]> git.karo-electronics.de Git - karo-tx-linux.git/commit
x86, mce, AMD: Fix leaving freed data in a list
authorJulia Lawall <julia@diku.dk>
Fri, 13 May 2011 13:52:09 +0000 (15:52 +0200)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Wed, 14 Mar 2012 14:58:01 +0000 (10:58 -0400)
commit3d5a672b04e8d7ae10cef95f89919ba134bbf863
tree95777e23405933b3ec72323ab4e645b8ed578a6f
parent6f6d8b2ea9781cc39fd52769acec1e885913182a
x86, mce, AMD: Fix leaving freed data in a list

commit d9a5ac9ef306eb5cc874f285185a15c303c50009 upstream.

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>
Link: http://lkml.kernel.org/r/1305294731-12127-1-git-send-email-julia@diku.dk
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
arch/x86/kernel/cpu/mcheck/mce_amd.c