netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeremy Kerr <jk@codeconstruct.com.au>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Andrew Lunn <andrew@lunn.ch>, Andrew Lunn <andrew+netdev@lunn.ch>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Joel Stanley <joel@jms.id.au>,
	Jacky Chou <jacky_chou@aspeedtech.com>,
	Jacob Keller <jacob.e.keller@intel.com>,
	netdev@vger.kernel.org,
	Samuel Mendoza-Jonas <sam@mendozajonas.com>
Subject: Re: [PATCH net 1/2] net: ethernet: ftgmac100: prevent use after free on unregister when using NCSI
Date: Wed, 30 Oct 2024 10:58:21 +0800	[thread overview]
Message-ID: <040df8130f6dffc4c4e519dc9241e1c35ed819ca.camel@codeconstruct.com.au> (raw)
In-Reply-To: <198a796d5855759ca8561590d848c52028378971.camel@codeconstruct.com.au>

Hi all,

[+Sam, as ncsi maintainer]

> 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.

OK, not so simple. ftgmac100_probe does a:
  
    ncsi_register_dev()
      -> dev_add_pack()
    register_netdev()

- where ptype.dev is the ftgmac netdev.

So we'd want to restructure the _remove to do:

    unregister_netdev()
    ncsi_unregister_dev()
     -> dev_remove_pack()

However, we (sensibly) can't do the unregister_netdev() with a
packet-type handler still in place.

Sam: would it make sense to move the dev_add_pack() / dev_remove_pack()
to the ncsi layer's ncsi_start_dev() / ncsi_stop_dev() ? The channel
monitor is disabled on stop, so we shouldn't expect to receive any
further NCSI ethertype packets.

Cheers,


Jeremy

  reply	other threads:[~2024-10-30  2:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-28  4:54 [PATCH net 0/2] net: ethernet: ftgmac100: fixes for ncsi/phy handling on device remove Jeremy Kerr
2024-10-28  4:54 ` [PATCH net 1/2] net: ethernet: ftgmac100: prevent use after free on unregister when using NCSI Jeremy Kerr
2024-10-28 18:33   ` Jacob Keller
2024-10-28 20:15   ` Andrew Lunn
2024-10-29  4:32     ` Jeremy Kerr
2024-10-29 12:37       ` Andrew Lunn
2024-10-29 14:10         ` Jeremy Kerr
2024-10-29 22:36       ` Jakub Kicinski
2024-10-30  0:29         ` Jeremy Kerr
2024-10-30  2:58           ` Jeremy Kerr [this message]
2024-10-30  9:02             ` Sam Mendoza-Jonas
2024-10-28  4:54 ` [PATCH net 2/2] net: ethernet: ftgmac100: fix NULL phy usage on device remove Jeremy Kerr
2024-10-28  5:58   ` 回覆: " Jacky Chou
2024-10-28 18:34   ` Jacob Keller
2024-10-28 20:23   ` Andrew Lunn
2024-10-29  4:36     ` Jeremy Kerr
2024-10-29 12:41       ` Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=040df8130f6dffc4c4e519dc9241e1c35ed819ca.camel@codeconstruct.com.au \
    --to=jk@codeconstruct.com.au \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jacky_chou@aspeedtech.com \
    --cc=jacob.e.keller@intel.com \
    --cc=joel@jms.id.au \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sam@mendozajonas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).