lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1329192654-11284-1-git-send-email-hamo.by@gmail.com>
Date:	Tue, 14 Feb 2012 12:10:54 +0800
From:	Yang Bai <hamo.by@...il.com>
To:	JBottomley@...allels.com
Cc:	linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
	Yang Bai <hamo.by@...il.com>
Subject: [PATCH] scsi: if sd card is removed, do not revalidate it

During revalidating, if sd card is removed, scsi_device
will be NULL, so we should not revalidate or it will cause
a panic.
This problem is report at:
http://comments.gmane.org/gmane.linux.kernel/1250235

Signed-off-by: Yang Bai <hamo.by@...il.com>
---
 drivers/scsi/sd.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index c691fb5..470339c 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2370,10 +2370,10 @@ static int sd_revalidate_disk(struct gendisk *disk)
 				      "sd_revalidate_disk\n"));
 
 	/*
-	 * If the device is offline, don't try and read capacity or any
+	 * If the device is removed or offline, don't try and read capacity or any
 	 * of the other niceties.
 	 */
-	if (!scsi_device_online(sdp))
+	if (!sdp || !scsi_device_online(sdp))
 		goto out;
 
 	buffer = kmalloc(SD_BUF_SIZE, GFP_KERNEL);
-- 
1.7.9

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ