netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yuan Can <yuancan@huawei.com>
To: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>, <sfr@canb.auug.org.au>, <error27@gmail.com>,
	<bigeasy@linutronix.de>, <colin.i.king@gmail.com>,
	<yang.lee@linux.alibaba.com>, <josright123@gmail.com>,
	<netdev@vger.kernel.org>
Cc: <yuancan@huawei.com>
Subject: [PATCH] net: dm9051: Fix missing dev_kfree_skb() in dm9051_loop_rx()
Date: Mon, 21 Nov 2022 03:32:26 +0000	[thread overview]
Message-ID: <20221121033226.91461-1-yuancan@huawei.com> (raw)

The dm9051_loop_rx() returns without release skb when dm9051_stop_mrcmd()
returns error, free the skb to avoid this leak.

Fixes: 2dc95a4d30ed ("net: Add dm9051 driver")
Signed-off-by: Yuan Can <yuancan@huawei.com>
---
 drivers/net/ethernet/davicom/dm9051.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/davicom/dm9051.c b/drivers/net/ethernet/davicom/dm9051.c
index a523ddda7609..de7105a84747 100644
--- a/drivers/net/ethernet/davicom/dm9051.c
+++ b/drivers/net/ethernet/davicom/dm9051.c
@@ -798,8 +798,10 @@ static int dm9051_loop_rx(struct board_info *db)
 		}
 
 		ret = dm9051_stop_mrcmd(db);
-		if (ret)
+		if (ret) {
+			dev_kfree_skb(skb);
 			return ret;
+		}
 
 		skb->protocol = eth_type_trans(skb, db->ndev);
 		if (db->ndev->features & NETIF_F_RXCSUM)
-- 
2.17.1


             reply	other threads:[~2022-11-21  3:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-21  3:32 Yuan Can [this message]
2022-11-21 18:09 ` [PATCH] net: dm9051: Fix missing dev_kfree_skb() in dm9051_loop_rx() Maciej Fijalkowski
2022-11-23 12:50 ` 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=20221121033226.91461-1-yuancan@huawei.com \
    --to=yuancan@huawei.com \
    --cc=bigeasy@linutronix.de \
    --cc=colin.i.king@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=error27@gmail.com \
    --cc=josright123@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sfr@canb.auug.org.au \
    --cc=yang.lee@linux.alibaba.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).