All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Artem Novak" <artem122novak@gmail.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH net 1/2] net: usb: smsc95xx: propagate MDIO reset errors
Date: Sun, 15 Nov 2026 05:10:11 +0000	[thread overview]
Message-ID: <sashiko-outbox-215232@kernel.org> (raw)
In-Reply-To: <20261114050954.275495-2-artem122novak@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] net: usb: smsc95xx: smsc95xx_mdiobus_reset() returns 4 on
  success
--

commit 2539b52a07146a1a92198f65c494924038af75bf
Author: Artem Novak <artem122novak@gmail.com>

net: usb: smsc95xx: propagate MDIO reset errors

This commit changes smsc95xx_mdiobus_reset() to return ret instead of 0
so that register access errors during external PHY reset are propagated
to callers.

> diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
> index 130a460c1f546..f85ee5f8a5394 100644
> --- a/drivers/net/usb/smsc95xx.c
> +++ b/drivers/net/usb/smsc95xx.c
> @@ -291,7 +291,7 @@ static int smsc95xx_mdiobus_reset(struct mii_bus *bus)
>  reset_out:
>  	mutex_unlock(&dev->phy_mutex);
>  
> -	return 0;
> +	return ret;
>  }
>  
>  static int smsc95xx_mdiobus_read(struct mii_bus *bus, int phy_id, int idx)

[Severity: High]
Does smsc95xx_mdiobus_reset() now return 4 on success for devices with an
external PHY?

smsc95xx_write_reg() returns the number of bytes written (4) on success,
and ret is not reset to 0 before reaching reset_out.  __mdiobus_register()
treats any non-zero return from bus->reset() as an error and returns 4 to
smsc95xx_bind(), which unwinds and frees pdata (leaving dev->driver_priv
dangling) and returns 4 to usbnet_probe().  Because usbnet_probe() only
aborts when status < 0, probe continues and registers the net_device with
a freed dev->driver_priv and a NULL phydev, leading to a use-after-free
in subsequent driver callbacks.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261114050954.275495-1-artem122novak@gmail.com?part=1

  parent reply	other threads:[~2026-11-15  5:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14  5:09 [PATCH net 0/2] net: usb: smsc95xx: propagate MDIO errors Artem Novak
2026-11-14  5:09 ` [PATCH net 1/2] net: usb: smsc95xx: propagate MDIO reset errors Artem Novak
2026-11-14 22:08   ` Andrew Lunn
2026-11-14 22:12     ` Artem Novak
2026-11-15  5:10   ` sashiko-bot [this message]
2026-11-15  5:21   ` netdev-bot+sashiko
2026-11-14  5:09 ` [PATCH net 2/2] net: usb: smsc95xx: propagate MDIO write errors Artem Novak
2026-11-14 22:10   ` Andrew Lunn
2026-11-14 22:13     ` Artem Novak
2026-11-15  5:10   ` sashiko-bot
2026-11-15  5:21   ` netdev-bot+sashiko
2026-11-14  5:12 ` [PATCH net 0/2] net: usb: smsc95xx: propagate MDIO errors netdev-bot+sinfo
2026-11-14  5:18   ` Artem Novak

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=sashiko-outbox-215232@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=artem122novak@gmail.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.