This is a note to let you know that I've just added the patch titled fcntl: don't leak fd reference when fixup_compat_flock fails to the 4.14-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: fcntl-don-t-leak-fd-reference-when-fixup_compat_flock-fails.patch and it can be found in the queue-4.14 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Tue Dec 12 10:32:42 CET 2017 From: Jeff Layton <jlayton@xxxxxxxxxx> Date: Tue, 14 Nov 2017 14:43:56 -0500 Subject: fcntl: don't leak fd reference when fixup_compat_flock fails From: Jeff Layton <jlayton@xxxxxxxxxx> [ 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@xxxxxxxxxx> Signed-off-by: Sasha Levin <alexander.levin@xxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/fcntl.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/fs/fcntl.c +++ b/fs/fcntl.c @@ -632,9 +632,8 @@ COMPAT_SYSCALL_DEFINE3(fcntl64, unsigned 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: Patches currently in stable-queue which might be from jlayton@xxxxxxxxxx are queue-4.14/fcntl-don-t-leak-fd-reference-when-fixup_compat_flock-fails.patch