Skip to contentSkip to conversation

net: avoid nul-deref trying to bind mp to incapable device

PATCH Applied Jakub Kicinski 4 participants 4 messages Apr 4 – Apr 8

Subsystems (2)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 net: avoid nul-deref trying to bind mp to incapable device

Sashiko points out that we use qops in __net_mp_open_rxq() but never validate they are null. This was introduced when check was moved from netdev_rx_queue_restart().

Look at ops directly instead of the locking config. qops imply netdev_need_ops_lock(). We used netdev_need_ops_lock() initially to signify that the real_num_rx_queues check below is safe without rtnl_lock, but I'm not sure if this is actually clear to most people, anyway.

Fixes da7772a2b4ad ("net: move mp->rx_page_size validation to __net_mp_open_rxq()")

---
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 net/core/netdev_rx_queue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/netdev_rx_queue.c +1 -1
index 668a90658f25..05fd2875d725 100644
@@ -117,7 +117,7 @@ int __net_mp_open_rxq(struct net_device *dev, unsigned int rxq_idx,
 	struct netdev_rx_queue *rxq;
 	int ret;
 
-	if (!netdev_need_ops_lock(dev))
+	if (!qops)
 		return -EOPNOTSUPP;
 
 	if (rxq_idx >= dev->real_num_rx_queues) {
Signature · 1 line
2.53.0
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Jakub Kicinski

Sashiko points out that we use qops in __net_mp_open_rxq() but never validate they are null. This was introduced when check was moved from netdev_rx_queue_restart().

Quoted 8 lines

Look at ops directly instead of the locking config. qops imply netdev_need_ops_lock(). We used netdev_need_ops_lock() initially to signify that the real_num_rx_queues check below is safe without rtnl_lock, but I'm not sure if this is actually clear to most people, anyway.

Fixes da7772a2b4ad ("net: move mp->rx_page_size validation to __net_mp_open_rxq()")
Reviewed-by on v1 1/1
#2 lore raw
In reply to Jakub Kicinski
Quoted 5 lines · Jakub Kicinski

Sashiko points out that we use qops in __net_mp_open_rxq() but never validate they are null. This was introduced when check was moved from netdev_rx_queue_restart().

Quoted 8 lines

Look at ops directly instead of the locking config. qops imply netdev_need_ops_lock(). We used netdev_need_ops_lock() initially to signify that the real_num_rx_queues check below is safe without rtnl_lock, but I'm not sure if this is actually clear to most people, anyway.

Fixes da7772a2b4ad ("net: move mp->rx_page_size validation to __net_mp_open_rxq()")

Honestly better for readability too. I was confused why we check that we need a lock here but never netdev_lock_ops AFAICT.

FWIW I'm not sure why this branch doesn't have NL_SET_ERR_MSG, but I didn't look deeply. Probably doesn't matter.

#3 lore raw
In reply to Jakub Kicinski
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 11 lines · On Fri, 3 Apr 2026 17:19:38 -0700 you wrote:

Sashiko points out that we use qops in __net_mp_open_rxq() but never validate they are null. This was introduced when check was moved from netdev_rx_queue_restart().

Look at ops directly instead of the locking config. qops imply netdev_need_ops_lock(). We used netdev_need_ops_lock() initially to signify that the real_num_rx_queues check below is safe without rtnl_lock, but I'm not sure if this is actually clear to most people, anyway.

[...]

Here is the summary with links:
- [net] net: avoid nul-deref trying to bind mp to incapable device

    https://git.kernel.org/netdev/net/c/944b3b734cfb

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html