From: Xiaotian Feng <[email protected]>

There's a name leak introduced by commit 91a27b2a7567 ("vfs: define
struct filename and have getname() return it").  Add the missing
putname.

[[email protected]: cleanup]
Signed-off-by: Xiaotian Feng <[email protected]>
Reviewed-by: Jeff Layton <[email protected]>
Cc: Al Viro <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>

Cc: <[email protected]> # 3.6.x
Upstream-ID: f58b59c1df3cb990d644018e1461cd4acd3c1700
Stable-Trees: 3.6
Signed-off-by: Peter Huewe <[email protected]>
---
Submitted for stable inclusion

 mm/swapfile.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/swapfile.c b/mm/swapfile.c
index 14e254c..116d026 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1494,9 +1494,8 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
        BUG_ON(!current->mm);
 
        pathname = getname(specialfile);
-       err = PTR_ERR(pathname);
        if (IS_ERR(pathname))
-               goto out;
+               return PTR_ERR(pathname);
 
        victim = filp_open(pathname, O_RDWR|O_LARGEFILE, 0);
        putname(pathname);
@@ -1609,6 +1608,7 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
 out_dput:
        filp_close(victim, NULL);
 out:
+       putname(pathname);
        return err;
 }
 
-- 
1.7.8.6

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to