[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5493ec79-7f64-47cd-972e-2ad0935f27b2@intel.com>
Date: Mon, 28 Oct 2024 11:33:39 -0700
From: Jacob Keller <jacob.e.keller@...el.com>
To: Jeremy Kerr <jk@...econstruct.com.au>, Andrew Lunn
<andrew+netdev@...n.ch>, "David S. Miller" <davem@...emloft.net>, "Eric
Dumazet" <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
<pabeni@...hat.com>, Joel Stanley <joel@....id.au>, Jacky Chou
<jacky_chou@...eedtech.com>
CC: <netdev@...r.kernel.org>
Subject: Re: [PATCH net 1/2] net: ethernet: ftgmac100: prevent use after free
on unregister when using NCSI
On 10/27/2024 9:54 PM, Jeremy Kerr wrote:
> When removing an active ftgmac100 netdev that is configured for NCSI, we
> have a double free of the ncsi device: We currently unregister the ncsi
> device (freeing it), then unregister the netdev itself. If the netdev is
> running, the netdev_unregister() path performs a ->ndo_stop(), which
> calls ncsi_stop_dev() on the now-free ncsi pointer.
>
> Instead, modify ftgmac100_stop() to check the ncsi pointer before
> freeing (rather than use_ncsi, which reflects configuration intent), and
> clear the pointer once we have done the ncsi_unregister().
>
> Fixes: 3d5179458d22 ("net: ftgmac100: Fix crash when removing driver")
> Signed-off-by: Jeremy Kerr <jk@...econstruct.com.au>
> ---
Reviewed-by: Jacob Keller <jacob.e.keller@...el.com>
Powered by blists - more mailing lists