* [PATCH 0/2] Do not read the IO hints VPD page from USB storage devices @ 2024-06-12 16:52 Bart Van Assche 2024-06-12 16:52 ` [PATCH 1/2] scsi: core: Introduce the BLIST_SKIP_IO_HINTS flag Bart Van Assche 2024-06-12 16:52 ` [PATCH 2/2] scsi: core: Do not query IO hints for USB devices Bart Van Assche 0 siblings, 2 replies; 9+ messages in thread From: Bart Van Assche @ 2024-06-12 16:52 UTC (permalink / raw) To: Martin K . Petersen; +Cc: Alan Stern, linux-scsi, linux-usb, Bart Van Assche Hi Martin, Recently it was reported that reading the IO hints VPD page makes at least two USB storage devices crash. Hence this patch series that disables reading the IO hints VPD page from USB storage devices. Please consider this patch series for your scsi-fixes branch. Thanks, Bart. Bart Van Assche (2): scsi: core: Introduce the BLIST_SKIP_IO_HINTS flag scsi: core: Do not query IO hints for USB devices drivers/scsi/sd.c | 4 ++++ drivers/usb/storage/scsiglue.c | 2 ++ include/scsi/scsi_devinfo.h | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] scsi: core: Introduce the BLIST_SKIP_IO_HINTS flag 2024-06-12 16:52 [PATCH 0/2] Do not read the IO hints VPD page from USB storage devices Bart Van Assche @ 2024-06-12 16:52 ` Bart Van Assche 2024-06-12 16:52 ` [PATCH 2/2] scsi: core: Do not query IO hints for USB devices Bart Van Assche 1 sibling, 0 replies; 9+ messages in thread From: Bart Van Assche @ 2024-06-12 16:52 UTC (permalink / raw) To: Martin K . Petersen Cc: Alan Stern, linux-scsi, linux-usb, Bart Van Assche, Joao Machado, Andy Shevchenko, Christian Heusel, stable, James E.J. Bottomley Prepare for skipping reading the IO hints VPD page for USB storage devices. Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Joao Machado <jocrismachado@gmail.com> Cc: Andy Shevchenko <andy.shevchenko@gmail.com> Cc: Christian Heusel <christian@heusel.eu> Cc: stable@vger.kernel.org Fixes: 4f53138fffc2 ("scsi: sd: Translate data lifetime information") Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- drivers/scsi/sd.c | 4 ++++ include/scsi/scsi_devinfo.h | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 3a43e2209751..fcf3d7730466 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -63,6 +63,7 @@ #include <scsi/scsi_cmnd.h> #include <scsi/scsi_dbg.h> #include <scsi/scsi_device.h> +#include <scsi/scsi_devinfo.h> #include <scsi/scsi_driver.h> #include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> @@ -3117,6 +3118,9 @@ static void sd_read_io_hints(struct scsi_disk *sdkp, unsigned char *buffer) struct scsi_mode_data data; int res; + if (sdp->sdev_bflags & BLIST_SKIP_IO_HINTS) + return; + res = scsi_mode_sense(sdp, /*dbd=*/0x8, /*modepage=*/0x0a, /*subpage=*/0x05, buffer, SD_BUF_SIZE, SD_TIMEOUT, sdkp->max_retries, &data, &sshdr); diff --git a/include/scsi/scsi_devinfo.h b/include/scsi/scsi_devinfo.h index 6b548dc2c496..fa8721e49dec 100644 --- a/include/scsi/scsi_devinfo.h +++ b/include/scsi/scsi_devinfo.h @@ -69,8 +69,10 @@ #define BLIST_RETRY_ITF ((__force blist_flags_t)(1ULL << 32)) /* Always retry ABORTED_COMMAND with ASC 0xc1 */ #define BLIST_RETRY_ASC_C1 ((__force blist_flags_t)(1ULL << 33)) +/* Do not read the I/O hints mode page */ +#define BLIST_SKIP_IO_HINTS ((__force blist_flags_t)(1ULL << 34)) -#define __BLIST_LAST_USED BLIST_RETRY_ASC_C1 +#define __BLIST_LAST_USED BLIST_SKIP_IO_HINTS #define __BLIST_HIGH_UNUSED (~(__BLIST_LAST_USED | \ (__force blist_flags_t) \ ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] scsi: core: Do not query IO hints for USB devices 2024-06-12 16:52 [PATCH 0/2] Do not read the IO hints VPD page from USB storage devices Bart Van Assche 2024-06-12 16:52 ` [PATCH 1/2] scsi: core: Introduce the BLIST_SKIP_IO_HINTS flag Bart Van Assche @ 2024-06-12 16:52 ` Bart Van Assche 2024-06-12 18:08 ` Alan Stern 2024-06-13 17:44 ` Andy Shevchenko 1 sibling, 2 replies; 9+ messages in thread From: Bart Van Assche @ 2024-06-12 16:52 UTC (permalink / raw) To: Martin K . Petersen Cc: Alan Stern, linux-scsi, linux-usb, Bart Van Assche, Joao Machado, Andy Shevchenko, Christian Heusel, stable, Greg Kroah-Hartman Recently it was reported that the following USB storage devices are unusable with Linux kernel 6.9: * Kingston DataTraveler G2 * Garmin FR35 This is because attempting to read the IO hint VPD page causes these devices to reset. Hence do not read the IO hint VPD page from USB storage devices. Cc: Alan Stern <stern@rowland.harvard.edu> Cc: linux-usb@vger.kernel.org Cc: Joao Machado <jocrismachado@gmail.com> Cc: Andy Shevchenko <andy.shevchenko@gmail.com> Cc: Christian Heusel <christian@heusel.eu> Cc: stable@vger.kernel.org Fixes: 4f53138fffc2 ("scsi: sd: Translate data lifetime information") Reported-by: Joao Machado <jocrismachado@gmail.com> Closes: https://lore.kernel.org/linux-scsi/20240130214911.1863909-1-bvanassche@acm.org/T/#mf4e3410d8f210454d7e4c3d1fb5c0f41e651b85f Tested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Bisected-by: Christian Heusel <christian@heusel.eu> Reported-by: Andy Shevchenko <andy.shevchenko@gmail.com> Closes: https://lore.kernel.org/linux-scsi/CACLx9VdpUanftfPo2jVAqXdcWe8Y43MsDeZmMPooTzVaVJAh2w@mail.gmail.com/ Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- drivers/usb/storage/scsiglue.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index b31464740f6c..9a7185c68872 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c @@ -79,6 +79,8 @@ static int slave_alloc (struct scsi_device *sdev) if (us->protocol == USB_PR_BULK && us->max_lun > 0) sdev->sdev_bflags |= BLIST_FORCELUN; + sdev->sdev_bflags |= BLIST_SKIP_IO_HINTS; + return 0; } ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] scsi: core: Do not query IO hints for USB devices 2024-06-12 16:52 ` [PATCH 2/2] scsi: core: Do not query IO hints for USB devices Bart Van Assche @ 2024-06-12 18:08 ` Alan Stern 2024-06-12 19:30 ` Bart Van Assche 2024-06-13 17:44 ` Andy Shevchenko 1 sibling, 1 reply; 9+ messages in thread From: Alan Stern @ 2024-06-12 18:08 UTC (permalink / raw) To: Bart Van Assche Cc: Martin K . Petersen, linux-scsi, linux-usb, Joao Machado, Andy Shevchenko, Christian Heusel, stable, Greg Kroah-Hartman On Wed, Jun 12, 2024 at 09:52:49AM -0700, Bart Van Assche wrote: > Recently it was reported that the following USB storage devices are unusable > with Linux kernel 6.9: > * Kingston DataTraveler G2 > * Garmin FR35 > > This is because attempting to read the IO hint VPD page causes these devices > to reset. Hence do not read the IO hint VPD page from USB storage devices. > > Cc: Alan Stern <stern@rowland.harvard.edu> > Cc: linux-usb@vger.kernel.org > Cc: Joao Machado <jocrismachado@gmail.com> > Cc: Andy Shevchenko <andy.shevchenko@gmail.com> > Cc: Christian Heusel <christian@heusel.eu> > Cc: stable@vger.kernel.org > Fixes: 4f53138fffc2 ("scsi: sd: Translate data lifetime information") > Reported-by: Joao Machado <jocrismachado@gmail.com> > Closes: https://lore.kernel.org/linux-scsi/20240130214911.1863909-1-bvanassche@acm.org/T/#mf4e3410d8f210454d7e4c3d1fb5c0f41e651b85f > Tested-by: Andy Shevchenko <andy.shevchenko@gmail.com> > Bisected-by: Christian Heusel <christian@heusel.eu> > Reported-by: Andy Shevchenko <andy.shevchenko@gmail.com> > Closes: https://lore.kernel.org/linux-scsi/CACLx9VdpUanftfPo2jVAqXdcWe8Y43MsDeZmMPooTzVaVJAh2w@mail.gmail.com/ > Signed-off-by: Bart Van Assche <bvanassche@acm.org> > --- > drivers/usb/storage/scsiglue.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c > index b31464740f6c..9a7185c68872 100644 > --- a/drivers/usb/storage/scsiglue.c > +++ b/drivers/usb/storage/scsiglue.c > @@ -79,6 +79,8 @@ static int slave_alloc (struct scsi_device *sdev) > if (us->protocol == USB_PR_BULK && us->max_lun > 0) > sdev->sdev_bflags |= BLIST_FORCELUN; > > + sdev->sdev_bflags |= BLIST_SKIP_IO_HINTS; > + > return 0; > } You might want to do the same thing in uas.c. I don't know if UAS devices suffer from the same problem, but it wouldn't be surprising if they do. Alan Stern ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] scsi: core: Do not query IO hints for USB devices 2024-06-12 18:08 ` Alan Stern @ 2024-06-12 19:30 ` Bart Van Assche 2024-06-12 19:43 ` Alan Stern 0 siblings, 1 reply; 9+ messages in thread From: Bart Van Assche @ 2024-06-12 19:30 UTC (permalink / raw) To: Alan Stern Cc: Martin K . Petersen, linux-scsi, linux-usb, Joao Machado, Andy Shevchenko, Christian Heusel, stable, Greg Kroah-Hartman On 6/12/24 11:08 AM, Alan Stern wrote: > You might want to do the same thing in uas.c. I don't know if UAS > devices suffer from the same problem, but it wouldn't be surprising if > they do. Hi Alan, How about replacing patch 2/2 from this series with the patch below? Thanks, Bart. diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index b31464740f6c..b4cf0349fd0d 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c @@ -79,6 +79,12 @@ static int slave_alloc (struct scsi_device *sdev) if (us->protocol == USB_PR_BULK && us->max_lun > 0) sdev->sdev_bflags |= BLIST_FORCELUN; + /* + * Some USB storage devices reset if the IO hints VPD page is queried. + * Hence skip that VPD page. + */ + sdev->sdev_bflags |= BLIST_SKIP_IO_HINTS; + return 0; } diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index a48870a87a29..bb75901b53e3 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c @@ -820,6 +820,12 @@ static int uas_slave_alloc(struct scsi_device *sdev) struct uas_dev_info *devinfo = (struct uas_dev_info *)sdev->host->hostdata; + /* + * Some USB storage devices reset if the IO hints VPD page is queried. + * Hence skip that VPD page. + */ + sdev->sdev_bflags |= BLIST_SKIP_IO_HINTS; + sdev->hostdata = devinfo; return 0; } ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] scsi: core: Do not query IO hints for USB devices 2024-06-12 19:30 ` Bart Van Assche @ 2024-06-12 19:43 ` Alan Stern 0 siblings, 0 replies; 9+ messages in thread From: Alan Stern @ 2024-06-12 19:43 UTC (permalink / raw) To: Bart Van Assche Cc: Martin K . Petersen, linux-scsi, linux-usb, Joao Machado, Andy Shevchenko, Christian Heusel, stable, Greg Kroah-Hartman On Wed, Jun 12, 2024 at 12:30:34PM -0700, Bart Van Assche wrote: > On 6/12/24 11:08 AM, Alan Stern wrote: > > You might want to do the same thing in uas.c. I don't know if UAS > > devices suffer from the same problem, but it wouldn't be surprising if > > they do. > > Hi Alan, > > How about replacing patch 2/2 from this series with the patch below? That's better, thanks. Alan Stern > > Thanks, > > Bart. > > diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c > index b31464740f6c..b4cf0349fd0d 100644 > --- a/drivers/usb/storage/scsiglue.c > +++ b/drivers/usb/storage/scsiglue.c > @@ -79,6 +79,12 @@ static int slave_alloc (struct scsi_device *sdev) > if (us->protocol == USB_PR_BULK && us->max_lun > 0) > sdev->sdev_bflags |= BLIST_FORCELUN; > > + /* > + * Some USB storage devices reset if the IO hints VPD page is queried. > + * Hence skip that VPD page. > + */ > + sdev->sdev_bflags |= BLIST_SKIP_IO_HINTS; > + > return 0; > } > > diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c > index a48870a87a29..bb75901b53e3 100644 > --- a/drivers/usb/storage/uas.c > +++ b/drivers/usb/storage/uas.c > @@ -820,6 +820,12 @@ static int uas_slave_alloc(struct scsi_device *sdev) > struct uas_dev_info *devinfo = > (struct uas_dev_info *)sdev->host->hostdata; > > + /* > + * Some USB storage devices reset if the IO hints VPD page is queried. > + * Hence skip that VPD page. > + */ > + sdev->sdev_bflags |= BLIST_SKIP_IO_HINTS; > + > sdev->hostdata = devinfo; > return 0; > } > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] scsi: core: Do not query IO hints for USB devices 2024-06-12 16:52 ` [PATCH 2/2] scsi: core: Do not query IO hints for USB devices Bart Van Assche 2024-06-12 18:08 ` Alan Stern @ 2024-06-13 17:44 ` Andy Shevchenko 2024-06-13 18:10 ` Bart Van Assche 1 sibling, 1 reply; 9+ messages in thread From: Andy Shevchenko @ 2024-06-13 17:44 UTC (permalink / raw) To: Bart Van Assche Cc: Martin K . Petersen, Alan Stern, linux-scsi, linux-usb, Joao Machado, Christian Heusel, stable, Greg Kroah-Hartman On Wed, Jun 12, 2024 at 6:53 PM Bart Van Assche <bvanassche@acm.org> wrote: > > Recently it was reported that the following USB storage devices are unusable > with Linux kernel 6.9: > * Kingston DataTraveler G2 > * Garmin FR35 > > This is because attempting to read the IO hint VPD page causes these devices > to reset. Hence do not read the IO hint VPD page from USB storage devices. > Cc: Alan Stern <stern@rowland.harvard.edu> > Cc: linux-usb@vger.kernel.org > Cc: Joao Machado <jocrismachado@gmail.com> > Cc: Andy Shevchenko <andy.shevchenko@gmail.com> > Cc: Christian Heusel <christian@heusel.eu> Besides no need to repeat these Cc's in case there are other tags for the same emails, can you move the rest of Cc's after the --- line below? For you it will be the same effect, for many others the Git history won't be polluted with this noise. -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] scsi: core: Do not query IO hints for USB devices 2024-06-13 17:44 ` Andy Shevchenko @ 2024-06-13 18:10 ` Bart Van Assche 2024-06-13 19:44 ` Andy Shevchenko 0 siblings, 1 reply; 9+ messages in thread From: Bart Van Assche @ 2024-06-13 18:10 UTC (permalink / raw) To: Andy Shevchenko Cc: Martin K . Petersen, Alan Stern, linux-scsi, linux-usb, Joao Machado, Christian Heusel, stable, Greg Kroah-Hartman On 6/13/24 10:44 AM, Andy Shevchenko wrote: > On Wed, Jun 12, 2024 at 6:53 PM Bart Van Assche <bvanassche@acm.org> wrote: >> >> Recently it was reported that the following USB storage devices are unusable >> with Linux kernel 6.9: >> * Kingston DataTraveler G2 >> * Garmin FR35 >> >> This is because attempting to read the IO hint VPD page causes these devices >> to reset. Hence do not read the IO hint VPD page from USB storage devices. > >> Cc: Alan Stern <stern@rowland.harvard.edu> >> Cc: linux-usb@vger.kernel.org >> Cc: Joao Machado <jocrismachado@gmail.com> > >> Cc: Andy Shevchenko <andy.shevchenko@gmail.com> >> Cc: Christian Heusel <christian@heusel.eu> > > Besides no need to repeat these Cc's in case there are other tags for > the same emails, can you move the rest of Cc's after the --- line > below? For you it will be the same effect, for many others the Git > history won't be polluted with this noise. I will leave out the redundant Cc's but I'm surprised by the request to move Cc tags after the --- line. There are many patches with Cc: tags in Linus' tree. I have never before seen anyone requesting to move Cc tags after the --- line. Thanks, Bart. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] scsi: core: Do not query IO hints for USB devices 2024-06-13 18:10 ` Bart Van Assche @ 2024-06-13 19:44 ` Andy Shevchenko 0 siblings, 0 replies; 9+ messages in thread From: Andy Shevchenko @ 2024-06-13 19:44 UTC (permalink / raw) To: Bart Van Assche Cc: Martin K . Petersen, Alan Stern, linux-scsi, linux-usb, Joao Machado, Christian Heusel, stable, Greg Kroah-Hartman On Thu, Jun 13, 2024 at 8:10 PM Bart Van Assche <bvanassche@acm.org> wrote: > On 6/13/24 10:44 AM, Andy Shevchenko wrote: > > On Wed, Jun 12, 2024 at 6:53 PM Bart Van Assche <bvanassche@acm.org> wrote: > >> > >> Recently it was reported that the following USB storage devices are unusable > >> with Linux kernel 6.9: > >> * Kingston DataTraveler G2 > >> * Garmin FR35 > >> > >> This is because attempting to read the IO hint VPD page causes these devices > >> to reset. Hence do not read the IO hint VPD page from USB storage devices. > > > >> Cc: Alan Stern <stern@rowland.harvard.edu> > >> Cc: linux-usb@vger.kernel.org > >> Cc: Joao Machado <jocrismachado@gmail.com> > > > >> Cc: Andy Shevchenko <andy.shevchenko@gmail.com> > >> Cc: Christian Heusel <christian@heusel.eu> > > > > Besides no need to repeat these Cc's in case there are other tags for > > the same emails, can you move the rest of Cc's after the --- line > > below? For you it will be the same effect, for many others the Git > > history won't be polluted with this noise. > > I will leave out the redundant Cc's but I'm surprised by the request to move > Cc tags after the --- line. There are many patches with Cc: tags in Linus' tree. I know, and that's why I am asking for them to be moved away. It's just duplicate information and since we have lore.kernel.org, we may always get the real message with the same data, no need to repeat this in Git history. > I have never before seen anyone requesting to move Cc tags after the --- line. -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-06-13 19:44 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-06-12 16:52 [PATCH 0/2] Do not read the IO hints VPD page from USB storage devices Bart Van Assche 2024-06-12 16:52 ` [PATCH 1/2] scsi: core: Introduce the BLIST_SKIP_IO_HINTS flag Bart Van Assche 2024-06-12 16:52 ` [PATCH 2/2] scsi: core: Do not query IO hints for USB devices Bart Van Assche 2024-06-12 18:08 ` Alan Stern 2024-06-12 19:30 ` Bart Van Assche 2024-06-12 19:43 ` Alan Stern 2024-06-13 17:44 ` Andy Shevchenko 2024-06-13 18:10 ` Bart Van Assche 2024-06-13 19:44 ` Andy Shevchenko
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).