Skip to contentSkip to conversation

vrf: fix NULL dereference in vrf_finish_output()

PATCH Applied Dan Carpenter 2 participants 2 messages Aug 6, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vrf: fix NULL dereference in vrf_finish_output()

The "skb" pointer is NULL on this error path so we can't dereference it. Use "dev" instead.

Fixes 14ee70ca89e6 ("vrf: use skb_expand_head in vrf_finish_output")
---
 drivers/net/vrf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/vrf.c +1 -1
index 726adf07ef31..662e26117353 100644
@@ -864,7 +864,7 @@ static int vrf_finish_output(struct net *net, struct sock *sk, struct sk_buff *s
 	if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) {
 		skb = skb_expand_head(skb, hh_len);
 		if (!skb) {
-			skb->dev->stats.tx_errors++;
+			dev->stats.tx_errors++;
 			return -ENOMEM;
 		}
 	}
Signature · 1 line
2.20.1
#1 lore raw
This patch was applied to netdev/net-next.git (refs/heads/master):

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

Quoted 8 lines · On Fri, 6 Aug 2021 18:04:35 +0300 you wrote:

The "skb" pointer is NULL on this error path so we can't dereference it. Use "dev" instead.

Fixes 14ee70ca89e6 ("vrf: use skb_expand_head in vrf_finish_output")
---
 drivers/net/vrf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
- [net-next] vrf: fix NULL dereference in vrf_finish_output()

    https://git.kernel.org/netdev/net-next/c/06669e6880be

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html