From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Zhengchao Shao <shaozhengchao@huawei.com>
Cc: netdev@vger.kernel.org, michael.jamet@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] net: thunderbolt: fix memory leak in tbnet_open()
Date: Mon, 5 Dec 2022 15:38:01 +0200 [thread overview]
Message-ID: <Y430Od5z5gNI2p0G@black.fi.intel.com> (raw)
In-Reply-To: <20221205115559.3189177-1-shaozhengchao@huawei.com>
Hi,
On Mon, Dec 05, 2022 at 07:55:59PM +0800, Zhengchao Shao wrote:
> When tb_ring_alloc_rx() failed in tbnet_open(), it doesn't free ida.
>
> Fixes: 180b0689425c ("thunderbolt: Allow multiple DMA tunnels over a single XDomain connection")
> Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
> ---
> drivers/net/thunderbolt.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/thunderbolt.c b/drivers/net/thunderbolt.c
> index a52ee2bf5575..70fd61ce15c6 100644
> --- a/drivers/net/thunderbolt.c
> +++ b/drivers/net/thunderbolt.c
> @@ -916,6 +916,7 @@ static int tbnet_open(struct net_device *dev)
> netdev_err(dev, "failed to allocate Rx ring\n");
> tb_ring_free(net->tx_ring.ring);
> net->tx_ring.ring = NULL;
> + tb_xdomain_release_out_hopid(xd, hopid);
Can you move this before tb_ring_free()? Like this:
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;
Otherwise looks good to me.
next prev parent reply other threads:[~2022-12-05 13:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-05 11:55 [PATCH net] net: thunderbolt: fix memory leak in tbnet_open() Zhengchao Shao
2022-12-05 13:38 ` Mika Westerberg [this message]
2022-12-06 0:46 ` 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=Y430Od5z5gNI2p0G@black.fi.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=YehezkelShB@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=michael.jamet@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 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).