]> git.baikalelectronics.ru Git - kernel.git/commit
mfd: Correct use after free for t7l66xb
authorJulia Lawall <julia@diku.dk>
Tue, 22 Dec 2009 20:31:43 +0000 (21:31 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Sun, 7 Mar 2010 21:16:55 +0000 (22:16 +0100)
commitf94a8a5f11f178d8c30ed951323f073d50ac6f0b
treeb2714e30224746ceea6d4e84acf9d8a33b09d300
parentc14a8e0b11e0e3290d16b3ed51590634a9f342dd
mfd: Correct use after free for t7l66xb

The structure t7l66xb should not be freed before the subsequent references
to its fields in the arguments to clk_put.  Furthermore, this structure is
allocated near the beginning of the function, and a goto to the label
err_noirq appears after a successful allocation, so it would seem that the
kfree should be moved down below this label.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,e;
identifier f;
iterator I;
statement S;
@@

*kfree(x);
... when != &x
    when != x = e
    when != I(x,...) S
*x->f
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
drivers/mfd/t7l66xb.c