Skip to content
/ linux Public

Commit 63e192b

Browse files
Wes2000leygregkh
authored andcommitted
netdevsim: drop PSP ext ref on forward failure
[ Upstream commit 7d93514 ] nsim_do_psp() takes an extra reference to the PSP skb extension so the extension survives __dev_forward_skb(). That forward path scrubs the skb and drops attached skb extensions before nsim_psp_handle_ext() can reattach the PSP metadata. If __dev_forward_skb() fails in nsim_forward_skb(), the function returns before nsim_psp_handle_ext() can attach that extension to the skb, leaving the extra reference leaked. Drop the saved PSP extension reference before returning from the forward-failure path. Guard the put because plain or non-decapsulated traffic can also fail forwarding without ever taking the extra PSP reference. Fixes: f857478 ("netdevsim: a basic test PSP implementation") Signed-off-by: Wesley Atwell <atwellwea@gmail.com> Reviewed-by: Daniel Zahka <daniel.zahka@gmail.com> Link: https://patch.msgid.link/20260317061431.1482716-1-atwellwea@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 9847330 commit 63e192b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/net/netdevsim/netdev.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,11 @@ static int nsim_forward_skb(struct net_device *tx_dev,
109109
int ret;
110110

111111
ret = __dev_forward_skb(rx_dev, skb);
112-
if (ret)
112+
if (ret) {
113+
if (psp_ext)
114+
__skb_ext_put(psp_ext);
113115
return ret;
116+
}
114117

115118
nsim_psp_handle_ext(skb, psp_ext);
116119

0 commit comments

Comments
 (0)