[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAvyFNjipHCvhy0=1T1JDFAFFUDvL_wOVFFGpdyNqY_SOVNfgQ@mail.gmail.com>
Date: Thu, 25 Jul 2024 08:54:44 +1000
From: Jamie Bainbridge <jamie.bainbridge@...il.com>
To: Johannes Berg <johannes@...solutions.net>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Jiri Pirko <jiri@...nulli.us>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net 1/4] net-sysfs: check device is present when showing carrier
On Wed, 24 Jul 2024 at 19:42, Johannes Berg <johannes@...solutions.net> wrote:
>
> 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
You are correct, patch 2 (duplex) is the one where we panicked during
device reset. I thought to fix the other "show" functions in advance
while I was there.
I will revise this and re-submit with only the necessary patch.
Thanks for the review, it is appreciated.
Jamie
Powered by blists - more mailing lists