mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-03 07:38:10 +00:00
net: atlantic: fix potential memory leak in aq_ndev_close()
[ Upstream commit 65e5d27df6
]
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>
This commit is contained in:
parent
cfaf7f090a
commit
5b4e1c1ffb
1 changed files with 0 additions and 3 deletions
|
@ -94,11 +94,8 @@ static int aq_ndev_close(struct net_device *ndev)
|
|||
int err = 0;
|
||||
|
||||
err = aq_nic_stop(aq_nic);
|
||||
if (err < 0)
|
||||
goto err_exit;
|
||||
aq_nic_deinit(aq_nic, true);
|
||||
|
||||
err_exit:
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue