Skip to content

Commit 7cc1d6c

Browse files
author
Maxim Levitsky
committed
net: mana: Fix possible double free in error handling path
JIRA: https://issues.redhat.com/browse/RHEL-54330 commit 1864b82 Author: Ma Ke <make24@iscas.ac.cn> Date: Tue Jun 25 21:03:14 2024 +0800 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 <make24@iscas.ac.cn> Link: https://patch.msgid.link/20240625130314.2661257-1-make24@iscas.ac.cn Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
1 parent 2b1f16b commit 7cc1d6c

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
@@ -2837,6 +2837,8 @@ static int add_adev(struct gdma_dev *gd)
28372837
if (ret)
28382838
goto init_fail;
28392839

2840+
/* madev is owned by the auxiliary device */
2841+
madev = NULL;
28402842
ret = auxiliary_device_add(adev);
28412843
if (ret)
28422844
goto add_fail;

0 commit comments

Comments
 (0)