From: Greg KH <gregkh@linuxfoundation.org>
To: Long Li <leo.lilong@huawei.com>
Cc: stable@vger.kernel.org, jannh@google.com, yangerkun@huawei.com
Subject: Re: [PATCH 5.4] filelock: Correct the filelock owner in fcntl_setlk/fcntl_setlk64
Date: Fri, 30 Aug 2024 13:13:29 +0200 [thread overview]
Message-ID: <2024083007-goes-banter-58c6@gregkh> (raw)
In-Reply-To: <20240816050627.2122228-1-leo.lilong@huawei.com>
On Fri, Aug 16, 2024 at 01:06:27PM +0800, Long Li wrote:
> The locks_remove_posix() function in fcntl_setlk/fcntl_setlk64 is designed
> to reliably remove locks when an fcntl/close race is detected. However, it
> was passing in the wrong filelock owner, it looks like a mistake and
> resulting in a failure to remove locks. More critically, if the lock
> removal fails, it could lead to a uaf issue while traversing the locks.
>
> This problem occurs only in the 4.19/5.4 stable version.
>
> Fixes: 4c43ad4ab416 ("filelock: Fix fcntl/close race recovery compat path")
> Fixes: dc2ce1dfceaa ("filelock: Remove locks reliably when fcntl/close race is detected")
> Cc: stable@vger.kernel.org
> Signed-off-by: Long Li <leo.lilong@huawei.com>
> ---
> fs/locks.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/locks.c b/fs/locks.c
> index 85c8af53d4eb..cf6ed857664b 100644
> --- a/fs/locks.c
> +++ b/fs/locks.c
> @@ -2542,7 +2542,7 @@ int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd,
> f = fcheck(fd);
> spin_unlock(¤t->files->file_lock);
> if (f != filp) {
> - locks_remove_posix(filp, ¤t->files);
> + locks_remove_posix(filp, current->files);
Ick, sorry about this, that was my fault in my backport.
both now queued up, thanks.
greg k-h
prev parent reply other threads:[~2024-08-30 11:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-16 5:06 [PATCH 5.4] filelock: Correct the filelock owner in fcntl_setlk/fcntl_setlk64 Long Li
2024-08-30 11:13 ` Greg KH [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2024083007-goes-banter-58c6@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=jannh@google.com \
--cc=leo.lilong@huawei.com \
--cc=stable@vger.kernel.org \
--cc=yangerkun@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox