mcb: Acquire reference to device in probe
authorJohannes Thumshirn <jthumshirn@suse.de>
Tue, 10 May 2016 10:39:44 +0000 (12:39 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jun 2016 01:49:30 +0000 (18:49 -0700)
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@suse.de>
Reported-by: Andreas Werner <andreas.werner@men.de>
Tested-by: Andreas Werner <andreas.werner@men.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mcb/mcb-core.c

index b73c6e7d28e4b9b0f337355aa75ce09d56c7e8f7..f5923c253f7ec478c985be15cf8cba54aea24070 100644 (file)
@@ -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);
 }