All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Daniel Golle <daniel@makrotopia.org>
Cc: andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	linux@armlinux.org.uk, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH net-next v5 2/4] net: dsa: mxl862xx: move phylink stubs to mxl862xx-phylink.c
Date: Thu, 11 Jun 2026 16:21:03 +0100	[thread overview]
Message-ID: <20260611152103.GT3920875@horms.kernel.org> (raw)
In-Reply-To: <aiq4GEDlCok3B2lT@makrotopia.org>

On Thu, Jun 11, 2026 at 02:28:56PM +0100, Daniel Golle wrote:
> On Thu, Jun 11, 2026 at 02:07:51PM +0100, Simon Horman wrote:
> > This is an AI-generated review of your patch. The human sending this
> > email has considered the AI review valid, or at least plausible.
> > Full review at: https://sashiko.dev
> > ---
> > net: dsa: mxl862xx: move phylink stubs to mxl862xx-phylink.c
> > 
> > Move the phylink MAC operations and get_caps callback from mxl862xx.c
> > into a dedicated mxl862xx-phylink.c file. This prepares for the SerDes
> > PCS implementation which adds substantial phylink/PCS code.
> > 
> > > diff --git a/drivers/net/dsa/mxl862xx/mxl862xx.c b/drivers/net/dsa/mxl862xx/mxl862xx.c
> > > index 2f22adedfbf67..a193f3c07d359 100644
> > > --- a/drivers/net/dsa/mxl862xx/mxl862xx.c
> > > +++ b/drivers/net/dsa/mxl862xx/mxl862xx.c
> > 
> > [ ... ]
> > 
> > [Severity: Critical]
> > This is a pre-existing issue, but the crc_err_work can execute after
> > dsa_unregister_switch(), leading to a use-after-free of ds->dst and
> > dsa_port structures.
> > 
> > In mxl862xx_remove(), dsa_unregister_switch() is called before the
> > asynchronous crc_err_work is cancelled via mxl862xx_host_shutdown():
> > 
> > drivers/net/dsa/mxl862xx/mxl862xx.c:mxl862xx_remove() {
> > 	...
> > 	dsa_unregister_switch(ds);
> > 
> > 	mxl862xx_host_shutdown(priv);
> > 	...
> > }
> > 
> > dsa_unregister_switch() tears down the DSA tree, frees all dsa_port
> > objects, and drops the reference to ds->dst.
> > 
> > If mxl862xx_crc_err_work_fn executes concurrently or after
> > dsa_unregister_switch() has returned, it traverses already freed
> > dsa_port entries:
> > 
> > drivers/net/dsa/mxl862xx/mxl862xx-host.c:mxl862xx_crc_err_work_fn() {
> > 	...
> > 	dsa_switch_for_each_cpu_port(dp, priv->ds)
> > 		dev_close(dp->conduit);
> > 	...
> > }
> > 
> > Could this order in mxl862xx_remove() result in a use-after-free, and
> > should mxl862xx_host_shutdown() be called before dsa_unregister_switch()?
> 
> To really address this a guard in mxl862xx_host_shutdown() will be
> needed. I'd rather do this in a separate Fixes:-patch targetting 'net'
> rather than in this series targetting 'net-next', right?

Yes, that sounds like a good approach to me.

  reply	other threads:[~2026-06-11 15:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09  1:25 [PATCH net-next v5 0/4] net: dsa: mxl862xx: SerDes ports Daniel Golle
2026-06-09  1:25 ` [PATCH net-next v5 1/4] net: dsa: mxl862xx: store firmware version for feature gating Daniel Golle
2026-06-09  1:25 ` [PATCH net-next v5 2/4] net: dsa: mxl862xx: move phylink stubs to mxl862xx-phylink.c Daniel Golle
2026-06-11 13:07   ` Simon Horman
2026-06-11 13:28     ` Daniel Golle
2026-06-11 15:21       ` Simon Horman [this message]
2026-06-09  1:26 ` [PATCH net-next v5 3/4] net: dsa: mxl862xx: move API macros to mxl862xx-host.h Daniel Golle
2026-06-09  1:26 ` [PATCH net-next v5 4/4] net: dsa: mxl862xx: add support for SerDes ports Daniel Golle
2026-06-11 13:10   ` Simon Horman
2026-06-11 13:27     ` Daniel Golle

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=20260611152103.GT3920875@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.