diff options
author | Sanjuán García, Jorge <Jorge.SanjuanGarcia@duagon.com> | 2023-10-19 14:15:34 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-11-28 17:20:05 +0000 |
commit | 07f2f69f0b82578da6bda5f10320ddfe0be43d96 (patch) | |
tree | b7a6e242207d0171b7b7b3478e076ccb1704bd82 /drivers/mcb/mcb-parse.c | |
parent | e4eccf228ac2c050d17af9a7bc6457a4d4e9116b (diff) | |
download | linux-stable-07f2f69f0b82578da6bda5f10320ddfe0be43d96.tar.gz linux-stable-07f2f69f0b82578da6bda5f10320ddfe0be43d96.tar.bz2 linux-stable-07f2f69f0b82578da6bda5f10320ddfe0be43d96.zip |
mcb: fix error handling for different scenarios when parsing
commit 63ba2d07b4be72b94216d20561f43e1150b25d98 upstream.
chameleon_parse_gdd() may fail for different reasons and end up
in the err tag. Make sure we at least always free the mcb_device
allocated with mcb_alloc_dev().
If mcb_device_register() fails, make sure to give up the reference
in the same place the device was added.
Fixes: 728ac3389296 ("mcb: mcb-parse: fix error handing in chameleon_parse_gdd()")
Cc: stable <stable@kernel.org>
Reviewed-by: Jose Javier Rodriguez Barbarin <JoseJavier.Rodriguez@duagon.com>
Signed-off-by: Jorge Sanjuan Garcia <jorge.sanjuangarcia@duagon.com>
Link: https://lore.kernel.org/r/20231019141434.57971-2-jorge.sanjuangarcia@duagon.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/mcb/mcb-parse.c')
-rw-r--r-- | drivers/mcb/mcb-parse.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mcb/mcb-parse.c b/drivers/mcb/mcb-parse.c index 656b6b71c768..1ae37e693de0 100644 --- a/drivers/mcb/mcb-parse.c +++ b/drivers/mcb/mcb-parse.c @@ -106,7 +106,7 @@ static int chameleon_parse_gdd(struct mcb_bus *bus, return 0; err: - put_device(&mdev->dev); + mcb_free_dev(mdev); return ret; } |