1 From 57619f3cdeb5ae9f4252833b0ed600e9f81da722 Mon Sep 17 00:00:00 2001
2 From: Bart Van Assche <bvanassche@acm.org>
3 Date: Thu, 13 Jun 2024 14:18:27 -0700
4 Subject: scsi: usb: uas: Do not query the IO Advice Hints Grouping mode page for USB/UAS devices
6 From: Bart Van Assche <bvanassche@acm.org>
8 commit 57619f3cdeb5ae9f4252833b0ed600e9f81da722 upstream.
10 Recently it was reported that the following USB storage devices are
11 unusable with Linux kernel 6.9:
13 * Kingston DataTraveler G2
16 This is because attempting to read the IO Advice Hints Grouping mode page
17 causes these devices to reset. Hence do not read the IO Advice Hints
18 Grouping mode page from USB/UAS storage devices.
20 Acked-by: Alan Stern <stern@rowland.harvard.edu>
21 Cc: stable@vger.kernel.org
22 Fixes: 4f53138fffc2 ("scsi: sd: Translate data lifetime information")
23 Reported-by: Joao Machado <jocrismachado@gmail.com>
24 Closes: https://lore.kernel.org/linux-scsi/20240130214911.1863909-1-bvanassche@acm.org/T/#mf4e3410d8f210454d7e4c3d1fb5c0f41e651b85f
25 Tested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
26 Bisected-by: Christian Heusel <christian@heusel.eu>
27 Reported-by: Andy Shevchenko <andy.shevchenko@gmail.com>
28 Closes: https://lore.kernel.org/linux-scsi/CACLx9VdpUanftfPo2jVAqXdcWe8Y43MsDeZmMPooTzVaVJAh2w@mail.gmail.com/
29 Signed-off-by: Bart Van Assche <bvanassche@acm.org>
30 Link: https://lore.kernel.org/r/20240613211828.2077477-3-bvanassche@acm.org
31 Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
32 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
34 drivers/usb/storage/scsiglue.c | 6 ++++++
35 drivers/usb/storage/uas.c | 7 +++++++
36 2 files changed, 13 insertions(+)
38 --- a/drivers/usb/storage/scsiglue.c
39 +++ b/drivers/usb/storage/scsiglue.c
40 @@ -86,6 +86,12 @@ static int slave_alloc (struct scsi_devi
41 if (us->protocol == USB_PR_BULK && us->max_lun > 0)
42 sdev->sdev_bflags |= BLIST_FORCELUN;
45 + * Some USB storage devices reset if the IO advice hints grouping mode
46 + * page is queried. Hence skip that mode page.
48 + sdev->sdev_bflags |= BLIST_SKIP_IO_HINTS;
53 --- a/drivers/usb/storage/uas.c
54 +++ b/drivers/usb/storage/uas.c
56 #include <scsi/scsi.h>
57 #include <scsi/scsi_eh.h>
58 #include <scsi/scsi_dbg.h>
59 +#include <scsi/scsi_devinfo.h>
60 #include <scsi/scsi_cmnd.h>
61 #include <scsi/scsi_device.h>
62 #include <scsi/scsi_host.h>
63 @@ -820,6 +821,12 @@ static int uas_slave_alloc(struct scsi_d
64 struct uas_dev_info *devinfo =
65 (struct uas_dev_info *)sdev->host->hostdata;
68 + * Some USB storage devices reset if the IO advice hints grouping mode
69 + * page is queried. Hence skip that mode page.
71 + sdev->sdev_bflags |= BLIST_SKIP_IO_HINTS;
73 sdev->hostdata = devinfo;