public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] ses: double free
@ 2010-01-19  9:36 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2010-01-19  9:36 UTC (permalink / raw)
  To: James E.J. Bottomley; +Cc: linux-scsi

There are some code paths that go to err_free after already calling
kfree(hdr_buf).  I moved the kfree() lower to avoid the double free.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Cc: stable@kernel.org

--- orig/drivers/scsi/ses.c	2010-01-18 21:54:14.000000000 +0300
+++ devel/drivers/scsi/ses.c	2010-01-18 21:54:25.000000000 +0300
@@ -591,7 +591,6 @@ static int ses_intf_add(struct device *c
 		ses_dev->page10_len = len;
 		buf = NULL;
 	}
-	kfree(hdr_buf);
 
 	scomp = kzalloc(sizeof(struct ses_component) * components, GFP_KERNEL);
 	if (!scomp)
@@ -618,6 +617,7 @@ static int ses_intf_add(struct device *c
 		ses_match_to_enclosure(edev, tmp_sdev);
 	}
 
+	kfree(hdr_buf);
 	return 0;
 
  recv_failed:

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-01-19  9:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-19  9:36 [patch] ses: double free Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox