From: Jakub Kicinski <kuba@kernel.org>
To: Stanislav Fomichev <sdf@fomichev.me>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, linux-kernel@vger.kernel.org,
jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us,
horms@kernel.org
Subject: Re: [PATCH net-next v2] net: hold netdev reference during qdisc_create request_module
Date: Mon, 24 Mar 2025 15:04:25 -0700 [thread overview]
Message-ID: <20250324150425.32b3ec10@kernel.org> (raw)
In-Reply-To: <20250320165103.3926946-1-sdf@fomichev.me>
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().
next prev parent reply other threads:[~2025-03-24 22:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-20 16:51 [PATCH net-next v2] net: hold netdev reference during qdisc_create request_module Stanislav Fomichev
2025-03-24 22:04 ` Jakub Kicinski [this message]
2025-03-24 22:22 ` Stanislav Fomichev
2025-03-25 10:28 ` Jakub Kicinski
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=20250324150425.32b3ec10@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=xiyou.wangcong@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.