net: avoid nul-deref trying to bind mp to incapable device
Subsystems (2)
Jakub Kicinski
maintainerPATCH 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.
---
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
@@ -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
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 fromnetdev_rx_queue_restart().
Quoted 8 lines
Look at ops directly instead of the locking config. qops imply
netdev_need_ops_lock(). We usednetdev_need_ops_lock()initially to signify that thereal_num_rx_queuescheck below is safe withoutrtnl_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()")Signed-off-by Jakub Kicinski <[email protected]>
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 fromnetdev_rx_queue_restart().
Quoted 8 lines
Look at ops directly instead of the locking config. qops imply
netdev_need_ops_lock(). We usednetdev_need_ops_lock()initially to signify that thereal_num_rx_queuescheck below is safe withoutrtnl_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()")Signed-off-by Jakub Kicinski <[email protected]>
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.
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 fromnetdev_rx_queue_restart().Look at ops directly instead of the locking config. qops imply
netdev_need_ops_lock(). We usednetdev_need_ops_lock()initially to signify that thereal_num_rx_queuescheck below is safe withoutrtnl_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