Skip to contentSkip to conversation

4.7.3-stable review

PATCH In review Greg Kroah-Hartman 8 participants 137 messages Sep 5, 2016 – Oct 10, 2016

Subsystems (10)
lore
Share & tools
lore

Greg Kroah-Hartman

author maintainer
#0 lore raw

cover 4.7.3-stable review

This is the start of the stable review cycle for the 4.7.3 release. There are 143 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Wed Sep 7 16:44:10 UTC 2016. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

	kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.7.3-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.7.y
and the diffstat can be found below.

thanks,

greg k-h

-------------
Pseudo-Shortlog of commits:

Greg Kroah-Hartman <[email protected]>

    Linux 4.7.3-rc1

Trond Myklebust <[email protected]>
SUNRPC: Fix infinite looping in rpc_clnt_iterate_for_each_xprt

Konstantin Khlebnikov <[email protected]>
sysfs: correctly handle read offset on PREALLOC attrs

Quentin Schulz <[email protected]>
hwmon: (iio_hwmon) fix memory leak in name attribute

Jean Delvare <[email protected]>
hwmon: (it87) Add missing sysfs attribute group terminator

Andrej Krutak <[email protected]>
ALSA: line6: Fix POD sysfs attributes segfault

Andrej Krutak <[email protected]>
ALSA: line6: Give up on the lock while URBs are released.

Andrej Krutak <[email protected]>
ALSA: line6: Remove double line6_pcm_release() after failed acquire.

Lorenzo Pieralisi <[email protected]>
ACPI / drivers: replace acpi_probe_lock spinlock with mutex

Lorenzo Pieralisi <[email protected]>
ACPI / drivers: fix typo in ACPI_DECLARE_PROBE_ENTRY macro

Ian Abbott <[email protected]>
staging: comedi: ni_mio_common: fix wrong insn_write handler

Ian Abbott <[email protected]>
staging: comedi: ni_mio_common: fix AO inttrig backwards compatibility

Ian Abbott <[email protected]>
staging: comedi: comedi_test: fix timer race conditions

Ian Abbott <[email protected]>
staging: comedi: daqboard2000: bug fix board type matching code

Oleg Drokin <[email protected]>
staging/lustre/llite: Close atomic_open race with several openers

Aleksandr Makarov <[email protected]>

    USB: serial: option: add WeTelecom 0x6802 and 0x6803 products

Aleksandr Makarov <[email protected]>
USB: serial: option: add WeTelecom WM-D200

Alexey Khoroshilov <[email protected]>
USB: serial: mos7840: fix non-atomic allocation in write path

Alexey Khoroshilov <[email protected]>
USB: serial: mos7720: fix non-atomic allocation in write path

Felipe Balbi <[email protected]>
usb: gadget: udc: core: don't starve DMA resources

Alan Stern <[email protected]>
USB: fix typo in wMaxPacketSize validation

Li Jun <[email protected]>
usb: chipidea: udc: don't touch DP when controller is in host mode

Alan Stern <[email protected]>
USB: avoid left shift by -1

Yoshihiro Shimoda <[email protected]>
dmaengine: usb-dmac: check CHCR.DE bit in usb_dmac_isr_channel()

Giovanni Cabiddu <[email protected]>
crypto: qat - fix aes-xts key sizes

Dan Carpenter <[email protected]>
crypto: nx - off by one bug in nx_of_update_msc()

Dmitry Torokhov <[email protected]>
Input: i8042 - set up shared ps2_cmd_mutex for AUX ports

Dmitry Torokhov <[email protected]>
Input: i8042 - break load dependency between atkbd/psmouse and i8042

Andrew Duggan <[email protected]>
Input: synaptics-rmi4 - fix register descriptor subpacket map construction

Masahiro Yamada <[email protected]>
Input: tegra-kbc - fix inverted reset logic

Jens Axboe <[email protected]>
Revert "floppy: fix open(O_ACCMODE) for ioctl-only open"

Jeff Mahoney <[email protected]>
btrfs: don't create or leak aliased root while cleaning up orphans

Jeff Mahoney <[email protected]>
btrfs: properly track when rescan worker is running

Jeff Mahoney <[email protected]>
btrfs: waiting on qgroup rescan should not always be interruptible

Ross Zwisler <[email protected]>
mm: silently skip readahead for DAX inodes

Dan Williams <[email protected]>
dax: fix device-dax region base

Andrea Arcangeli <[email protected]>
soft_dirty: fix soft_dirty during THP split

Vegard Nossum <[email protected]>
fs/seq_file: fix out-of-bounds read

Christophe Leroy <[email protected]>

    gpio: max730x: set gpiochip data pointer before using it

Linus Walleij <[email protected]>
gpio: Fix OF build problem on UM

Mike Snitzer <[email protected]>
dm round robin: do not use this_cpu_ptr() without having preemption disabled

Wei Yongjun <[email protected]>
usb: renesas_usbhs: gadget: fix return value check in usbhs_mod_gadget_probe()

Yinghai Lu <[email protected]>
megaraid_sas: Fix probing cards without io port

Greg Edwards <[email protected]>
mpt3sas: Fix resume on WarpDrive flash cards

Gavin Li <[email protected]>
cdc-acm: fix wrong pipe type on rx interrupt xfers

Brian Norris <[email protected]>
i2c: cros-ec-tunnel: Fix usage of cros_ec_cmd_xfer()

Tomeu Vizoso <[email protected]>
mfd: cros_ec: Add cros_ec_cmd_xfer_status() helper

Dave Carroll <[email protected]>
aacraid: Check size values after double-fetch from user

Vineet Gupta <[email protected]>
ARC: Elide redundant setup of DMA callbacks

Daniel Mentz <[email protected]>
ARC: Call trace_hardirqs_on() before enabling irqs

Vineet Gupta <[email protected]>
ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS

Liav Rehana <[email protected]>
ARC: use correct offset in pt_regs for saving/restoring user mode r25

Lyude <[email protected]>
drm/i915: Enable polling when we don't have hpd

Lyude <[email protected]>
drm/i915/vlv: Disable HPD in valleyview_crt_detect_hotplug()

Lyude <[email protected]>
drm/i915/vlv: Reset the ADPA in vlv_display_power_well_init()

Lyude <[email protected]>
drm/i915/vlv: Make intel_crt_reset() per-encoder

Matthew Auld <[email protected]>
drm/i915: fix aliasing_ppgtt leak

Chris Wilson <[email protected]>
drm/i915: Acquire audio powerwell for HD-Audio registers

Ville Syrjälä <[email protected]>
drm/i915: Fix iboost setting for SKL Y/U DP DDI buffer translation entry 2

Ville Syrjälä <[email protected]>
drm/i915: Program iboost settings for HDMI/DVI on SKL

Ville Syrjälä <[email protected]>
drm/i915: Fix iboost setting for DDI with 4 lanes on SKL

Chunming Zhou <[email protected]>
drm/amdgpu: record error code when ring test failed

jimqu <[email protected]>
drm/amd/amdgpu: compute ring test fail during S4 on CI

jimqu <[email protected]>
drm/amd/amdgpu: sdma resume fail during S4 on CI

Alex Deucher <[email protected]>
drm/amdgpu: skip TV/CV in display parsing

Alex Deucher <[email protected]>
drm/amdgpu: avoid a possible array overflow

Christian König <[email protected]>
drm/amdgpu: fix lru size grouping v2

Christian König <[email protected]>
drm/amdgpu: fix amdgpu_move_blit on 32bit systems

Felix Kuehling <[email protected]>
drm/amdgpu: Change GART offset to 64-bit

Brian Norris <[email protected]>
iio: fix sched WARNING "do not call blocking ops when !TASK_RUNNING"

Peter Zijlstra <[email protected]>
sched/cputime: Fix NO_HZ_FULL getrusage() monotonicity regression

Lucas Stach <[email protected]>
of: fix reference counting in of_graph_get_endpoint_by_regs

James Morse <[email protected]>
arm64: kernel: Fix unmasked debug exceptions when restoring mdscr_el1

Caesar Wang <[email protected]>
arm64: dts: rockchip: add reset saradc node for rk3368 SoCs

Mark Rutland <[email protected]>
arm64: avoid TLB conflict with CONFIG_RANDOMIZE_BASE

Ard Biesheuvel <[email protected]>
arm64: kernel: avoid literal load of virtual address with MMU off

Felix Fietkau <[email protected]>
mac80211: fix purging multicast PS buffer queue

Stefan Haberland <[email protected]>
s390/dasd: fix hanging device after clear subchannel

Lukasz Odzioba <[email protected]>
EDAC, sb_edac: Fix channel reporting on Knights Landing

Wolfram Sang <[email protected]>
i2c: mux: demux-pinctrl: properly roll back when adding adapter fails

Agrawal, Nitesh-kumar <[email protected]>
pinctrl/amd: Remove the default de-bounce time

Wei Yongjun <[email protected]>
pinctrl: meson: Drop pinctrl_unregister for devm_ registered device

Will Deacon <[email protected]>
iommu/arm-smmu: Don't BUG() if we find aborting STEs with disable_bypass

Will Deacon <[email protected]>
iommu/arm-smmu: Disable stalling faults for all endpoints

Will Deacon <[email protected]>
iommu/arm-smmu: Fix CMDQ error handling

Robin Murphy <[email protected]>
iommu/io-pgtable-arm-v7s: Fix attributes when splitting blocks

Robin Murphy <[email protected]>
iommu/dma: Don't put uninitialised IOVA domains

Jiri Olsa <[email protected]>
perf tools mem: Fix -t store option for record command

Peter Zijlstra <[email protected]>
perf/core: Fix event_function_local()

Anton Blanchard <[email protected]>
perf symbols: Fix annotation of objects with debuginfo files

Oleg Nesterov <[email protected]>
uprobes: Fix the memcg accounting

Robert Deliën <[email protected]>
USB: serial: ftdi_sio: add PIDs for Ivium Technologies devices

Sheng-Hui J. Chu <[email protected]>
USB: serial: ftdi_sio: add device ID for WICED USB UART dev board

Daniele Palmas <[email protected]>
USB: serial: option: add support for Telit LE920A4

Lubomir Rintel <[email protected]>
USB: serial: option: add D-Link DWM-156/A3

Alexey Klimov <[email protected]>
USB: serial: fix memleak in driver-registration error path

Mathias Nyman <[email protected]>
xhci: don't dereference a xhci member after removing xhci

Jim Lin <[email protected]>
usb: xhci: Fix panic if disconnect

Mathias Nyman <[email protected]>
xhci: always handle "Command Ring Stopped" events

Mathieu Laurendeau <[email protected]>
usb/gadget: fix gadgetfs aio support.

Dan Carpenter <[email protected]>
usb: gadget: fsl_qe_udc: off by one in setup_received_handle()

Alan Stern <[email protected]>
USB: validate wMaxPacketValue entries in endpoint descriptors

Yoshihiro Shimoda <[email protected]>
clk: renesas: r8a7795: Fix SD clocks

Yoshihiro Shimoda <[email protected]>
usb: renesas_usbhs: Use dmac only if the pipe type is bulk

Yoshihiro Shimoda <[email protected]>
usb: renesas_usbhs: clear the BRDYSTS in usbhsg_ep_enable()

Yoshihiro Shimoda <[email protected]>
usb: renesas_usbhs: Fix receiving data corrupt on R-Car Gen3 with dmac

Alan Stern <[email protected]>
USB: hub: change the locking in hub_activate

Alan Stern <[email protected]>
USB: hub: fix up early-exit pathway in hub_activate

Viresh Kumar <[email protected]>
usb: hub: Fix unbalanced reference count/memory leak/deadlocks

Felipe Balbi <[email protected]>
usb: dwc3: gadget: always cleanup all TRBs

Felipe Balbi <[email protected]>
usb: dwc3: gadget: fix for short pkts during chained xfers

Felipe Balbi <[email protected]>

    usb: dwc3: gadget: increment request->actual once

Heikki Krogerus <[email protected]>
usb: dwc3: pci: add Intel Kabylake PCI ID

Peter Chen <[email protected]>
usb: misc: usbtest: usbtest_do_ioctl may return positive integer

Lu Baolu <[email protected]>
usb: misc: usbtest: add fix for driver hang

Jiri Slaby <[email protected]>
usb: devio, do not warn when allocation fails

Marc Ohlf <[email protected]>
usb: ehci: change order of register cleanup during shutdown

Helge Deller <[email protected]>
parisc: Fix automatic selection of cr16 clocksource

Horia Geantă <[email protected]>
crypto: caam - defer aead_set_sh_desc in case of zero authsize

Horia Geantă <[email protected]>
crypto: caam - fix echainiv(authenc) encrypt shared descriptor

Russell King <[email protected]>
crypto: caam - fix non-hmac hashes

Marc Zyngier <[email protected]>
genirq/msi: Make sure PCI MSIs are activated early

Thomas Gleixner <[email protected]>
genirq/msi: Remove unused MSI_FLAG_IDENTITY_MAP

Andrey Ryabinin <[email protected]>
um: Don't discard .text.exit section

Hoan Tran <[email protected]>
ACPI / CPPC: Prevent cpc_desc_ptr points to the invalid data

Hoan Tran <[email protected]>
ACPI: CPPC: Return error if _CPC is invalid on a CPU

Ross Zwisler <[email protected]>
libnvdimm, nd_blk: mask off reserved status bits

Adrian Hunter <[email protected]>
perf intel-pt: Fix occasional decoding errors when tracing system-wide

Steven Rostedt (Red Hat) <[email protected]>
tracing: Fix tick_stop tracepoint symbols for user export

Alex Williamson <[email protected]>
vfio/pci: Fix NULL pointer oops in error interrupt setup handling

Chris Wilson <[email protected]>

    mm/slub.c: run free_partial() outside of the kmem_cache_node->list_lock

Wei Yongjun <[email protected]>
virtio: fix memory leak in virtqueue_add()

Helge Deller <[email protected]>
parisc: Fix order of EREFUSED define in errno.h

Austin Christ <[email protected]>
efi/capsule: Allocate whole capsule into virtual memory

James Hogan <[email protected]>
arm64: Define AT_VECTOR_SIZE_ARCH for ARCH_DLINFO

Takashi Iwai <[email protected]>
ALSA: hda - Manage power well properly for resume

Vittorio Gambaletta (VittGam) <[email protected]>
ALSA: usb-audio: Add quirk for ELP HD USB Camera

Piotr Karasinski <[email protected]>
ALSA: usb-audio: Add a sample rate quirk for Creative Live! Cam Socialize HD (VF0610)

Olga Kornievskaia <[email protected]>
SUNRPC: allow for upcalls for same uid but different gss service

Trond Myklebust <[email protected]>
SUNRPC: Handle EADDRNOTAVAIL on connection failures

Dan Williams <[email protected]>
tools/testing/nvdimm: fix SIGTERM vs hotplug crash

Alex Thorlton <[email protected]>
x86/platform/uv: Skip UV runtime services mapping in the efi_runtime_disabled case

Denys Vlasenko <[email protected]>
uprobes/x86: Fix RIP-relative handling of EVEX-encoded instructions

Sebastian Andrzej Siewior <[email protected]>
x86/mm: Disable preemption during CR3 read+write

-------------

Diffstat:

 Makefile                                       |   4 +-
 arch/arc/include/asm/entry.h                   |   4 +-
 arch/arc/include/asm/irqflags-compact.h        |   2 +-
 arch/arc/include/asm/pgtable.h                 |   2 +-
 arch/arc/mm/cache.c                            |   9 ++
 arch/arm64/boot/dts/rockchip/rk3368.dtsi       |   2 +
 arch/arm64/include/asm/elf.h                   |   1 +
 arch/arm64/include/uapi/asm/auxvec.h           |   2 +
 arch/arm64/kernel/head.S                       |   3 +
 arch/arm64/kernel/sleep.S                      |  10 ++-
 arch/arm64/mm/proc.S                           |   9 ++
 arch/parisc/include/uapi/asm/errno.h           |   4 +-
 arch/parisc/kernel/processor.c                 |   8 --
 arch/parisc/kernel/time.c                      |  12 ---
 arch/um/include/asm/common.lds.S               |   2 +-
 arch/x86/include/asm/tlbflush.h                |   7 ++
 arch/x86/kernel/uprobes.c                      |  22 ++---
 arch/x86/platform/uv/bios_uv.c                 |   3 +-
 drivers/acpi/cppc_acpi.c                       |  24 +++--
 drivers/acpi/nfit.c                            |   3 +-
 drivers/acpi/scan.c                            |   6 +-
 drivers/block/floppy.c                         |  21 +++--
 drivers/clk/renesas/r8a7795-cpg-mssr.c         |   9 +-
 drivers/crypto/caam/caamalg.c                  |  13 +--
 drivers/crypto/caam/caamhash.c                 |   1 +
 drivers/crypto/nx/nx.c                         |   2 +-
 drivers/crypto/qat/qat_common/qat_algs.c       |   4 +-
 drivers/dax/pmem.c                             |   3 +
 drivers/dma/sh/usb-dmac.c                      |  19 ++--
 drivers/edac/sb_edac.c                         |  15 +++-
 drivers/firmware/efi/capsule-loader.c          |   8 +-
 drivers/firmware/efi/capsule.c                 |   6 +-
 drivers/gpio/Kconfig                           |   1 +
 drivers/gpio/gpio-max730x.c                    |   8 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu.h            |   6 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c   |  13 +++
 drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c       |   4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c         |   5 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c        |  12 ++-
 drivers/gpu/drm/amd/amdgpu/cik_sdma.c          |   3 +
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c          |  12 ++-
 drivers/gpu/drm/i915/i915_drv.c                |   3 +
 drivers/gpu/drm/i915/i915_drv.h                |   5 ++
 drivers/gpu/drm/i915/i915_gem_gtt.c            |   1 +
 drivers/gpu/drm/i915/i915_reg.h                |   1 +
 drivers/gpu/drm/i915/intel_audio.c             |   6 ++
 drivers/gpu/drm/i915/intel_crt.c               |  28 ++++--
 drivers/gpu/drm/i915/intel_ddi.c               |  91 +++++++++++++------
 drivers/gpu/drm/i915/intel_drv.h               |   4 +-
 drivers/gpu/drm/i915/intel_hotplug.c           | 117 ++++++++++++++++++++++---
 drivers/gpu/drm/i915/intel_runtime_pm.c        |   9 ++
 drivers/hwmon/iio_hwmon.c                      |  24 ++---
 drivers/hwmon/it87.c                           |   1 +
 drivers/i2c/busses/i2c-cros-ec-tunnel.c        |   2 +-
 drivers/i2c/muxes/i2c-demux-pinctrl.c          |   4 +-
 drivers/iio/industrialio-buffer.c              |  23 +++--
 drivers/input/keyboard/tegra-kbc.c             |   2 +-
 drivers/input/rmi4/rmi_driver.c                |   3 +-
 drivers/input/serio/i8042.c                    |  17 +---
 drivers/input/serio/libps2.c                   |  10 +--
 drivers/iommu/arm-smmu-v3.c                    |   7 +-
 drivers/iommu/arm-smmu.c                       |  34 ++-----
 drivers/iommu/dma-iommu.c                      |   3 +-
 drivers/iommu/io-pgtable-arm-v7s.c             |   4 +-
 drivers/md/dm-round-robin.c                    |   7 +-
 drivers/of/base.c                              |  11 +--
 drivers/pci/msi.c                              |   2 +
 drivers/pinctrl/meson/pinctrl-meson.c          |   8 +-
 drivers/pinctrl/pinctrl-amd.c                  |  20 -----
 drivers/platform/chrome/cros_ec_proto.c        |  17 ++++
 drivers/s390/block/dasd.c                      |  10 ++-
 drivers/scsi/aacraid/commctrl.c                |  13 ++-
 drivers/scsi/megaraid/megaraid_sas_base.c      |   6 +-
 drivers/scsi/megaraid/megaraid_sas_fusion.c    |   2 +-
 drivers/scsi/mpt3sas/mpt3sas_base.c            |  22 ++---
 drivers/staging/comedi/drivers/comedi_test.c   |  46 +++-------
 drivers/staging/comedi/drivers/daqboard2000.c  |   2 +-
 drivers/staging/comedi/drivers/ni_mio_common.c |  12 ++-
 drivers/staging/lustre/lustre/llite/namei.c    |  43 +++++----
 drivers/usb/chipidea/udc.c                     |   7 +-
 drivers/usb/class/cdc-acm.c                    |   5 +-
 drivers/usb/class/cdc-acm.h                    |   1 -
 drivers/usb/core/config.c                      |  66 +++++++++++++-
 drivers/usb/core/devio.c                       |  19 ++--
 drivers/usb/core/hub.c                         |  23 ++---
 drivers/usb/dwc3/dwc3-pci.c                    |   2 +
 drivers/usb/dwc3/gadget.c                      |  42 ++++++---
 drivers/usb/gadget/legacy/inode.c              |   2 +-
 drivers/usb/gadget/udc/fsl_qe_udc.c            |   2 +-
 drivers/usb/gadget/udc/udc-core.c              |   2 +-
 drivers/usb/host/ehci-hcd.c                    |   4 +-
 drivers/usb/host/xhci-hub.c                    |   3 +
 drivers/usb/host/xhci-pci.c                    |   3 +-
 drivers/usb/host/xhci-ring.c                   |  13 +--
 drivers/usb/misc/usbtest.c                     |   9 +-
 drivers/usb/renesas_usbhs/common.c             |   3 +-
 drivers/usb/renesas_usbhs/fifo.c               |   4 +-
 drivers/usb/renesas_usbhs/mod_gadget.c         |   9 +-
 drivers/usb/serial/ftdi_sio.c                  |   3 +
 drivers/usb/serial/ftdi_sio_ids.h              |  12 +++
 drivers/usb/serial/mos7720.c                   |   2 +-
 drivers/usb/serial/mos7840.c                   |   4 +-
 drivers/usb/serial/option.c                    |  31 +++++++
 drivers/usb/serial/usb-serial.c                |   4 +-
 drivers/vfio/pci/vfio_pci_intrs.c              |  85 ++++++++++--------
 drivers/virtio/virtio_ring.c                   |   2 +
 fs/btrfs/ctree.h                               |   1 +
 fs/btrfs/disk-io.c                             |   7 +-
 fs/btrfs/disk-io.h                             |   2 +
 fs/btrfs/ioctl.c                               |   2 +-
 fs/btrfs/qgroup.c                              |  21 ++++-
 fs/btrfs/qgroup.h                              |   3 +-
 fs/btrfs/root-tree.c                           |  27 ++++--
 fs/seq_file.c                                  |   4 +-
 fs/sysfs/file.c                                |   8 +-
 include/linux/acpi.h                           |   2 +-
 include/linux/i8042.h                          |   6 --
 include/linux/mfd/cros_ec.h                    |  15 ++++
 include/linux/msi.h                            |   8 +-
 include/linux/serio.h                          |  24 +++--
 include/trace/events/timer.h                   |  14 ++-
 kernel/events/core.c                           |  60 ++++++++++---
 kernel/events/uprobes.c                        |   5 +-
 kernel/irq/msi.c                               |  19 ++--
 kernel/sched/cputime.c                         |  15 ++--
 mm/huge_memory.c                               |   7 +-
 mm/readahead.c                                 |   9 ++
 mm/slub.c                                      |   6 +-
 net/mac80211/cfg.c                             |   2 +-
 net/mac80211/tx.c                              |   6 +-
 net/sunrpc/auth_gss/auth_gss.c                 |   8 +-
 net/sunrpc/xprtmultipath.c                     |   8 +-
 net/sunrpc/xprtsock.c                          |   4 +
 sound/pci/hda/hda_intel.c                      |  32 ++++---
 sound/usb/line6/pcm.c                          |   3 +-
 sound/usb/line6/pod.c                          |  12 +--
 sound/usb/quirks.c                             |   2 +
 tools/perf/arch/x86/util/intel-pt.c            |   6 +-
 tools/perf/builtin-mem.c                       |   3 +
 tools/perf/util/symbol-elf.c                   |   3 +-
 tools/testing/nvdimm/test/nfit.c               |   2 +
 141 files changed, 1102 insertions(+), 540 deletions(-)
author maintainer
#1 lore raw

PATCH 1/143 x86/mm: Disable preemption during CR3 read+write

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Sebastian Andrzej Siewior <[email protected]>

commit 5cf0791da5c162ebc14b01eb01631cfa7ed4fa6e upstream.

There's a subtle preemption race on UP kernels:

Usually current->mm (and therefore mm->pgd) stays the same during the lifetime of a task so it does not matter if a task gets preempted during the read and write of the CR3.

But then, there is this scenario on x86-UP:

TaskA is in do_exit() and exit_mm() sets current->mm = NULL followed by:

-> mmput()
-> exit_mmap()
-> tlb_finish_mmu()
-> tlb_flush_mmu()
-> tlb_flush_mmu_tlbonly()
-> tlb_flush()
-> flush_tlb_mm_range()
-> __flush_tlb_up()
-> __flush_tlb()
-> __native_flush_tlb()

At this point current->mm is NULL but current->active_mm still points to the "old" mm.

Let's preempt taskA _after_ native_read_cr3() by taskB. TaskB has its own mm so CR3 has changed.

Now preempt back to taskA. TaskA has no ->mm set so it borrows taskB's mm and so CR3 remains unchanged. Once taskA gets active it continues where it was interrupted and that means it writes its old CR3 value back. Everything is fine because userland won't need its memory anymore.

Now the fun part:

Let's preempt taskA one more time and get back to taskB. This time switch_mm() won't do a thing because oldmm (->active_mm) is the same as mm (as per context_switch()). So we remain with a bad CR3 / PGD and return to userland.

The next thing that happens is handle_mm_fault() with an address for the execution of its code in userland. handle_mm_fault() realizes that it has a PTE with proper rights so it returns doing nothing. But the CPU looks at the wrong PGD and insists that something is wrong and faults again. And again. And one more time…

This pagefault circle continues until the scheduler gets tired of it and puts another task on the CPU. It gets little difficult if the task is a RT task with a high priority. The system will either freeze or it gets fixed by the software watchdog thread which usually runs at RT-max prio. But waiting for the watchdog will increase the latency of the RT task which is no good.

Fix this by disabling preemption across the critical code section.

---
 arch/x86/include/asm/tlbflush.h |    7 +++++++
 1 file changed, 7 insertions(+)
arch/x86/include/asm/tlbflush.h +7 -0
@@ -135,7 +135,14 @@ static inline void cr4_set_bits_and_upda
 
 static inline void __native_flush_tlb(void)
 {
+	/*
+	 * If current->mm == NULL then we borrow a mm which may change during a
+	 * task switch and therefore we must not be preempted while we write CR3
+	 * back:
+	 */
+	preempt_disable();
 	native_write_cr3(native_read_cr3());
+	preempt_enable();
 }
 
 static inline void __native_flush_tlb_global_irq_disabled(void)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author maintainer
#2 lore raw

PATCH 2/143 uprobes/x86: Fix RIP-relative handling of EVEX-encoded instructions

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Denys Vlasenko <[email protected]>

commit 68187872c76a96ed4db7bfb064272591f02e208b upstream.

Since instruction decoder now supports EVEX-encoded instructions, two fixes are needed to correctly handle them in uprobes.

Extended bits for MODRM.rm field need to be sanitized just like we do it for VEX3, to avoid encoding wrong register for register-relative access.

EVEX has _two_ extended bits: b and x. Theoretically, EVEX.x should be ignored by the CPU (since GPRs go only up to 15, not 31), but let's be paranoid here: proper encoding for register-relative access should have EVEX.x = 1.

Secondly, we should fetch vex.vvvv for EVEX too.
This is now super easy because instruction decoder populates vex_prefix.bytes[2] for all flavors of (e)vex encodings, even for VEX2.

Cc Alexander Shishkin <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Brian Gerst <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Jim Keniston <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Josh Poimboeuf <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Masami Hiramatsu <[email protected]>
Cc Oleg Nesterov <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Vince Weaver <[email protected]>
Fixes 8a764a875fe3 ("x86/asm/decoder: Create artificial 3rd byte for 2-byte VEX")
---
 arch/x86/kernel/uprobes.c |   22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
arch/x86/kernel/uprobes.c +11 -11
@@ -357,20 +357,22 @@ static void riprel_analyze(struct arch_u
 		*cursor &= 0xfe;
 	}
 	/*
-	 * Similar treatment for VEX3 prefix.
-	 * TODO: add XOP/EVEX treatment when insn decoder supports them
+	 * Similar treatment for VEX3/EVEX prefix.
+	 * TODO: add XOP treatment when insn decoder supports them
 	 */
-	if (insn->vex_prefix.nbytes == 3) {
+	if (insn->vex_prefix.nbytes >= 3) {
 		/*
 		 * vex2:     c5    rvvvvLpp   (has no b bit)
 		 * vex3/xop: c4/8f rxbmmmmm wvvvvLpp
 		 * evex:     62    rxbR00mm wvvvv1pp zllBVaaa
-		 *   (evex will need setting of both b and x since
-		 *   in non-sib encoding evex.x is 4th bit of MODRM.rm)
-		 * Setting VEX3.b (setting because it has inverted meaning):
+		 * Setting VEX3.b (setting because it has inverted meaning).
+		 * Setting EVEX.x since (in non-SIB encoding) EVEX.x
+		 * is the 4th bit of MODRM.rm, and needs the same treatment.
+		 * For VEX3-encoded insns, VEX3.x value has no effect in
+		 * non-SIB encoding, the change is superfluous but harmless.
 		 */
 		cursor = auprobe->insn + insn_offset_vex_prefix(insn) + 1;
-		*cursor |= 0x20;
+		*cursor |= 0x60;
 	}
 
 	/*
@@ -415,12 +417,10 @@ static void riprel_analyze(struct arch_u
 
 	reg = MODRM_REG(insn);	/* Fetch modrm.reg */
 	reg2 = 0xff;		/* Fetch vex.vvvv */
-	if (insn->vex_prefix.nbytes == 2)
-		reg2 = insn->vex_prefix.bytes[1];
-	else if (insn->vex_prefix.nbytes == 3)
+	if (insn->vex_prefix.nbytes)
 		reg2 = insn->vex_prefix.bytes[2];
 	/*
-	 * TODO: add XOP, EXEV vvvv reading.
+	 * TODO: add XOP vvvv reading.
 	 *
 	 * vex.vvvv field is in bits 6-3, bits are inverted.
 	 * But in 32-bit mode, high-order bit may be ignored.
author maintainer
#3 lore raw

PATCH 3/143 x86/platform/uv: Skip UV runtime services mapping in the efi_runtime_disabled case

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Alex Thorlton <[email protected]>

commit f72075c9eda8a43aeea2f9dbb8d187afd4a76f0b upstream.

This problem has actually been in the UV code for a while, but we didn't catch it until recently, because we had been relying on EFI_OLD_MEMMAP to allow our systems to boot for a period of time. We noticed the issue when trying to kexec a recent community kernel, where we hit this NULL pointer dereference in efi_sync_low_kernel_mappings():

 [    0.337515] BUG: unable to handle kernel NULL pointer dereference at 0000000000000880
 [    0.346276] IP: [<ffffffff8105df8d>] efi_sync_low_kernel_mappings+0x5d/0x1b0

The problem doesn't show up with EFI_OLD_MEMMAP because we skip the chunk of setup_efi_state() that sets the efi_loader_signature for the kexec'd kernel. When the kexec'd kernel boots, it won't set EFI_BOOT in setup_arch, so we completely avoid the bug.

We always kexec with noefi on the command line, so this shouldn't be an issue, but since we're not actually checking for efi_runtime_disabled in uv_bios_init(), we end up trying to do EFI runtime callbacks when we shouldn't be. This patch just adds a check for efi_runtime_disabled in uv_bios_init() so that we don't map in uv_systab when runtime_disabled == true.

Cc Andy Lutomirski <[email protected]>
Cc Ard Biesheuvel <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Brian Gerst <[email protected]>
Cc Denys Vlasenko <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Josh Poimboeuf <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Mike Travis <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Russ Anderson <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 arch/x86/platform/uv/bios_uv.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/platform/uv/bios_uv.c +2 -1
@@ -188,7 +188,8 @@ EXPORT_SYMBOL_GPL(uv_bios_set_legacy_vga
 void uv_bios_init(void)
 {
 	uv_systab = NULL;
-	if ((efi.uv_systab == EFI_INVALID_TABLE_ADDR) || !efi.uv_systab) {
+	if ((efi.uv_systab == EFI_INVALID_TABLE_ADDR) ||
+	    !efi.uv_systab || efi_runtime_disabled()) {
 		pr_crit("UV: UVsystab: missing\n");
 		return;
 	}
author maintainer
#4 lore raw

PATCH 4/143 tools/testing/nvdimm: fix SIGTERM vs hotplug crash

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Dan Williams <[email protected]>

commit d8d378fa1a0c98ecb50ca52c9bf3bc14e25aa2d2 upstream.

The unit tests crash when hotplug races the previous probe. This race requires that the loading of the nfit_test module be terminated with SIGTERM, and the module to be unloaded while the ars scan is still running.

In contrast to the normal nfit driver, the unit test calls acpi_nfit_init() twice to simulate hotplug, whereas the nominal case goes through the acpi_nfit_notify() event handler. The acpi_nfit_notify() path is careful to flush the previous region registration before servicing the hotplug event. The unit test was missing this guarantee.

 BUG: unable to handle kernel NULL pointer dereference at           (null)
 IP: [<ffffffff810cdce7>] pwq_activate_delayed_work+0x47/0x170
 [..]
 Call Trace:
  [<ffffffff810ce186>] pwq_dec_nr_in_flight+0x66/0xa0
  [<ffffffff810ce490>] process_one_work+0x2d0/0x680
  [<ffffffff810ce331>] ? process_one_work+0x171/0x680
  [<ffffffff810ce88e>] worker_thread+0x4e/0x480
  [<ffffffff810ce840>] ? process_one_work+0x680/0x680
  [<ffffffff810ce840>] ? process_one_work+0x680/0x680
  [<ffffffff810d5343>] kthread+0xf3/0x110
  [<ffffffff8199846f>] ret_from_fork+0x1f/0x40
  [<ffffffff810d5250>] ? kthread_create_on_node+0x230/0x230
---
 tools/testing/nvdimm/test/nfit.c |    2 ++
 1 file changed, 2 insertions(+)
tools/testing/nvdimm/test/nfit.c +2 -0
@@ -13,6 +13,7 @@
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
+#include <linux/workqueue.h>
 #include <linux/libnvdimm.h>
 #include <linux/vmalloc.h>
 #include <linux/device.h>
@@ -1480,6 +1481,7 @@ static int nfit_test_probe(struct platfo
 	if (nfit_test->setup != nfit_test0_setup)
 		return 0;
 
+	flush_work(&acpi_desc->work);
 	nfit_test->setup_hotplug = 1;
 	nfit_test->setup(nfit_test);
 
author maintainer
#5 lore raw

PATCH 5/143 SUNRPC: Handle EADDRNOTAVAIL on connection failures

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Trond Myklebust <[email protected]>

commit 1f4c17a03ba7f430d63dba8c8e08ff1e2712581d upstream.

If the connect attempt immediately fails with an EADDRNOTAVAIL error, then that means our choice of source port number was bad.
This error is expected when we set the SO_REUSEPORT socket option and we have 2 sockets sharing the same source and destination address and port combinations.

Fixes 402e23b4ed9ed ("SUNRPC: Fix stupid typo in xs_sock_set_reuseport")
---
 net/sunrpc/xprtsock.c |    4 ++++
 1 file changed, 4 insertions(+)
net/sunrpc/xprtsock.c +4 -0
@@ -2278,6 +2278,10 @@ static int xs_tcp_finish_connecting(stru
 		/* SYN_SENT! */
 		if (xprt->reestablish_timeout < XS_TCP_INIT_REEST_TO)
 			xprt->reestablish_timeout = XS_TCP_INIT_REEST_TO;
+		break;
+	case -EADDRNOTAVAIL:
+		/* Source port number is unavailable. Try a new one! */
+		transport->srcport = 0;
 	}
 out:
 	return ret;
author maintainer
#6 lore raw

PATCH 6/143 SUNRPC: allow for upcalls for same uid but different gss service

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Olga Kornievskaia <[email protected]>

commit 9130b8dbc6ac20f2dc5846e1647f5b60eafab6e3 upstream.

It's possible to have simultaneous upcalls for the same UIDs but different GSS service. In that case, we need to allow for the upcall to gssd to proceed so that not the same context is used by two different GSS services. Some servers lock the use of context to the GSS service.

---
 net/sunrpc/auth_gss/auth_gss.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
net/sunrpc/auth_gss/auth_gss.c +5 -3
@@ -340,12 +340,14 @@ gss_release_msg(struct gss_upcall_msg *g
 }
 
 static struct gss_upcall_msg *
-__gss_find_upcall(struct rpc_pipe *pipe, kuid_t uid)
+__gss_find_upcall(struct rpc_pipe *pipe, kuid_t uid, const struct gss_auth *auth)
 {
 	struct gss_upcall_msg *pos;
 	list_for_each_entry(pos, &pipe->in_downcall, list) {
 		if (!uid_eq(pos->uid, uid))
 			continue;
+		if (auth && pos->auth->service != auth->service)
+			continue;
 		atomic_inc(&pos->count);
 		dprintk("RPC:       %s found msg %p\n", __func__, pos);
 		return pos;
@@ -365,7 +367,7 @@ gss_add_msg(struct gss_upcall_msg *gss_m
 	struct gss_upcall_msg *old;
 
 	spin_lock(&pipe->lock);
-	old = __gss_find_upcall(pipe, gss_msg->uid);
+	old = __gss_find_upcall(pipe, gss_msg->uid, gss_msg->auth);
 	if (old == NULL) {
 		atomic_inc(&gss_msg->count);
 		list_add(&gss_msg->list, &pipe->in_downcall);
@@ -714,7 +716,7 @@ gss_pipe_downcall(struct file *filp, con
 	err = -ENOENT;
 	/* Find a matching upcall */
 	spin_lock(&pipe->lock);
-	gss_msg = __gss_find_upcall(pipe, uid);
+	gss_msg = __gss_find_upcall(pipe, uid, NULL);
 	if (gss_msg == NULL) {
 		spin_unlock(&pipe->lock);
 		goto err_put_ctx;
author maintainer
#7 lore raw

PATCH 7/143 ALSA: usb-audio: Add a sample rate quirk for Creative Live! Cam Socialize HD (VF0610)

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Piotr Karasinski <[email protected]>

commit 7627e40c66b5547e12b6c5673646ceea84797a74 upstream.

VF0610 does not support reading the sample rate which leads to many lines of "cannot get freq at ep 0x82". This patch adds the USB ID (0x041E:4080) to snd_usb_get_sample_rate_quirk() list.

---
 sound/usb/quirks.c |    1 +
 1 file changed, 1 insertion(+)
sound/usb/quirks.c +1 -0
@@ -1128,6 +1128,7 @@ bool snd_usb_get_sample_rate_quirk(struc
 {
 	/* devices which do not support reading the sample rate. */
 	switch (chip->usb_id) {
+	case USB_ID(0x041E, 0x4080): /* Creative Live Cam VF0610 */
 	case USB_ID(0x045E, 0x075D): /* MS Lifecam Cinema  */
 	case USB_ID(0x045E, 0x076D): /* MS Lifecam HD-5000 */
 	case USB_ID(0x045E, 0x076E): /* MS Lifecam HD-5001 */
author maintainer
#8 lore raw

PATCH 8/143 ALSA: usb-audio: Add quirk for ELP HD USB Camera

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Vittorio Gambaletta (VittGam) <[email protected]>

commit 41f5e3bdbf706a9e98194bf0c4b62a875c02f170 upstream.

The ELP HD USB Camera (05a3:9420) needs this quirk for suppressing the unsupported sample rate inquiry.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=98481

---
 sound/usb/quirks.c |    1 +
 1 file changed, 1 insertion(+)
sound/usb/quirks.c +1 -0
@@ -1139,6 +1139,7 @@ bool snd_usb_get_sample_rate_quirk(struc
 	case USB_ID(0x047F, 0xAA05): /* Plantronics DA45 */
 	case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */
 	case USB_ID(0x0556, 0x0014): /* Phoenix Audio TMX320VC */
+	case USB_ID(0x05A3, 0x9420): /* ELP HD USB Camera */
 	case USB_ID(0x074D, 0x3553): /* Outlaw RR2150 (Micronas UAC3553B) */
 	case USB_ID(0x1de7, 0x0013): /* Phoenix Audio MT202exe */
 	case USB_ID(0x1de7, 0x0014): /* Phoenix Audio TMX320 */
author maintainer
#9 lore raw

PATCH 9/143 ALSA: hda - Manage power well properly for resume

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <[email protected]>

commit a52ff34e5ec61749c62c6618b76a9d6dbecee450 upstream.

For SKL and later Intel chips, we control the power well per codec basis via link_power callback since the commit [03b135cebc47: ALSA:
hda - remove dependency on i915 power well for SKL]. However, there are a few exceptional cases where the gfx registers are accessed from the audio driver: namely the wakeup override bit toggling at (both system and runtime) resume. This seems causing a kernel warning when accessed during the power well down (and likely resulting in the bogus register accesses).

This patch puts the proper power up / down sequence around the resume code so that the wakeup bit is fiddled properly while the power is up. (The other callback, sync_audio_rate, is used only in the PCM callback, so it's guaranteed in the power-on.)

Also, by this proper power up/down, the instantaneous flip of wakeup bit in the resume callback that was introduced by the commit [033ea349a7cd: ALSA: hda - Fix Skylake codec timeout] becomes superfluous, as snd_hdac_display_power() already does it. So we can clean it up together.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96214

Fixes 03b135cebc47 ('ALSA: hda - remove dependency on i915 power well for SKL')
---
 sound/pci/hda/hda_intel.c |   32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)
sound/pci/hda/hda_intel.c +20 -12
@@ -906,20 +906,23 @@ static int azx_resume(struct device *dev
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct azx *chip;
 	struct hda_intel *hda;
+	struct hdac_bus *bus;
 
 	if (!card)
 		return 0;
 
 	chip = card->private_data;
 	hda = container_of(chip, struct hda_intel, chip);
+	bus = azx_bus(chip);
 	if (chip->disabled || hda->init_failed || !chip->running)
 		return 0;
 
-	if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL
-		&& hda->need_i915_power) {
-		snd_hdac_display_power(azx_bus(chip), true);
-		snd_hdac_i915_set_bclk(azx_bus(chip));
+	if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
+		snd_hdac_display_power(bus, true);
+		if (hda->need_i915_power)
+			snd_hdac_i915_set_bclk(bus);
 	}
+
 	if (chip->msi)
 		if (pci_enable_msi(pci) < 0)
 			chip->msi = 0;
@@ -929,6 +932,11 @@ static int azx_resume(struct device *dev
 
 	hda_intel_init_chip(chip, true);
 
+	/* power down again for link-controlled chips */
+	if ((chip->driver_caps & AZX_DCAPS_I915_POWERWELL) &&
+	    !hda->need_i915_power)
+		snd_hdac_display_power(bus, false);
+
 	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
 
 	trace_azx_resume(chip);
@@ -1008,6 +1016,7 @@ static int azx_runtime_resume(struct dev
 
 	chip = card->private_data;
 	hda = container_of(chip, struct hda_intel, chip);
+	bus = azx_bus(chip);
 	if (chip->disabled || hda->init_failed)
 		return 0;
 
@@ -1015,15 +1024,9 @@ static int azx_runtime_resume(struct dev
 		return 0;
 
 	if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
-		bus = azx_bus(chip);
-		if (hda->need_i915_power) {
-			snd_hdac_display_power(bus, true);
+		snd_hdac_display_power(bus, true);
+		if (hda->need_i915_power)
 			snd_hdac_i915_set_bclk(bus);
-		} else {
-			/* toggle codec wakeup bit for STATESTS read */
-			snd_hdac_set_codec_wakeup(bus, true);
-			snd_hdac_set_codec_wakeup(bus, false);
-		}
 	}
 
 	/* Read STATESTS before controller reset */
@@ -1043,6 +1046,11 @@ static int azx_runtime_resume(struct dev
 	azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) &
 			~STATESTS_INT_MASK);
 
+	/* power down again for link-controlled chips */
+	if ((chip->driver_caps & AZX_DCAPS_I915_POWERWELL) &&
+	    !hda->need_i915_power)
+		snd_hdac_display_power(bus, false);
+
 	trace_azx_runtime_resume(chip);
 	return 0;
 }
author maintainer
#10 lore raw

PATCH 10/143 arm64: Define AT_VECTOR_SIZE_ARCH for ARCH_DLINFO

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: James Hogan <[email protected]>

commit 3146bc64d12377a74dbda12b96ea32da3774ae07 upstream.

AT_VECTOR_SIZE_ARCH should be defined with the maximum number of NEW_AUX_ENT entries that ARCH_DLINFO can contain, but it wasn't defined for arm64 at all even though ARCH_DLINFO will contain one NEW_AUX_ENT for the VDSO address.

This shouldn't be a problem as AT_VECTOR_SIZE_BASE includes space for AT_BASE_PLATFORM which arm64 doesn't use, but lets define it now and add the comment above ARCH_DLINFO as found in several other architectures to remind future modifiers of ARCH_DLINFO to keep AT_VECTOR_SIZE_ARCH up to date.

Fixes f668cd1673aa ("arm64: ELF definitions")
Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
---
 arch/arm64/include/asm/elf.h         |    1 +
 arch/arm64/include/uapi/asm/auxvec.h |    2 ++
 2 files changed, 3 insertions(+)
arch/arm64/include/asm/elf.h +1 -0
@@ -140,6 +140,7 @@ typedef struct user_fpsimd_state elf_fpr
 
 #define SET_PERSONALITY(ex)		clear_thread_flag(TIF_32BIT);
 
+/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
 #define ARCH_DLINFO							\
 do {									\
 	NEW_AUX_ENT(AT_SYSINFO_EHDR,					\
arch/arm64/include/uapi/asm/auxvec.h +2 -0
@@ -19,4 +19,6 @@
 /* vDSO location */
 #define AT_SYSINFO_EHDR	33
 
+#define AT_VECTOR_SIZE_ARCH 1 /* entries in ARCH_DLINFO */
+
 #endif
author maintainer
#11 lore raw

PATCH 11/143 efi/capsule: Allocate whole capsule into virtual memory

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Austin Christ <[email protected]>

commit 6862e6ad95e984991a6ceec592cf67831658f928 upstream.

According to UEFI 2.6 section 7.5.3, the capsule should be in contiguous virtual memory and firmware may consume the capsule immediately. To correctly implement this functionality, the kernel driver needs to vmap the entire capsule at the time it is made available to firmware.

The virtual allocation of the capsule update has been changed from kmap, which was only allocating the first page of the update, to vmap, and allocates the entire data payload.

Cc Andy Lutomirski <[email protected]>
Cc Ard Biesheuvel <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Brian Gerst <[email protected]>
Cc Bryan O'Donoghue <[email protected]>
Cc Denys Vlasenko <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Josh Poimboeuf <[email protected]>
Cc Kweh Hock Leong <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 drivers/firmware/efi/capsule-loader.c |    8 +++++---
 drivers/firmware/efi/capsule.c        |    6 +++---
 2 files changed, 8 insertions(+), 6 deletions(-)
drivers/firmware/efi/capsule-loader.c +5 -3
@@ -16,6 +16,7 @@
 #include <linux/slab.h>
 #include <linux/mutex.h>
 #include <linux/efi.h>
+#include <linux/vmalloc.h>
 
 #define NO_FURTHER_WRITE_ACTION -1
 
@@ -108,14 +109,15 @@ static ssize_t efi_capsule_submit_update
 	int ret;
 	void *cap_hdr_temp;
 
-	cap_hdr_temp = kmap(cap_info->pages[0]);
+	cap_hdr_temp = vmap(cap_info->pages, cap_info->index,
+			VM_MAP, PAGE_KERNEL);
 	if (!cap_hdr_temp) {
-		pr_debug("%s: kmap() failed\n", __func__);
+		pr_debug("%s: vmap() failed\n", __func__);
 		return -EFAULT;
 	}
 
 	ret = efi_capsule_update(cap_hdr_temp, cap_info->pages);
-	kunmap(cap_info->pages[0]);
+	vunmap(cap_hdr_temp);
 	if (ret) {
 		pr_err("%s: efi_capsule_update() failed\n", __func__);
 		return ret;
drivers/firmware/efi/capsule.c +3 -3
@@ -190,9 +190,9 @@ efi_capsule_update_locked(efi_capsule_he
  * map the capsule described by @capsule with its data in @pages and
  * send it to the firmware via the UpdateCapsule() runtime service.
  *
- * @capsule must be a virtual mapping of the first page in @pages
- * (@pages[0]) in the kernel address space. That is, a
- * capsule_header_t that describes the entire contents of the capsule
+ * @capsule must be a virtual mapping of the complete capsule update in the
+ * kernel address space, as the capsule can be consumed immediately.
+ * A capsule_header_t that describes the entire contents of the capsule
  * must be at the start of the first data page.
  *
  * Even though this function will validate that the firmware supports
author maintainer
#12 lore raw

PATCH 12/143 parisc: Fix order of EREFUSED define in errno.h

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Helge Deller <[email protected]>

commit 3eb53b20d7bd1374598cfb1feaa081fcac0e76cd upstream.

When building gccgo in userspace, errno.h gets parsed and the go include file sysinfo.go is generated.

Since EREFUSED is defined to the same value as ECONNREFUSED, and ECONNREFUSED is defined later on in errno.h, this leads to go complaining that EREFUSED isn't defined yet.

Fix this trivial problem by moving the define of EREFUSED down after ECONNREFUSED in errno.h (and clean up the indenting while touching this line).

---
 arch/parisc/include/uapi/asm/errno.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/parisc/include/uapi/asm/errno.h +2 -2
@@ -97,10 +97,10 @@
 #define	ENOTCONN	235	/* Transport endpoint is not connected */
 #define	ESHUTDOWN	236	/* Cannot send after transport endpoint shutdown */
 #define	ETOOMANYREFS	237	/* Too many references: cannot splice */
-#define EREFUSED	ECONNREFUSED	/* for HP's NFS apparently */
 #define	ETIMEDOUT	238	/* Connection timed out */
 #define	ECONNREFUSED	239	/* Connection refused */
-#define EREMOTERELEASE	240	/* Remote peer released connection */
+#define	EREFUSED	ECONNREFUSED	/* for HP's NFS apparently */
+#define	EREMOTERELEASE	240	/* Remote peer released connection */
 #define	EHOSTDOWN	241	/* Host is down */
 #define	EHOSTUNREACH	242	/* No route to host */
 
author maintainer
#13 lore raw

PATCH 13/143 virtio: fix memory leak in virtqueue_add()

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Wei Yongjun <[email protected]>

commit 58625edf9e2515ed41dac2a24fa8004030a87b87 upstream.

When using the indirect buffers feature, 'desc' is allocated in virtqueue_add() but isn't freed before leaving on a ring full error, causing a memory leak.

For example, it seems rather clear that this can trigger with virtio net if mergeable buffers are not used.

---
 drivers/virtio/virtio_ring.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/virtio/virtio_ring.c +2 -0
@@ -316,6 +316,8 @@ static inline int virtqueue_add(struct v
 		 * host should service the ring ASAP. */
 		if (out_sgs)
 			vq->notify(&vq->vq);
+		if (indirect)
+			kfree(desc);
 		END_USE(vq);
 		return -ENOSPC;
 	}
author maintainer
#14 lore raw

PATCH 14/143 mm/slub.c: run free_partial() outside of the kmem_cache_node->list_lock

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Chris Wilson <[email protected]>

commit 6039892396d845b18228935561960441900cffca upstream.

With debugobjects enabled and using SLAB_DESTROY_BY_RCU, when a kmem_cache_node is destroyed the call_rcu() may trigger a slab allocation to fill the debug object pool (__debug_object_init:fill_pool).

Everywhere but during kmem_cache_destroy(), discard_slab() is performed outside of the kmem_cache_node->list_lock and avoids a lockdep warning about potential recursion:

=============================================
[ INFO: possible recursive locking detected ]
4.8.0-rc1-gfxbench+ #1 Tainted: G U
---------------------------------------------
rmmod/8895 is trying to acquire lock:
(&(&n->list_lock)->rlock){-.-...}, at: [<ffffffff811c80d7>] get_partial_node.isra.63+0x47/0x430

but task is already holding lock:
(&(&n->list_lock)->rlock){-.-...}, at: [<ffffffff811cbda4>] __kmem_cache_shutdown+0x54/0x320

other info that might help us debug this:

  Possible unsafe locking scenario:
        CPU0
        ----
   lock(&(&n->list_lock)->rlock);
   lock(&(&n->list_lock)->rlock);

*** DEADLOCK ***
May be due to missing lock nesting notation
5 locks held by rmmod/8895:

   #0:  (&dev->mutex){......}, at: driver_detach+0x42/0xc0
   #1:  (&dev->mutex){......}, at: driver_detach+0x50/0xc0
   #2:  (cpu_hotplug.dep_map){++++++}, at: get_online_cpus+0x2d/0x80
   #3:  (slab_mutex){+.+.+.}, at: kmem_cache_destroy+0x3c/0x220
   #4:  (&(&n->list_lock)->rlock){-.-...}, at: __kmem_cache_shutdown+0x54/0x320
  stack backtrace:
  CPU: 6 PID: 8895 Comm: rmmod Tainted: G     U          4.8.0-rc1-gfxbench+ #1
  Hardware name: Gigabyte Technology Co., Ltd. H87M-D3H/H87M-D3H, BIOS F11 08/18/2015
  Call Trace:
    __lock_acquire+0x1646/0x1ad0
    lock_acquire+0xb2/0x200
    _raw_spin_lock+0x36/0x50
    get_partial_node.isra.63+0x47/0x430
    ___slab_alloc.constprop.67+0x1a7/0x3b0
    __slab_alloc.isra.64.constprop.66+0x43/0x80
    kmem_cache_alloc+0x236/0x2d0
    __debug_object_init+0x2de/0x400
    debug_object_activate+0x109/0x1e0
    __call_rcu.constprop.63+0x32/0x2f0
    call_rcu+0x12/0x20
    discard_slab+0x3d/0x40
    __kmem_cache_shutdown+0xdb/0x320
    shutdown_cache+0x19/0x60
    kmem_cache_destroy+0x1ae/0x220
    i915_gem_load_cleanup+0x14/0x40 [i915]
    i915_driver_unload+0x151/0x180 [i915]
    i915_pci_remove+0x14/0x20 [i915]
    pci_device_remove+0x34/0xb0
    __device_release_driver+0x95/0x140
    driver_detach+0xb6/0xc0
    bus_remove_driver+0x53/0xd0
    driver_unregister+0x27/0x50
    pci_unregister_driver+0x25/0x70
    i915_exit+0x1a/0x1e2 [i915]
    SyS_delete_module+0x193/0x1f0
    entry_SYSCALL_64_fastpath+0x1c/0xac
Fixes 52b4b950b507 ("mm: slab: free kmem_cache_node after destroy sysfs file")
Cc Pekka Enberg <[email protected]>
Cc David Rientjes <[email protected]>
Cc Joonsoo Kim <[email protected]>
Cc Dmitry Safonov <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Dave Gordon <[email protected]>
---
 mm/slub.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
mm/slub.c +5 -1
@@ -3479,6 +3479,7 @@ static void list_slab_objects(struct kme
  */
 static void free_partial(struct kmem_cache *s, struct kmem_cache_node *n)
 {
+	LIST_HEAD(discard);
 	struct page *page, *h;
 
 	BUG_ON(irqs_disabled());
@@ -3486,13 +3487,16 @@ static void free_partial(struct kmem_cac
 	list_for_each_entry_safe(page, h, &n->partial, lru) {
 		if (!page->inuse) {
 			remove_partial(n, page);
-			discard_slab(s, page);
+			list_add(&page->lru, &discard);
 		} else {
 			list_slab_objects(s, page,
 			"Objects remaining in %s on __kmem_cache_shutdown()");
 		}
 	}
 	spin_unlock_irq(&n->list_lock);
+
+	list_for_each_entry_safe(page, h, &discard, lru)
+		discard_slab(s, page);
 }
 
 /*
author maintainer
#15 lore raw

PATCH 15/143 vfio/pci: Fix NULL pointer oops in error interrupt setup handling

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Alex Williamson <[email protected]>

commit c8952a707556e04374d7b2fdb3a079d63ddf6f2f upstream.

There are multiple cases in vfio_pci_set_ctx_trigger_single() where we assume we can safely read from our data pointer without actually checking whether the user has passed any data via the count field. VFIO_IRQ_SET_DATA_NONE in particular is entirely broken since we attempt to pull an int32_t file descriptor out before even checking the data type. The other data types assume the data pointer contains one element of their type as well.

In part this is good news because we were previously restricted from doing much sanitization of parameters because it was missed in the past and we didn't want to break existing users. Clearly DATA_NONE is completely broken, so it must not have any users and we can fix it up completely. For DATA_BOOL and DATA_EVENTFD, we'll just protect ourselves, returning error when count is zero since we previously would have oopsed.

---
 drivers/vfio/pci/vfio_pci_intrs.c |   85 +++++++++++++++++++++-----------------
 1 file changed, 49 insertions(+), 36 deletions(-)
drivers/vfio/pci/vfio_pci_intrs.c +49 -36
@@ -564,67 +564,80 @@ static int vfio_pci_set_msi_trigger(stru
 }
 
 static int vfio_pci_set_ctx_trigger_single(struct eventfd_ctx **ctx,
-					   uint32_t flags, void *data)
+					   unsigned int count, uint32_t flags,
+					   void *data)
 {
-	int32_t fd = *(int32_t *)data;
-
-	if (!(flags & VFIO_IRQ_SET_DATA_TYPE_MASK))
-		return -EINVAL;
-
 	/* DATA_NONE/DATA_BOOL enables loopback testing */
 	if (flags & VFIO_IRQ_SET_DATA_NONE) {
-		if (*ctx)
-			eventfd_signal(*ctx, 1);
-		return 0;
+		if (*ctx) {
+			if (count) {
+				eventfd_signal(*ctx, 1);
+			} else {
+				eventfd_ctx_put(*ctx);
+				*ctx = NULL;
+			}
+			return 0;
+		}
 	} else if (flags & VFIO_IRQ_SET_DATA_BOOL) {
-		uint8_t trigger = *(uint8_t *)data;
+		uint8_t trigger;
+
+		if (!count)
+			return -EINVAL;
+
+		trigger = *(uint8_t *)data;
 		if (trigger && *ctx)
 			eventfd_signal(*ctx, 1);
-		return 0;
-	}
 
-	/* Handle SET_DATA_EVENTFD */
-	if (fd == -1) {
-		if (*ctx)
-			eventfd_ctx_put(*ctx);
-		*ctx = NULL;
 		return 0;
-	} else if (fd >= 0) {
-		struct eventfd_ctx *efdctx;
-		efdctx = eventfd_ctx_fdget(fd);
-		if (IS_ERR(efdctx))
-			return PTR_ERR(efdctx);
-		if (*ctx)
-			eventfd_ctx_put(*ctx);
-		*ctx = efdctx;
+	} else if (flags & VFIO_IRQ_SET_DATA_EVENTFD) {
+		int32_t fd;
+
+		if (!count)
+			return -EINVAL;
+
+		fd = *(int32_t *)data;
+		if (fd == -1) {
+			if (*ctx)
+				eventfd_ctx_put(*ctx);
+			*ctx = NULL;
+		} else if (fd >= 0) {
+			struct eventfd_ctx *efdctx;
+
+			efdctx = eventfd_ctx_fdget(fd);
+			if (IS_ERR(efdctx))
+				return PTR_ERR(efdctx);
+
+			if (*ctx)
+				eventfd_ctx_put(*ctx);
+
+			*ctx = efdctx;
+		}
 		return 0;
-	} else
-		return -EINVAL;
+	}
+
+	return -EINVAL;
 }
 
 static int vfio_pci_set_err_trigger(struct vfio_pci_device *vdev,
 				    unsigned index, unsigned start,
 				    unsigned count, uint32_t flags, void *data)
 {
-	if (index != VFIO_PCI_ERR_IRQ_INDEX)
+	if (index != VFIO_PCI_ERR_IRQ_INDEX || start != 0 || count > 1)
 		return -EINVAL;
 
-	/*
-	 * We should sanitize start & count, but that wasn't caught
-	 * originally, so this IRQ index must forever ignore them :-(
-	 */
-
-	return vfio_pci_set_ctx_trigger_single(&vdev->err_trigger, flags, data);
+	return vfio_pci_set_ctx_trigger_single(&vdev->err_trigger,
+					       count, flags, data);
 }
 
 static int vfio_pci_set_req_trigger(struct vfio_pci_device *vdev,
 				    unsigned index, unsigned start,
 				    unsigned count, uint32_t flags, void *data)
 {
-	if (index != VFIO_PCI_REQ_IRQ_INDEX || start != 0 || count != 1)
+	if (index != VFIO_PCI_REQ_IRQ_INDEX || start != 0 || count > 1)
 		return -EINVAL;
 
-	return vfio_pci_set_ctx_trigger_single(&vdev->req_trigger, flags, data);
+	return vfio_pci_set_ctx_trigger_single(&vdev->req_trigger,
+					       count, flags, data);
 }
 
 int vfio_pci_set_irqs_ioctl(struct vfio_pci_device *vdev, uint32_t flags,
author maintainer
#16 lore raw

PATCH 16/143 tracing: Fix tick_stop tracepoint symbols for user export

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Steven Rostedt (Red Hat) <[email protected]>

commit c87edb36118664f1fa275107c1138b6f47793240 upstream.

The symbols used in the tick_stop tracepoint were not being converted properly into integers in the trace_stop format file. Instead we had this:

print fmt: "success=%d dependency=%s", REC->success,

    __print_symbolic(REC->dependency, { 0, "NONE" },
     { (1 << TICK_DEP_BIT_POSIX_TIMER), "POSIX_TIMER" },
     { (1 << TICK_DEP_BIT_PERF_EVENTS), "PERF_EVENTS" },
     { (1 << TICK_DEP_BIT_SCHED), "SCHED" },
     { (1 << TICK_DEP_BIT_CLOCK_UNSTABLE), "CLOCK_UNSTABLE" })

User space tools have no idea how to parse "TICK_DEP_BIT_SCHED" or the other symbols used to do the bit shifting. The reason is that the conversion was done with using the TICK_DEP_MASK_* symbols which are just macros that convert to the BIT shift itself (with the exception of NONE, which was converted properly, because it doesn't use bits, and is defined as zero).

The TICK_DEP_BIT_* needs to be denoted by TRACE_DEFINE_ENUM() in order to have this properly converted for user space tools to parse this event.

Cc Frederic Weisbecker <[email protected]>
Fixes e6e6cc22e067 ("nohz: Use enum code for tick stop failure tracing message")
---
 include/trace/events/timer.h |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
include/trace/events/timer.h +11 -3
@@ -330,24 +330,32 @@ TRACE_EVENT(itimer_expire,
 #ifdef CONFIG_NO_HZ_COMMON
 
 #define TICK_DEP_NAMES					\
-		tick_dep_name(NONE)			\
+		tick_dep_mask_name(NONE)		\
 		tick_dep_name(POSIX_TIMER)		\
 		tick_dep_name(PERF_EVENTS)		\
 		tick_dep_name(SCHED)			\
 		tick_dep_name_end(CLOCK_UNSTABLE)
 
 #undef tick_dep_name
+#undef tick_dep_mask_name
 #undef tick_dep_name_end
 
-#define tick_dep_name(sdep) TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep);
-#define tick_dep_name_end(sdep)  TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep);
+/* The MASK will convert to their bits and they need to be processed too */
+#define tick_dep_name(sdep) TRACE_DEFINE_ENUM(TICK_DEP_BIT_##sdep); \
+	TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep);
+#define tick_dep_name_end(sdep)  TRACE_DEFINE_ENUM(TICK_DEP_BIT_##sdep); \
+	TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep);
+/* NONE only has a mask defined for it */
+#define tick_dep_mask_name(sdep) TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep);
 
 TICK_DEP_NAMES
 
 #undef tick_dep_name
+#undef tick_dep_mask_name
 #undef tick_dep_name_end
 
 #define tick_dep_name(sdep) { TICK_DEP_MASK_##sdep, #sdep },
+#define tick_dep_mask_name(sdep) { TICK_DEP_MASK_##sdep, #sdep },
 #define tick_dep_name_end(sdep) { TICK_DEP_MASK_##sdep, #sdep }
 
 #define show_tick_dep_name(val)				\
author maintainer
#17 lore raw

PATCH 17/143 perf intel-pt: Fix occasional decoding errors when tracing system-wide

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Adrian Hunter <[email protected]>

commit 3d918fb13abdbeca7947578f5d7e426eafad7f5e upstream.

In order to successfully decode Intel PT traces, context switch events are needed from the moment the trace starts. Currently that is ensured by using the 'immediate' flag which enables the switch event when it is opened.

However, since commit 86c2786994bd ("perf intel-pt: Add support for PERF_RECORD_SWITCH") that might not always happen. When tracing system-wide the context switch event is added to the tracking event which was not set as 'immediate'. Change that so it is.

Cc Jiri Olsa <[email protected]>
Fixes 86c2786994bd ("perf intel-pt: Add support for PERF_RECORD_SWITCH")
---
 tools/perf/arch/x86/util/intel-pt.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/arch/x86/util/intel-pt.c +5 -1
@@ -501,7 +501,7 @@ static int intel_pt_recording_options(st
 	struct intel_pt_recording *ptr =
 			container_of(itr, struct intel_pt_recording, itr);
 	struct perf_pmu *intel_pt_pmu = ptr->intel_pt_pmu;
-	bool have_timing_info;
+	bool have_timing_info, need_immediate = false;
 	struct perf_evsel *evsel, *intel_pt_evsel = NULL;
 	const struct cpu_map *cpus = evlist->cpus;
 	bool privileged = geteuid() == 0 || perf_event_paranoid() < 0;
@@ -655,6 +655,7 @@ static int intel_pt_recording_options(st
 				ptr->have_sched_switch = 3;
 			} else {
 				opts->record_switch_events = true;
+				need_immediate = true;
 				if (cpu_wide)
 					ptr->have_sched_switch = 3;
 				else
@@ -700,6 +701,9 @@ static int intel_pt_recording_options(st
 		tracking_evsel->attr.freq = 0;
 		tracking_evsel->attr.sample_period = 1;
 
+		if (need_immediate)
+			tracking_evsel->immediate = true;
+
 		/* In per-cpu case, always need the time of mmap events etc */
 		if (!cpu_map__empty(cpus)) {
 			perf_evsel__set_sample_bit(tracking_evsel, TIME);
author maintainer
#18 lore raw

PATCH 18/143 libnvdimm, nd_blk: mask off reserved status bits

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Ross Zwisler <[email protected]>

commit 68202c9f0ad6e16ee806fbadbc5838d55fe5aa5c upstream.

The "NVDIMM Block Window Driver Writer's Guide":

http://pmem.io/documents/NVDIMM_DriverWritersGuide-July-2016.pdf

...defines the layout of the block window status register. For the July 2016 version of the spec linked to above, this happens in Figure 4 on page 26.

The only bits defined in this spec are bits 31, 5, 4, 2, 1 and 0. The rest of the bits in the status register are reserved, and there is a warning following the diagram that says:

Note: The driver cannot assume the value of the RESERVED bits in the status register are zero. These reserved bits need to be masked off, and the driver must avoid checking the state of those bits.

This change ensures that for hardware implementations that set these reserved bits in the status register, the driver won't incorrectly fail the block I/Os.

---
 drivers/acpi/nfit.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/acpi/nfit.c +2 -1
@@ -1396,11 +1396,12 @@ static u32 read_blk_stat(struct nfit_blk
 {
 	struct nfit_blk_mmio *mmio = &nfit_blk->mmio[DCR];
 	u64 offset = nfit_blk->stat_offset + mmio->size * bw;
+	const u32 STATUS_MASK = 0x80000037;
 
 	if (mmio->num_lines)
 		offset = to_interleave_offset(offset, mmio);
 
-	return readl(mmio->addr.base + offset);
+	return readl(mmio->addr.base + offset) & STATUS_MASK;
 }
 
 static void write_blk_ctl(struct nfit_blk *nfit_blk, unsigned int bw,
author maintainer
#19 lore raw

PATCH 19/143 ACPI: CPPC: Return error if _CPC is invalid on a CPU

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Hoan Tran <[email protected]>

commit 8343c40d3de32ebfe8f48b043964e4ba0e7701f7 upstream.

Based on 8.4.7.1 section of ACPI 6.1 specification, if the platform supports CPPC, the _CPC object must exist under all processor objects. If cpc_desc_ptr pointer is invalid on any CPUs, acpi_get_psd_map() should return error and CPPC cpufreq driver can not be registered.

---
 drivers/acpi/cppc_acpi.c |   18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/acpi/cppc_acpi.c +12 -6
@@ -299,8 +299,10 @@ int acpi_get_psd_map(struct cpudata **al
 			continue;
 
 		cpc_ptr = per_cpu(cpc_desc_ptr, i);
-		if (!cpc_ptr)
-			continue;
+		if (!cpc_ptr) {
+			retval = -EFAULT;
+			goto err_ret;
+		}
 
 		pdomain = &(cpc_ptr->domain_info);
 		cpumask_set_cpu(i, pr->shared_cpu_map);
@@ -322,8 +324,10 @@ int acpi_get_psd_map(struct cpudata **al
 				continue;
 
 			match_cpc_ptr = per_cpu(cpc_desc_ptr, j);
-			if (!match_cpc_ptr)
-				continue;
+			if (!match_cpc_ptr) {
+				retval = -EFAULT;
+				goto err_ret;
+			}
 
 			match_pdomain = &(match_cpc_ptr->domain_info);
 			if (match_pdomain->domain != pdomain->domain)
@@ -353,8 +357,10 @@ int acpi_get_psd_map(struct cpudata **al
 				continue;
 
 			match_cpc_ptr = per_cpu(cpc_desc_ptr, j);
-			if (!match_cpc_ptr)
-				continue;
+			if (!match_cpc_ptr) {
+				retval = -EFAULT;
+				goto err_ret;
+			}
 
 			match_pdomain = &(match_cpc_ptr->domain_info);
 			if (match_pdomain->domain != pdomain->domain)
author maintainer
#20 lore raw

PATCH 20/143 ACPI / CPPC: Prevent cpc_desc_ptr points to the invalid data

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Hoan Tran <[email protected]>

commit 2324d15447a9db168b1f85e3feac635b1ff8edb8 upstream.

When CPPC fails to request a PCC channel, the CPC data is freed and cpc_desc_ptr points to the invalid data.

Avoid this issue by moving the cpc_desc_ptr assignment after the PCC channel request.

---
 drivers/acpi/cppc_acpi.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/acpi/cppc_acpi.c +3 -3
@@ -601,9 +601,6 @@ int acpi_cppc_processor_probe(struct acp
 	/* Store CPU Logical ID */
 	cpc_ptr->cpu_id = pr->id;
 
-	/* Plug it into this CPUs CPC descriptor. */
-	per_cpu(cpc_desc_ptr, pr->id) = cpc_ptr;
-
 	/* Parse PSD data for this CPU */
 	ret = acpi_get_psd(cpc_ptr, handle);
 	if (ret)
@@ -616,6 +613,9 @@ int acpi_cppc_processor_probe(struct acp
 			goto out_free;
 	}
 
+	/* Plug PSD data into this CPUs CPC descriptor. */
+	per_cpu(cpc_desc_ptr, pr->id) = cpc_ptr;
+
 	/* Everything looks okay */
 	pr_debug("Parsed CPC struct for CPU: %d\n", pr->id);
 
author maintainer
#21 lore raw

PATCH 21/143 um: Dont discard .text.exit section

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Andrey Ryabinin <[email protected]>

commit dad2232844073295c64e9cc2d734a0ade043e0f6 upstream.

Commit e41f501d3912 ("vmlinux.lds: account for destructor sections") added '.text.exit' to EXIT_TEXT which is discarded at link time by default. This breaks compilation of UML:
.text.exit' referenced in section .fini_array' of /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libc.a(sdlerror.o):
defined in discarded section `.text.exit' of /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libc.a(sdlerror.o)

Apparently UML doesn't want to discard exit text, so let's place all EXIT_TEXT sections in .exit.text.

Fixes e41f501d3912 ("vmlinux.lds: account for destructor sections")
---
 arch/um/include/asm/common.lds.S |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/include/asm/common.lds.S +1 -1
@@ -81,7 +81,7 @@
   .altinstr_replacement : { *(.altinstr_replacement) }
   /* .exit.text is discard at runtime, not link time, to deal with references
      from .altinstructions and .eh_frame */
-  .exit.text : { *(.exit.text) }
+  .exit.text : { EXIT_TEXT }
   .exit.data : { *(.exit.data) }
 
   .preinit_array : {
author maintainer
#22 lore raw

PATCH 22/143 genirq/msi: Remove unused MSI_FLAG_IDENTITY_MAP

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Thomas Gleixner <[email protected]>

commit b6140914fd079e43ea75a53429b47128584f033a upstream.

No user and we definitely don't want to grow one.

Signed-off-by Thomas Gleixner <tglx at linutronix.de>
Reviewed-by Bart Van Assche <bart.vanassche at sandisk.com>
Cc Christoph Hellwig <hch at lst.de>
Cc linux-block at vger.kernel.org
Cc linux-pci at vger.kernel.org
Cc linux-nvme at lists.infradead.org
Cc axboe at fb.com
Cc agordeev at redhat.com
Signed-off-by Thomas Gleixner <tglx at linutronix.de>
Signed-off-by Greg Kroah-Hartman <gregkh at linuxfoundation.org>
---
 include/linux/msi.h |    6 ++----
 kernel/irq/msi.c    |    8 ++------
 2 files changed, 4 insertions(+), 10 deletions(-)
include/linux/msi.h +2 -4
@@ -264,12 +264,10 @@ enum {
 	 * callbacks.
 	 */
 	MSI_FLAG_USE_DEF_CHIP_OPS	= (1 << 1),
-	/* Build identity map between hwirq and irq */
-	MSI_FLAG_IDENTITY_MAP		= (1 << 2),
 	/* Support multiple PCI MSI interrupts */
-	MSI_FLAG_MULTI_PCI_MSI		= (1 << 3),
+	MSI_FLAG_MULTI_PCI_MSI		= (1 << 2),
 	/* Support PCI MSIX interrupts */
-	MSI_FLAG_PCI_MSIX		= (1 << 4),
+	MSI_FLAG_PCI_MSIX		= (1 << 3),
 };
 
 int msi_domain_set_affinity(struct irq_data *data, const struct cpumask *mask,
kernel/irq/msi.c +2 -6
@@ -324,7 +324,7 @@ int msi_domain_alloc_irqs(struct irq_dom
 	struct msi_domain_ops *ops = info->ops;
 	msi_alloc_info_t arg;
 	struct msi_desc *desc;
-	int i, ret, virq = -1;
+	int i, ret, virq;
 
 	ret = msi_domain_prepare_irqs(domain, dev, nvec, &arg);
 	if (ret)
@@ -332,12 +332,8 @@ int msi_domain_alloc_irqs(struct irq_dom
 
 	for_each_msi_entry(desc, dev) {
 		ops->set_desc(&arg, desc);
-		if (info->flags & MSI_FLAG_IDENTITY_MAP)
-			virq = (int)ops->get_hwirq(info, &arg);
-		else
-			virq = -1;
 
-		virq = __irq_domain_alloc_irqs(domain, virq, desc->nvec_used,
+		virq = __irq_domain_alloc_irqs(domain, -1, desc->nvec_used,
 					       dev_to_node(dev), &arg, false);
 		if (virq < 0) {
 			ret = -ENOSPC;
author maintainer
#23 lore raw

PATCH 23/143 genirq/msi: Make sure PCI MSIs are activated early

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Marc Zyngier <[email protected]>

commit f3b0946d629c8bfbd3e5f038e30cb9c711a35f10 upstream.

Bharat Kumar Gogada reported issues with the generic MSI code, where the end-point ended up with garbage in its MSI configuration (both for the vector and the message).

It turns out that the two MSI paths in the kernel are doing slightly different things:

generic MSI: disable MSI -> allocate MSI -> enable MSI -> setup EP PCI MSI: disable MSI -> allocate MSI -> setup EP -> enable MSI

And it turns out that end-points are allowed to latch the content of the MSI configuration registers as soon as MSIs are enabled. In Bharat's case, the end-point ends up using whatever was there already, which is not what you want.

In order to make things converge, we introduce a new MSI domain flag (MSI_FLAG_ACTIVATE_EARLY) that is unconditionally set for PCI/MSI. When set, this flag forces the programming of the end-point as soon as the MSIs are allocated.

A consequence of this is that we have an extra activate in irq_startup, but that should be without much consequence.

tglx:

- Several people reported a VMWare regression with PCI/MSI-X passthrough. It turns out that the patch also cures that issue.

- We need to have a look at the MSI disable interrupt path, where we write the msg to all zeros without disabling MSI in the PCI device. Is that correct?

---
 drivers/pci/msi.c   |    2 ++
 include/linux/msi.h |    2 ++
 kernel/irq/msi.c    |   11 +++++++++++
 3 files changed, 15 insertions(+)
drivers/pci/msi.c +2 -0
@@ -1277,6 +1277,8 @@ struct irq_domain *pci_msi_create_irq_do
 	if (info->flags & MSI_FLAG_USE_DEF_CHIP_OPS)
 		pci_msi_domain_update_chip_ops(info);
 
+	info->flags |= MSI_FLAG_ACTIVATE_EARLY;
+
 	domain = msi_create_irq_domain(fwnode, info, parent);
 	if (!domain)
 		return NULL;
include/linux/msi.h +2 -0
@@ -268,6 +268,8 @@ enum {
 	MSI_FLAG_MULTI_PCI_MSI		= (1 << 2),
 	/* Support PCI MSIX interrupts */
 	MSI_FLAG_PCI_MSIX		= (1 << 3),
+	/* Needs early activate, required for PCI */
+	MSI_FLAG_ACTIVATE_EARLY		= (1 << 4),
 };
 
 int msi_domain_set_affinity(struct irq_data *data, const struct cpumask *mask,
kernel/irq/msi.c +11 -0
@@ -357,6 +357,17 @@ int msi_domain_alloc_irqs(struct irq_dom
 		else
 			dev_dbg(dev, "irq [%d-%d] for MSI\n",
 				virq, virq + desc->nvec_used - 1);
+		/*
+		 * This flag is set by the PCI layer as we need to activate
+		 * the MSI entries before the PCI layer enables MSI in the
+		 * card. Otherwise the card latches a random msi message.
+		 */
+		if (info->flags & MSI_FLAG_ACTIVATE_EARLY) {
+			struct irq_data *irq_data;
+
+			irq_data = irq_domain_get_irq_data(domain, desc->irq);
+			irq_domain_activate_irq(irq_data);
+		}
 	}
 
 	return 0;
author maintainer
#24 lore raw

PATCH 24/143 crypto: caam - fix non-hmac hashes

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Russell King <[email protected]>

commit a0118c8b2be9297aed8e915c60b4013326b256d4 upstream.

Since 6de62f15b581 ("crypto: algif_hash - Require setkey before accept(2)"), the AF_ALG interface requires userspace to provide a key to any algorithm that has a setkey method. However, the non-HMAC algorithms are not keyed, so setting a key is unnecessary.

Fix this by removing the setkey method from the non-keyed hash algorithms.

Fixes 6de62f15b581 ("crypto: algif_hash - Require setkey before accept(2)")
---
 drivers/crypto/caam/caamhash.c |    1 +
 1 file changed, 1 insertion(+)
drivers/crypto/caam/caamhash.c +1 -0
@@ -1897,6 +1897,7 @@ caam_hash_alloc(struct caam_hash_templat
 			 template->name);
 		snprintf(alg->cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s",
 			 template->driver_name);
+		t_alg->ahash_alg.setkey = NULL;
 	}
 	alg->cra_module = THIS_MODULE;
 	alg->cra_init = caam_hash_cra_init;
author maintainer
#25 lore raw

PATCH 27/143 parisc: Fix automatic selection of cr16 clocksource

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Helge Deller <[email protected]>

commit ae141830b118c3fb5b7eab6fa7c8ab7b7224b0a4 upstream.

Commit 54b66800907 (parisc: Add native high-resolution sched_clock() implementation) added support to use the CPU-internal cr16 counters as reliable clocksource with the help of HAVE_UNSTABLE_SCHED_CLOCK.

Sadly the commit missed to remove the hack which prevented cr16 to become the default clocksource even on SMP systems.

---
 arch/parisc/kernel/processor.c |    8 --------
 arch/parisc/kernel/time.c      |   12 ------------
 2 files changed, 20 deletions(-)
arch/parisc/kernel/processor.c +0 -8
@@ -51,8 +51,6 @@ EXPORT_SYMBOL(_parisc_requires_coherency
 
 DEFINE_PER_CPU(struct cpuinfo_parisc, cpu_data);
 
-extern int update_cr16_clocksource(void);	/* from time.c */
-
 /*
 **  	PARISC CPU driver - claim "device" and initialize CPU data structures.
 **
@@ -228,12 +226,6 @@ static int processor_probe(struct parisc
 	}
 #endif
 
-	/* If we've registered more than one cpu,
-	 * we'll use the jiffies clocksource since cr16
-	 * is not synchronized between CPUs.
-	 */
-	update_cr16_clocksource();
-
 	return 0;
 }
 
arch/parisc/kernel/time.c +0 -12
@@ -220,18 +220,6 @@ static struct clocksource clocksource_cr
 	.flags			= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
-int update_cr16_clocksource(void)
-{
-	/* since the cr16 cycle counters are not synchronized across CPUs,
-	   we'll check if we should switch to a safe clocksource: */
-	if (clocksource_cr16.rating != 0 && num_online_cpus() > 1) {
-		clocksource_change_rating(&clocksource_cr16, 0);
-		return 1;
-	}
-
-	return 0;
-}
-
 void __init start_cpu_itimer(void)
 {
 	unsigned int cpu = smp_processor_id();
author maintainer
#26 lore raw

PATCH 28/143 usb: ehci: change order of register cleanup during shutdown

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Marc Ohlf <[email protected]>

commit bc337b51508beb2d039aff5074a76cfe1c212030 upstream.

In ehci_turn_off_all_ports() all EHCI port registers are cleared to zero. On some hardware, this can lead to an system hang,
when ehci_port_power() accesses the already cleared registers.

This patch changes the order of cleanup.
First call ehci_port_power() which respects the current bits in port status registers
and afterwards cleanup the hard way by setting everything to zero.

---
 drivers/usb/host/ehci-hcd.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/ehci-hcd.c +2 -2
@@ -332,11 +332,11 @@ static void ehci_turn_off_all_ports(stru
 	int	port = HCS_N_PORTS(ehci->hcs_params);
 
 	while (port--) {
-		ehci_writel(ehci, PORT_RWC_BITS,
-				&ehci->regs->port_status[port]);
 		spin_unlock_irq(&ehci->lock);
 		ehci_port_power(ehci, port, false);
 		spin_lock_irq(&ehci->lock);
+		ehci_writel(ehci, PORT_RWC_BITS,
+				&ehci->regs->port_status[port]);
 	}
 }
 
author maintainer
#27 lore raw

PATCH 29/143 usb: devio, do not warn when allocation fails

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Jiri Slaby <[email protected]>

commit 70f7ca9a0262784d0b80727860a63d64ab228e7b upstream.

usbdev_mmap allocates a buffer. The size of the buffer is determined by a user. So with this code (no need to be root):

	int fd = open("/dev/bus/usb/001/001", O_RDONLY);
	mmap(NULL, 0x800000, PROT_READ, MAP_SHARED, fd, 0);

we can see a warning:

WARNING: CPU: 0 PID: 21771 at ../mm/page_alloc.c:3563 __alloc_pages_slowpath+0x1036/0x16e0()
...
Call Trace:
 [<ffffffff8117a3ae>] ? warn_slowpath_null+0x2e/0x40
 [<ffffffff815178b6>] ? __alloc_pages_slowpath+0x1036/0x16e0
 [<ffffffff81516880>] ? warn_alloc_failed+0x250/0x250
 [<ffffffff8151226b>] ? get_page_from_freelist+0x75b/0x28b0
 [<ffffffff815184e3>] ? __alloc_pages_nodemask+0x583/0x6b0
 [<ffffffff81517f60>] ? __alloc_pages_slowpath+0x16e0/0x16e0
 [<ffffffff810565d4>] ? dma_generic_alloc_coherent+0x104/0x220
 [<ffffffffa0269e56>] ? hcd_buffer_alloc+0x1d6/0x3e0 [usbcore]
 [<ffffffffa0269c80>] ? hcd_buffer_destroy+0xa0/0xa0 [usbcore]
 [<ffffffffa0228f05>] ? usb_alloc_coherent+0x65/0x90 [usbcore]
 [<ffffffffa0275c05>] ? usbdev_mmap+0x1a5/0x770 [usbcore]

...

Allocations like this one should be marked as __GFP_NOWARN. So do so.

The size could be also clipped by something like:

	if (size >= (1 << (MAX_ORDER + PAGE_SHIFT - 1)))
		return -ENOMEM;

But I think the overall limit of 16M (by usbfs_increase_memory_usage) is enough, so that we only silence the warning here.

Cc Greg Kroah-Hartman <[email protected]>
Cc Alan Stern <[email protected]>
Cc Steinar H. Gunderson <[email protected]>
Cc Markus Rechberger <[email protected]>
Fixes f7d34b445a (USB: Add support for usbfs zerocopy.)
---
 drivers/usb/core/devio.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/core/devio.c +2 -1
@@ -241,7 +241,8 @@ static int usbdev_mmap(struct file *file
 		goto error_decrease_mem;
 	}
 
-	mem = usb_alloc_coherent(ps->dev, size, GFP_USER, &dma_handle);
+	mem = usb_alloc_coherent(ps->dev, size, GFP_USER | __GFP_NOWARN,
+			&dma_handle);
 	if (!mem) {
 		ret = -ENOMEM;
 		goto error_free_usbm;
author maintainer
#28 lore raw

PATCH 30/143 usb: misc: usbtest: add fix for driver hang

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Lu Baolu <[email protected]>

commit 539587511835ea12d8daa444cbed766cf2bc3612 upstream.

In sg_timeout(), req->status is set to "-ETIMEDOUT" before calling into usb_sg_cancel(). usb_sg_cancel() will do nothing and return directly if req->status has been set to a non-zero value. This will cause driver hang whenever transfer time out is triggered.

This patch fixes this issue. It could be backported to stable kernel with version later than v3.15.

---
 drivers/usb/misc/usbtest.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/usb/misc/usbtest.c +4 -3
@@ -585,7 +585,6 @@ static void sg_timeout(unsigned long _re
 {
 	struct usb_sg_request	*req = (struct usb_sg_request *) _req;
 
-	req->status = -ETIMEDOUT;
 	usb_sg_cancel(req);
 }
 
@@ -616,8 +615,10 @@ static int perform_sglist(
 		mod_timer(&sg_timer, jiffies +
 				msecs_to_jiffies(SIMPLE_IO_TIMEOUT));
 		usb_sg_wait(req);
-		del_timer_sync(&sg_timer);
-		retval = req->status;
+		if (!del_timer_sync(&sg_timer))
+			retval = -ETIMEDOUT;
+		else
+			retval = req->status;
 
 		/* FIXME check resulting data pattern */
 
author maintainer
#29 lore raw

PATCH 31/143 usb: misc: usbtest: usbtest_do_ioctl may return positive integer

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Peter Chen <[email protected]>

commit 528d28138f91009f230903bd89ccd44719667831 upstream.

For case 14 and case 21, their correct return value is the number of bytes transferred, so it is a positive integer. But in usbtest_ioctl, it takes non-zero as false return value for usbtest_do_ioctl, so it will treat the correct test as wrong test, then the time on tests will be the minus value.

Fixes 18fc4ebdc705 ("usb: misc: usbtest: Remove timeval usage")
---
 drivers/usb/misc/usbtest.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/misc/usbtest.c +1 -1
@@ -2603,7 +2603,7 @@ usbtest_ioctl(struct usb_interface *intf
 	ktime_get_ts64(&start);
 
 	retval = usbtest_do_ioctl(intf, param_32);
-	if (retval)
+	if (retval < 0)
 		goto free_mutex;
 
 	ktime_get_ts64(&end);
author maintainer
#30 lore raw

PATCH 32/143 usb: dwc3: pci: add Intel Kabylake PCI ID

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Heikki Krogerus <[email protected]>

commit 4491ed5042f0419b22a4b08331adb54af31e2caa upstream.

Intel Kabylake PCH has the same DWC3 than Intel Sunrisepoint. Add the new ID to the supported devices.

---
 drivers/usb/dwc3/dwc3-pci.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/usb/dwc3/dwc3-pci.c +2 -0
@@ -37,6 +37,7 @@
 #define PCI_DEVICE_ID_INTEL_BXT			0x0aaa
 #define PCI_DEVICE_ID_INTEL_BXT_M		0x1aaa
 #define PCI_DEVICE_ID_INTEL_APL			0x5aaa
+#define PCI_DEVICE_ID_INTEL_KBP			0xa2b0
 
 static const struct acpi_gpio_params reset_gpios = { 0, 0, false };
 static const struct acpi_gpio_params cs_gpios = { 1, 0, false };
@@ -214,6 +215,7 @@ static const struct pci_device_id dwc3_p
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT), },
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT_M), },
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_APL), },
+	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBP), },
 	{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), },
 	{  }	/* Terminating Entry */
 };
author maintainer
#31 lore raw

PATCH 33/143 usb: dwc3: gadget: increment request->actual once

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Felipe Balbi <[email protected]>

commit c7de573471832dff7d31f0c13b0f143d6f017799 upstream.

When using SG lists, we would end up setting
request->actual to:

	num_mapped_sgs * (request->length - count)

Let's fix that up by incrementing request->actual
only once.

---
 drivers/usb/dwc3/gadget.c |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/usb/dwc3/gadget.c +11 -8
@@ -1954,14 +1954,6 @@ static int __dwc3_cleanup_done_trbs(stru
 			s_pkt = 1;
 	}
 
-	/*
-	 * We assume here we will always receive the entire data block
-	 * which we should receive. Meaning, if we program RX to
-	 * receive 4K but we receive only 2K, we assume that's all we
-	 * should receive and we simply bounce the request back to the
-	 * gadget driver for further processing.
-	 */
-	req->request.actual += req->request.length - count;
 	if (s_pkt)
 		return 1;
 	if ((event->status & DEPEVT_STATUS_LST) &&
@@ -1981,6 +1973,7 @@ static int dwc3_cleanup_done_reqs(struct
 	struct dwc3_trb		*trb;
 	unsigned int		slot;
 	unsigned int		i;
+	int			count = 0;
 	int			ret;
 
 	do {
@@ -1995,6 +1988,8 @@ static int dwc3_cleanup_done_reqs(struct
 				slot++;
 			slot %= DWC3_TRB_NUM;
 			trb = &dep->trb_pool[slot];
+			count += trb->size & DWC3_TRB_SIZE_MASK;
+
 
 			ret = __dwc3_cleanup_done_trbs(dwc, dep, req, trb,
 					event, status);
@@ -2002,6 +1997,14 @@ static int dwc3_cleanup_done_reqs(struct
 				break;
 		} while (++i < req->request.num_mapped_sgs);
 
+		/*
+		 * We assume here we will always receive the entire data block
+		 * which we should receive. Meaning, if we program RX to
+		 * receive 4K but we receive only 2K, we assume that's all we
+		 * should receive and we simply bounce the request back to the
+		 * gadget driver for further processing.
+		 */
+		req->request.actual += req->request.length - count;
 		dwc3_gadget_giveback(dep, req, status);
 
 		if (ret)
author maintainer
#32 lore raw

PATCH 34/143 usb: dwc3: gadget: fix for short pkts during chained xfers

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Felipe Balbi <[email protected]>

commit e5b36ae2f851024d43c76e51f395d32ce8d769ce upstream.

DWC3 has one interesting peculiarity with chained transfers. If we setup N chained transfers and we get a short packet before processing all N TRBs, DWC3 will (conditionally) issue a XferComplete or XferInProgress event and retire all TRBs from the one which got a short packet to the last without clearing their HWO bits.

This means SW must clear HWO bit manually, which this patch is doing.

---
 drivers/usb/dwc3/gadget.c |   23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
drivers/usb/dwc3/gadget.c +20 -3
@@ -1897,7 +1897,8 @@ static void dwc3_gadget_free_endpoints(s
 
 static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep,
 		struct dwc3_request *req, struct dwc3_trb *trb,
-		const struct dwc3_event_depevt *event, int status)
+		const struct dwc3_event_depevt *event, int status,
+		int chain)
 {
 	unsigned int		count;
 	unsigned int		s_pkt = 0;
@@ -1905,6 +1906,19 @@ static int __dwc3_cleanup_done_trbs(stru
 
 	trace_dwc3_complete_trb(dep, trb);
 
+	/*
+	 * If we're in the middle of series of chained TRBs and we
+	 * receive a short transfer along the way, DWC3 will skip
+	 * through all TRBs including the last TRB in the chain (the
+	 * where CHN bit is zero. DWC3 will also avoid clearing HWO
+	 * bit and SW has to do it manually.
+	 *
+	 * We're going to do that here to avoid problems of HW trying
+	 * to use bogus TRBs for transfers.
+	 */
+	if (chain && (trb->ctrl & DWC3_TRB_CTRL_HWO))
+		trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
+
 	if ((trb->ctrl & DWC3_TRB_CTRL_HWO) && status != -ESHUTDOWN)
 		/*
 		 * We continue despite the error. There is not much we
@@ -1916,6 +1930,7 @@ static int __dwc3_cleanup_done_trbs(stru
 		 */
 		dev_err(dwc->dev, "%s's TRB (%p) still owned by HW\n",
 				dep->name, trb);
+
 	count = trb->size & DWC3_TRB_SIZE_MASK;
 
 	if (dep->direction) {
@@ -1977,10 +1992,13 @@ static int dwc3_cleanup_done_reqs(struct
 	int			ret;
 
 	do {
+		int chain;
+
 		req = next_request(&dep->started_list);
 		if (WARN_ON_ONCE(!req))
 			return 1;
 
+		chain = req->request.num_mapped_sgs > 0;
 		i = 0;
 		do {
 			slot = req->first_trb_index + i;
@@ -1990,9 +2008,8 @@ static int dwc3_cleanup_done_reqs(struct
 			trb = &dep->trb_pool[slot];
 			count += trb->size & DWC3_TRB_SIZE_MASK;
 
-
 			ret = __dwc3_cleanup_done_trbs(dwc, dep, req, trb,
-					event, status);
+					event, status, chain);
 			if (ret)
 				break;
 		} while (++i < req->request.num_mapped_sgs);
author maintainer
#33 lore raw

PATCH 35/143 usb: dwc3: gadget: always cleanup all TRBs

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Felipe Balbi <[email protected]>

commit 7c705dfe2ebe731c8fd068623b6b4df2d3512c08 upstream.

If we stop earlier due to short packet, we will not be able to giveback all TRBs.

---
 drivers/usb/dwc3/gadget.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc3/gadget.c +1 -1
@@ -1969,7 +1969,7 @@ static int __dwc3_cleanup_done_trbs(stru
 			s_pkt = 1;
 	}
 
-	if (s_pkt)
+	if (s_pkt && !chain)
 		return 1;
 	if ((event->status & DEPEVT_STATUS_LST) &&
 			(trb->ctrl & (DWC3_TRB_CTRL_LST |
author maintainer
#34 lore raw

PATCH 36/143 usb: hub: Fix unbalanced reference count/memory leak/deadlocks

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Viresh Kumar <[email protected]>

commit 6bb47e8ab98accb1319bd43c64966340ba3bba9a upstream.

Memory leak and unbalanced reference count:

If the hub gets disconnected while the core is still activating it, this can result in leaking memory of few USB structures.

This will happen if we have done a kref_get() from hub_activate() and scheduled a delayed work item for HUB_INIT2/3. Now if hub_disconnect() gets called before the delayed work expires, then we will cancel the work from hub_quiesce(), but wouldn't do a kref_put(). And so the unbalance.

kmemleak reports this as (with the commit e50293ef9775 backported to 3.10 kernel with other changes, though the same is true for mainline as well):

unreferenced object 0xffffffc08af5b800 (size 1024):
comm "khubd", pid 73, jiffies 4295051211 (age 6482.350s) hex dump (first 32 bytes):

    30 68 f3 8c c0 ff ff ff 00 a0 b2 2e c0 ff ff ff  0h..............
    01 00 00 00 00 00 00 00 00 94 7d 40 c0 ff ff ff  ..........}@....
  backtrace:
    [<ffffffc0003079ec>] create_object+0x148/0x2a0
    [<ffffffc000cc150c>] kmemleak_alloc+0x80/0xbc
    [<ffffffc000303a7c>] kmem_cache_alloc_trace+0x120/0x1ac
    [<ffffffc0006fa610>] hub_probe+0x120/0xb84
    [<ffffffc000702b20>] usb_probe_interface+0x1ec/0x298
    [<ffffffc0005d50cc>] driver_probe_device+0x160/0x374
    [<ffffffc0005d5308>] __device_attach+0x28/0x4c
    [<ffffffc0005d3164>] bus_for_each_drv+0x78/0xac
    [<ffffffc0005d4ee0>] device_attach+0x6c/0x9c
    [<ffffffc0005d42b8>] bus_probe_device+0x28/0xa0
    [<ffffffc0005d23a4>] device_add+0x324/0x604
    [<ffffffc000700fcc>] usb_set_configuration+0x660/0x6cc
    [<ffffffc00070a350>] generic_probe+0x44/0x84
    [<ffffffc000702914>] usb_probe_device+0x54/0x74
    [<ffffffc0005d50cc>] driver_probe_device+0x160/0x374
    [<ffffffc0005d5308>] __device_attach+0x28/0x4c

Deadlocks:

If the hub gets disconnected early enough (i.e. before INIT2/INIT3 are finished and the init_work is still queued), the core may call hub_quiesce() after acquiring interface device locks and it will wait for the work to be cancelled synchronously. But if the work handler is already running in parallel, it may try to acquire the same interface device lock and this may result in deadlock.

Fix both the issues by removing the call to cancel_delayed_work_sync().

Fixes e50293ef9775 ("USB: fix invalid memory access in hub_activate()")
---
 drivers/usb/core/hub.c |    2 --
 1 file changed, 2 deletions(-)
drivers/usb/core/hub.c +0 -2
@@ -1315,8 +1315,6 @@ static void hub_quiesce(struct usb_hub *
 	struct usb_device *hdev = hub->hdev;
 	int i;
 
-	cancel_delayed_work_sync(&hub->init_work);
-
 	/* hub_wq and related activity won't re-trigger */
 	hub->quiescing = 1;
 
author maintainer
#35 lore raw

PATCH 37/143 USB: hub: fix up early-exit pathway in hub_activate

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Alan Stern <[email protected]>

commit ca5cbc8b02f9b21cc8cd1ab36668763ec34f9ee8 upstream.

The early-exit pathway in hub_activate, added by commit e50293ef9775 ("USB: fix invalid memory access in hub_activate()") needs improvement. It duplicates code that is already present at the end of the subroutine, and it neglects to undo the effect of a usb_autopm_get_interface_no_resume() call.

This patch fixes both problems by making the early-exit pathway jump directly to the end of the subroutine. It simplifies the code at the end by merging two conditionals that actually test the same condition although they appear different: If type < HUB_INIT3 then type must be either HUB_INIT2 or HUB_INIT, and it can't be HUB_INIT because in that case the subroutine would have exited earlier.

---
 drivers/usb/core/hub.c |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/usb/core/hub.c +6 -9
@@ -1055,11 +1055,8 @@ static void hub_activate(struct usb_hub
 		device_lock(hub->intfdev);
 
 		/* Was the hub disconnected while we were waiting? */
-		if (hub->disconnected) {
-			device_unlock(hub->intfdev);
-			kref_put(&hub->kref, hub_release);
-			return;
-		}
+		if (hub->disconnected)
+			goto disconnected;
 		if (type == HUB_INIT2)
 			goto init2;
 		goto init3;
@@ -1281,12 +1278,12 @@ static void hub_activate(struct usb_hub
 	/* Scan all ports that need attention */
 	kick_hub_wq(hub);
 
-	/* Allow autosuspend if it was suppressed */
-	if (type <= HUB_INIT3)
+	if (type == HUB_INIT2 || type == HUB_INIT3) {
+		/* Allow autosuspend if it was suppressed */
+ disconnected:
 		usb_autopm_put_interface_async(to_usb_interface(hub->intfdev));
-
-	if (type == HUB_INIT2 || type == HUB_INIT3)
 		device_unlock(hub->intfdev);
+	}
 
 	kref_put(&hub->kref, hub_release);
 }
author maintainer
#36 lore raw

PATCH 38/143 USB: hub: change the locking in hub_activate

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Alan Stern <[email protected]>

commit 07d316a22e119fa301fd7dba7f1e1adfd4f72c05 upstream.

The locking in hub_activate() is not adequate to provide full mutual exclusion with hub_quiesce(). The subroutine locks the hub's usb_interface, but the callers of hub_quiesce() (such as hub_pre_reset() and hub_event()) hold the lock to the hub's usb_device.

This patch changes hub_activate() to make it acquire the same lock as those other routines.

---
 drivers/usb/core/hub.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/core/hub.c +3 -3
@@ -1052,7 +1052,7 @@ static void hub_activate(struct usb_hub
 
 	/* Continue a partial initialization */
 	if (type == HUB_INIT2 || type == HUB_INIT3) {
-		device_lock(hub->intfdev);
+		device_lock(&hdev->dev);
 
 		/* Was the hub disconnected while we were waiting? */
 		if (hub->disconnected)
@@ -1259,7 +1259,7 @@ static void hub_activate(struct usb_hub
 			queue_delayed_work(system_power_efficient_wq,
 					&hub->init_work,
 					msecs_to_jiffies(delay));
-			device_unlock(hub->intfdev);
+			device_unlock(&hdev->dev);
 			return;		/* Continues at init3: below */
 		} else {
 			msleep(delay);
@@ -1282,7 +1282,7 @@ static void hub_activate(struct usb_hub
 		/* Allow autosuspend if it was suppressed */
  disconnected:
 		usb_autopm_put_interface_async(to_usb_interface(hub->intfdev));
-		device_unlock(hub->intfdev);
+		device_unlock(&hdev->dev);
 	}
 
 	kref_put(&hub->kref, hub_release);
author maintainer
#37 lore raw

PATCH 39/143 usb: renesas_usbhs: Fix receiving data corrupt on R-Car Gen3 with dmac

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Yoshihiro Shimoda <[email protected]>

commit 772ce81264b179c0e61340998e3b29e900b2fa6d upstream.

Since R-Car Gen3 SoC has the USB-DMAC, this driver should set dparam->has_usb_dmac to 1. Otherwise, behavior of this driver and the usb-dmac driver will be mismatch, then sometimes receiving data will be corrupt.

Fixes de18757e272d ("usb: renesas_usbhs: add R-Car Gen3 power control")
---
 drivers/usb/renesas_usbhs/common.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/renesas_usbhs/common.c +2 -1
@@ -514,7 +514,8 @@ static struct renesas_usbhs_platform_inf
 	if (gpio > 0)
 		dparam->enable_gpio = gpio;
 
-	if (dparam->type == USBHS_TYPE_RCAR_GEN2)
+	if (dparam->type == USBHS_TYPE_RCAR_GEN2 ||
+	    dparam->type == USBHS_TYPE_RCAR_GEN3)
 		dparam->has_usb_dmac = 1;
 
 	return info;
author maintainer
#38 lore raw

PATCH 40/143 usb: renesas_usbhs: clear the BRDYSTS in usbhsg_ep_enable()

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Yoshihiro Shimoda <[email protected]>

commit 9ab967e6db7412b675ecbff80d5371d53c82cb2e upstream.

This patch fixes an issue that unexpected BRDY interruption happens when the usb_ep_{enable,disable}() are called with different direction. In this case, the driver will cause the following message:

renesas_usbhs e6590000.usb: irq_ready run_error 1 : -16

This issue causes the followings:
1) A pipe is enabled as transmission
2) The pipe sent a data
3) The pipe is disabled and re-enabled as reception.
4) The pipe got a queue

Since the driver doesn't clear the BRDYSTS flags after 2) above, the issue happens. If we add such clearing the flags into the driver, the code will become complicate. So, this patch clears the BRDYSTS flag of reception in usbhsg_ep_enable() to avoid complicate.

---
 drivers/usb/renesas_usbhs/mod_gadget.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/renesas_usbhs/mod_gadget.c +5 -2
@@ -617,10 +617,13 @@ static int usbhsg_ep_enable(struct usb_e
 		 * use dmaengine if possible.
 		 * It will use pio handler if impossible.
 		 */
-		if (usb_endpoint_dir_in(desc))
+		if (usb_endpoint_dir_in(desc)) {
 			pipe->handler = &usbhs_fifo_dma_push_handler;
-		else
+		} else {
 			pipe->handler = &usbhs_fifo_dma_pop_handler;
+			usbhs_xxxsts_clear(priv, BRDYSTS,
+					   usbhs_pipe_number(pipe));
+		}
 
 		ret = 0;
 	}
author maintainer
#39 lore raw

PATCH 41/143 usb: renesas_usbhs: Use dmac only if the pipe type is bulk

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Yoshihiro Shimoda <[email protected]>

commit 700aa7ff8d2c2b9cc669c99375e2ccd06d3cd38d upstream.

This patch fixes an issue that isochronous transfer's data is possible to be lost as a workaround. Since this driver uses a workqueue to start the dmac, the transfer is possible to be delayed when system load is high.

Fixes 6e4b74e4690d ("usb: renesas: fix scheduling in atomic context bug")
---
 drivers/usb/renesas_usbhs/fifo.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/renesas_usbhs/fifo.c +2 -2
@@ -871,7 +871,7 @@ static int usbhsf_dma_prepare_push(struc
 
 	/* use PIO if packet is less than pio_dma_border or pipe is DCP */
 	if ((len < usbhs_get_dparam(priv, pio_dma_border)) ||
-	    usbhs_pipe_is_dcp(pipe))
+	    usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_ISOC))
 		goto usbhsf_pio_prepare_push;
 
 	/* check data length if this driver don't use USB-DMAC */
@@ -976,7 +976,7 @@ static int usbhsf_dma_prepare_pop_with_u
 
 	/* use PIO if packet is less than pio_dma_border or pipe is DCP */
 	if ((pkt->length < usbhs_get_dparam(priv, pio_dma_border)) ||
-	    usbhs_pipe_is_dcp(pipe))
+	    usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_ISOC))
 		goto usbhsf_pio_prepare_pop;
 
 	fifo = usbhsf_get_dma_fifo(priv, pkt);
author maintainer
#40 lore raw

PATCH 42/143 clk: renesas: r8a7795: Fix SD clocks

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Yoshihiro Shimoda <[email protected]>

commit e0cb1b84163720ec67ff0e54397fd3f57ad4a4dd upstream.

According to the datasheet, SDn clocks are from the SDSRC clock. And the SDSRC has a 1/2 divider. So, we should have ".sdsrc" as an internal core clock. Otherwise, since the sdhi driver will calculate clock for a sd card using the wrong parent clock rate, and then performance will be not good.

Fixes 90c073e53909da85 ("clk: shmobile: r8a7795: Add SD divider support")
---
 drivers/clk/renesas/r8a7795-cpg-mssr.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/clk/renesas/r8a7795-cpg-mssr.c +5 -4
@@ -91,6 +91,7 @@ static const struct cpg_core_clk r8a7795
 	DEF_FIXED(".s1",        CLK_S1,            CLK_PLL1_DIV2,  3, 1),
 	DEF_FIXED(".s2",        CLK_S2,            CLK_PLL1_DIV2,  4, 1),
 	DEF_FIXED(".s3",        CLK_S3,            CLK_PLL1_DIV2,  6, 1),
+	DEF_FIXED(".sdsrc",     CLK_SDSRC,         CLK_PLL1_DIV2,  2, 1),
 
 	/* Core Clock Outputs */
 	DEF_FIXED("ztr",        R8A7795_CLK_ZTR,   CLK_PLL1_DIV2,  6, 1),
@@ -109,10 +110,10 @@ static const struct cpg_core_clk r8a7795
 	DEF_FIXED("s3d2",       R8A7795_CLK_S3D2,  CLK_S3,         2, 1),
 	DEF_FIXED("s3d4",       R8A7795_CLK_S3D4,  CLK_S3,         4, 1),
 
-	DEF_GEN3_SD("sd0",      R8A7795_CLK_SD0,   CLK_PLL1_DIV2, 0x0074),
-	DEF_GEN3_SD("sd1",      R8A7795_CLK_SD1,   CLK_PLL1_DIV2, 0x0078),
-	DEF_GEN3_SD("sd2",      R8A7795_CLK_SD2,   CLK_PLL1_DIV2, 0x0268),
-	DEF_GEN3_SD("sd3",      R8A7795_CLK_SD3,   CLK_PLL1_DIV2, 0x026c),
+	DEF_GEN3_SD("sd0",      R8A7795_CLK_SD0,   CLK_SDSRC,     0x0074),
+	DEF_GEN3_SD("sd1",      R8A7795_CLK_SD1,   CLK_SDSRC,     0x0078),
+	DEF_GEN3_SD("sd2",      R8A7795_CLK_SD2,   CLK_SDSRC,     0x0268),
+	DEF_GEN3_SD("sd3",      R8A7795_CLK_SD3,   CLK_SDSRC,     0x026c),
 
 	DEF_FIXED("cl",         R8A7795_CLK_CL,    CLK_PLL1_DIV2, 48, 1),
 	DEF_FIXED("cp",         R8A7795_CLK_CP,    CLK_EXTAL,      2, 1),
author maintainer
#41 lore raw

PATCH 43/143 USB: validate wMaxPacketValue entries in endpoint descriptors

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Alan Stern <[email protected]>

commit aed9d65ac3278d4febd8665bd7db59ef53e825fe upstream.

Erroneous or malicious endpoint descriptors may have non-zero bits in reserved positions, or out-of-bounds values. This patch helps prevent these from causing problems by bounds-checking the wMaxPacketValue entries in endpoint descriptors and capping the values at the maximum allowed.

This issue was first discovered and tests were conducted by Jake Lamberson <[email protected]>, an intern working for Rosie Hall.

---
 drivers/usb/core/config.c |   66 +++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 63 insertions(+), 3 deletions(-)
drivers/usb/core/config.c +63 -3
@@ -171,6 +171,31 @@ static void usb_parse_ss_endpoint_compan
 							ep, buffer, size);
 }
 
+static const unsigned short low_speed_maxpacket_maxes[4] = {
+	[USB_ENDPOINT_XFER_CONTROL] = 8,
+	[USB_ENDPOINT_XFER_ISOC] = 0,
+	[USB_ENDPOINT_XFER_BULK] = 0,
+	[USB_ENDPOINT_XFER_INT] = 8,
+};
+static const unsigned short full_speed_maxpacket_maxes[4] = {
+	[USB_ENDPOINT_XFER_CONTROL] = 64,
+	[USB_ENDPOINT_XFER_ISOC] = 1023,
+	[USB_ENDPOINT_XFER_BULK] = 64,
+	[USB_ENDPOINT_XFER_INT] = 64,
+};
+static const unsigned short high_speed_maxpacket_maxes[4] = {
+	[USB_ENDPOINT_XFER_CONTROL] = 64,
+	[USB_ENDPOINT_XFER_ISOC] = 1024,
+	[USB_ENDPOINT_XFER_BULK] = 512,
+	[USB_ENDPOINT_XFER_INT] = 1023,
+};
+static const unsigned short super_speed_maxpacket_maxes[4] = {
+	[USB_ENDPOINT_XFER_CONTROL] = 512,
+	[USB_ENDPOINT_XFER_ISOC] = 1024,
+	[USB_ENDPOINT_XFER_BULK] = 1024,
+	[USB_ENDPOINT_XFER_INT] = 1024,
+};
+
 static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
     int asnum, struct usb_host_interface *ifp, int num_ep,
     unsigned char *buffer, int size)
@@ -179,6 +204,8 @@ static int usb_parse_endpoint(struct dev
 	struct usb_endpoint_descriptor *d;
 	struct usb_host_endpoint *endpoint;
 	int n, i, j, retval;
+	unsigned int maxp;
+	const unsigned short *maxpacket_maxes;
 
 	d = (struct usb_endpoint_descriptor *) buffer;
 	buffer += d->bLength;
@@ -286,6 +313,42 @@ static int usb_parse_endpoint(struct dev
 			endpoint->desc.wMaxPacketSize = cpu_to_le16(8);
 	}
 
+	/* Validate the wMaxPacketSize field */
+	maxp = usb_endpoint_maxp(&endpoint->desc);
+
+	/* Find the highest legal maxpacket size for this endpoint */
+	i = 0;		/* additional transactions per microframe */
+	switch (to_usb_device(ddev)->speed) {
+	case USB_SPEED_LOW:
+		maxpacket_maxes = low_speed_maxpacket_maxes;
+		break;
+	case USB_SPEED_FULL:
+		maxpacket_maxes = full_speed_maxpacket_maxes;
+		break;
+	case USB_SPEED_HIGH:
+		/* Bits 12..11 are allowed only for HS periodic endpoints */
+		if (usb_endpoint_xfer_int(d) || usb_endpoint_xfer_isoc(d)) {
+			i = maxp & (BIT(12) | BIT(11));
+			maxp &= ~i;
+		}
+		/* fallthrough */
+	default:
+		maxpacket_maxes = high_speed_maxpacket_maxes;
+		break;
+	case USB_SPEED_SUPER:
+	case USB_SPEED_SUPER_PLUS:
+		maxpacket_maxes = super_speed_maxpacket_maxes;
+		break;
+	}
+	j = maxpacket_maxes[usb_endpoint_type(&endpoint->desc)];
+
+	if (maxp > j) {
+		dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid maxpacket %d, setting to %d\n",
+		    cfgno, inum, asnum, d->bEndpointAddress, maxp, j);
+		maxp = j;
+		endpoint->desc.wMaxPacketSize = cpu_to_le16(i | maxp);
+	}
+
 	/*
 	 * Some buggy high speed devices have bulk endpoints using
 	 * maxpacket sizes other than 512.  High speed HCDs may not
@@ -293,9 +356,6 @@ static int usb_parse_endpoint(struct dev
 	 */
 	if (to_usb_device(ddev)->speed == USB_SPEED_HIGH
 			&& usb_endpoint_xfer_bulk(d)) {
-		unsigned maxp;
-
-		maxp = usb_endpoint_maxp(&endpoint->desc) & 0x07ff;
 		if (maxp != 512)
 			dev_warn(ddev, "config %d interface %d altsetting %d "
 				"bulk endpoint 0x%X has invalid maxpacket %d\n",
author maintainer
#42 lore raw

PATCH 44/143 usb: gadget: fsl_qe_udc: off by one in setup_received_handle()

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <[email protected]>

commit 7442e6db5bdd0dce4615205508301f9b22e502d6 upstream.

The udc->eps[] array has USB_MAX_ENDPOINTS elements so > should be >=.

Fixes 3948f0e0c999 ('usb: add Freescale QE/CPM USB peripheral controller driver')
---
 drivers/usb/gadget/udc/fsl_qe_udc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/fsl_qe_udc.c +1 -1
@@ -2053,7 +2053,7 @@ static void setup_received_handle(struct
 			struct qe_ep *ep;
 
 			if (wValue != 0 || wLength != 0
-				|| pipe > USB_MAX_ENDPOINTS)
+				|| pipe >= USB_MAX_ENDPOINTS)
 				break;
 			ep = &udc->eps[pipe];
 
author maintainer
#43 lore raw

PATCH 46/143 xhci: always handle "Command Ring Stopped" events

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Mathias Nyman <[email protected]>

commit 33be126510974e2eb9679f1ca9bca4f67ee4c4c7 upstream.

Fix "Command completion event does not match command" errors by always handling the command ring stopped events.

The command ring stopped event is generated as a result of aborting or stopping the command ring with a register write. It is not caused by a command in the command queue, and thus won't have a matching command in the comman list.

Solve it by handling the command ring stopped event before checking for a matching command.

In most command time out cases we abort the command ring, and get a command ring stopped event. The events command pointer will point at the current command ring dequeue, which in most cases matches the timed out command in the command list, and no error messages are seen.

If we instead get a command aborted event before the command ring stopped event, the abort event will increse the command ring dequeue pointer, and the following command ring stopped events command pointer will point at the next, not yet queued command. This case triggered the error message

---
 drivers/usb/host/xhci-ring.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/usb/host/xhci-ring.c +7 -6
@@ -1325,12 +1325,6 @@ static void handle_cmd_completion(struct
 
 	cmd = list_entry(xhci->cmd_list.next, struct xhci_command, cmd_list);
 
-	if (cmd->command_trb != xhci->cmd_ring->dequeue) {
-		xhci_err(xhci,
-			 "Command completion event does not match command\n");
-		return;
-	}
-
 	del_timer(&xhci->cmd_timer);
 
 	trace_xhci_cmd_completion(cmd_trb, (struct xhci_generic_trb *) event);
@@ -1342,6 +1336,13 @@ static void handle_cmd_completion(struct
 		xhci_handle_stopped_cmd_ring(xhci, cmd);
 		return;
 	}
+
+	if (cmd->command_trb != xhci->cmd_ring->dequeue) {
+		xhci_err(xhci,
+			 "Command completion event does not match command\n");
+		return;
+	}
+
 	/*
 	 * Host aborted the command ring, check if the current command was
 	 * supposed to be aborted, otherwise continue normally.
author maintainer
#44 lore raw

PATCH 47/143 usb: xhci: Fix panic if disconnect

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Jim Lin <[email protected]>

commit 88716a93766b8f095cdef37a8e8f2c93aa233b21 upstream.

After a device is disconnected, xhci_stop_device() will be invoked in xhci_bus_suspend().
Also the "disconnect" IRQ will have ISR to invoke xhci_free_virt_device() in this sequence.
xhci_irq -> xhci_handle_event -> handle_cmd_completion -> xhci_handle_cmd_disable_slot -> xhci_free_virt_device

If xhci->devs[slot_id] has been assigned to NULL in xhci_free_virt_device(), then virt_dev->eps[i].ring in xhci_stop_device() may point to an invlid address to cause kernel panic.

virt_dev = xhci->devs[slot_id];
:
if (virt_dev->eps[i].ring && virt_dev->eps[i].ring->dequeue)

[] Unable to handle kernel paging request at virtual address 00001a68 [] pgd=ffffffc001430000
[] [00001a68] *pgd=000000013c807003, *pud=000000013c807003, *pmd=000000013c808003, *pte=0000000000000000
[] Internal error: Oops: 96000006 [#1] PREEMPT SMP
[] CPU: 0 PID: 39 Comm: kworker/0:1 Tainted: G U
[] Workqueue: pm pm_runtime_work
[] task: ffffffc0bc0e0bc0 ti: ffffffc0bc0ec000 task.ti:
ffffffc0bc0ec000
[] PC is at xhci_stop_device.constprop.11+0xb4/0x1a4

This issue is found when running with realtek ethernet device (0bda:8153).

---
 drivers/usb/host/xhci-hub.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/usb/host/xhci-hub.c +3 -0
@@ -386,6 +386,9 @@ static int xhci_stop_device(struct xhci_
 
 	ret = 0;
 	virt_dev = xhci->devs[slot_id];
+	if (!virt_dev)
+		return -ENODEV;
+
 	cmd = xhci_alloc_command(xhci, false, true, GFP_NOIO);
 	if (!cmd) {
 		xhci_dbg(xhci, "Couldn't allocate command structure.\n");
author maintainer
#45 lore raw

PATCH 48/143 xhci: dont dereference a xhci member after removing xhci

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Mathias Nyman <[email protected]>

commit f1f6d9a8b540df22b87a5bf6bc104edaade81f47 upstream.

Remove the hcd after checking for the xhci last quirks, not before.

This caused a hang on a Alpine Ridge xhci based maching which remove the whole xhci controller when unplugging the last usb device

---
 drivers/usb/host/xhci-pci.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-pci.c +2 -1
@@ -314,11 +314,12 @@ static void xhci_pci_remove(struct pci_d
 		usb_remove_hcd(xhci->shared_hcd);
 		usb_put_hcd(xhci->shared_hcd);
 	}
-	usb_hcd_pci_remove(dev);
 
 	/* Workaround for spurious wakeups at shutdown with HSW */
 	if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
 		pci_set_power_state(dev, PCI_D3hot);
+
+	usb_hcd_pci_remove(dev);
 }
 
 #ifdef CONFIG_PM
author maintainer
#46 lore raw

PATCH 49/143 USB: serial: fix memleak in driver-registration error path

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Alexey Klimov <[email protected]>

commit 647024a7df36014bbc4479d92d88e6b77c0afcf6 upstream.

udriver struct allocated by kzalloc() will not be freed if usb_register() and next calls fail. This patch fixes this by adding one more step with kfree(udriver) in error path.

---
 drivers/usb/serial/usb-serial.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/serial/usb-serial.c +3 -1
@@ -1433,7 +1433,7 @@ int usb_serial_register_drivers(struct u
 
 	rc = usb_register(udriver);
 	if (rc)
-		return rc;
+		goto failed_usb_register;
 
 	for (sd = serial_drivers; *sd; ++sd) {
 		(*sd)->usb_driver = udriver;
@@ -1451,6 +1451,8 @@ int usb_serial_register_drivers(struct u
 	while (sd-- > serial_drivers)
 		usb_serial_deregister(*sd);
 	usb_deregister(udriver);
+failed_usb_register:
+	kfree(udriver);
 	return rc;
 }
 EXPORT_SYMBOL_GPL(usb_serial_register_drivers);
author maintainer
#47 lore raw

PATCH 50/143 USB: serial: option: add D-Link DWM-156/A3

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Lubomir Rintel <[email protected]>

commit cf1b18030de29e4e5b0a57695ae5db4a89da0ff7 upstream.

The device has four interfaces; the three serial ports ought to be handled by this driver:

00 Diagnostic interface serial port
01 NMEA device serial port
02 Mass storage (sd card)
03 Modem serial port

The other product ids listed in the Windows driver are present already.

---
 drivers/usb/serial/option.c |    1 +
 1 file changed, 1 insertion(+)
drivers/usb/serial/option.c +1 -0
@@ -1966,6 +1966,7 @@ static const struct usb_device_id option
 	  .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
 	{ USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */
 	{ USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */
+	{ USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x7e11, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/A3 */
 	{ USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) },                /* OLICARD300 - MT6225 */
 	{ USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) },
 	{ USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) },
author maintainer
#48 lore raw

PATCH 51/143 USB: serial: option: add support for Telit LE920A4

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Daniele Palmas <[email protected]>

commit 01d7956b58e644ea0d2e8d9340c5727a8fc39d70 upstream.

This patch adds a set of compositions for Telit LE920A4.

Compositions in short are:

0x1207: tty + tty
0x1208: tty + adb + tty + tty
0x1211: tty + adb + ecm
0x1212: tty + adb
0x1213: ecm + tty
0x1214: tty + adb + ecm + tty

telit_le922_blacklist_usbcfg3 is reused for compositions 0x1211 and 0x1214 due to the same interfaces positions.

---
 drivers/usb/serial/option.c |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
drivers/usb/serial/option.c +21 -0
@@ -274,6 +274,12 @@ static void option_instat_callback(struc
 #define TELIT_PRODUCT_LE920			0x1200
 #define TELIT_PRODUCT_LE910			0x1201
 #define TELIT_PRODUCT_LE910_USBCFG4		0x1206
+#define TELIT_PRODUCT_LE920A4_1207		0x1207
+#define TELIT_PRODUCT_LE920A4_1208		0x1208
+#define TELIT_PRODUCT_LE920A4_1211		0x1211
+#define TELIT_PRODUCT_LE920A4_1212		0x1212
+#define TELIT_PRODUCT_LE920A4_1213		0x1213
+#define TELIT_PRODUCT_LE920A4_1214		0x1214
 
 /* ZTE PRODUCTS */
 #define ZTE_VENDOR_ID				0x19d2
@@ -628,6 +634,11 @@ static const struct option_blacklist_inf
 	.reserved = BIT(1) | BIT(5),
 };
 
+static const struct option_blacklist_info telit_le920a4_blacklist_1 = {
+	.sendsetup = BIT(0),
+	.reserved = BIT(1),
+};
+
 static const struct option_blacklist_info telit_le922_blacklist_usbcfg0 = {
 	.sendsetup = BIT(2),
 	.reserved = BIT(0) | BIT(1) | BIT(3),
@@ -1203,6 +1214,16 @@ static const struct usb_device_id option
 		.driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 },
 	{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920),
 		.driver_info = (kernel_ulong_t)&telit_le920_blacklist },
+	{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1207) },
+	{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1208),
+		.driver_info = (kernel_ulong_t)&telit_le920a4_blacklist_1 },
+	{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1211),
+		.driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 },
+	{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1212),
+		.driver_info = (kernel_ulong_t)&telit_le920a4_blacklist_1 },
+	{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1213, 0xff) },
+	{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1214),
+		.driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff),
 		.driver_info = (kernel_ulong_t)&net_intf1_blacklist },
author maintainer
#49 lore raw

PATCH 52/143 USB: serial: ftdi_sio: add device ID for WICED USB UART dev board

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Sheng-Hui J. Chu <[email protected]>

commit ae34d12cc1e212ffcd92e069030e54dae69c832f upstream.

BCM20706V2_EVAL is a WICED dev board designed with FT2232H USB 2.0 UART/FIFO IC.

To support BCM920706V2_EVAL dev board for WICED development on Linux. Add the VID(0a5c) and PID(6422) to ftdi_sio driver to allow loading ftdi_sio for this board.

---
 drivers/usb/serial/ftdi_sio.c     |    1 +
 drivers/usb/serial/ftdi_sio_ids.h |    6 ++++++
 2 files changed, 7 insertions(+)
drivers/usb/serial/ftdi_sio.c +1 -0
@@ -1008,6 +1008,7 @@ static const struct usb_device_id id_tab
 	{ USB_DEVICE(ICPDAS_VID, ICPDAS_I7560U_PID) },
 	{ USB_DEVICE(ICPDAS_VID, ICPDAS_I7561U_PID) },
 	{ USB_DEVICE(ICPDAS_VID, ICPDAS_I7563U_PID) },
+	{ USB_DEVICE(WICED_VID, WICED_USB20706V2_PID) },
 	{ }					/* Terminating entry */
 };
 
drivers/usb/serial/ftdi_sio_ids.h +6 -0
@@ -673,6 +673,12 @@
 #define INTREPID_NEOVI_PID	0x0701
 
 /*
+ * WICED USB UART
+ */
+#define WICED_VID		0x0A5C
+#define WICED_USB20706V2_PID	0x6422
+
+/*
  * Definitions for ID TECH (www.idt-net.com) devices
  */
 #define IDTECH_VID		0x0ACD	/* ID TECH Vendor ID */
author maintainer
#50 lore raw

PATCH 54/143 uprobes: Fix the memcg accounting

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Oleg Nesterov <[email protected]>

commit 6c4687cc17a788a6dd8de3e27dbeabb7cbd3e066 upstream.

__replace_page() wronlgy calls mem_cgroup_cancel_charge() in "success" path, it should only do this if page_check_address() fails.

This means that every enable/disable leads to unbalanced mem_cgroup_uncharge() from put_page(old_page), it is trivial to underflow the page_counter->count and trigger OOM.

Cc Alexander Shishkin <[email protected]>
Cc Alexei Starovoitov <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Vladimir Davydov <[email protected]>
Fixes 00501b531c47 ("mm: memcontrol: rewrite charge API")
---
 kernel/events/uprobes.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/events/uprobes.c +3 -2
@@ -172,8 +172,10 @@ static int __replace_page(struct vm_area
 	mmu_notifier_invalidate_range_start(mm, mmun_start, mmun_end);
 	err = -EAGAIN;
 	ptep = page_check_address(page, mm, addr, &ptl, 0);
-	if (!ptep)
+	if (!ptep) {
+		mem_cgroup_cancel_charge(kpage, memcg, false);
 		goto unlock;
+	}
 
 	get_page(kpage);
 	page_add_new_anon_rmap(kpage, vma, addr, false);
@@ -200,7 +202,6 @@ static int __replace_page(struct vm_area
 
 	err = 0;
  unlock:
-	mem_cgroup_cancel_charge(kpage, memcg, false);
 	mmu_notifier_invalidate_range_end(mm, mmun_start, mmun_end);
 	unlock_page(page);
 	return err;
author maintainer
#51 lore raw

PATCH 55/143 perf symbols: Fix annotation of objects with debuginfo files

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Anton Blanchard <[email protected]>

commit 50de1a0c54cdbc69a6dbcbc323f53daf95a4050e upstream.

Commit 73cdf0c6ea9c ("perf symbols: Record text offset in dso to calculate objdump address") started storing the offset of the text section for all DSOs:

       if (elf_section_by_name(elf, &ehdr, &tshdr, ".text", NULL))
               dso->text_offset = tshdr.sh_addr - tshdr.sh_offset;

Unfortunately this breaks debuginfo files, because we need to calculate the offset of the text section in the associated executable file. As a result perf annotate returns junk for all debuginfo files.

Fix this by using runtime_ss->elf which should point at the executable when parsing a debuginfo file.

Cc Peter Zijlstra <[email protected]>
Cc Ravi Bangoria <[email protected]>
Fixes 73cdf0c6ea9c ("perf symbols: Record text offset in dso to calculate objdump address")
---
 tools/perf/util/symbol-elf.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/symbol-elf.c +2 -1
@@ -827,7 +827,8 @@ int dso__load_sym(struct dso *dso, struc
 	sec = syms_ss->symtab;
 	shdr = syms_ss->symshdr;
 
-	if (elf_section_by_name(elf, &ehdr, &tshdr, ".text", NULL))
+	if (elf_section_by_name(runtime_ss->elf, &runtime_ss->ehdr, &tshdr,
+				".text", NULL))
 		dso->text_offset = tshdr.sh_addr - tshdr.sh_offset;
 
 	if (runtime_ss->opdsec)
author maintainer
#52 lore raw

PATCH 56/143 perf/core: Fix event_function_local()

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Peter Zijlstra <[email protected]>

commit cca2094605efe6ccf43ff2876dd5bccc799202d8 upstream.

Vincent reported triggering the WARN_ON_ONCE() in event_function_local().

While thinking through cases I noticed that by using event_function() directly, we miss the inactive case usually handled by event_function_call().

Therefore construct a blend of event_function_call() and event_function() that handles the cases relevant to event_function_local().

Cc Alexander Shishkin <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
Cc Thomas Gleixner <[email protected]>
Fixes fae3fde65138 ("perf: Collapse and fix event_function_call() users")
---
 kernel/events/core.c |   60 ++++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 48 insertions(+), 12 deletions(-)
kernel/events/core.c +48 -12
@@ -242,18 +242,6 @@ unlock:
 	return ret;
 }
 
-static void event_function_local(struct perf_event *event, event_f func, void *data)
-{
-	struct event_function_struct efs = {
-		.event = event,
-		.func = func,
-		.data = data,
-	};
-
-	int ret = event_function(&efs);
-	WARN_ON_ONCE(ret);
-}
-
 static void event_function_call(struct perf_event *event, event_f func, void *data)
 {
 	struct perf_event_context *ctx = event->ctx;
@@ -303,6 +291,54 @@ again:
 	raw_spin_unlock_irq(&ctx->lock);
 }
 
+/*
+ * Similar to event_function_call() + event_function(), but hard assumes IRQs
+ * are already disabled and we're on the right CPU.
+ */
+static void event_function_local(struct perf_event *event, event_f func, void *data)
+{
+	struct perf_event_context *ctx = event->ctx;
+	struct perf_cpu_context *cpuctx = __get_cpu_context(ctx);
+	struct task_struct *task = READ_ONCE(ctx->task);
+	struct perf_event_context *task_ctx = NULL;
+
+	WARN_ON_ONCE(!irqs_disabled());
+
+	if (task) {
+		if (task == TASK_TOMBSTONE)
+			return;
+
+		task_ctx = ctx;
+	}
+
+	perf_ctx_lock(cpuctx, task_ctx);
+
+	task = ctx->task;
+	if (task == TASK_TOMBSTONE)
+		goto unlock;
+
+	if (task) {
+		/*
+		 * We must be either inactive or active and the right task,
+		 * otherwise we're screwed, since we cannot IPI to somewhere
+		 * else.
+		 */
+		if (ctx->is_active) {
+			if (WARN_ON_ONCE(task != current))
+				goto unlock;
+
+			if (WARN_ON_ONCE(cpuctx->task_ctx != ctx))
+				goto unlock;
+		}
+	} else {
+		WARN_ON_ONCE(&cpuctx->ctx != ctx);
+	}
+
+	func(event, cpuctx, ctx, data);
+unlock:
+	perf_ctx_unlock(cpuctx, task_ctx);
+}
+
 #define PERF_FLAG_ALL (PERF_FLAG_FD_NO_GROUP |\
 		       PERF_FLAG_FD_OUTPUT  |\
 		       PERF_FLAG_PID_CGROUP |\
author maintainer
#53 lore raw

PATCH 57/143 perf tools mem: Fix -t store option for record command

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Jiri Olsa <[email protected]>

commit 33da54fa86e29b87fe1e83bd0f15b4ef2be53ecb upstream.

Michael reported 'perf mem -t store record' being broken. The reason is latest rework of this area:

commit acbe613e0c03 ("perf tools: Add monitored events array")

We don't mark perf_mem_events store record when -t store option is specified.

Committer notes:

Before:

  # perf mem -t store record usleep 1
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.020 MB perf.data (7 samples) ]
  # perf evlist
  cycles:ppp
  #

After:

  # perf mem -t store record usleep 1
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.020 MB perf.data (7 samples) ]
  # perf evlist
  cpu/mem-stores/P
  #
---
 tools/perf/builtin-mem.c |    3 +++
 1 file changed, 3 insertions(+)
tools/perf/builtin-mem.c +3 -0
@@ -87,6 +87,9 @@ static int __cmd_record(int argc, const
 	if (mem->operation & MEM_OPERATION_LOAD)
 		perf_mem_events[PERF_MEM_EVENTS__LOAD].record = true;
 
+	if (mem->operation & MEM_OPERATION_STORE)
+		perf_mem_events[PERF_MEM_EVENTS__STORE].record = true;
+
 	if (perf_mem_events[PERF_MEM_EVENTS__LOAD].record)
 		rec_argv[i++] = "-W";
 
author maintainer
#54 lore raw

PATCH 58/143 iommu/dma: Dont put uninitialised IOVA domains

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Robin Murphy <[email protected]>

commit 3ec60043f7c02e1f79e4a90045ff2d2e80042941 upstream.

Due to the limitations of having to wait until we see a device's DMA restrictions before we know how we want an IOVA domain initialised, there is a window for error if a DMA ops domain is allocated but later freed without ever being used. In that case, init_iova_domain() was never called, so calling put_iova_domain() from iommu_put_dma_cookie() ends up trying to take an uninitialised lock and crashing.

Make things robust by skipping the call unless the IOVA domain actually has been initialised, as we probably should have done from the start.

---
 drivers/iommu/dma-iommu.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iommu/dma-iommu.c +2 -1
@@ -68,7 +68,8 @@ void iommu_put_dma_cookie(struct iommu_d
 	if (!iovad)
 		return;
 
-	put_iova_domain(iovad);
+	if (iovad->granule)
+		put_iova_domain(iovad);
 	kfree(iovad);
 	domain->iova_cookie = NULL;
 }
author maintainer
#55 lore raw

PATCH 59/143 iommu/io-pgtable-arm-v7s: Fix attributes when splitting blocks

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Robin Murphy <[email protected]>

commit e633fc7a1347528c3b4a6bbdeb41f5d63988242c upstream.

Due to the attribute bits being all over the place in the different types of short-descriptor PTEs, when remapping an existing entry, e.g. splitting a section into pages, we take the approach of decomposing the PTE attributes back to the IOMMU API flags to start from scratch.

On inspection, though, the existing code seems to have got the read-only bit backwards and ignored the XN bit. How embarrassing...

Fortunately the primary user so far, the Mediatek IOMMU, both never splits blocks (because it only serves non-overlapping DMA API calls) and also ignores permissions anyway, but let's put things right before any future users trip up.

Fixes e5fc9753b1a8 ("iommu/io-pgtable: Add ARMv7 short descriptor support")
---
 drivers/iommu/io-pgtable-arm-v7s.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iommu/io-pgtable-arm-v7s.c +3 -1
@@ -286,12 +286,14 @@ static int arm_v7s_pte_to_prot(arm_v7s_i
 	int prot = IOMMU_READ;
 	arm_v7s_iopte attr = pte >> ARM_V7S_ATTR_SHIFT(lvl);
 
-	if (attr & ARM_V7S_PTE_AP_RDONLY)
+	if (!(attr & ARM_V7S_PTE_AP_RDONLY))
 		prot |= IOMMU_WRITE;
 	if ((attr & (ARM_V7S_TEX_MASK << ARM_V7S_TEX_SHIFT)) == 0)
 		prot |= IOMMU_MMIO;
 	else if (pte & ARM_V7S_ATTR_C)
 		prot |= IOMMU_CACHE;
+	if (pte & ARM_V7S_ATTR_XN(lvl))
+		prot |= IOMMU_NOEXEC;
 
 	return prot;
 }
author maintainer
#56 lore raw

PATCH 60/143 iommu/arm-smmu: Fix CMDQ error handling

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Will Deacon <[email protected]>

commit aea2037e0d3e23c3be1498feae29f71ca997d9e6 upstream.

In the unlikely event of a global command queue error, the ARM SMMUv3 driver attempts to convert the problematic command into a CMD_SYNC and resume the command queue. Unfortunately, this code is pretty badly broken:

1. It uses the index into the error string table as the CMDQ index, so we probably read the wrong entry out of the queue

2. The arguments to queue_write are the wrong way round, so we end up writing from the queue onto the stack.

These happily cancel out, so the kernel is likely to stay alive, but the command queue will probably fault again when we resume.

This patch fixes the error handling code to use the correct queue index and write back the CMD_SYNC to the faulting entry.

Fixes 48ec83bcbcf5 ("iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices")
---
 drivers/iommu/arm-smmu-v3.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iommu/arm-smmu-v3.c +2 -2
@@ -879,7 +879,7 @@ static void arm_smmu_cmdq_skip_err(struc
 	 * We may have concurrent producers, so we need to be careful
 	 * not to touch any of the shadow cmdq state.
 	 */
-	queue_read(cmd, Q_ENT(q, idx), q->ent_dwords);
+	queue_read(cmd, Q_ENT(q, cons), q->ent_dwords);
 	dev_err(smmu->dev, "skipping command in error state:\n");
 	for (i = 0; i < ARRAY_SIZE(cmd); ++i)
 		dev_err(smmu->dev, "\t0x%016llx\n", (unsigned long long)cmd[i]);
@@ -890,7 +890,7 @@ static void arm_smmu_cmdq_skip_err(struc
 		return;
 	}
 
-	queue_write(cmd, Q_ENT(q, idx), q->ent_dwords);
+	queue_write(Q_ENT(q, cons), cmd, q->ent_dwords);
 }
 
 static void arm_smmu_cmdq_issue_cmd(struct arm_smmu_device *smmu,
author maintainer
#57 lore raw

PATCH 61/143 iommu/arm-smmu: Disable stalling faults for all endpoints

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Will Deacon <[email protected]>

commit 3714ce1d6655098ee69ede632883e5874d67e4ab upstream.

Enabling stalling faults can result in hardware deadlock on poorly designed systems, particularly those with a PCI root complex upstream of the SMMU.

Although it's not really Linux's job to save hardware integrators from their own misfortune, it *is* our job to stop userspace (e.g. VFIO clients) from hosing the system for everybody else, even if they might already be required to have elevated privileges.

Given that the fault handling code currently executes entirely in IRQ context, there is nothing that can sensibly be done to recover from things like page faults anyway, so let's rip this code out for now and avoid the potential for deadlock.

Fixes 48ec83bcbcf5 ("iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices")
---
 drivers/iommu/arm-smmu.c |   34 +++++++---------------------------
 1 file changed, 7 insertions(+), 27 deletions(-)
drivers/iommu/arm-smmu.c +7 -27
@@ -686,8 +686,7 @@ static struct iommu_gather_ops arm_smmu_
 
 static irqreturn_t arm_smmu_context_fault(int irq, void *dev)
 {
-	int flags, ret;
-	u32 fsr, fsynr, resume;
+	u32 fsr, fsynr;
 	unsigned long iova;
 	struct iommu_domain *domain = dev;
 	struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain);
@@ -701,34 +700,15 @@ static irqreturn_t arm_smmu_context_faul
 	if (!(fsr & FSR_FAULT))
 		return IRQ_NONE;
 
-	if (fsr & FSR_IGN)
-		dev_err_ratelimited(smmu->dev,
-				    "Unexpected context fault (fsr 0x%x)\n",
-				    fsr);
-
 	fsynr = readl_relaxed(cb_base + ARM_SMMU_CB_FSYNR0);
-	flags = fsynr & FSYNR0_WNR ? IOMMU_FAULT_WRITE : IOMMU_FAULT_READ;
-
 	iova = readq_relaxed(cb_base + ARM_SMMU_CB_FAR);
-	if (!report_iommu_fault(domain, smmu->dev, iova, flags)) {
-		ret = IRQ_HANDLED;
-		resume = RESUME_RETRY;
-	} else {
-		dev_err_ratelimited(smmu->dev,
-		    "Unhandled context fault: iova=0x%08lx, fsynr=0x%x, cb=%d\n",
-		    iova, fsynr, cfg->cbndx);
-		ret = IRQ_NONE;
-		resume = RESUME_TERMINATE;
-	}
 
-	/* Clear the faulting FSR */
-	writel(fsr, cb_base + ARM_SMMU_CB_FSR);
-
-	/* Retry or terminate any stalled transactions */
-	if (fsr & FSR_SS)
-		writel_relaxed(resume, cb_base + ARM_SMMU_CB_RESUME);
+	dev_err_ratelimited(smmu->dev,
+	"Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cb=%d\n",
+			    fsr, iova, fsynr, cfg->cbndx);
 
-	return ret;
+	writel(fsr, cb_base + ARM_SMMU_CB_FSR);
+	return IRQ_HANDLED;
 }
 
 static irqreturn_t arm_smmu_global_fault(int irq, void *dev)
@@ -837,7 +817,7 @@ static void arm_smmu_init_context_bank(s
 	}
 
 	/* SCTLR */
-	reg = SCTLR_CFCFG | SCTLR_CFIE | SCTLR_CFRE | SCTLR_M | SCTLR_EAE_SBOP;
+	reg = SCTLR_CFIE | SCTLR_CFRE | SCTLR_M | SCTLR_EAE_SBOP;
 	if (stage1)
 		reg |= SCTLR_S1_ASIDPNE;
 #ifdef __BIG_ENDIAN
author maintainer
#58 lore raw

PATCH 62/143 iommu/arm-smmu: Dont BUG() if we find aborting STEs with disable_bypass

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Will Deacon <[email protected]>

commit 5bc0a11664e17e9f9551983f5b660bd48b57483c upstream.

The disable_bypass cmdline option changes the SMMUv3 driver to put down faulting stream table entries by default, as opposed to bypassing transactions from unconfigured devices.

In this mode of operation, it is entirely expected to see aborting entries in the stream table if and when we come to installing a valid translation, so don't trigger a BUG() as a result of misdiagnosing these entries as stream table corruption.

Fixes 48ec83bcbcf5 ("iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices")
---
 drivers/iommu/arm-smmu-v3.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/iommu/arm-smmu-v3.c +3 -0
@@ -1034,6 +1034,9 @@ static void arm_smmu_write_strtab_ent(st
 		case STRTAB_STE_0_CFG_S2_TRANS:
 			ste_live = true;
 			break;
+		case STRTAB_STE_0_CFG_ABORT:
+			if (disable_bypass)
+				break;
 		default:
 			BUG(); /* STE corruption */
 		}
author maintainer
#59 lore raw

PATCH 63/143 pinctrl: meson: Drop pinctrl_unregister for devm_ registered device

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Wei Yongjun <[email protected]>

commit 5b236d0fde21d88351420ef0b9a6cb7aeeea0c54 upstream.

It's not necessary to unregister pin controller device registered with devm_pinctrl_register() and using pinctrl_unregister() leads to a double free.

This is detected by Coccinelle semantic patch.

Fixes e649f7ec8c5f ("pinctrl: meson: Use devm_pinctrl_register() for pinctrl registration")
---
 drivers/pinctrl/meson/pinctrl-meson.c |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/pinctrl/meson/pinctrl-meson.c +1 -7
@@ -727,13 +727,7 @@ static int meson_pinctrl_probe(struct pl
 		return PTR_ERR(pc->pcdev);
 	}
 
-	ret = meson_gpiolib_register(pc);
-	if (ret) {
-		pinctrl_unregister(pc->pcdev);
-		return ret;
-	}
-
-	return 0;
+	return meson_gpiolib_register(pc);
 }
 
 static struct platform_driver meson_pinctrl_driver = {
author maintainer
#60 lore raw

PATCH 65/143 i2c: mux: demux-pinctrl: properly roll back when adding adapter fails

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Wolfram Sang <[email protected]>

commit ce8cb803d8b90458495f23606c706f0c0c857cdc upstream.

We also need to revert the dynamic OF change, so we get a consistent state again. Otherwise, we might have two devices enabled e.g. after pinctrl setup fails.

---
 drivers/i2c/muxes/i2c-demux-pinctrl.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/i2c/muxes/i2c-demux-pinctrl.c +3 -1
@@ -68,7 +68,7 @@ static int i2c_demux_activate_master(str
 	adap = of_find_i2c_adapter_by_node(priv->chan[new_chan].parent_np);
 	if (!adap) {
 		ret = -ENODEV;
-		goto err;
+		goto err_with_revert;
 	}
 
 	p = devm_pinctrl_get_select(adap->dev.parent, priv->bus_name);
@@ -103,6 +103,8 @@ static int i2c_demux_activate_master(str
 
  err_with_put:
 	i2c_put_adapter(adap);
+ err_with_revert:
+	of_changeset_revert(&priv->chan[new_chan].chgset);
  err:
 	dev_err(priv->dev, "failed to setup demux-adapter %d (%d)\n", new_chan, ret);
 	return ret;
author maintainer
#61 lore raw

PATCH 66/143 EDAC, sb_edac: Fix channel reporting on Knights Landing

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Lukasz Odzioba <[email protected]>

commit c5b48fa7e298b9a8968a1c1fc0ef013069ca2dd2 upstream.

On Intel Xeon Phi Knights Landing processor family the channels of the memory controller have untypical arrangement - MC0 is mapped to CH3,4,5 and MC1 is mapped to CH0,1,2. This causes the EDAC driver to report the channel name incorrectly.

We missed this change earlier, so the code already contains similar comment, but the translation function is incorrect.

Without this patch:
errors in DIMM_A and DIMM_D were reported in DIMM_D errors in DIMM_B and DIMM_E were reported in DIMM_E errors in DIMM_C and DIMM_F were reported in DIMM_F

Correct this.

Hubert Chrzaniuk:
- rebased to 4.8
- comments and code cleanup

Fixes d0cdf9003140 ("sb_edac: Add Knights Landing (Xeon Phi gen 2) support")
Cc Mauro Carvalho Chehab <[email protected]>
Cc Hubert Chrzaniuk <[email protected]>
Cc linux-edac <[email protected]>
[ Boris: Simplify a bit by removing char mc. ]
---
 drivers/edac/sb_edac.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/edac/sb_edac.c +11 -4
@@ -552,9 +552,9 @@ static const struct pci_id_table pci_dev
 /* Knight's Landing Support */
 /*
  * KNL's memory channels are swizzled between memory controllers.
- * MC0 is mapped to CH3,5,6 and MC1 is mapped to CH0,1,2
+ * MC0 is mapped to CH3,4,5 and MC1 is mapped to CH0,1,2
  */
-#define knl_channel_remap(channel) ((channel + 3) % 6)
+#define knl_channel_remap(mc, chan) ((mc) ? (chan) : (chan) + 3)
 
 /* Memory controller, TAD tables, error injection - 2-8-0, 2-9-0 (2 of these) */
 #define PCI_DEVICE_ID_INTEL_KNL_IMC_MC       0x7840
@@ -1286,7 +1286,7 @@ static u32 knl_get_mc_route(int entry, u
 	mc = GET_BITFIELD(reg, entry*3, (entry*3)+2);
 	chan = GET_BITFIELD(reg, (entry*2) + 18, (entry*2) + 18 + 1);
 
-	return knl_channel_remap(mc*3 + chan);
+	return knl_channel_remap(mc, chan);
 }
 
 /*
@@ -2997,8 +2997,15 @@ static void sbridge_mce_output_error(str
 		} else {
 			char A = *("A");
 
-			channel = knl_channel_remap(channel);
+			/*
+			 * Reported channel is in range 0-2, so we can't map it
+			 * back to mc. To figure out mc we check machine check
+			 * bank register that reported this error.
+			 * bank15 means mc0 and bank16 means mc1.
+			 */
+			channel = knl_channel_remap(m->bank == 16, channel);
 			channel_mask = 1 << channel;
+
 			snprintf(msg, sizeof(msg),
 				"%s%s err_code:%04x:%04x channel:%d (DIMM_%c)",
 				overflow ? " OVERFLOW" : "",
author maintainer
#62 lore raw

PATCH 67/143 s390/dasd: fix hanging device after clear subchannel

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Stefan Haberland <[email protected]>

commit 9ba333dc55cbb9523553df973adb3024d223e905 upstream.

When a device is in a status where CIO has killed all I/O by itself the interrupt for a clear request may not contain an irb to determine the clear function. Instead it contains an error pointer -EIO. This was ignored by the DASD int_handler leading to a hanging device waiting for a clear interrupt.

Handle -EIO error pointer correctly for requests that are clear pending and treat the clear as successful.

---
 drivers/s390/block/dasd.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/s390/block/dasd.c +9 -1
@@ -1643,9 +1643,18 @@ void dasd_int_handler(struct ccw_device
 	u8 *sense = NULL;
 	int expires;
 
+	cqr = (struct dasd_ccw_req *) intparm;
 	if (IS_ERR(irb)) {
 		switch (PTR_ERR(irb)) {
 		case -EIO:
+			if (cqr && cqr->status == DASD_CQR_CLEAR_PENDING) {
+				device = (struct dasd_device *) cqr->startdev;
+				cqr->status = DASD_CQR_CLEARED;
+				dasd_device_clear_timer(device);
+				wake_up(&dasd_flush_wq);
+				dasd_schedule_device_bh(device);
+				return;
+			}
 			break;
 		case -ETIMEDOUT:
 			DBF_EVENT_DEVID(DBF_WARNING, cdev, "%s: "
@@ -1661,7 +1670,6 @@ void dasd_int_handler(struct ccw_device
 	}
 
 	now = get_tod_clock();
-	cqr = (struct dasd_ccw_req *) intparm;
 	/* check for conditions that should be handled immediately */
 	if (!cqr ||
 	    !(scsw_dstat(&irb->scsw) == (DEV_STAT_CHN_END | DEV_STAT_DEV_END) &&
author maintainer
#63 lore raw

PATCH 68/143 mac80211: fix purging multicast PS buffer queue

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Felix Fietkau <[email protected]>

commit 6b07d9ca9b5363dda959b9582a3fc9c0b89ef3b5 upstream.

The code currently assumes that buffered multicast PS frames don't have a pending ACK frame for tx status reporting.
However, hostapd sends a broadcast deauth frame on teardown for which tx status is requested. This can lead to the "Have pending ack frames" warning on module reload.
Fix this by using ieee80211_free_txskb/ieee80211_purge_tx_queue.

---
 net/mac80211/cfg.c |    2 +-
 net/mac80211/tx.c  |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
net/mac80211/cfg.c +1 -1
@@ -869,7 +869,7 @@ static int ieee80211_stop_ap(struct wiph
 
 	/* free all potentially still buffered bcast frames */
 	local->total_ps_buffered -= skb_queue_len(&sdata->u.ap.ps.bc_buf);
-	skb_queue_purge(&sdata->u.ap.ps.bc_buf);
+	ieee80211_purge_tx_queue(&local->hw, &sdata->u.ap.ps.bc_buf);
 
 	mutex_lock(&local->mtx);
 	ieee80211_vif_copy_chanctx_to_vlans(sdata, true);
net/mac80211/tx.c +3 -3
@@ -365,7 +365,7 @@ static void purge_old_ps_buffers(struct
 		skb = skb_dequeue(&ps->bc_buf);
 		if (skb) {
 			purged++;
-			dev_kfree_skb(skb);
+			ieee80211_free_txskb(&local->hw, skb);
 		}
 		total += skb_queue_len(&ps->bc_buf);
 	}
@@ -448,7 +448,7 @@ ieee80211_tx_h_multicast_ps_buf(struct i
 	if (skb_queue_len(&ps->bc_buf) >= AP_MAX_BC_BUFFER) {
 		ps_dbg(tx->sdata,
 		       "BC TX buffer full - dropping the oldest frame\n");
-		dev_kfree_skb(skb_dequeue(&ps->bc_buf));
+		ieee80211_free_txskb(&tx->local->hw, skb_dequeue(&ps->bc_buf));
 	} else
 		tx->local->total_ps_buffered++;
 
@@ -4055,7 +4055,7 @@ ieee80211_get_buffered_bc(struct ieee802
 			sdata = IEEE80211_DEV_TO_SUB_IF(skb->dev);
 		if (!ieee80211_tx_prepare(sdata, &tx, NULL, skb))
 			break;
-		dev_kfree_skb_any(skb);
+		ieee80211_free_txskb(hw, skb);
 	}
 
 	info = IEEE80211_SKB_CB(skb);
author maintainer
#64 lore raw

PATCH 69/143 arm64: kernel: avoid literal load of virtual address with MMU off

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Ard Biesheuvel <[email protected]>

commit bc9f3d7788a88d080a30599bde68f383daf8f8a5 upstream.

Literal loads of virtual addresses are subject to runtime relocation when CONFIG_RELOCATABLE=y, and given that the relocation routines run with the MMU and caches enabled, literal loads of relocated values performed with the MMU off are not guaranteed to return the latest value unless the memory covering the literal is cleaned to the PoC explicitly.

So defer the literal load until after the MMU has been enabled, just like we do for primary_switch() and secondary_switch() in head.S.

Fixes 1e48ef7fcc37 ("arm64: add support for building vmlinux as a relocatable PIE binary")
---
 arch/arm64/kernel/sleep.S |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
arch/arm64/kernel/sleep.S +9 -1
@@ -101,12 +101,20 @@ ENTRY(cpu_resume)
 	bl	el2_setup		// if in EL2 drop to EL1 cleanly
 	/* enable the MMU early - so we can access sleep_save_stash by va */
 	adr_l	lr, __enable_mmu	/* __cpu_setup will return here */
-	ldr	x27, =_cpu_resume	/* __enable_mmu will branch here */
+	adr_l	x27, _resume_switched	/* __enable_mmu will branch here */
 	adrp	x25, idmap_pg_dir
 	adrp	x26, swapper_pg_dir
 	b	__cpu_setup
 ENDPROC(cpu_resume)
 
+	.pushsection	".idmap.text", "ax"
+_resume_switched:
+	ldr	x8, =_cpu_resume
+	br	x8
+ENDPROC(_resume_switched)
+	.ltorg
+	.popsection
+
 ENTRY(_cpu_resume)
 	mrs	x1, mpidr_el1
 	adrp	x8, mpidr_hash
author maintainer
#65 lore raw

PATCH 70/143 arm64: avoid TLB conflict with CONFIG_RANDOMIZE_BASE

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Mark Rutland <[email protected]>

commit fd363bd417ddb6103564c69cfcbd92d9a7877431 upstream.

When CONFIG_RANDOMIZE_BASE is selected, we modify the page tables to remap the kernel at a newly-chosen VA range. We do this with the MMU disabled, but do not invalidate TLBs prior to re-enabling the MMU with the new tables. Thus the old mappings entries may still live in TLBs, and we risk violating Break-Before-Make requirements, leading to TLB conflicts and/or other issues.

We invalidate TLBs when we uninsall the idmap in early setup code, but prior to this we are subject to issues relating to the Break-Before-Make violation.

Avoid these issues by invalidating the TLBs before the new mappings can be used by the hardware.

Fixes f80fb3a3d508 ("arm64: add support for kernel ASLR")
---
 arch/arm64/kernel/head.S |    3 +++
 1 file changed, 3 insertions(+)
arch/arm64/kernel/head.S +3 -0
@@ -757,6 +757,9 @@ ENTRY(__enable_mmu)
 	isb
 	bl	__create_page_tables		// recreate kernel mapping
 
+	tlbi	vmalle1				// Remove any stale TLB entries
+	dsb	nsh
+
 	msr	sctlr_el1, x19			// re-enable the MMU
 	isb
 	ic	iallu				// flush instructions fetched
author maintainer
#66 lore raw

PATCH 71/143 arm64: dts: rockchip: add reset saradc node for rk3368 SoCs

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Caesar Wang <[email protected]>

commit 78ec79bfd59e126e1cb394302bfa531a420b3ecd upstream.

SARADC controller needs to be reset before programming it, otherwise it will not function properly.

---
 arch/arm64/boot/dts/rockchip/rk3368.dtsi |    2 ++
 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/rockchip/rk3368.dtsi +2 -0
@@ -270,6 +270,8 @@
 		#io-channel-cells = <1>;
 		clocks = <&cru SCLK_SARADC>, <&cru PCLK_SARADC>;
 		clock-names = "saradc", "apb_pclk";
+		resets = <&cru SRST_SARADC>;
+		reset-names = "saradc-apb";
 		status = "disabled";
 	};
 
author maintainer
#67 lore raw

PATCH 72/143 arm64: kernel: Fix unmasked debug exceptions when restoring mdscr_el1

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: James Morse <[email protected]>

commit 744c6c37cc18705d19e179622f927f5b781fe9cc upstream.

Changes to make the resume from cpu_suspend() code behave more like secondary boot caused debug exceptions to be unmasked early by __cpu_setup(). We then go on to restore mdscr_el1 in cpu_do_resume(), potentially taking break or watch points based on uninitialised registers.

Mask debug exceptions in cpu_do_resume(), which is specific to resume from cpu_suspend(). Debug exceptions will be restored to their original state by local_dbg_restore() in cpu_suspend(), which runs after hw_breakpoint_restore() has re-initialised the other registers.

Fixes cabe1c81ea5b ("arm64: Change cpu_resume() to enable mmu early then access sleep_sp by va")
---
 arch/arm64/mm/proc.S |    9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm64/mm/proc.S +9 -0
@@ -100,7 +100,16 @@ ENTRY(cpu_do_resume)
 
 	msr	tcr_el1, x8
 	msr	vbar_el1, x9
+
+	/*
+	 * __cpu_setup() cleared MDSCR_EL1.MDE and friends, before unmasking
+	 * debug exceptions. By restoring MDSCR_EL1 here, we may take a debug
+	 * exception. Mask them until local_dbg_restore() in cpu_suspend()
+	 * resets them.
+	 */
+	disable_dbg
 	msr	mdscr_el1, x10
+
 	msr	sctlr_el1, x12
 	/*
 	 * Restore oslsr_el1 by writing oslar_el1
author maintainer
#68 lore raw

PATCH 73/143 of: fix reference counting in of_graph_get_endpoint_by_regs

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Lucas Stach <[email protected]>

commit 34276bb062b8449b3b0a208c9b848a1a27920075 upstream.

The called of_graph_get_next_endpoint() already decrements the refcount of the prev node, so it is wrong to do it again in the calling function.

Use the for_each_endpoint_of_node() helper to interate through the endpoint OF nodes, which already does the right thing and simplifies the code a bit.

Fixes 8ccd0d0ca041

(of: add helper for getting endpoint node of specific identifiers)

---
 drivers/of/base.c |   11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/of/base.c +2 -9
@@ -2318,20 +2318,13 @@ struct device_node *of_graph_get_endpoin
 	const struct device_node *parent, int port_reg, int reg)
 {
 	struct of_endpoint endpoint;
-	struct device_node *node, *prev_node = NULL;
-
-	while (1) {
-		node = of_graph_get_next_endpoint(parent, prev_node);
-		of_node_put(prev_node);
-		if (!node)
-			break;
+	struct device_node *node = NULL;
 
+	for_each_endpoint_of_node(parent, node) {
 		of_graph_parse_endpoint(node, &endpoint);
 		if (((port_reg == -1) || (endpoint.port == port_reg)) &&
 			((reg == -1) || (endpoint.id == reg)))
 			return node;
-
-		prev_node = node;
 	}
 
 	return NULL;
author maintainer
#69 lore raw

PATCH 74/143 sched/cputime: Fix NO_HZ_FULL getrusage() monotonicity regression

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Peter Zijlstra <[email protected]>

commit 173be9a14f7b2e901cf77c18b1aafd4d672e9d9e upstream.

Mike reports:

Roughly 10% of the time, ltp testcase getrusage04 fails:

 getrusage04    0  TINFO  :  Expected timers granularity is 4000 us
 getrusage04    0  TINFO  :  Using 1 as multiply factor for max [us]time increment (1000+4000us)!
 getrusage04    0  TINFO  :  utime:           0us; stime:         179us
 getrusage04    0  TINFO  :  utime:        3751us; stime:           0us
 getrusage04    1  TFAIL  :  getrusage04.c:133: stime increased > 5000us:

And tracked it down to the case where the task simply doesn't get _any_ [us]time ticks.

Update the code to assume all rtime is utime when we lack information, thus ensuring a task that elides the tick gets time accounted.

Cc Frederic Weisbecker <[email protected]>
Cc Fredrik Markstrom <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Stephane Eranian <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Vince Weaver <[email protected]>
Cc Wanpeng Li <[email protected]>
Fixes 9d7fb0427648 ("sched/cputime: Guarantee stime + utime == rtime")
---
 kernel/sched/cputime.c |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
kernel/sched/cputime.c +10 -5
@@ -603,19 +603,25 @@ static void cputime_adjust(struct task_c
 	stime = curr->stime;
 	utime = curr->utime;
 
-	if (utime == 0) {
-		stime = rtime;
+	/*
+	 * If either stime or both stime and utime are 0, assume all runtime is
+	 * userspace. Once a task gets some ticks, the monotonicy code at
+	 * 'update' will ensure things converge to the observed ratio.
+	 */
+	if (stime == 0) {
+		utime = rtime;
 		goto update;
 	}
 
-	if (stime == 0) {
-		utime = rtime;
+	if (utime == 0) {
+		stime = rtime;
 		goto update;
 	}
 
 	stime = scale_stime((__force u64)stime, (__force u64)rtime,
 			    (__force u64)(stime + utime));
 
+update:
 	/*
 	 * Make sure stime doesn't go backwards; this preserves monotonicity
 	 * for utime because rtime is monotonic.
@@ -638,7 +644,6 @@ static void cputime_adjust(struct task_c
 		stime = rtime - utime;
 	}
 
-update:
 	prev->stime = stime;
 	prev->utime = utime;
 out:
author maintainer
#70 lore raw

PATCH 75/143 iio: fix sched WARNING "do not call blocking ops when !TASK_RUNNING"

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Brian Norris <[email protected]>

commit fcf68f3c0bb2a541aa47a2a38b8939edf84fd529 upstream.

When using CONFIG_DEBUG_ATOMIC_SLEEP, the scheduler nicely points out that we're calling sleeping primitives within the wait_event loop, which means we might clobber the task state:

[   10.831289] do not call blocking ops when !TASK_RUNNING; state=1 set at [<ffffffc00026b610>]
[   10.845531] ------------[ cut here ]------------
[   10.850161] WARNING: at kernel/sched/core.c:7630
...
[   12.164333] ---[ end trace 45409966a9a76438 ]---
[   12.168942] Call trace:
[   12.171391] [<ffffffc00024ed44>] __might_sleep+0x64/0x90
[   12.176699] [<ffffffc000954774>] mutex_lock_nested+0x50/0x3fc
[   12.182440] [<ffffffc0007b9424>] iio_kfifo_buf_data_available+0x28/0x4c
[   12.189043] [<ffffffc0007b76ac>] iio_buffer_ready+0x60/0xe0
[   12.194608] [<ffffffc0007b7834>] iio_buffer_read_first_n_outer+0x108/0x1a8
[   12.201474] [<ffffffc000370d48>] __vfs_read+0x58/0x114
[   12.206606] [<ffffffc000371740>] vfs_read+0x94/0x118
[   12.211564] [<ffffffc0003720f8>] SyS_read+0x64/0xb4
[   12.216436] [<ffffffc000203cb4>] el0_svc_naked+0x24/0x28

To avoid this, we should (a la https://lwn.net/Articles/628628/) use the wait_woken() function, which avoids the nested sleeping while still handling races between waiting / wake-events.

---
 drivers/iio/industrialio-buffer.c |   25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)
drivers/iio/industrialio-buffer.c +18 -7
@@ -107,6 +107,7 @@ ssize_t iio_buffer_read_first_n_outer(st
 {
 	struct iio_dev *indio_dev = filp->private_data;
 	struct iio_buffer *rb = indio_dev->buffer;
+	DEFINE_WAIT_FUNC(wait, woken_wake_function);
 	size_t datum_size;
 	size_t to_wait;
 	int ret;
@@ -131,19 +132,29 @@ ssize_t iio_buffer_read_first_n_outer(st
 	else
 		to_wait = min_t(size_t, n / datum_size, rb->watermark);
 
+	add_wait_queue(&rb->pollq, &wait);
 	do {
-		ret = wait_event_interruptible(rb->pollq,
-		      iio_buffer_ready(indio_dev, rb, to_wait, n / datum_size));
-		if (ret)
-			return ret;
-
-		if (!indio_dev->info)
-			return -ENODEV;
+		if (!indio_dev->info) {
+			ret = -ENODEV;
+			break;
+		}
+
+		if (!iio_buffer_ready(indio_dev, rb, to_wait, n / datum_size)) {
+			if (signal_pending(current)) {
+				ret = -ERESTARTSYS;
+				break;
+			}
+
+			wait_woken(&wait, TASK_INTERRUPTIBLE,
+				   MAX_SCHEDULE_TIMEOUT);
+			continue;
+		}
 
 		ret = rb->access->read_first_n(rb, n, buf);
 		if (ret == 0 && (filp->f_flags & O_NONBLOCK))
 			ret = -EAGAIN;
 	 } while (ret == 0);
+	remove_wait_queue(&rb->pollq, &wait);
 
 	return ret;
 }
author maintainer
#71 lore raw

PATCH 81/143 drm/amd/amdgpu: sdma resume fail during S4 on CI

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: jimqu <[email protected]>

commit 10ea9434065e56fe14287f89258ecf2fb684ed1a upstream.

SDMA could be fail in the thaw() and restore() processes, do software reset if each SDMA engine is busy.

---
 drivers/gpu/drm/amd/amdgpu/cik_sdma.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +3 -0
@@ -52,6 +52,7 @@ static void cik_sdma_set_ring_funcs(stru
 static void cik_sdma_set_irq_funcs(struct amdgpu_device *adev);
 static void cik_sdma_set_buffer_funcs(struct amdgpu_device *adev);
 static void cik_sdma_set_vm_pte_funcs(struct amdgpu_device *adev);
+static int cik_sdma_soft_reset(void *handle);
 
 MODULE_FIRMWARE("radeon/bonaire_sdma.bin");
 MODULE_FIRMWARE("radeon/bonaire_sdma1.bin");
@@ -1051,6 +1052,8 @@ static int cik_sdma_resume(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+	cik_sdma_soft_reset(handle);
+
 	return cik_sdma_hw_init(adev);
 }
 
author maintainer
#72 lore raw

PATCH 82/143 drm/amd/amdgpu: compute ring test fail during S4 on CI

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: jimqu <[email protected]>

commit 53960b4f89db58bc155d6f8aa0a44ccc59ccb26f upstream.

unhalt Instrction Fetch Unit after all rings are inited.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +9 -3
@@ -2777,8 +2777,7 @@ static int gfx_v7_0_cp_compute_resume(st
 	u64 wb_gpu_addr;
 	u32 *buf;
 	struct bonaire_mqd *mqd;
-
-	gfx_v7_0_cp_compute_enable(adev, true);
+	struct amdgpu_ring *ring;
 
 	/* fix up chicken bits */
 	tmp = RREG32(mmCP_CPF_DEBUG);
@@ -2813,7 +2812,7 @@ static int gfx_v7_0_cp_compute_resume(st
 
 	/* init the queues.  Just two for now. */
 	for (i = 0; i < adev->gfx.num_compute_rings; i++) {
-		struct amdgpu_ring *ring = &adev->gfx.compute_ring[i];
+		ring = &adev->gfx.compute_ring[i];
 
 		if (ring->mqd_obj == NULL) {
 			r = amdgpu_bo_create(adev,
@@ -2992,6 +2991,13 @@ static int gfx_v7_0_cp_compute_resume(st
 		amdgpu_bo_unreserve(ring->mqd_obj);
 
 		ring->ready = true;
+	}
+
+	gfx_v7_0_cp_compute_enable(adev, true);
+
+	for (i = 0; i < adev->gfx.num_compute_rings; i++) {
+		ring = &adev->gfx.compute_ring[i];
+
 		r = amdgpu_ring_test_ring(ring);
 		if (r)
 			ring->ready = false;
author maintainer
#73 lore raw

PATCH 87/143 drm/i915: Acquire audio powerwell for HD-Audio registers

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Chris Wilson <[email protected]>

commit 3cffb0a44750726cdc1cc07399efe3cbb45e028b upstream.

On Haswell/Broadwell, the HD-Audio block is inside the HDMI/display power well and so the sna-hda audio codec acquires the display power well while it is operational. However, Skylake separates the powerwells again, but yet we still need the audio powerwell to setup the registers. (But then the hardware uses those registers even while powered off???)

Acquiring the powerwell around setting the chicken bits when setting up the audio channel does at least silence the WARNs from touching our registers whilst unpowered. We silence our own test cases, but maybe there is a latent bug in using the audio channel?

v2: Grab both rpm wakelock and audio wakelock

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96214

Fixes 03b135cebc47 "ALSA: hda - remove dependency on i915 power well for SKL")
Cc Libin Yang <[email protected]>
Cc Takashi Iwai <[email protected]>
Cc Marius Vlad <[email protected]>
(cherry picked from commit d838a110f0b310d408ebe6b5a97e36ec27555ebf)
---
 drivers/gpu/drm/i915/intel_audio.c |    6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/i915/intel_audio.c +6 -0
@@ -600,6 +600,8 @@ static void i915_audio_component_codec_w
 	if (!IS_SKYLAKE(dev_priv) && !IS_KABYLAKE(dev_priv))
 		return;
 
+	i915_audio_component_get_power(dev);
+
 	/*
 	 * Enable/disable generating the codec wake signal, overriding the
 	 * internal logic to generate the codec wake to controller.
@@ -615,6 +617,8 @@ static void i915_audio_component_codec_w
 		I915_WRITE(HSW_AUD_CHICKENBIT, tmp);
 		usleep_range(1000, 1500);
 	}
+
+	i915_audio_component_put_power(dev);
 }
 
 /* Get CDCLK in kHz  */
@@ -654,6 +658,7 @@ static int i915_audio_component_sync_aud
 	    !IS_HASWELL(dev_priv))
 		return 0;
 
+	i915_audio_component_get_power(dev);
 	mutex_lock(&dev_priv->av_mutex);
 	/* 1. get the pipe */
 	intel_encoder = dev_priv->dig_port_map[port];
@@ -704,6 +709,7 @@ static int i915_audio_component_sync_aud
 
  unlock:
 	mutex_unlock(&dev_priv->av_mutex);
+	i915_audio_component_put_power(dev);
 	return err;
 }
 
author maintainer
#74 lore raw

PATCH 88/143 drm/i915: fix aliasing_ppgtt leak

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Matthew Auld <[email protected]>

commit 3871f42a57efcdc6a9da751a8cb6fa196c212289 upstream.

In i915_ggtt_cleanup_hw we need to remember to free aliasing_ppgtt. This fixes the following kmemleak message:

unreferenced object 0xffff880213cca000 (size 8192):
comm "modprobe", pid 1298, jiffies 4294745402 (age 703.930s) hex dump (first 32 bytes):

    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffffff817c808e>] kmemleak_alloc+0x4e/0xb0
    [<ffffffff8121f9c2>] kmem_cache_alloc_trace+0x142/0x1d0
    [<ffffffffa06d11ef>] i915_gem_init_ggtt+0x10f/0x210 [i915]
    [<ffffffffa06d71bb>] i915_gem_init+0x5b/0xd0 [i915]
    [<ffffffffa069749a>] i915_driver_load+0x97a/0x1460 [i915]
    [<ffffffffa06a26ef>] i915_pci_probe+0x4f/0x70 [i915]
    [<ffffffff81423015>] local_pci_probe+0x45/0xa0
    [<ffffffff81424463>] pci_device_probe+0x103/0x150
    [<ffffffff81515e6c>] driver_probe_device+0x22c/0x440
    [<ffffffff81516151>] __driver_attach+0xd1/0xf0
    [<ffffffff8151379c>] bus_for_each_dev+0x6c/0xc0
    [<ffffffff8151555e>] driver_attach+0x1e/0x20
    [<ffffffff81514fa3>] bus_add_driver+0x1c3/0x280
    [<ffffffff81516aa0>] driver_register+0x60/0xe0
    [<ffffffff8142297c>] __pci_register_driver+0x4c/0x50
    [<ffffffffa013605b>] 0xffffffffa013605b
Fixes b18b6bde300e ("drm/i915/bdw: Free PPGTT struct")
(cherry picked from commit cb7f27601c81a1e0454e9461e96f65b31fafbea0)
---
 drivers/gpu/drm/i915/i915_gem_gtt.c |    1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_gem_gtt.c +1 -0
@@ -2826,6 +2826,7 @@ void i915_ggtt_cleanup_hw(struct drm_dev
 		struct i915_hw_ppgtt *ppgtt = dev_priv->mm.aliasing_ppgtt;
 
 		ppgtt->base.cleanup(&ppgtt->base);
+		kfree(ppgtt);
 	}
 
 	i915_gem_cleanup_stolen(dev);
author maintainer
#75 lore raw

PATCH 93/143 ARC: use correct offset in pt_regs for saving/restoring user mode r25

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Liav Rehana <[email protected]>

commit 86147e3cfa5e118b61e78f4f0bf29e920dcbd477 upstream.

User mode callee regs are explicitly collected before signal delivery or breakpoint trap. r25 is special for kernel as it serves as task pointer, so user mode value is clobbered very early. It is saved in pt_regs where generally only scratch (aka caller saved) regs are saved.

The code to access the corresponding pt_regs location had a subtle bug as it was using load/store with scaling of offset, whereas the offset was already byte wise correct. So fix this by replacing LD.AS with a standard LD

---
 arch/arc/include/asm/entry.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arc/include/asm/entry.h +2 -2
@@ -142,7 +142,7 @@
 
 #ifdef CONFIG_ARC_CURR_IN_REG
 	; Retrieve orig r25 and save it with rest of callee_regs
-	ld.as   r12, [r12, PT_user_r25]
+	ld	r12, [r12, PT_user_r25]
 	PUSH	r12
 #else
 	PUSH	r25
@@ -198,7 +198,7 @@
 
 	; SP is back to start of pt_regs
 #ifdef CONFIG_ARC_CURR_IN_REG
-	st.as   r12, [sp, PT_user_r25]
+	st	r12, [sp, PT_user_r25]
 #endif
 .endm
 
author maintainer
#76 lore raw

PATCH 95/143 ARC: Call trace_hardirqs_on() before enabling irqs

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Daniel Mentz <[email protected]>

commit 18b43e89d295cc65151c505c643c98fb2c320e59 upstream.

trace_hardirqs_on_caller() in lockdep.c expects to be called before, not after interrupts are actually enabled.

The following comment in kernel/locking/lockdep.c substantiates this claim:

"
/*
* We're enabling irqs and according to our state above irqs weren't
* already enabled, yet we find the hardware thinks they are in fact
* enabled.. someone messed up their IRQ state tracing. */
"

An example can be found in include/linux/irqflags.h:

	do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0)

Without this change, we hit the following DEBUG_LOCKS_WARN_ON.

[    7.760000] ------------[ cut here ]------------
[    7.760000] WARNING: CPU: 0 PID: 1 at kernel/locking/lockdep.c:2711 resume_user_mode_begin+0x48/0xf0
[    7.770000] DEBUG_LOCKS_WARN_ON(!irqs_disabled())
[    7.780000] Modules linked in:
[    7.780000] CPU: 0 PID: 1 Comm: init Not tainted 4.7.0-00003-gc668bb9-dirty #366
[    7.790000]
[    7.790000] Stack Trace:
[    7.790000]   arc_unwind_core.constprop.1+0xa4/0x118
[    7.800000]   warn_slowpath_fmt+0x72/0x158
[    7.800000]   resume_user_mode_begin+0x48/0xf0
[    7.810000] ---[ end trace 6f6a7a8fae20d2f0 ]---
---
 arch/arc/include/asm/irqflags-compact.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arc/include/asm/irqflags-compact.h +1 -1
@@ -188,10 +188,10 @@ static inline int arch_irqs_disabled(voi
 .endm
 
 .macro IRQ_ENABLE  scratch
+	TRACE_ASM_IRQ_ENABLE
 	lr	\scratch, [status32]
 	or	\scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK)
 	flag	\scratch
-	TRACE_ASM_IRQ_ENABLE
 .endm
 
 #endif	/* __ASSEMBLY__ */
author maintainer
#77 lore raw

PATCH 96/143 ARC: Elide redundant setup of DMA callbacks

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Vineet Gupta <[email protected]>

commit 45c3b08a117e2232fc8d7b9e849ead36386f4f96 upstream.

For resources shared by all cores such as SLC and IOC, only the master core needs to do any setups / enabling / disabling etc.

---
 arch/arc/mm/cache.c |    9 +++++++++
 1 file changed, 9 insertions(+)
arch/arc/mm/cache.c +9 -0
@@ -921,6 +921,15 @@ void arc_cache_init(void)
 
 	printk(arc_cache_mumbojumbo(0, str, sizeof(str)));
 
+	/*
+	 * Only master CPU needs to execute rest of function:
+	 *  - Assume SMP so all cores will have same cache config so
+	 *    any geomtry checks will be same for all
+	 *  - IOC setup / dma callbacks only need to be setup once
+	 */
+	if (cpu)
+		return;
+
 	if (IS_ENABLED(CONFIG_ARC_HAS_ICACHE)) {
 		struct cpuinfo_arc_cache *ic = &cpuinfo_arc700[cpu].icache;
 
author maintainer
#78 lore raw

PATCH 97/143 aacraid: Check size values after double-fetch from user

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Dave Carroll <[email protected]>

commit fa00c437eef8dc2e7b25f8cd868cfa405fcc2bb3 upstream.

In aacraid's ioctl_send_fib() we do two fetches from userspace, one the get the fib header's size and one for the fib itself. Later we use the size field from the second fetch to further process the fib. If for some reason the size from the second fetch is different than from the first fix, we may encounter an out-of- bounds access in aac_fib_send(). We also check the sender size to insure it is not out of bounds. This was reported in https://bugzilla.kernel.org/show_bug.cgi?id=116751 and was assigned CVE-2016-6480.

Fixes 7c00ffa31 '[SCSI] 2.6 aacraid: Variable FIB size (updated patch)'
---
 drivers/scsi/aacraid/commctrl.c |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/scsi/aacraid/commctrl.c +11 -2
@@ -63,7 +63,7 @@ static int ioctl_send_fib(struct aac_dev
 	struct fib *fibptr;
 	struct hw_fib * hw_fib = (struct hw_fib *)0;
 	dma_addr_t hw_fib_pa = (dma_addr_t)0LL;
-	unsigned size;
+	unsigned int size, osize;
 	int retval;
 
 	if (dev->in_reset) {
@@ -87,7 +87,8 @@ static int ioctl_send_fib(struct aac_dev
 	 *	will not overrun the buffer when we copy the memory. Return
 	 *	an error if we would.
 	 */
-	size = le16_to_cpu(kfib->header.Size) + sizeof(struct aac_fibhdr);
+	osize = size = le16_to_cpu(kfib->header.Size) +
+		sizeof(struct aac_fibhdr);
 	if (size < le16_to_cpu(kfib->header.SenderSize))
 		size = le16_to_cpu(kfib->header.SenderSize);
 	if (size > dev->max_fib_size) {
@@ -118,6 +119,14 @@ static int ioctl_send_fib(struct aac_dev
 		goto cleanup;
 	}
 
+	/* Sanity check the second copy */
+	if ((osize != le16_to_cpu(kfib->header.Size) +
+		sizeof(struct aac_fibhdr))
+		|| (size < le16_to_cpu(kfib->header.SenderSize))) {
+		retval = -EINVAL;
+		goto cleanup;
+	}
+
 	if (kfib->header.Command == cpu_to_le16(TakeABreakPt)) {
 		aac_adapter_interrupt(dev);
 		/*
author maintainer
#79 lore raw

PATCH 98/143 mfd: cros_ec: Add cros_ec_cmd_xfer_status() helper

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Tomeu Vizoso <[email protected]>

commit 9798ac6d32c1a32d6d92d853ff507d2d39c4300c upstream.

So that callers of cros_ec_cmd_xfer() don't have to repeat boilerplate code when checking for errors from the EC side.

---
 drivers/platform/chrome/cros_ec_proto.c |   17 +++++++++++++++++
 include/linux/mfd/cros_ec.h             |   15 +++++++++++++++
 2 files changed, 32 insertions(+)
drivers/platform/chrome/cros_ec_proto.c +17 -0
@@ -380,3 +380,20 @@ int cros_ec_cmd_xfer(struct cros_ec_devi
 	return ret;
 }
 EXPORT_SYMBOL(cros_ec_cmd_xfer);
+
+int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev,
+			    struct cros_ec_command *msg)
+{
+	int ret;
+
+	ret = cros_ec_cmd_xfer(ec_dev, msg);
+	if (ret < 0) {
+		dev_err(ec_dev->dev, "Command xfer error (err:%d)\n", ret);
+	} else if (msg->result != EC_RES_SUCCESS) {
+		dev_dbg(ec_dev->dev, "Command result (err: %d)\n", msg->result);
+		return -EPROTO;
+	}
+
+	return ret;
+}
+EXPORT_SYMBOL(cros_ec_cmd_xfer_status);
include/linux/mfd/cros_ec.h +15 -0
@@ -226,6 +226,21 @@ int cros_ec_cmd_xfer(struct cros_ec_devi
 		     struct cros_ec_command *msg);
 
 /**
+ * cros_ec_cmd_xfer_status - Send a command to the ChromeOS EC
+ *
+ * This function is identical to cros_ec_cmd_xfer, except it returns success
+ * status only if both the command was transmitted successfully and the EC
+ * replied with success status. It's not necessary to check msg->result when
+ * using this function.
+ *
+ * @ec_dev: EC device
+ * @msg: Message to write
+ * @return: Num. of bytes transferred on success, <0 on failure
+ */
+int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev,
+			    struct cros_ec_command *msg);
+
+/**
  * cros_ec_remove - Remove a ChromeOS EC
  *
  * Call this to deregister a ChromeOS EC, then clean up any private data.
author maintainer
#80 lore raw

PATCH 99/143 i2c: cros-ec-tunnel: Fix usage of cros_ec_cmd_xfer()

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Brian Norris <[email protected]>

commit 4d01d88019261d05ec3bff5f1a6013393faa3b9e upstream.

cros_ec_cmd_xfer returns success status if the command transport completes successfully, but the execution result is incorrectly ignored. In many cases, the execution result is assumed to be successful, leading to ignored errors and operating on uninitialized data.

We've recently introduced the cros_ec_cmd_xfer_status() helper to avoid these problems. Let's use it.

[Regarding the 'Fixes' tag; there is significant refactoring since the driver's introduction, but the underlying logical error exists throughout I believe]

---
 drivers/i2c/busses/i2c-cros-ec-tunnel.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-cros-ec-tunnel.c +1 -1
@@ -215,7 +215,7 @@ static int ec_i2c_xfer(struct i2c_adapte
 	msg->outsize = request_len;
 	msg->insize = response_len;
 
-	result = cros_ec_cmd_xfer(bus->ec, msg);
+	result = cros_ec_cmd_xfer_status(bus->ec, msg);
 	if (result < 0) {
 		dev_err(dev, "Error transferring EC i2c message %d\n", result);
 		goto exit;
author maintainer
#81 lore raw

PATCH 100/143 cdc-acm: fix wrong pipe type on rx interrupt xfers

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Gavin Li <[email protected]>

commit add125054b8727103631dce116361668436ef6a7 upstream.

This fixes the "BOGUS urb xfer" warning logged by usb_submit_urb().

---
 drivers/usb/class/cdc-acm.c |    5 ++---
 drivers/usb/class/cdc-acm.h |    1 -
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/usb/class/cdc-acm.c +2 -3
@@ -1405,7 +1405,6 @@ made_compressed_probe:
 	spin_lock_init(&acm->write_lock);
 	spin_lock_init(&acm->read_lock);
 	mutex_init(&acm->mutex);
-	acm->rx_endpoint = usb_rcvbulkpipe(usb_dev, epread->bEndpointAddress);
 	acm->is_int_ep = usb_endpoint_xfer_int(epread);
 	if (acm->is_int_ep)
 		acm->bInterval = epread->bInterval;
@@ -1445,14 +1444,14 @@ made_compressed_probe:
 		urb->transfer_dma = rb->dma;
 		if (acm->is_int_ep) {
 			usb_fill_int_urb(urb, acm->dev,
-					 acm->rx_endpoint,
+					 usb_rcvintpipe(usb_dev, epread->bEndpointAddress),
 					 rb->base,
 					 acm->readsize,
 					 acm_read_bulk_callback, rb,
 					 acm->bInterval);
 		} else {
 			usb_fill_bulk_urb(urb, acm->dev,
-					  acm->rx_endpoint,
+					  usb_rcvbulkpipe(usb_dev, epread->bEndpointAddress),
 					  rb->base,
 					  acm->readsize,
 					  acm_read_bulk_callback, rb);
drivers/usb/class/cdc-acm.h +0 -1
@@ -96,7 +96,6 @@ struct acm {
 	struct acm_rb read_buffers[ACM_NR];
 	struct acm_wb *putbuffer;			/* for acm_tty_put_char() */
 	int rx_buflimit;
-	int rx_endpoint;
 	spinlock_t read_lock;
 	int write_used;					/* number of non-empty write buffers */
 	int transmitting;
author maintainer
#82 lore raw

PATCH 101/143 mpt3sas: Fix resume on WarpDrive flash cards

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Greg Edwards <[email protected]>

commit ce7c6c9e1d997a2670aead3a7b87f4df32c11118 upstream.

mpt3sas crashes on resume after suspend with WarpDrive flash cards. The reply_post_host_index array is not set back up after the resume, and we deference a stale pointer in _base_interrupt().

[   47.309711] BUG: unable to handle kernel paging request at ffffc90001f8006c
[   47.318289] IP: [<ffffffffc00863ef>] _base_interrupt+0x49f/0xa30 [mpt3sas]
[   47.326749] PGD 41ccaa067 PUD 41ccab067 PMD 3466c067 PTE 0
[   47.333848] Oops: 0002 [#1] SMP
...
[   47.452708] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.7.0 #6
[   47.460506] Hardware name: Dell Inc. OptiPlex 990/06D7TR, BIOS A18 09/24/2013
[   47.469629] task: ffffffff81c0d500 ti: ffffffff81c00000 task.ti: ffffffff81c00000
[   47.479112] RIP: 0010:[<ffffffffc00863ef>]  [<ffffffffc00863ef>] _base_interrupt+0x49f/0xa30 [mpt3sas]
[   47.490466] RSP: 0018:ffff88041d203e30  EFLAGS: 00010002
[   47.497801] RAX: 0000000000000001 RBX: ffff880033f4c000 RCX: 0000000000000001
[   47.506973] RDX: ffffc90001f8006c RSI: 0000000000000082 RDI: 0000000000000082
[   47.516141] RBP: ffff88041d203eb0 R08: ffff8804118e2820 R09: 0000000000000001
[   47.525300] R10: 0000000000000001 R11: 00000000100c0000 R12: 0000000000000000
[   47.534457] R13: ffff880412c487e0 R14: ffff88041a8987d8 R15: 0000000000000001
[   47.543632] FS:  0000000000000000(0000) GS:ffff88041d200000(0000) knlGS:0000000000000000
[   47.553796] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   47.561632] CR2: ffffc90001f8006c CR3: 0000000001c06000 CR4: 00000000000406f0
[   47.570883] Stack:
[   47.575015]  000000001d211228 ffff88041d2100c0 ffff8800c47d8130 0000000000000100
[   47.584625]  ffff8804100c0000 100c000000000000 ffff88041a8992a0 ffff88041a8987f8
[   47.594230]  ffff88041d203e00 ffffffff81111e55 000000000000038c ffff880414ad4280
[   47.603862] Call Trace:
[   47.608474]  <IRQ>
[   47.610413]  [<ffffffff81111e55>] ? call_timer_fn+0x35/0x120
[   47.620539]  [<ffffffff81100a1f>] handle_irq_event_percpu+0x7f/0x1c0
[   47.629061]  [<ffffffff81100b8c>] handle_irq_event+0x2c/0x50
[   47.636859]  [<ffffffff81103fff>] handle_edge_irq+0x6f/0x130
[   47.644654]  [<ffffffff8102fbf3>] handle_irq+0x73/0x120
[   47.652011]  [<ffffffff810c6ada>] ? atomic_notifier_call_chain+0x1a/0x20
[   47.660854]  [<ffffffff817e374b>] do_IRQ+0x4b/0xd0
[   47.667777]  [<ffffffff817e160c>] common_interrupt+0x8c/0x8c
[   47.675635]  <EOI>

Move the reply_post_host_index array setup into mpt3sas_base_map_resources(), which is also in the resume path.

---
 drivers/scsi/mpt3sas/mpt3sas_base.c |   22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +11 -11
@@ -2188,6 +2188,17 @@ mpt3sas_base_map_resources(struct MPT3SA
 	} else
 		ioc->msix96_vector = 0;
 
+	if (ioc->is_warpdrive) {
+		ioc->reply_post_host_index[0] = (resource_size_t __iomem *)
+		    &ioc->chip->ReplyPostHostIndex;
+
+		for (i = 1; i < ioc->cpu_msix_table_sz; i++)
+			ioc->reply_post_host_index[i] =
+			(resource_size_t __iomem *)
+			((u8 __iomem *)&ioc->chip->Doorbell + (0x4000 + ((i - 1)
+			* 4)));
+	}
+
 	list_for_each_entry(reply_q, &ioc->reply_queue_list, list)
 		pr_info(MPT3SAS_FMT "%s: IRQ %d\n",
 		    reply_q->name,  ((ioc->msix_enable) ? "PCI-MSI-X enabled" :
@@ -5280,17 +5291,6 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPT
 	if (r)
 		goto out_free_resources;
 
-	if (ioc->is_warpdrive) {
-		ioc->reply_post_host_index[0] = (resource_size_t __iomem *)
-		    &ioc->chip->ReplyPostHostIndex;
-
-		for (i = 1; i < ioc->cpu_msix_table_sz; i++)
-			ioc->reply_post_host_index[i] =
-			(resource_size_t __iomem *)
-			((u8 __iomem *)&ioc->chip->Doorbell + (0x4000 + ((i - 1)
-			* 4)));
-	}
-
 	pci_set_drvdata(ioc->pdev, ioc->shost);
 	r = _base_get_ioc_facts(ioc, CAN_SLEEP);
 	if (r)
author maintainer
#83 lore raw

PATCH 102/143 megaraid_sas: Fix probing cards without io port

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Yinghai Lu <[email protected]>

commit e7f851684efb3377e9c93aca7fae6e76212e5680 upstream.

Found one megaraid_sas HBA probe fails,

[  187.235190] scsi host2: Avago SAS based MegaRAID driver
[  191.112365] megaraid_sas 0000:89:00.0: BAR 0: can't reserve [io  0x0000-0x00ff]
[  191.120548] megaraid_sas 0000:89:00.0: IO memory region busy!

and the card has resource like,

[  125.097714] pci 0000:89:00.0: [1000:005d] type 00 class 0x010400
[  125.104446] pci 0000:89:00.0: reg 0x10: [io  0x0000-0x00ff]
[  125.110686] pci 0000:89:00.0: reg 0x14: [mem 0xce400000-0xce40ffff 64bit]
[  125.118286] pci 0000:89:00.0: reg 0x1c: [mem 0xce300000-0xce3fffff 64bit]
[  125.125891] pci 0000:89:00.0: reg 0x30: [mem 0xce200000-0xce2fffff pref]

that does not io port resource allocated from BIOS, and kernel can not assign one as io port shortage.

The driver is only looking for MEM, and should not fail.

It turns out megasas_init_fw() etc are using bar index as mask. index 1 is used as mask 1, so that pci_request_selected_regions() is trying to request BAR0 instead of BAR1.

Fix all related reference.

Fixes b6d5d8808b4c ("megaraid_sas: Use lowest memory bar for SR-IOV VF support")
---
 drivers/scsi/megaraid/megaraid_sas_base.c   |    6 +++---
 drivers/scsi/megaraid/megaraid_sas_fusion.c |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/megaraid/megaraid_sas_base.c +3 -3
@@ -5037,7 +5037,7 @@ static int megasas_init_fw(struct megasa
 	/* Find first memory bar */
 	bar_list = pci_select_bars(instance->pdev, IORESOURCE_MEM);
 	instance->bar = find_first_bit(&bar_list, sizeof(unsigned long));
-	if (pci_request_selected_regions(instance->pdev, instance->bar,
+	if (pci_request_selected_regions(instance->pdev, 1<<instance->bar,
 					 "megasas: LSI")) {
 		dev_printk(KERN_DEBUG, &instance->pdev->dev, "IO memory region busy!\n");
 		return -EBUSY;
@@ -5339,7 +5339,7 @@ fail_ready_state:
 	iounmap(instance->reg_set);
 
       fail_ioremap:
-	pci_release_selected_regions(instance->pdev, instance->bar);
+	pci_release_selected_regions(instance->pdev, 1<<instance->bar);
 
 	return -EINVAL;
 }
@@ -5360,7 +5360,7 @@ static void megasas_release_mfi(struct m
 
 	iounmap(instance->reg_set);
 
-	pci_release_selected_regions(instance->pdev, instance->bar);
+	pci_release_selected_regions(instance->pdev, 1<<instance->bar);
 }
 
 /**
drivers/scsi/megaraid/megaraid_sas_fusion.c +1 -1
@@ -2603,7 +2603,7 @@ megasas_release_fusion(struct megasas_in
 
 	iounmap(instance->reg_set);
 
-	pci_release_selected_regions(instance->pdev, instance->bar);
+	pci_release_selected_regions(instance->pdev, 1<<instance->bar);
 }
 
 /**
author maintainer
#84 lore raw

PATCH 103/143 usb: renesas_usbhs: gadget: fix return value check in usbhs_mod_gadget_probe()

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Wei Yongjun <[email protected]>

commit 3295235fd70ed6d594aadee8c892a14f6a4b2d2e upstream.

In case of error, the function usb_get_phy() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR().

Fixes b5a2875605ca ("usb: renesas_usbhs: Allow an OTG PHY driver to

provide VBUS")

---
 drivers/usb/renesas_usbhs/mod_gadget.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/renesas_usbhs/mod_gadget.c +1 -1
@@ -1076,7 +1076,7 @@ int usbhs_mod_gadget_probe(struct usbhs_
 
 	gpriv->transceiver = usb_get_phy(USB_PHY_TYPE_UNDEFINED);
 	dev_info(dev, "%stransceiver found\n",
-		 gpriv->transceiver ? "" : "no ");
+		 !IS_ERR(gpriv->transceiver) ? "" : "no ");
 
 	/*
 	 * CAUTION
author maintainer
#85 lore raw

PATCH 104/143 dm round robin: do not use this_cpu_ptr() without having preemption disabled

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Mike Snitzer <[email protected]>

commit 802934b2cfde463b72cc1b9bc1c081895a90be53 upstream.

Use local_irq_save() to disable preemption before calling this_cpu_ptr().

Fixes b0b477c7e0dd ("dm round robin: use percpu 'repeat_count' and 'current_path'")
---
 drivers/md/dm-round-robin.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/md/dm-round-robin.c +5 -2
@@ -210,14 +210,17 @@ static struct dm_path *rr_select_path(st
 	struct path_info *pi = NULL;
 	struct dm_path *current_path = NULL;
 
+	local_irq_save(flags);
 	current_path = *this_cpu_ptr(s->current_path);
 	if (current_path) {
 		percpu_counter_dec(&s->repeat_count);
-		if (percpu_counter_read_positive(&s->repeat_count) > 0)
+		if (percpu_counter_read_positive(&s->repeat_count) > 0) {
+			local_irq_restore(flags);
 			return current_path;
+		}
 	}
 
-	spin_lock_irqsave(&s->lock, flags);
+	spin_lock(&s->lock);
 	if (!list_empty(&s->valid_paths)) {
 		pi = list_entry(s->valid_paths.next, struct path_info, list);
 		list_move_tail(&pi->list, &s->valid_paths);
author maintainer
#86 lore raw

PATCH 105/143 gpio: Fix OF build problem on UM

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Linus Walleij <[email protected]>

commit 2527ecc9195e9c66252af24c4689e8a67cd4ccb9 upstream.

The UserMode (UM) Linux build was failing in gpiolib-of as it requires ioremap()/iounmap() to exist, which is absent from UM. The non-existence of IO memory is negatively defined as CONFIG_NO_IOMEM which means we need to depend on HAS_IOMEM.

---
 drivers/gpio/Kconfig |    1 +
 1 file changed, 1 insertion(+)
drivers/gpio/Kconfig +1 -0
@@ -50,6 +50,7 @@ config GPIO_DEVRES
 config OF_GPIO
 	def_bool y
 	depends on OF
+	depends on HAS_IOMEM
 
 config GPIO_ACPI
 	def_bool y
author maintainer
#87 lore raw

PATCH 106/143 gpio: max730x: set gpiochip data pointer before using it

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Christophe Leroy <[email protected]>

commit 6f4deb18a505523eb7925d646574a95f9e982ff7 upstream.

gpiochip_add_data() has to be called before calling max7301_direction_input()

[    4.389883] Unable to handle kernel paging request for data at address 0x00000018
[    4.397282] Faulting instruction address: 0xc01a8cbc
[    4.402023] Oops: Kernel access of bad area, sig: 11 [#1]
[    4.407331] PREEMPT CMPC885
[    4.410131] CPU: 0 PID: 6 Comm: kworker/u2:0 Not tainted 4.5.0-gacdfdee #39
[    4.418592] Workqueue: deferwq deferred_probe_work_func
[    4.423711] task: c60798b0 ti: c608a000 task.ti: c608a000
[    4.429038] NIP: c01a8cbc LR: c01a8e24 CTR: c01ff028
[    4.433953] REGS: c608bad0 TRAP: 0300   Not tainted  (4.5.0-s3k-dev-gacdfdee-svn-dirty)
[    4.441847] MSR: 00009032 <EE,ME,IR,DR,RI>  CR: 33039553  XER: a000f940
[    4.448395] DAR: 00000018 DSISR: c0000000

GPR00: c01a8e24 c608bb80 c60798b0 c60d6f6c 00000004 00000002 07de2900 00700000
GPR08: 00000000 00000000 c608a000 00001032 35039553 00000000 c002f37c c6010b64
GPR16: c6010a48 c6010a14 c6010a00 00000000 c0450000 c0453568 c0453438 c050db14
GPR24: c62662bc 00000009 ffffffaa c60d6f5d 00000001 00000000 00000000 00000000

[    4.480371] NIP [c01a8cbc] max7301_direction_input+0x20/0x9c
[    4.485951] LR [c01a8e24] __max730x_probe+0xec/0x138
[    4.490812] Call Trace:
[    4.493268] [c608bba0] [c01a8e24] __max730x_probe+0xec/0x138
[    4.498878] [c608bbc0] [c01cc368] driver_probe_device+0x190/0x38c
[    4.504895] [c608bbf0] [c01ca918] bus_for_each_drv+0x58/0xb4
[    4.510489] [c608bc20] [c01cc04c] __device_attach+0x8c/0x110
[    4.516082] [c608bc50] [c01cab80] bus_probe_device+0x34/0xb8
[    4.521673] [c608bc70] [c01c96c8] device_add+0x3c0/0x598
[    4.526925] [c608bcb0] [c0200f90] spi_add_device+0x114/0x160
[    4.532512] [c608bcd0] [c02018d0] spi_register_master+0x6e0/0x7c8
[    4.538537] [c608bd20] [c02019fc] devm_spi_register_master+0x44/0x8c
[    4.544824] [c608bd40] [c0203854] of_fsl_spi_probe+0x458/0x57c
[    4.550587] [c608bda0] [c01cd828] platform_drv_probe+0x30/0x74
[    4.556366] [c608bdb0] [c01cc368] driver_probe_device+0x190/0x38c
[    4.562383] [c608bde0] [c01ca918] bus_for_each_drv+0x58/0xb4
[    4.567977] [c608be10] [c01cc04c] __device_attach+0x8c/0x110
[    4.573572] [c608be40] [c01cab80] bus_probe_device+0x34/0xb8
[    4.579170] [c608be60] [c01cb9b4] deferred_probe_work_func+0xa4/0xc4
[    4.585438] [c608be80] [c0029c04] process_one_work+0x22c/0x414
[    4.591201] [c608bea0] [c002a100] worker_thread+0x314/0x5c0
[    4.596722] [c608bef0] [c002f444] kthread+0xc8/0xcc
[    4.601538] [c608bf40] [c000af84] ret_from_kernel_thread+0x5c/0x64
[    4.607596] Instruction dump:
[    4.610530] 7c0803a6 bba10014 38210020 4e800020 7c0802a6 9421ffe0 38840004 bf810010
[    4.618188] 90010024 549cf0be 83c30010 549d0f7c <813e0018> 7fc3f378 7d3f2430 57ff07fe
[    4.626041] ---[ end trace 303adb021dd4caf2 ]---
Fixes 5e45e01916197 ("gpio: max730x: use gpiochip data pointer")
---
 drivers/gpio/gpio-max730x.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpio/gpio-max730x.c +4 -4
@@ -192,6 +192,10 @@ int __max730x_probe(struct max7301 *ts)
 	ts->chip.parent = dev;
 	ts->chip.owner = THIS_MODULE;
 
+	ret = gpiochip_add_data(&ts->chip, ts);
+	if (ret)
+		goto exit_destroy;
+
 	/*
 	 * initialize pullups according to platform data and cache the
 	 * register values for later use.
@@ -213,10 +217,6 @@ int __max730x_probe(struct max7301 *ts)
 		}
 	}
 
-	ret = gpiochip_add_data(&ts->chip, ts);
-	if (ret)
-		goto exit_destroy;
-
 	return ret;
 
 exit_destroy:
author maintainer
#88 lore raw

PATCH 107/143 fs/seq_file: fix out-of-bounds read

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Vegard Nossum <[email protected]>

commit 088bf2ff5d12e2e32ee52a4024fec26e582f44d3 upstream.

seq_read() is a nasty piece of work, not to mention buggy.

It has (I think) an old bug which allows unprivileged userspace to read beyond the end of m->buf.

I was getting these:

    BUG: KASAN: slab-out-of-bounds in seq_read+0xcd2/0x1480 at addr ffff880116889880
    Read of size 2713 by task trinity-c2/1329
    CPU: 2 PID: 1329 Comm: trinity-c2 Not tainted 4.8.0-rc1+ #96
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2014
    Call Trace:
      kasan_object_err+0x1c/0x80
      kasan_report_error+0x2cb/0x7e0
      kasan_report+0x4e/0x80
      check_memory_region+0x13e/0x1a0
      kasan_check_read+0x11/0x20
      seq_read+0xcd2/0x1480
      proc_reg_read+0x10b/0x260
      do_loop_readv_writev.part.5+0x140/0x2c0
      do_readv_writev+0x589/0x860
      vfs_readv+0x7b/0xd0
      do_readv+0xd8/0x2c0
      SyS_readv+0xb/0x10
      do_syscall_64+0x1b3/0x4b0
      entry_SYSCALL64_slow_path+0x25/0x25
    Object at ffff880116889100, in cache kmalloc-4096 size: 4096
    Allocated:
    PID = 1329
      save_stack_trace+0x26/0x80
      save_stack+0x46/0xd0
      kasan_kmalloc+0xad/0xe0
      __kmalloc+0x1aa/0x4a0
      seq_buf_alloc+0x35/0x40
      seq_read+0x7d8/0x1480
      proc_reg_read+0x10b/0x260
      do_loop_readv_writev.part.5+0x140/0x2c0
      do_readv_writev+0x589/0x860
      vfs_readv+0x7b/0xd0
      do_readv+0xd8/0x2c0
      SyS_readv+0xb/0x10
      do_syscall_64+0x1b3/0x4b0
      return_from_SYSCALL_64+0x0/0x6a
    Freed:
    PID = 0
    (stack is not available)
    Memory state around the buggy address:
     ffff88011688a000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     ffff88011688a080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    >ffff88011688a100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
		       ^
     ffff88011688a180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
     ffff88011688a200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ==================================================================
    Disabling lock debugging due to kernel taint

This seems to be the same thing that Dave Jones was seeing here:

https://lkml.org/lkml/2016/8/12/334

There are multiple issues here:

1) If we enter the function with a non-empty buffer, there is an attempt to flush it. But it was not clearing m->from after doing so, which means that if we try to do this flush twice in a row without any call to traverse() in between, we are going to be reading from the wrong place -- the splat above, fixed by this patch.

2) If there's a short write to userspace because of page faults, the buffer may already contain multiple lines (i.e. pos has advanced by more than 1), but we don't save the progress that was made so the next call will output what we've already returned previously. Since that is a much less serious issue (and I have a headache after staring at seq_read() for the past 8 hours), I'll leave that for now.

---
 fs/seq_file.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/seq_file.c +3 -1
@@ -223,8 +223,10 @@ ssize_t seq_read(struct file *file, char
 		size -= n;
 		buf += n;
 		copied += n;
-		if (!m->count)
+		if (!m->count) {
+			m->from = 0;
 			m->index++;
+		}
 		if (!size)
 			goto Done;
 	}
author maintainer
#89 lore raw

PATCH 108/143 soft_dirty: fix soft_dirty during THP split

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Andrea Arcangeli <[email protected]>

commit 804dd150468cfd920d92d4b3cf00536fedef3902 upstream.

While adding proper userfaultfd_wp support with bits in pagetable and swap entry to avoid false positives WP userfaults through swap/fork/ KSM/etc, I've been adding a framework that mostly mirrors soft dirty.

So I noticed in one place I had to add uffd_wp support to the pagetables that wasn't covered by soft_dirty and I think it should have.

Example: in the THP migration code migrate_misplaced_transhuge_page() pmd_mkdirty is called unconditionally after mk_huge_pmd.

	entry = mk_huge_pmd(new_page, vma->vm_page_prot);
	entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma);

That sets soft dirty too (it's a false positive for soft dirty, the soft dirty bit could be more finegrained and transfer the bit like uffd_wp will do.. pmd/pte_uffd_wp() enforces the invariant that when it's set pmd/pte_write is not set).

However in the THP split there's no unconditional pmd_mkdirty after mk_huge_pmd and pte_swp_mksoft_dirty isn't called after the migration entry is created. The code sets the dirty bit in the struct page instead of setting it in the pagetable (which is fully equivalent as far as the real dirty bit is concerned, as the whole point of pagetable bits is to be eventually flushed out of to the page, but that is not equivalent for the soft-dirty bit that gets lost in translation).

This was found by code review only and totally untested as I'm working to actually replace soft dirty and I don't have time to test potential soft dirty bugfixes as well :).

Transfer the soft_dirty from pmd to pte during THP splits.

This fix avoids losing the soft_dirty bit and avoids userland memory corruption in the checkpoint.

---
 mm/huge_memory.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
mm/huge_memory.c +6 -1
@@ -2872,7 +2872,7 @@ static void __split_huge_pmd_locked(stru
 	struct page *page;
 	pgtable_t pgtable;
 	pmd_t _pmd;
-	bool young, write, dirty;
+	bool young, write, dirty, soft_dirty;
 	unsigned long addr;
 	int i;
 
@@ -2898,6 +2898,7 @@ static void __split_huge_pmd_locked(stru
 	write = pmd_write(*pmd);
 	young = pmd_young(*pmd);
 	dirty = pmd_dirty(*pmd);
+	soft_dirty = pmd_soft_dirty(*pmd);
 
 	pmdp_huge_split_prepare(vma, haddr, pmd);
 	pgtable = pgtable_trans_huge_withdraw(mm, pmd);
@@ -2914,6 +2915,8 @@ static void __split_huge_pmd_locked(stru
 			swp_entry_t swp_entry;
 			swp_entry = make_migration_entry(page + i, write);
 			entry = swp_entry_to_pte(swp_entry);
+			if (soft_dirty)
+				entry = pte_swp_mksoft_dirty(entry);
 		} else {
 			entry = mk_pte(page + i, vma->vm_page_prot);
 			entry = maybe_mkwrite(entry, vma);
@@ -2921,6 +2924,8 @@ static void __split_huge_pmd_locked(stru
 				entry = pte_wrprotect(entry);
 			if (!young)
 				entry = pte_mkold(entry);
+			if (soft_dirty)
+				entry = pte_mksoft_dirty(entry);
 		}
 		if (dirty)
 			SetPageDirty(page + i);
author maintainer
#90 lore raw

PATCH 109/143 dax: fix device-dax region base

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Dan Williams <[email protected]>

commit d0e5845561c238619de9f5b77e0d763f4c331ca5 upstream.

The data offset for a dax region needs to account for a reservation in the resource range. Otherwise, device-dax is allowing mappings directly into the memmap or device-info-block area with crash signatures like the following:

 BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
 IP: get_zone_device_page+0x11/0x30
 Call Trace:
   follow_devmap_pmd+0x298/0x2c0
   follow_page_mask+0x275/0x530
   __get_user_pages+0xe3/0x750
   __gfn_to_pfn_memslot+0x1b2/0x450 [kvm]
   tdp_page_fault+0x130/0x280 [kvm]
   kvm_mmu_page_fault+0x5f/0xf0 [kvm]
   handle_ept_violation+0x94/0x180 [kvm_intel]
   vmx_handle_exit+0x1d3/0x1440 [kvm_intel]
   kvm_arch_vcpu_ioctl_run+0x81d/0x16a0 [kvm]
   kvm_vcpu_ioctl+0x33c/0x620 [kvm]
   do_vfs_ioctl+0xa2/0x5d0
   SyS_ioctl+0x79/0x90
   entry_SYSCALL_64_fastpath+0x1a/0xa4
---
 drivers/dax/pmem.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/dax/pmem.c +3 -0
@@ -118,6 +118,9 @@ static int dax_pmem_probe(struct device
 		return rc;
 	}
 
+	/* adjust the dax_region resource to the start of data */
+	res.start += le64_to_cpu(pfn_sb->dataoff);
+
 	nd_region = to_nd_region(dev->parent);
 	dax_region = alloc_dax_region(dev, nd_region->id, &res,
 			le32_to_cpu(pfn_sb->align), addr, PFN_DEV|PFN_MAP);
author maintainer
#91 lore raw

PATCH 110/143 mm: silently skip readahead for DAX inodes

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Ross Zwisler <[email protected]>

commit 11bd969fdefea3ac0cb9791224f1e09784e21e58 upstream.

For DAX inodes we need to be careful to never have page cache pages in the mapping->page_tree. This radix tree should be composed only of DAX exceptional entries and zero pages.

ltp's readahead02 test was triggering a warning because we were trying to insert a DAX exceptional entry but found that a page cache page had already been inserted into the tree. This page was being inserted into the radix tree in response to a readahead(2) call.

Readahead doesn't make sense for DAX inodes, but we don't want it to report a failure either. Instead, we just return success and don't do any work.

---
 mm/readahead.c |    9 +++++++++
 1 file changed, 9 insertions(+)
mm/readahead.c +9 -0
@@ -8,6 +8,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/dax.h>
 #include <linux/gfp.h>
 #include <linux/export.h>
 #include <linux/blkdev.h>
@@ -545,6 +546,14 @@ do_readahead(struct address_space *mappi
 	if (!mapping || !mapping->a_ops)
 		return -EINVAL;
 
+	/*
+	 * Readahead doesn't make sense for DAX inodes, but we don't want it
+	 * to report a failure either.  Instead, we just return success and
+	 * don't do any work.
+	 */
+	if (dax_mapping(mapping))
+		return 0;
+
 	return force_page_cache_readahead(mapping, filp, index, nr);
 }
 
author maintainer
#92 lore raw

PATCH 111/143 btrfs: waiting on qgroup rescan should not always be interruptible

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Jeff Mahoney <[email protected]>

commit d06f23d6a947c9abae41dc46be69a56baf36f436 upstream.

We wait on qgroup rescan completion in three places: file system shutdown, the quota disable ioctl, and the rescan wait ioctl. If the user sends a signal while we're waiting, we continue happily along. This is expected behavior for the rescan wait ioctl. It's racy in the shutdown path but mostly works due to other unrelated synchronization points. In the quota disable path, it Oopses the kernel pretty much immediately.

---
 fs/btrfs/disk-io.c |    2 +-
 fs/btrfs/ioctl.c   |    2 +-
 fs/btrfs/qgroup.c  |   12 +++++++++---
 fs/btrfs/qgroup.h  |    3 ++-
 4 files changed, 13 insertions(+), 6 deletions(-)
fs/btrfs/disk-io.c +1 -1
@@ -3849,7 +3849,7 @@ void close_ctree(struct btrfs_root *root
 	smp_mb();
 
 	/* wait for the qgroup rescan worker to stop */
-	btrfs_qgroup_wait_for_completion(fs_info);
+	btrfs_qgroup_wait_for_completion(fs_info, false);
 
 	/* wait for the uuid_scan task to finish */
 	down(&fs_info->uuid_tree_rescan_sem);
fs/btrfs/ioctl.c +1 -1
@@ -5088,7 +5088,7 @@ static long btrfs_ioctl_quota_rescan_wai
 	if (!capable(CAP_SYS_ADMIN))
 		return -EPERM;
 
-	return btrfs_qgroup_wait_for_completion(root->fs_info);
+	return btrfs_qgroup_wait_for_completion(root->fs_info, true);
 }
 
 static long _btrfs_ioctl_set_received_subvol(struct file *file,
fs/btrfs/qgroup.c +9 -3
@@ -995,7 +995,7 @@ int btrfs_quota_disable(struct btrfs_tra
 		goto out;
 	fs_info->quota_enabled = 0;
 	fs_info->pending_quota_state = 0;
-	btrfs_qgroup_wait_for_completion(fs_info);
+	btrfs_qgroup_wait_for_completion(fs_info, false);
 	spin_lock(&fs_info->qgroup_lock);
 	quota_root = fs_info->quota_root;
 	fs_info->quota_root = NULL;
@@ -2486,7 +2486,8 @@ btrfs_qgroup_rescan(struct btrfs_fs_info
 	return 0;
 }
 
-int btrfs_qgroup_wait_for_completion(struct btrfs_fs_info *fs_info)
+int btrfs_qgroup_wait_for_completion(struct btrfs_fs_info *fs_info,
+				     bool interruptible)
 {
 	int running;
 	int ret = 0;
@@ -2497,9 +2498,14 @@ int btrfs_qgroup_wait_for_completion(str
 	spin_unlock(&fs_info->qgroup_lock);
 	mutex_unlock(&fs_info->qgroup_rescan_lock);
 
-	if (running)
+	if (!running)
+		return 0;
+
+	if (interruptible)
 		ret = wait_for_completion_interruptible(
 					&fs_info->qgroup_rescan_completion);
+	else
+		wait_for_completion(&fs_info->qgroup_rescan_completion);
 
 	return ret;
 }
fs/btrfs/qgroup.h +2 -1
@@ -46,7 +46,8 @@ int btrfs_quota_disable(struct btrfs_tra
 			struct btrfs_fs_info *fs_info);
 int btrfs_qgroup_rescan(struct btrfs_fs_info *fs_info);
 void btrfs_qgroup_rescan_resume(struct btrfs_fs_info *fs_info);
-int btrfs_qgroup_wait_for_completion(struct btrfs_fs_info *fs_info);
+int btrfs_qgroup_wait_for_completion(struct btrfs_fs_info *fs_info,
+				     bool interruptible);
 int btrfs_add_qgroup_relation(struct btrfs_trans_handle *trans,
 			      struct btrfs_fs_info *fs_info, u64 src, u64 dst);
 int btrfs_del_qgroup_relation(struct btrfs_trans_handle *trans,
author maintainer
#93 lore raw

PATCH 112/143 btrfs: properly track when rescan worker is running

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Jeff Mahoney <[email protected]>

commit d2c609b834d62f1e91f1635a27dca29f7806d3d6 upstream.

The qgroup_flags field is overloaded such that it reflects the on-disk status of qgroups and the runtime state. The BTRFS_QGROUP_STATUS_FLAG_RESCAN flag is used to indicate that a rescan operation is in progress, but if the file system is unmounted while a rescan is running, the rescan operation is paused. If the file system is then mounted read-only, the flag will still be present but the rescan operation will not have been resumed. When we go to umount, btrfs_qgroup_wait_for_completion will see the flag and interpret it to mean that the rescan worker is still running and will wait for a completion that will never come.

This patch uses a separate flag to indicate when the worker is running. The locking and state surrounding the qgroup rescan worker needs a lot of attention beyond this patch but this is enough to avoid a hung umount.

Signed-off-by; Jeff Mahoney <[email protected]>

---
 fs/btrfs/ctree.h   |    1 +
 fs/btrfs/disk-io.c |    1 +
 fs/btrfs/qgroup.c  |    9 ++++++++-
 3 files changed, 10 insertions(+), 1 deletion(-)
fs/btrfs/ctree.h +1 -0
@@ -1040,6 +1040,7 @@ struct btrfs_fs_info {
 	struct btrfs_workqueue *qgroup_rescan_workers;
 	struct completion qgroup_rescan_completion;
 	struct btrfs_work qgroup_rescan_work;
+	bool qgroup_rescan_running;	/* protected by qgroup_rescan_lock */
 
 	/* filesystem state */
 	unsigned long fs_state;
fs/btrfs/disk-io.c +1 -0
@@ -2306,6 +2306,7 @@ static void btrfs_init_qgroup(struct btr
 	fs_info->quota_enabled = 0;
 	fs_info->pending_quota_state = 0;
 	fs_info->qgroup_ulist = NULL;
+	fs_info->qgroup_rescan_running = false;
 	mutex_init(&fs_info->qgroup_rescan_lock);
 }
 
fs/btrfs/qgroup.c +8 -1
@@ -2302,6 +2302,10 @@ static void btrfs_qgroup_rescan_worker(s
 	int err = -ENOMEM;
 	int ret = 0;
 
+	mutex_lock(&fs_info->qgroup_rescan_lock);
+	fs_info->qgroup_rescan_running = true;
+	mutex_unlock(&fs_info->qgroup_rescan_lock);
+
 	path = btrfs_alloc_path();
 	if (!path)
 		goto out;
@@ -2368,6 +2372,9 @@ out:
 	}
 
 done:
+	mutex_lock(&fs_info->qgroup_rescan_lock);
+	fs_info->qgroup_rescan_running = false;
+	mutex_unlock(&fs_info->qgroup_rescan_lock);
 	complete_all(&fs_info->qgroup_rescan_completion);
 }
 
@@ -2494,7 +2501,7 @@ int btrfs_qgroup_wait_for_completion(str
 
 	mutex_lock(&fs_info->qgroup_rescan_lock);
 	spin_lock(&fs_info->qgroup_lock);
-	running = fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_RESCAN;
+	running = fs_info->qgroup_rescan_running;
 	spin_unlock(&fs_info->qgroup_lock);
 	mutex_unlock(&fs_info->qgroup_rescan_lock);
 
author maintainer
#94 lore raw

PATCH 113/143 btrfs: dont create or leak aliased root while cleaning up orphans

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Jeff Mahoney <[email protected]>

commit 35bbb97fc898aeb874cb7c8b746f091caa359994 upstream.

commit 909c3a22da3 (Btrfs: fix loading of orphan roots leading to BUG_ON) avoids the BUG_ON but can add an aliased root to the dead_roots list or leak the root.

Since we've already been loading roots into the radix tree, we should use it before looking the root up on disk.

---
 fs/btrfs/disk-io.c   |    4 ++--
 fs/btrfs/disk-io.h   |    2 ++
 fs/btrfs/root-tree.c |   27 ++++++++++++++++++---------
 3 files changed, 22 insertions(+), 11 deletions(-)
fs/btrfs/disk-io.c +2 -2
@@ -1626,8 +1626,8 @@ fail:
 	return ret;
 }
 
-static struct btrfs_root *btrfs_lookup_fs_root(struct btrfs_fs_info *fs_info,
-					       u64 root_id)
+struct btrfs_root *btrfs_lookup_fs_root(struct btrfs_fs_info *fs_info,
+					u64 root_id)
 {
 	struct btrfs_root *root;
 
fs/btrfs/disk-io.h +2 -0
@@ -68,6 +68,8 @@ struct extent_buffer *btrfs_find_tree_bl
 struct btrfs_root *btrfs_read_fs_root(struct btrfs_root *tree_root,
 				      struct btrfs_key *location);
 int btrfs_init_fs_root(struct btrfs_root *root);
+struct btrfs_root *btrfs_lookup_fs_root(struct btrfs_fs_info *fs_info,
+					u64 root_id);
 int btrfs_insert_fs_root(struct btrfs_fs_info *fs_info,
 			 struct btrfs_root *root);
 void btrfs_free_fs_roots(struct btrfs_fs_info *fs_info);
fs/btrfs/root-tree.c +18 -9
@@ -272,6 +272,23 @@ int btrfs_find_orphan_roots(struct btrfs
 		root_key.objectid = key.offset;
 		key.offset++;
 
+		/*
+		 * The root might have been inserted already, as before we look
+		 * for orphan roots, log replay might have happened, which
+		 * triggers a transaction commit and qgroup accounting, which
+		 * in turn reads and inserts fs roots while doing backref
+		 * walking.
+		 */
+		root = btrfs_lookup_fs_root(tree_root->fs_info,
+					    root_key.objectid);
+		if (root) {
+			WARN_ON(!test_bit(BTRFS_ROOT_ORPHAN_ITEM_INSERTED,
+					  &root->state));
+			if (btrfs_root_refs(&root->root_item) == 0)
+				btrfs_add_dead_root(root);
+			continue;
+		}
+
 		root = btrfs_read_fs_root(tree_root, &root_key);
 		err = PTR_ERR_OR_ZERO(root);
 		if (err && err != -ENOENT) {
@@ -310,16 +327,8 @@ int btrfs_find_orphan_roots(struct btrfs
 		set_bit(BTRFS_ROOT_ORPHAN_ITEM_INSERTED, &root->state);
 
 		err = btrfs_insert_fs_root(root->fs_info, root);
-		/*
-		 * The root might have been inserted already, as before we look
-		 * for orphan roots, log replay might have happened, which
-		 * triggers a transaction commit and qgroup accounting, which
-		 * in turn reads and inserts fs roots while doing backref
-		 * walking.
-		 */
-		if (err == -EEXIST)
-			err = 0;
 		if (err) {
+			BUG_ON(err == -EEXIST);
 			btrfs_free_fs_root(root);
 			break;
 		}
author maintainer
#95 lore raw

PATCH 114/143 Revert "floppy: fix open(O_ACCMODE) for ioctl-only open"

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Jens Axboe <[email protected]>

commit 468c298ad3ed3f0d94a65f8ca00f6bfc6c2b4e33 upstream.

This reverts commit ff06db1efb2ad6db06eb5b99b88a0c15a9cc9b0e.

---
 drivers/block/floppy.c |   21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/block/floppy.c +12 -9
@@ -3663,6 +3663,11 @@ static int floppy_open(struct block_devi
 
 	opened_bdev[drive] = bdev;
 
+	if (!(mode & (FMODE_READ|FMODE_WRITE))) {
+		res = -EINVAL;
+		goto out;
+	}
+
 	res = -ENXIO;
 
 	if (!floppy_track_buffer) {
@@ -3706,15 +3711,13 @@ static int floppy_open(struct block_devi
 	if (UFDCS->rawcmd == 1)
 		UFDCS->rawcmd = 2;
 
-	if (mode & (FMODE_READ|FMODE_WRITE)) {
-		UDRS->last_checked = 0;
-		clear_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags);
-		check_disk_change(bdev);
-		if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags))
-			goto out;
-		if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags))
-			goto out;
-	}
+	UDRS->last_checked = 0;
+	clear_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags);
+	check_disk_change(bdev);
+	if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags))
+		goto out;
+	if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags))
+		goto out;
 
 	res = -EROFS;
 
#96 lore raw

Re: [PATCH 4.7 114/143] Revert "floppy: fix open(O_ACCMODE) for ioctl-only open"

Quoted 46 lines · Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Jens Axboe <[email protected]>

commit 468c298ad3ed3f0d94a65f8ca00f6bfc6c2b4e33 upstream.

This reverts commit ff06db1efb2ad6db06eb5b99b88a0c15a9cc9b0e.

---
 drivers/block/floppy.c |   21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/block/floppy.c +5 -9
@@ -3663,6 +3663,11 @@ static int floppy_open(struct block_devi
 
 	opened_bdev[drive] = bdev;
 
+	if (!(mode & (FMODE_READ|FMODE_WRITE))) {
+		res = -EINVAL;
+		goto out;
+	}
+
 	res = -ENXIO;
 
 	if (!floppy_track_buffer) {
@@ -3706,15 +3711,13 @@ static int floppy_open(struct block_devi
 	if (UFDCS->rawcmd == 1)
 		UFDCS->rawcmd = 2;
 
-	if (mode & (FMODE_READ|FMODE_WRITE)) {
-		UDRS->last_checked = 0;
-		clear_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags);
-		check_disk_change(bdev);
-		if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags))
-			goto out;
-		if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags))
-			goto out;
-	}

drivers/block/floppy.c static int floppy_open(struct block_devi · line 3723

Quoted 10 lines
drivers/block/floppy.c +7 -0
+	UDRS->last_checked = 0;
+	clear_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags);
+	check_disk_change(bdev);
+	if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags))
+		goto out;
+	if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags))
+		goto out;
 
 	res = -EROFS;
 

Can I assume the one to revert 09954bad448791ef01202351d437abdd9497a804 will be a separate one?

Thanks
Mark

author maintainer
#97 lore raw

Re: [PATCH 4.7 114/143] Revert "floppy: fix open(O_ACCMODE) for ioctl-only open"

Quoted 52 lines · Mark Hounschell
Quoted 51 lines · Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Jens Axboe <[email protected]>

commit 468c298ad3ed3f0d94a65f8ca00f6bfc6c2b4e33 upstream.

This reverts commit ff06db1efb2ad6db06eb5b99b88a0c15a9cc9b0e.

---
 drivers/block/floppy.c |   21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/block/floppy.c +12 -9
@@ -3663,6 +3663,11 @@ static int floppy_open(struct block_devi
 
 	opened_bdev[drive] = bdev;
 
+	if (!(mode & (FMODE_READ|FMODE_WRITE))) {
+		res = -EINVAL;
+		goto out;
+	}
+
 	res = -ENXIO;
 
 	if (!floppy_track_buffer) {
@@ -3706,15 +3711,13 @@ static int floppy_open(struct block_devi
 	if (UFDCS->rawcmd == 1)
 		UFDCS->rawcmd = 2;
 
-	if (mode & (FMODE_READ|FMODE_WRITE)) {
-		UDRS->last_checked = 0;
-		clear_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags);
-		check_disk_change(bdev);
-		if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags))
-			goto out;
-		if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags))
-			goto out;
-	}
+	UDRS->last_checked = 0;
+	clear_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags);
+	check_disk_change(bdev);
+	if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags))
+		goto out;
+	if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags))
+		goto out;
 
Quoted 8 lines

drivers/block/floppy.c static int floppy_open(struct block_devi · line 3723

Quoted 5 lines
drivers/block/floppy.c +0 -0
 	res = -EROFS;
 

Can I assume the one to revert 09954bad448791ef01202351d437abdd9497a804 will be a separate one?

Hm, I didn't think I needed that here. What is the git commit id of that patch in Linus's tree?

sorry about this,

greg k-h

#98 lore raw

Re: [PATCH 4.7 114/143] Revert "floppy: fix open(O_ACCMODE) for ioctl-only open"

Quoted 2 lines · Greg Kroah-Hartman

Hm, I didn't think I needed that here. What is the git commit id of that patch in Linus's tree?

It's f2791e7ea. Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs
author maintainer
#99 lore raw

Re: [PATCH 4.7 114/143] Revert "floppy: fix open(O_ACCMODE) for ioctl-only open"

Quoted 6 lines · Jiri Kosina
Quoted 2 lines · Greg Kroah-Hartman

Hm, I didn't think I needed that here. What is the git commit id of that patch in Linus's tree?

It's f2791e7ea. Thanks,

Thanks, now queued up.

greg k-h

author maintainer
#100 lore raw

PATCH 115/143 Input: tegra-kbc - fix inverted reset logic

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Masahiro Yamada <[email protected]>

commit fae16989be77b09bab86c79233e4b511ea769cea upstream.

Commit fe6b0dfaba68 ("Input: tegra-kbc - use reset framework") accidentally converted _deassert to _assert, so there is no code to wake up this hardware.

---
 drivers/input/keyboard/tegra-kbc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/keyboard/tegra-kbc.c +1 -1
@@ -376,7 +376,7 @@ static int tegra_kbc_start(struct tegra_
 	/* Reset the KBC controller to clear all previous status.*/
 	reset_control_assert(kbc->rst);
 	udelay(100);
-	reset_control_assert(kbc->rst);
+	reset_control_deassert(kbc->rst);
 	udelay(100);
 
 	tegra_kbc_config_pins(kbc);
author maintainer
#101 lore raw

PATCH 116/143 Input: synaptics-rmi4 - fix register descriptor subpacket map construction

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Andrew Duggan <[email protected]>

commit 3e29d6bb6433ebfa4e187b1164b80baf720d58c3 upstream.

The map_offset variable is specific to the register and needs to be reset in the loop. Otherwise, subsequent register's subpacket maps will have their bits set at the wrong index.

---
 drivers/input/rmi4/rmi_driver.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/input/rmi4/rmi_driver.c +2 -1
@@ -553,7 +553,6 @@ int rmi_read_register_desc(struct rmi_de
 		goto free_struct_buff;
 
 	reg = find_first_bit(rdesc->presense_map, RMI_REG_DESC_PRESENSE_BITS);
-	map_offset = 0;
 	for (i = 0; i < rdesc->num_registers; i++) {
 		struct rmi_register_desc_item *item = &rdesc->registers[i];
 		int reg_size = struct_buf[offset];
@@ -576,6 +575,8 @@ int rmi_read_register_desc(struct rmi_de
 		item->reg = reg;
 		item->reg_size = reg_size;
 
+		map_offset = 0;
+
 		do {
 			for (b = 0; b < 7; b++) {
 				if (struct_buf[offset] & (0x1 << b))
author maintainer
#102 lore raw

PATCH 117/143 Input: i8042 - break load dependency between atkbd/psmouse and i8042

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Dmitry Torokhov <[email protected]>

commit 4097461897df91041382ff6fcd2bfa7ee6b2448c upstream.

As explained in [email protected] we have a hard load dependency between i8042 and atkbd which prevents keyboard from working on Gen2 Hyper-V VMs.

Quoted 6 lines

hyperv_keyboard invokes serio_interrupt(), which needs a valid serio driver like atkbd.c. atkbd.c depends on libps2.c because it invokes ps2_command(). libps2.c depends on i8042.c because it invokes i8042_check_port_owner(). As a result, hyperv_keyboard actually depends on i8042.c.

Quoted 6 lines

For a Generation 2 Hyper-V VM (meaning no i8042 device emulated), if a Linux VM (like Arch Linux) happens to configure CONFIG_SERIO_I8042=m rather than =y, atkbd.ko can't load because i8042.ko can't load(due to no i8042 device emulated) and finally hyperv_keyboard can't work and the user can't input: https://bugs.archlinux.org/task/39820
(Ubuntu/RHEL/SUSE aren't affected since they use CONFIG_SERIO_I8042=y)

To break the dependency we move away from using i8042_check_port_owner() and instead allow serio port owner specify a mutex that clients should use to serialize PS/2 command stream.

---
 drivers/input/serio/i8042.c  |   16 +---------------
 drivers/input/serio/libps2.c |   10 ++++------
 include/linux/i8042.h        |    6 ------
 include/linux/serio.h        |   24 +++++++++++++++++++-----
 4 files changed, 24 insertions(+), 32 deletions(-)
drivers/input/serio/i8042.c +1 -15
@@ -1277,6 +1277,7 @@ static int __init i8042_create_kbd_port(
 	serio->start		= i8042_start;
 	serio->stop		= i8042_stop;
 	serio->close		= i8042_port_close;
+	serio->ps2_cmd_mutex	= &i8042_mutex;
 	serio->port_data	= port;
 	serio->dev.parent	= &i8042_platform_device->dev;
 	strlcpy(serio->name, "i8042 KBD port", sizeof(serio->name));
@@ -1373,21 +1374,6 @@ static void i8042_unregister_ports(void)
 	}
 }
 
-/*
- * Checks whether port belongs to i8042 controller.
- */
-bool i8042_check_port_owner(const struct serio *port)
-{
-	int i;
-
-	for (i = 0; i < I8042_NUM_PORTS; i++)
-		if (i8042_ports[i].serio == port)
-			return true;
-
-	return false;
-}
-EXPORT_SYMBOL(i8042_check_port_owner);
-
 static void i8042_free_irqs(void)
 {
 	if (i8042_aux_irq_registered)
drivers/input/serio/libps2.c +4 -6
@@ -56,19 +56,17 @@ EXPORT_SYMBOL(ps2_sendbyte);
 
 void ps2_begin_command(struct ps2dev *ps2dev)
 {
-	mutex_lock(&ps2dev->cmd_mutex);
+	struct mutex *m = ps2dev->serio->ps2_cmd_mutex ?: &ps2dev->cmd_mutex;
 
-	if (i8042_check_port_owner(ps2dev->serio))
-		i8042_lock_chip();
+	mutex_lock(m);
 }
 EXPORT_SYMBOL(ps2_begin_command);
 
 void ps2_end_command(struct ps2dev *ps2dev)
 {
-	if (i8042_check_port_owner(ps2dev->serio))
-		i8042_unlock_chip();
+	struct mutex *m = ps2dev->serio->ps2_cmd_mutex ?: &ps2dev->cmd_mutex;
 
-	mutex_unlock(&ps2dev->cmd_mutex);
+	mutex_unlock(m);
 }
 EXPORT_SYMBOL(ps2_end_command);
 
include/linux/i8042.h +0 -6
@@ -62,7 +62,6 @@ struct serio;
 void i8042_lock_chip(void);
 void i8042_unlock_chip(void);
 int i8042_command(unsigned char *param, int command);
-bool i8042_check_port_owner(const struct serio *);
 int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str,
 					struct serio *serio));
 int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str,
@@ -83,11 +82,6 @@ static inline int i8042_command(unsigned
 	return -ENODEV;
 }
 
-static inline bool i8042_check_port_owner(const struct serio *serio)
-{
-	return false;
-}
-
 static inline int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str,
 					struct serio *serio))
 {
include/linux/serio.h +19 -5
@@ -31,7 +31,8 @@ struct serio {
 
 	struct serio_device_id id;
 
-	spinlock_t lock;		/* protects critical sections from port's interrupt handler */
+	/* Protects critical sections from port's interrupt handler */
+	spinlock_t lock;
 
 	int (*write)(struct serio *, unsigned char);
 	int (*open)(struct serio *);
@@ -40,16 +41,29 @@ struct serio {
 	void (*stop)(struct serio *);
 
 	struct serio *parent;
-	struct list_head child_node;	/* Entry in parent->children list */
+	/* Entry in parent->children list */
+	struct list_head child_node;
 	struct list_head children;
-	unsigned int depth;		/* level of nesting in serio hierarchy */
+	/* Level of nesting in serio hierarchy */
+	unsigned int depth;
 
-	struct serio_driver *drv;	/* accessed from interrupt, must be protected by serio->lock and serio->sem */
-	struct mutex drv_mutex;		/* protects serio->drv so attributes can pin driver */
+	/*
+	 * serio->drv is accessed from interrupt handlers; when modifying
+	 * caller should acquire serio->drv_mutex and serio->lock.
+	 */
+	struct serio_driver *drv;
+	/* Protects serio->drv so attributes can pin current driver */
+	struct mutex drv_mutex;
 
 	struct device dev;
 
 	struct list_head node;
+
+	/*
+	 * For use by PS/2 layer when several ports share hardware and
+	 * may get indigestion when exposed to concurrent access (i8042).
+	 */
+	struct mutex *ps2_cmd_mutex;
 };
 #define to_serio_port(d)	container_of(d, struct serio, dev)
 
author maintainer
#103 lore raw

PATCH 118/143 Input: i8042 - set up shared ps2_cmd_mutex for AUX ports

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Dmitry Torokhov <[email protected]>

commit 47af45d684b5f3ae000ad448db02ce4f13f73273 upstream.

The commit 4097461897df ("Input: i8042 - break load dependency ...") correctly set up ps2_cmd_mutex pointer for the KBD port but forgot to do the same for AUX port(s), which results in communication on KBD and AUX ports to clash with each other.

Fixes 4097461897df ("Input: i8042 - break load dependency ...")
---
 drivers/input/serio/i8042.c |    1 +
 1 file changed, 1 insertion(+)
drivers/input/serio/i8042.c +1 -0
@@ -1305,6 +1305,7 @@ static int __init i8042_create_aux_port(
 	serio->write		= i8042_aux_write;
 	serio->start		= i8042_start;
 	serio->stop		= i8042_stop;
+	serio->ps2_cmd_mutex	= &i8042_mutex;
 	serio->port_data	= port;
 	serio->dev.parent	= &i8042_platform_device->dev;
 	if (idx < 0) {
author maintainer
#104 lore raw

PATCH 119/143 crypto: nx - off by one bug in nx_of_update_msc()

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <[email protected]>

commit e514cc0a492a3f39ef71b31590a7ef67537ee04b upstream.

The props->ap[] array is defined like this:

	struct alg_props ap[NX_MAX_FC][NX_MAX_MODE][3];

So we can see that if msc->fc and msc->mode are == to NX_MAX_FC or NX_MAX_MODE then we're off by one.

Fixes ae0222b7289d ('powerpc/crypto: nx driver code supporting nx encryption')
---
 drivers/crypto/nx/nx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/nx/nx.c +1 -1
@@ -392,7 +392,7 @@ static void nx_of_update_msc(struct devi
 		     ((bytes_so_far + sizeof(struct msc_triplet)) <= lenp) &&
 		     i < msc->triplets;
 		     i++) {
-			if (msc->fc > NX_MAX_FC || msc->mode > NX_MAX_MODE) {
+			if (msc->fc >= NX_MAX_FC || msc->mode >= NX_MAX_MODE) {
 				dev_err(dev, "unknown function code/mode "
 					"combo: %d/%d (ignored)\n", msc->fc,
 					msc->mode);
author maintainer
#105 lore raw

PATCH 120/143 crypto: qat - fix aes-xts key sizes

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Giovanni Cabiddu <[email protected]>

commit 10bb087ce381c812cd81a65ffd5e6f83e6399291 upstream.

Increase value of supported key sizes for qat_aes_xts. aes-xts keys consists of keys of equal size concatenated.

Fixes def14bfaf30d ("crypto: qat - add support for ctr(aes) and xts(aes)")
---
 drivers/crypto/qat/qat_common/qat_algs.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/qat/qat_common/qat_algs.c +2 -2
@@ -1260,8 +1260,8 @@ static struct crypto_alg qat_algs[] = {
 			.setkey = qat_alg_ablkcipher_xts_setkey,
 			.decrypt = qat_alg_ablkcipher_decrypt,
 			.encrypt = qat_alg_ablkcipher_encrypt,
-			.min_keysize = AES_MIN_KEY_SIZE,
-			.max_keysize = AES_MAX_KEY_SIZE,
+			.min_keysize = 2 * AES_MIN_KEY_SIZE,
+			.max_keysize = 2 * AES_MAX_KEY_SIZE,
 			.ivsize = AES_BLOCK_SIZE,
 		},
 	},
author maintainer
#106 lore raw

PATCH 121/143 dmaengine: usb-dmac: check CHCR.DE bit in usb_dmac_isr_channel()

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Yoshihiro Shimoda <[email protected]>

commit 626d2f07de89bf6be3d7301524d0ab3375b81b9c upstream.

The USB-DMAC's interruption happens even if the CHCR.DE is not set to 1 because CHCR.NULLE is set to 1. So, this driver should call usb_dmac_isr_transfer_end() if the DE bit is set to 1 only. Otherwise, the desc is possible to be NULL in the usb_dmac_isr_transfer_end().

Fixes 0c1c8ff32fa2 ("dmaengine: usb-dmac: Add Renesas USB DMA Controller (USB-DMAC) driver)
---
 drivers/dma/sh/usb-dmac.c |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/dma/sh/usb-dmac.c +11 -8
@@ -600,27 +600,30 @@ static irqreturn_t usb_dmac_isr_channel(
 {
 	struct usb_dmac_chan *chan = dev;
 	irqreturn_t ret = IRQ_NONE;
-	u32 mask = USB_DMACHCR_TE;
-	u32 check_bits = USB_DMACHCR_TE | USB_DMACHCR_SP;
+	u32 mask = 0;
 	u32 chcr;
+	bool xfer_end = false;
 
 	spin_lock(&chan->vc.lock);
 
 	chcr = usb_dmac_chan_read(chan, USB_DMACHCR);
-	if (chcr & check_bits)
-		mask |= USB_DMACHCR_DE | check_bits;
+	if (chcr & (USB_DMACHCR_TE | USB_DMACHCR_SP)) {
+		mask |= USB_DMACHCR_DE | USB_DMACHCR_TE | USB_DMACHCR_SP;
+		if (chcr & USB_DMACHCR_DE)
+			xfer_end = true;
+		ret |= IRQ_HANDLED;
+	}
 	if (chcr & USB_DMACHCR_NULL) {
 		/* An interruption of TE will happen after we set FTE */
 		mask |= USB_DMACHCR_NULL;
 		chcr |= USB_DMACHCR_FTE;
 		ret |= IRQ_HANDLED;
 	}
-	usb_dmac_chan_write(chan, USB_DMACHCR, chcr & ~mask);
+	if (mask)
+		usb_dmac_chan_write(chan, USB_DMACHCR, chcr & ~mask);
 
-	if (chcr & check_bits) {
+	if (xfer_end)
 		usb_dmac_isr_transfer_end(chan);
-		ret |= IRQ_HANDLED;
-	}
 
 	spin_unlock(&chan->vc.lock);
 
author maintainer
#107 lore raw

PATCH 123/143 usb: chipidea: udc: dont touch DP when controller is in host mode

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Li Jun <[email protected]>

commit c4e94174983a86c935be1537a73e496b778b0287 upstream.

When the controller is configured to be dual role and it's in host mode, if bind udc and gadgt driver, those gadget operations will do gadget disconnect and finally pull down DP line, which will break host function.

---
 drivers/usb/chipidea/udc.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/chipidea/udc.c +5 -2
@@ -1596,8 +1596,11 @@ static int ci_udc_pullup(struct usb_gadg
 {
 	struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget);
 
-	/* Data+ pullup controlled by OTG state machine in OTG fsm mode */
-	if (ci_otg_is_fsm_mode(ci))
+	/*
+	 * Data+ pullup controlled by OTG state machine in OTG fsm mode;
+	 * and don't touch Data+ in host mode for dual role config.
+	 */
+	if (ci_otg_is_fsm_mode(ci) || ci->role == CI_ROLE_HOST)
 		return 0;
 
 	pm_runtime_get_sync(&ci->gadget.dev);
author maintainer
#108 lore raw

PATCH 124/143 USB: fix typo in wMaxPacketSize validation

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Alan Stern <[email protected]>

commit 6c73358c83ce870c0cf32413e5cadb3b9a39c606 upstream.

The maximum value allowed for wMaxPacketSize of a high-speed interrupt endpoint is 1024 bytes, not 1023.

Fixes aed9d65ac327 ("USB: validate wMaxPacketValue entries in endpoint descriptors")
---
 drivers/usb/core/config.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/core/config.c +1 -1
@@ -187,7 +187,7 @@ static const unsigned short high_speed_m
 	[USB_ENDPOINT_XFER_CONTROL] = 64,
 	[USB_ENDPOINT_XFER_ISOC] = 1024,
 	[USB_ENDPOINT_XFER_BULK] = 512,
-	[USB_ENDPOINT_XFER_INT] = 1023,
+	[USB_ENDPOINT_XFER_INT] = 1024,
 };
 static const unsigned short super_speed_maxpacket_maxes[4] = {
 	[USB_ENDPOINT_XFER_CONTROL] = 512,
author maintainer
#109 lore raw

PATCH 125/143 usb: gadget: udc: core: dont starve DMA resources

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Felipe Balbi <[email protected]>

commit 23fd537c9508fb6e3b93ddf23982f51afc087781 upstream.

Always unmap all SG entries as required by DMA API

Fixes a698908d3b3b ("usb: gadget: add generic map/unmap request utilities")
---
 drivers/usb/gadget/udc/udc-core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/udc-core.c +1 -1
@@ -106,7 +106,7 @@ void usb_gadget_unmap_request_by_dev(str
 		return;
 
 	if (req->num_mapped_sgs) {
-		dma_unmap_sg(dev, req->sg, req->num_mapped_sgs,
+		dma_unmap_sg(dev, req->sg, req->num_sgs,
 				is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
 
 		req->num_mapped_sgs = 0;
author maintainer
#110 lore raw

PATCH 126/143 USB: serial: mos7720: fix non-atomic allocation in write path

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Alexey Khoroshilov <[email protected]>

commit 5a5a1d614287a647b36dff3f40c2b0ceabbc83ec upstream.

There is an allocation with GFP_KERNEL flag in mos7720_write(), while it may be called from interrupt context.

Follow-up for commit 191252837626 ("USB: kobil_sct: fix non-atomic allocation in write path")

Found by Linux Driver Verification project (linuxtesting.org).

---
 drivers/usb/serial/mos7720.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/serial/mos7720.c +1 -1
@@ -1252,7 +1252,7 @@ static int mos7720_write(struct tty_stru
 
 	if (urb->transfer_buffer == NULL) {
 		urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
-					       GFP_KERNEL);
+					       GFP_ATOMIC);
 		if (!urb->transfer_buffer)
 			goto exit;
 	}
author maintainer
#111 lore raw

PATCH 127/143 USB: serial: mos7840: fix non-atomic allocation in write path

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Alexey Khoroshilov <[email protected]>

commit 3b7c7e52efda0d4640060de747768360ba70a7c0 upstream.

There is an allocation with GFP_KERNEL flag in mos7840_write(), while it may be called from interrupt context.

Follow-up for commit 191252837626 ("USB: kobil_sct: fix non-atomic allocation in write path")

Found by Linux Driver Verification project (linuxtesting.org).

---
 drivers/usb/serial/mos7840.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/serial/mos7840.c +2 -2
@@ -1340,8 +1340,8 @@ static int mos7840_write(struct tty_stru
 	}
 
 	if (urb->transfer_buffer == NULL) {
-		urb->transfer_buffer =
-		    kmalloc(URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL);
+		urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
+					       GFP_ATOMIC);
 		if (!urb->transfer_buffer)
 			goto exit;
 	}
author maintainer
#112 lore raw

PATCH 128/143 USB: serial: option: add WeTelecom WM-D200

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Aleksandr Makarov <[email protected]>

commit 6695593e4a7659db49ac6eca98c164f7b5589f72 upstream.

Add support for WeTelecom WM-D200.

T:  Bus=03 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  4 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=22de ProdID=6801 Rev=00.00
S:  Manufacturer=WeTelecom Incorporated
S:  Product=WeTelecom Mobile Products
C:  #Ifs= 4 Cfg#= 1 Atr=80 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
I:  If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
I:  If#= 3 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
---
 drivers/usb/serial/option.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/usb/serial/option.c +5 -0
@@ -525,6 +525,10 @@ static void option_instat_callback(struc
 #define VIATELECOM_VENDOR_ID			0x15eb
 #define VIATELECOM_PRODUCT_CDS7			0x0001
 
+/* WeTelecom products */
+#define WETELECOM_VENDOR_ID			0x22de
+#define WETELECOM_PRODUCT_WMD200		0x6801
+
 struct option_blacklist_info {
 	/* bitmask of interface numbers blacklisted for send_setup */
 	const unsigned long sendsetup;
@@ -1991,6 +1995,7 @@ static const struct usb_device_id option
 	{ USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) },                /* OLICARD300 - MT6225 */
 	{ USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) },
 	{ USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(WETELECOM_VENDOR_ID, WETELECOM_PRODUCT_WMD200, 0xff, 0xff, 0xff) },
 	{ } /* Terminating entry */
 };
 MODULE_DEVICE_TABLE(usb, option_ids);
author maintainer
#113 lore raw

PATCH 129/143 USB: serial: option: add WeTelecom 0x6802 and 0x6803 products

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Aleksandr Makarov <[email protected]>

commit 40d9c32525cba79130612650b1abc47c0c0f19a8 upstream.

These product IDs are listed in Windows driver.
0x6803 corresponds to WeTelecom WM-D300.
0x6802 name is unknown.

---
 drivers/usb/serial/option.c |    4 ++++
 1 file changed, 4 insertions(+)
drivers/usb/serial/option.c +4 -0
@@ -528,6 +528,8 @@ static void option_instat_callback(struc
 /* WeTelecom products */
 #define WETELECOM_VENDOR_ID			0x22de
 #define WETELECOM_PRODUCT_WMD200		0x6801
+#define WETELECOM_PRODUCT_6802			0x6802
+#define WETELECOM_PRODUCT_WMD300		0x6803
 
 struct option_blacklist_info {
 	/* bitmask of interface numbers blacklisted for send_setup */
@@ -1996,6 +1998,8 @@ static const struct usb_device_id option
 	{ USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) },
 	{ USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(WETELECOM_VENDOR_ID, WETELECOM_PRODUCT_WMD200, 0xff, 0xff, 0xff) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(WETELECOM_VENDOR_ID, WETELECOM_PRODUCT_6802, 0xff, 0xff, 0xff) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(WETELECOM_VENDOR_ID, WETELECOM_PRODUCT_WMD300, 0xff, 0xff, 0xff) },
 	{ } /* Terminating entry */
 };
 MODULE_DEVICE_TABLE(usb, option_ids);
author maintainer
#114 lore raw

PATCH 130/143 staging/lustre/llite: Close atomic_open race with several openers

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Oleg Drokin <[email protected]>

commit 99f1c013194e64d4b67d5d318148303b0e1585e1 upstream.

Right now, if it's an open of a negative dentry, a race is possible with several openers who all try to instantiate/rehash the same dentry and would hit a BUG_ON in d_add.
But in fact if we got a negative dentry in atomic_open, that means we just revalidated it so no point in talking to MDS at all, just return ENOENT and make the race go away completely.

---
 drivers/staging/lustre/lustre/llite/namei.c |   43 +++++++++++++++-------------
 1 file changed, 24 insertions(+), 19 deletions(-)
drivers/staging/lustre/lustre/llite/namei.c +24 -19
@@ -391,6 +391,7 @@ static int ll_lookup_it_finish(struct pt
 	struct inode *inode = NULL;
 	__u64 bits = 0;
 	int rc = 0;
+	struct dentry *alias;
 
 	/* NB 1 request reference will be taken away by ll_intent_lock()
 	 * when I return
@@ -415,26 +416,12 @@ static int ll_lookup_it_finish(struct pt
 		 */
 	}
 
-	/* Only hash *de if it is unhashed (new dentry).
-	 * Atoimc_open may passing hashed dentries for open.
-	 */
-	if (d_unhashed(*de)) {
-		struct dentry *alias;
-
-		alias = ll_splice_alias(inode, *de);
-		if (IS_ERR(alias)) {
-			rc = PTR_ERR(alias);
-			goto out;
-		}
-		*de = alias;
-	} else if (!it_disposition(it, DISP_LOOKUP_NEG)  &&
-		   !it_disposition(it, DISP_OPEN_CREATE)) {
-		/* With DISP_OPEN_CREATE dentry will be
-		 * instantiated in ll_create_it.
-		 */
-		LASSERT(!d_inode(*de));
-		d_instantiate(*de, inode);
+	alias = ll_splice_alias(inode, *de);
+	if (IS_ERR(alias)) {
+		rc = PTR_ERR(alias);
+		goto out;
 	}
+	*de = alias;
 
 	if (!it_disposition(it, DISP_LOOKUP_NEG)) {
 		/* we have lookup look - unhide dentry */
@@ -590,6 +577,24 @@ static int ll_atomic_open(struct inode *
 	       dentry, PFID(ll_inode2fid(dir)), dir, file, open_flags, mode,
 	       *opened);
 
+	/* Only negative dentries enter here */
+	LASSERT(!d_inode(dentry));
+
+	if (!d_in_lookup(dentry)) {
+		/* A valid negative dentry that just passed revalidation,
+		 * there's little point to try and open it server-side,
+		 * even though there's a minuscle chance it might succeed.
+		 * Either way it's a valid race to just return -ENOENT here.
+		 */
+		if (!(open_flags & O_CREAT))
+			return -ENOENT;
+
+		/* Otherwise we just unhash it to be rehashed afresh via
+		 * lookup if necessary
+		 */
+		d_drop(dentry);
+	}
+
 	it = kzalloc(sizeof(*it), GFP_NOFS);
 	if (!it)
 		return -ENOMEM;
author maintainer
#115 lore raw

PATCH 131/143 staging: comedi: daqboard2000: bug fix board type matching code

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Ian Abbott <[email protected]>

commit 80e162ee9b31d77d851b10f8c5299132be1e120f upstream.

daqboard2000_find_boardinfo() is supposed to check if the DaqBoard/2000 series model is supported, based on the PCI subvendor and subdevice ID. The current code is wrong as it is comparing the PCI device's subdevice ID to an expected, fixed value for the subvendor ID. It should be comparing the PCI device's subvendor ID to this fixed value. Correct it.

Fixes 7e8401b23e7f ("staging: comedi: daqboard2000: add back subsystem_device check")
---
 drivers/staging/comedi/drivers/daqboard2000.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/drivers/daqboard2000.c +1 -1
@@ -636,7 +636,7 @@ static const void *daqboard2000_find_boa
 	const struct daq200_boardtype *board;
 	int i;
 
-	if (pcidev->subsystem_device != PCI_VENDOR_ID_IOTECH)
+	if (pcidev->subsystem_vendor != PCI_VENDOR_ID_IOTECH)
 		return NULL;
 
 	for (i = 0; i < ARRAY_SIZE(boardtypes); i++) {
author maintainer
#116 lore raw

PATCH 133/143 staging: comedi: ni_mio_common: fix AO inttrig backwards compatibility

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Ian Abbott <[email protected]>

commit f0f4b0cc3a8cffd983f5940d46cd0227f3f5710a upstream.

Commit ebb657babfa9 ("staging: comedi: ni_mio_common: clarify the cmd->start_arg validation and use") introduced a backwards compatibility issue in the use of asynchronous commands on the AO subdevice when start_src is TRIG_EXT. Valid values for start_src are TRIG_INT (for internal, software trigger), and TRIG_EXT (for external trigger). When set to TRIG_EXT. In both cases, the driver relies on an internal, software trigger to set things up (allowing the user application to write sufficient samples to the data buffer before the trigger), so it acts as a software "pre-trigger" in the TRIG_EXT case. The software trigger is handled by ni_ao_inttrig().

Prior to the above change, when start_src was TRIG_INT, start_arg was required to be 0, and ni_ao_inttrig() checked that the software trigger number was also 0. After the above change, when start_src was TRIG_INT, any value was allowed for start_arg, and ni_ao_inttrig() checked that the software trigger number matched this start_arg value. The backwards compatibility issue is that the internal trigger number now has to match start_arg when start_src is TRIG_EXT when it previously had to be 0.

Fix the backwards compatibility issue in ni_ao_inttrig() by always allowing software trigger number 0 when start_src is something other than TRIG_INT.

Thanks to Spencer Olson for reporting the issue.

Fixes ebb657babfa9 ("staging: comedi: ni_mio_common: clarify the cmd->start_arg validation and use")
---
 drivers/staging/comedi/drivers/ni_mio_common.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/staging/comedi/drivers/ni_mio_common.c +9 -1
@@ -2772,7 +2772,15 @@ static int ni_ao_inttrig(struct comedi_d
 	int i;
 	static const int timeout = 1000;
 
-	if (trig_num != cmd->start_arg)
+	/*
+	 * Require trig_num == cmd->start_arg when cmd->start_src == TRIG_INT.
+	 * For backwards compatibility, also allow trig_num == 0 when
+	 * cmd->start_src != TRIG_INT (i.e. when cmd->start_src == TRIG_EXT);
+	 * in that case, the internal trigger is being used as a pre-trigger
+	 * before the external trigger.
+	 */
+	if (!(trig_num == cmd->start_arg ||
+	      (trig_num == 0 && cmd->start_src != TRIG_INT)))
 		return -EINVAL;
 
 	/*
author maintainer
#117 lore raw

PATCH 135/143 ACPI / drivers: fix typo in ACPI_DECLARE_PROBE_ENTRY macro

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Lorenzo Pieralisi <[email protected]>

commit 3feab13c919f99b0a17d0ca22ae00cf90f5d3fd1 upstream.

When the ACPI_DECLARE_PROBE_ENTRY macro was added in
commit e647b532275b ("ACPI: Add early device probing infrastructure"), a stub macro adding an unused entry was added for the !CONFIG_ACPI Kconfig option case to make sure kernel code making use of the macro did not require to be guarded within CONFIG_ACPI in order to be compiled.

The stub macro was never used since all kernel code that defines ACPI_DECLARE_PROBE_ENTRY entries is currently guarded within CONFIG_ACPI; it contains a typo that should be nonetheless fixed.

Fix the typo in the stub (ie !CONFIG_ACPI) ACPI_DECLARE_PROBE_ENTRY() macro so that it can actually be used if needed.

Fixes e647b532275b (ACPI: Add early device probing infrastructure)
---
 include/linux/acpi.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/acpi.h +1 -1
@@ -985,7 +985,7 @@ static inline struct fwnode_handle *acpi
 	return NULL;
 }
 
-#define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, subtable, validate, data, fn) \
+#define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, subtable, valid, data, fn) \
 	static const void * __acpi_table_##name[]			\
 		__attribute__((unused))					\
 		 = { (void *) table_id,					\
author maintainer
#118 lore raw

PATCH 136/143 ACPI / drivers: replace acpi_probe_lock spinlock with mutex

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Lorenzo Pieralisi <[email protected]>

commit 5331d9cab32ef640b4cd38a43b0858874fbb7168 upstream.

Commit e647b532275b ("ACPI: Add early device probing infrastructure") introduced code that allows inserting driver specific struct acpi_probe_entry probe entries into ACPI linker sections (one per-subsystem, eg irqchip, clocksource) that are then walked to retrieve the data and function hooks required to probe the respective kernel components.

Probing for all entries in a section is triggered through the __acpi_probe_device_table() function, that in turn, according to the table ID a given probe entry reports parses the table with the function retrieved from the respective section structures (ie struct acpi_probe_entry). Owing to the current ACPI table parsing implementation, the __acpi_probe_device_table() function has to share global variables with the acpi_match_madt() function, so in order to guarantee mutual exclusion locking is required between the two functions.

Current kernel code implements the locking through the acpi_probe_lock spinlock; this has the side effect of requiring all code called within the lock (ie struct acpi_probe_entry.probe_{table/subtbl} hooks) not to sleep.

However, kernel subsystems that make use of the early probing infrastructure are relying on kernel APIs that may sleep (eg irq_domain_alloc_fwnode(), among others) in the function calls pointed at by struct acpi_probe_entry.{probe_table/subtbl} entries (eg gic_v2_acpi_init()), which is a bug.

Since __acpi_probe_device_table() is called from context that is allowed to sleep the acpi_probe_lock spinlock can be replaced with a mutex; this fixes the issue whilst still guaranteeing mutual exclusion.

Fixes e647b532275b (ACPI: Add early device probing infrastructure)
---
 drivers/acpi/scan.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/acpi/scan.c +3 -3
@@ -1967,7 +1967,7 @@ int __init acpi_scan_init(void)
 
 static struct acpi_probe_entry *ape;
 static int acpi_probe_count;
-static DEFINE_SPINLOCK(acpi_probe_lock);
+static DEFINE_MUTEX(acpi_probe_mutex);
 
 static int __init acpi_match_madt(struct acpi_subtable_header *header,
 				  const unsigned long end)
@@ -1986,7 +1986,7 @@ int __init __acpi_probe_device_table(str
 	if (acpi_disabled)
 		return 0;
 
-	spin_lock(&acpi_probe_lock);
+	mutex_lock(&acpi_probe_mutex);
 	for (ape = ap_head; nr; ape++, nr--) {
 		if (ACPI_COMPARE_NAME(ACPI_SIG_MADT, ape->id)) {
 			acpi_probe_count = 0;
@@ -1999,7 +1999,7 @@ int __init __acpi_probe_device_table(str
 				count++;
 		}
 	}
-	spin_unlock(&acpi_probe_lock);
+	mutex_unlock(&acpi_probe_mutex);
 
 	return count;
 }
author maintainer
#119 lore raw

PATCH 137/143 ALSA: line6: Remove double line6_pcm_release() after failed acquire.

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Andrej Krutak <[email protected]>

commit 7e4379eae0e31994ea645db1d13006ea8e5ce539 upstream.

If there's an error, pcm is released in line6_pcm_acquire already.

Fixes 247d95ee6dd2 ('ALSA: line6: Handle error from line6_pcm_acquire()')
---
 sound/usb/line6/pcm.c |    1 -
 1 file changed, 1 deletion(-)
sound/usb/line6/pcm.c +0 -1
@@ -55,7 +55,6 @@ static int snd_line6_impulse_volume_put(
 		err = line6_pcm_acquire(line6pcm, LINE6_STREAM_IMPULSE);
 		if (err < 0) {
 			line6pcm->impulse_volume = 0;
-			line6_pcm_release(line6pcm, LINE6_STREAM_IMPULSE);
 			return err;
 		}
 	} else {
author maintainer
#120 lore raw

PATCH 138/143 ALSA: line6: Give up on the lock while URBs are released.

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Andrej Krutak <[email protected]>

commit adc8a43a6d6688272ebffa81789fa857e603dec6 upstream.

Done, because line6_stream_stop() locks and calls line6_unlink_audio_urbs(), which in turn invokes audio_out_callback(), which tries to lock 2nd time.

Fixes:

=============================================
[ INFO: possible recursive locking detected ]
4.4.15+ #15 Not tainted
---------------------------------------------
mplayer/3591 is trying to acquire lock:
(&(&line6pcm->out.lock)->rlock){-.-...}, at: [<bfa27655>] audio_out_callback+0x70/0x110 [snd_usb_line6]

but task is already holding lock:
(&(&line6pcm->out.lock)->rlock){-.-...}, at: [<bfa26aad>] line6_stream_stop+0x24/0x5c [snd_usb_line6]

other info that might help us debug this:

 Possible unsafe locking scenario:
       CPU0
       ----

lock(&(&line6pcm->out.lock)->rlock);
lock(&(&line6pcm->out.lock)->rlock);

*** DEADLOCK ***

May be due to missing lock nesting notation

3 locks held by mplayer/3591:

 #0:  (snd_pcm_link_rwlock){.-.-..}, at: [<bf8d49a7>] snd_pcm_stream_lock+0x1e/0x40 [snd_pcm]
 #1:  (&(&substream->self_group.lock)->rlock){-.-...}, at: [<bf8d49af>] snd_pcm_stream_lock+0x26/0x40 [snd_pcm]
 #2:  (&(&line6pcm->out.lock)->rlock){-.-...}, at: [<bfa26aad>] line6_stream_stop+0x24/0x5c [snd_usb_line6]
stack backtrace:
CPU: 0 PID: 3591 Comm: mplayer Not tainted 4.4.15+ #15
Hardware name: Generic AM33XX (Flattened Device Tree)
[<c0015d85>] (unwind_backtrace) from [<c001253d>] (show_stack+0x11/0x14)
[<c001253d>] (show_stack) from [<c02f1bdf>] (dump_stack+0x8b/0xac)
[<c02f1bdf>] (dump_stack) from [<c0076f43>] (__lock_acquire+0xc8b/0x1780)
[<c0076f43>] (__lock_acquire) from [<c007810d>] (lock_acquire+0x99/0x1c0)
[<c007810d>] (lock_acquire) from [<c06171e7>] (_raw_spin_lock_irqsave+0x3f/0x4c)
[<c06171e7>] (_raw_spin_lock_irqsave) from [<bfa27655>] (audio_out_callback+0x70/0x110 [snd_usb_line6])
[<bfa27655>] (audio_out_callback [snd_usb_line6]) from [<c04294db>] (__usb_hcd_giveback_urb+0x53/0xd0)
[<c04294db>] (__usb_hcd_giveback_urb) from [<c046388d>] (musb_giveback+0x3d/0x98)
[<c046388d>] (musb_giveback) from [<c04647f5>] (musb_urb_dequeue+0x6d/0x114)
[<c04647f5>] (musb_urb_dequeue) from [<c042ac11>] (usb_hcd_unlink_urb+0x39/0x98)
[<c042ac11>] (usb_hcd_unlink_urb) from [<bfa26a87>] (line6_unlink_audio_urbs+0x6a/0x6c [snd_usb_line6])
[<bfa26a87>] (line6_unlink_audio_urbs [snd_usb_line6]) from [<bfa26acb>] (line6_stream_stop+0x42/0x5c [snd_usb_line6])
[<bfa26acb>] (line6_stream_stop [snd_usb_line6]) from [<bfa26fe7>] (snd_line6_trigger+0xb6/0xf4 [snd_usb_line6])
[<bfa26fe7>] (snd_line6_trigger [snd_usb_line6]) from [<bf8d47b7>] (snd_pcm_do_stop+0x36/0x38 [snd_pcm])
[<bf8d47b7>] (snd_pcm_do_stop [snd_pcm]) from [<bf8d462f>] (snd_pcm_action_single+0x22/0x40 [snd_pcm])
[<bf8d462f>] (snd_pcm_action_single [snd_pcm]) from [<bf8d46f9>] (snd_pcm_action+0xac/0xb0 [snd_pcm])
[<bf8d46f9>] (snd_pcm_action [snd_pcm]) from [<bf8d4b61>] (snd_pcm_drop+0x38/0x64 [snd_pcm])
[<bf8d4b61>] (snd_pcm_drop [snd_pcm]) from [<bf8d6233>] (snd_pcm_common_ioctl1+0x7fe/0xbe8 [snd_pcm])
[<bf8d6233>] (snd_pcm_common_ioctl1 [snd_pcm]) from [<bf8d6779>] (snd_pcm_playback_ioctl1+0x15c/0x51c [snd_pcm])
[<bf8d6779>] (snd_pcm_playback_ioctl1 [snd_pcm]) from [<bf8d6b59>] (snd_pcm_playback_ioctl+0x20/0x28 [snd_pcm])
[<bf8d6b59>] (snd_pcm_playback_ioctl [snd_pcm]) from [<c016714b>] (do_vfs_ioctl+0x3af/0x5c8)
Fixes 63e20df1e5b2 ('ALSA: line6: Reorganize PCM stream handling')
---
 sound/usb/line6/pcm.c |    2 ++
 1 file changed, 2 insertions(+)
sound/usb/line6/pcm.c +2 -0
@@ -210,7 +210,9 @@ static void line6_stream_stop(struct snd
 	spin_lock_irqsave(&pstr->lock, flags);
 	clear_bit(type, &pstr->running);
 	if (!pstr->running) {
+		spin_unlock_irqrestore(&pstr->lock, flags);
 		line6_unlink_audio_urbs(line6pcm, pstr);
+		spin_lock_irqsave(&pstr->lock, flags);
 		if (direction == SNDRV_PCM_STREAM_CAPTURE) {
 			line6pcm->prev_fbuf = NULL;
 			line6pcm->prev_fsize = 0;
author maintainer
#121 lore raw

PATCH 139/143 ALSA: line6: Fix POD sysfs attributes segfault

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Andrej Krutak <[email protected]>

commit b027d11263836a0cd335520175257dcb99b43757 upstream.

The commit 02fc76f6a changed base of the sysfs attributes from device to card. The "show" callbacks dereferenced wrong objects because of this.

Fixes 02fc76f6a7db ('ALSA: line6: Create sysfs via snd_card_add_dev_attr()')
---
 sound/usb/line6/pod.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
sound/usb/line6/pod.c +6 -6
@@ -244,8 +244,8 @@ static int pod_set_system_param_int(stru
 static ssize_t serial_number_show(struct device *dev,
 				  struct device_attribute *attr, char *buf)
 {
-	struct usb_interface *interface = to_usb_interface(dev);
-	struct usb_line6_pod *pod = usb_get_intfdata(interface);
+	struct snd_card *card = dev_to_snd_card(dev);
+	struct usb_line6_pod *pod = card->private_data;
 
 	return sprintf(buf, "%u\n", pod->serial_number);
 }
@@ -256,8 +256,8 @@ static ssize_t serial_number_show(struct
 static ssize_t firmware_version_show(struct device *dev,
 				     struct device_attribute *attr, char *buf)
 {
-	struct usb_interface *interface = to_usb_interface(dev);
-	struct usb_line6_pod *pod = usb_get_intfdata(interface);
+	struct snd_card *card = dev_to_snd_card(dev);
+	struct usb_line6_pod *pod = card->private_data;
 
 	return sprintf(buf, "%d.%02d\n", pod->firmware_version / 100,
 		       pod->firmware_version % 100);
@@ -269,8 +269,8 @@ static ssize_t firmware_version_show(str
 static ssize_t device_id_show(struct device *dev,
 			      struct device_attribute *attr, char *buf)
 {
-	struct usb_interface *interface = to_usb_interface(dev);
-	struct usb_line6_pod *pod = usb_get_intfdata(interface);
+	struct snd_card *card = dev_to_snd_card(dev);
+	struct usb_line6_pod *pod = card->private_data;
 
 	return sprintf(buf, "%d\n", pod->device_id);
 }
author maintainer
#122 lore raw

PATCH 140/143 hwmon: (it87) Add missing sysfs attribute group terminator

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Jean Delvare <[email protected]>

commit 3c3292634fc2de1ab97b6aa3222fee647f737adb upstream.

Attribute array it87_attributes_in lacks its NULL terminator, causing random behavior when operating on the attribute group.

Fixes 52929715634a ("hwmon: (it87) Use is_visible for voltage sensors")
Cc Martin Blumenstingl <[email protected]>
Cc Guenter Roeck <[email protected]>
---
 drivers/hwmon/it87.c |    1 +
 1 file changed, 1 insertion(+)
drivers/hwmon/it87.c +1 -0
@@ -2015,6 +2015,7 @@ static struct attribute *it87_attributes
 	&sensor_dev_attr_in10_input.dev_attr.attr,	/* 41 */
 	&sensor_dev_attr_in11_input.dev_attr.attr,	/* 41 */
 	&sensor_dev_attr_in12_input.dev_attr.attr,	/* 41 */
+	NULL
 };
 
 static const struct attribute_group it87_group_in = {
author maintainer
#123 lore raw

PATCH 141/143 hwmon: (iio_hwmon) fix memory leak in name attribute

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Quentin Schulz <[email protected]>

commit 5d17d3b4bbf3becb89fd48b74340a50a39736f6d upstream.

The "name" variable's memory is now freed when the device is destructed thanks to devm function.

Fixes e0f8a24e0edfd ("staging:iio::hwmon interface client driver.")
Fixes 61bb53bcbdd86 ("hwmon: (iio_hwmon) Add support for humidity sensors")
---
 drivers/hwmon/iio_hwmon.c |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/hwmon/iio_hwmon.c +12 -12
@@ -110,24 +110,24 @@ static int iio_hwmon_probe(struct platfo
 
 		switch (type) {
 		case IIO_VOLTAGE:
-			a->dev_attr.attr.name = kasprintf(GFP_KERNEL,
-							  "in%d_input",
-							  in_i++);
+			a->dev_attr.attr.name = devm_kasprintf(dev, GFP_KERNEL,
+							       "in%d_input",
+							       in_i++);
 			break;
 		case IIO_TEMP:
-			a->dev_attr.attr.name = kasprintf(GFP_KERNEL,
-							  "temp%d_input",
-							  temp_i++);
+			a->dev_attr.attr.name = devm_kasprintf(dev, GFP_KERNEL,
+							       "temp%d_input",
+							       temp_i++);
 			break;
 		case IIO_CURRENT:
-			a->dev_attr.attr.name = kasprintf(GFP_KERNEL,
-							  "curr%d_input",
-							  curr_i++);
+			a->dev_attr.attr.name = devm_kasprintf(dev, GFP_KERNEL,
+							       "curr%d_input",
+							       curr_i++);
 			break;
 		case IIO_HUMIDITYRELATIVE:
-			a->dev_attr.attr.name = kasprintf(GFP_KERNEL,
-							  "humidity%d_input",
-							  humidity_i++);
+			a->dev_attr.attr.name = devm_kasprintf(dev, GFP_KERNEL,
+							       "humidity%d_input",
+							       humidity_i++);
 			break;
 		default:
 			ret = -EINVAL;
author maintainer
#124 lore raw

PATCH 142/143 sysfs: correctly handle read offset on PREALLOC attrs

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Konstantin Khlebnikov <[email protected]>

commit 17d0774f80681020eccc9638d925a23f1fc4f671 upstream.

Attributes declared with __ATTR_PREALLOC use sysfs_kf_read() which returns zero bytes for non-zero offset. This breaks script checkarray in mdadm tool in debian where /bin/sh is 'dash' because its builtin 'read' reads only one byte at a time. Script gets 'i' instead of 'idle' when reads current action from /sys/block/$dev/md/sync_action and as a result does nothing.

This patch adds trivial implementation of partial read: generate whole string and move required part into buffer head.

Fixes 4ef67a8c95f3 ("sysfs/kernfs: make read requests on pre-alloc files use the buffer.")
---
 fs/sysfs/file.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
fs/sysfs/file.c +7 -1
@@ -114,9 +114,15 @@ static ssize_t sysfs_kf_read(struct kern
 	 * If buf != of->prealloc_buf, we don't know how
 	 * large it is, so cannot safely pass it to ->show
 	 */
-	if (pos || WARN_ON_ONCE(buf != of->prealloc_buf))
+	if (WARN_ON_ONCE(buf != of->prealloc_buf))
 		return 0;
 	len = ops->show(kobj, of->kn->priv, buf);
+	if (pos) {
+		if (len <= pos)
+			return 0;
+		len -= pos;
+		memmove(buf, buf + pos, len);
+	}
 	return min(count, len);
 }
 
author maintainer
#125 lore raw

PATCH 143/143 SUNRPC: Fix infinite looping in rpc_clnt_iterate_for_each_xprt

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Trond Myklebust <[email protected]>

commit bdc54d8e3cb4a41dddcabfd86d9eb3aa5f622b75 upstream.

If there were less than 2 entries in the multipath list, then xprt_iter_next_entry_multiple() would never advance beyond the first entry, which is correct for round robin behaviour, but not for the list iteration.

The end result would be infinite looping in rpc_clnt_iterate_for_each_xprt() as we would never see the xprt == NULL condition fulfilled.

Fixes 80b14d5e61ca ("SUNRPC: Add a structure to track multiple transports")
Cc Jason L Tibbitts III <[email protected]>
---
 net/sunrpc/xprtmultipath.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
net/sunrpc/xprtmultipath.c +3 -5
@@ -271,14 +271,12 @@ struct rpc_xprt *xprt_iter_next_entry_mu
 		xprt_switch_find_xprt_t find_next)
 {
 	struct rpc_xprt_switch *xps = rcu_dereference(xpi->xpi_xpswitch);
-	struct list_head *head;
 
 	if (xps == NULL)
 		return NULL;
-	head = &xps->xps_xprt_list;
-	if (xps->xps_nxprts < 2)
-		return xprt_switch_find_first_entry(head);
-	return xprt_switch_set_next_cursor(head, &xpi->xpi_cursor, find_next);
+	return xprt_switch_set_next_cursor(&xps->xps_xprt_list,
+			&xpi->xpi_cursor,
+			find_next);
 }
 
 static
Tested-by Olaf Hering Tested-by Ralf-Peter Rohbeck on the v1 series
#126 lore raw
In reply to Greg Kroah-Hartman
Quoted 7 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.7.3 release. There are 143 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Wed Sep 7 16:44:10 UTC 2016. Anything received after that time might be too late.

As far as I can see this missing an rather important mm fix from Michal Hocko.

commit 6b4e3181d7bd5ca5ab6f45929e4a5ffa7ab4ab7f

Author: Michal Hocko <[email protected]>
Date:   Thu Sep 1 16:14:41 2016 -0700

mm, oom: prevent premature OOM killer invocation for high order request

There have been several reports about pre-mature OOM killer invocation in 4.7 kernel when order-2 allocation request (for the kernel stack) invoked OOM killer even during basic workloads (light IO or even kernel compile on some filesystems). In all reported cases the memory is fragmented and there are no order-2+ pages available. There is usually a large amount of slab memory (usually dentries/inodes) and further debugging has shown that there are way too many unmovable blocks which are skipped during the compaction. Multiple reporters have confirmed that the current linux-next which includes [1] and [2] helped and OOMs are not reproducible anymore.

A simpler fix for the late rc and stable is to simply ignore the compaction feedback and retry as long as there is a reclaim progress and we are not getting OOM for order-0 pages. We already do that for CONFING_COMPACTION=n so let's reuse the same code when compaction is enabled as well.

[1] http://lkml.kernel.org/r/[email protected]
[2] http://lkml.kernel.org/r/[email protected]

Fixes 0a0337e0d1d1 ("mm, oom: rework oom detection")
Cc Markus Trippelsdorf <[email protected]>
Cc Arkadiusz Miskiewicz <[email protected]>
Cc Ralf-Peter Rohbeck <[email protected]>
Cc Jiri Slaby <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Joonsoo Kim <[email protected]>
Cc Tetsuo Handa <[email protected]>
Cc David Rientjes <[email protected]>
Cc <[email protected]> [4.7.x]
Signature · 1 line
Markus
author maintainer
#127 lore raw
Quoted 6 lines · Markus Trippelsdorf
Quoted 5 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.7.3 release. There are 143 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Quoted 8 lines
Quoted 2 lines

Responses should be made by Wed Sep 7 16:44:10 UTC 2016. Anything received after that time might be too late.

As far as I can see this missing an rather important mm fix from Michal Hocko.

commit 6b4e3181d7bd5ca5ab6f45929e4a5ffa7ab4ab7f

Author: Michal Hocko <[email protected]>
Date:   Thu Sep 1 16:14:41 2016 -0700

There are 165 patches in my queue still that are in the "in Linus's tree and marked for stable but not yet applied", so you are in good company.

Let's get this patch at least tested for more than 1 day in an -rc before we apply it to a stable kernel, right? Please be patient...

thanks,

greg k-h

#128 lore raw
In reply to Greg Kroah-Hartman
Quoted 8 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.7.3 release. There are 143 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Wed Sep 7 16:44:10 UTC 2016. Anything received after that time might be too late.

Build results:

	total: 148 pass: 148 fail: 0
Qemu test results:
	total: 107 pass: 107 fail: 0

Details are available at http://kerneltests.org/builders.

Guenter

author maintainer
#129 lore raw
Quoted 9 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.7.3 release. There are 143 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Wed Sep 7 16:44:10 UTC 2016. Anything received after that time might be too late.

Quoted 6 lines

Build results:

	total: 148 pass: 148 fail: 0
Qemu test results:
	total: 107 pass: 107 fail: 0

Details are available at http://kerneltests.org/builders.

Thanks for testing all of these and letting me know.

greg k-h

#130 lore raw
In reply to Greg Kroah-Hartman
Quoted 9 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.7.3 release. There are 143 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Wed Sep 7 16:44:10 UTC 2016. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

Quoted 9 lines
	kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.7.3-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.7.y
and the diffstat can be found below.

thanks,

greg k-h

Compiled and booted on my test system. No dmesg regressions.

thanks,
-- Shuah

Signature · 5 lines
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America(Silicon Valley)
[email protected]
author maintainer
#131 lore raw
Quoted 15 lines · Shuah Khan
Quoted 14 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.7.3 release. There are 143 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Wed Sep 7 16:44:10 UTC 2016. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

	kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.7.3-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.7.y
and the diffstat can be found below.

Quoted 6 lines
Quoted 4 lines

thanks,

greg k-h

Compiled and booted on my test system. No dmesg regressions.

Thanks for testing all of these and letting me know.

greg k-h

#132 lore raw
In reply to Greg Kroah-Hartman
Quoted 5 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.7.3 release. There are 143 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Quoted 8 lines

Responses should be made by Wed Sep 7 16:44:10 UTC 2016. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

	kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.7.3-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.7.y
and the diffstat can be found below.

Hey Greg,

For reference, I've generated a list of <=4.8-rc4 commits that look to me like stable material but are not in 4.7.3:

422eac3f7deae34dbaffd08e03e27f37a5394a56 (v4.8-rc1) tpm_crb: fix mapping of the buffers a36aa80f3cb2540fb1dbad6240852de4365a2e82 (v4.8-rc1) intel_th: Fix a deadlock in modprobing 7a1a47ce35821b40f5b2ce46379ba14393bc3873 (v4.8-rc1) intel_th: pci: Add Kaby Lake PCH-H support fa95986095e39205ea2fb5b5dafe271bca7eb8d1 (v4.8-rc1) drm/i915: Set legacy properties when using legacy gamma set IOCTL. (v2) 78f4f7c2341f1cf510152ad494108850fec1ae39 (v4.8-rc1) ALSA: hda/realtek - ALC891 headset mode for Dell 9b51fe3efe4c270005e34f55a97e5a84ad68e581 (v4.8-rc1) ALSA: hda - On-board speaker fixup on ACER Veriton 7d9595d848cdff5c7939f68eec39e0c5d36a1d67 (v4.8-rc1) dm rq: fix the starting and stopping of blk-mq queues 3b2c1710fac7fb278b760d1545e637cbb5ea5b5b (v4.8-rc2) drm/i915: Wait up to 3ms for the pcu to ack the cdclk change request on SKL c518189567eaf42b2ec50a4d982484c8e38799f8 (v4.8-rc3) net: macb: Correct CAPS mask 80788a0fbbdfbb125e3fd45a640cddb582160bc7 (v4.8-rc1) drm/i915/fbc: sanitize i915.enable_fbc during FBC init 0a491b96aa59a7232f6c1a81414aa57fb8de8594 (v4.8-rc3) drm/i915/fbc: FBC causes display flicker when VT-d is enabled on Skylake 3e103a65514c2947e53f3171b21255fbde8b60c6 (v4.8-rc4) ASoC: atmel_ssc_dai: Don't unconditionally reset SSC on stream startup 1b856086813be9371929b6cc62045f9fd470f5a0 (v4.8-rc4) block: Fix race triggered by blk_set_queue_dying() ae5b80d2b68eac945b124227dea34462118a6f01 (v4.8-rc4) drm/radeon: only apply the SS fractional workaround to RS[78]80 d9dc1702b297ec4a6bb9c0326a70641b322ba886 (v4.8-rc4) bcache: register_bcache(): call blkdev_put() when cache_alloc() fails acc9cf8c66c66b2cbbdb4a375537edee72be64df (v4.8-rc4) bcache: RESERVE_PRIO is too small by one when prio_buckets() is a power of two. 13f479b9df4e2bbf2d16e7e1b02f3f55f70e2455 (v4.8-rc4) drm/radeon: fix radeon_move_blit on 32bit systems d77976c414ed7f521b9c79b2a9dde0147a3cf754 (v4.8-rc4) ARC: export kmap
c57653dc94d0db7bf63067433ceaa97bdcd0a312 (v4.8-rc4) ARC: export __udivdi3 for modules 6f00975c619064a18c23fd3aced325ae165a73b9 (v4.8-rc4) drm: Reject page_flip for !DRIVER_MODESET e9e5e3fae8da7e237049e00e0bfc9e32fd808fe8 (v4.8-rc4) bdev: fix NULL pointer dereference 6a33fa2b87513fee44cb8f0cd17b1acd6316bc6b (v4.8-rc4) irqchip/mips-gic: Cleanup chip and handler setup 2564970a381651865364974ea414384b569cb9c0 (v4.8-rc4) irqchip/mips-gic: Implement activate op for device domain c62fb260a86dde3df5b2905432caa0e9f6898434 (v4.8-rc4) IB/hfi1,IB/qib: Fix qp_stats sleep with rcu read lock held a77ec83a57890240c546df00ca5df1cdeedb1cc3 (v4.8-rc4) vhost/scsi: fix reuse of &vq->iov[out] in response c0082e985fdf77b02fc9e0dac3b58504dcf11b7a (v4.8-rc4) ubifs: Fix assertion in layout_in_gaps() 17ce1eb0b64eb27d4f9180daae7495fa022c7b0d (v4.8-rc4) ubifs: Fix xattr generic handler usage 27727df240c7cc84f2ba6047c6f18d5addfd25ef (v4.8-rc4) timekeeping: Avoid taking lock in NMI path with CONFIG_DEBUG_TIMEKEEPING a4f8f6667f099036c88f231dcad4cf233652c824 (v4.8-rc4) timekeeping: Cap array access in timekeeping_debug 2e63ad4bd5dd583871e6602f9d398b9322d358d9 (v4.8-rc4) x86/apic: Do not init irq remapping if ioapic is disabled 9b47f77a680447e0132b2cf7fb82374e014bec1c (v4.8-rc4) nvme: Fix nvme_get/set_features() with a NULL result pointer 4d70dca4eadf2f95abe389116ac02b8439c2d16c (v4.8-rc4) block: make sure a big bio is split into at most 256 bvecs 9a035a40f7f3f6708b79224b86c5777a3334f7ea (v4.8-rc4) xenbus: don't look up transaction IDs for ordinary writes 299f6230bc6d0ccd5f95bb0fb865d80a9c7d5ccc (v4.8-rc4) dm flakey: fix reads to be issued if drop_writes configured b53e7d000d9e6e9fd2c6eb6b82d2783c67fd599e (v4.8-rc4) clocksource/drivers/sun4i: Clear interrupts after stopping timer in probe function add1fa75101263ab4d74240f93000998d4325624 (v4.8-rc4) drm/atomic: Don't potentially reset color_mgmt_changed on successive property updates.

Signature · 2 lines
Thanks,
Sasha
author maintainer
#133 lore raw
Quoted 47 lines · Alexander
Quoted 5 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.7.3 release. There are 143 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Quoted 8 lines

Responses should be made by Wed Sep 7 16:44:10 UTC 2016. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

	kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.7.3-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.7.y
and the diffstat can be found below.

Hey Greg,

For reference, I've generated a list of <=4.8-rc4 commits that look to me like stable material but are not in 4.7.3:

422eac3f7deae34dbaffd08e03e27f37a5394a56 (v4.8-rc1) tpm_crb: fix mapping of the buffers a36aa80f3cb2540fb1dbad6240852de4365a2e82 (v4.8-rc1) intel_th: Fix a deadlock in modprobing 7a1a47ce35821b40f5b2ce46379ba14393bc3873 (v4.8-rc1) intel_th: pci: Add Kaby Lake PCH-H support fa95986095e39205ea2fb5b5dafe271bca7eb8d1 (v4.8-rc1) drm/i915: Set legacy properties when using legacy gamma set IOCTL. (v2) 78f4f7c2341f1cf510152ad494108850fec1ae39 (v4.8-rc1) ALSA: hda/realtek - ALC891 headset mode for Dell 9b51fe3efe4c270005e34f55a97e5a84ad68e581 (v4.8-rc1) ALSA: hda - On-board speaker fixup on ACER Veriton 7d9595d848cdff5c7939f68eec39e0c5d36a1d67 (v4.8-rc1) dm rq: fix the starting and stopping of blk-mq queues 3b2c1710fac7fb278b760d1545e637cbb5ea5b5b (v4.8-rc2) drm/i915: Wait up to 3ms for the pcu to ack the cdclk change request on SKL c518189567eaf42b2ec50a4d982484c8e38799f8 (v4.8-rc3) net: macb: Correct CAPS mask 80788a0fbbdfbb125e3fd45a640cddb582160bc7 (v4.8-rc1) drm/i915/fbc: sanitize i915.enable_fbc during FBC init 0a491b96aa59a7232f6c1a81414aa57fb8de8594 (v4.8-rc3) drm/i915/fbc: FBC causes display flicker when VT-d is enabled on Skylake 3e103a65514c2947e53f3171b21255fbde8b60c6 (v4.8-rc4) ASoC: atmel_ssc_dai: Don't unconditionally reset SSC on stream startup 1b856086813be9371929b6cc62045f9fd470f5a0 (v4.8-rc4) block: Fix race triggered by blk_set_queue_dying() ae5b80d2b68eac945b124227dea34462118a6f01 (v4.8-rc4) drm/radeon: only apply the SS fractional workaround to RS[78]80 d9dc1702b297ec4a6bb9c0326a70641b322ba886 (v4.8-rc4) bcache: register_bcache(): call blkdev_put() when cache_alloc() fails acc9cf8c66c66b2cbbdb4a375537edee72be64df (v4.8-rc4) bcache: RESERVE_PRIO is too small by one when prio_buckets() is a power of two. 13f479b9df4e2bbf2d16e7e1b02f3f55f70e2455 (v4.8-rc4) drm/radeon: fix radeon_move_blit on 32bit systems d77976c414ed7f521b9c79b2a9dde0147a3cf754 (v4.8-rc4) ARC: export kmap
c57653dc94d0db7bf63067433ceaa97bdcd0a312 (v4.8-rc4) ARC: export __udivdi3 for modules 6f00975c619064a18c23fd3aced325ae165a73b9 (v4.8-rc4) drm: Reject page_flip for !DRIVER_MODESET e9e5e3fae8da7e237049e00e0bfc9e32fd808fe8 (v4.8-rc4) bdev: fix NULL pointer dereference 6a33fa2b87513fee44cb8f0cd17b1acd6316bc6b (v4.8-rc4) irqchip/mips-gic: Cleanup chip and handler setup 2564970a381651865364974ea414384b569cb9c0 (v4.8-rc4) irqchip/mips-gic: Implement activate op for device domain c62fb260a86dde3df5b2905432caa0e9f6898434 (v4.8-rc4) IB/hfi1,IB/qib: Fix qp_stats sleep with rcu read lock held a77ec83a57890240c546df00ca5df1cdeedb1cc3 (v4.8-rc4) vhost/scsi: fix reuse of &vq->iov[out] in response c0082e985fdf77b02fc9e0dac3b58504dcf11b7a (v4.8-rc4) ubifs: Fix assertion in layout_in_gaps() 17ce1eb0b64eb27d4f9180daae7495fa022c7b0d (v4.8-rc4) ubifs: Fix xattr generic handler usage 27727df240c7cc84f2ba6047c6f18d5addfd25ef (v4.8-rc4) timekeeping: Avoid taking lock in NMI path with CONFIG_DEBUG_TIMEKEEPING

Quoted 9 lines

a4f8f6667f099036c88f231dcad4cf233652c824 (v4.8-rc4) timekeeping: Cap array access in timekeeping_debug 2e63ad4bd5dd583871e6602f9d398b9322d358d9 (v4.8-rc4) x86/apic: Do not init irq remapping if ioapic is disabled 9b47f77a680447e0132b2cf7fb82374e014bec1c (v4.8-rc4) nvme: Fix nvme_get/set_features() with a NULL result pointer 4d70dca4eadf2f95abe389116ac02b8439c2d16c (v4.8-rc4) block: make sure a big bio is split into at most 256 bvecs 9a035a40f7f3f6708b79224b86c5777a3334f7ea (v4.8-rc4) xenbus: don't look up transaction IDs for ordinary writes 299f6230bc6d0ccd5f95bb0fb865d80a9c7d5ccc (v4.8-rc4) dm flakey: fix reads to be issued if drop_writes configured b53e7d000d9e6e9fd2c6eb6b82d2783c67fd599e (v4.8-rc4) clocksource/drivers/sun4i: Clear interrupts after stopping timer in probe function add1fa75101263ab4d74240f93000998d4325624 (v4.8-rc4) drm/atomic: Don't potentially reset color_mgmt_changed on successive property updates.

Thanks for these, I'll look at them after I get through the other "properly tagged" patches in my queue. I also have a long list of stuff like this that I need to look at closer...

thanks,

greg k-h

#134 lore raw
Quoted 43 lines · Greg Kroah-Hartman
Quoted 32 lines · Alexander

Hey Greg,

For reference, I've generated a list of <=4.8-rc4 commits that look to me like stable material but are not in 4.7.3:

422eac3f7deae34dbaffd08e03e27f37a5394a56 (v4.8-rc1) tpm_crb: fix mapping of the buffers a36aa80f3cb2540fb1dbad6240852de4365a2e82 (v4.8-rc1) intel_th: Fix a deadlock in modprobing 7a1a47ce35821b40f5b2ce46379ba14393bc3873 (v4.8-rc1) intel_th: pci: Add Kaby Lake PCH-H support fa95986095e39205ea2fb5b5dafe271bca7eb8d1 (v4.8-rc1) drm/i915: Set legacy properties when using legacy gamma set IOCTL. (v2) 78f4f7c2341f1cf510152ad494108850fec1ae39 (v4.8-rc1) ALSA: hda/realtek - ALC891 headset mode for Dell 9b51fe3efe4c270005e34f55a97e5a84ad68e581 (v4.8-rc1) ALSA: hda - On-board speaker fixup on ACER Veriton 7d9595d848cdff5c7939f68eec39e0c5d36a1d67 (v4.8-rc1) dm rq: fix the starting and stopping of blk-mq queues 3b2c1710fac7fb278b760d1545e637cbb5ea5b5b (v4.8-rc2) drm/i915: Wait up to 3ms for the pcu to ack the cdclk change request on SKL c518189567eaf42b2ec50a4d982484c8e38799f8 (v4.8-rc3) net: macb: Correct CAPS mask 80788a0fbbdfbb125e3fd45a640cddb582160bc7 (v4.8-rc1) drm/i915/fbc: sanitize i915.enable_fbc during FBC init 0a491b96aa59a7232f6c1a81414aa57fb8de8594 (v4.8-rc3) drm/i915/fbc: FBC causes display flicker when VT-d is enabled on Skylake 3e103a65514c2947e53f3171b21255fbde8b60c6 (v4.8-rc4) ASoC: atmel_ssc_dai: Don't unconditionally reset SSC on stream startup 1b856086813be9371929b6cc62045f9fd470f5a0 (v4.8-rc4) block: Fix race triggered by blk_set_queue_dying() ae5b80d2b68eac945b124227dea34462118a6f01 (v4.8-rc4) drm/radeon: only apply the SS fractional workaround to RS[78]80 d9dc1702b297ec4a6bb9c0326a70641b322ba886 (v4.8-rc4) bcache: register_bcache(): call blkdev_put() when cache_alloc() fails acc9cf8c66c66b2cbbdb4a375537edee72be64df (v4.8-rc4) bcache: RESERVE_PRIO is too small by one when prio_buckets() is a power of two. 13f479b9df4e2bbf2d16e7e1b02f3f55f70e2455 (v4.8-rc4) drm/radeon: fix radeon_move_blit on 32bit systems d77976c414ed7f521b9c79b2a9dde0147a3cf754 (v4.8-rc4) ARC: export kmap
c57653dc94d0db7bf63067433ceaa97bdcd0a312 (v4.8-rc4) ARC: export __udivdi3 for modules 6f00975c619064a18c23fd3aced325ae165a73b9 (v4.8-rc4) drm: Reject page_flip for !DRIVER_MODESET e9e5e3fae8da7e237049e00e0bfc9e32fd808fe8 (v4.8-rc4) bdev: fix NULL pointer dereference 6a33fa2b87513fee44cb8f0cd17b1acd6316bc6b (v4.8-rc4) irqchip/mips-gic: Cleanup chip and handler setup 2564970a381651865364974ea414384b569cb9c0 (v4.8-rc4) irqchip/mips-gic: Implement activate op for device domain c62fb260a86dde3df5b2905432caa0e9f6898434 (v4.8-rc4) IB/hfi1,IB/qib: Fix qp_stats sleep with rcu read lock held a77ec83a57890240c546df00ca5df1cdeedb1cc3 (v4.8-rc4) vhost/scsi: fix reuse of &vq->iov[out] in response c0082e985fdf77b02fc9e0dac3b58504dcf11b7a (v4.8-rc4) ubifs: Fix assertion in layout_in_gaps() 17ce1eb0b64eb27d4f9180daae7495fa022c7b0d (v4.8-rc4) ubifs: Fix xattr generic handler usage 27727df240c7cc84f2ba6047c6f18d5addfd25ef (v4.8-rc4) timekeeping: Avoid taking lock in NMI path with CONFIG_DEBUG_TIMEKEEPING

Quoted 9 lines

a4f8f6667f099036c88f231dcad4cf233652c824 (v4.8-rc4) timekeeping: Cap array access in timekeeping_debug 2e63ad4bd5dd583871e6602f9d398b9322d358d9 (v4.8-rc4) x86/apic: Do not init irq remapping if ioapic is disabled 9b47f77a680447e0132b2cf7fb82374e014bec1c (v4.8-rc4) nvme: Fix nvme_get/set_features() with a NULL result pointer 4d70dca4eadf2f95abe389116ac02b8439c2d16c (v4.8-rc4) block: make sure a big bio is split into at most 256 bvecs 9a035a40f7f3f6708b79224b86c5777a3334f7ea (v4.8-rc4) xenbus: don't look up transaction IDs for ordinary writes 299f6230bc6d0ccd5f95bb0fb865d80a9c7d5ccc (v4.8-rc4) dm flakey: fix reads to be issued if drop_writes configured b53e7d000d9e6e9fd2c6eb6b82d2783c67fd599e (v4.8-rc4) clocksource/drivers/sun4i: Clear interrupts after stopping timer in probe function add1fa75101263ab4d74240f93000998d4325624 (v4.8-rc4) drm/atomic: Don't potentially reset color_mgmt_changed on successive property updates.

Quoted 3 lines

Thanks for these, I'll look at them after I get through the other "properly tagged" patches in my queue. I also have a long list of stuff like this that I need to look at closer...

And another one:
b47820edd1634dc1208f9212b7ecfb4230610a23 ext4: avoid modifying checksum fields directly during checksum verification

Sorry fo the noise if you have it already, but there was no repsonse to two pings in
https://lkml.kernel.org/r/[email protected]

Thanks,
Johannes

author maintainer
#135 lore raw
Quoted 48 lines · Johannes Stezenbach
Quoted 43 lines · Greg Kroah-Hartman
Quoted 32 lines · Alexander

Hey Greg,

For reference, I've generated a list of <=4.8-rc4 commits that look to me like stable material but are not in 4.7.3:

422eac3f7deae34dbaffd08e03e27f37a5394a56 (v4.8-rc1) tpm_crb: fix mapping of the buffers a36aa80f3cb2540fb1dbad6240852de4365a2e82 (v4.8-rc1) intel_th: Fix a deadlock in modprobing 7a1a47ce35821b40f5b2ce46379ba14393bc3873 (v4.8-rc1) intel_th: pci: Add Kaby Lake PCH-H support fa95986095e39205ea2fb5b5dafe271bca7eb8d1 (v4.8-rc1) drm/i915: Set legacy properties when using legacy gamma set IOCTL. (v2) 78f4f7c2341f1cf510152ad494108850fec1ae39 (v4.8-rc1) ALSA: hda/realtek - ALC891 headset mode for Dell 9b51fe3efe4c270005e34f55a97e5a84ad68e581 (v4.8-rc1) ALSA: hda - On-board speaker fixup on ACER Veriton 7d9595d848cdff5c7939f68eec39e0c5d36a1d67 (v4.8-rc1) dm rq: fix the starting and stopping of blk-mq queues 3b2c1710fac7fb278b760d1545e637cbb5ea5b5b (v4.8-rc2) drm/i915: Wait up to 3ms for the pcu to ack the cdclk change request on SKL c518189567eaf42b2ec50a4d982484c8e38799f8 (v4.8-rc3) net: macb: Correct CAPS mask 80788a0fbbdfbb125e3fd45a640cddb582160bc7 (v4.8-rc1) drm/i915/fbc: sanitize i915.enable_fbc during FBC init 0a491b96aa59a7232f6c1a81414aa57fb8de8594 (v4.8-rc3) drm/i915/fbc: FBC causes display flicker when VT-d is enabled on Skylake 3e103a65514c2947e53f3171b21255fbde8b60c6 (v4.8-rc4) ASoC: atmel_ssc_dai: Don't unconditionally reset SSC on stream startup 1b856086813be9371929b6cc62045f9fd470f5a0 (v4.8-rc4) block: Fix race triggered by blk_set_queue_dying() ae5b80d2b68eac945b124227dea34462118a6f01 (v4.8-rc4) drm/radeon: only apply the SS fractional workaround to RS[78]80 d9dc1702b297ec4a6bb9c0326a70641b322ba886 (v4.8-rc4) bcache: register_bcache(): call blkdev_put() when cache_alloc() fails acc9cf8c66c66b2cbbdb4a375537edee72be64df (v4.8-rc4) bcache: RESERVE_PRIO is too small by one when prio_buckets() is a power of two. 13f479b9df4e2bbf2d16e7e1b02f3f55f70e2455 (v4.8-rc4) drm/radeon: fix radeon_move_blit on 32bit systems d77976c414ed7f521b9c79b2a9dde0147a3cf754 (v4.8-rc4) ARC: export kmap
c57653dc94d0db7bf63067433ceaa97bdcd0a312 (v4.8-rc4) ARC: export __udivdi3 for modules 6f00975c619064a18c23fd3aced325ae165a73b9 (v4.8-rc4) drm: Reject page_flip for !DRIVER_MODESET e9e5e3fae8da7e237049e00e0bfc9e32fd808fe8 (v4.8-rc4) bdev: fix NULL pointer dereference 6a33fa2b87513fee44cb8f0cd17b1acd6316bc6b (v4.8-rc4) irqchip/mips-gic: Cleanup chip and handler setup 2564970a381651865364974ea414384b569cb9c0 (v4.8-rc4) irqchip/mips-gic: Implement activate op for device domain c62fb260a86dde3df5b2905432caa0e9f6898434 (v4.8-rc4) IB/hfi1,IB/qib: Fix qp_stats sleep with rcu read lock held a77ec83a57890240c546df00ca5df1cdeedb1cc3 (v4.8-rc4) vhost/scsi: fix reuse of &vq->iov[out] in response c0082e985fdf77b02fc9e0dac3b58504dcf11b7a (v4.8-rc4) ubifs: Fix assertion in layout_in_gaps() 17ce1eb0b64eb27d4f9180daae7495fa022c7b0d (v4.8-rc4) ubifs: Fix xattr generic handler usage 27727df240c7cc84f2ba6047c6f18d5addfd25ef (v4.8-rc4) timekeeping: Avoid taking lock in NMI path with CONFIG_DEBUG_TIMEKEEPING

Quoted 9 lines

a4f8f6667f099036c88f231dcad4cf233652c824 (v4.8-rc4) timekeeping: Cap array access in timekeeping_debug 2e63ad4bd5dd583871e6602f9d398b9322d358d9 (v4.8-rc4) x86/apic: Do not init irq remapping if ioapic is disabled 9b47f77a680447e0132b2cf7fb82374e014bec1c (v4.8-rc4) nvme: Fix nvme_get/set_features() with a NULL result pointer 4d70dca4eadf2f95abe389116ac02b8439c2d16c (v4.8-rc4) block: make sure a big bio is split into at most 256 bvecs 9a035a40f7f3f6708b79224b86c5777a3334f7ea (v4.8-rc4) xenbus: don't look up transaction IDs for ordinary writes 299f6230bc6d0ccd5f95bb0fb865d80a9c7d5ccc (v4.8-rc4) dm flakey: fix reads to be issued if drop_writes configured b53e7d000d9e6e9fd2c6eb6b82d2783c67fd599e (v4.8-rc4) clocksource/drivers/sun4i: Clear interrupts after stopping timer in probe function add1fa75101263ab4d74240f93000998d4325624 (v4.8-rc4) drm/atomic: Don't potentially reset color_mgmt_changed on successive property updates.

Quoted 3 lines

Thanks for these, I'll look at them after I get through the other "properly tagged" patches in my queue. I also have a long list of stuff like this that I need to look at closer...

Quoted 6 lines

And another one:
b47820edd1634dc1208f9212b7ecfb4230610a23 ext4: avoid modifying checksum fields directly during checksum verification

Sorry fo the noise if you have it already, but there was no repsonse to two pings in
https://lkml.kernel.org/r/[email protected]

This ext4 patch is now queued up, thanks.

greg k-h

author maintainer
#136 lore raw
In reply to Levin, Alexander
Quoted 15 lines · Alexander
Quoted 5 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.7.3 release. There are 143 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Quoted 8 lines

Responses should be made by Wed Sep 7 16:44:10 UTC 2016. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

	kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.7.3-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.7.y
and the diffstat can be found below.

Quoted 3 lines

Hey Greg,

For reference, I've generated a list of <=4.8-rc4 commits that look to me like stable material but are not in 4.7.3:

Should now be caught up with all pending 4.8 patches that were marked for a stable kernel tree.

thanks,

greg k-h