mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Julia Lawall <julia@diku.dk>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, julia@diku.dk, hpa@zytor.com,
	mingo@redhat.com, yinghai@kernel.org, andreas.herrmann3@amd.com,
	robert.richter@amd.com, stable@kernel.org, tglx@linutronix.de,
	mingo@elte.hu, borislav.petkov@amd.com
Subject: [tip:x86/urgent] x86, mce, AMD: Fix leaving freed data in a list
Date: Sun, 15 May 2011 12:16:13 GMT	[thread overview]
Message-ID: <tip-d9a5ac9ef306eb5cc874f285185a15c303c50009@git.kernel.org> (raw)
In-Reply-To: <1305294731-12127-1-git-send-email-julia@diku.dk>

Commit-ID:  d9a5ac9ef306eb5cc874f285185a15c303c50009
Gitweb:     http://git.kernel.org/tip/d9a5ac9ef306eb5cc874f285185a15c303c50009
Author:     Julia Lawall <julia@diku.dk>
AuthorDate: Fri, 13 May 2011 15:52:09 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 13 May 2011 17:11:02 +0200

x86, mce, AMD: Fix leaving freed data in a list

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>
Cc: Borislav Petkov <borislav.petkov@amd.com>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Andreas Herrmann <andreas.herrmann3@amd.com>
Cc: <stable@kernel.org>
Link: http://lkml.kernel.org/r/1305294731-12127-1-git-send-email-julia@diku.dk
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/mcheck/mce_amd.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

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;

      parent reply	other threads:[~2011-05-15 12:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-13 13:52 [PATCH 1/3] arch/x86/kernel/cpu/mcheck/mce_amd.c: Avoid " Julia Lawall
2011-05-15  9:36 ` Borislav Petkov
2011-05-15 12:16 ` tip-bot for Julia Lawall [this message]

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=tip-d9a5ac9ef306eb5cc874f285185a15c303c50009@git.kernel.org \
    --to=julia@diku.dk \
    --cc=andreas.herrmann3@amd.com \
    --cc=borislav.petkov@amd.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=robert.richter@amd.com \
    --cc=stable@kernel.org \
    --cc=tglx@linutronix.de \
    --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

Powered by JetHome