Skip to content

Commit 1864b82

Browse files
Ma KePaolo Abeni
authored andcommitted
net: mana: Fix possible double free in error handling path
When auxiliary_device_add() returns error and then calls auxiliary_device_uninit(), callback function adev_release calls kfree(madev). We shouldn't call kfree(madev) again in the error handling path. Set 'madev' to NULL. Fixes: a69839d ("net: mana: Add support for auxiliary device") Signed-off-by: Ma Ke <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 3f4d9e4 commit 1864b82

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/ethernet/microsoft/mana/mana_en.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2798,6 +2798,8 @@ static int add_adev(struct gdma_dev *gd)
27982798
if (ret)
27992799
goto init_fail;
28002800

2801+
/* madev is owned by the auxiliary device */
2802+
madev = NULL;
28012803
ret = auxiliary_device_add(adev);
28022804
if (ret)
28032805
goto add_fail;

0 commit comments

Comments
 (0)