[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240808081054.1291238d@kernel.org>
Date: Thu, 8 Aug 2024 08:10:54 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Jamie Bainbridge <jamie.bainbridge@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
<edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Johannes Berg
<johannes@...solutions.net>, Shigeru Yoshida <syoshida@...hat.com>, Simon
Horman <horms@...nel.org>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH net v4] net-sysfs: check device is present when showing
duplex
On Tue, 6 Aug 2024 16:35:27 +1000 Jamie Bainbridge wrote:
> A sysfs reader can race with a device reset or removal, attempting to
> read device state when the device is not actually present.
True, but..
> - if (netif_running(netdev)) {
> + if (netif_running(netdev) && netif_device_present(netdev)) {
> struct ethtool_link_ksettings cmd;
>
> if (!__ethtool_get_link_ksettings(netdev, &cmd)) {
..there are more callers of __ethtool_get_link_ksettings() and only
a fraction of them have something resembling a presence check in
their path. Can we put the check inside __ethtool_get_link_ksettings()
itself?
Powered by blists - more mailing lists