Commit d30a5694 authored by Jeff Layton's avatar Jeff Layton Committed by Treehugger Robot
Browse files

UPSTREAM: filelock: fix potential use-after-free in posix_lock_inode

[ Upstream commit 1b3ec4f7 ]

Light Hsieh reported a KASAN UAF warning in trace_posix_lock_inode().
The request pointer had been changed earlier to point to a lock entry
that was added to the inode's list. However, before the tracepoint could
fire, another task raced in and freed that lock.

Fix this by moving the tracepoint inside the spinlock, which should
ensure that this doesn't happen.

Bug: 370263554
Fixes: 74f6f591 ("locks: fix KASAN: use-after-free in trace_event_raw_event_filelock_lock")
Link: https://lore.kernel.org/linux-fsdevel/724ffb0a2962e912ea62bb0515deadf39c325112.camel@kernel.org/


Reported-by: default avatarLight Hsieh (謝明燈) <Light.Hsieh@mediatek.com>
Change-Id: I59f2653b8041f2d8397f5e95538432ac303f349a
Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
Link: https://lore.kernel.org/r/20240702-filelock-6-10-v1-1-96e766aadc98@kernel.org


Reviewed-by: default avatarAlexander Aring <aahringo@redhat.com>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 1a453675
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment