summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2017-11-14 14:43:56 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-12-14 09:53:11 +0100
commit6e9c2a05c368a0b53d5b6647798e67830f5508e0 (patch)
tree3ef906dde16d8dc4024b9ce8c6263c66cd0a5026
parent0c7e787bfc91cb374b60ba5fe7055178c94a7cb7 (diff)
downloadlinux-stable-6e9c2a05c368a0b53d5b6647798e67830f5508e0.tar.gz
linux-stable-6e9c2a05c368a0b53d5b6647798e67830f5508e0.tar.bz2
linux-stable-6e9c2a05c368a0b53d5b6647798e67830f5508e0.zip
fcntl: don't leak fd reference when fixup_compat_flock fails
[ Upstream commit 9280a601e6080c9ff658468c1c775ff6514099a6 ] Currently we just return err here, but we need to put the fd reference first. Fixes: 94073ad77fff (fs/locks: don't mess with the address limit in compat_fcntl64) Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/fcntl.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/fcntl.c b/fs/fcntl.c
index 8d78ffd7b399..6fd311367efc 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -632,9 +632,8 @@ COMPAT_SYSCALL_DEFINE3(fcntl64, unsigned int, fd, unsigned int, cmd,
if (err)
break;
err = fixup_compat_flock(&flock);
- if (err)
- return err;
- err = put_compat_flock(&flock, compat_ptr(arg));
+ if (!err)
+ err = put_compat_flock(&flock, compat_ptr(arg));
break;
case F_GETLK64:
case F_OFD_GETLK: