Re: [PATCH] bpf: Fix NULL deref in __list_del_clearprev for flush_node

From: Alexei Starovoitov

Date: Mon Dec 15 2025 - 23:06:31 EST


On Mon, Dec 15, 2025 at 7:14 PM <donglaipang@xxxxxxx> wrote:
>
> From: DLpang <donglaipang@xxxxxxx>
>
> #syz test
>
> Hi,
>
> This patch fixes a NULL pointer dereference in the BPF subsystem that occurs
> when __list_del_clearprev() is called on an already-cleared flush_node list_head.
>
> The fix includes two parts:
> 1. Properly initialize the flush_node list_head during per-CPU bulk queue allocation
> using INIT_LIST_HEAD(&bq->flush_node)
> 2. Add defensive checks before calling __list_del_clearprev() to ensure the node
> is actually in the list by checking if (bq->flush_node.prev)
>
> According to the __list_del_clearprev documentation in include/linux/list.h,
> 'The code that uses this needs to check the node 'prev' pointer instead of calling list_empty()'.
>
> This patch fixes the following syzbot-reported issue:
> https://syzkaller.appspot.com/bug?extid=2b3391f44313b3983e91
>
> Reported-by: syzbot+2b3391f44313b3983e91@xxxxxxxxxxxxxxxxxxxxxxxxx
> Closes: https://syzkaller.appspot.com/bug?extid=2b3391f44313b3983e91
> Signed-off-by: DLpang <donglaipang@xxxxxxx>

If you're going to throw AI slop at us, please do your homework
and root cause the issue.
Nothing in this AI generated commit log explains the bug.

pw-bot: cr