提交 fffe487d 编写于 作者: T Tejun Heo 提交者: Jens Axboe

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: NTejun Heo <htejun@gmail.com>
Acked-by: NPeter Osterlund <petero2@telia.com>
Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
上级 8ec680e4
......@@ -358,10 +358,19 @@ static ssize_t class_pktcdvd_store_add(struct class *c, const char *buf,
size_t count)
{
unsigned int major, minor;
if (sscanf(buf, "%u:%u", &major, &minor) == 2) {
/* pkt_setup_dev() expects caller to hold reference to self */
if (!try_module_get(THIS_MODULE))
return -ENODEV;
pkt_setup_dev(MKDEV(major, minor), NULL);
module_put(THIS_MODULE);
return count;
}
return -EINVAL;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册