aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-11-08 02:00:24 -0500
committerJens Axboe <jens.axboe@oracle.com>2007-11-08 02:00:24 -0500
commitfffe487d59ba4017c7c62b06667ca4a226cee651 (patch)
treee7473f6bc2406c1f20119a2d5532d7ec2655bdb6 /drivers
parent8ec680e4c3ec818efd1652f15199ed1c216ab550 (diff)
pktcdvd: fix BUG caused by sysfs module reference semantics change
pkt_setup_dev() expects module reference to be held on invocation. This used to be true for sysfs callbacks but not anymore. Test and grab module reference around pkt_setup_dev() in class_pktcdvd_store_add(). Signed-off-by: Tejun Heo <htejun@gmail.com> Acked-by: Peter Osterlund <petero2@telia.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/pktcdvd.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index a8130a4ad6d4..a5ee21319d37 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -358,10 +358,19 @@ static ssize_t class_pktcdvd_store_add(struct class *c, const char *buf,
358 size_t count) 358 size_t count)
359{ 359{
360 unsigned int major, minor; 360 unsigned int major, minor;
361
361 if (sscanf(buf, "%u:%u", &major, &minor) == 2) { 362 if (sscanf(buf, "%u:%u", &major, &minor) == 2) {
363 /* pkt_setup_dev() expects caller to hold reference to self */
364 if (!try_module_get(THIS_MODULE))
365 return -ENODEV;
366
362 pkt_setup_dev(MKDEV(major, minor), NULL); 367 pkt_setup_dev(MKDEV(major, minor), NULL);
368
369 module_put(THIS_MODULE);
370
363 return count; 371 return count;
364 } 372 }
373
365 return -EINVAL; 374 return -EINVAL;
366} 375}
367 376