Skip to contentSkip to conversation

drivers: mcb: collected patches for 6.2

PATCH New Johannes Thumshirn 1 participant 3 messages Dec 2, 2022 Men chameleon bus (mcb)

lore
Share & tools
lore
#0 lore raw

cover drivers: mcb: collected patches for 6.2

From: Johannes Thumshirn <[email protected]>

Hi Greg,

Here are the patches I've collected for drivers mcb for v6.2. Both fix problems in the error paths.

I'm sorry I know I'm ultra late with this.

Thanks,
Johannes

Yang Yingliang (1):
mcb: mcb-parse: fix error handing in chameleon_parse_gdd()

Zhengchao Shao (1):
drivers: mcb: fix resource leak in mcb_probe()

 drivers/mcb/mcb-core.c  | 4 +++-
 drivers/mcb/mcb-parse.c | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)
Signature · 1 line
2.37.3
#1 lore raw

PATCH 1/2 drivers: mcb: fix resource leak in mcb_probe()

From: Zhengchao Shao <[email protected]>

When probe hook function failed in mcb_probe(), it doesn't put the device. Compiled test only.

Fixes 7bc364097a89 ("mcb: Acquire reference to device in probe")
---
 drivers/mcb/mcb-core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mcb/mcb-core.c +3 -1
index 338fc889b357..b8ad4f16b4ac 100644
@@ -71,8 +71,10 @@ static int mcb_probe(struct device *dev)
 
 	get_device(dev);
 	ret = mdrv->probe(mdev, found_id);
-	if (ret)
+	if (ret) {
 		module_put(carrier_mod);
+		put_device(dev);
+	}
 
 	return ret;
 }
Signature · 1 line
2.37.3
#2 lore raw

PATCH 2/2 mcb: mcb-parse: fix error handing in chameleon_parse_gdd()

In reply to Johannes Thumshirn

From: Yang Yingliang <[email protected]>

If mcb_device_register() returns error in chameleon_parse_gdd(), the refcount of bus and device name are leaked. Fix this by calling put_device() to give up the reference, so they can be released in mcb_release_dev() and kobject_cleanup().

Fixes 3764e82e5150 ("drivers: Introduce MEN Chameleon Bus")
---
 drivers/mcb/mcb-parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mcb/mcb-parse.c +1 -1
index 0266bfddfbe2..aa6938da0db8 100644
@@ -108,7 +108,7 @@ static int chameleon_parse_gdd(struct mcb_bus *bus,
 	return 0;
 
 err:
-	mcb_free_dev(mdev);
+	put_device(&mdev->dev);
 
 	return ret;
 }
Signature · 1 line
2.37.3