aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/storage
AgeCommit message (Collapse)AuthorFilesLines
2017-11-01usb-storage: make use of srb local variableAlan Stern1-17/+17
Commit 8b52291a0743 ("usb-storage: fix deadlock involving host lock and scsi_done") added a local variable to usb_stor_control_thread() in the usb-storage driver. This local variable holds the value of us->srb, for use after the host lock has been released. But as long as we have the value in a local variable, we may as well use it instead of dereferencing the us pointer all over the place. This patch makes no functional change; it just makes the code a little shorter and a little neater. Signed-off-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-10-30usb: storage: sddr55: mark expected switch fall-throughGustavo A. R. Silva1-0/+1
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-10-09Merge 4.14-rc4 into usb-nextGreg Kroah-Hartman4-13/+33
This merges in the USB fixes that we need here. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-09-22USB: uas: fix bug in handling of alternate settingsAlan Stern2-12/+13
The uas driver has a subtle bug in the way it handles alternate settings. The uas_find_uas_alt_setting() routine returns an altsetting value (the bAlternateSetting number in the descriptor), but uas_use_uas_driver() then treats that value as an index to the intf->altsetting array, which it isn't. Normally this doesn't cause any problems because the various alternate settings have bAlternateSetting values 0, 1, 2, ..., so the value is equal to the index in the array. But this is not guaranteed, and Andrey Konovalov used the syzkaller fuzzer with KASAN to get a slab-out-of-bounds error by violating this assumption. This patch fixes the bug by making uas_find_uas_alt_setting() return a pointer to the altsetting entry rather than either the value or the index. Pointers are less subject to misinterpretation. Signed-off-by: Alan Stern <[email protected]> Reported-by: Andrey Konovalov <[email protected]> Tested-by: Andrey Konovalov <[email protected]> CC: Oliver Neukum <[email protected]> CC: <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-09-22usb-storage: unusual_devs entry to fix write-access regression for Seagate ↵Alan Stern1-0/+7
external drives Kris Lindgren reports that without the NO_WP_DETECT flag, his Seagate external disk drive fails all write accesses. This regresssion dates back approximately to the start of the 4.x kernel releases. Signed-off-by: Alan Stern <[email protected]> Reported-by: Kris Lindgren <[email protected]> CC: <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-09-22usb-storage: fix bogus hardware error messages for ATA pass-thru devicesAlan Stern1-1/+13
Ever since commit a621bac3044e ("scsi_lib: correctly retry failed zero length REQ_TYPE_FS commands"), people have been getting bogus error messages for USB disk drives using ATA pass-thru. For example: [ 1344.880193] sd 6:0:0:0: [sdb] Attached SCSI disk [ 1345.069152] sd 6:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_ERROR driverbyte=DRIVER_SENSE [ 1345.069159] sd 6:0:0:0: [sdb] tag#0 Sense Key : Hardware Error [current] [descriptor] [ 1345.069162] sd 6:0:0:0: [sdb] tag#0 Add. Sense: No additional sense information [ 1345.069168] sd 6:0:0:0: [sdb] tag#0 CDB: ATA command pass through(16) 85 06 20 00 00 00 00 00 00 00 00 00 00 00 e5 00 [ 1345.172252] sd 6:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_ERROR driverbyte=DRIVER_SENSE [ 1345.172258] sd 6:0:0:0: [sdb] tag#0 Sense Key : Hardware Error [current] [descriptor] [ 1345.172261] sd 6:0:0:0: [sdb] tag#0 Add. Sense: No additional sense information [ 1345.172266] sd 6:0:0:0: [sdb] tag#0 CDB: ATA command pass through(12)/Blank a1 06 20 da 00 00 4f c2 00 b0 00 00 These messages can be quite annoying, because programs like udisks2 provoke them every 10 minutes or so. Other programs can also have this effect, such as those in smartmontools. I don't fully understand how that commit induced the SCSI core to log these error messages, but the underlying cause for them is code added to usb-storage by commit f1a0743bc0e7 ("USB: storage: When a device returns no sense data, call it a Hardware Error"). At the time it was necessary to do this, in order to prevent an infinite retry loop with some not-so-great mass storage devices. However, the ATA pass-thru protocol uses SCSI sense data to return command status values, and some devices always report Check Condition status for ATA pass-thru commands to ensure that the host retrieves the sense data, even if the command succeeded. This violates the USB mass-storage protocol (Check Condition status is supposed to mean the command failed), but we can't help that. This patch attempts to mitigate the problem of these bogus error reports by changing usb-storage. The HARDWARE ERROR sense key will be inserted only for commands that aren't ATA pass-thru. Thanks to Ewan Milne for pointing out that this mechanism was present in usb-storage. 8 years after writing it, I had completely forgotten its existence. Signed-off-by: Alan Stern <[email protected]> Tested-by: Kris Lindgren <[email protected]> Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1351305 CC: Ewan D. Milne <[email protected]> CC: <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-09-18usb: storage: make const arrays static, reduces object code sizeColin Ian King1-2/+2
Don't populate const arrays on the stack, instead make them static. Makes the object code smaller by over 1070 bytes: Before: text data bss dec hex filename 3505 880 0 4385 1121 drivers/usb/storage/option_ms.o After: text data bss dec hex filename 2269 1040 0 3309 ced drivers/usb/storage/option_ms.o Signed-off-by: Colin Ian King <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-09-07Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsiLinus Torvalds1-2/+2
Pull SCSI updates from James Bottomley: "This is mostly updates of the usual suspects: lpfc, qla2xxx, hisi_sas, megaraid_sas, zfcp and a host of minor updates. The major driver change here is the elimination of the block based cciss driver in favour of the SCSI based hpsa driver (which now drives all the legacy cases cciss used to be required for). Plus a reset handler clean up and the redo of the SAS SMP handler to use bsg lib" * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (279 commits) scsi: scsi-mq: Always unprepare before requeuing a request scsi: Show .retries and .jiffies_at_alloc in debugfs scsi: Improve requeuing behavior scsi: Call scsi_initialize_rq() for filesystem requests scsi: qla2xxx: Reset the logo flag, after target re-login. scsi: qla2xxx: Fix slow mem alloc behind lock scsi: qla2xxx: Clear fc4f_nvme flag scsi: qla2xxx: add missing includes for qla_isr scsi: qla2xxx: Fix an integer overflow in sysfs code scsi: aacraid: report -ENOMEM to upper layer from aac_convert_sgraw2() scsi: aacraid: get rid of one level of indentation scsi: aacraid: fix indentation errors scsi: storvsc: fix memory leak on ring buffer busy scsi: scsi_transport_sas: switch to bsg-lib for SMP passthrough scsi: smartpqi: remove the smp_handler stub scsi: hpsa: remove the smp_handler stub scsi: bsg-lib: pass the release callback through bsg_setup_queue scsi: Rework handling of scsi_device.vpd_pg8[03] scsi: Rework the code for caching Vital Product Data (VPD) scsi: rcu: Introduce rcu_swap_protected() ...
2017-08-25scsi: uas: move eh_bus_reset_handler to eh_device_reset_handlerHannes Reinecke1-2/+2
The bus_reset handler is really a device reset, so move it to eh_device_reset_handler(). Signed-off-by: Hannes Reinecke <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2017-08-14Merge 4.13-rc5 into usb-nextGreg Kroah-Hartman2-8/+14
This gets the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-07-30usb-storage: fix deadlock involving host lock and scsi_doneAlan Stern1-6/+12
Christoph Hellwig says that since version 4.12, the kernel switched to using blk-mq by default. The old code used a softirq for handling request completions, but blk-mq can handle completions in the caller's context. This may cause a problem for usb-storage, because it invokes the ->scsi_done callback while holding the host lock, and the completion routine sometimes tries to acquire the same lock (when running the error handler, for example). The consequence is that the existing code will sometimes deadlock upon error completion of a SCSI command (with a lockdep warning). This is easy enough to fix, since usb-storage doesn't really need to hold the host lock while the callback runs. It was simpler to write it that way, but moving the call outside the locked region is pretty easy and there's no downside. That's what this patch does. Signed-off-by: Alan Stern <[email protected]> Reported-and-tested-by: Arthur Marsh <[email protected]> CC: Christoph Hellwig <[email protected]> CC: <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-07-30uas: Add US_FL_IGNORE_RESIDUE for Initio Corporation INIC-3069Alan Swanson1-2/+2
Similar to commit d595259fbb7a ("usb-storage: Add ignore-residue quirk for Initio INIC-3619") for INIC-3169 in unusual_devs.h but INIC-3069 already present in unusual_uas.h. Both in same controller IC family. Issue is that MakeMKV fails during key exchange with installed bluray drive with following error: 002004:0000 Error 'Scsi error - ILLEGAL REQUEST:COPY PROTECTION KEY EXCHANGE FAILURE - KEY NOT ESTABLISHED' occurred while issuing SCSI command AD010..080002400 to device 'SG:dev_11:0' Signed-off-by: Alan Swanson <[email protected]> Acked-by: Oliver Neukum <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-07-23Merge 4.13-rc2 into usb-nextGreg Kroah-Hartman1-1/+4
We want the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-07-22USB: realtek_cr: remove unneeded MODULE_VERSION() usageGreg Kroah-Hartman1-1/+0
MODULE_VERSION is useless for in-kernel drivers, so remove the use of it in the Realtek USB card reader driver. Cc: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-07-17usb: storage: return on error to avoid a null pointer dereferenceColin Ian King1-1/+4
When us->extra is null the driver is not initialized, however, a later call to osd200_scsi_to_ata is made that dereferences us->extra, causing a null pointer dereference. The code currently detects and reports that the driver is not initialized; add a return to avoid the subsequent dereference issue in this check. Thanks to Alan Stern for pointing out that srb->result needs setting to DID_ERROR << 16 Detected by CoverityScan, CID#100308 ("Dereference after null check") Signed-off-by: Colin Ian King <[email protected]> Cc: stable <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-05-22Merge 4.12-rc2 into usb-nextGreg Kroah-Hartman1-35/+55
We want the USB fixes in here as well to handle testing and merge issues. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-05-18USB: ene_usb6250: turn off the Removable flagAlan Stern1-1/+1
In the ene_usb6250 sub-driver for usb-storage, the INQUIRY data returned by the driver indicates that the device has removable media. While this is technically correct (memory cards can be removed from the reader), it is not useful because the device automatically disconnects itself from the USB bus when no media is present. In addition, the driver does not support the PREVENT-ALLOW MEDIUM REMOVAL and START STOP UNIT commands, and this can cause user-interface frameworks to get confused when the user asks for the card to be removed or ejected. This patch fixes the problem by changing the INQUIRY data to specify non-removable media; in practice this value works much better. Signed-off-by: Alan Stern <[email protected]> Reported-and-tested-by: Andreas Hartmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-05-18USB: ene_usb6250: remove subroutine duplicationAlan Stern1-27/+14
In the ene_usb6250 sub-driver for usb-storage, the sd_scsi_inquiry() and ms_scsi_inquiry() subroutines (one meant for use with SD memory cards and the other for use with MS memory cards) are exact duplicates. This patch removes the duplication by creating a single do_scsi_inquiry() command and using it instead of the other two. Signed-off-by: Alan Stern <[email protected]> Tested-by: Andreas Hartmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-05-18USB: ene_usb6250: implement REQUEST SENSEAlan Stern1-8/+33
In the ene_usb6250 sub-driver for usb-storage, there is no support for the REQUEST SENSE command. This command is issued whenever a failure occurs, and without it the driver has no way to tell the SCSI core what the reason for the failure was. This patch adds a do_scsi_request_sense() routine to the driver. The new routine reports the error code stored by the previous command. Signed-off-by: Alan Stern <[email protected]> Reported-and-tested-by: Andreas Hartmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-05-18USB: ene_usb6250: fix SCSI residue overwritingAlan Stern1-0/+2
In the ene_usb6250 sub-driver for usb-storage, the SCSI residue is not reported correctly. The residue is initialized to 0, but this value is overwritten whenever the driver sends firmware to the card reader before performing the current command. As a result, a valid READ or WRITE operation appears to have failed, causing the SCSI core to retry the command multiple times and eventually fail. This patch fixes the problem by resetting the SCSI residue to 0 after sending firmware to the device. Signed-off-by: Alan Stern <[email protected]> Reported-and-tested-by: Andreas Hartmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-05-18USB: ene_usb6250: fix first command executionAlan Stern1-4/+5
In the ene_usb6250 sub-driver for usb-storage, the ene_transport() routine is supposed to initialize the driver before executing the current command, if the initialization has not already been performed. However, a bug in the routine causes it to skip the command after doing the initialization. Also, the routine does not return an appropriate error code if either the initialization or the command fails. As a result of the first bug, the first command (a SCSI INQUIRY) is not carried out. The results can be seen in the system log, in the form of a warning message and empty or garbage INQUIRY data: Apr 18 22:40:08 notebook2 kernel: scsi host6: scsi scan: INQUIRY result too short (5), using 36 Apr 18 22:40:08 notebook2 kernel: scsi 6:0:0:0: Direct-Access PQ: 0 ANSI: 0 This patch fixes both errors. Signed-off-by: Alan Stern <[email protected]> Reported-and-tested-by: Andreas Hartmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-05-17USB: ene_usb6250: fix DMA to the stackAlan Stern1-35/+55
The ene_usb6250 sub-driver in usb-storage does USB I/O to buffers on the stack, which doesn't work with vmapped stacks. This patch fixes the problem by allocating a separate 512-byte buffer at probe time and using it for all of the offending I/O operations. Signed-off-by: Alan Stern <[email protected]> Reported-and-tested-by: Andreas Hartmann <[email protected]> CC: <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-04-25USB: storage: e-mail update in drivers/usb/storage/unusual_devs.hPhillip Potter1-1/+1
Updates the e-mail address of Phillip Potter, updater of the Nokia 6288 entry in drivers/usb/storage/unusual_devs.h Signed-off-by: Phillip Potter <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-04-18usb: fix some references for /proc/bus/usbMauro Carvalho Chehab1-1/+1
Since when we got rid of usbfs, the /proc/bus/usb is now elsewhere. Fix references for it. Signed-off-by: Mauro Carvalho Chehab <[email protected]> Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-03-23USB: storage: refactor endpoint retrievalJohan Hovold1-27/+13
Use the new endpoint helpers to lookup the required bulk-in and bulk-out endpoints and the (typically) optional interrupt-in endpoint. Cc: [email protected] Signed-off-by: Johan Hovold <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-03-17usb: storage: karma: remove useless variablePierre-Yves Kerbrat1-3/+3
Remove the useless variable 'partial' storing the actual length transferred. Nothing was done with it, so simply get rid of it as usb_stor_bulk_transfer_buf can handle having NULL instead. This also fixes the following sparse issues (-Wtypesign): drivers/usb/storage/karma.c:122:51: warning: incorrect type in argument 5 (different signedness) drivers/usb/storage/karma.c:122:51: expected unsigned int *act_len drivers/usb/storage/karma.c:122:51: got int *<noident> drivers/usb/storage/karma.c:127:52: warning: incorrect type in argument 5 (different signedness) drivers/usb/storage/karma.c:127:52: expected unsigned int *act_len drivers/usb/storage/karma.c:127:52: got int *<noident> Signed-off-by: Pierre-Yves Kerbrat <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-03-09usb-storage: Add ignore-residue quirk for Initio INIC-3619Tobias Jakobi1-0/+14
This USB-SATA bridge chip is used in a StarTech enclosure for optical drives. Without the quirk MakeMKV fails during the key exchange with an installed BluRay drive: > Error 'Scsi error - ILLEGAL REQUEST:COPY PROTECTION KEY EXCHANGE FAILURE - KEY NOT ESTABLISHED' > occurred while issuing SCSI command AD010..080002400 to device 'SG:dev_11:2' Signed-off-by: Tobias Jakobi <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-01-25usb: storage: sddr09: Remove a set-but-not-used variableAugusto Mecking Caringi1-3/+1
The 'isnew' variable in 'sddr09_write_lba' function is set but never used. This has been detected by building the driver with W=1: drivers/usb/storage/sddr09.c: In function ‘sddr09_write_lba’: drivers/usb/storage/sddr09.c:873:17: warning: variable ‘isnew’ set but not used [-Wunused-but-set-variable] int i, result, isnew; ^ Signed-off-by: Augusto Mecking Caringi <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-01-19usb: storage: ene_ub6250: remove unused variableSudip Mukherjee1-2/+0
The variable Newblk was only being assigned some value but was never used after that. Signed-off-by: Sudip Mukherjee <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-01-05usb: storage: unusual_uas: Add JMicron JMS56x to unusual deviceOliver Neukum1-0/+7
This device gives the following error on detection. xhci_hcd 0000:00:11.0: ERROR Transfer event for disabled endpoint or incorrect stream ring The same error is not seen when it is added to unusual_device list with US_FL_NO_REPORT_OPCODES passed. Signed-off-by: George Cherian <[email protected]> Signed-off-by: Oliver Neukum <[email protected]> CC: [email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-11-28Merge 4.9-rc7 into usb-nextGreg Kroah-Hartman1-1/+6
We want the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-11-15Fix USB CB/CBI storage devices with CONFIG_VMAP_STACK=yPetr Vandrovec1-1/+6
Some code (all error handling) submits CDBs that are allocated on the stack. This breaks with CB/CBI code that tries to create URB directly from SCSI command buffer - which happens to be in vmalloced memory with vmalloced kernel stacks. Let's make copy of the command in usb_stor_CB_transport. Signed-off-by: Petr Vandrovec <[email protected]> Cc: stable <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-11-07usb: storage: drop freezer.h usageGreg Kroah-Hartman1-1/+0
usb-storage does not use any freezer apis, so drop the inclusion of freezer.h from the drivers/usb/storage/usb.c file. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-09-13scsi: introduce a quirk for false cache reportingOliver Neukum3-1/+20
Some SATA to USB bridges fail to cooperate with some drives resulting in no cache being present being reported to the host. That causes the host to skip sending a command to synchronize caches. That causes data loss when the drive is powered down. Signed-off-by: Oliver Neukum <[email protected]> Reviewed-by: Martin K. Petersen <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-08-30usb: storage: sddr09: don't print on ENOMEMWolfram Sang1-10/+4
All kmalloc-based functions print enough information on failures. Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-08-30usb: storage: alauda: don't print on ENOMEMWolfram Sang1-8/+3
All kmalloc-based functions print enough information on failures. Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-08-15usb: storage: usb: don't print error when allocating urb failsWolfram Sang1-3/+1
kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-08-09usb: storage: fix runtime pm issue in usb_stor_probe2Heiner Kallweit1-2/+4
Since commit 71723f95463d "PM / runtime: print error when activating a child to unactive parent" I see the following error message: scsi host2: usb-storage 1-3:1.0 scsi host2: runtime PM trying to activate child device host2 but parent (1-3:1.0) is not active Digging into it it seems to be related to the problem described in the commit message for cd998ded5c12 "i2c: designware: Prevent runtime suspend during adapter registration" as scsi_add_host also calls device_add and after the call to device_add the parent device is suspended. Fix this by using the approach from the mentioned commit and getting the runtime pm reference before calling scsi_add_host. Signed-off-by: Heiner Kallweit <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-06-01USB: uas: Fix slave queue_depth not being setHans de Goede1-0/+1
Commit 198de51dbc34 ("USB: uas: Limit qdepth at the scsi-host level") removed the scsi_change_queue_depth() call from uas_slave_configure() assuming that the slave would inherit the host's queue_depth, which that commit sets to the same value. This is incorrect, without the scsi_change_queue_depth() call the slave's queue_depth defaults to 1, introducing a performance regression. This commit restores the call, fixing the performance regression. Cc: [email protected] Fixes: 198de51dbc34 ("USB: uas: Limit qdepth at the scsi-host level") Reported-by: Tom Yan <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-06-01uas: remove can_queue set in host templateTom Yan1-1/+0
Commit 198de51dbc34 ("USB: uas: Limit qdepth at the scsi-host level") made qdepth limit set in host template (`.can_queue = MAX_CMNDS`) redundant. Removing it to avoid confusion. Signed-off-by: Tom Yan <[email protected]> Acked-by: Hans de Goede <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-05-20Merge tag 'usb-4.7-rc1' of ↵Linus Torvalds42-455/+851
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb Pull USB updates from Greg KH: "Here's the big pull request for USB and PHY drivers for 4.7-rc1 Full details in the shortlog, but it's the normal major gadget driver updates, phy updates, new usbip code, as well as a bit of lots of other stuff. All have been in linux-next with no reported issues" * tag 'usb-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (164 commits) USB: serial: ti_usb_3410_5052: add MOXA UPORT 11x0 support USB: serial: fix minor-number allocation USB: serial: quatech2: fix use-after-free in probe error path USB: serial: mxuport: fix use-after-free in probe error path USB: serial: keyspan: fix debug and error messages USB: serial: keyspan: fix URB unlink USB: serial: keyspan: fix use-after-free in probe error path USB: serial: io_edgeport: fix memory leaks in probe error path USB: serial: io_edgeport: fix memory leaks in attach error path usb: Remove unnecessary space before operator ','. usb: Remove unnecessary space before open square bracket. USB: FHCI: avoid redundant condition usb: host: xhci-rcar: Avoid long wait in xhci_reset() usb/host/fotg210: remove dead code in create_sysfs_files usb: wusbcore: Do not initialise statics to 0. usb: wusbcore: Remove space before ',' and '(' . USB: serial: cp210x: clean up CRTSCTS flag code USB: serial: cp210x: get rid of magic numbers in CRTSCTS flag code USB: serial: cp210x: fix hardware flow-control disable USB: serial: option: add even more ZTE device ids ...
2016-05-17Merge branch 'fixes' into miscJames Bottomley3-3/+30
2016-04-26usb: storage: fix multi-line comment styleFelipe Balbi42-455/+829
No functional changes here, just making sure our storage driver uses a consistent multi-line comment style. Signed-off-by: Felipe Balbi <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-04-26usb: storage: scsiglue: limit USB3 devices to 2048 sectorsFelipe Balbi1-0/+5
USB3 devices, because they are much newer, have much less chance of having issues with larger transfers. We still keep a limit because anything above 2048 sectors really rendered negligible speed improvements, so we will simply ignore that. Transferring 1MiB should already give us pretty good performance. Signed-off-by: Felipe Balbi <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-04-26usb: storage: scsiglue: further describe our 240 sector limitFelipe Balbi1-1/+18
Just so we have some sort of documentation as to why we limit our Mass Storage transfers to 240 sectors, let's update the comment to make clearer that devices were found that would choke with larger transfers. While at that, also make sure to clarify that other operating systems have similar, albeit different, limits on mass storage transfers. Signed-off-by: Felipe Balbi <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-04-15scsi: rename SCSI_MAX_{SG, SG_CHAIN}_SEGMENTSMing Lin1-1/+1
Rename SCSI_MAX_SG_SEGMENTS to SG_CHUNK_SIZE, which means the amount we fit into a single scatterlist chunk. Rename SCSI_MAX_SG_CHAIN_SEGMENTS to SG_MAX_SEGMENTS. Will move these 2 generic definitions to scatterlist.h later. Reviewed-by: Christoph Hellwig <[email protected]> Acked-by: Bart Van Assche <[email protected]> (for ib_srp changes) Signed-off-by: Ming Lin <[email protected]> Acked-by: Tejun Heo <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-04-13USB: uas: Add a new NO_REPORT_LUNS quirkHans de Goede3-2/+24
Add a new NO_REPORT_LUNS quirk and set it for Seagate drives with an usb-id of: 0bc2:331a, as these will fail to respond to a REPORT_LUNS command. Cc: [email protected] Reported-and-tested-by: David Webb <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-04-13USB: uas: Limit qdepth at the scsi-host levelHans de Goede1-1/+6
Commit 64d513ac31bd ("scsi: use host wide tags by default") causes the SCSI core to queue more commands then we can handle on devices with multiple LUNs, limit the queue depth at the scsi-host level instead of per slave to fix this. BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1315013 Cc: [email protected] # 4.4.x and 4.5.x Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-04-04mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macrosKirill A. Shutemov1-1/+1
PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time ago with promise that one day it will be possible to implement page cache with bigger chunks than PAGE_SIZE. This promise never materialized. And unlikely will. We have many places where PAGE_CACHE_SIZE assumed to be equal to PAGE_SIZE. And it's constant source of confusion on whether PAGE_CACHE_* or PAGE_* constant should be used in a particular case, especially on the border between fs and mm. Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much breakage to be doable. Let's stop pretending that pages in page cache are special. They are not. The changes are pretty straight-forward: - <foo> << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>; - <foo> >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>; - PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN}; - page_cache_get() -> get_page(); - page_cache_release() -> put_page(); This patch contains automated changes generated with coccinelle using script below. For some reason, coccinelle doesn't patch header files. I've called spatch for them manually. The only adjustment after coccinelle is revert of changes to PAGE_CAHCE_ALIGN definition: we are going to drop it later. There are few places in the code where coccinelle didn't reach. I'll fix them manually in a separate patch. Comments and documentation also will be addressed with the separate patch. virtual patch @@ expression E; @@ - E << (PAGE_CACHE_SHIFT - PAGE_SHIFT) + E @@ expression E; @@ - E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) + E @@ @@ - PAGE_CACHE_SHIFT + PAGE_SHIFT @@ @@ - PAGE_CACHE_SIZE + PAGE_SIZE @@ @@ - PAGE_CACHE_MASK + PAGE_MASK @@ expression E; @@ - PAGE_CACHE_ALIGN(E) + PAGE_ALIGN(E) @@ expression E; @@ - page_cache_get(E) + get_page(E) @@ expression E; @@ - page_cache_release(E) + put_page(E) Signed-off-by: Kirill A. Shutemov <[email protected]> Acked-by: Michal Hocko <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2016-03-18USB: uas: Reduce can_queue to MAX_CMNDSHans de Goede1-1/+1
The uas driver can never queue more then MAX_CMNDS (- 1) tags and tags are shared between luns, so there is no need to claim that we can_queue some random large number. Not claiming that we can_queue 65536 commands, fixes the uas driver failing to initialize while allocating the tag map with a "Page allocation failure (order 7)" error on systems which have been running for a while and thus have fragmented memory. Cc: [email protected] Reported-and-tested-by: Yves-Alexis Perez <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>