From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
"Martin K. Petersen" <martin.petersen@oracle.com>,
James Bottomley <James.Bottomley@suse.de>
Subject: [2/3] SCSI: Fix protection scsi_data_buffer leak
Date: Thu, 15 Oct 2009 11:54:32 -0700 [thread overview]
Message-ID: <20091015211020.055924387@mini.kroah.org> (raw)
In-Reply-To: <20091015211112.GA5634@kroah.com>
[-- Attachment #1: scsi-fix-protection-scsi_data_buffer-leak.patch --]
[-- Type: text/plain, Size: 1356 bytes --]
2.6.27-stable review patch. If anyone has any objections, please let us know.
------------------
From: Martin K. Petersen <martin.petersen@oracle.com>
commit b4c2554d40ceac130a8d062eaa8838ed22158c45 upstream.
We would leak a scsi_data_buffer if the free_list command was of the
protected variety.
Reported-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/scsi/scsi.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -243,10 +243,7 @@ scsi_host_alloc_command(struct Scsi_Host
*/
struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *shost, gfp_t gfp_mask)
{
- struct scsi_cmnd *cmd;
- unsigned char *buf;
-
- cmd = scsi_host_alloc_command(shost, gfp_mask);
+ struct scsi_cmnd *cmd = scsi_host_alloc_command(shost, gfp_mask);
if (unlikely(!cmd)) {
unsigned long flags;
@@ -260,9 +257,15 @@ struct scsi_cmnd *__scsi_get_command(str
spin_unlock_irqrestore(&shost->free_list_lock, flags);
if (cmd) {
+ void *buf, *prot;
+
buf = cmd->sense_buffer;
+ prot = cmd->prot_sdb;
+
memset(cmd, 0, sizeof(*cmd));
+
cmd->sense_buffer = buf;
+ cmd->prot_sdb = prot;
}
}
next prev parent reply other threads:[~2009-10-15 21:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20091015185430.128674330@mini.kroah.org>
2009-10-15 21:11 ` [0/3] 2.6.27.38-stable review Greg KH
2009-10-15 18:54 ` [1/3] usb-serial: fix crash when sub-driver updates firmware Greg KH
2009-10-15 18:54 ` Greg KH [this message]
2009-10-15 18:54 ` [3/3] USB: digi_acceleport: Fix broken unthrottle Greg KH
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=20091015211020.055924387@mini.kroah.org \
--to=gregkh@suse.de \
--cc=James.Bottomley@suse.de \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=stable-review@kernel.org \
--cc=stable@kernel.org \
--cc=torvalds@linux-foundation.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
Powered by JetHome