Skip to content

Commit

Permalink
Fix Off-by-one in /sys/module/*/refcnt
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alexey Dobriyan authored and Greg Kroah-Hartman committed Aug 22, 2007
1 parent 6cb5214 commit 256e2fd
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 256e2fd

Please sign in to comment.