Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ubi: gluebi: Fix double refcounting

There is no need to call get/put on the module
reference in gluebi_get/put_device() callbacks.
Since mtd->owner is the gluebi module itself
mtdcore.c will take care of proper refcounting
in __get/put_mtd_device() before executing the
callbacks.

Signed-off-by: Richard Weinberger <richard@nod.at>

-5
-5
drivers/mtd/ubi/gluebi.c
··· 99 99 struct gluebi_device *gluebi; 100 100 int ubi_mode = UBI_READONLY; 101 101 102 - if (!try_module_get(THIS_MODULE)) 103 - return -ENODEV; 104 - 105 102 if (mtd->flags & MTD_WRITEABLE) 106 103 ubi_mode = UBI_READWRITE; 107 104 ··· 126 129 ubi_mode); 127 130 if (IS_ERR(gluebi->desc)) { 128 131 mutex_unlock(&devices_mutex); 129 - module_put(THIS_MODULE); 130 132 return PTR_ERR(gluebi->desc); 131 133 } 132 134 gluebi->refcnt += 1; ··· 149 153 gluebi->refcnt -= 1; 150 154 if (gluebi->refcnt == 0) 151 155 ubi_close_volume(gluebi->desc); 152 - module_put(THIS_MODULE); 153 156 mutex_unlock(&devices_mutex); 154 157 } 155 158