An error occurred fetching the project authors.
  1. 28 Oct, 2020 1 commit
  2. 25 Sep, 2020 1 commit
  3. 17 Sep, 2020 1 commit
    • Christoph Hellwig's avatar
      usb: don't inherity DMA properties for USB devices · 6eb0233e
      Christoph Hellwig authored
      As the comment in usb_alloc_dev correctly states, drivers can't use
      the DMA API on usb device, and at least calling dma_set_mask on them
      is highly dangerous.  Unlike what the comment states upper level drivers
      also can't really use the presence of a dma mask to check for DMA
      support, as the dma_mask is set by default for most busses.
      
      Setting the dma_mask comes from "[PATCH] usbcore dma updates (and doc)"
      in BitKeeper times, as it seems like it was primarily for setting the
      NETIF_F_HIGHDMA flag in USB drivers, something that has long been
      fixed up since.
      
      Setting the dma_pfn_offset comes from commit b44bbc46
      ("usb: core: setup dma_pfn_offset for USB devices and, interfaces"),
      which worked around the fact that the scsi_calculate_bounce_limits
      functions wasn't going through the proper driver interface to query
      DMA information, but that function was removed in commit 21e07dba
      ("scsi: reduce use of block bounce buffers") years ago.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6eb0233e
  4. 16 Sep, 2020 2 commits
  5. 04 Sep, 2020 1 commit
  6. 05 May, 2020 1 commit
    • Alan Stern's avatar
      USB: core: Fix misleading driver bug report · ac854131
      Alan Stern authored
      The syzbot fuzzer found a race between URB submission to endpoint 0
      and device reset.  Namely, during the reset we call usb_ep0_reinit()
      because the characteristics of ep0 may have changed (if the reset
      follows a firmware update, for example).  While usb_ep0_reinit() is
      running there is a brief period during which the pointers stored in
      udev->ep_in[0] and udev->ep_out[0] are set to NULL, and if an URB is
      submitted to ep0 during that period, usb_urb_ep_type_check() will
      report it as a driver bug.  In the absence of those pointers, the
      routine thinks that the endpoint doesn't exist.  The log message looks
      like this:
      
      ------------[ cut here ]------------
      usb 2-1: BOGUS urb xfer, pipe 2 != type 2
      WARNING: CPU: 0 PID: 9241 at drivers/usb/core/urb.c:478
      usb_submit_urb+0x1188/0x1460 drivers/usb/core/urb.c:478
      
      Now, although submitting an URB while the device is being reset is a
      questionable thing to do, it shouldn't count as a driver bug as severe
      as submitting an URB for an endpoint that doesn't exist.  Indeed,
      endpoint 0 always exists, even while the device is in its unconfigured
      state.
      
      To prevent these misleading driver bug reports, this patch updates
      usb_disable_endpoint() to avoid clearing the ep_in[] and ep_out[]
      pointers when the endpoint being disabled is ep0.  There's no danger
      of leaving a stale pointer in place, because the usb_host_endpoint
      structure being pointed to is stored permanently in udev->ep0; it
      doesn't get deallocated until the entire usb_device structure does.
      
      Reported-and-tested-by: syzbot+db339689b2101f6f6071@syzkaller.appspotmail.com
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      
      Link: https://lore.kernel.org/r/Pine.LNX.4.44L0.2005011558590.903-100000@netrider.rowland.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ac854131
  7. 16 Apr, 2020 1 commit
    • Alan Stern's avatar
      USB: core: Fix free-while-in-use bug in the USB S-Glibrary · 056ad39e
      Alan Stern authored
      FuzzUSB (a variant of syzkaller) found a free-while-still-in-use bug
      in the USB scatter-gather library:
      
      BUG: KASAN: use-after-free in atomic_read
      include/asm-generic/atomic-instrumented.h:26 [inline]
      BUG: KASAN: use-after-free in usb_hcd_unlink_urb+0x5f/0x170
      drivers/usb/core/hcd.c:1607
      Read of size 4 at addr ffff888065379610 by task kworker/u4:1/27
      
      CPU: 1 PID: 27 Comm: kworker/u4:1 Not tainted 5.5.11 #2
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
      1.10.2-1ubuntu1 04/01/2014
      Workqueue: scsi_tmf_2 scmd_eh_abort_handler
      Call Trace:
       __dump_stack lib/dump_stack.c:77 [inline]
       dump_stack+0xce/0x128 lib/dump_stack.c:118
       print_address_description.constprop.4+0x21/0x3c0 mm/kasan/report.c:374
       __kasan_report+0x153/0x1cb mm/kasan/report.c:506
       kasan_report+0x12/0x20 mm/kasan/common.c:639
       check_memory_region_inline mm/kasan/generic.c:185 [inline]
       check_memory_region+0x152/0x1b0 mm/kasan/generic.c:192
       __kasan_check_read+0x11/0x20 mm/kasan/common.c:95
       atomic_read include/asm-generic/atomic-instrumented.h:26 [inline]
       usb_hcd_unlink_urb+0x5f/0x170 drivers/usb/core/hcd.c:1607
       usb_unlink_urb+0x72/0xb0 drivers/usb/core/urb.c:657
       usb_sg_cancel+0x14e/0x290 drivers/usb/core/message.c:602
       usb_stor_stop_transport+0x5e/0xa0 drivers/usb/storage/transport.c:937
      
      This bug occurs when cancellation of the S-G transfer races with
      transfer completion.  When that happens, usb_sg_cancel() may continue
      to access the transfer's URBs after usb_sg_wait() has freed them.
      
      The bug is caused by the fact that usb_sg_cancel() does not take any
      sort of reference to the transfer, and so there is nothing to prevent
      the URBs from being deallocated while the routine is trying to use
      them.  The fix is to take such a reference by incrementing the
      transfer's io->count field while the cancellation is in progres and
      decrementing it afterward.  The transfer's URBs are not deallocated
      until io->complete is triggered, which happens when io->count reaches
      zero.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Reported-and-tested-by: default avatarKyungtae Kim <kt0755@gmail.com>
      CC: <stable@vger.kernel.org>
      
      Link: https://lore.kernel.org/r/Pine.LNX.4.44L0.2003281615140.14837-100000@netrider.rowland.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      056ad39e
  8. 24 Mar, 2020 1 commit
  9. 15 Aug, 2019 1 commit
  10. 16 Apr, 2019 1 commit
    • Alan Stern's avatar
      USB: core: Fix unterminated string returned by usb_string() · c01c348e
      Alan Stern authored
      Some drivers (such as the vub300 MMC driver) expect usb_string() to
      return a properly NUL-terminated string, even when an error occurs.
      (In fact, vub300's probe routine doesn't bother to check the return
      code from usb_string().)  When the driver goes on to use an
      unterminated string, it leads to kernel errors such as
      stack-out-of-bounds, as found by the syzkaller USB fuzzer.
      
      An out-of-range string index argument is not at all unlikely, given
      that some devices don't provide string descriptors and therefore list
      0 as the value for their string indexes.  This patch makes
      usb_string() return a properly terminated empty string along with the
      -EINVAL error code when an out-of-range index is encountered.
      
      And since a USB string index is a single-byte value, indexes >= 256
      are just as invalid as values of 0 or below.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Reported-by: syzbot+b75b85111c10b8d680f1@syzkaller.appspotmail.com
      CC: <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c01c348e
  11. 20 Feb, 2019 1 commit
  12. 18 Jan, 2019 2 commits
  13. 05 Sep, 2018 1 commit
  14. 28 Jun, 2018 1 commit
  15. 12 Jun, 2018 1 commit
    • Kees Cook's avatar
      treewide: kmalloc() -> kmalloc_array() · 6da2ec56
      Kees Cook authored
      The kmalloc() function has a 2-factor argument form, kmalloc_array(). This
      patch replaces cases of:
      
              kmalloc(a * b, gfp)
      
      with:
              kmalloc_array(a * b, gfp)
      
      as well as handling cases of:
      
              kmalloc(a * b * c, gfp)
      
      with:
      
              kmalloc(array3_size(a, b, c), gfp)
      
      as it's slightly less ugly than:
      
              kmalloc_array(array_size(a, b), c, gfp)
      
      This does, however, attempt to ignore constant size factors like:
      
              kmalloc(4 * 1024, gfp)
      
      though any constants defined via macros get caught up in the conversion.
      
      Any factors with a sizeof() of "unsigned char", "char", and "u8" were
      dropped, since they're redundant.
      
      The tools/ directory was manually excluded, since it has its own
      implementation of kmalloc().
      
      The Coccinelle script used for this was:
      
      // Fix redundant parens around sizeof().
      @@
      type TYPE;
      expression THING, E;
      @@
      
      (
        kmalloc(
      -	(sizeof(TYPE)) * E
      +	sizeof(TYPE) * E
        , ...)
      |
        kmalloc(
      -	(sizeof(THING)) * E
      +	sizeof(THING) * E
        , ...)
      )
      
      // Drop single-byte sizes and redundant parens.
      @@
      expression COUNT;
      typedef u8;
      typedef __u8;
      @@
      
      (
        kmalloc(
      -	sizeof(u8) * (COUNT)
      +	COUNT
        , ...)
      |
        kmalloc(
      -	sizeof(__u8) * (COUNT)
      +	COUNT
        , ...)
      |
        kmalloc(
      -	sizeof(char) * (COUNT)
      +	COUNT
        , ...)
      |
        kmalloc(
      -	sizeof(unsigned char) * (COUNT)
      +	COUNT
        , ...)
      |
        kmalloc(
      -	sizeof(u8) * COUNT
      +	COUNT
        , ...)
      |
        kmalloc(
      -	sizeof(__u8) * COUNT
      +	COUNT
        , ...)
      |
        kmalloc(
      -	sizeof(char) * COUNT
      +	COUNT
        , ...)
      |
        kmalloc(
      -	sizeof(unsigned char) * COUNT
      +	COUNT
        , ...)
      )
      
      // 2-factor product with sizeof(type/expression) and identifier or constant.
      @@
      type TYPE;
      expression THING;
      identifier COUNT_ID;
      constant COUNT_CONST;
      @@
      
      (
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(TYPE) * (COUNT_ID)
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(TYPE) * COUNT_ID
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(TYPE) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(TYPE) * COUNT_CONST
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(THING) * (COUNT_ID)
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(THING) * COUNT_ID
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(THING) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(THING)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(THING) * COUNT_CONST
      +	COUNT_CONST, sizeof(THING)
        , ...)
      )
      
      // 2-factor product, only identifiers.
      @@
      identifier SIZE, COUNT;
      @@
      
      - kmalloc
      + kmalloc_array
        (
      -	SIZE * COUNT
      +	COUNT, SIZE
        , ...)
      
      // 3-factor product with 1 sizeof(type) or sizeof(expression), with
      // redundant parens removed.
      @@
      expression THING;
      identifier STRIDE, COUNT;
      type TYPE;
      @@
      
      (
        kmalloc(
      -	sizeof(TYPE) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kmalloc(
      -	sizeof(TYPE) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kmalloc(
      -	sizeof(TYPE) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kmalloc(
      -	sizeof(TYPE) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kmalloc(
      -	sizeof(THING) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        kmalloc(
      -	sizeof(THING) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        kmalloc(
      -	sizeof(THING) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        kmalloc(
      -	sizeof(THING) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      )
      
      // 3-factor product with 2 sizeof(variable), with redundant parens removed.
      @@
      expression THING1, THING2;
      identifier COUNT;
      type TYPE1, TYPE2;
      @@
      
      (
        kmalloc(
      -	sizeof(TYPE1) * sizeof(TYPE2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        kmalloc(
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        kmalloc(
      -	sizeof(THING1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        kmalloc(
      -	sizeof(THING1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        kmalloc(
      -	sizeof(TYPE1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      |
        kmalloc(
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      )
      
      // 3-factor product, only identifiers, with redundant parens removed.
      @@
      identifier STRIDE, SIZE, COUNT;
      @@
      
      (
        kmalloc(
      -	(COUNT) * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kmalloc(
      -	COUNT * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kmalloc(
      -	COUNT * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kmalloc(
      -	(COUNT) * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kmalloc(
      -	COUNT * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kmalloc(
      -	(COUNT) * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kmalloc(
      -	(COUNT) * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kmalloc(
      -	COUNT * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      )
      
      // Any remaining multi-factor products, first at least 3-factor products,
      // when they're not all constants...
      @@
      expression E1, E2, E3;
      constant C1, C2, C3;
      @@
      
      (
        kmalloc(C1 * C2 * C3, ...)
      |
        kmalloc(
      -	(E1) * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        kmalloc(
      -	(E1) * (E2) * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        kmalloc(
      -	(E1) * (E2) * (E3)
      +	array3_size(E1, E2, E3)
        , ...)
      |
        kmalloc(
      -	E1 * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      )
      
      // And then all remaining 2 factors products when they're not all constants,
      // keeping sizeof() as the second factor argument.
      @@
      expression THING, E1, E2;
      type TYPE;
      constant C1, C2, C3;
      @@
      
      (
        kmalloc(sizeof(THING) * C2, ...)
      |
        kmalloc(sizeof(TYPE) * C2, ...)
      |
        kmalloc(C1 * C2 * C3, ...)
      |
        kmalloc(C1 * C2, ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(TYPE) * (E2)
      +	E2, sizeof(TYPE)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(TYPE) * E2
      +	E2, sizeof(TYPE)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(THING) * (E2)
      +	E2, sizeof(THING)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(THING) * E2
      +	E2, sizeof(THING)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	(E1) * E2
      +	E1, E2
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	(E1) * (E2)
      +	E1, E2
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	E1 * E2
      +	E1, E2
        , ...)
      )
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      6da2ec56
  16. 31 May, 2018 1 commit
  17. 06 Mar, 2018 1 commit
    • Danilo Krummrich's avatar
      usb: quirks: add control message delay for 1b1c:1b20 · cb88a058
      Danilo Krummrich authored
      Corsair Strafe RGB keyboard does not respond to usb control messages
      sometimes and hence generates timeouts.
      
      Commit de3af5bf ("usb: quirks: add delay init quirk for Corsair
      Strafe RGB keyboard") tried to fix those timeouts by adding
      USB_QUIRK_DELAY_INIT.
      
      Unfortunately, even with this quirk timeouts of usb_control_msg()
      can still be seen, but with a lower frequency (approx. 1 out of 15):
      
      [   29.103520] usb 1-8: string descriptor 0 read error: -110
      [   34.363097] usb 1-8: can't set config #1, error -110
      
      Adding further delays to different locations where usb control
      messages are issued just moves the timeouts to other locations,
      e.g.:
      
      [   35.400533] usbhid 1-8:1.0: can't add hid device: -110
      [   35.401014] usbhid: probe of 1-8:1.0 failed with error -110
      
      The only way to reliably avoid those issues is having a pause after
      each usb control message. In approx. 200 boot cycles no more timeouts
      were seen.
      
      Addionaly, keep USB_QUIRK_DELAY_INIT as it turned out to be necessary
      to have the delay in hub_port_connect() after hub_port_init().
      
      The overall boot time seems not to be influenced by these additional
      delays, even on fast machines and lightweight distributions.
      
      Fixes: de3af5bf ("usb: quirks: add delay init quirk for Corsair Strafe RGB keyboard")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDanilo Krummrich <danilokrummrich@dk-develop.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cb88a058
  18. 15 Dec, 2017 1 commit
  19. 06 Dec, 2017 1 commit
  20. 28 Nov, 2017 2 commits
    • Johan Hovold's avatar
      USB: add device-tree support for interfaces · 1a7e3948
      Johan Hovold authored
      Add OF device-tree support for USB interfaces.
      
      USB "interface nodes" are children of USB "device nodes" and are
      identified by an interface number and a configuration value:
      
      	&usb1 { /* host controller */
      		dev1: device@1 { /* device at port 1 */
      			compatible = "usb1234,5678";
      			reg = <1>;
      
      			#address-cells = <2>;
      			#size-cells = <0>;
      
      			interface@0,2 { /* interface 0 of configuration 2 */
      				compatible = "usbif1234,5678.config2.0";
      				reg = <0 2>;
      			};
      		};
      	};
      
      The configuration component is not included in the textual
      representation of an interface-node unit address for configuration 1:
      
      	&dev1 {
      		interface@0 {	/* interface 0 of configuration 1 */
      			compatible = "usbif1234,5678.config1.0";
      			reg = <0 1>;
      		};
      	};
      
      When a USB device of class 0 or 9 (hub) has only a single configuration
      with a single interface, a special case "combined node" is used instead
      of a device node with an interface node:
      
      	&usb1 {
      		device@2 {
      			compatible = "usb1234,abcd";
      			reg = <2>;
      		};
      	};
      
      Combined nodes are shared by the two device structures representing the
      USB device and its interface in the kernel's device model.
      
      Note that, as for device nodes, the compatible strings for interface
      nodes are currently not used.
      
      For more details see "Open Firmware Recommended Practice: Universal
      Serial Bus Version 1" and the binding documentation.
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1a7e3948
    • Kai-Heng Feng's avatar
      usb: core: lower log level when device is not able to deal with string · 2124c888
      Kai-Heng Feng authored
      USB devices should work just fine when they don't support language id.
      
      Lower the log level so user won't panic in the future.
      
      BugLink: https://bugs.launchpad.net/bugs/1729618Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2124c888
  21. 09 Nov, 2017 1 commit
  22. 07 Nov, 2017 3 commits
  23. 03 Nov, 2017 1 commit
  24. 21 Sep, 2017 1 commit
  25. 11 Apr, 2017 1 commit
  26. 19 Jan, 2017 1 commit
    • Jaejoong Kim's avatar
      usb: core: update comments for send message functions · 123b7b30
      Jaejoong Kim authored
      The commonly use of bottom halves are tasklet and workqueue. The big
      difference between tasklet and workqueue is that the tasklet runs in
      an interrupt context and the workqueue runs in a process context,
      which means it can sleep if need be.
      
      The comment for usb_control/interrupt/bulk_msg() functions note that do
      not use this function within an interrupt context, like a 'bottom half'
      handler. With this comment, it makes confuse about usage of these
      functions.
      
      To more clarify, remove 'bottom half' comment.
      Signed-off-by: default avatarJaejoong Kim <climbbb.kim@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      123b7b30
  27. 29 Oct, 2016 1 commit
  28. 13 Sep, 2016 1 commit
    • Roger Quadros's avatar
      usb: core: setup dma_pfn_offset for USB devices and, interfaces · b44bbc46
      Roger Quadros authored
      If dma_pfn_offset is not inherited correctly from the host controller,
      it might result in sub-optimal configuration as bounce
      buffer limit might be set to less than optimal level.
      
      Consider the mass storage device case.
      USB storage driver creates a scsi host for the mass storage interface in
      drivers/usb/storage/usb.c
      The scsi host parent device is nothing but the the USB interface device.
      Now, __scsi_init_queue() calls scsi_calculate_bounce_limit() to find out
      and set the block layer bounce limit.
      scsi_calculate_bounce_limit() uses dma_max_pfn(host_dev) to get the
      bounce_limit. host_dev is nothing but the device representing the
      mass storage interface.
      If that device doesn't have the right dma_pfn_offset, then dma_max_pfn()
      is messed up and the bounce buffer limit is wrong.
      
      e.g. On Keystone 2 systems, dma_max_pfn() is 0x87FFFF and dma_mask_pfn
      is 0xFFFFF. Consider a mass storage use case: Without this patch,
      usb scsi host device (usb-storage) will get a dma_pfn_offset of 0 resulting
      in a dma_max_pfn() of 0xFFFFF within the scsi layer
      (scsi_calculate_bounce_limit()).
      This will result in bounce buffers being unnecessarily used.
      
      Hint: On 32-bit ARM platforms dma_max_pfn() = dma_mask_pfn + dma_pfn_offset
      Signed-off-by: default avatarRoger Quadros <rogerq@ti.com>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b44bbc46
  29. 30 Aug, 2016 1 commit
  30. 18 Jul, 2016 1 commit
  31. 26 Apr, 2016 2 commits
  32. 04 Oct, 2015 1 commit
  33. 22 Sep, 2015 2 commits