Skip to content

Commit 35bb670

Browse files
committed
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "Two fixes: one in the ufs driver fixing an obvious memory leak and the other (with a core flag based update) trying to prevent USB crashes by stopping the core from issuing a request for the I/O Hints mode page" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: usb: uas: Do not query the IO Advice Hints Grouping mode page for USB/UAS devices scsi: core: Introduce the BLIST_SKIP_IO_HINTS flag scsi: ufs: core: Free memory allocated for model before reinit
2 parents d6c9415 + 57619f3 commit 35bb670

File tree

5 files changed

+21
-1
lines changed

5 files changed

+21
-1
lines changed

drivers/scsi/sd.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
#include <scsi/scsi_cmnd.h>
6464
#include <scsi/scsi_dbg.h>
6565
#include <scsi/scsi_device.h>
66+
#include <scsi/scsi_devinfo.h>
6667
#include <scsi/scsi_driver.h>
6768
#include <scsi/scsi_eh.h>
6869
#include <scsi/scsi_host.h>
@@ -3118,6 +3119,9 @@ static void sd_read_io_hints(struct scsi_disk *sdkp, unsigned char *buffer)
31183119
struct scsi_mode_data data;
31193120
int res;
31203121

3122+
if (sdp->sdev_bflags & BLIST_SKIP_IO_HINTS)
3123+
return;
3124+
31213125
res = scsi_mode_sense(sdp, /*dbd=*/0x8, /*modepage=*/0x0a,
31223126
/*subpage=*/0x05, buffer, SD_BUF_SIZE, SD_TIMEOUT,
31233127
sdkp->max_retries, &data, &sshdr);

drivers/ufs/core/ufshcd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8787,6 +8787,7 @@ static int ufshcd_probe_hba(struct ufs_hba *hba, bool init_dev_params)
87878787
(hba->quirks & UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH)) {
87888788
/* Reset the device and controller before doing reinit */
87898789
ufshcd_device_reset(hba);
8790+
ufs_put_device_desc(hba);
87908791
ufshcd_hba_stop(hba);
87918792
ufshcd_vops_reinit_notify(hba);
87928793
ret = ufshcd_hba_enable(hba);

drivers/usb/storage/scsiglue.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ static int slave_alloc (struct scsi_device *sdev)
7979
if (us->protocol == USB_PR_BULK && us->max_lun > 0)
8080
sdev->sdev_bflags |= BLIST_FORCELUN;
8181

82+
/*
83+
* Some USB storage devices reset if the IO advice hints grouping mode
84+
* page is queried. Hence skip that mode page.
85+
*/
86+
sdev->sdev_bflags |= BLIST_SKIP_IO_HINTS;
87+
8288
return 0;
8389
}
8490

drivers/usb/storage/uas.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <scsi/scsi.h>
2222
#include <scsi/scsi_eh.h>
2323
#include <scsi/scsi_dbg.h>
24+
#include <scsi/scsi_devinfo.h>
2425
#include <scsi/scsi_cmnd.h>
2526
#include <scsi/scsi_device.h>
2627
#include <scsi/scsi_host.h>
@@ -820,6 +821,12 @@ static int uas_slave_alloc(struct scsi_device *sdev)
820821
struct uas_dev_info *devinfo =
821822
(struct uas_dev_info *)sdev->host->hostdata;
822823

824+
/*
825+
* Some USB storage devices reset if the IO advice hints grouping mode
826+
* page is queried. Hence skip that mode page.
827+
*/
828+
sdev->sdev_bflags |= BLIST_SKIP_IO_HINTS;
829+
823830
sdev->hostdata = devinfo;
824831
return 0;
825832
}

include/scsi/scsi_devinfo.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,10 @@
6969
#define BLIST_RETRY_ITF ((__force blist_flags_t)(1ULL << 32))
7070
/* Always retry ABORTED_COMMAND with ASC 0xc1 */
7171
#define BLIST_RETRY_ASC_C1 ((__force blist_flags_t)(1ULL << 33))
72+
/* Do not query the IO Advice Hints Grouping mode page */
73+
#define BLIST_SKIP_IO_HINTS ((__force blist_flags_t)(1ULL << 34))
7274

73-
#define __BLIST_LAST_USED BLIST_RETRY_ASC_C1
75+
#define __BLIST_LAST_USED BLIST_SKIP_IO_HINTS
7476

7577
#define __BLIST_HIGH_UNUSED (~(__BLIST_LAST_USED | \
7678
(__force blist_flags_t) \

0 commit comments

Comments
 (0)