All of lore.kernel.org
 help / color / mirror / Atom feed
From: Francois Romieu <romieu@fr.zoreil.com>
To: Jianglei Nie <niejianglei2021@163.com>
Cc: irusskikh@marvell.com, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: atlantic: fix potential memory leak in aq_ndev_close()
Date: Fri, 1 Jul 2022 16:33:28 +0200	[thread overview]
Message-ID: <Yr8FuKXVD83AW+u+@electric-eye.fr.zoreil.com> (raw)
In-Reply-To: <20220701065253.2183789-1-niejianglei2021@163.com>

Jianglei Nie <niejianglei2021@163.com> :
> If aq_nic_stop() fails, aq_ndev_close() returns err without calling
> aq_nic_deinit() to release the relevant memory and resource, which
> will lead to a memory leak.
> 
> We can fix it by deleting the if condition judgment and goto statement to
> call aq_nic_deinit() directly after aq_nic_stop() to fix the memory leak.
> 
> Signed-off-by: Jianglei Nie <niejianglei2021@163.com>

Either (1) the hardware is stopped and the relevance of error returning
aq_nic_stop is dubious at best or (2) the hardware is not stopped and
it may not be safe to remove its kernel allocated resources behind its
back.

There is a problem but this patch is imho targeting the symptom.

A knowledgeable answer to (1), (2) could also help to avoid the
dev_{close/open} danse in drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c.

-- 
Ueimor

  reply	other threads:[~2022-07-01 14:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-01  6:52 [PATCH] net: atlantic: fix potential memory leak in aq_ndev_close() Jianglei Nie
2022-07-01 14:33 ` Francois Romieu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-09-14  1:42 Jianglei Nie
2022-09-21 12:00 ` patchwork-bot+netdevbpf
2022-09-13 17:15 kernel test robot
2022-09-13  6:39 Jianglei Nie
2022-09-13 10:25 ` kernel test robot
2022-09-13 14:29 ` kernel test robot
2022-06-29 17:56 Jianglei Nie
2022-07-01  3:19 ` Jakub Kicinski

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=Yr8FuKXVD83AW+u+@electric-eye.fr.zoreil.com \
    --to=romieu@fr.zoreil.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=irusskikh@marvell.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=niejianglei2021@163.com \
    --cc=pabeni@redhat.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.