* [PATCH] fcntl: don't leak fd reference when fixup_compat_flock fails
@ 2017-11-14 20:24 Jeff Layton
0 siblings, 0 replies; only message in thread
From: Jeff Layton @ 2017-11-14 20:24 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Vitaly Lipatov, hch, bfields, Alexander Viro, linux-kernel
From: Jeff Layton <jlayton@redhat.com>
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>
---
fs/fcntl.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
I don't have a great way to test this. There's another similar bug in
the F_GETLK64 case as well, but Vitaly is looking at another problem
there.
diff --git a/fs/fcntl.c b/fs/fcntl.c
index e44a95dd3f86..0793eca4d0ec 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:
--
2.14.3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2017-11-14 20:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-14 20:24 [PATCH] fcntl: don't leak fd reference when fixup_compat_flock fails Jeff Layton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).