public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: "James E.J. Bottomley" <James.Bottomley@suse.de>
Cc: linux-scsi@vger.kernel.org
Subject: [patch] ses: double free
Date: Tue, 19 Jan 2010 12:36:39 +0300	[thread overview]
Message-ID: <20100119093639.GB23956@bicker> (raw)

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:

                 reply	other threads:[~2010-01-19  9:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100119093639.GB23956@bicker \
    --to=error27@gmail.com \
    --cc=James.Bottomley@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox