mirror of
https://github.com/torvalds/linux
synced 2024-10-01 17:00:41 +00:00
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: a69839d432
("net: mana: Add support for auxiliary device")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
Link: https://patch.msgid.link/20240625130314.2661257-1-make24@iscas.ac.cn
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
3f4d9e4f82
commit
1864b82241
|
@ -2798,6 +2798,8 @@ static int add_adev(struct gdma_dev *gd)
|
||||||
if (ret)
|
if (ret)
|
||||||
goto init_fail;
|
goto init_fail;
|
||||||
|
|
||||||
|
/* madev is owned by the auxiliary device */
|
||||||
|
madev = NULL;
|
||||||
ret = auxiliary_device_add(adev);
|
ret = auxiliary_device_add(adev);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto add_fail;
|
goto add_fail;
|
||||||
|
|
Loading…
Reference in a new issue