Re: [PATCH] scsi: core: Handle devices which return an unusually large VPD page count

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

 



On 5/20/24 19:30, Martin K. Petersen wrote:
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 3e0c0381277a..f0464db3f9de 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -350,6 +350,13 @@ static int scsi_get_vpd_size(struct scsi_device *sdev, u8 page)
  		if (result < SCSI_VPD_HEADER_SIZE)
  			return 0;
+ if (result > sizeof(vpd)) {
+			dev_warn_once(&sdev->sdev_gendev,
+				      "%s: long VPD page 0 length: %d bytes\n",
+				      __func__, result);
+			result = sizeof(vpd);
+		}
+
  		result -= SCSI_VPD_HEADER_SIZE;
  		if (!memchr(&vpd[SCSI_VPD_HEADER_SIZE], page, result))
  			return 0;

Reviewed-by: Bart Van Assche <bvanassche@xxxxxxx>




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux