[PATCH 1/2] mcb: Acquire reference to device in probe

From: Johannes Thumshirn
Date: Tue May 10 2016 - 06:40:06 EST


mcb_probe() does not aqcuire a reference to the probed device but drops one
when removing the device. As it is actually using the device, it should grab
a reference via get_device().

This could lead to a panic found with a rmmod/modprobe stress test

Signed-off-by: Johannes Thumshirn <jthumshirn@xxxxxxx>
Reported-by: Andreas Werner <andreas.werner@xxxxxx>
Tested-by: Andreas Werner <andreas.werner@xxxxxx>
---
drivers/mcb/mcb-core.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/mcb/mcb-core.c b/drivers/mcb/mcb-core.c
index b73c6e7..f5923c2 100644
--- a/drivers/mcb/mcb-core.c
+++ b/drivers/mcb/mcb-core.c
@@ -66,6 +66,7 @@ static int mcb_probe(struct device *dev)
if (!found_id)
return -ENODEV;

+ get_device(dev);
return mdrv->probe(mdev, found_id);
}

--
2.8.1