Fix Off-by-one in /sys/module/*/refcnt
authorAlexey Dobriyan <adobriyan@gmail.com>
Mon, 6 Aug 2007 19:47:45 +0000 (23:47 +0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 22 Aug 2007 21:35:35 +0000 (14:35 -0700)
sysfs internals were changed to not pin module in question.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Kay Sievers <kay.sievers@vrfy.org>
Acked-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
kernel/module.c

index 33c04ad511750bc693410d9866b98dcfa6c2cb3d..db0ead0363e2504be6760e73cbef5a2b981a8565 100644 (file)
@@ -784,8 +784,7 @@ EXPORT_SYMBOL_GPL(symbol_put_addr);
 static ssize_t show_refcnt(struct module_attribute *mattr,
                           struct module *mod, char *buffer)
 {
-       /* sysfs holds a reference */
-       return sprintf(buffer, "%u\n", module_refcount(mod)-1);
+       return sprintf(buffer, "%u\n", module_refcount(mod));
 }
 
 static struct module_attribute refcnt = {