Skip to content

Commit 65e5d27

Browse files
Jianglei Niedavem330
authored andcommitted
net: atlantic: fix potential memory leak in aq_ndev_close()
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 79a392a commit 65e5d27

File tree

1 file changed

+0
-3
lines changed
  • drivers/net/ethernet/aquantia/atlantic

1 file changed

+0
-3
lines changed

drivers/net/ethernet/aquantia/atlantic/aq_main.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,8 @@ static int aq_ndev_close(struct net_device *ndev)
9494
int err = 0;
9595

9696
err = aq_nic_stop(aq_nic);
97-
if (err < 0)
98-
goto err_exit;
9997
aq_nic_deinit(aq_nic, true);
10098

101-
err_exit:
10299
return err;
103100
}
104101

0 commit comments

Comments
 (0)