From: Hannes Reinecke <hare@suse.de>
Date: Mon, 13 Jun 2016 12:07:05 +0200
Subject: scsi: disable VPD page check on error
References: bsc#981954
Patch-Mainline: submitted linux-scsi, 2016/06/13
If we encounter an error during VPD page scanning we should be
setting the 'skip_vpd_pages' bit to avoid further accesses.
Signed-off-by: Hannes Reinecke <hare@suse.com>
---
drivers/scsi/scsi.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -481,14 +481,26 @@ void scsi_attach_vpd(struct scsi_device
/* Ask for all the pages supported by this device */
vpd_buf = scsi_get_vpd_buf(sdev, 0);
- if (!vpd_buf)
+ if (!vpd_buf) {
+ sdev->skip_vpd_pages = true;
return;
+ }
for (i = 4; i < vpd_buf->len; i++) {
- if (vpd_buf->data[i] == 0x80)
+ if (vpd_buf->data[i] == 0x80) {
scsi_update_vpd_page(sdev, 0x80, &sdev->vpd_pg80);
- if (vpd_buf->data[i] == 0x83)
+ if (sdev->vpd_pg80 == NULL) {
+ sdev->skip_vpd_pages = true;
+ break;
+ }
+ }
+ if (vpd_buf->data[i] == 0x83) {
scsi_update_vpd_page(sdev, 0x83, &sdev->vpd_pg83);
+ if (sdev->vpd_pg83 == NULL) {
+ sdev->skip_vpd_pages = true;
+ break;
+ }
+ }
}
kfree(vpd_buf);
}