From: Miroslav Benes <mbenes@suse.cz>
To: Yuehaibing <yuehaibing@huawei.com>
Cc: jeyu@kernel.org, gregkh@linuxfoundation.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] kernel/module: Fix mem leak in module_add_modinfo_attrs
Date: Tue, 4 Jun 2019 16:15:39 +0200 (CEST) [thread overview]
Message-ID: <alpine.LSU.2.21.1906041613480.16030@pobox.suse.cz> (raw)
In-Reply-To: <5705910c-ea13-9ff0-0d94-f2311fa510d9@huawei.com>
> >> -static void module_remove_modinfo_attrs(struct module *mod)
> >> +static void module_remove_modinfo_attrs(struct module *mod, int end)
> >> {
> >> struct module_attribute *attr;
> >> int i;
> >>
> >> for (i = 0; (attr = &mod->modinfo_attrs[i]); i++) {
> >> + if (end >= 0 && i > end)
> >> + break;
> >
> > If end == 0, you break the loop without calling sysfs_remove_file(), which
> > is a bug if you called module_remove_modinfo_attrs(mod, 0).
>
> If end == 0 and i == 0, if statement is false, it won't break the loop.
Eh, you're right of course.
Miroslav
next prev parent reply other threads:[~2019-06-04 14:15 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-15 16:12 [PATCH] kernel/module: Fix mem leak in module_add_modinfo_attrs YueHaibing
2019-05-30 9:24 ` Yuehaibing
2019-05-30 11:45 ` Jessica Yu
2019-05-30 13:32 ` Yuehaibing
2019-05-30 13:43 ` [PATCH v2] " YueHaibing
2019-06-03 10:47 ` Jessica Yu
2019-06-03 12:41 ` Yuehaibing
2019-06-03 12:11 ` Miroslav Benes
2019-06-03 14:45 ` Yuehaibing
2019-06-03 14:45 ` [PATCH v3] " YueHaibing
2019-06-04 10:46 ` Miroslav Benes
2019-06-04 13:54 ` Yuehaibing
2019-06-04 14:15 ` Miroslav Benes [this message]
2019-06-07 14:02 ` Jessica Yu
2019-06-11 13:33 ` Jessica Yu
2019-06-11 14:30 ` Yuehaibing
2019-06-11 15:38 ` Greg KH
2019-06-11 15:00 ` [PATCH v4] " YueHaibing
2019-06-12 11:12 ` Miroslav Benes
2019-06-14 7:54 ` Jessica Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LSU.2.21.1906041613480.16030@pobox.suse.cz \
--to=mbenes@suse.cz \
--cc=gregkh@linuxfoundation.org \
--cc=jeyu@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=yuehaibing@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.