diff options
Diffstat (limited to 'drivers/block/pktcdvd.c')
-rw-r--r-- | drivers/block/pktcdvd.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index a8130a4ad6d4..3535ef896677 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -117,8 +117,10 @@ static struct pktcdvd_kobj* pkt_kobj_create(struct pktcdvd_device *pd, | |||
117 | p->kobj.parent = parent; | 117 | p->kobj.parent = parent; |
118 | p->kobj.ktype = ktype; | 118 | p->kobj.ktype = ktype; |
119 | p->pd = pd; | 119 | p->pd = pd; |
120 | if (kobject_register(&p->kobj) != 0) | 120 | if (kobject_register(&p->kobj) != 0) { |
121 | kobject_put(&p->kobj); | ||
121 | return NULL; | 122 | return NULL; |
123 | } | ||
122 | return p; | 124 | return p; |
123 | } | 125 | } |
124 | /* | 126 | /* |
@@ -358,10 +360,19 @@ static ssize_t class_pktcdvd_store_add(struct class *c, const char *buf, | |||
358 | size_t count) | 360 | size_t count) |
359 | { | 361 | { |
360 | unsigned int major, minor; | 362 | unsigned int major, minor; |
363 | |||
361 | if (sscanf(buf, "%u:%u", &major, &minor) == 2) { | 364 | if (sscanf(buf, "%u:%u", &major, &minor) == 2) { |
365 | /* pkt_setup_dev() expects caller to hold reference to self */ | ||
366 | if (!try_module_get(THIS_MODULE)) | ||
367 | return -ENODEV; | ||
368 | |||
362 | pkt_setup_dev(MKDEV(major, minor), NULL); | 369 | pkt_setup_dev(MKDEV(major, minor), NULL); |
370 | |||
371 | module_put(THIS_MODULE); | ||
372 | |||
363 | return count; | 373 | return count; |
364 | } | 374 | } |
375 | |||
365 | return -EINVAL; | 376 | return -EINVAL; |
366 | } | 377 | } |
367 | 378 | ||