Skip to content

Commit fbffb8c

Browse files
lgs2513pH5
authored andcommitted
reset: gpio: fix double free in reset_add_gpio_aux_device() error path
When __auxiliary_device_add() fails, reset_add_gpio_aux_device() calls auxiliary_device_uninit(adev). The device release callback reset_gpio_aux_device_release() frees adev, but the current error path then calls kfree(adev) again, causing a double free. Keep kfree(adev) for the auxiliary_device_init() failure path, but avoid freeing adev after auxiliary_device_uninit(). Fixes: 5fc4e4c ("reset: gpio: use software nodes to setup the GPIO lookup") Cc: [email protected] Signed-off-by: Guangshuo Li <[email protected]> Reviewed-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Philipp Zabel <[email protected]>
1 parent c961cc8 commit fbffb8c

1 file changed

Lines changed: 0 additions & 1 deletion

File tree

drivers/reset/core.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,6 @@ static int reset_add_gpio_aux_device(struct device *parent,
856856
ret = __auxiliary_device_add(adev, "reset");
857857
if (ret) {
858858
auxiliary_device_uninit(adev);
859-
kfree(adev);
860859
return ret;
861860
}
862861

0 commit comments

Comments
 (0)