From: Johannes Berg <johannes@sipsolutions.net>
To: Jamie Bainbridge <jamie.bainbridge@gmail.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Jiri Pirko <jiri@resnulli.us>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net 1/4] net-sysfs: check device is present when showing carrier
Date: Wed, 24 Jul 2024 11:41:56 +0200 [thread overview]
Message-ID: <0042d3c7d695ed7b253ccbc7786888dc3b400867.camel@sipsolutions.net> (raw)
In-Reply-To: <c20dcbc18af57f235974c9e5503491ea07a3ce99.camel@sipsolutions.net>
On Wed, 2024-07-24 at 11:35 +0200, Johannes Berg wrote:
> On Wed, 2024-07-24 at 01:46 +0000, Jamie Bainbridge wrote:
> > A sysfs reader can race with a device reset or removal.
>
> Kind of, yes, but please check what the race actually is.
>
> > This was fixed for speed_show with commit 4224cfd7fb65 ("net-sysfs: add
> > check for netdevice being present to speed_show") so add the same check
> > to carrier_show.
>
> You didn't say why it's needed here, so ... why is it?
>
> FWIW, I don't think it actually _is_ needed, since the netdev struct
> itself is still around, linkwatch_sync_dev() will not do anything that's
> not still needed anyway (the removal from list must clearly either still
> happen or nothing happens in the function). This will not call into the
> driver (which would be the problematic part).
>
> So while I don't think this is _wrong_ per se, I also don't think it's
> necessary, nor are you demonstrating that it is.
>
> And for userspace it should be pretty much immaterial whether it gets a
> real value or -EINVAL in the race, or -ENOENT because the file
> disappeared anyway?
>
All of which, btw, is also true for patches 3 and 4 in this set.
For patch 2 it seems applicable.
I do wonder if ethtool itself, at least ethtool netlink, doesn't have a
similar problem though, since it just uses netdev_get_by_name() /
netdev_get_by_index()?
johannes
next prev parent reply other threads:[~2024-07-24 9:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1721784184.git.jamie.bainbridge@gmail.com>
2024-07-24 1:46 ` Jamie Bainbridge
2024-07-24 9:35 ` Johannes Berg
2024-07-24 9:41 ` Johannes Berg [this message]
2024-07-24 22:54 ` Jamie Bainbridge
2024-07-25 2:22 ` Shigeru Yoshida
2024-07-24 1:46 ` [PATCH net 2/4] net-sysfs: check device is present when showing duplex Jamie Bainbridge
2024-07-24 1:46 ` [PATCH net 3/4] net-sysfs: check device is present when showing testing Jamie Bainbridge
2024-07-24 10:35 ` Andrew Lunn
2024-07-24 1:46 ` [PATCH net 4/4] net-sysfs: check device is present when showing dormant Jamie Bainbridge
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=0042d3c7d695ed7b253ccbc7786888dc3b400867.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jamie.bainbridge@gmail.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--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
all inboxes | Powered by JetHome®