]> git.karo-electronics.de Git - karo-tx-linux.git/commit
drivers/scsi/ses.c: eliminate double free
authorJulia Lawall <julia@diku.dk>
Wed, 10 Mar 2010 23:20:42 +0000 (15:20 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 1 Apr 2010 23:01:08 +0000 (16:01 -0700)
commit997c7813cedb9829ef8973c8ed35ecba486925ac
treeccb2dc69680ded70eba1cc597d78e7ccf2faccfe
parentdbdafe5ccf02d6a59e412ac8314a030ec703e880
drivers/scsi/ses.c: eliminate double free

commit 9b3a6549b2602ca30f58715a0071e29f9898cae9 upstream.

The few lines below the kfree of hdr_buf may go to the label err_free
which will also free hdr_buf.  The most straightforward solution seems to
be to just move the kfree of hdr_buf after these gotos.

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

// <smpl>
@r@
identifier E;
expression E1;
iterator I;
statement S;
@@

*kfree(E);
... when != E = E1
    when != I(E,...) S
    when != &E
*kfree(E);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/scsi/ses.c