public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <borislav.petkov@amd.com>
To: Julia Lawall <julia@diku.dk>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>, Ingo Molnar <mingo@redhat.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"Richter, Robert" <robert.richter@amd.com>,
	Yinghai Lu <yinghai@kernel.org>,
	"Herrmann3, Andreas" <Andreas.Herrmann3@amd.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/3] arch/x86/kernel/cpu/mcheck/mce_amd.c: Avoid
Date: Sun, 15 May 2011 09:36:29 +0000	[thread overview]
Message-ID: <20110515093629.GB10319@aftab> (raw)
In-Reply-To: <1305294731-12127-1-git-send-email-julia@diku.dk>

On Fri, May 13, 2011 at 09:52:09AM -0400, Julia Lawall wrote:
> 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>

Acked-by: Borislav Petkov <borislav.petkov@amd.com>

> 
> ---
>  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;
> 
> 

-- 
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632


      reply	other threads:[~2011-05-15  9:36 UTC|newest]

Thread overview: 2+ 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 leaving freed data in a list Julia Lawall
2011-05-15  9:36 ` Borislav Petkov [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=20110515093629.GB10319@aftab \
    --to=borislav.petkov@amd.com \
    --cc=Andreas.Herrmann3@amd.com \
    --cc=hpa@zytor.com \
    --cc=julia@diku.dk \
    --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