[PATCH net-next 2/3] net: stmmac: selftests: use skb_share_check() in the loopback receive hook
From: Nicolai Buchwitz
Date: Wed Oct 07 2026 - 14:30:42 EST
The loopback hook gets a shared skb when another ETH_P_IP handler is
bound to the device. skb_unshare() does not unshare it, so
skb_linearize() on a non-linear frame hits BUG_ON(skb_shared()).
Use skb_share_check() instead.
Fixes: 091810dbded9 ("net: stmmac: Introduce selftests support")
Signed-off-by: Nicolai Buchwitz <nb@xxxxxxxxxxx>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
index 6097f312fce4..c910675a9d9b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
@@ -244,7 +244,7 @@ static int stmmac_test_loopback_validate(struct sk_buff *skb,
struct tcphdr *thdr;
struct iphdr *ihdr;
- skb = skb_unshare(skb, GFP_ATOMIC);
+ skb = skb_share_check(skb, GFP_ATOMIC);
if (!skb)
goto out;
--
2.53.0