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

Fix Off-by-one in /sys/module/*/refcnt

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>

authored by

Alexey Dobriyan and committed by
Greg Kroah-Hartman
256e2fdf 6cb52147

+1 -2
+1 -2
kernel/module.c
··· 784 784 static ssize_t show_refcnt(struct module_attribute *mattr, 785 785 struct module *mod, char *buffer) 786 786 { 787 - /* sysfs holds a reference */ 788 - return sprintf(buffer, "%u\n", module_refcount(mod)-1); 787 + return sprintf(buffer, "%u\n", module_refcount(mod)); 789 788 } 790 789 791 790 static struct module_attribute refcnt = {