]> Git Repo - linux.git/commitdiff
net: mana: Fix possible double free in error handling path
authorMa Ke <[email protected]>
Tue, 25 Jun 2024 13:03:14 +0000 (21:03 +0800)
committerPaolo Abeni <[email protected]>
Thu, 27 Jun 2024 10:35:58 +0000 (12:35 +0200)
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: a69839d4327d ("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]>
drivers/net/ethernet/microsoft/mana/mana_en.c

index d087cf954f7552170d6d81dccc43b08bf5b20ba8..608ad31a97022bc8315979d3e320bbf67ec0923c 100644 (file)
@@ -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;
This page took 0.06693 seconds and 4 git commands to generate.