Commit 1864b822 authored by Ma Ke's avatar Ma Ke Committed by Paolo Abeni
Browse files

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: a69839d4 ("net: mana: Add support for auxiliary device")
Signed-off-by: default avatarMa Ke <make24@iscas.ac.cn>
Link: https://patch.msgid.link/20240625130314.2661257-1-make24@iscas.ac.cn


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 3f4d9e4f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2798,6 +2798,8 @@ static int add_adev(struct gdma_dev *gd)
	if (ret)
		goto init_fail;

	/* madev is owned by the auxiliary device */
	madev = NULL;
	ret = auxiliary_device_add(adev);
	if (ret)
		goto add_fail;