[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Yr8FuKXVD83AW+u+@electric-eye.fr.zoreil.com>
Date: Fri, 1 Jul 2022 16:33:28 +0200
From: Francois Romieu <romieu@...zoreil.com>
To: Jianglei Nie <niejianglei2021@....com>
Cc: irusskikh@...vell.com, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: atlantic: fix potential memory leak in
aq_ndev_close()
Jianglei Nie <niejianglei2021@....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@....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
Powered by blists - more mailing lists