netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wenjia Zhao <driverfuzzing@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: driverfuzzing@gmail.com, Yisen Zhuang <yisen.zhuang@huawei.com>,
	Salil Mehta <salil.mehta@huawei.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 4/4] net: hns3: double free 'skb'
Date: Tue,  2 Feb 2021 21:13:43 -0600	[thread overview]
Message-ID: <1612322024-93322-1-git-send-email-driverfuzzing@gmail.com> (raw)

net: hns3: double free 'skb'

The false branch of (tx_ret == NETDEV_TX_OK) free the skb. However, the
kfree_skb(skb) in the out label will be execute when exits the function.
So the skb has a double-free bugs.

Remove the kfree_skb(skb) at line 269

Signed-off-by: Wenjia Zhao <driverfuzzing@gmail.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
index 2622e04..1b926ff 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
@@ -266,7 +266,6 @@ static int hns3_lp_run_test(struct net_device *ndev, enum hnae3_loop mode)
 		if (tx_ret == NETDEV_TX_OK) {
 			good_cnt++;
 		} else {
-			kfree_skb(skb);
 			netdev_err(ndev, "hns3_lb_run_test xmit failed: %d\n",
 				   tx_ret);
 		}
-- 
2.7.4


             reply	other threads:[~2021-02-03  3:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-03  3:13 Wenjia Zhao [this message]
2021-02-03  3:51 ` [PATCH 4/4] net: hns3: double free 'skb' Yunsheng Lin

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=1612322024-93322-1-git-send-email-driverfuzzing@gmail.com \
    --to=driverfuzzing@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=salil.mehta@huawei.com \
    --cc=yisen.zhuang@huawei.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).