From: Julia Lawall <julia@diku.dk>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: kernel-janitors@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
"H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, Borislav Petkov <borislav.petkov@amd.com>,
Robert Richter <robert.richter@amd.com>,
Yinghai Lu <yinghai@kernel.org>,
Andreas Herrmann <andreas.herrmann3@amd.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] arch/x86/kernel/cpu/mcheck/mce_amd.c: Avoid leaving freed data in a list
Date: Fri, 13 May 2011 13:52:09 +0000 [thread overview]
Message-ID: <1305294731-12127-1-git-send-email-julia@diku.dk> (raw)
b may be added to a list, but is not removed before being freed in the case
of an error. This is done in the corresponding deallocation function, so
the code here has been changed to follow that.
The sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression E,E1,E2;
identifier l;
@@
*list_add(&E->l,E1);
... when != E1
when != list_del(&E->l)
when != list_del_init(&E->l)
when != E = E2
*kfree(E);// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
arch/x86/kernel/cpu/mcheck/mce_amd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index 167f97b..bb0adad 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -509,6 +509,7 @@ recurse:
out_free:
if (b) {
kobject_put(&b->kobj);
+ list_del(&b->miscj);
kfree(b);
}
return err;
next reply other threads:[~2011-05-13 13:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-13 13:52 Julia Lawall [this message]
2011-05-15 9:36 ` [PATCH 1/3] arch/x86/kernel/cpu/mcheck/mce_amd.c: Avoid Borislav Petkov
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=1305294731-12127-1-git-send-email-julia@diku.dk \
--to=julia@diku.dk \
--cc=andreas.herrmann3@amd.com \
--cc=borislav.petkov@amd.com \
--cc=hpa@zytor.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=robert.richter@amd.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=yinghai@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