]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
scsi: core: Improve scsi_vpd_inquiry() checks
authorDamien Le Moal <damien.lemoal@opensource.wdc.com>
Wed, 22 Mar 2023 02:22:11 +0000 (11:22 +0900)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 16 Jun 2023 12:57:54 +0000 (14:57 +0200)
commit26f4f44a232da34e25c3bb366b71d1d7518536bf
treeb794f994f0abc6e965e8edfaa336ed85688d642b
parent654db865d1f2a8cdaaf901946238964b81ab4de1
scsi: core: Improve scsi_vpd_inquiry() checks

BugLink: https://bugs.launchpad.net/bugs/2023929
[ Upstream commit f0aa59a33d2ac2267d260fe21eaf92500df8e7b4 ]

Some USB-SATA adapters have broken behavior when an unsupported VPD page is
probed: Depending on the VPD page number, a 4-byte header with a valid VPD
page number but with a 0 length is returned. Currently, scsi_vpd_inquiry()
only checks that the page number is valid to determine if the page is
valid, which results in receiving only the 4-byte header for the
non-existent page. This error manifests itself very often with page 0xb9
for the Concurrent Positioning Ranges detection done by sd_read_cpr(),
resulting in the following error message:

sd 0:0:0:0: [sda] Invalid Concurrent Positioning Ranges VPD page

Prevent such misleading error message by adding a check in
scsi_vpd_inquiry() to verify that the page length is not 0.

Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Link: https://lore.kernel.org/r/20230322022211.116327-1-damien.lemoal@opensource.wdc.com
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/scsi/scsi.c