All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Zhengchao Shao <shaozhengchao@huawei.com>
Cc: netdev@vger.kernel.org, michael.jamet@intel.com,
	mika.westerberg@linux.intel.com, YehezkelShB@gmail.com,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, weiyongjun1@huawei.com, yuehaibing@huawei.com
Subject: Re: [PATCH net v2] net: thunderbolt: fix memory leak in tbnet_open()
Date: Tue, 6 Dec 2022 10:38:07 +0100	[thread overview]
Message-ID: <Y48Nf4OkBbaVgw4C@nanopsycho> (raw)
In-Reply-To: <20221206010646.3552313-1-shaozhengchao@huawei.com>

Tue, Dec 06, 2022 at 02:06:46AM CET, shaozhengchao@huawei.com wrote:
>When tb_ring_alloc_rx() failed in tbnet_open(), it doesn't free ida.

You should be imperative to the codebase in your patch descriptions.

The code fix looks okay.

>
>Fixes: 180b0689425c ("thunderbolt: Allow multiple DMA tunnels over a single XDomain connection")
>Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
>---
>v2: move release ida before free tx_ring
>---
> drivers/net/thunderbolt.c | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/drivers/net/thunderbolt.c b/drivers/net/thunderbolt.c
>index a52ee2bf5575..6312f67f260e 100644
>--- a/drivers/net/thunderbolt.c
>+++ b/drivers/net/thunderbolt.c
>@@ -914,6 +914,7 @@ static int tbnet_open(struct net_device *dev)
> 				eof_mask, tbnet_start_poll, net);
> 	if (!ring) {
> 		netdev_err(dev, "failed to allocate Rx ring\n");
>+		tb_xdomain_release_out_hopid(xd, hopid);
> 		tb_ring_free(net->tx_ring.ring);
> 		net->tx_ring.ring = NULL;
> 		return -ENOMEM;
>-- 
>2.34.1
>

  parent reply	other threads:[~2022-12-06  9:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-06  1:06 [PATCH net v2] net: thunderbolt: fix memory leak in tbnet_open() Zhengchao Shao
2022-12-06  6:09 ` Mika Westerberg
2022-12-06  9:38 ` Jiri Pirko [this message]
2022-12-07  0:53   ` shaozhengchao

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=Y48Nf4OkBbaVgw4C@nanopsycho \
    --to=jiri@resnulli.us \
    --cc=YehezkelShB@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=michael.jamet@intel.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shaozhengchao@huawei.com \
    --cc=weiyongjun1@huawei.com \
    --cc=yuehaibing@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.