[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ba1883f3-7367-47af-a81d-3a59b6d12fea@redhat.com>
Date: Tue, 24 Sep 2024 11:10:40 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Eddie James <eajames@...ux.ibm.com>, sam@...dozajonas.com
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
gwshan@...ux.vnet.ibm.com, joel@....id.au, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net/ncsi: Cancel the ncsi work before freeing the
associated structure
On 9/17/24 21:12, Eddie James wrote:
> The work function can run after the ncsi device is freed, resulting
> in use-after-free bugs or kernel panic.
>
> Fixes: 2d283bdd079c ("net/ncsi: Resource management")
> Signed-off-by: Eddie James <eajames@...ux.ibm.com>
> ---
> net/ncsi/ncsi-manage.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c
> index 5ecf611c8820..3eda24eac668 100644
> --- a/net/ncsi/ncsi-manage.c
> +++ b/net/ncsi/ncsi-manage.c
> @@ -1954,6 +1954,8 @@ void ncsi_unregister_dev(struct ncsi_dev *nd)
> list_del_rcu(&ndp->node);
> spin_unlock_irqrestore(&ncsi_dev_lock, flags);
>
> + cancel_work_sync(&ndp->work);
Possibly disable_work_sync(), just to be on the safe side?
Thanks,
Paolo
Powered by blists - more mailing lists