diff options
| author | Guangshuo Li <lgs201920130244@gmail.com> | 2026-03-21 15:42:40 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-04-11 14:29:52 +0200 |
| commit | 1de465753220deb41569cf2add87bbb0673731db (patch) | |
| tree | a5c647e27aa94d7babba1c8d2303f4d30c540fc6 /drivers | |
| parent | e7813ea3cc6036c9657e811736387a2d09f6abde (diff) | |
reset: gpio: fix double free in reset_add_gpio_aux_device() error path
commit fbffb8c7c7bb4d38e9f65e0bee446685011de5d8 upstream.
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: 5fc4e4cf7a22 ("reset: gpio: use software nodes to setup the GPIO lookup")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/reset/core.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/drivers/reset/core.c b/drivers/reset/core.c index 0135dd0ae204..58ecde760b6e 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c @@ -856,7 +856,6 @@ static int reset_add_gpio_aux_device(struct device *parent, ret = __auxiliary_device_add(adev, "reset"); if (ret) { auxiliary_device_uninit(adev); - kfree(adev); return ret; } |
