[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250915182235.77a556c4@kernel.org>
Date: Mon, 15 Sep 2025 18:22:35 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Duoming Zhou <duoming@....edu.cn>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org, pabeni@...hat.com,
edumazet@...gle.com, davem@...emloft.net, andrew+netdev@...n.ch
Subject: Re: [PATCH net] cnic: Fix use-after-free bugs in cnic_delete_task
On Sun, 14 Sep 2025 11:43:35 +0800 Duoming Zhou wrote:
> The original code uses cancel_delayed_work() in cnic_cm_stop_bnx2x_hw(),
> which does not guarantee that the delayed work item 'delete_task' has
> fully completed if it was already running. Additionally, the delayed work
> item is cyclic, flush_workqueue() in cnic_cm_stop_bnx2x_hw() could not
> prevent the new incoming ones. This leads to use-after-free scenarios
> where the cnic_dev is deallocated by cnic_free_dev(), while delete_task
> remains active and attempt to dereference cnic_dev in cnic_delete_task().
[snip]
> Replace cancel_delayed_work() with cancel_delayed_work_sync() to ensure
> that the delayed work item is properly canceled and any executing delayed
> work has finished before the cnic_dev is deallocated.
Have you tested this on real HW? Please always include information on
how you discovered the problem and whether you managed to test the fix.
> Fixes: fdf24086f475 ("cnic: Defer iscsi connection cleanup")
> Signed-off-by: Duoming Zhou <duoming@....edu.cn>
> cnic_bnx2x_delete_wait(dev, 0);
>
> - cancel_delayed_work(&cp->delete_task);
> + cancel_delayed_work_sync(&cp->delete_task);
> flush_workqueue(cnic_wq);
AFAICT your patch is a nop, doubt this if fixing anything
> if (atomic_read(&cp->iscsi_conn) != 0)
--
pw-bot: cr
pv-bot: s
Powered by blists - more mailing lists