Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1397984

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

From Johannes Thumshirn <jthumshirn@suse.de>
Newsgroups linux.kernel
Subject [PATCH 1/2] mcb: Acquire reference to device in probe
Date 2016-05-10 12:50 +0200
Message-ID <rxdoK-P9-19@gated-at.bofh.it> (permalink)
References <rxdoJ-P9-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] MCB: two additional fixes for v4.7 Johannes Thumshirn <jthumshirn@suse.de> - 2016-05-10 12:50 +0200
  [PATCH 2/2] mcb: Acquire reference to carrier module in core Johannes Thumshirn <jthumshirn@suse.de> - 2016-05-10 12:50 +0200
  [PATCH 1/2] mcb: Acquire reference to device in probe Johannes Thumshirn <jthumshirn@suse.de> - 2016-05-10 12:50 +0200

csiph-web