summaryrefslogtreecommitdiff
path: root/tools/lib/python/kdoc
diff options
context:
space:
mode:
authorKyle Zeng <kylebot@openai.com>2026-10-02 06:17:05 +0000
committerChristian Brauner <brauner@kernel.org>2026-10-12 10:46:23 +0200
commit10393682225508d9791f560546eef0b5b38e1fbb (patch)
tree328ab397864a23e7e9b0e031af4a92261aaf9304 /tools/lib/python/kdoc
parent56d5dcb2d6d59c8e2d0626e23dda50ce9f0fcd9d (diff)
downloadlinux-next-10393682225508d9791f560546eef0b5b38e1fbb.tar.gz
linux-next-10393682225508d9791f560546eef0b5b38e1fbb.zip
pipe: preserve existing fasync readers on writer setup failure
F_SETFL and FIOASYNC decide whether to invoke ->fasync() before pipe_fasync() takes pipe->mutex. Two enables of one O_RDWR FIFO can therefore both enter the callback. fasync_helper() allocates before checking for an existing entry. If the first enable installs both entries, a second enable can update the reader entry and then fail the allocation for the writer entry. The error path removes the pre-existing reader entry, clearing FASYNC while the writer entry remains registered. __fput() then skips ->fasync(), so a later pipe notification can dereference the freed file or its f_owner. An unprivileged memory-pressure reproducer triggers a KASAN slab-use-after-free in send_sigio() through this path. Keep the reader helper's result and undo the registration only if this call added it. The pipe mutex serializes changes to both lists, so a failed new registration still removes its reader, while a failed duplicate preserves the existing registrations and FASYNC. Successful duplicate enables continue to update fa_fd as before. Fixes: 76398425bb06 ("Move FASYNC bit handling to f_op->fasync()") Signed-off-by: Kyle Zeng <kylebot@openai.com> Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'tools/lib/python/kdoc')
0 files changed, 0 insertions, 0 deletions