From: Dan Carpenter <dan.carpenter@oracle.com>
To: David Ahern <dsahern@kernel.org>, Vasily Averin <vvs@virtuozzo.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH net-next] vrf: fix NULL dereference in vrf_finish_output()
Date: Fri, 6 Aug 2021 18:04:35 +0300 [thread overview]
Message-ID: <20210806150435.GB15586@kili> (raw)
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@oracle.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
next reply other threads:[~2021-08-06 15:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-06 15:04 Dan Carpenter [this message]
2021-08-06 22:50 ` [PATCH net-next] vrf: fix NULL dereference in vrf_finish_output() patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210806150435.GB15586@kili \
--to=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vvs@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).