Netdev List
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Eric Dumazet <edumazet@kernel.org>,
	 "David S . Miller" <davem@davemloft.net>,
	 Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>,
	 Willem de Bruijn <willemb@google.com>
Cc: Kuniyuki Iwashima <kuniyu@google.com>,
	 Simon Horman <horms@kernel.org>,
	 netdev@vger.kernel.org,  Eric Dumazet <edumazet@kernel.org>
Subject: Re: [PATCH net-next 4/4] tap: remove tap_get_tap_dev() and tap_put_tap_dev()
Date: Thu, 19 Nov 2026 19:03:21 -0500	[thread overview]
Message-ID: <willemdebruijn.kernel.e221ffaa921e@gmail.com> (raw)
In-Reply-To: <20261119072258.3157902-5-edumazet@kernel.org>

Eric Dumazet wrote:
> tap_get_tap_dev() takes a reference on tap->dev, released by
> tap_put_tap_dev().
> 
> This comes from commit 8f475a318aaa ("macvtap: introduce
> macvtap_get_vlan()"), when q->vlan was read under rcu_read_lock_bh()
> and the reference was needed to use the device after
> rcu_read_unlock_bh().
> 
> Both remaining callers, SIOCGIFHWADDR and SIOCSIFHWADDR, hold RTNL

Iff respinning would be worthwhile to add when the condition that
required the dev_hold went away.

Apparently very soon after the introduction in commit 441ac0fcaadc
("macvtap: Convert to using rtnl lock").

> for the whole time the device is used. tap_del_queues() clears q->tap
> under RTNL, before the device can be freed, so a non NULL q->tap
> guarantees the device stays around until rtnl_unlock(). TUNSETOFFLOAD
> already relies on this.
> 
> Use rtnl_dereference(q->tap) directly.
> 
> Signed-off-by: Eric Dumazet <edumazet@kernel.org>

Reviewed-by: Willem de Bruijn <willemb@google.com>


      reply	other threads:[~2026-11-20  0:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19  7:22 [PATCH net-next 0/4] tap: do not hold RTNL in open(), release() and queue ioctls Eric Dumazet
2026-11-19  7:22 ` [PATCH net-next 1/4] tap: detach queues from the NETDEV_UNREGISTER notifier Eric Dumazet
2026-11-19 23:46   ` Willem de Bruijn
2026-11-19  7:22 ` [PATCH net-next 2/4] tap: add a mutex to protect queue management Eric Dumazet
2026-11-19 23:49   ` Willem de Bruijn
2026-11-19  7:22 ` [PATCH net-next 3/4] tap: do not hold RTNL in open(), release() and queue ioctls Eric Dumazet
2026-11-19  7:22 ` [PATCH net-next 4/4] tap: remove tap_get_tap_dev() and tap_put_tap_dev() Eric Dumazet
2026-11-20  0:03   ` Willem de Bruijn [this message]

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=willemdebruijn.kernel.e221ffaa921e@gmail.com \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=willemb@google.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