[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iLwvqUJHBNifLESJyBQ85qjK42sK85Fs=QV4M7HqUXmxQ@mail.gmail.com>
Date: Mon, 25 Apr 2022 08:13:40 -0700
From: Eric Dumazet <edumazet@...gle.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Jann Horn <jannh@...gle.com>, Lukas Wunner <lukas@...ner.de>,
Paolo Abeni <pabeni@...hat.com>,
Oliver Neukum <oneukum@...e.com>,
"David S. Miller" <davem@...emloft.net>,
Oleksij Rempel <o.rempel@...gutronix.de>,
netdev <netdev@...r.kernel.org>,
USB list <linux-usb@...r.kernel.org>,
Andrew Lunn <andrew@...n.ch>,
Jacky Chou <jackychou@...x.com.tw>, Willy Tarreau <w@....eu>,
Lino Sanfilippo <LinoSanfilippo@....de>,
Philipp Rosenberger <p.rosenberger@...bus.com>,
Heiner Kallweit <hkallweit1@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH] net: linkwatch: ignore events for unregistered netdevs
On Mon, Apr 25, 2022 at 8:01 AM Jakub Kicinski <kuba@...nel.org> wrote:
>
> On Mon, 25 Apr 2022 16:49:34 +0200 Jann Horn wrote:
> > > Doesn't mean we should make it legal. We can add a warning to catch
> > > abuses.
> >
> > That was the idea with
> > https://lore.kernel.org/netdev/20220128014303.2334568-1-jannh@google.com/,
> > but I didn't get any replies when I asked what the precise semantics
> > of dev_hold() are supposed to be
> > (https://lore.kernel.org/netdev/CAG48ez1-OyZETvrYAfaHicYW1LbrQUVp=C0EukSWqZrYMej73w@mail.gmail.com/),
> > so I don't know how to proceed...
>
> Yeah, I think after you pointed out that the netdev per cpu refcounting
> is fundamentally broken everybody decided to hit themselves with the
> obliviate spell :S
dev_hold() has been an increment of a refcount, and dev_put() a decrement.
Not sure why it is fundamentally broken.
There are specific steps at device dismantles making sure no more
users can dev_hold()
It is a contract. Any buggy layer can overwrite any piece of memory,
including a refcount_t.
Traditionally we could not add a test in dev_hold() to prevent an
increment if the device is in dismantle phase.
Maybe the situation is better nowadays.
Powered by blists - more mailing lists