1. 12 Jan, 2017 40 commits
    • Milo Kim's avatar
      mfd: tps65217: Fix page fault on unloading modules · ac86312e
      Milo Kim authored
      commit 40a50f8b upstream.
      
      TPS65217 IRQ domain should be removed and initialised as NULL when the
      module is unloaded for the next use. When tps65217.ko is loaded again,
      it causes the page fault. This patch fixes the error below.
      
      root@arm:~# lsmod | grep "tps"
      tps65217_charger        3538  0
      tps65218_pwrbutton      2974  0
      tps65217                6710  1 tps65217_charger
      
      root@arm:~# modprobe -r tps65217_charger
      
      root@arm:~# modprobe tps65217.ko
      [   71.990277] Unable to handle kernel paging request at virtual address bf055944
      [   71.998063] pgd = dd3a4000
      [   72.000904] [bf055944] *pgd=9e6f7811, *pte=00000000, *ppte=00000000
      [   72.007567] Internal error: Oops: 7 [#1] SMP ARM
      [   72.012404] Modules linked in: tps65217(+) evdev musb_dsps musb_hdrc udc_core tps65218_pwrbutton usbcore phy_am335]
      [   72.055700] CPU: 0 PID: 243 Comm: modprobe Not tainted 4.9.0-rc5-next-20161114 #3
      [   72.063531] Hardware name: Generic AM33XX (Flattened Device Tree)
      [   72.069899] task: de714380 task.stack: de7e6000
      [   72.074655] PC is at irq_find_matching_fwspec+0x88/0x100
      [   72.080211] LR is at 0xde7e79d8
      [   72.083496] pc : [<c01a5d88>]    lr : [<de7e79d8>]    psr: 200e0013
      [   72.083496] sp : de7e7a78  ip : 00000000  fp : dd138a68
      [   72.095506] r10: c0ca04f8  r9 : 00000018  r8 : de7e7ab8
      [   72.100973] r7 : 00000001  r6 : c0c4517c  r5 : df963f68  r4 : de321980
      [   72.107797] r3 : bf055940  r2 : de714380  r1 : 00000000  r0 : 00000000
      [   72.114633] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
      [   72.122084] Control: 10c5387d  Table: 9d3a4019  DAC: 00000051
      [   72.128097] Process modprobe (pid: 243, stack limit = 0xde7e6218)
      [   72.134489] Stack: (0xde7e7a78 to 0xde7e8000)
      [   72.139060] 7a60:                                                       df963f68 de7e7ab8
      [   72.147643] 7a80: 00000000 dd0e1000 dd491e20 c01a6ea0 600e0013 c01a5dc0 dd138a68 c0c45138
      [   72.156216] 7aa0: df963f68 00000000 df963f68 dd0e1010 00000000 c01a71a4 df963f68 00000001
      [   72.164800] 7ac0: 00000002 de7e7ac0 c80048b8 dd0adf00 df963f68 c0c4517c 00000000 de7e7b50
      [   72.173369] 7ae0: 00000018 c0ca04f8 dd138a68 c01a5dc0 df963f68 dd0e1010 00000000 dd0e1000
      [   72.181942] 7b00: dd491e20 c0653a70 df963f58 00000001 00000002 00000000 00000000 00000000
      [   72.190522] 7b20: 600e0093 c0cbf8f0 c0c0512c c0193674 00000001 00000080 00000000 c0554984
      [   72.199096] 7b40: 00000000 00000000 800e0013 c0553858 df963f68 00000000 00000000 00000000
      [   72.207674] 7b60: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
      [   72.216239] 7b80: 00000000 00000000 00000000 00000000 00000000 00000000 dd0e1000 c0544d24
      [   72.224816] 7ba0: dd491e10 dd0e1010 dd16e800 bf1d517c bf1d5620 dd0e1010 c1497ed4 bf1d5620
      [   72.233398] 7bc0: dd0e1010 fffffdfb bf1d5620 bf1d5620 00000000 c054537c c0545330 dd0e1010
      [   72.241967] 7be0: c1497ed4 00000000 bf1d5620 c05433ac 00000000 00000000 de7e7c28 c0543570
      [   72.250537] 7c00: 00000001 c1497e90 00000000 c0541884 de080cd4 dd44b7d4 dd0e1010 dd0e1010
      [   72.259109] 7c20: dd0e1044 c05430c8 dd0e1010 00000001 dd0e1010 dd0e1018 dd0e1010 c0c9e328
      [   72.267676] 7c40: de5d4020 c0542760 dd0e1018 dd0e1010 00000000 c0540ba8 dd138a40 c048dec4
      [   72.276253] 7c60: 00000000 dd0e1000 00000001 dd0e1000 dd0e1010 dd0e1000 bf233de0 dd138a40
      [   72.284829] 7c80: dd0e1010 c05450a0 000000bf 00000000 dd138a60 00000001 dd0e1000 c0571240
      [   72.293398] 7ca0: 00000000 dd1ce9c0 00000040 dd1ce9cc bf233de0 00000003 de5d4020 ffffffff
      [   72.301969] 7cc0: 00000004 dd0adf00 00000000 c0571408 00000000 00000000 dd0adf00 de5d4020
      [   72.310543] 7ce0: c057146c dd1ce9c0 bf233d14 de5d4020 de7fb3d0 00000004 bf233d14 ffffffff
      [   72.319120] 7d00: 00000018 dd49bf30 c01cedc0 c05714d0 00000000 00000000 dd0adf00 de322810
      [   72.327692] 7d20: de322810 00000000 dd033000 000000f0 00000001 bf2333fc 00000000 00000000
      [   72.336269] 7d40: dd0adf00 de5d4020 000000b6 bf233e40 de5d4020 bf233968 de5d4004 de5d4000
      [   72.344848] 7d60: bf233314 c06148ac de5d4020 c1497ed4 00000000 bf233e40 00000000 c05433ac
      [   72.353422] 7d80: 00000000 de5d4020 bf233e40 de5d4054 00000000 bf236000 00000000 c0543538
      [   72.362002] 7da0: 00000000 bf233e40 c0543484 c05417e4 de1442a4 de5d04d0 bf233e40 de321300
      [   72.370582] 7dc0: c0caa5a4 c05429fc bf233be0 bf233e40 c0cbfa44 bf233e40 c0cbfa44 dd2f7740
      [   72.379148] 7de0: bf233f00 c05442f0 bf233e8c bf233e24 c0cbfa44 c0615ae0 00000000 bf233f00
      [   72.387718] 7e00: c0cbfa44 c010186c 200f0013 c0191650 de714380 00000000 600f0013 00000040
      [   72.396286] 7e20: dd2f7740 c018f1ac 00000001 c0c8356c 024000c0 c01a8854 c0c56e0e c028225c
      [   72.404863] 7e40: dd2f7740 c0191984 de714380 dd2f7740 00000001 bf233f00 bf233f00 c0cbfa44
      [   72.413440] 7e60: dd2f7740 bf233f00 00000001 dd49bf08 dd49bf30 c0230998 00000001 c0c8356c
      [   72.421997] 7e80: c0c4c536 c0cbfa44 c0c0512c c01d2070 bf233f0c 00007fff bf233f00 c01cf5b8
      [   72.430570] 7ea0: 00000000 c1475134 c01cee34 bf23411c bf233f48 bf234054 bf234150 00000000
      [   72.439144] 7ec0: 024002c2 de7fbf40 0009bc20 c02776ac ff800000 00000000 00000000 bf233670
      [   72.447723] 7ee0: 00000004 00000000 00000000 00000000 00000000 00000000 00000000 00000000
      [   72.456298] 7f00: 00000000 00000000 00000000 00000000 c01d2590 0000aa41 00000000 00000000
      [   72.464862] 7f20: 000b2549 e12c3a41 00000051 de7e6000 0009bc20 c01d2630 00000530 e12b9000
      [   72.473438] 7f40: 0000aa41 e12c1434 e12c1211 e12c336c 00001150 00001620 00000000 00000000
      [   72.482003] 7f60: 00000000 000010fc 00000035 00000036 0000001d 0000001a 00000017 00000000
      [   72.490564] 7f80: de7e6000 3ba39a00 0009b008 0009b718 00000080 c0107704 de7e6000 00000000
      [   72.499141] 7fa0: 0009f609 c0107560 3ba39a00 0009b008 000a7b08 0000aa41 0009bc20 0000aa41
      [   72.507717] 7fc0: 3ba39a00 0009b008 0009b718 00000080 00000001 00000008 0009ab14 0009f609
      [   72.516290] 7fe0: bea31ab8 bea31aa8 0001e5eb b6e83b42 800f0030 000a7b08 0000ffff 0840ffff
      [   72.524883] [<c01a5d88>] (irq_find_matching_fwspec) from [<c01a6ea0>] (irq_create_fwspec_mapping+0x28/0x2e0)
      [   72.535174] [<c01a6ea0>] (irq_create_fwspec_mapping) from [<c01a71a4>] (irq_create_of_mapping+0x4c/0x54)
      [   72.545115] [<c01a71a4>] (irq_create_of_mapping) from [<c0653a70>] (of_irq_get+0x58/0x68)
      [   72.553699] [<c0653a70>] (of_irq_get) from [<c0544d24>] (platform_get_irq+0x1c/0xec)
      [   72.561828] [<c0544d24>] (platform_get_irq) from [<bf1d517c>] (tps6521x_pb_probe+0xd0/0x1a8 [tps65218_pwrbutton])
      [   72.572581] [<bf1d517c>] (tps6521x_pb_probe [tps65218_pwrbutton]) from [<c054537c>] (platform_drv_probe+0x4c/0xac)
      [   72.583426] [<c054537c>] (platform_drv_probe) from [<c05433ac>] (driver_probe_device+0x204/0x2dc)
      [   72.592729] [<c05433ac>] (driver_probe_device) from [<c0541884>] (bus_for_each_drv+0x58/0x8c)
      [   72.601657] [<c0541884>] (bus_for_each_drv) from [<c05430c8>] (__device_attach+0xb0/0x114)
      [   72.610324] [<c05430c8>] (__device_attach) from [<c0542760>] (bus_probe_device+0x88/0x90)
      [   72.618898] [<c0542760>] (bus_probe_device) from [<c0540ba8>] (device_add+0x3b8/0x560)
      [   72.627203] [<c0540ba8>] (device_add) from [<c05450a0>] (platform_device_add+0xa8/0x208)
      [   72.635693] [<c05450a0>] (platform_device_add) from [<c0571240>] (mfd_add_device+0x240/0x338)
      [   72.644634] [<c0571240>] (mfd_add_device) from [<c0571408>] (mfd_add_devices+0xa0/0x104)
      [   72.653120] [<c0571408>] (mfd_add_devices) from [<c05714d0>] (devm_mfd_add_devices+0x60/0xa8)
      [   72.662077] [<c05714d0>] (devm_mfd_add_devices) from [<bf2333fc>] (tps65217_probe+0xe8/0x2ec [tps65217])
      [   72.672026] [<bf2333fc>] (tps65217_probe [tps65217]) from [<c06148ac>] (i2c_device_probe+0x168/0x1f4)
      [   72.681695] [<c06148ac>] (i2c_device_probe) from [<c05433ac>] (driver_probe_device+0x204/0x2dc)
      [   72.690816] [<c05433ac>] (driver_probe_device) from [<c0543538>] (__driver_attach+0xb4/0xb8)
      [   72.699657] [<c0543538>] (__driver_attach) from [<c05417e4>] (bus_for_each_dev+0x60/0x94)
      [   72.708224] [<c05417e4>] (bus_for_each_dev) from [<c05429fc>] (bus_add_driver+0x18c/0x214)
      [   72.716892] [<c05429fc>] (bus_add_driver) from [<c05442f0>] (driver_register+0x78/0xf8)
      [   72.725280] [<c05442f0>] (driver_register) from [<c0615ae0>] (i2c_register_driver+0x38/0x80)
      [   72.734120] [<c0615ae0>] (i2c_register_driver) from [<c010186c>] (do_one_initcall+0x3c/0x178)
      [   72.743055] [<c010186c>] (do_one_initcall) from [<c0230998>] (do_init_module+0x5c/0x1d0)
      [   72.751537] [<c0230998>] (do_init_module) from [<c01d2070>] (load_module+0x1d10/0x21c0)
      [   72.759933] [<c01d2070>] (load_module) from [<c01d2630>] (SyS_init_module+0x110/0x154)
      [   72.768242] [<c01d2630>] (SyS_init_module) from [<c0107560>] (ret_fast_syscall+0x0/0x1c)
      [   72.776725] Code: e5944000 e1540006 0a00001b e594300c (e593c004)
      [   72.783181] ---[ end trace 0278ec325f4689b8 ]---
      
      Fixes: 6556bdac ("mfd: tps65217: Add support for IRQs")
      Signed-off-by: default avatarMilo Kim <woogyom.kim@gmail.com>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ac86312e
    • Mohammed Shafi Shajakhan's avatar
      ath10k: fix failure to send NULL func frame for 10.4 · a24f1f35
      Mohammed Shafi Shajakhan authored
      commit fcf7cf15 upstream.
      
      This partially reverts 'commit 2cdce425
      ("ath10k: Fix broken NULL func data frame status for 10.4")'
      Unfortunately this breaks sending NULL func and the existing
      issue of obtaining proper tx status for NULL function will be
      fixed. Also update the comments for feature flag added to be
      useless and not working
      
      Fixes: 2cdce425 "ath10k: Fix broken NULL func data frame status for
      10.4"
      Signed-off-by: default avatarMohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
      Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a24f1f35
    • Vamsi Krishna's avatar
      nl80211: Use different attrs for BSSID and random MAC addr in scan req · 45816391
      Vamsi Krishna authored
      commit 2fa436b3 upstream.
      
      NL80211_ATTR_MAC was used to set both the specific BSSID to be scanned
      and the random MAC address to be used when privacy is enabled. When both
      the features are enabled, both the BSSID and the local MAC address were
      getting same value causing Probe Request frames to go with unintended
      DA. Hence, this has been fixed by using a different NL80211_ATTR_BSSID
      attribute to set the specific BSSID (which was the more recent addition
      in cfg80211) for a scan.
      
      Backwards compatibility with old userspace software is maintained to
      some extent by allowing NL80211_ATTR_MAC to be used to set the specific
      BSSID when scanning without enabling random MAC address use.
      
      Scanning with random source MAC address was introduced by commit
      ad2b26ab ("cfg80211: allow drivers to support random MAC addresses
      for scan") and the issue was introduced with the addition of the second
      user for the same attribute in commit 818965d3 ("cfg80211: Allow a
      scan request for a specific BSSID").
      
      Fixes: 818965d3 ("cfg80211: Allow a scan request for a specific BSSID")
      Signed-off-by: default avatarVamsi Krishna <vamsin@qti.qualcomm.com>
      Signed-off-by: default avatarJouni Malinen <jouni@qca.qualcomm.com>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      45816391
    • Johannes Berg's avatar
      mac80211: fix tid_agg_rx NULL dereference · cd845164
      Johannes Berg authored
      commit 1c3d185a upstream.
      
      On drivers setting the SUPPORTS_REORDERING_BUFFER hardware flag,
      we crash when the peer sends an AddBA request while we already
      have a session open on the seame TID; this is because on those
      drivers, the tid_agg_rx is left NULL even though the session is
      valid, and the agg_session_valid bit is set.
      
      To fix this, store the dialog tokens outside the tid_agg_rx to
      be able to compare them to the received AddBA request.
      
      Fixes: f89e07d4 ("mac80211: agg-rx: refuse ADDBA Request with timeout update")
      Reported-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cd845164
    • Daniel Vetter's avatar
      drm/i915: tune down the fast link training vs boot fail · 1d9c33f1
      Daniel Vetter authored
      commit 2c57b18a upstream.
      
      It's been unfixed since a while and no one is immediately working on
      this. And we have the FIXME already. And now also a task in the DP
      team's backlog.
      
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: stable@vger.kernel.org
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      References: https://lists.freedesktop.org/archives/intel-gfx/2016-July/101951.htmlAcked-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      [danvet: Adjust comment per Ville's feedback.]
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20161213195414.28923-1-daniel.vetter@ffwll.chSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      (cherry picked from commit 2dd85aeb)
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      1d9c33f1
    • Matthew Auld's avatar
      drm/i915/dp: add lane_count check in intel_dp_check_link_status · 8b487915
      Matthew Auld authored
      commit d4cb3fd9 upstream.
      
      Currently it's entirely possible to go through the link training step
      without first determining the lane_count, which is silly since we end up
      doing a bunch of aux transfers of size = 0, as highlighted by
      WARN_ON(!msg->buffer != !msg->size), and can only ever result in a
      'failed to update link training' message. This can be observed during
      intel_dp_long_pulse where we can do the link training step, but before
      we have had a chance to set the link params. To avoid this we add an
      extra check for the lane_count in intel_dp_check_link_status, which
      should prevent us from doing the link training step prematurely.
      
      v2: add WARN_ON_ONCE and FIXME comment (Ville)
      
      References: https://bugs.freedesktop.org/show_bug.cgi?id=97344
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Mika Kahola <mika.kahola@intel.com>
      Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1476912593-10019-1-git-send-email-matthew.auld@intel.comSigned-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8b487915
    • Felipe Balbi's avatar
      usb: dwc3: gadget: always unmap EP0 requests · 5af6f56b
      Felipe Balbi authored
      commit d6214592 upstream.
      
      commit 0416e494 ("usb: dwc3: ep0: correct cache
      sync issue in case of ep0_bounced") introduced a bug
      where we would leak DMA resources which would cause
      us to starve the system of them resulting in failing
      DMA transfers.
      
      Fix the bug by making sure that we always unmap EP0
      requests since those are *always* mapped.
      
      Fixes: 0416e494 ("usb: dwc3: ep0: correct cache
      	sync issue in case of ep0_bounced")
      Cc: <stable@vger.kernel.org>
      Tested-by: default avatarTomasz Medrek <tomaszx.medrek@intel.com>
      Reported-by: default avatarJanusz Dziedzic <januszx.dziedzic@linux.intel.com>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5af6f56b
    • Felipe Balbi's avatar
      usb: dwc3: ep0: explicitly call dwc3_ep0_prepare_one_trb() · c008309f
      Felipe Balbi authored
      commit 19ec3123 upstream.
      
      Let's call dwc3_ep0_prepare_one_trb() explicitly
      because there are occasions where we will need more
      than one TRB to handle an EP0 transfer.
      
      A follow-up patch will fix one bug related to
      multiple-TRB Data Phases when it comes to
      mapping/unmapping requests for DMA.
      Reported-by: default avatarJanusz Dziedzic <januszx.dziedzic@linux.intel.com>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      c008309f
    • Felipe Balbi's avatar
      usb: dwc3: ep0: add dwc3_ep0_prepare_one_trb() · 5f7fd4d2
      Felipe Balbi authored
      commit 7931ec86 upstream.
      
      For now this is just a cleanup patch, no functional
      changes. We will be using the new function to fix a
      bug introduced long ago by commit 0416e494
      ("usb: dwc3: ep0: correct cache sync issue in case
      of ep0_bounced") and further worsened by commit
      c0bd5456 ("usb: dwc3: ep0: handle non maxpacket
      aligned transfers > 512")
      Reported-by: default avatarJanusz Dziedzic <januszx.dziedzic@linux.intel.com>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      5f7fd4d2
    • Linus Walleij's avatar
      iio: accel: st_accel: fix LIS3LV02 reading and scaling · 96a0c8ee
      Linus Walleij authored
      commit 65e4345c upstream.
      
      The LIS3LV02 has a special bit that need to be set to get the
      read values left aligned. Before this patch we get gibberish
      like this:
      
      iio_generic_buffer -a -c10 -n lis3lv02dl_accel
      (...)
      0.000000 -0.010042 -0.642688 19155832931907
      0.000000 -0.010042 -0.642688 19155858751073
      
      Which is because we read a raw value for 1g as 64 which is
      the nominal 1024 for 1g shifted 4 bits to the left by being
      right-aligned rather than left aligned.
      
      Since all other sensors are left aligned, add some code to
      set the special DAS (data alignment setting) bit to 1 so that
      the right value is now read like this:
      
      iio_generic_buffer -a -c10 -n lis3lv02dl_accel
      (...)
      0.000000 -0.147095 -10.120135 24761614364956
      -0.029419 -0.176514 -10.120135 24761631624540
      
      The scaling was weird as well: we have a gain of 1000 for 1g
      and 3000 for 6g. I don't even remember how I came up with the
      old values but they are wrong.
      
      Fixes: 3acddf74 ("iio: st-sensors: add support for lis3lv02d accelerometer")
      Cc: Lorenzo Bianconi <lorenzo.bianconi@st.com>
      Cc: Giuseppe Barba <giuseppe.barba@st.com>
      Cc: Denis Ciocca <denis.ciocca@st.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      96a0c8ee
    • Eva Rachel Retuya's avatar
      staging: iio: ad7606: fix improper setting of oversampling pins · a673f998
      Eva Rachel Retuya authored
      commit b321a38d upstream.
      
      The oversampling ratio is controlled using the oversampling pins,
      OS [2:0] with OS2 being the MSB control bit, and OS0 the LSB control
      bit.
      
      The gpio connected to the OS2 pin is not being set correctly, only OS0
      and OS1 pins are being set. Fix the typo to allow proper control of the
      oversampling pins.
      Signed-off-by: default avatarEva Rachel Retuya <eraretuya@gmail.com>
      Fixes: b9618c0c ("staging: IIO: ADC: New driver for AD7606/AD7606-6/AD7606-4")
      Acked-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a673f998
    • Alexander Usyskin's avatar
      mei: move write cb to completion on credentials failures · fc322290
      Alexander Usyskin authored
      commit e09ee853 upstream.
      
      The credentials handling was pushed to the write handlers
      but error handling wasn't done properly.
      Move write callbacks to completion queue to destroy them
      and to notify a blocked writer about the failure
      
      Fixes: 136698e5 (mei: push credentials inside the irq write handler)
      Signed-off-by: default avatarAlexander Usyskin <alexander.usyskin@intel.com>
      Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fc322290
    • Alexander Usyskin's avatar
      mei: bus: fix mei_cldev_enable KDoc · 5d46c4e9
      Alexander Usyskin authored
      commit 5026c9cb upstream.
      
      Adjust function name in KDoc.
      
      Fixes: d49dc5e7 (mei: bus: use mei_cldev_ prefix for the API functions)
      Signed-off-by: default avatarAlexander Usyskin <alexander.usyskin@intel.com>
      Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5d46c4e9
    • Alexander Usyskin's avatar
      mei: fix parameter rename KDoc · af776953
      Alexander Usyskin authored
      commit 967b274e upstream.
      
      Parameter renaming to fop_type was not reflected in KDoc
      
      Fixes: 3030dc05 (mei: add wrapper for queuing control commands)
      Signed-off-by: default avatarAlexander Usyskin <alexander.usyskin@intel.com>
      Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      af776953
    • Johan Hovold's avatar
      USB: serial: io_ti: bind to interface after fw download · c1ec6ba3
      Johan Hovold authored
      commit e35d6d7c upstream.
      
      Bind to the interface, but do not register any ports, after having
      downloaded the firmware. The device will still disconnect and
      re-enumerate, but this way we avoid an error messages from being logged
      as part of the process:
      
      io_ti: probe of 1-1.3:1.0 failed with error -5
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c1ec6ba3
    • Wei Yongjun's avatar
      dibusb: fix possible memory leak in dibusb_rc_query() · fb0a00fb
      Wei Yongjun authored
      commit 1f5ecaf9 upstream.
      
      'buf' is malloced in dibusb_rc_query() and should be freed before
      leaving from the error handling cases, otherwise it will cause
      memory leak.
      
      Fixes: ff1c1235 ("[media] dibusb: handle error code on RC query")
      Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fb0a00fb
    • Chen-Yu Tsai's avatar
      ARM: dts: sun7i: bananapi-m1-plus: Enable USB PHY for USB host support · 5f6136de
      Chen-Yu Tsai authored
      commit 0cff18cb upstream.
      
      The 2 USB host ports are directly tied to the 2 USB hosts in the SoC.
      The 2 host pairs were already enabled, but the USB PHY wasn't.
      VBUS on the 2 ports are always on.
      
      Enable the USB PHY.
      
      Fixes: 04c85eca ("ARM: dts: sun7i: Add dts file for Bananapi M1 Plus
      		      board")
      Signed-off-by: default avatarChen-Yu Tsai <wens@csie.org>
      Signed-off-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5f6136de
    • Kefeng Wang's avatar
      arm64: dts: hip06: Correct hardware pin number of usb node · 5ef54ae3
      Kefeng Wang authored
      commit 4d75a171 upstream.
      
      The ohci/ehci hardware pin number should be 640/641, correct them.
      
      Fixes: commit aa8d3e74 ("arm64: dts: Add initial dts for Hisilicon Hip06 D03 board")
      Signed-off-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
      Signed-off-by: default avatarWei Xu <xuwei5@hisilicon.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5ef54ae3
    • Johan Hovold's avatar
      USB: phy: am335x-control: fix device and of_node leaks · 93f6891a
      Johan Hovold authored
      commit 015105b1 upstream.
      
      Make sure to drop the references taken by of_parse_phandle() and
      bus_find_device() before returning from am335x_get_phy_control().
      
      Note that there is no guarantee that the devres-managed struct
      phy_control will be valid for the lifetime of the sibling phy device
      regardless of this change.
      
      Fixes: 3bb869c8 ("usb: phy: Add AM335x PHY driver")
      Acked-by: default avatarBin Liu <b-liu@ti.com>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      93f6891a
    • Geert Uytterhoeven's avatar
      ARM: dts: r8a7794: Correct hsusb parent clock · d387f98c
      Geert Uytterhoeven authored
      commit dc8ee9db upstream.
      
      The parent clock of the HSUSB clock is the HP clock, not the MP clock.
      
      Fixes: c7bab9f9 ("ARM: shmobile: r8a7794: Add USB clocks to device tree")
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Acked-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Signed-off-by: default avatarSimon Horman <horms+renesas@verge.net.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d387f98c
    • Peter Chen's avatar
      usb: gadget: fix request length error for isoc transfer · a10a1b79
      Peter Chen authored
      commit 982555fc upstream.
      
      For isoc endpoint descriptor, the wMaxPacketSize is not real max packet
      size (see Table 9-13. Standard Endpoint Descriptor, USB 2.0 specifcation),
      it may contain the number of packet, so the real max packet should be
      ep->desc->wMaxPacketSize && 0x7ff.
      
      Cc: Felipe F. Tonello <eu@felipetonello.com>
      Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
      Fixes: 16b114a6 ("usb: gadget: fix usb_ep_align_maybe
        endianness and new usb_ep_aligna")
      Signed-off-by: default avatarPeter Chen <peter.chen@nxp.com>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a10a1b79
    • Bart Van Assche's avatar
      usb: gadget: Fix second argument of percpu_ida_alloc() · b429e37b
      Bart Van Assche authored
      commit 03274445 upstream.
      
      Pass a task state as second argument to percpu_ida_alloc().
      
      Fixes: commit 71e7ae8e ("usb-gadget/tcm: Conversion to percpu_ida tag pre-allocation")
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Cc: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b429e37b
    • Pan Bian's avatar
      USB: serial: kl5kusb105: abort on open exception path · 8da83724
      Pan Bian authored
      commit 3c3dd1e0 upstream.
      
      Function klsi_105_open() calls usb_control_msg() (to "enable read") and
      checks its return value. When the return value is unexpected, it only
      assigns the error code to the return variable retval, but does not
      terminate the exception path. This patch fixes the bug by inserting
      "goto err_generic_close;" when the call to usb_control_msg() fails.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarPan Bian <bianpan2016@163.com>
      [johan: rebase on prerequisite fix and amend commit message]
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8da83724
    • Takashi Iwai's avatar
      ALSA: usb-audio: Fix bogus error return in snd_usb_create_stream() · e7c72dcc
      Takashi Iwai authored
      commit 4763601a upstream.
      
      The function returns -EINVAL even if it builds the stream properly.
      The bogus error code sneaked in during the code refactoring, but it
      wasn't noticed until now since the returned error code itself is
      ignored in anyway.  Kill it here, but there is no behavior change by
      this patch, obviously.
      
      Fixes: e5779998 ('ALSA: usb-audio: refactor code')
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e7c72dcc
    • Jérémy Lefaure's avatar
      usb: musb: blackfin: add bfin_fifo_offset in bfin_ops · 2eb09ccf
      Jérémy Lefaure authored
      commit 5563bb57 upstream.
      
      The function bfin_fifo_offset is defined but not used:
      
      drivers/usb/musb/blackfin.c:36:12: warning: ‘bfin_fifo_offset’ defined
      but not used [-Wunused-function]
       static u32 bfin_fifo_offset(u8 epnum)
                   ^~~~~~~~~~~~~~~~
      
      Adding bfin_fifo_offset to bfin_ops fixes this warning and allows musb
      core to call this function instead of default_fifo_offset.
      
      Fixes: cc92f681 ("usb: musb: Populate new IO functions for blackfin")
      Signed-off-by: default avatarJérémy Lefaure <jeremy.lefaure@lse.epita.fr>
      Signed-off-by: default avatarBin Liu <b-liu@ti.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2eb09ccf
    • Felix Hädicke's avatar
      usb: gadget: udc: core: fix return code of usb_gadget_probe_driver() · 64244edf
      Felix Hädicke authored
      commit 7b017381 upstream.
      
      This fixes a regression which was introduced by commit f1bddbb3, by
      reverting a small fragment of commit 855ed04a.
      
      If the following conditions were met, usb_gadget_probe_driver() returned
      0, although the call was unsuccessful:
      1. A particular UDC was specified by thge gadget driver (using member
      "udc_name" of struct usb_gadget_driver).
      2. The UDC with this name is available.
      3. Another gadget driver is already bound to this gadget.
      4. The gadget driver has the "match_existing_only" flag set.
      In this case, the return code variable "ret" is set to 0, the return
      code of a strcmp() call (to check for the second condition).
      
      This also fixes an oops which could occur in the following scenario:
      1. Two usb gadget instances were configured using configfs.
      2. The first gadget configuration was bound to a UDC (using the configfs
      attribute "UDC").
      3. It was tried to bind the second gadget configuration to the same UDC
      in the same way. This operation was then wrongly reported as being
      successful.
      4. The second gadget configuration's "UDC" attribute is cleared, to
      unbind the (not really bound) second gadget configuration from the UDC.
      
      <BUG: unable to handle kernel NULL pointer dereference
      at           (null)
      IP: [<ffffffff94f5e5e9>] __list_del_entry+0x29/0xc0
      PGD 41b4c5067
      PUD 41a598067
      PMD 0
      
      Oops: 0000 [#1] SMP
      Modules linked in: cdc_acm usb_f_fs usb_f_serial
      usb_f_acm u_serial libcomposite configfs dummy_hcd bnep intel_rapl
      x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm
      snd_hda_codec_hdmi irqbypass crct10dif_pclmul crc32_pclmul
      ghash_clmulni_intel aesni_intel aes_x86_64 lrw gf128mul glue_helper
      ablk_helper cryptd snd_hda_codec_realtek snd_hda_codec_generic serio_raw
      uvcvideo videobuf2_vmalloc btusb snd_usb_audio snd_hda_intel
      videobuf2_memops btrtl snd_hda_codec snd_hda_core snd_usbmidi_lib btbcm
      videobuf2_v4l2 btintel snd_hwdep videobuf2_core snd_seq_midi bluetooth
      snd_seq_midi_event videodev xpad efi_pstore snd_pcm_oss rfkill joydev
      media crc16 ff_memless snd_mixer_oss snd_rawmidi nls_ascii snd_pcm
      snd_seq snd_seq_device nls_cp437 mei_me snd_timer vfat sg udc_core
      lpc_ich fat
      efivars mfd_core mei snd soundcore battery nuvoton_cir rc_core evdev
      intel_smartconnect ie31200_edac edac_core shpchp tpm_tis tpm_tis_core
      tpm parport_pc ppdev lp parport efivarfs autofs4 btrfs xor raid6_pq
      hid_logitech_hidpp hid_logitech_dj hid_generic usbhid hid uas
      usb_storage sr_mod cdrom sd_mod ahci libahci nouveau i915 crc32c_intel
      i2c_algo_bit psmouse ttm xhci_pci libata scsi_mod ehci_pci
      drm_kms_helper xhci_hcd ehci_hcd r8169 mii usbcore drm nvme nvme_core
      fjes button [last unloaded: net2280]
      CPU: 5 PID: 829 Comm: bash Not tainted 4.9.0-rc7 #1
      Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./Z77
      Extreme3, BIOS P1.50 07/11/2013
      task: ffff880419ce4040 task.stack: ffffc90002ed4000
      RIP: 0010:[<ffffffff94f5e5e9>]  [<ffffffff94f5e5e9>]
      __list_del_entry+0x29/0xc0
      RSP: 0018:ffffc90002ed7d68  EFLAGS: 00010207
      RAX: 0000000000000000 RBX: ffff88041787ec30 RCX: dead000000000200
      RDX: 0000000000000000 RSI: ffff880417482002 RDI: ffff88041787ec30
      RBP: ffffc90002ed7d68 R08: 0000000000000000 R09: 0000000000000010
      R10: 0000000000000000 R11: ffff880419ce4040 R12: ffff88041787eb68
      R13: ffff88041787eaa8 R14: ffff88041560a2c0 R15: 0000000000000001
      FS:  00007fe4e49b8700(0000) GS:ffff88042f340000(0000)
      knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000000000000 CR3: 000000041b4c4000 CR4: 00000000001406e0
      Stack:
      ffffc90002ed7d80 ffffffff94f5e68d ffffffffc0ae5ef0 ffffc90002ed7da0
      ffffffffc0ae22aa ffff88041787e800 ffff88041787e800 ffffc90002ed7dc0
      ffffffffc0d7a727 ffffffff952273fa ffff88041aba5760 ffffc90002ed7df8
      Call Trace:
      [<ffffffff94f5e68d>] list_del+0xd/0x30
      [<ffffffffc0ae22aa>] usb_gadget_unregister_driver+0xaa/0xc0 [udc_core]
      [<ffffffffc0d7a727>] unregister_gadget+0x27/0x60 [libcomposite]
      [<ffffffff952273fa>] ? mutex_lock+0x1a/0x30
      [<ffffffffc0d7a9b8>] gadget_dev_desc_UDC_store+0x88/0xe0 [libcomposite]
      [<ffffffffc0af8aa0>] configfs_write_file+0xa0/0x100 [configfs]
      [<ffffffff94e10d27>] __vfs_write+0x37/0x160
      [<ffffffff94e31430>] ? __fd_install+0x30/0xd0
      [<ffffffff95229dae>] ? _raw_spin_unlock+0xe/0x10
      [<ffffffff94e11458>] vfs_write+0xb8/0x1b0
      [<ffffffff94e128f8>] SyS_write+0x58/0xc0
      [<ffffffff94e31594>] ? __close_fd+0x94/0xc0
      [<ffffffff9522a0fb>] entry_SYSCALL_64_fastpath+0x1e/0xad
      Code: 66 90 55 48 8b 07 48 b9 00 01 00 00 00 00 ad de 48 8b 57 08 48 89
      e5 48 39 c8 74 29 48 b9 00 02 00 00 00 00 ad de 48 39 ca 74 3a <4c> 8b
      02 4c 39 c7 75 52 4c 8b 40 08 4c 39 c7 75 66 48 89 50 08
      RIP  [<ffffffff94f5e5e9>] __list_del_entry+0x29/0xc0
      RSP <ffffc90002ed7d68>
      CR2: 0000000000000000
      ---[ end trace 99fc090ab3ff6cbc ]---
      
      Fixes: f1bddbb3 ("usb: gadget: Fix binding to UDC via configfs interface")
      Signed-off-by: default avatarFelix Hädicke <felixhaedicke@web.de>
      Tested-by: default avatarKrzysztof Opasiak <k.opasiak@samsung.com>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      64244edf
    • Geert Uytterhoeven's avatar
      usb: hub: Move hub_port_disable() to fix warning if PM is disabled · 8ecf70fb
      Geert Uytterhoeven authored
      commit 3bc02bce upstream.
      
      If CONFIG_PM=n:
      
          drivers/usb/core/hub.c:107: warning: ‘hub_usb3_port_prepare_disable’ declared inline after being called
          drivers/usb/core/hub.c:107: warning: previous declaration of ‘hub_usb3_port_prepare_disable’ was here
      
      To fix this, move hub_port_disable() after
      hub_usb3_port_prepare_disable(), and adjust forward declarations.
      
      Fixes: 37be6676 ("usb: hub: Fix auto-remount of safely removed or ejected USB-3 devices")
      Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8ecf70fb
    • Tony Lindgren's avatar
      usb: musb: Fix trying to free already-free IRQ 4 · d7550d7d
      Tony Lindgren authored
      commit 8c300fe2 upstream.
      
      When unloading omap2430, we can get the following splat:
      
      WARNING: CPU: 1 PID: 295 at kernel/irq/manage.c:1478 __free_irq+0xa8/0x2c8
      Trying to free already-free IRQ 4
      ...
      [<c01a8b78>] (free_irq) from [<bf0aea84>]
      (musbhs_dma_controller_destroy+0x28/0xb0 [musb_hdrc])
      [<bf0aea84>] (musbhs_dma_controller_destroy [musb_hdrc]) from
      [<bf09f88c>] (musb_remove+0xf0/0x12c [musb_hdrc])
      [<bf09f88c>] (musb_remove [musb_hdrc]) from [<c056a384>]
      (platform_drv_remove+0x24/0x3c)
      ...
      
      This is because the irq number in use is 260 nowadays, and the dma
      controller is using u8 instead of int.
      
      Fixes: 6995eb68 ("USB: musb: enable low level DMA operation for Blackfin")
      Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
      [b-liu@ti.com: added Fixes tag]
      Signed-off-by: default avatarBin Liu <b-liu@ti.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d7550d7d
    • Roger Quadros's avatar
      usb: dwc3: gadget: Fix full speed mode · 5e3c2920
      Roger Quadros authored
      commit 9418ee15 upstream.
      
      DCFG.DEVSPD == 0x3 is not valid and we need to set
      DCFG.DEVSPD to 0x1 for full speed mode. Same goes for
      DSTS.CONNECTSPD.
      
      Old databooks had 0x3 for full speed in 48MHz mode for
      USB1.1 transceivers which was never supported. Newer databooks
      don't mention 0x3 at all.
      
      Cc: John Youn <John.Youn@synopsys.com>
      Signed-off-by: default avatarRoger Quadros <rogerq@ti.com>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5e3c2920
    • Hans de Goede's avatar
      usb: dwc3: pci: Fix dr_mode misspelling · 81f1f24d
      Hans de Goede authored
      commit 51c1685d upstream.
      
      usb_get_dr_mode() expects the device-property to be spelled
      "dr_mode" not "dr-mode".
      
      Spelling it properly fixes the following warning showing up in dmesg:
      [ 8704.500545] dwc3 dwc3.2.auto: Configuration mismatch. dr_mode forced to gadget
      
      Signed-off-by: Hans de Goede <hdegoede@redhat.com
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      81f1f24d
    • Heikki Krogerus's avatar
      usb: dwc3: pci: add Intel Gemini Lake PCI ID · 6af3ba28
      Heikki Krogerus authored
      commit 8f8983a5 upstream.
      
      Intel Gemini Lake SoC has the same DWC3 than Broxton. Add
      the new ID to the supported Devices.
      Signed-off-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6af3ba28
    • OGAWA Hirofumi's avatar
      xhci: Fix race related to abort operation · 63d92d10
      OGAWA Hirofumi authored
      commit 1c111b6c upstream.
      
      Current abort operation has race.
      
          xhci_handle_command_timeout()
            xhci_abort_cmd_ring()
              xhci_write_64(CMD_RING_ABORT)
              xhci_handshake(5s)
      	  do {
      	    check CMD_RING_RUNNING
                  udelay(1)
      					 ...
      					 COMP_CMD_ABORT event
      					 COMP_CMD_STOP event
      					 xhci_handle_stopped_cmd_ring()
      					   restart cmd_ring
                                                 CMD_RING_RUNNING become 1 again
      	  } while ()
                return -ETIMEDOUT
              xhci_write_64(CMD_RING_ABORT)
              /* can abort random command */
      
      To do abort operation correctly, we have to wait both of COMP_CMD_STOP
      event and negation of CMD_RING_RUNNING.
      
      But like above, while timeout handler is waiting negation of
      CMD_RING_RUNNING, event handler can restart cmd_ring. So timeout
      handler never be notice negation of CMD_RING_RUNNING, and retry of
      CMD_RING_ABORT can abort random command (BTW, I guess retry of
      CMD_RING_ABORT was workaround of this race).
      
      To fix this race, this moves xhci_handle_stopped_cmd_ring() to
      xhci_abort_cmd_ring().  And timeout handler waits COMP_CMD_STOP event.
      
      At this point, timeout handler is owner of cmd_ring, and safely
      restart cmd_ring by using xhci_handle_stopped_cmd_ring().
      
      [FWIW, as bonus, this way would be easily extend to add CMD_RING_PAUSE
      operation]
      
      [locks edited as patch is rebased on other locking fixes -Mathias]
      Signed-off-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      63d92d10
    • OGAWA Hirofumi's avatar
      xhci: Use delayed_work instead of timer for command timeout · 799dfdeb
      OGAWA Hirofumi authored
      commit cb4d5ce5 upstream.
      
      This is preparation to fix abort operation race (See "xhci: Fix race
      related to abort operation"). To make timeout sleepable, use
      delayed_work instead of timer.
      
      [change a newly added pending timer fix to pending work -Mathias]
      Signed-off-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      799dfdeb
    • Dan Carpenter's avatar
      usb: xhci-mem: use passed in GFP flags instead of GFP_KERNEL · 6db52153
      Dan Carpenter authored
      commit c95a9f83 upstream.
      
      We normally use the passed in gfp flags for allocations, it's just these
      two which were missed.
      
      Fixes: 22d45f01 ("usb/xhci: replace pci_*_consistent() with dma_*_coherent()")
      Cc: Mathias Nyman <mathias.nyman@intel.com>
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Acked-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6db52153
    • Johan Hovold's avatar
      USB: serial: mos7720: fix parallel probe · 1bd67e85
      Johan Hovold authored
      commit fde1faf8 upstream.
      
      A static usb-serial-driver structure that is used to initialise the
      interrupt URB was modified during probe depending on the currently
      probed device type, something which could break a parallel probe of a
      device of a different type.
      
      Fix this up by overriding the default completion callback for MCS7715
      devices in attach() instead. We may want to use two usb-serial driver
      instances for the two types later.
      
      Fixes: fb088e33 ("USB: serial: add support for serial port on the moschip 7715")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1bd67e85
    • Johan Hovold's avatar
      USB: serial: mos7720: fix parport use-after-free on probe errors · 6ea44fb2
      Johan Hovold authored
      commit 75dd211e upstream.
      
      Do not submit the interrupt URB until after the parport has been
      successfully registered to avoid another use-after-free in the
      completion handler when accessing the freed parport private data in case
      of a racing completion.
      
      Fixes: b69578df ("USB: usbserial: mos7720: add support for parallel port on moschip 7715")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6ea44fb2
    • Johan Hovold's avatar
      USB: serial: mos7720: fix use-after-free on probe errors · e7cf756c
      Johan Hovold authored
      commit 91a1ff4d upstream.
      
      The interrupt URB was submitted on probe but never stopped on probe
      errors. This can lead to use-after-free issues in the completion
      handler when accessing the freed usb-serial struct:
      
      Unable to handle kernel paging request at virtual address 6b6b6be7
      ...
      [<bf052e70>] (mos7715_interrupt_callback [mos7720]) from [<c052a894>] (__usb_hcd_giveback_urb+0x80/0x140)
      [<c052a894>] (__usb_hcd_giveback_urb) from [<c052a9a4>] (usb_hcd_giveback_urb+0x50/0x138)
      [<c052a9a4>] (usb_hcd_giveback_urb) from [<c0550684>] (musb_giveback+0xc8/0x1cc)
      
      Fixes: b69578df ("USB: usbserial: mos7720: add support for parallel port on moschip 7715")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e7cf756c
    • Johan Hovold's avatar
      USB: serial: mos7720: fix NULL-deref at open · ac81f1fa
      Johan Hovold authored
      commit b05aebc2 upstream.
      
      Fix NULL-pointer dereference at port open if a device lacks the expected
      bulk in and out endpoints.
      
      Unable to handle kernel NULL pointer dereference at virtual address 00000030
      ...
      [<bf071c20>] (mos7720_open [mos7720]) from [<bf0490e0>] (serial_port_activate+0x68/0x98 [usbserial])
      [<bf0490e0>] (serial_port_activate [usbserial]) from [<c0470ca4>] (tty_port_open+0x9c/0xe8)
      [<c0470ca4>] (tty_port_open) from [<bf049d98>] (serial_open+0x48/0x6c [usbserial])
      [<bf049d98>] (serial_open [usbserial]) from [<c0469178>] (tty_open+0xcc/0x5cc)
      
      Fixes: 0f64478c ("USB: add USB serial mos7720 driver")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ac81f1fa
    • Johan Hovold's avatar
      USB: serial: mos7840: fix NULL-deref at open · bd52ddb0
      Johan Hovold authored
      commit 5c75633e upstream.
      
      Fix NULL-pointer dereference in open() should the device lack the
      expected endpoints:
      
      Unable to handle kernel NULL pointer dereference at virtual address 00000030
      ...
      PC is at mos7840_open+0x88/0x8dc [mos7840]
      
      Note that we continue to treat the interrupt-in endpoint as optional for
      now.
      
      Fixes: 3f542974 ("USB: Moschip 7840 USB-Serial Driver")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bd52ddb0
    • Johan Hovold's avatar
      USB: serial: kobil_sct: fix NULL-deref in write · 9de856ca
      Johan Hovold authored
      commit 21ce5784 upstream.
      
      Fix NULL-pointer dereference in write() should the device lack the
      expected interrupt-out endpoint:
      
      Unable to handle kernel NULL pointer dereference at virtual address 00000054
      ...
      PC is at kobil_write+0x144/0x2a0 [kobil_sct]
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9de856ca