]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
net: atlantic: fix potential memory leak in aq_ndev_close()
authorJianglei Nie <niejianglei2021@163.com>
Wed, 14 Sep 2022 01:42:38 +0000 (09:42 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 14 Nov 2022 10:25:41 +0000 (11:25 +0100)
commita31111595b65ebe3958f240aad6dbe6b521b1d9f
tree52ad7287a972f46cb7f676595f014a894b62cd08
parentc2cfb397db6cc7e4c983e30dbcf96e999df5e47a
net: atlantic: fix potential memory leak in aq_ndev_close()

BugLink: https://bugs.launchpad.net/bugs/1995637
[ Upstream commit 65e5d27df61283e5390f04b09dc79cd832f95607 ]

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/net/ethernet/aquantia/atlantic/aq_main.c