[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <198a796d5855759ca8561590d848c52028378971.camel@codeconstruct.com.au>
Date: Wed, 30 Oct 2024 08:29:05 +0800
From: Jeremy Kerr <jk@...econstruct.com.au>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Andrew Lunn <andrew@...n.ch>, Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet
<edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Joel Stanley
<joel@....id.au>, Jacky Chou <jacky_chou@...eedtech.com>, Jacob Keller
<jacob.e.keller@...el.com>, netdev@...r.kernel.org
Subject: Re: [PATCH net 1/2] net: ethernet: ftgmac100: prevent use after
free on unregister when using NCSI
Hi Jakub,
> > As the ordering in ftgmac100_remove() is:
> >
> >
> > if (priv->ndev)
> > ncsi_unregister_dev(priv->ndev);
> > unregister_netdev(netdev);
> >
> > which, is (I assume intentionally) symmetric with the _probe, which
> > does:
> >
> > priv->ndev = ncsi_register_dev(netdev, ftgmac100_ncsi_handler);
> >
> > /* ... */
> >
> > register_netdev(netdev)
>
> To be clear - symmetric means mirror image.
Totally agree with you both on the concept, but I had flipped the
unregister order in my head, sorry!
So, this worth a try with the _remove sequence reordered with respect
to the ncsi device. I'll work on a replacement patch to see if that can
be done without other fallout, and will send a follow-up soon.
Cheers,
Jeremy
Powered by blists - more mailing lists