This is a note to let you know that I've just added the patch titled aio: Fix null ptr deref in aio_complete() wakeup to the 6.8-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: aio-fix-null-ptr-deref-in-aio_complete-wakeup.patch and it can be found in the queue-6.8 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From caeb4b0a11b3393e43f7fa8e0a5a18462acc66bd Mon Sep 17 00:00:00 2001 From: Kent Overstreet <kent.overstreet@xxxxxxxxx> Date: Sun, 31 Mar 2024 17:52:12 -0400 Subject: aio: Fix null ptr deref in aio_complete() wakeup From: Kent Overstreet <kent.overstreet@xxxxxxxxx> commit caeb4b0a11b3393e43f7fa8e0a5a18462acc66bd upstream. list_del_init_careful() needs to be the last access to the wait queue entry - it effectively unlocks access. Previously, finish_wait() would see the empty list head and skip taking the lock, and then we'd return - but the completion path would still attempt to do the wakeup after the task_struct pointer had been overwritten. Fixes: 71eb6b6b0ba9 ("fs/aio: obey min_nr when doing wakeups") Cc: stable@xxxxxxxxxxxxxxx Link: https://lore.kernel.org/linux-fsdevel/CAHTA-ubfwwB51A5Wg5M6H_rPEQK9pNf8FkAGH=vr=FEkyRrtqw@xxxxxxxxxxxxxx/ Signed-off-by: Kent Overstreet <kent.overstreet@xxxxxxxxx> Link: https://lore.kernel.org/stable/20240331215212.522544-1-kent.overstreet%40linux.dev Link: https://lore.kernel.org/r/20240331215212.522544-1-kent.overstreet@xxxxxxxxx Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/aio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/aio.c +++ b/fs/aio.c @@ -1202,8 +1202,8 @@ static void aio_complete(struct aio_kioc spin_lock_irqsave(&ctx->wait.lock, flags); list_for_each_entry_safe(curr, next, &ctx->wait.head, w.entry) if (avail >= curr->min_nr) { - list_del_init_careful(&curr->w.entry); wake_up_process(curr->w.private); + list_del_init_careful(&curr->w.entry); } spin_unlock_irqrestore(&ctx->wait.lock, flags); } Patches currently in stable-queue which might be from kent.overstreet@xxxxxxxxx are queue-6.8/mean_and_variance-drop-always-failing-tests.patch queue-6.8/aio-fix-null-ptr-deref-in-aio_complete-wakeup.patch