Skip to content

Commit f72a199

Browse files
shifty91kuba-moo
authored andcommitted
net: stmmac: Complete meta data only when enabled
Currently using plain XDP/ZC sockets on stmmac results in a kernel crash: |[ 255.822584] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 |[...] |[ 255.822764] Call trace: |[ 255.822766] stmmac_tx_clean.constprop.0+0x848/0xc38 The program counter indicates xsk_tx_metadata_complete(). It works on compl->tx_timestamp, which is not set by xsk_tx_metadata_to_compl() due to missing meta data. Therefore, call xsk_tx_metadata_complete() only when meta data is actually used. Tested on imx93 without XDP, with XDP and with XDP/ZC. Fixes: 1347b41 ("net: stmmac: Add Tx HWTS support to XDP ZC") Suggested-by: Serge Semin <[email protected]> Tested-by: Serge Semin <[email protected]> Link: https://lore.kernel.org/netdev/[email protected]/ Acked-by: Stanislav Fomichev <[email protected]> Signed-off-by: Kurt Kanzenbach <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent c68b2c9 commit f72a199

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2672,7 +2672,8 @@ static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue,
26722672
}
26732673
if (skb) {
26742674
stmmac_get_tx_hwtstamp(priv, p, skb);
2675-
} else {
2675+
} else if (tx_q->xsk_pool &&
2676+
xp_tx_metadata_enabled(tx_q->xsk_pool)) {
26762677
struct stmmac_xsk_tx_complete tx_compl = {
26772678
.priv = priv,
26782679
.desc = p,

0 commit comments

Comments
 (0)