From: Daniel Golle <daniel@makrotopia.org>
To: Simon Horman <horms@kernel.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 14:28:56 +0100 [thread overview]
Message-ID: <aiq4GEDlCok3B2lT@makrotopia.org> (raw)
In-Reply-To: <20260611130750.575946-2-horms@kernel.org>
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?
next prev parent reply other threads:[~2026-06-11 13:29 UTC|newest]
Thread overview: 9+ 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 [this message]
2026-06-11 15:21 ` Simon Horman
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
[not found] ` <20260611131043.578836-2-horms@kernel.org>
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=aiq4GEDlCok3B2lT@makrotopia.org \
--to=daniel@makrotopia.org \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox