2014-08-25 14:33:49 +00:00
|
|
|
From e3206c8da31eef59b99065ad28463dd79ef20334 Mon Sep 17 00:00:00 2001
|
2014-08-20 17:22:24 +00:00
|
|
|
From: "kernel-team@fedoraproject.org" <kernel-team@fedoraproject.org>
|
|
|
|
Date: Fri, 10 Feb 2012 14:56:13 -0500
|
|
|
|
Subject: [PATCH] scsi: sd_revalidate_disk prevent NULL ptr deref
|
|
|
|
|
2013-12-17 16:16:02 +00:00
|
|
|
Bugzilla: 754518
|
|
|
|
Upstream-status: Fedora mustard (might be worth dropping...)
|
2014-08-20 17:22:24 +00:00
|
|
|
---
|
|
|
|
drivers/scsi/sd.c | 7 ++++++-
|
|
|
|
1 file changed, 6 insertions(+), 1 deletion(-)
|
2014-08-08 09:42:06 +00:00
|
|
|
|
|
|
|
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
|
|
|
|
index 2c2041ca4b70..e10812d985af 100644
|
|
|
|
--- a/drivers/scsi/sd.c
|
|
|
|
+++ b/drivers/scsi/sd.c
|
|
|
|
@@ -2749,13 +2749,18 @@ static int sd_try_extended_inquiry(struct scsi_device *sdp)
|
2012-02-10 19:56:13 +00:00
|
|
|
static int sd_revalidate_disk(struct gendisk *disk)
|
|
|
|
{
|
|
|
|
struct scsi_disk *sdkp = scsi_disk(disk);
|
|
|
|
- struct scsi_device *sdp = sdkp->device;
|
|
|
|
+ struct scsi_device *sdp;
|
|
|
|
unsigned char *buffer;
|
2014-08-08 09:42:06 +00:00
|
|
|
unsigned int max_xfer;
|
2012-02-10 19:56:13 +00:00
|
|
|
|
|
|
|
SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp,
|
|
|
|
"sd_revalidate_disk\n"));
|
|
|
|
|
2012-02-14 16:01:47 +00:00
|
|
|
+ if (WARN_ONCE((!sdkp), "Invalid scsi_disk from %p\n", disk))
|
2012-02-10 19:56:13 +00:00
|
|
|
+ goto out;
|
|
|
|
+
|
|
|
|
+ sdp = sdkp->device;
|
|
|
|
+
|
|
|
|
/*
|
|
|
|
* If the device is offline, don't try and read capacity or any
|
|
|
|
* of the other niceties.
|
2014-08-20 17:22:24 +00:00
|
|
|
--
|
|
|
|
1.9.3
|
|
|
|
|