Skip to contentSkip to conversation

Patch "fcntl: don't leak fd reference when fixup_compat_flock fails" has been added to the 4.14-stable tree

PATCH [email protected] 1 participant 1 message Dec 12, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

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 <[email protected]> know about it.

Quoted 1 line

From foo@baz Tue Dec 12 10:32:42 CET 2017

From: Jeff Layton <[email protected]>
Date: Tue, 14 Nov 2017 14:43:56 -0500
Subject: fcntl: don't leak fd reference when fixup_compat_flock fails

From: Jeff Layton <[email protected]>

[ 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)
---
 fs/fcntl.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
fs/fcntl.c +2 -3
@@ -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 [email protected] are

queue-4.14/fcntl-don-t-leak-fd-reference-when-fixup_compat_flock-fails.patch