From: Andrew Lunn <andrew@lunn.ch>
To: Stefano Munari <stefanomunari.sm@gmail.com>
Cc: netdev@vger.kernel.org,
Thangaraj Samynathan <Thangaraj.S@microchip.com>,
UNGLinuxDriver@microchip.com, Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Nisar Sayed <Nisar.Sayed@microchip.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net: usb: lan78xx: reject invalid EEPROM write requests
Date: Fri, 9 Oct 2026 03:27:25 +0200 [thread overview]
Message-ID: <cc1a471e-ba76-4fe5-a982-0cbe1775c915@lunn.ch> (raw)
In-Reply-To: <20261009005702.164936-1-stefanomunari.sm@gmail.com>
On Fri, Oct 09, 2026 at 02:57:02AM +0200, Stefano Munari wrote:
> The runtime PM handling removed the -EINVAL return for invalid
> EEPROM/OTP write requests. These requests now return zero from a
> successful usb_autopm_get_interface() call, even though no data is
> written.
>
> Set ret to -EINVAL for invalid requests while preserving the runtime
> PM reference release.
>
> Fixes: 8a7ffeb795f8 ("lan78xx: Fix for eeprom read/write when device auto suspend")
> Signed-off-by: Stefano Munari <stefanomunari.sm@gmail.com>
> ---
> Tested on a Raspberry Pi 3 Model B+ with the onboard Ethernet
> controller, using raspberrypi/linux commit bba53a117a4a on the
> rpi-6.6.y branch as the baseline.
>
> ethtool -E eth0 magic 0 offset 0 length 1 value 0
>
> The command succeeds without the patch and reports "Invalid argument"
> with the patch applied.
> ---
> drivers/net/usb/lan78xx.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
> index 5655941f1478..7ac263454d45 100644
> --- a/drivers/net/usb/lan78xx.c
> +++ b/drivers/net/usb/lan78xx.c
> @@ -1719,6 +1719,8 @@ static int lan78xx_ethtool_set_eeprom(struct net_device *netdev,
> (ee->len == 512) &&
> (data[0] == OTP_INDICATOR_1))
> ret = lan78xx_write_raw_otp(dev, ee->offset, ee->len, data);
> + else
> + ret = -EINVAL;
It might be the nested if's without {} which caused the broken patch?
Maybe add some brackets to make it clearer?
Andrew
next prev parent reply other threads:[~2026-10-09 1:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 0:57 [PATCH net] net: usb: lan78xx: reject invalid EEPROM write requests Stefano Munari
2026-10-09 1:02 ` sashiko-bot
2026-10-09 1:27 ` Andrew Lunn [this message]
2026-10-09 8:28 ` Nicolai Buchwitz
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=cc1a471e-ba76-4fe5-a982-0cbe1775c915@lunn.ch \
--to=andrew@lunn.ch \
--cc=Nisar.Sayed@microchip.com \
--cc=Thangaraj.S@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stefanomunari.sm@gmail.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