]> git.baikalelectronics.ru Git - kernel.git/commit
net/rfkill/core.c: Avoid leaving freed data in a list
authorJulia Lawall <julia@diku.dk>
Fri, 13 May 2011 13:52:10 +0000 (15:52 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 16 May 2011 18:10:42 +0000 (14:10 -0400)
commit1a9857152251aae798b34ced4d6da327ebf01e3e
treead4022b4c9f7ec4125b9d6716cd9865c3165c874
parenteb5315f8ad04af47b53fa314602735cb658a4f65
net/rfkill/core.c: Avoid leaving freed data in a list

The list_for_each_entry loop can fail, in which case the list element is
not removed from the list rfkill_fds.  Since this list is not accessed by
the loop, the addition of &data->list into the list is just moved after the
loop.

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>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/rfkill/core.c