* [pve-devel] [PATCH pve-kernel] fix #5448: cherry-pick SCSI VPD fix
@ 2024-05-23 9:38 Fabian Grünbichler
2024-06-06 7:02 ` Fabian Grünbichler
0 siblings, 1 reply; 4+ messages in thread
From: Fabian Grünbichler @ 2024-05-23 9:38 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Fabian Grünbichler <f.gruenbichler@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.petersen@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: stable@vger.kernel.org
+Reported-by: Peter Schneider <pschneider1968@googlemail.com>
+Tested-by: Peter Schneider <pschneider1968@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-ea748aa4d035@googlemail.com/
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Fabian Grünbichler <f.gruenbichler@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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [pve-devel] [PATCH pve-kernel] fix #5448: cherry-pick SCSI VPD fix
2024-05-23 9:38 [pve-devel] [PATCH pve-kernel] fix #5448: cherry-pick SCSI VPD fix Fabian Grünbichler
@ 2024-06-06 7:02 ` Fabian Grünbichler
2024-06-17 7:49 ` Fiona Ebner
0 siblings, 1 reply; 4+ messages in thread
From: Fabian Grünbichler @ 2024-06-06 7:02 UTC (permalink / raw)
To: Proxmox VE development discussion
ping, it's in linux-next in the meantime :)
On May 23, 2024 11:38 am, Fabian Grünbichler wrote:
> Signed-off-by: Fabian Grünbichler <f.gruenbichler@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.petersen@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: stable@vger.kernel.org
> +Reported-by: Peter Schneider <pschneider1968@googlemail.com>
> +Tested-by: Peter Schneider <pschneider1968@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-ea748aa4d035@googlemail.com/
> +Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
> +Signed-off-by: Fabian Grünbichler <f.gruenbichler@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
>
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [pve-devel] [PATCH pve-kernel] fix #5448: cherry-pick SCSI VPD fix
2024-06-06 7:02 ` Fabian Grünbichler
@ 2024-06-17 7:49 ` Fiona Ebner
2024-06-20 9:08 ` [pve-devel] applied: " Fabian Grünbichler
0 siblings, 1 reply; 4+ messages in thread
From: Fiona Ebner @ 2024-06-17 7:49 UTC (permalink / raw)
To: Proxmox VE development discussion, Fabian Grünbichler
Am 06.06.24 um 09:02 schrieb Fabian Grünbichler:
> ping, it's in linux-next in the meantime :)
>
And now in some mainline stable kernels and v6.10-rc3.
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pve-devel] applied: [PATCH pve-kernel] fix #5448: cherry-pick SCSI VPD fix
2024-06-17 7:49 ` Fiona Ebner
@ 2024-06-20 9:08 ` Fabian Grünbichler
0 siblings, 0 replies; 4+ messages in thread
From: Fabian Grünbichler @ 2024-06-20 9:08 UTC (permalink / raw)
To: Proxmox VE development discussion
via -stable cherry-pick, but otherwise identical.
On June 17, 2024 9:49 am, Fiona Ebner wrote:
> Am 06.06.24 um 09:02 schrieb Fabian Grünbichler:
>> ping, it's in linux-next in the meantime :)
>>
>
> And now in some mainline stable kernels and v6.10-rc3.
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-06-20 9:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-23 9:38 [pve-devel] [PATCH pve-kernel] fix #5448: cherry-pick SCSI VPD fix Fabian Grünbichler
2024-06-06 7:02 ` Fabian Grünbichler
2024-06-17 7:49 ` Fiona Ebner
2024-06-20 9:08 ` [pve-devel] applied: " Fabian Grünbichler
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal