* [PATCH net] qede: Don't advertise XDP features on VFs without XDP support
@ 2026-11-24 4:28 Suyuan Wang via B4 Relay
2026-12-01 14:25 ` Paolo Abeni
2026-12-01 14:30 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Suyuan Wang via B4 Relay @ 2026-11-24 4:28 UTC (permalink / raw)
To: john.fastabend, pabeni, davem, daniel, andrew+netdev, edumazet,
hawk, ast, kuba
Cc: netdev, lorenzo, bpf, linux-kernel, sdf
From: Suyuan Wang <stevewong@hust.edu.cn>
A VF without XDP support gets qede_netdev_vf_ops, which has neither
.ndo_bpf nor .ndo_xdp_xmit, but qede_init_ndev() still sets
ndev->xdp_features = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT |
NETDEV_XDP_ACT_NDO_XMIT;
for every device. The devmap code only allocates dev->xdp_bulkq when
the device has .ndo_xdp_xmit, but the XDP redirect paths use
NETDEV_XDP_ACT_NDO_XMIT to decide whether they can call bq_enqueue(),
which dereferences dev->xdp_bulkq. So an XDP program running on another
device can redirect a frame to such a VF, through a devmap or
bpf_redirect(), and bq_enqueue() then dereferences a NULL xdp_bulkq.
Only set the XDP features when the device uses ops with XDP support,
that is on a PF or on a VF with xdp_supported.
Found with a static analysis tool and checked by hand.
Fixes: 66c0e13ad236 ("drivers: net: turn on XDP features")
Cc: stable@vger.kernel.org
Co-developed-by: Kaixuan Li <kaixuan.li@ntu.edu.sg>
Signed-off-by: Kaixuan Li <kaixuan.li@ntu.edu.sg>
Signed-off-by: Suyuan Wang <stevewong@hust.edu.cn>
---
Compile tested on x86_64 (W=1, no new warnings). I don't have qede
hardware.
---
drivers/net/ethernet/qlogic/qede/qede_main.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c
index 7ed17faced54..19d13ef27d10 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_main.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_main.c
@@ -890,8 +890,11 @@ static void qede_init_ndev(struct qede_dev *edev)
ndev->hw_features = hw_features;
- ndev->xdp_features = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT |
- NETDEV_XDP_ACT_NDO_XMIT;
+ /* qede_netdev_vf_ops has no XDP callbacks */
+ if (!IS_VF(edev) || edev->dev_info.xdp_supported)
+ ndev->xdp_features = NETDEV_XDP_ACT_BASIC |
+ NETDEV_XDP_ACT_REDIRECT |
+ NETDEV_XDP_ACT_NDO_XMIT;
/* MTU range: 46 - 9600 */
ndev->min_mtu = ETH_ZLEN - ETH_HLEN;
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net] qede: Don't advertise XDP features on VFs without XDP support
2026-11-24 4:28 [PATCH net] qede: Don't advertise XDP features on VFs without XDP support Suyuan Wang via B4 Relay
@ 2026-12-01 14:25 ` Paolo Abeni
2026-12-01 14:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Paolo Abeni @ 2026-12-01 14:25 UTC (permalink / raw)
To: Suyuan Wang, john.fastabend, davem, daniel, andrew+netdev,
edumazet, hawk, ast, kuba
Cc: netdev, lorenzo, bpf, linux-kernel, sdf
On 11/24/26 05:28, Suyuan Wang wrote:
> From: Suyuan Wang <stevewong@hust.edu.cn>
>
> A VF without XDP support gets qede_netdev_vf_ops, which has neither
> .ndo_bpf nor .ndo_xdp_xmit, but qede_init_ndev() still sets
>
> ndev->xdp_features = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT |
> NETDEV_XDP_ACT_NDO_XMIT;
>
> for every device. The devmap code only allocates dev->xdp_bulkq when
> the device has .ndo_xdp_xmit, but the XDP redirect paths use
> NETDEV_XDP_ACT_NDO_XMIT to decide whether they can call bq_enqueue(),
> which dereferences dev->xdp_bulkq. So an XDP program running on another
> device can redirect a frame to such a VF, through a devmap or
> bpf_redirect(), and bq_enqueue() then dereferences a NULL xdp_bulkq.
>
> Only set the XDP features when the device uses ops with XDP support,
> that is on a PF or on a VF with xdp_supported.
>
> Found with a static analysis tool and checked by hand.
>
> Fixes: 66c0e13ad236 ("drivers: net: turn on XDP features")
> Cc: stable@vger.kernel.org
> Co-developed-by: Kaixuan Li <kaixuan.li@ntu.edu.sg>
> Signed-off-by: Kaixuan Li <kaixuan.li@ntu.edu.sg>
> Signed-off-by: Suyuan Wang <stevewong@hust.edu.cn>
We can't push to net, even less to stable driver code with no H/W testing,
even if reasonable. I'll apply this one to net.
/P
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net] qede: Don't advertise XDP features on VFs without XDP support
2026-11-24 4:28 [PATCH net] qede: Don't advertise XDP features on VFs without XDP support Suyuan Wang via B4 Relay
2026-12-01 14:25 ` Paolo Abeni
@ 2026-12-01 14:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-12-01 14:30 UTC (permalink / raw)
To: Wong Steve
Cc: john.fastabend, pabeni, davem, daniel, andrew+netdev, edumazet,
hawk, ast, kuba, netdev, lorenzo, bpf, linux-kernel, sdf
Hello:
This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Tue, 24 Nov 2026 04:28:02 +0000 you wrote:
> From: Suyuan Wang <stevewong@hust.edu.cn>
>
> A VF without XDP support gets qede_netdev_vf_ops, which has neither
> .ndo_bpf nor .ndo_xdp_xmit, but qede_init_ndev() still sets
>
> ndev->xdp_features = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT |
> NETDEV_XDP_ACT_NDO_XMIT;
>
> [...]
Here is the summary with links:
- [net] qede: Don't advertise XDP features on VFs without XDP support
https://git.kernel.org/netdev/net-next/c/7ef38f320e43
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] 3+ messages in thread
end of thread, other threads:[~2026-12-01 14:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 4:28 [PATCH net] qede: Don't advertise XDP features on VFs without XDP support Suyuan Wang via B4 Relay
2026-12-01 14:25 ` Paolo Abeni
2026-12-01 14:30 ` 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