1. 16 Oct, 2016 12 commits
    • Boris Ostrovsky's avatar
      xen/x86: Update topology map for PV VCPUs · ed17bfe0
      Boris Ostrovsky authored
      commit a6a198bc upstream.
      
      Early during boot topology_update_package_map() computes
      logical_pkg_ids for all present processors.
      
      Later, when processors are brought up, identify_cpu() updates
      these values based on phys_pkg_id which is a function of
      initial_apicid. On PV guests the latter may point to a
      non-existing node, causing logical_pkg_ids to be set to -1.
      
      Intel's RAPL uses logical_pkg_id (as topology_logical_package_id())
      to index its arrays and therefore in this case will point to index
      65535 (since logical_pkg_id is a u16). This could lead to either a
      crash or may actually access random memory location.
      
      As a workaround, we recompute topology during CPU bringup to reset
      logical_pkg_id to a valid value.
      
      (The reason for initial_apicid being bogus is because it is
      initial_apicid of the processor from which the guest is launched.
      This value is CPUID(1).EBX[31:24])
      Signed-off-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ed17bfe0
    • Uwe Kleine-König's avatar
      mfd: wm8350-i2c: Make sure the i2c regmap functions are compiled · d074f937
      Uwe Kleine-König authored
      commit 88003fb1 upstream.
      
      This fixes a compile failure:
      
      	drivers/built-in.o: In function `wm8350_i2c_probe':
      	core.c:(.text+0x828b0): undefined reference to `__devm_regmap_init_i2c'
      	Makefile:953: recipe for target 'vmlinux' failed
      
      Fixes: 52b461b8 ("mfd: Add regmap cache support for wm8350")
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Acked-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d074f937
    • Dan Carpenter's avatar
      mfd: 88pm80x: Double shifting bug in suspend/resume · 21c02f87
      Dan Carpenter authored
      commit 9a6dc644 upstream.
      
      set_bit() and clear_bit() take the bit number so this code is really
      doing "1 << (1 << irq)" which is a double shift bug.  It's done
      consistently so it won't cause a problem unless "irq" is more than 4.
      
      Fixes: 70c6cce0 ('mfd: Support 88pm80x in 80x driver')
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      21c02f87
    • Boris Brezillon's avatar
      mfd: atmel-hlcdc: Do not sleep in atomic context · db910738
      Boris Brezillon authored
      commit 2c2469bc upstream.
      
      readl_poll_timeout() calls usleep_range(), but
      regmap_atmel_hlcdc_reg_write() is called in atomic context (regmap
      spinlock held).
      
      Replace the readl_poll_timeout() call by readl_poll_timeout_atomic().
      
      Fixes: ea31c0cf ("mfd: atmel-hlcdc: Implement config synchronization")
      Signed-off-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      db910738
    • Lu Baolu's avatar
      mfd: rtsx_usb: Avoid setting ucr->current_sg.status · 6fb0ccbb
      Lu Baolu authored
      commit 8dcc5ff8 upstream.
      
      Member "status" of struct usb_sg_request is managed by usb core. A
      spin lock is used to serialize the change of it. The driver could
      check the value of req->status, but should avoid changing it without
      the hold of the spinlock. Otherwise, it could cause race or error
      in usb core.
      
      This patch could be backported to stable kernels with version later
      than v3.14.
      
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Roger Tseng <rogerable@realtek.com>
      Signed-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6fb0ccbb
    • Takashi Sakamoto's avatar
      ALSA: usb-line6: use the same declaration as definition in header for MIDI manufacturer ID · be794eba
      Takashi Sakamoto authored
      commit 8da08ca0 upstream.
      
      Currently, usb-line6 module exports an array of MIDI manufacturer ID and
      usb-pod module uses it. However, the declaration is not the definition in
      common header. The difference is explicit length of array. Although
      compiler calculates it and everything goes well, it's better to use the
      same representation between definition and declaration.
      
      This commit fills the length of array for usb-line6 module. As a small
      good sub-effect, this commit suppress below warnings from static analysis
      by sparse v0.5.0.
      
      sound/usb/line6/driver.c:274:43: error: cannot size expression
      sound/usb/line6/driver.c:275:16: error: cannot size expression
      sound/usb/line6/driver.c:276:16: error: cannot size expression
      sound/usb/line6/driver.c:277:16: error: cannot size expression
      
      Fixes: 705ececd ("Staging: add line6 usb driver")
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      be794eba
    • Anssi Hannula's avatar
      ALSA: usb-audio: Extend DragonFly dB scale quirk to cover other variants · 972cf5ca
      Anssi Hannula authored
      commit eb1a74b7 upstream.
      
      The DragonFly quirk added in 42e3121d ("ALSA: usb-audio: Add a more
      accurate volume quirk for AudioQuest DragonFly") applies a custom dB map
      on the volume control when its range is reported as 0..50 (0 .. 0.2dB).
      
      However, there exists at least one other variant (hw v1.0c, as opposed
      to the tested v1.2) which reports a different non-sensical volume range
      (0..53) and the custom map is therefore not applied for that device.
      
      This results in all of the volume change appearing close to 100% on
      mixer UIs that utilize the dB TLV information.
      
      Add a fallback case where no dB TLV is reported at all if the control
      range is not 0..50 but still 0..N where N <= 1000 (3.9 dB). Also
      restrict the quirk to only apply to the volume control as there is also
      a mute control which would match the check otherwise.
      
      Fixes: 42e3121d ("ALSA: usb-audio: Add a more accurate volume quirk for AudioQuest DragonFly")
      Signed-off-by: default avatarAnssi Hannula <anssi.hannula@iki.fi>
      Reported-by: default avatarDavid W <regulars@d-dub.org.uk>
      Tested-by: default avatarDavid W <regulars@d-dub.org.uk>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      972cf5ca
    • Takashi Iwai's avatar
      ALSA: ali5451: Fix out-of-bound position reporting · 8af40120
      Takashi Iwai authored
      commit db685779 upstream.
      
      The pointer callbacks of ali5451 driver may return the value at the
      boundary occasionally, and it results in the kernel warning like
        snd_ali5451 0000:00:06.0: BUG: , pos = 16384, buffer size = 16384, period size = 1024
      
      It seems that folding the position offset is enough for fixing the
      warning and no ill-effect has been seen by that.
      Reported-by: default avatarEnrico Mioso <mrkiko.rs@gmail.com>
      Tested-by: default avatarEnrico Mioso <mrkiko.rs@gmail.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8af40120
    • Lu Baolu's avatar
      usb: dwc3: fix Clear Stall EP command failure · 2a25eb7a
      Lu Baolu authored
      commit 5e6c88d2 upstream.
      
      Commit 50c763f8 ("usb: dwc3: Set the ClearPendIN bit on Clear
      Stall EP command") sets ClearPendIN bit for all IN endpoints of
      v2.60a+ cores. This causes ClearStall command fails on 2.60+ cores
      operating in HighSpeed mode.
      
      In page 539 of 2.60a specification:
      
      "When issuing Clear Stall command for IN endpoints in SuperSpeed
      mode, the software must set the "ClearPendIN" bit to '1' to
      clear any pending IN transcations, so that the device does not
      expect any ACK TP from the host for the data sent earlier."
      
      It's obvious that we only need to apply this rule to those IN
      endpoints that currently operating in SuperSpeed mode.
      
      Fixes: 50c763f8 ("usb: dwc3: Set the ClearPendIN bit on Clear Stall EP command")
      Signed-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2a25eb7a
    • John Stultz's avatar
      timekeeping: Fix __ktime_get_fast_ns() regression · 7ea90daa
      John Stultz authored
      commit 58bfea95 upstream.
      
      In commit 27727df2 ("Avoid taking lock in NMI path with
      CONFIG_DEBUG_TIMEKEEPING"), I changed the logic to open-code
      the timekeeping_get_ns() function, but I forgot to include
      the unit conversion from cycles to nanoseconds, breaking the
      function's output, which impacts users like perf.
      
      This results in bogus perf timestamps like:
       swapper     0 [000]   253.427536:  111111111 cpu-clock:  ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
       swapper     0 [000]   254.426573:  111111111 cpu-clock:  ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
       swapper     0 [000]   254.426687:  111111111 cpu-clock:  ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
       swapper     0 [000]   254.426800:  111111111 cpu-clock:  ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
       swapper     0 [000]   254.426905:  111111111 cpu-clock:  ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
       swapper     0 [000]   254.427022:  111111111 cpu-clock:  ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
       swapper     0 [000]   254.427127:  111111111 cpu-clock:  ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
       swapper     0 [000]   254.427239:  111111111 cpu-clock:  ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
       swapper     0 [000]   254.427346:  111111111 cpu-clock:  ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
       swapper     0 [000]   254.427463:  111111111 cpu-clock:  ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
       swapper     0 [000]   255.426572:  111111111 cpu-clock:  ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
      
      Instead of more reasonable expected timestamps like:
       swapper     0 [000]    39.953768:  111111111 cpu-clock:  ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
       swapper     0 [000]    40.064839:  111111111 cpu-clock:  ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
       swapper     0 [000]    40.175956:  111111111 cpu-clock:  ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
       swapper     0 [000]    40.287103:  111111111 cpu-clock:  ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
       swapper     0 [000]    40.398217:  111111111 cpu-clock:  ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
       swapper     0 [000]    40.509324:  111111111 cpu-clock:  ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
       swapper     0 [000]    40.620437:  111111111 cpu-clock:  ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
       swapper     0 [000]    40.731546:  111111111 cpu-clock:  ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
       swapper     0 [000]    40.842654:  111111111 cpu-clock:  ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
       swapper     0 [000]    40.953772:  111111111 cpu-clock:  ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
       swapper     0 [000]    41.064881:  111111111 cpu-clock:  ffffffff810a0de6 native_safe_halt+0x6 ([kernel.kallsyms])
      
      Add the proper use of timekeeping_delta_to_ns() to convert
      the cycle delta to nanoseconds as needed.
      
      Thanks to Brendan and Alexei for finding this quickly after
      the v4.8 release. Unfortunately the problematic commit has
      landed in some -stable trees so they'll need this fix as
      well.
      
      Many apologies for this mistake. I'll be looking to add a
      perf-clock sanity test to the kselftest timers tests soon.
      
      Fixes: 27727df2 "timekeeping: Avoid taking lock in NMI path with CONFIG_DEBUG_TIMEKEEPING"
      Reported-by: default avatarBrendan Gregg <bgregg@netflix.com>
      Reported-by: default avatarAlexei Starovoitov <alexei.starovoitov@gmail.com>
      Tested-and-reviewed-by: default avatarMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Link: http://lkml.kernel.org/r/1475636148-26539-1-git-send-email-john.stultz@linaro.orgSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7ea90daa
    • Andrew Donnellan's avatar
      cxl: use pcibios_free_controller_deferred() when removing vPHBs · 3e08bc37
      Andrew Donnellan authored
      commit 6f38a8b9 upstream.
      
      When cxl removes a vPHB, it's possible that the pci_controller may be freed
      before all references to the devices on the vPHB have been released. This
      in turn causes an invalid memory access when the devices are eventually
      released, as pcibios_release_device() attempts to call the phb's
      release_device hook.
      
      In cxl_pci_vphb_remove(), remove the existing call to
      pcibios_free_controller(). Instead, use
      pcibios_free_controller_deferred() to free the pci_controller after all
      devices have been released. Export pci_set_host_bridge_release() so we can
      do this.
      Signed-off-by: default avatarAndrew Donnellan <andrew.donnellan@au1.ibm.com>
      Reviewed-by: default avatarMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
      Acked-by: default avatarIan Munsie <imunsie@au1.ibm.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3e08bc37
    • Mauricio Faria de Oliveira's avatar
      powerpc/pseries: use pci_host_bridge.release_fn() to kfree(phb) · 83573add
      Mauricio Faria de Oliveira authored
      commit 2dd9c11b upstream.
      
      This patch leverages 'struct pci_host_bridge' from the PCI subsystem
      in order to free the pci_controller only after the last reference to
      its devices is dropped (avoiding an oops in pcibios_release_device()
      if the last reference is dropped after pcibios_free_controller()).
      
      The patch relies on pci_host_bridge.release_fn() (and .release_data),
      which is called automatically by the PCI subsystem when the root bus
      is released (i.e., the last reference is dropped).  Those fields are
      set via pci_set_host_bridge_release() (e.g. in the platform-specific
      implementation of pcibios_root_bridge_prepare()).
      
      It introduces the 'pcibios_free_controller_deferred()' .release_fn()
      and it expects .release_data to hold a pointer to the pci_controller.
      
      The function implictly calls 'pcibios_free_controller()', so an user
      must *NOT* explicitly call it if using the new _deferred() callback.
      
      The functionality is enabled for pseries (although it isn't platform
      specific, and may be used by cxl).
      
      Details on not-so-elegant design choices:
      
       - Use 'pci_host_bridge.release_data' field as pointer to associated
         'struct pci_controller' so *not* to 'pci_bus_to_host(bridge->bus)'
         in pcibios_free_controller_deferred().
      
         That's because pci_remove_root_bus() sets 'host_bridge->bus = NULL'
         (so, if the last reference is released after pci_remove_root_bus()
         runs, which eventually reaches pcibios_free_controller_deferred(),
         that would hit a null pointer dereference).
      
         The cxl/vphb.c code calls pci_remove_root_bus(), and the cxl folks
         are interested in this fix.
      
      Test-case #1 (hold references)
      
        # ls -ld /sys/block/sd* | grep -m1 0021:01:00.0
        <...> /sys/block/sdaa -> ../devices/pci0021:01/0021:01:00.0/<...>
      
        # ls -ld /sys/block/sd* | grep -m1 0021:01:00.1
        <...> /sys/block/sdab -> ../devices/pci0021:01/0021:01:00.1/<...>
      
        # cat >/dev/sdaa & pid1=$!
        # cat >/dev/sdab & pid2=$!
      
        # drmgr -w 5 -d 1 -c phb -s 'PHB 33' -r
        Validating PHB DLPAR capability...yes.
        [  594.306719] pci_hp_remove_devices: PCI: Removing devices on bus 0021:01
        [  594.306738] pci_hp_remove_devices:    Removing 0021:01:00.0...
        ...
        [  598.236381] pci_hp_remove_devices:    Removing 0021:01:00.1...
        ...
        [  611.972077] pci_bus 0021:01: busn_res: [bus 01-ff] is released
        [  611.972140] rpadlpar_io: slot PHB 33 removed
      
        # kill -9 $pid1
        # kill -9 $pid2
        [  632.918088] pcibios_free_controller_deferred: domain 33, dynamic 1
      
      Test-case #2 (don't hold references)
      
        # drmgr -w 5 -d 1 -c phb -s 'PHB 33' -r
        Validating PHB DLPAR capability...yes.
        [  916.357363] pci_hp_remove_devices: PCI: Removing devices on bus 0021:01
        [  916.357386] pci_hp_remove_devices:    Removing 0021:01:00.0...
        ...
        [  920.566527] pci_hp_remove_devices:    Removing 0021:01:00.1...
        ...
        [  933.955873] pci_bus 0021:01: busn_res: [bus 01-ff] is released
        [  933.955977] pcibios_free_controller_deferred: domain 33, dynamic 1
        [  933.955999] rpadlpar_io: slot PHB 33 removed
      Suggested-By: default avatarGavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: default avatarMauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
      Reviewed-by: default avatarGavin Shan <gwshan@linux.vnet.ibm.com>
      Reviewed-by: default avatarAndrew Donnellan <andrew.donnellan@au1.ibm.com>
      Tested-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> # cxl
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      83573add
  2. 07 Oct, 2016 28 commits
    • Greg Kroah-Hartman's avatar
      Linux 4.7.7 · fdf81f0f
      Greg Kroah-Hartman authored
      fdf81f0f
    • Takashi Iwai's avatar
      ALSA: hda - Add the top speaker pin config for HP Spectre x360 · 81b18fbe
      Takashi Iwai authored
      commit 0eec8809 upstream.
      
      HP Spectre x360 with CX20724 codec has two speaker outputs while the
      BIOS sets up only the bottom one (NID 0x17) and disables the top one
      (NID 0x1d).
      
      This patch adds a fixup simply defining the proper pincfg for NID 0x1d
      so that the top speaker works as is.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=169071Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      81b18fbe
    • Hui Wang's avatar
      ALSA: hda - Fix headset mic detection problem for several Dell laptops · 28e2aad9
      Hui Wang authored
      commit 3f640970 upstream.
      
      One of the laptops has the codec ALC256 on it, applying the
      ALC255_FIXUP_DELL1_MIC_NO_PRESENCE can fix the problem, the rest
      of laptops have the codec ALC295 on them, they are similar to machines
      with ALC225, applying the ALC269_FIXUP_DELL1_MIC_NO_PRESENCE can fix
      the problem.
      Signed-off-by: default avatarHui Wang <hui.wang@canonical.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      28e2aad9
    • Hui Wang's avatar
      ALSA: hda - Adding one more ALC255 pin definition for headset problem · c8d80159
      Hui Wang authored
      commit 392c9da2 upstream.
      
      We have two new Dell laptop models, they have the same ALC255 pin
      definition, but not in the pin quirk table yet, as a result, the
      headset microphone can't work. After adding the definition in the
      table, the headset microphone works well.
      Signed-off-by: default avatarHui Wang <hui.wang@canonical.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c8d80159
    • Greg Kroah-Hartman's avatar
      Revert "usbtmc: convert to devm_kzalloc" · c215a12f
      Greg Kroah-Hartman authored
      commit ab21b63e upstream.
      
      This reverts commit e6c7efdc.
      
      Turns out it was totally wrong.  The memory is supposed to be bound to
      the kref, as the original code was doing correctly, not the
      device/driver binding as the devm_kzalloc() would cause.
      
      This fixes an oops when read would be called after the device was
      unbound from the driver.
      Reported-by: default avatarLadislav Michl <ladis@linux-mips.org>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c215a12f
    • Kyle Jones's avatar
      USB: serial: cp210x: Add ID for a Juniper console · bd273969
      Kyle Jones authored
      commit decc5360 upstream.
      Signed-off-by: default avatarKyle Jones <kyle@kf5jwc.us>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bd273969
    • Nicolas Iooss's avatar
      usb: usbip: vudc: fix left shift overflow · 57a265bc
      Nicolas Iooss authored
      commit 238b7bd9 upstream.
      
      In v_recv_cmd_submit(), urb_p->urb->pipe has the type unsigned int
      (which is 32-bit long on x86_64) but 11<<30 results in a 34-bit integer.
      Therefore the 2 leading bits are truncated and
      
          urb_p->urb->pipe &= ~(11 << 30);
      
      has the same meaning as
      
          urb_p->urb->pipe &= ~(3 << 30);
      
      This second statement seems to be how the code was intended to be
      written, as PIPE_ constants have values between 0 and 3.
      
      The overflow has been detected with a clang warning:
      
          drivers/usb/usbip/vudc_rx.c:145:27: warning: signed shift result
          (0x2C0000000) requires 35 bits to represent, but 'int' only has 32
          bits [-Wshift-overflow]
                  urb_p->urb->pipe &= ~(11 << 30);
                                        ~~ ^  ~~
      
      Fixes: 79c02cb1 ("usbip: vudc: Add vudc_rx")
      Signed-off-by: default avatarNicolas Iooss <nicolas.iooss_linux@m4x.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      57a265bc
    • Ksenija Stanojevic's avatar
      Staging: fbtft: Fix bug in fbtft-core · 41cba9cd
      Ksenija Stanojevic authored
      commit fc1e2c8e upstream.
      
      Commit 367e8560 introduced a bug
      in fbtft-core where fps is always 0, this is because variable
      update_time is not assigned correctly.
      Signed-off-by: default avatarKsenija Stanojevic <ksenija.stanojevic@gmail.com>
      Fixes: 367e8560 ("Staging: fbtbt: Replace timespec with ktime_t")
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      41cba9cd
    • Greg Kroah-Hartman's avatar
      usb: misc: legousbtower: Fix NULL pointer deference · 03f8e90d
      Greg Kroah-Hartman authored
      commit 2fae9e5a upstream.
      
      This patch fixes a NULL pointer dereference caused by a race codition in
      the probe function of the legousbtower driver. It re-structures the
      probe function to only register the interface after successfully reading
      the board's firmware ID.
      
      The probe function does not deregister the usb interface after an error
      receiving the devices firmware ID. The device file registered
      (/dev/usb/legousbtower%d) may be read/written globally before the probe
      function returns. When tower_delete is called in the probe function
      (after an r/w has been initiated), core dev structures are deleted while
      the file operation functions are still running. If the 0 address is
      mappable on the machine, this vulnerability can be used to create a
      Local Priviege Escalation exploit via a write-what-where condition by
      remapping dev->interrupt_out_buffer in tower_write. A forged USB device
      and local program execution would be required for LPE. The USB device
      would have to delay the control message in tower_probe and accept
      the control urb in tower_open whilst guest code initiated a write to the
      device file as tower_delete is called from the error in tower_probe.
      
      This bug has existed since 2003. Patch tested by emulated device.
      Reported-by: default avatarJames Patrick-Evans <james@jmp-e.com>
      Tested-by: default avatarJames Patrick-Evans <james@jmp-e.com>
      Signed-off-by: default avatarJames Patrick-Evans <james@jmp-e.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      03f8e90d
    • Mikulas Patocka's avatar
      dm log writes: fix bug with too large bios · acae2cb2
      Mikulas Patocka authored
      commit 7efb3673 upstream.
      
      bio_alloc() can allocate a bio with at most BIO_MAX_PAGES (256) vector
      entries.  However, the incoming bio may have more vector entries if it
      was allocated by other means.  For example, bcache submits bios with
      more than BIO_MAX_PAGES entries.  This results in bio_alloc() failure.
      
      To avoid the failure, change the code so that it allocates bio with at
      most BIO_MAX_PAGES entries.  If the incoming bio has more entries,
      bio_add_page() will fail and a new bio will be allocated - the code that
      handles bio_add_page() failure already exists in the dm-log-writes
      target.
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Reviewed-by: default avatarJosef Bacik <jbacik@fb.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      acae2cb2
    • Jann Horn's avatar
      aio: mark AIO pseudo-fs noexec · f4a75a57
      Jann Horn authored
      commit 22f6b4d3 upstream.
      
      This ensures that do_mmap() won't implicitly make AIO memory mappings
      executable if the READ_IMPLIES_EXEC personality flag is set.  Such
      behavior is problematic because the security_mmap_file LSM hook doesn't
      catch this case, potentially permitting an attacker to bypass a W^X
      policy enforced by SELinux.
      
      I have tested the patch on my machine.
      
      To test the behavior, compile and run this:
      
          #define _GNU_SOURCE
          #include <unistd.h>
          #include <sys/personality.h>
          #include <linux/aio_abi.h>
          #include <err.h>
          #include <stdlib.h>
          #include <stdio.h>
          #include <sys/syscall.h>
      
          int main(void) {
              personality(READ_IMPLIES_EXEC);
              aio_context_t ctx = 0;
              if (syscall(__NR_io_setup, 1, &ctx))
                  err(1, "io_setup");
      
              char cmd[1000];
              sprintf(cmd, "cat /proc/%d/maps | grep -F '/[aio]'",
                  (int)getpid());
              system(cmd);
              return 0;
          }
      
      In the output, "rw-s" is good, "rwxs" is bad.
      Signed-off-by: default avatarJann Horn <jann@thejh.net>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f4a75a57
    • Jarkko Sakkinen's avatar
      tpm_crb: fix mapping of the buffers · 8e20d930
      Jarkko Sakkinen authored
      commit 422eac3f upstream.
      
      On my Lenovo x250 the following situation occurs:
      
      [18697.813871] tpm_crb MSFT0101:00: can't request region for resource
      [mem 0xacdff080-0xacdfffff]
      
      The mapping of the control area overlaps the mapping of the command
      buffer. The control area is mapped over page, which is not right. It
      should mapped over sizeof(struct crb_control_area).
      
      Fixing this issue unmasks another issue. Command and response buffers
      can overlap and they do interleave on this machine. According to the PTP
      specification the overlapping means that they are mapped to the same
      buffer.
      
      The commit has been also on a Haswell NUC where things worked before
      applying this fix so that the both code paths for response buffer
      initialization are tested.
      
      Cc: stable@vger.kernel.org
      Fixes: 1bd047be ("tpm_crb: Use devm_ioremap_resource")
      Signed-off-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
      Reviewed-by: default avatarJason Gunthorpe <jgunthorpe@obsidianresearch.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8e20d930
    • Jarkko Sakkinen's avatar
      tpm_crb: drop struct resource res from struct crb_priv · 5a580057
      Jarkko Sakkinen authored
      commit 14ddfbf4 upstream.
      
      The iomem resource is needed only temporarily so it is better to pass
      it on instead of storing it permanently. Named the variable as io_res
      so that the code better documents itself.
      Signed-off-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
      Reviewed-by: default avatarStefan Berger <stefanb@linux.vnet.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5a580057
    • Marek Lindner's avatar
    • Maor Gottlieb's avatar
      IB/mlx5: Set source mac address in FTE · 11e4257d
      Maor Gottlieb authored
      commit ee3da804 upstream.
      
      Set the source mac address in the FTE when L2 specification
      is provided.
      
      Fixes: 038d2ef8 ('IB/mlx5: Add flow steering support')
      Signed-off-by: default avatarMaor Gottlieb <maorg@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      11e4257d
    • Noa Osherovich's avatar
      IB/mlx5: Enable MAD_IFC commands for IB ports only · d0240249
      Noa Osherovich authored
      commit 7fae6655 upstream.
      
      MAD_IFC command is supported only for physical functions (PF)
      and when physical port is IB. The proposed fix enforces it.
      
      Fixes: d603c809 ("IB/mlx5: Fix decision on using MAD_IFC")
      Reported-by: default avatarDavid Chang <dchang@suse.com>
      Signed-off-by: default avatarNoa Osherovich <noaos@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d0240249
    • Jack Morgenstein's avatar
      IB/mlx4: Use correct subnet-prefix in QP1 mads under SR-IOV · 23c1162c
      Jack Morgenstein authored
      commit 8ec07bf8 upstream.
      
      When sending QP1 MAD packets which use a GRH, the source GID
      (which consists of the 64-bit subnet prefix, and the 64 bit port GUID)
      must be included in the packet GRH.
      
      For SR-IOV, a GID cache is used, since the source GID needs to be the
      slave's source GID, and not the Hypervisor's GID. This cache also
      included a subnet_prefix. Unfortunately, the subnet_prefix field in
      the cache was never initialized (to the default subnet prefix 0xfe80::0).
      As a result, this field remained all zeroes.  Therefore, when SR-IOV
      was active, all QP1 packets which included a GRH had a source GID
      subnet prefix of all-zeroes.
      
      However, the subnet-prefix should initially be 0xfe80::0 (the default
      subnet prefix). In addition, if OpenSM modifies a port's subnet prefix,
      the new subnet prefix must be used in the GRH when sending QP1 packets.
      To fix this we now initialize the subnet prefix in the SR-IOV GID cache
      to the default subnet prefix. We update the cached value if/when OpenSM
      modifies the port's subnet prefix. We take this cached value when sending
      QP1 packets when SR-IOV is active.
      
      Note that the value is stored as an atomic64. This eliminates any need
      for locking when the subnet prefix is being updated.
      
      Note also that we depend on the FW generating the "port management change"
      event for tracking subnet-prefix changes performed by OpenSM. If running
      early FW (before 2.9.4630), subnet prefix changes will not be tracked (but
      the default subnet prefix still will be stored in the cache; therefore
      users who do not modify the subnet prefix will not have a problem).
      IF there is a need for such tracking also for early FW, we will add that
      capability in a subsequent patch.
      
      Fixes: 1ffeb2eb ("IB/mlx4: SR-IOV IB context objects and proxy/tunnel SQP support")
      Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      23c1162c
    • Jack Morgenstein's avatar
      IB/mlx4: Fix code indentation in QP1 MAD flow · 34238679
      Jack Morgenstein authored
      commit baa0be70 upstream.
      
      The indentation in the QP1 GRH flow in procedure build_mlx_header is
      really confusing. Fix it, in preparation for a commit which touches
      this code.
      
      Fixes: 1ffeb2eb ("IB/mlx4: SR-IOV IB context objects and proxy/tunnel SQP support")
      Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      34238679
    • Alex Vesker's avatar
      IB/mlx4: Fix incorrect MC join state bit-masking on SR-IOV · c1502159
      Alex Vesker authored
      commit e5ac40cd upstream.
      
      Because of an incorrect bit-masking done on the join state bits, when
      handling a join request we failed to detect a difference between the
      group join state and the request join state when joining as send only
      full member (0x8). This caused the MC join request not to be sent.
      This issue is relevant only when SRIOV is enabled and SM supports
      send only full member.
      
      This fix separates scope bits and join states bits a nibble each.
      
      Fixes: b9c5d6a6 ('IB/mlx4: Add multicast group (MCG) paravirtualization for SR-IOV')
      Signed-off-by: default avatarAlex Vesker <valex@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c1502159
    • Alex Vesker's avatar
      IB/ipoib: Don't allow MC joins during light MC flush · 749fd55d
      Alex Vesker authored
      commit 344bacca upstream.
      
      This fix solves a race between light flush and on the fly joins.
      Light flush doesn't set the device to down and unset IPOIB_OPER_UP
      flag, this means that if while flushing we have a MC join in progress
      and the QP was attached to BC MGID we can have a mismatches when
      re-attaching a QP to the BC MGID.
      
      The light flush would set the broadcast group to NULL causing an on
      the fly join to rejoin and reattach to the BC MCG as well as adding
      the BC MGID to the multicast list. The flush process would later on
      remove the BC MGID and detach it from the QP. On the next flush
      the BC MGID is present in the multicast list but not found when trying
      to detach it because of the previous double attach and single detach.
      
      [18332.714265] ------------[ cut here ]------------
      [18332.717775] WARNING: CPU: 6 PID: 3767 at drivers/infiniband/core/verbs.c:280 ib_dealloc_pd+0xff/0x120 [ib_core]
      ...
      [18332.775198] Hardware name: Red Hat KVM, BIOS Bochs 01/01/2011
      [18332.779411]  0000000000000000 ffff8800b50dfbb0 ffffffff813fed47 0000000000000000
      [18332.784960]  0000000000000000 ffff8800b50dfbf0 ffffffff8109add1 0000011832f58300
      [18332.790547]  ffff880226a596c0 ffff880032482000 ffff880032482830 ffff880226a59280
      [18332.796199] Call Trace:
      [18332.798015]  [<ffffffff813fed47>] dump_stack+0x63/0x8c
      [18332.801831]  [<ffffffff8109add1>] __warn+0xd1/0xf0
      [18332.805403]  [<ffffffff8109aebd>] warn_slowpath_null+0x1d/0x20
      [18332.809706]  [<ffffffffa025d90f>] ib_dealloc_pd+0xff/0x120 [ib_core]
      [18332.814384]  [<ffffffffa04f3d7c>] ipoib_transport_dev_cleanup+0xfc/0x1d0 [ib_ipoib]
      [18332.820031]  [<ffffffffa04ed648>] ipoib_ib_dev_cleanup+0x98/0x110 [ib_ipoib]
      [18332.825220]  [<ffffffffa04e62c8>] ipoib_dev_cleanup+0x2d8/0x550 [ib_ipoib]
      [18332.830290]  [<ffffffffa04e656f>] ipoib_uninit+0x2f/0x40 [ib_ipoib]
      [18332.834911]  [<ffffffff81772a8a>] rollback_registered_many+0x1aa/0x2c0
      [18332.839741]  [<ffffffff81772bd1>] rollback_registered+0x31/0x40
      [18332.844091]  [<ffffffff81773b18>] unregister_netdevice_queue+0x48/0x80
      [18332.848880]  [<ffffffffa04f489b>] ipoib_vlan_delete+0x1fb/0x290 [ib_ipoib]
      [18332.853848]  [<ffffffffa04df1cd>] delete_child+0x7d/0xf0 [ib_ipoib]
      [18332.858474]  [<ffffffff81520c08>] dev_attr_store+0x18/0x30
      [18332.862510]  [<ffffffff8127fe4a>] sysfs_kf_write+0x3a/0x50
      [18332.866349]  [<ffffffff8127f4e0>] kernfs_fop_write+0x120/0x170
      [18332.870471]  [<ffffffff81207198>] __vfs_write+0x28/0xe0
      [18332.874152]  [<ffffffff810e09bf>] ? percpu_down_read+0x1f/0x50
      [18332.878274]  [<ffffffff81208062>] vfs_write+0xa2/0x1a0
      [18332.881896]  [<ffffffff812093a6>] SyS_write+0x46/0xa0
      [18332.885632]  [<ffffffff810039b7>] do_syscall_64+0x57/0xb0
      [18332.889709]  [<ffffffff81883321>] entry_SYSCALL64_slow_path+0x25/0x25
      [18332.894727] ---[ end trace 09ebbe31f831ef17 ]---
      
      Fixes: ee1e2c82 ("IPoIB: Refresh paths instead of flushing them on SM change events")
      Signed-off-by: default avatarAlex Vesker <valex@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      749fd55d
    • Johannes Thumshirn's avatar
      scsi: ses: use scsi_is_sas_rphy instead of is_sas_attached · 27241dbf
      Johannes Thumshirn authored
      commit 835831c5 upstream.
      
      Use scsi_is_sas_rphy() instead of is_sas_attached() to decide whether we
      should obtain the SAS address from a scsi device or not. This will
      prevent us from tripping on the BUG_ON() in sas_sdev_to_rdev() if the
      rphy isn't attached to the SAS transport class, like it is with hpsa's
      logical devices.
      
      Fixes: 3f8d6f2a ('ses: fix discovery of SATA devices in SAS enclosures')
      Signed-off-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
      Reviewed-by: default avatarJames E.J. Bottomley <jejb@linux.vnet.ibm.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      27241dbf
    • Johannes Thumshirn's avatar
      scsi: sas: provide stub implementation for scsi_is_sas_rphy · c31d2667
      Johannes Thumshirn authored
      commit c1a23f6d upstream.
      
      Provide a stub implementation for scsi_is_sas_rphy for kernel
      configurations which do not have CONFIG_SCSI_SAS_ATTRS defined.
      Reported-by: default avatarkbuild test robot <lkp@intel.com>
      Suggested-by: default avatarJames Bottomley <jejb@linux.vnet.ibm.com>
      Reviewed-by: default avatarJames E.J. Bottomley <jejb@linux.vnet.ibm.com>
      Signed-off-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c31d2667
    • Lars-Peter Clausen's avatar
      regmap: rbtree: Avoid overlapping nodes · 1ee64247
      Lars-Peter Clausen authored
      commit 1bc8da4e upstream.
      
      When searching for a suitable node that should be used for inserting a new
      register, which does not fall within the range of any existing node, we not
      only looks for nodes which are directly adjacent to the new register, but
      for nodes within a certain proximity. This is done to avoid creating lots
      of small nodes with just a few registers spacing in between, which would
      increase memory usage as well as tree traversal time.
      
      This means there might be multiple node candidates which fall within the
      proximity range of the new register. If we choose the first node we
      encounter, under certain register insertion patterns it is possible to end
      up with overlapping ranges. This will break order in the rbtree and can
      cause the cached register value to become corrupted.
      
      E.g. take the simplified example where the proximity range is 2 and the
      register insertion sequence is 1, 4, 2, 3, 5.
       * Insert of register 1 creates a new node, this is the root of the rbtree
       * Insert of register 4 creates a new node, which is inserted to the right
         of the root.
       * Insert of register 2 gets inserted to the first node
       * Insert of register 3 gets inserted to the first node
       * Insert of register 5 also gets inserted into the first node since
         this is the first node encountered and it is within the proximity range.
         Now there are two overlapping nodes.
      
      To avoid this always choose the node that is closest to the new register.
      This will ensure that nodes will not overlap. The tree traversal is still
      done as a binary search, we just don't stop at the first node found. So the
      complexity of the algorithm stays within the same order.
      
      Ideally if a new register is in the range of two adjacent blocks those
      blocks should be merged, but that is a much more invasive change and left
      for later.
      
      The issue was initially introduced in commit 472fdec7 ("regmap: rbtree:
      Reduce number of nodes, take 2"), but became much more exposed by commit
      6399aea6 ("regmap: rbtree: When adding a reg do a bsearch for target
      node") which changed the order in which nodes are looked-up.
      
      Fixes: 6399aea6 ("regmap: rbtree: When adding a reg do a bsearch for target node")
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1ee64247
    • Erez Shitrit's avatar
      IB/core: Fix use after free in send_leave function · fe459deb
      Erez Shitrit authored
      commit 68c6bcdd upstream.
      
      The function send_leave sets the member: group->query_id
      (group->query_id = ret) after calling the sa_query, but leave_handler
      can be executed before the setting and it might delete the group object,
      and will get a memory corruption.
      
      Additionally, this patch gets rid of group->query_id variable which is
      not used.
      
      Fixes: faec2f7b ('IB/sa: Track multicast join/leave requests')
      Signed-off-by: default avatarErez Shitrit <erezsh@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fe459deb
    • Ashok Raj Nagarajan's avatar
      ath10k: fix get rx_status from htt context · a734679b
      Ashok Raj Nagarajan authored
      commit 237e15df upstream.
      
      On handling amsdu on rx path, get the rx_status from htt context. Without this
      fix, we are seeing warnings when running DBDC traffic like this.
      
      WARNING: CPU: 0 PID: 0 at net/mac80211/rx.c:4105 ieee80211_rx_napi+0x88/0x7d8 [mac80211]()
      
      [ 1715.878248] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W 3.18.21 #1
      [ 1715.878273] [<c001d3f4>] (unwind_backtrace) from [<c001a4b0>] (show_stack+0x10/0x14)
      [ 1715.878293] [<c001a4b0>] (show_stack) from [<c01bee64>] (dump_stack+0x70/0xbc)
      [ 1715.878315] [<c01bee64>] (dump_stack) from [<c002a61c>] (warn_slowpath_common+0x64/0x88)
      [ 1715.878339] [<c002a61c>] (warn_slowpath_common) from [<c002a6d0>] (warn_slowpath_null+0x18/0x20)
      [ 1715.878395] [<c002a6d0>] (warn_slowpath_null) from [<bf4caa98>] (ieee80211_rx_napi+0x88/0x7d8 [mac80211])
      [ 1715.878474] [<bf4caa98>] (ieee80211_rx_napi [mac80211]) from [<bf568658>] (ath10k_htt_t2h_msg_handler+0xb48/0xbfc [ath10k_core])
      [ 1715.878535] [<bf568658>] (ath10k_htt_t2h_msg_handler [ath10k_core]) from [<bf568708>] (ath10k_htt_t2h_msg_handler+0xbf8/0xbfc [ath10k_core])
      [ 1715.878597] [<bf568708>] (ath10k_htt_t2h_msg_handler [ath10k_core]) from [<bf569160>] (ath10k_htt_txrx_compl_task+0xa54/0x1170 [ath10k_core])
      [ 1715.878639] [<bf569160>] (ath10k_htt_txrx_compl_task [ath10k_core]) from [<c002db14>] (tasklet_action+0xb4/0x130)
      [ 1715.878659] [<c002db14>] (tasklet_action) from [<c002d110>] (__do_softirq+0xe0/0x210)
      [ 1715.878678] [<c002d110>] (__do_softirq) from [<c002d4b4>] (irq_exit+0x84/0xe0)
      [ 1715.878700] [<c002d4b4>] (irq_exit) from [<c005a544>] (__handle_domain_irq+0x98/0xd0)
      [ 1715.878722] [<c005a544>] (__handle_domain_irq) from [<c00085f4>] (gic_handle_irq+0x38/0x5c)
      [ 1715.878741] [<c00085f4>] (gic_handle_irq) from [<c0009680>] (__irq_svc+0x40/0x74)
      [ 1715.878753] Exception stack(0xc05f9f50 to 0xc05f9f98)
      [ 1715.878767] 9f40: ffffffed 00000000 00399e1e c000a220
      [ 1715.878786] 9f60: 00000000 c05f6780 c05f8000 00000000 c05f5db8 ffffffed c05f8000 c04d1980
      [ 1715.878802] 9f80: 00000000 c05f9f98 c0018110 c0018114 60000013 ffffffff
      [ 1715.878822] [<c0009680>] (__irq_svc) from [<c0018114>] (arch_cpu_idle+0x2c/0x50)
      [ 1715.878844] [<c0018114>] (arch_cpu_idle) from [<c00530d4>] (cpu_startup_entry+0x108/0x234)
      [ 1715.878866] [<c00530d4>] (cpu_startup_entry) from [<c05c7be0>] (start_kernel+0x33c/0x3b8)
      [ 1715.878879] ---[ end trace 6d5e1cc0fef8ed6a ]---
      [ 1715.878899] ------------[ cut here ]------------
      
      Fixes: 18235664 ("ath10k: cleanup amsdu processing for rx indication")
      Signed-off-by: default avatarAshok Raj Nagarajan <arnagara@qti.qualcomm.com>
      Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a734679b
    • Erez Shitrit's avatar
      IB/ipoib: Fix memory corruption in ipoib cm mode connect flow · 40d5ac1c
      Erez Shitrit authored
      commit 546481c2 upstream.
      
      When a new CM connection is being requested, ipoib driver copies data
      from the path pointer in the CM/tx object, the path object might be
      invalid at the point and memory corruption will happened later when now
      the CM driver will try using that data.
      
      The next scenario demonstrates it:
      	neigh_add_path --> ipoib_cm_create_tx -->
      	queue_work (pointer to path is in the cm/tx struct)
      	#while the work is still in the queue,
      	#the port goes down and causes the ipoib_flush_paths:
      	ipoib_flush_paths --> path_free --> kfree(path)
      	#at this point the work scheduled starts.
      	ipoib_cm_tx_start --> copy from the (invalid)path pointer:
      	(memcpy(&pathrec, &p->path->pathrec, sizeof pathrec);)
      	 -> memory corruption.
      
      To fix that the driver now starts the CM/tx connection only if that
      specific path exists in the general paths database.
      This check is protected with the relevant locks, and uses the gid from
      the neigh member in the CM/tx object which is valid according to the ref
      count that was taken by the CM/tx.
      
      Fixes: 839fcaba ('IPoIB: Connected mode experimental support')
      Signed-off-by: default avatarErez Shitrit <erezsh@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      40d5ac1c
    • Nicolas Iooss's avatar
      ceph: do not modify fi->frag in need_reset_readdir() · 44bd8641
      Nicolas Iooss authored
      commit 0f5aa88a upstream.
      
      Commit f3c4ebe6 ("ceph: using hash value to compose dentry offset")
      modified "if (fpos_frag(new_pos) != fi->frag)" to "if (fi->frag |=
      fpos_frag(new_pos))" in need_reset_readdir(), thus replacing a
      comparison operator with an assignment one.
      
      This looks like a typo which is reported by clang when building the
      kernel with some warning flags:
      
          fs/ceph/dir.c:600:22: error: using the result of an assignment as a
          condition without parentheses [-Werror,-Wparentheses]
                  } else if (fi->frag |= fpos_frag(new_pos)) {
                             ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
          fs/ceph/dir.c:600:22: note: place parentheses around the assignment
          to silence this warning
                  } else if (fi->frag |= fpos_frag(new_pos)) {
                                      ^
                             (                             )
          fs/ceph/dir.c:600:22: note: use '!=' to turn this compound
          assignment into an inequality comparison
                  } else if (fi->frag |= fpos_frag(new_pos)) {
                                      ^~
                                      !=
      
      Fixes: f3c4ebe6 ("ceph: using hash value to compose dentry offset")
      Signed-off-by: default avatarNicolas Iooss <nicolas.iooss_linux@m4x.org>
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      44bd8641
    • Radim Krčmář's avatar
      KVM: nVMX: postpone VMCS changes on MSR_IA32_APICBASE write · 11669327
      Radim Krčmář authored
      commit dccbfcf5 upstream.
      
      If vmcs12 does not intercept APIC_BASE writes, then KVM will handle the
      write with vmcs02 as the current VMCS.
      This will incorrectly apply modifications intended for vmcs01 to vmcs02
      and L2 can use it to gain access to L0's x2APIC registers by disabling
      virtualized x2APIC while using msr bitmap that assumes enabled.
      
      Postpone execution of vmx_set_virtual_x2apic_mode until vmcs01 is the
      current VMCS.  An alternative solution would temporarily make vmcs01 the
      current VMCS, but it requires more care.
      
      Fixes: 8d14695f ("x86, apicv: add virtual x2apic support")
      Reported-by: default avatarJim Mattson <jmattson@google.com>
      Reviewed-by: default avatarWanpeng Li <wanpeng.li@hotmail.com>
      Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      11669327