Netdev List
 help / color / mirror / Atom feed
* [PATCH net] net: expect instance lock in netdev_queue_get_dma_dev()
@ 2026-08-06 22:56 Jakub Kicinski
  2026-08-10 10:23 ` Simon Horman
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jakub Kicinski @ 2026-08-06 22:56 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, Jakub Kicinski,
	stable, syzbot+a78926bdac2adb52dc0e, axboe, io-uring,
	asml.silence

netdev_queue_get_dma_dev() uses "compat" locking assert which wants
either the rtnl_lock or netdev instance lock. This is not right,
the callers are taking the instance lock unconditionally. All entry
points for queue config are purely instance locked.

In other words the callers use netdev_get_by_index_lock(), not
netdev_get_by_index_lock_ops_compat(). All the state we will
access is effectively instance lock protected (it's const for
devices which are not ops-locked).

Update the assert to avoid false positive warnings.

Cc: stable@vger.kernel.org
Fixes: b6c5f9454ef34 ("io_uring/zcrx: call netdev_queue_get_dma_dev() under instance lock")
Reported-by: syzbot+a78926bdac2adb52dc0e@syzkaller.appspotmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: axboe@kernel.dk
CC: io-uring@vger.kernel.org
CC: asml.silence@gmail.com
---
 net/core/netdev_queues.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/netdev_queues.c b/net/core/netdev_queues.c
index 4d6864bb4f6b..f5558b12877c 100644
--- a/net/core/netdev_queues.c
+++ b/net/core/netdev_queues.c
@@ -40,7 +40,7 @@ struct device *netdev_queue_get_dma_dev(struct net_device *dev,
 	struct netdev_rx_queue *hw_rxq;
 	struct device *dma_dev;
 
-	netdev_assert_locked_ops_compat(dev);
+	netdev_assert_locked(dev);
 
 	/* Only RX side supports queue leasing today. */
 	if (type != NETDEV_QUEUE_TYPE_RX || !netif_rxq_is_leased(dev, idx))
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net] net: expect instance lock in netdev_queue_get_dma_dev()
  2026-08-06 22:56 [PATCH net] net: expect instance lock in netdev_queue_get_dma_dev() Jakub Kicinski
@ 2026-08-10 10:23 ` Simon Horman
  2026-08-10 10:27 ` Daniel Borkmann
  2026-08-10 23:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2026-08-10 10:23 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, stable,
	syzbot+a78926bdac2adb52dc0e, axboe, io-uring, asml.silence

On Thu, Aug 06, 2026 at 03:56:26PM -0700, Jakub Kicinski wrote:
> netdev_queue_get_dma_dev() uses "compat" locking assert which wants
> either the rtnl_lock or netdev instance lock. This is not right,
> the callers are taking the instance lock unconditionally. All entry
> points for queue config are purely instance locked.
> 
> In other words the callers use netdev_get_by_index_lock(), not
> netdev_get_by_index_lock_ops_compat(). All the state we will
> access is effectively instance lock protected (it's const for
> devices which are not ops-locked).
> 
> Update the assert to avoid false positive warnings.
> 
> Cc: stable@vger.kernel.org
> Fixes: b6c5f9454ef34 ("io_uring/zcrx: call netdev_queue_get_dma_dev() under instance lock")
> Reported-by: syzbot+a78926bdac2adb52dc0e@syzkaller.appspotmail.com
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] net: expect instance lock in netdev_queue_get_dma_dev()
  2026-08-06 22:56 [PATCH net] net: expect instance lock in netdev_queue_get_dma_dev() Jakub Kicinski
  2026-08-10 10:23 ` Simon Horman
@ 2026-08-10 10:27 ` Daniel Borkmann
  2026-08-10 23:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Borkmann @ 2026-08-10 10:27 UTC (permalink / raw)
  To: Jakub Kicinski, davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, stable,
	syzbot+a78926bdac2adb52dc0e, axboe, io-uring, asml.silence

On 8/7/26 12:56 AM, Jakub Kicinski wrote:
> netdev_queue_get_dma_dev() uses "compat" locking assert which wants
> either the rtnl_lock or netdev instance lock. This is not right,
> the callers are taking the instance lock unconditionally. All entry
> points for queue config are purely instance locked.
> 
> In other words the callers use netdev_get_by_index_lock(), not
> netdev_get_by_index_lock_ops_compat(). All the state we will
> access is effectively instance lock protected (it's const for
> devices which are not ops-locked).
> 
> Update the assert to avoid false positive warnings.
> 
> Cc: stable@vger.kernel.org
> Fixes: b6c5f9454ef34 ("io_uring/zcrx: call netdev_queue_get_dma_dev() under instance lock")
> Reported-by: syzbot+a78926bdac2adb52dc0e@syzkaller.appspotmail.com
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] net: expect instance lock in netdev_queue_get_dma_dev()
  2026-08-06 22:56 [PATCH net] net: expect instance lock in netdev_queue_get_dma_dev() Jakub Kicinski
  2026-08-10 10:23 ` Simon Horman
  2026-08-10 10:27 ` Daniel Borkmann
@ 2026-08-10 23:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-08-10 23:20 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms, stable,
	syzbot+a78926bdac2adb52dc0e, axboe, io-uring, asml.silence

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu,  6 Aug 2026 15:56:26 -0700 you wrote:
> netdev_queue_get_dma_dev() uses "compat" locking assert which wants
> either the rtnl_lock or netdev instance lock. This is not right,
> the callers are taking the instance lock unconditionally. All entry
> points for queue config are purely instance locked.
> 
> In other words the callers use netdev_get_by_index_lock(), not
> netdev_get_by_index_lock_ops_compat(). All the state we will
> access is effectively instance lock protected (it's const for
> devices which are not ops-locked).
> 
> [...]

Here is the summary with links:
  - [net] net: expect instance lock in netdev_queue_get_dma_dev()
    https://git.kernel.org/netdev/net/c/92465f46f3c3

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-10 23:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-06 22:56 [PATCH net] net: expect instance lock in netdev_queue_get_dma_dev() Jakub Kicinski
2026-08-10 10:23 ` Simon Horman
2026-08-10 10:27 ` Daniel Borkmann
2026-08-10 23:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox