From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:41514 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752131AbdLLKMA (ORCPT ); Tue, 12 Dec 2017 05:12:00 -0500 Subject: Patch "fcntl: don't leak fd reference when fixup_compat_flock fails" has been added to the 4.14-stable tree To: jlayton@redhat.com, alexander.levin@verizon.com, gregkh@linuxfoundation.org Cc: , From: Date: Tue, 12 Dec 2017 11:11:21 +0100 Message-ID: <1513073481127172@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: 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 know about it. >>From foo@baz Tue Dec 12 10:32:42 CET 2017 From: Jeff Layton Date: Tue, 14 Nov 2017 14:43:56 -0500 Subject: fcntl: don't leak fd reference when fixup_compat_flock fails From: Jeff Layton [ 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 Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- 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@redhat.com are queue-4.14/fcntl-don-t-leak-fd-reference-when-fixup_compat_flock-fails.patch