block: missing module_put in put_disk
PATCH 1/1 block: missing module_put in put_disk
From: Chun Wu <[email protected]>
module_put function is not called in put_disk function. Should it be added?
--- block/genhd.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
block/genhd.c +7 -0
@@ -1228,6 +1228,13 @@ EXPORT_SYMBOL(get_disk);void put_disk (struct gendisk *disk) { +#ifdef CONFIG_MODULE_UNLOAD +struct module *owner; + + owner = disk->fops->owner; +if (owner) +module_put (owner); +#endif if (disk)kobject_put (&disk_to_dev (disk)->kobj); }
Signature · 1 line
1.5.6.5
Quoted 3 lines · Chun Wu
From: Chun Wu <[email protected]>
module_putfunction is not called input_diskfunction. Should it be added?
Check the callers. Check the callers of get_disk. Think whether those two are counterparts. See if any callers would have module_put() nearby. See if any callers would not have module_put() nearby. See if there is anything that would distinguish one class from another. Think whether they need different behaviour. Then you'll be able to answer your question. As a bonus, consider the source of confusion and see if you can remove it [I'm serious, BTW - get_disk() is apparently a lousy name asking for confusion; renaming it might be a useful thing to do, provided that new name would be less confusing]
[snip the patch blindly adding such call]