netlink: remove dev_hold() and dev_put() in __netlink_deliver_tap_skb()

__netlink_deliver_tap_skb() is called from netlink_deliver_tap()
under rcu_read_lock().

dev_queue_xmit() does not require the caller to hold a device reference
count, and the device lifetime is already protected by RCU (the netlink tap
is unlinked and waited for via grace periods prior to device destruction).

Remove the redundant dev_hold(dev) and dev_put(dev) calls.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260921093947.477658-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Eric Dumazet 2026-09-21 09:39:47 +00:00 committed by Jakub Kicinski
parent 8cf9152d94
commit c7a2a8c0c9

View File

@ -293,8 +293,6 @@ static int __netlink_deliver_tap_skb(struct sk_buff *skb,
if (!net_eq(dev_net(dev), sock_net(sk)))
return 0;
dev_hold(dev);
if (is_vmalloc_addr(skb->head))
nskb = netlink_to_full_skb(skb, GFP_ATOMIC);
else
@ -310,7 +308,6 @@ static int __netlink_deliver_tap_skb(struct sk_buff *skb,
ret = net_xmit_errno(ret);
}
dev_put(dev);
return ret;
}