[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250324150425.32b3ec10@kernel.org>
Date: Mon, 24 Mar 2025 15:04:25 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Stanislav Fomichev <sdf@...ichev.me>
Cc: netdev@...r.kernel.org, davem@...emloft.net, edumazet@...gle.com,
pabeni@...hat.com, linux-kernel@...r.kernel.org, jhs@...atatu.com,
xiyou.wangcong@...il.com, jiri@...nulli.us, horms@...nel.org
Subject: Re: [PATCH net-next v2] net: hold netdev reference during
qdisc_create request_module
On Thu, 20 Mar 2025 09:51:03 -0700 Stanislav Fomichev wrote:
> rtnl_lock();
> netdev_lock_ops(dev);
> + dev_put(dev);
> ops = qdisc_lookup_ops(kind);
I'm not sure if this is a correct sequence. Do we guarantee that locks
will be taken before device is freed? I mean we do:
dev = netdev_wait_allrefs_any()
free_netdev(dev)
mutex_destroy(dev->lock)
without explicitly taking rtnl_lock() or netdev_lock(), so the moment
that dev_put() is called the device may get freed from another thread
- while its locked here.
My mental model is that taking the instance lock on a dev for which we
only have a ref requires a dance implemented in __netdev_put_lock().
Powered by blists - more mailing lists