1 From 8a52da632ceb9d8b776494563df579e87b7b586b Mon Sep 17 00:00:00 2001
2 From: Julia Lawall <julia@diku.dk>
3 Date: Sat, 15 May 2010 11:46:12 +0200
4 Subject: SCSI: aacraid: Eliminate use after free
6 From: Julia Lawall <julia@diku.dk>
8 commit 8a52da632ceb9d8b776494563df579e87b7b586b upstream.
10 The debugging code using the freed structure is moved before the kfree.
12 A simplified version of the semantic match that finds this problem is as
13 follows: (http://coccinelle.lip6.fr/)
23 expression free.E, subE<=free.E, E1;
36 Signed-off-by: Julia Lawall <julia@diku.dk>
37 Signed-off-by: James Bottomley <James.Bottomley@suse.de>
40 drivers/scsi/aacraid/commctrl.c | 4 ++--
41 1 file changed, 2 insertions(+), 2 deletions(-)
43 --- a/drivers/scsi/aacraid/commctrl.c
44 +++ b/drivers/scsi/aacraid/commctrl.c
45 @@ -655,9 +655,9 @@ static int aac_send_raw_srb(struct aac_d
46 /* Does this really need to be GFP_DMA? */
47 p = kmalloc(usg->sg[i].count,GFP_KERNEL|__GFP_DMA);
50 - dprintk((KERN_DEBUG"aacraid: Could not allocate SG buffer - size = %d buffer number %d of %d\n",
51 + dprintk((KERN_DEBUG "aacraid: Could not allocate SG buffer - size = %d buffer number %d of %d\n",
52 usg->sg[i].count,i,usg->count));