[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210806150435.GB15586@kili>
Date: Fri, 6 Aug 2021 18:04:35 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: David Ahern <dsahern@...nel.org>, Vasily Averin <vvs@...tuozzo.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: [PATCH net-next] 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")
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
---
drivers/net/vrf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 726adf07ef31..662e26117353 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -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;
}
}
--
2.20.1
Powered by blists - more mailing lists