[PATCH v1] scsi: Check the SPC version in sd_read_cpr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add SPC version verification to avoid unnecessary inquiry command

Signed-off-by: Yohan Joung <yohan.joung@xxxxxx>
---
 drivers/scsi/sd.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 6203915945a4..9d71ad24d8e3 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -3413,11 +3413,16 @@ static inline sector_t sd64_to_sectors(struct scsi_disk *sdkp, u8 *buf)
 static void sd_read_cpr(struct scsi_disk *sdkp)
 {
 	struct blk_independent_access_ranges *iars = NULL;
+	struct scsi_device *sdev = sdkp->device;
 	unsigned char *buffer = NULL;
 	unsigned int nr_cpr = 0;
 	int i, vpd_len, buf_len = SD_BUF_SIZE;
 	u8 *desc;
 
+	/* Support for CPR was defined in SPC-5. */
+	if (sdev->scsi_level < SCSI_SPC_5)
+		return;
+
 	/*
 	 * We need to have the capacity set first for the block layer to be
 	 * able to check the ranges.
-- 
2.25.1





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux