[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20120205220952.826423599@pcw.home.local>
Date: Sun, 05 Feb 2012 23:11:08 +0100
From: Willy Tarreau <w@....eu>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Jiri Slaby <jirislaby@...il.com>,
James Bottomley <James.Bottomley@...e.de>,
Greg KH <gregkh@...uxfoundation.org>
Subject: [PATCH 79/91] SCSI: scsi_lib: fix potential NULL dereference
2.6.27-longterm review patch. If anyone has any objections, please let us know.
------------------
commit 03b147083a2f9a2a3fbbd2505fa88ffa3c6ab194 upstream.
Stanse found a potential NULL dereference in scsi_kill_request.
Instead of triggering BUG() in 'if (unlikely(cmd == NULL))' branch,
the kernel will Oops earlier on cmd dereference.
Move the dereferences after the if.
[ WT: starget is not set in 2.6.27 ]
Signed-off-by: Jiri Slaby <jirislaby@...il.com>
Signed-off-by: James Bottomley <James.Bottomley@...e.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@...e.de>
---
drivers/scsi/scsi_lib.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
Index: longterm-2.6.27/drivers/scsi/scsi_lib.c
===================================================================
--- longterm-2.6.27.orig/drivers/scsi/scsi_lib.c 2012-02-05 22:34:42.697916475 +0100
+++ longterm-2.6.27/drivers/scsi/scsi_lib.c 2012-02-05 22:34:46.142917247 +0100
@@ -1389,8 +1389,8 @@
static void scsi_kill_request(struct request *req, struct request_queue *q)
{
struct scsi_cmnd *cmd = req->special;
- struct scsi_device *sdev = cmd->device;
- struct Scsi_Host *shost = sdev->host;
+ struct scsi_device *sdev;
+ struct Scsi_Host *shost;
blkdev_dequeue_request(req);
@@ -1400,6 +1400,8 @@
BUG();
}
+ sdev = cmd->device;
+ shost = sdev->host;
scsi_init_cmd_errh(cmd);
cmd->result = DID_NO_CONNECT << 16;
atomic_inc(&cmd->device->iorequest_cnt);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists