Signed-off-by: Fabian Grünbichler <f.gruenbich...@proxmox.com> --- 6.8/master only, patch straight from the linked LKML thread
affected user confirmed it fixes the issue, patch is very small and straight-forward. ...-devices-which-return-an-unusually-l.patch | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 patches/kernel/0016-scsi-core-Handle-devices-which-return-an-unusually-l.patch diff --git a/patches/kernel/0016-scsi-core-Handle-devices-which-return-an-unusually-l.patch b/patches/kernel/0016-scsi-core-Handle-devices-which-return-an-unusually-l.patch new file mode 100644 index 0000000..513d79b --- /dev/null +++ b/patches/kernel/0016-scsi-core-Handle-devices-which-return-an-unusually-l.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: "Martin K. Petersen" <martin.peter...@oracle.com> +Date: Mon, 20 May 2024 22:30:40 -0400 +Subject: [PATCH] scsi: core: Handle devices which return an unusually large + VPD page count +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Peter Schneider reported that a system would no longer boot after +updating to 6.8.4. Peter bisected the issue and identified commit +b5fc07a5fb56 ("scsi: core: Consult supported VPD page list prior to +fetching page") as being the culprit. + +Turns out the enclosure device in Peter's system reports a byteswapped +page length for VPD page 0. It reports "02 00" as page length instead +of "00 02". This causes us to attempt to access 516 bytes (page length ++ header) of information despite only 2 pages being present. + +Limit the page search scope to the size of our VPD buffer to guard +against devices returning a larger page count than requested. + +Cc: sta...@vger.kernel.org +Reported-by: Peter Schneider <pschneider1...@googlemail.com> +Tested-by: Peter Schneider <pschneider1...@googlemail.com> +Fixes: b5fc07a5fb56 ("scsi: core: Consult supported VPD page list prior to fetching page") +Link: https://lore.kernel.org/all/eec6ebbf-061b-4a7b-96dc-ea748aa4d...@googlemail.com/ +Signed-off-by: Martin K. Petersen <martin.peter...@oracle.com> +Signed-off-by: Fabian Grünbichler <f.gruenbich...@proxmox.com> +--- + drivers/scsi/scsi.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c +index 8cad9792a562..b3ff3a633a1e 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; -- 2.39.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel