From: lyl2019@mail.ustc.edu.cn
To: "Luis Chamberlain" <mcgrof@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Re: [PATCH] lib/test_kmod: Fix a use after free in register_test_dev_kmod
Date: Thu, 11 Mar 2021 21:31:55 +0800 (GMT+08:00) [thread overview]
Message-ID: <17bb31cd.cc46.178217c9344.Coremail.lyl2019@mail.ustc.edu.cn> (raw)
In-Reply-To: <20210311130108.GS4332@42.do-not-panic.com>
> -----原始邮件-----
> 发件人: "Luis Chamberlain" <mcgrof@kernel.org>
> 发送时间: 2021-03-11 21:01:08 (星期四)
> 收件人: "Lv Yunlong" <lyl2019@mail.ustc.edu.cn>
> 抄送: linux-kernel@vger.kernel.org
> 主题: Re: [PATCH] lib/test_kmod: Fix a use after free in register_test_dev_kmod
>
> On Thu, Mar 11, 2021 at 12:02:46AM -0800, Lv Yunlong wrote:
> > In register_test_dev_kmod, it calls free_test_dev_kmod() to free
> > test_dev. But free_test_dev_kmod() can't set the original pointer
> > test_dev to NULL, because the test_dev was passed by it's value
> > not reference.
>
> Did you actually get a crash or something? If so can you supply the
> actual log? If this is just an observation and you think this is an
> issue, specifying that would help during patch review.
>
> Luis
>
> > Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
> > ---
> > lib/test_kmod.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/test_kmod.c b/lib/test_kmod.c
> > index 38c250fbace3..aa8a2a563d7e 100644
> > --- a/lib/test_kmod.c
> > +++ b/lib/test_kmod.c
> > @@ -1124,7 +1124,6 @@ static void free_test_dev_kmod(struct kmod_test_device *test_dev)
> > free_test_dev_info(test_dev);
> > kmod_config_free(test_dev);
> > vfree(test_dev);
> > - test_dev = NULL;
> > }
> > }
> >
> > @@ -1149,6 +1148,7 @@ static struct kmod_test_device *register_test_dev_kmod(void)
> > if (ret) {
> > pr_err("could not register misc device: %d\n", ret);
> > free_test_dev_kmod(test_dev);
> > + test_dev = NULL;
> > goto out;
> > }
> >
> > --
> > 2.25.1
> >
> >
This problem was reported by source code analyzers developed by our Security Lab(Loccs).
We have confirmed this issue before submiting the patch.
If you still have any questions about this patch, i will reply to you as soon as possible.
Thanks for your time.
next prev parent reply other threads:[~2021-03-11 13:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-11 8:02 Lv Yunlong
2021-03-11 13:01 ` Luis Chamberlain
2021-03-11 13:31 ` lyl2019 [this message]
2021-03-11 13:58 ` Luis Chamberlain
2021-03-11 14:40 ` lyl2019
2021-03-11 14:46 ` Luis Chamberlain
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=17bb31cd.cc46.178217c9344.Coremail.lyl2019@mail.ustc.edu.cn \
--to=lyl2019@mail.ustc.edu.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®