[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110515093629.GB10319@aftab>
Date: Sun, 15 May 2011 11:36:29 +0200
From: Borislav Petkov <borislav.petkov@....com>
To: Julia Lawall <julia@...u.dk>
CC: Thomas Gleixner <tglx@...utronix.de>,
"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>,
"x86@...nel.org" <x86@...nel.org>,
"Richter, Robert" <robert.richter@....com>,
Yinghai Lu <yinghai@...nel.org>,
"Herrmann3, Andreas" <Andreas.Herrmann3@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/3] arch/x86/kernel/cpu/mcheck/mce_amd.c: Avoid
leaving freed data in a list
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@...u.dk>
Acked-by: Borislav Petkov <borislav.petkov@....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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists