linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4.9 000/130] 4.9.6-stable review
@ 2017-01-24  7:54 ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 001/130] IB/core: Release allocated memory in cache setup failure Greg Kroah-Hartman
                     ` (126 more replies)
  0 siblings, 127 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, torvalds, akpm, linux, shuah.kh, patches,
	ben.hutchings, stable

This is the start of the stable review cycle for the 4.9.6 release.
There are 130 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 Thu Jan 26 07:55:13 UTC 2017.
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.9.6-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.9.y
and the diffstat can be found below.

thanks,

greg k-h

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

Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Linux 4.9.6-rc1

Ilya Dryomov <idryomov@gmail.com>
    libceph: stop allocating a new cipher on every crypto request

Ilya Dryomov <idryomov@gmail.com>
    libceph: uninline ceph_crypto_key_destroy()

Halil Pasic <pasic@linux.vnet.ibm.com>
    tools/virtio/ringtest: fix run-on-all.sh for offline cpus

Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
    selftest/powerpc: Wrong PMC initialized in pmc56_overflow test

Wei Yongjun <weiyongjun1@huawei.com>
    soc: ti: wkup_m3_ipc: Fix error return code in wkup_m3_ipc_probe()

Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    spi: pxa2xx: add missed break

Marek Szyprowski <m.szyprowski@samsung.com>
    dmaengine: pl330: Fix runtime PM support for terminated transfers

Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
    dmaengine: rcar-dmac: unmap slave resource when channel is freed

Marek Szyprowski <m.szyprowski@samsung.com>
    s5p-mfc: Fix clock management in s5p_mfc_release() function

Arnd Bergmann <arnd@arndb.de>
    s5p-cec: mark PM functions as __maybe_unused again

Dan Carpenter <dan.carpenter@oracle.com>
    st-hva: fix some error handling in hva_hw_probe()

Nicolas Iooss <nicolas.iooss_linux@m4x.org>
    ite-cir: initialize use_demodulator before using it

Wei Yongjun <weiyongjun1@huawei.com>
    gs1662: drop kfree for memory allocated with devm_kzalloc

Arnd Bergmann <arnd@arndb.de>
    platform: pxa_camera: add VIDEO_V4L2 dependency

Dan Carpenter <dan.carpenter@oracle.com>
    blackfin: check devm_pinctrl_get() for errors

Loic Pallardy <loic.pallardy@st.com>
    rpmsg: virtio_rpmsg_bus: fix channel creation

Dan Carpenter <dan.carpenter@oracle.com>
    mtd: spi-nor: Fix some error codes in cqspi_setup_flash()

Dan Carpenter <dan.carpenter@oracle.com>
    mtd: spi-nor: Off by one in cqspi_setup_flash()

Chanwoo Choi <cw00.choi@samsung.com>
    PM / devfreq: Fix the bug of devfreq_add_device when governor is NULL

Chanwoo Choi <cw00.choi@samsung.com>
    PM / devfreq: exynos-bus: Fix the wrong return value

James Bottomley <James.Bottomley@HansenPartnership.com>
    scsi: mpt3sas: fix hang on ata passthrough commands

Ewan D. Milne <emilne@redhat.com>
    scsi: ses: Fix SAS device detection in enclosure

Geert Uytterhoeven <geert+renesas@glider.be>
    swiotlb: Add swiotlb=noforce debug option

Geert Uytterhoeven <geert+renesas@glider.be>
    swiotlb: Convert swiotlb_force from int to enum

Alexander Graf <agraf@suse.de>
    arm64: Fix swiotlb fallback allocation

Oleksandr Andrushchenko <Oleksandr_Andrushchenko@epam.com>
    arm64: mm: avoid name clash in __page_to_voff()

Chuck Lever <chuck.lever@oracle.com>
    xprtrdma: Squelch "max send, max recv" messages at connect time

Chuck Lever <chuck.lever@oracle.com>
    xprtrdma: Make FRWR send queue entry accounting more accurate

Ilya Dryomov <idryomov@gmail.com>
    libceph: make sure ceph_aes_crypt() IV is aligned

Jeff Layton <jlayton@redhat.com>
    ceph: fix endianness bug in frag_tree_split_cmp

Jeff Layton <jlayton@redhat.com>
    ceph: fix endianness of getattr mask in ceph_d_revalidate

Yan, Zheng <zyan@redhat.com>
    ceph: fix ceph_get_caps() interruption

Nikolay Borisov <kernel@kyup.com>
    ceph: fix scheduler warning due to nested blocking

Linus Walleij <linus.walleij@linaro.org>
    ARM: 8613/1: Fix the uaccess crash on PB11MPCore

Arnd Bergmann <arnd@arndb.de>
    ARM: ux500: fix prcmu_is_cpu_in_wfi() calculation

Adam Ford <aford173@gmail.com>
    ARM: dts: omap3: Fix Card Detect and Write Protect on Logic PD SOM-LV

Gary Bisson <gary.bisson@boundarydevices.com>
    ARM: dts: imx6qdl-nitrogen6_max: fix sgtl5000 pinctrl init

Javier Martinez Canillas <javier@osg.samsung.com>
    ARM: dts: omap2: Add an empty chosen node to top level DTSI

Javier Martinez Canillas <javier@osg.samsung.com>
    ARM: dts: omap3: Add an empty chosen node to top level DTSI

Javier Martinez Canillas <javier@osg.samsung.com>
    ARM: dts: am4372: Add an empty chosen node to top level DTSI

Javier Martinez Canillas <javier@osg.samsung.com>
    ARM: dts: omap5: Add an empty chosen node to top level DTSI

Javier Martinez Canillas <javier@osg.samsung.com>
    ARM: dts: omap4: Add an empty chosen node to top level DTSI

Javier Martinez Canillas <javier@osg.samsung.com>
    ARM: dts: am33xx: Add an empty chosen node to top level DTSI

Javier Martinez Canillas <javier@osg.samsung.com>
    ARM: dts: dm814x: Add an empty chosen node to top level DTSI

Javier Martinez Canillas <javier@osg.samsung.com>
    ARM: dts: dm816x: Add an empty chosen node to top level DTSI

Javier Martinez Canillas <javier@osg.samsung.com>
    ARM: dts: dra7: Add an empty chosen node to top level DTSI

Ilya Dryomov <idryomov@gmail.com>
    libceph: remove now unused ceph_*{en,de}crypt*() functions

Ilya Dryomov <idryomov@gmail.com>
    libceph: switch ceph_x_decrypt() to ceph_crypt()

Ilya Dryomov <idryomov@gmail.com>
    libceph: switch ceph_x_encrypt() to ceph_crypt()

Ilya Dryomov <idryomov@gmail.com>
    libceph: tweak calcu_signature() a little

Ilya Dryomov <idryomov@gmail.com>
    libceph: rename and align ceph_x_authorizer::reply_buf

Ilya Dryomov <idryomov@gmail.com>
    libceph: introduce ceph_crypt() for in-place en/decryption

Ilya Dryomov <idryomov@gmail.com>
    libceph: introduce ceph_x_encrypt_offset()

Ilya Dryomov <idryomov@gmail.com>
    libceph: old_key in process_one_ticket() is redundant

Ilya Dryomov <idryomov@gmail.com>
    libceph: ceph_x_encrypt_buflen() takes in_len

Paul Donohue <linux-kernel@PaulSD.com>
    Input: ALPS - fix TrackStick support for SS5 hardware

Dave Martin <Dave.Martin@arm.com>
    arm64/ptrace: Reject attempts to set incomplete hardware breakpoint fields

Dave Martin <Dave.Martin@arm.com>
    arm64/ptrace: Avoid uninitialised struct padding in fpr_set()

Dave Martin <Dave.Martin@arm.com>
    arm64/ptrace: Preserve previous registers for short regset write - 3

Dave Martin <Dave.Martin@arm.com>
    arm64/ptrace: Preserve previous registers for short regset write - 2

Dave Martin <Dave.Martin@arm.com>
    arm64/ptrace: Preserve previous registers for short regset write

Mark Rutland <mark.rutland@arm.com>
    arm64: avoid returning from bad_mode

Fabien Parent <fparent@baylibre.com>
    ARM: dts: da850-evm: fix read access to SPI flash

Jean-Jacques Hiblot <jjhiblot@ti.com>
    ARM: dts: OMAP5 / DRA7: indicate that SATA port 0 is available.

Jeff Layton <jlayton@redhat.com>
    ceph: fix bad endianness handling in parse_reply_info_extra

Bryant G. Ly <bryantly@linux.vnet.ibm.com>
    ibmvscsis: Fix max transfer length

Bryant G. Ly <bryantly@linux.vnet.ibm.com>
    ibmvscsis: Fix sleeping in interrupt context

Mark Rutland <mark.rutland@arm.com>
    ARM: 8634/1: hw_breakpoint: blacklist Scorpion CPUs

Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
    svcrdma: avoid duplicate dma unmapping during error recovery

Joonyoung Shim <jy0922.shim@samsung.com>
    clocksource/exynos_mct: Clear interrupt when cpu is shut down

Richard Weinberger <richard@nod.at>
    ubifs: Fix journal replay wrt. xattr nodes

Johannes Berg <johannes.berg@intel.com>
    mac80211: implement multicast forwarding on fast-RX path

Quinn Tran <quinn.tran@cavium.com>
    qla2xxx: Fix crash due to null pointer access

Ruslan Ruslichenko <rruslich@cisco.com>
    x86/ioapic: Restore IO-APIC irq_chip retrigger callback

Anton Blanchard <anton@samba.org>
    powerpc: Ignore reserved field in DCSR and PVR reads and writes

Dave Martin <Dave.Martin@arm.com>
    powerpc/ptrace: Preserve previous TM fprs/vsrs on short regset write

Dave Martin <Dave.Martin@arm.com>
    powerpc/ptrace: Preserve previous fprs/vsrs on short regset write

Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
    powerpc/perf: Fix PM_BRU_CMPL event code for power9

Benjamin Herrenschmidt <benh@kernel.crashing.org>
    powerpc/icp-opal: Fix missing KVM case and harden replay

Marc Zyngier <marc.zyngier@arm.com>
    KVM: arm/arm64: vgic: Fix deadlock on error handling

Christian Borntraeger <borntraeger@de.ibm.com>
    KVM: s390: do not expose random data via facility bitmap

Hauke Mehrtens <hauke@hauke-m.de>
    mtd: nand: xway: fix build because of module functions

Hauke Mehrtens <hauke@hauke-m.de>
    mtd: nand: xway: disable module support

Vladimir Zapolskiy <vz@mleia.com>
    mtd: nand: lpc32xx: fix invalid error handling of a requested irq

Stefan Schmidt <stefan@osg.samsung.com>
    ieee802154: atusb: do not use the stack for buffers to make them DMA able

Stefan Wahren <stefan.wahren@i2se.com>
    mmc: mxs-mmc: Fix additional cycles after transmission stop

Hans de Goede <hdegoede@redhat.com>
    mmc: sdhci-acpi: Only powered up enabled acpi child devices

Johan Hovold <johan@kernel.org>
    HID: corsair: fix control-transfer error handling

Johan Hovold <johan@kernel.org>
    HID: corsair: fix DMA buffers on stack

Bjorn Helgaas <bhelgaas@google.com>
    PCI: Enumerate switches below PCI-to-PCIe bridges

Murali Karicheri <m-karicheri2@ti.com>
    PCI: designware: Check for iATU unroll only on platforms that use ATU

David Sheets <david.sheets@docker.com>
    fuse: fix time_to_jiffies nsec sanity check

Tahsin Erdogan <tahsin@google.com>
    fuse: clear FR_PENDING flag when moving requests out of pending queue

Vineet Gupta <vgupta@synopsys.com>
    ARC: module: Fix !CONFIG_ARC_DW2_UNWIND builds

Dan Williams <dan.j.williams@intel.com>
    libnvdimm, namespace: fix pmem namespace leak, delete when size set to zero

J. Bruce Fields <bfields@redhat.com>
    svcrpc: don't leak contexts on PROC_DESTROY

Scott Mayhew <smayhew@redhat.com>
    sunrpc: don't call sleeping functions from the notifier block callbacks

Paul E. McKenney <paulmck@linux.vnet.ibm.com>
    rcu: Narrow early boot window of illegal synchronous grace periods

Paul E. McKenney <paulmck@linux.vnet.ibm.com>
    rcu: Remove cond_resched() from Tiny synchronize_sched()

Bjorn Helgaas <bhelgaas@google.com>
    x86/PCI: Ignore _CRS on Supermicro X8DTH-i/6/iF/6F

Gu Zheng <guzheng1@huawei.com>
    tmpfs: clear S_ISGID when setting posix ACLs

Adam Ford <aford173@gmail.com>
    ARM: dts: omap3: Add DTS for Logic PD SOM-LV 37xx Dev Kit

Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
    ARM: dts: imx31: fix AVIC base address

Vladimir Zapolskiy <vz@mleia.com>
    ARM: dts: imx31: move CCM device node to AIPS2 bus devices

Vladimir Zapolskiy <vz@mleia.com>
    ARM: dts: imx31: fix clock control module interrupts description

Christopher Spinrath <christopher.spinrath@rwth-aachen.de>
    ARM: dts: imx6q-cm-fx6: fix fec pinctrl

Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
    ARM: dts: r8a7794: remove Z clock

Geert Uytterhoeven <geert+renesas@glider.be>
    ARM: dts: r8a7794: Use SYSC "always-on" PM Domain for sound

Stefan Wahren <stefan.wahren@i2se.com>
    ARM: dts: bcm283x: fix typo in mailbox address

Maciej Debski <maciejd@google.com>
    perf jit: Enable jitdump support without dwarf

Arnaldo Carvalho de Melo <acme@redhat.com>
    perf scripting: Avoid leaking the scripting_context variable

Rabin Vincent <rabinv@axis.com>
    perf callchain: Fixup help/config for no-unwinding

Kan Liang <kan.liang@intel.com>
    perf diff: Do not overwrite valid build id

Jiri Olsa <jolsa@kernel.org>
    perf trace: Check if MAP_32BIT is defined (again)

Jiri Olsa <jolsa@kernel.org>
    perf mem: Fix --all-user/--all-kernel options

Arnaldo Carvalho de Melo <acme@redhat.com>
    perf trace: Use the syscall raw_syscalls:sys_enter timestamp

Kamal Heib <kamalh@mellanox.com>
    IB/IPoIB: Remove can't use GFP_NOIO warning

Eran Ben Elisha <eranbe@mellanox.com>
    IB/mlx4: Check if GRH is available before using it

Eran Ben Elisha <eranbe@mellanox.com>
    IB/mlx4: When no DMFS for IPoIB, don't allow NET_IF QPs

Saeed Mahameed <saeedm@mellanox.com>
    IB/mlx4: Fix port query for 56Gb Ethernet links

Jack Morgenstein <jackm@dev.mellanox.co.il>
    IB/mlx4: Handle well-known-gid in mad_demux processing

Jack Morgenstein <jackm@dev.mellanox.co.il>
    IB/mlx4: Fix out-of-range array index in destroy qp flow

Maor Gottlieb <maorg@mellanox.com>
    IB/mlx4: Set traffic class in AH

Eli Cohen <eli@mellanox.com>
    IB/mlx5: Wait for all async command completions to complete

Maor Gottlieb <maorg@mellanox.com>
    IB/mlx5: Assign SRQ type earlier

Eli Cohen <eli@mellanox.com>
    IB/mlx5: Fix reported max SGE calculation

Eli Cohen <eli@mellanox.com>
    IB/mlx5: Avoid system crash when enabling many VFs

Arnd Bergmann <arnd@arndb.de>
    IB/rxe: avoid putting a large struct rxe_qp on stack

Yonatan Cohen <yonatanc@mellanox.com>
    IB/rxe: Increase max number of completions to 32k

Leon Romanovsky <leon@kernel.org>
    IB/core: Release allocated memory in cache setup failure


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

Diffstat:

 .../devicetree/bindings/clock/imx31-clock.txt      |   2 +-
 Documentation/kernel-parameters.txt                |   3 +-
 Makefile                                           |   4 +-
 arch/arc/Kconfig                                   |   2 +-
 arch/arc/include/asm/module.h                      |   4 +-
 arch/arc/kernel/module.c                           |   4 +-
 arch/arm/boot/dts/Makefile                         |   1 +
 arch/arm/boot/dts/am33xx.dtsi                      |   1 +
 arch/arm/boot/dts/am4372.dtsi                      |   1 +
 arch/arm/boot/dts/bcm283x.dtsi                     |   2 +-
 arch/arm/boot/dts/da850-evm.dts                    |   1 +
 arch/arm/boot/dts/dm814x.dtsi                      |   1 +
 arch/arm/boot/dts/dm816x.dtsi                      |   1 +
 arch/arm/boot/dts/dra7.dtsi                        |   2 +
 arch/arm/boot/dts/imx31.dtsi                       |  18 +-
 arch/arm/boot/dts/imx6q-cm-fx6.dts                 |   1 -
 arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi       |   4 +-
 arch/arm/boot/dts/logicpd-som-lv-37xx-devkit.dts   |  11 +-
 arch/arm/boot/dts/omap2.dtsi                       |   1 +
 arch/arm/boot/dts/omap3.dtsi                       |   1 +
 arch/arm/boot/dts/omap4.dtsi                       |   1 +
 arch/arm/boot/dts/omap5.dtsi                       |   2 +
 arch/arm/boot/dts/r8a7794.dtsi                     |   7 +-
 arch/arm/include/asm/cputype.h                     |   3 +
 arch/arm/kernel/hw_breakpoint.c                    |  16 +
 arch/arm/kernel/smp_tlb.c                          |   7 +
 arch/arm/mach-ux500/pm.c                           |   4 +-
 arch/arm64/include/asm/memory.h                    |   2 +-
 arch/arm64/include/uapi/asm/ptrace.h               |   1 +
 arch/arm64/kernel/entry.S                          |   2 +-
 arch/arm64/kernel/ptrace.c                         |  16 +-
 arch/arm64/kernel/traps.c                          |  28 +-
 arch/arm64/mm/dma-mapping.c                        |   3 +-
 arch/arm64/mm/init.c                               |   5 +-
 arch/powerpc/include/asm/ppc-opcode.h              |  10 +-
 arch/powerpc/kernel/ptrace.c                       |  14 +
 arch/powerpc/perf/power9-events-list.h             |   2 +-
 arch/powerpc/sysdev/xics/icp-opal.c                |  31 +-
 arch/s390/kvm/kvm-s390.c                           |   4 +-
 arch/x86/kernel/apic/io_apic.c                     |   2 +
 arch/x86/kernel/pci-swiotlb.c                      |   2 +-
 arch/x86/pci/acpi.c                                |  10 +
 arch/x86/xen/pci-swiotlb-xen.c                     |   2 +-
 drivers/clocksource/exynos_mct.c                   |   1 +
 drivers/devfreq/devfreq.c                          |  15 +-
 drivers/devfreq/exynos-bus.c                       |   2 +-
 drivers/dma/pl330.c                                |  11 +
 drivers/dma/sh/rcar-dmac.c                         |   8 +
 drivers/hid/hid-corsair.c                          |  60 ++-
 drivers/infiniband/core/cache.c                    |  16 +-
 drivers/infiniband/hw/mlx4/ah.c                    |   6 +-
 drivers/infiniband/hw/mlx4/mad.c                   |  16 +-
 drivers/infiniband/hw/mlx4/main.c                  |  29 +-
 drivers/infiniband/hw/mlx4/qp.c                    |   7 +-
 drivers/infiniband/hw/mlx5/main.c                  |   8 +-
 drivers/infiniband/hw/mlx5/mr.c                    |  31 +-
 drivers/infiniband/hw/mlx5/qp.c                    |  29 +-
 drivers/infiniband/hw/mlx5/srq.c                   |   2 +-
 drivers/infiniband/sw/rxe/rxe_param.h              |   2 +-
 drivers/infiniband/sw/rxe/rxe_req.c                |  14 +-
 drivers/infiniband/ulp/ipoib/ipoib_cm.c            |   2 -
 drivers/input/mouse/alps.c                         |  19 +-
 drivers/media/platform/Kconfig                     |   2 +-
 drivers/media/platform/blackfin/ppi.c              |   2 +
 drivers/media/platform/s5p-mfc/s5p_mfc.c           |   7 +-
 drivers/media/platform/sti/hva/hva-hw.c            |   6 +-
 drivers/media/rc/ite-cir.c                         |   2 +
 drivers/media/spi/gs1662.c                         |   3 +-
 drivers/mmc/host/mxs-mmc.c                         |   6 +-
 drivers/mmc/host/sdhci-acpi.c                      |   3 +-
 drivers/mtd/nand/Kconfig                           |   2 +-
 drivers/mtd/nand/lpc32xx_mlc.c                     |   2 +-
 drivers/mtd/nand/xway_nand.c                       |   5 +-
 drivers/mtd/spi-nor/cadence-quadspi.c              |   6 +-
 drivers/net/ieee802154/atusb.c                     |  31 +-
 drivers/nvdimm/namespace_devs.c                    |  23 +-
 drivers/pci/host/pcie-designware.c                 |  10 +-
 drivers/pci/probe.c                                |  12 +-
 drivers/rpmsg/rpmsg_core.c                         |   4 +-
 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c           |   7 +-
 drivers/scsi/mpt3sas/mpt3sas_base.h                |  12 +
 drivers/scsi/mpt3sas/mpt3sas_scsih.c               |  40 +-
 drivers/scsi/qla2xxx/qla_os.c                      |  16 +-
 drivers/scsi/ses.c                                 |   2 +-
 drivers/soc/ti/wkup_m3_ipc.c                       |   1 +
 drivers/spi/spi-pxa2xx.c                           |   1 +
 drivers/staging/media/s5p-cec/s5p_cec.c            |   4 +-
 drivers/xen/swiotlb-xen.c                          |   4 +-
 fs/ceph/caps.c                                     |  17 +-
 fs/ceph/dir.c                                      |   5 +-
 fs/ceph/inode.c                                    |   3 +-
 fs/ceph/mds_client.c                               |   9 +-
 fs/fuse/dev.c                                      |   3 +-
 fs/fuse/dir.c                                      |   2 +-
 fs/posix_acl.c                                     |   9 +-
 fs/ubifs/tnc.c                                     |  25 +-
 include/dt-bindings/clock/r8a7794-clock.h          |   3 +-
 include/linux/rcupdate.h                           |   4 +
 include/linux/sunrpc/svc_xprt.h                    |   1 +
 include/linux/swiotlb.h                            |   8 +-
 include/trace/events/swiotlb.h                     |  17 +-
 kernel/rcu/rcu.h                                   |   1 +
 kernel/rcu/tiny.c                                  |   4 -
 kernel/rcu/tiny_plugin.h                           |   9 +-
 kernel/rcu/tree.c                                  |  33 +-
 kernel/rcu/tree_exp.h                              |  52 ++-
 kernel/rcu/tree_plugin.h                           |   2 +-
 kernel/rcu/update.c                                |  38 +-
 lib/swiotlb.c                                      |  26 +-
 net/ceph/auth_x.c                                  | 195 ++++-----
 net/ceph/auth_x.h                                  |   3 +-
 net/ceph/crypto.c                                  | 463 +++++----------------
 net/ceph/crypto.h                                  |  26 +-
 net/mac80211/rx.c                                  |  26 +-
 net/sunrpc/auth_gss/svcauth_gss.c                  |   2 +-
 net/sunrpc/svc_xprt.c                              |  10 +-
 net/sunrpc/xprtrdma/frwr_ops.c                     |  13 +-
 net/sunrpc/xprtrdma/svc_rdma_recvfrom.c            |   2 -
 net/sunrpc/xprtrdma/verbs.c                        |  14 +-
 net/sunrpc/xprtrdma/xprt_rdma.h                    |  20 +-
 tools/perf/Makefile.config                         |   2 +-
 tools/perf/builtin-mem.c                           |   4 +-
 tools/perf/builtin-trace.c                         |   6 +-
 tools/perf/trace/beauty/mmap.c                     |   2 +
 tools/perf/util/Build                              |   2 +-
 tools/perf/util/callchain.c                        |   2 -
 tools/perf/util/callchain.h                        |   4 -
 tools/perf/util/genelf.c                           |   9 +-
 tools/perf/util/genelf.h                           |   2 +
 tools/perf/util/symbol.c                           |   3 +-
 tools/perf/util/trace-event-scripting.c            |   6 +-
 .../powerpc/pmu/ebb/pmc56_overflow_test.c          |   2 +-
 tools/virtio/ringtest/run-on-all.sh                |   5 +-
 virt/kvm/arm/vgic/vgic-init.c                      |  18 +-
 virt/kvm/arm/vgic/vgic-v2.c                        |   2 -
 virt/kvm/arm/vgic/vgic-v3.c                        |   2 -
 136 files changed, 1031 insertions(+), 815 deletions(-)

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 001/130] IB/core: Release allocated memory in cache setup failure
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 002/130] IB/rxe: Increase max number of completions to 32k Greg Kroah-Hartman
                     ` (125 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Leon Romanovsky, Doug Ledford

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

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

From: Leon Romanovsky <leon@kernel.org>

commit aa6aae38f7fb2c030f326a6dd10b58fff1851dfa upstream.

The failure in ib_cache_setup_one function during
ib_register_device will leave leaked allocated memory.

Fixes: 03db3a2d81e6 ("IB/core: Add RoCE GID table management")
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/core/cache.c |   16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

--- a/drivers/infiniband/core/cache.c
+++ b/drivers/infiniband/core/cache.c
@@ -770,12 +770,8 @@ static int _gid_table_setup_one(struct i
 	int err = 0;
 
 	table = kcalloc(ib_dev->phys_port_cnt, sizeof(*table), GFP_KERNEL);
-
-	if (!table) {
-		pr_warn("failed to allocate ib gid cache for %s\n",
-			ib_dev->name);
+	if (!table)
 		return -ENOMEM;
-	}
 
 	for (port = 0; port < ib_dev->phys_port_cnt; port++) {
 		u8 rdma_port = port + rdma_start_port(ib_dev);
@@ -1170,14 +1166,13 @@ int ib_cache_setup_one(struct ib_device
 					  GFP_KERNEL);
 	if (!device->cache.pkey_cache ||
 	    !device->cache.lmc_cache) {
-		pr_warn("Couldn't allocate cache for %s\n", device->name);
-		return -ENOMEM;
+		err = -ENOMEM;
+		goto free;
 	}
 
 	err = gid_table_setup_one(device);
 	if (err)
-		/* Allocated memory will be cleaned in the release function */
-		return err;
+		goto free;
 
 	for (p = 0; p <= rdma_end_port(device) - rdma_start_port(device); ++p)
 		ib_cache_update(device, p + rdma_start_port(device));
@@ -1192,6 +1187,9 @@ int ib_cache_setup_one(struct ib_device
 
 err:
 	gid_table_cleanup_one(device);
+free:
+	kfree(device->cache.pkey_cache);
+	kfree(device->cache.lmc_cache);
 	return err;
 }
 

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 002/130] IB/rxe: Increase max number of completions to 32k
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 001/130] IB/core: Release allocated memory in cache setup failure Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 003/130] IB/rxe: avoid putting a large struct rxe_qp on stack Greg Kroah-Hartman
                     ` (124 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Yonatan Cohen, Moni Shoua,
	Leon Romanovsky, Doug Ledford

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

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

From: Yonatan Cohen <yonatanc@mellanox.com>

commit d680ebed91e0b45c43ae03a880a0b43211096161 upstream.

Increase limit of max CQE from 8K to 32K to allow demanding
applications to work over SoftRoCE with same configuration
as most RoCEv2 HW vendors have.

Fixes: 8700e3e7c485 ("Soft RoCE driver")
Signed-off-by: Yonatan Cohen <yonatanc@mellanox.com>
Reviewed-by: Moni Shoua <monis@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/sw/rxe/rxe_param.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/infiniband/sw/rxe/rxe_param.h
+++ b/drivers/infiniband/sw/rxe/rxe_param.h
@@ -82,7 +82,7 @@ enum rxe_device_param {
 	RXE_MAX_SGE			= 32,
 	RXE_MAX_SGE_RD			= 32,
 	RXE_MAX_CQ			= 16384,
-	RXE_MAX_LOG_CQE			= 13,
+	RXE_MAX_LOG_CQE			= 15,
 	RXE_MAX_MR			= 2 * 1024,
 	RXE_MAX_PD			= 0x7ffc,
 	RXE_MAX_QP_RD_ATOM		= 128,

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 003/130] IB/rxe: avoid putting a large struct rxe_qp on stack
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 001/130] IB/core: Release allocated memory in cache setup failure Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 002/130] IB/rxe: Increase max number of completions to 32k Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 004/130] IB/mlx5: Avoid system crash when enabling many VFs Greg Kroah-Hartman
                     ` (123 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Arnd Bergmann, Leon Romanovsky, Doug Ledford

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

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

From: Arnd Bergmann <arnd@arndb.de>

commit a0fa72683e78979ef1123d679b1c40ae28bd9096 upstream.

A race condition fix added an rxe_qp structure to the stack in order
to be able to perform rollback in rxe_requester(), but the structure
is large enough to trigger the warning for possible stack overflow:

drivers/infiniband/sw/rxe/rxe_req.c: In function 'rxe_requester':
drivers/infiniband/sw/rxe/rxe_req.c:757:1: error: the frame size of 2064 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

This changes the rollback function to only save the psn inside
the qp, which is the only field we access in the rollback_qp
anyway.

Fixes: 3050b9985024 ("IB/rxe: Fix race condition between requester and completer")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/sw/rxe/rxe_req.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

--- a/drivers/infiniband/sw/rxe/rxe_req.c
+++ b/drivers/infiniband/sw/rxe/rxe_req.c
@@ -548,23 +548,23 @@ static void update_wqe_psn(struct rxe_qp
 static void save_state(struct rxe_send_wqe *wqe,
 		       struct rxe_qp *qp,
 		       struct rxe_send_wqe *rollback_wqe,
-		       struct rxe_qp *rollback_qp)
+		       u32 *rollback_psn)
 {
 	rollback_wqe->state     = wqe->state;
 	rollback_wqe->first_psn = wqe->first_psn;
 	rollback_wqe->last_psn  = wqe->last_psn;
-	rollback_qp->req.psn    = qp->req.psn;
+	*rollback_psn		= qp->req.psn;
 }
 
 static void rollback_state(struct rxe_send_wqe *wqe,
 			   struct rxe_qp *qp,
 			   struct rxe_send_wqe *rollback_wqe,
-			   struct rxe_qp *rollback_qp)
+			   u32 rollback_psn)
 {
 	wqe->state     = rollback_wqe->state;
 	wqe->first_psn = rollback_wqe->first_psn;
 	wqe->last_psn  = rollback_wqe->last_psn;
-	qp->req.psn    = rollback_qp->req.psn;
+	qp->req.psn    = rollback_psn;
 }
 
 static void update_state(struct rxe_qp *qp, struct rxe_send_wqe *wqe,
@@ -593,8 +593,8 @@ int rxe_requester(void *arg)
 	int mtu;
 	int opcode;
 	int ret;
-	struct rxe_qp rollback_qp;
 	struct rxe_send_wqe rollback_wqe;
+	u32 rollback_psn;
 
 next_wqe:
 	if (unlikely(!qp->valid || qp->req.state == QP_STATE_ERROR))
@@ -719,7 +719,7 @@ next_wqe:
 	 * rxe_xmit_packet().
 	 * Otherwise, completer might initiate an unjustified retry flow.
 	 */
-	save_state(wqe, qp, &rollback_wqe, &rollback_qp);
+	save_state(wqe, qp, &rollback_wqe, &rollback_psn);
 	update_wqe_state(qp, wqe, &pkt);
 	update_wqe_psn(qp, wqe, &pkt, payload);
 	ret = rxe_xmit_packet(to_rdev(qp->ibqp.device), qp, &pkt, skb);
@@ -727,7 +727,7 @@ next_wqe:
 		qp->need_req_skb = 1;
 		kfree_skb(skb);
 
-		rollback_state(wqe, qp, &rollback_wqe, &rollback_qp);
+		rollback_state(wqe, qp, &rollback_wqe, rollback_psn);
 
 		if (ret == -EAGAIN) {
 			rxe_run_task(&qp->req.task, 1);

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 004/130] IB/mlx5: Avoid system crash when enabling many VFs
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (2 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 003/130] IB/rxe: avoid putting a large struct rxe_qp on stack Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 005/130] IB/mlx5: Fix reported max SGE calculation Greg Kroah-Hartman
                     ` (122 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Eli Cohen, Maor Gottlieb,
	Leon Romanovsky, Doug Ledford

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

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

From: Eli Cohen <eli@mellanox.com>

commit afd02cd3a9b6c04b41d946b5d7f6e17b3fc30c6b upstream.

When enabling many VFs, the total amount of DMA mappings increase
significantly. This causes DMA allocations to take a lot of time
since they are serialized in the kernel.

As a result the driver enters into fatal condition due to
timeout and the system hangs. To recover from this we disable
MR cache for VFs.

PFs will still have a full cache and VFs cache can be manipulated
as usual after driver load.

Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
Signed-off-by: Eli Cohen <eli@mellanox.com>
Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/hw/mlx5/mr.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -628,7 +628,8 @@ int mlx5_mr_cache_init(struct mlx5_ib_de
 		ent->order = i + 2;
 		ent->dev = dev;
 
-		if (dev->mdev->profile->mask & MLX5_PROF_MASK_MR_CACHE)
+		if ((dev->mdev->profile->mask & MLX5_PROF_MASK_MR_CACHE) &&
+		    (mlx5_core_is_pf(dev->mdev)))
 			limit = dev->mdev->profile->mr_cache[i].limit;
 		else
 			limit = 0;

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 005/130] IB/mlx5: Fix reported max SGE calculation
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (3 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 004/130] IB/mlx5: Avoid system crash when enabling many VFs Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 006/130] IB/mlx5: Assign SRQ type earlier Greg Kroah-Hartman
                     ` (121 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Eli Cohen, Maor Gottlieb,
	Leon Romanovsky, Doug Ledford

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

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

From: Eli Cohen <eli@mellanox.com>

commit 288c01b746aab484651391ca6d64b585d3eb5ec6 upstream.

Add the 512 bytes limit of RDMA READ and the size of remote
address to the max SGE calculation.

Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
Signed-off-by: Eli Cohen <eli@mellanox.com>
Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/hw/mlx5/main.c |    8 +++++---
 drivers/infiniband/hw/mlx5/qp.c   |   29 ++++++++++++++++++++++++++++-
 2 files changed, 33 insertions(+), 4 deletions(-)

--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -496,6 +496,7 @@ static int mlx5_ib_query_device(struct i
 	struct mlx5_ib_dev *dev = to_mdev(ibdev);
 	struct mlx5_core_dev *mdev = dev->mdev;
 	int err = -ENOMEM;
+	int max_sq_desc;
 	int max_rq_sg;
 	int max_sq_sg;
 	u64 min_page_size = 1ull << MLX5_CAP_GEN(mdev, log_pg_sz);
@@ -618,9 +619,10 @@ static int mlx5_ib_query_device(struct i
 	props->max_qp_wr	   = 1 << MLX5_CAP_GEN(mdev, log_max_qp_sz);
 	max_rq_sg =  MLX5_CAP_GEN(mdev, max_wqe_sz_rq) /
 		     sizeof(struct mlx5_wqe_data_seg);
-	max_sq_sg = (MLX5_CAP_GEN(mdev, max_wqe_sz_sq) -
-		     sizeof(struct mlx5_wqe_ctrl_seg)) /
-		     sizeof(struct mlx5_wqe_data_seg);
+	max_sq_desc = min_t(int, MLX5_CAP_GEN(mdev, max_wqe_sz_sq), 512);
+	max_sq_sg = (max_sq_desc - sizeof(struct mlx5_wqe_ctrl_seg) -
+		     sizeof(struct mlx5_wqe_raddr_seg)) /
+		sizeof(struct mlx5_wqe_data_seg);
 	props->max_sge = min(max_rq_sg, max_sq_sg);
 	props->max_sge_rd	   = MLX5_MAX_SGE_RD;
 	props->max_cq		   = 1 << MLX5_CAP_GEN(mdev, log_max_cq);
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -351,6 +351,29 @@ static int calc_send_wqe(struct ib_qp_in
 		return ALIGN(max_t(int, inl_size, size), MLX5_SEND_WQE_BB);
 }
 
+static int get_send_sge(struct ib_qp_init_attr *attr, int wqe_size)
+{
+	int max_sge;
+
+	if (attr->qp_type == IB_QPT_RC)
+		max_sge = (min_t(int, wqe_size, 512) -
+			   sizeof(struct mlx5_wqe_ctrl_seg) -
+			   sizeof(struct mlx5_wqe_raddr_seg)) /
+			sizeof(struct mlx5_wqe_data_seg);
+	else if (attr->qp_type == IB_QPT_XRC_INI)
+		max_sge = (min_t(int, wqe_size, 512) -
+			   sizeof(struct mlx5_wqe_ctrl_seg) -
+			   sizeof(struct mlx5_wqe_xrc_seg) -
+			   sizeof(struct mlx5_wqe_raddr_seg)) /
+			sizeof(struct mlx5_wqe_data_seg);
+	else
+		max_sge = (wqe_size - sq_overhead(attr)) /
+			sizeof(struct mlx5_wqe_data_seg);
+
+	return min_t(int, max_sge, wqe_size - sq_overhead(attr) /
+		     sizeof(struct mlx5_wqe_data_seg));
+}
+
 static int calc_sq_size(struct mlx5_ib_dev *dev, struct ib_qp_init_attr *attr,
 			struct mlx5_ib_qp *qp)
 {
@@ -387,7 +410,11 @@ static int calc_sq_size(struct mlx5_ib_d
 		return -ENOMEM;
 	}
 	qp->sq.wqe_shift = ilog2(MLX5_SEND_WQE_BB);
-	qp->sq.max_gs = attr->cap.max_send_sge;
+	qp->sq.max_gs = get_send_sge(attr, wqe_size);
+	if (qp->sq.max_gs < attr->cap.max_send_sge)
+		return -ENOMEM;
+
+	attr->cap.max_send_sge = qp->sq.max_gs;
 	qp->sq.max_post = wq_size / wqe_size;
 	attr->cap.max_send_wr = qp->sq.max_post;
 

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 006/130] IB/mlx5: Assign SRQ type earlier
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (4 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 005/130] IB/mlx5: Fix reported max SGE calculation Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 007/130] IB/mlx5: Wait for all async command completions to complete Greg Kroah-Hartman
                     ` (120 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Maor Gottlieb, Majd Dibbiny,
	Leon Romanovsky, Doug Ledford

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

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

From: Maor Gottlieb <maorg@mellanox.com>

commit c73b7911de97fad3ab9032a110af48d6ab2da48f upstream.

Move the SRQ type assignment to be before actually using it
in create_srq_user() and in create_srq_kernel() functions.

Fixes: af1ba291c5e4 ('{net, IB}/mlx5: Refactor internal SRQ API')
Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Reviewed-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/hw/mlx5/srq.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/infiniband/hw/mlx5/srq.c
+++ b/drivers/infiniband/hw/mlx5/srq.c
@@ -282,6 +282,7 @@ struct ib_srq *mlx5_ib_create_srq(struct
 	mlx5_ib_dbg(dev, "desc_size 0x%x, req wr 0x%x, srq size 0x%x, max_gs 0x%x, max_avail_gather 0x%x\n",
 		    desc_size, init_attr->attr.max_wr, srq->msrq.max, srq->msrq.max_gs,
 		    srq->msrq.max_avail_gather);
+	in.type = init_attr->srq_type;
 
 	if (pd->uobject)
 		err = create_srq_user(pd, srq, &in, udata, buf_size);
@@ -294,7 +295,6 @@ struct ib_srq *mlx5_ib_create_srq(struct
 		goto err_srq;
 	}
 
-	in.type = init_attr->srq_type;
 	in.log_size = ilog2(srq->msrq.max);
 	in.wqe_shift = srq->msrq.wqe_shift - 4;
 	if (srq->wq_sig)

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 007/130] IB/mlx5: Wait for all async command completions to complete
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (5 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 006/130] IB/mlx5: Assign SRQ type earlier Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 008/130] IB/mlx4: Set traffic class in AH Greg Kroah-Hartman
                     ` (119 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Eli Cohen, Maor Gottlieb,
	Leon Romanovsky, Doug Ledford

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

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

From: Eli Cohen <eli@mellanox.com>

commit acbda523884dcf45613bf6818d8ead5180df35c2 upstream.

Wait before continuing unload till all pending mkey async creation requests
are done.

Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
Signed-off-by: Eli Cohen <eli@mellanox.com>
Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/hw/mlx5/mr.c |   28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -647,6 +647,33 @@ int mlx5_mr_cache_init(struct mlx5_ib_de
 	return 0;
 }
 
+static void wait_for_async_commands(struct mlx5_ib_dev *dev)
+{
+	struct mlx5_mr_cache *cache = &dev->cache;
+	struct mlx5_cache_ent *ent;
+	int total = 0;
+	int i;
+	int j;
+
+	for (i = 0; i < MAX_MR_CACHE_ENTRIES; i++) {
+		ent = &cache->ent[i];
+		for (j = 0 ; j < 1000; j++) {
+			if (!ent->pending)
+				break;
+			msleep(50);
+		}
+	}
+	for (i = 0; i < MAX_MR_CACHE_ENTRIES; i++) {
+		ent = &cache->ent[i];
+		total += ent->pending;
+	}
+
+	if (total)
+		mlx5_ib_warn(dev, "aborted while there are %d pending mr requests\n", total);
+	else
+		mlx5_ib_warn(dev, "done with all pending requests\n");
+}
+
 int mlx5_mr_cache_cleanup(struct mlx5_ib_dev *dev)
 {
 	int i;
@@ -660,6 +687,7 @@ int mlx5_mr_cache_cleanup(struct mlx5_ib
 		clean_keys(dev, i);
 
 	destroy_workqueue(dev->cache.wq);
+	wait_for_async_commands(dev);
 	del_timer_sync(&dev->delay_timer);
 
 	return 0;

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 008/130] IB/mlx4: Set traffic class in AH
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (6 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 007/130] IB/mlx5: Wait for all async command completions to complete Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 009/130] IB/mlx4: Fix out-of-range array index in destroy qp flow Greg Kroah-Hartman
                     ` (118 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Maor Gottlieb, Daniel Jurgens,
	Mark Bloch, Leon Romanovsky, Doug Ledford

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

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

From: Maor Gottlieb <maorg@mellanox.com>

commit af4295c117b82a521b05d0daf39ce879d26e6cb1 upstream.

Set traffic class within sl_tclass_flowlabel when create iboe AH.
Without this the TOS value will be empty when running VLAN tagged
traffic, because the TOS value is taken from the traffic class in the
address handle attributes.

Fixes: 9106c4106974 ('IB/mlx4: Fix SL to 802.1Q priority-bits mapping for IBoE')
Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Daniel Jurgens <danielj@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/hw/mlx4/ah.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/drivers/infiniband/hw/mlx4/ah.c
+++ b/drivers/infiniband/hw/mlx4/ah.c
@@ -114,7 +114,9 @@ static struct ib_ah *create_iboe_ah(stru
 		       !(1 << ah->av.eth.stat_rate & dev->caps.stat_rate_support))
 			--ah->av.eth.stat_rate;
 	}
-
+	ah->av.eth.sl_tclass_flowlabel |=
+			cpu_to_be32((ah_attr->grh.traffic_class << 20) |
+				    ah_attr->grh.flow_label);
 	/*
 	 * HW requires multicast LID so we just choose one.
 	 */
@@ -122,7 +124,7 @@ static struct ib_ah *create_iboe_ah(stru
 		ah->av.ib.dlid = cpu_to_be16(0xc000);
 
 	memcpy(ah->av.eth.dgid, ah_attr->grh.dgid.raw, 16);
-	ah->av.eth.sl_tclass_flowlabel = cpu_to_be32(ah_attr->sl << 29);
+	ah->av.eth.sl_tclass_flowlabel |= cpu_to_be32(ah_attr->sl << 29);
 
 	return &ah->ibah;
 }

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 009/130] IB/mlx4: Fix out-of-range array index in destroy qp flow
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (7 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 008/130] IB/mlx4: Set traffic class in AH Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 010/130] IB/mlx4: Handle well-known-gid in mad_demux processing Greg Kroah-Hartman
                     ` (117 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jack Morgenstein, Leon Romanovsky,
	Doug Ledford

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

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

From: Jack Morgenstein <jackm@dev.mellanox.co.il>

commit c482af646d0809a8d5e1b7f4398cce3592589b98 upstream.

For non-special QPs, the port value becomes non-zero only at the
RESET-to-INIT transition. If the QP has not undergone that transition,
its port number value is still zero.

If such a QP is destroyed before being moved out of the RESET state,
subtracting one from the qp port number results in a negative value.
Using that negative value as an index into the qp1_proxy array
results in an out-of-bounds array reference.

Fix this by testing that the QP type is one that uses qp1_proxy before
using the port number. For special QPs of all types, the port number is
specified at QP creation time.

Fixes: 9433c188915c ("IB/mlx4: Invoke UPDATE_QP for proxy QP1 on MAC changes")
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/hw/mlx4/qp.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -1280,7 +1280,8 @@ static int _mlx4_ib_destroy_qp(struct ib
 	if (is_qp0(dev, mqp))
 		mlx4_CLOSE_PORT(dev->dev, mqp->port);
 
-	if (dev->qp1_proxy[mqp->port - 1] == mqp) {
+	if (mqp->mlx4_ib_qp_type == MLX4_IB_QPT_PROXY_GSI &&
+	    dev->qp1_proxy[mqp->port - 1] == mqp) {
 		mutex_lock(&dev->qp1_proxy_lock[mqp->port - 1]);
 		dev->qp1_proxy[mqp->port - 1] = NULL;
 		mutex_unlock(&dev->qp1_proxy_lock[mqp->port - 1]);

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 010/130] IB/mlx4: Handle well-known-gid in mad_demux processing
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (8 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 009/130] IB/mlx4: Fix out-of-range array index in destroy qp flow Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 011/130] IB/mlx4: Fix port query for 56Gb Ethernet links Greg Kroah-Hartman
                     ` (116 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jack Morgenstein, Daniel Jurgens,
	Leon Romanovsky, Doug Ledford

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

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

From: Jack Morgenstein <jackm@dev.mellanox.co.il>

commit befcabcd530e4ffb6f016638f693b7d94986d2ba upstream.

If OpenSM runs over a ConnectX-3, and there are ConnectX-4 or Connect-IB
VFs active on the network, the OpenSM will receive QP1 packets containing
a GRH where the destination GID is the "Well-Known GID" -- which is not a
GID in the HCA Port's GID Table.

This GID must be tested-for separately -- and packets which contain
this destination GID should be routed to slave 0 (the PF).

Fixes: 37bfc7c1e83f ('IB/mlx4: SR-IOV multiplex and demultiplex MADs')
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Daniel Jurgens <danielj@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/hw/mlx4/mad.c |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

--- a/drivers/infiniband/hw/mlx4/mad.c
+++ b/drivers/infiniband/hw/mlx4/mad.c
@@ -702,10 +702,18 @@ static int mlx4_ib_demux_mad(struct ib_d
 
 	/* If a grh is present, we demux according to it */
 	if (wc->wc_flags & IB_WC_GRH) {
-		slave = mlx4_ib_find_real_gid(ibdev, port, grh->dgid.global.interface_id);
-		if (slave < 0) {
-			mlx4_ib_warn(ibdev, "failed matching grh\n");
-			return -ENOENT;
+		if (grh->dgid.global.interface_id ==
+			cpu_to_be64(IB_SA_WELL_KNOWN_GUID) &&
+		    grh->dgid.global.subnet_prefix == cpu_to_be64(
+			atomic64_read(&dev->sriov.demux[port - 1].subnet_prefix))) {
+			slave = 0;
+		} else {
+			slave = mlx4_ib_find_real_gid(ibdev, port,
+						      grh->dgid.global.interface_id);
+			if (slave < 0) {
+				mlx4_ib_warn(ibdev, "failed matching grh\n");
+				return -ENOENT;
+			}
 		}
 	}
 	/* Class-specific handling */

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 011/130] IB/mlx4: Fix port query for 56Gb Ethernet links
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (9 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 010/130] IB/mlx4: Handle well-known-gid in mad_demux processing Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 012/130] IB/mlx4: When no DMFS for IPoIB, dont allow NET_IF QPs Greg Kroah-Hartman
                     ` (115 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Saeed Mahameed, Yishai Hadas,
	Daniel Jurgens, Leon Romanovsky, Doug Ledford

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

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

From: Saeed Mahameed <saeedm@mellanox.com>

commit 6fa26208206c406fa529cd73f7ae6bf4181e270b upstream.

Report the correct speed in the port attributes when using a 56Gbps
ethernet link.  Without this change the field is incorrectly set to 10.

Fixes: a9c766bb75ee ('IB/mlx4: Fix info returned when querying IBoE ports')
Fixes: 2e96691c31ec ('IB: Use central enum for speed instead of hard-coded values')
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Daniel Jurgens <danielj@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/hw/mlx4/main.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -697,9 +697,11 @@ static int eth_link_query_port(struct ib
 	if (err)
 		goto out;
 
-	props->active_width	=  (((u8 *)mailbox->buf)[5] == 0x40) ?
-						IB_WIDTH_4X : IB_WIDTH_1X;
-	props->active_speed	= IB_SPEED_QDR;
+	props->active_width	=  (((u8 *)mailbox->buf)[5] == 0x40) ||
+				   (((u8 *)mailbox->buf)[5] == 0x20 /*56Gb*/) ?
+					   IB_WIDTH_4X : IB_WIDTH_1X;
+	props->active_speed	=  (((u8 *)mailbox->buf)[5] == 0x20 /*56Gb*/) ?
+					   IB_SPEED_FDR : IB_SPEED_QDR;
 	props->port_cap_flags	= IB_PORT_CM_SUP | IB_PORT_IP_BASED_GIDS;
 	props->gid_tbl_len	= mdev->dev->caps.gid_table_len[port];
 	props->max_msg_sz	= mdev->dev->caps.max_msg_sz;

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 012/130] IB/mlx4: When no DMFS for IPoIB, dont allow NET_IF QPs
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (10 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 011/130] IB/mlx4: Fix port query for 56Gb Ethernet links Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 013/130] IB/mlx4: Check if GRH is available before using it Greg Kroah-Hartman
                     ` (114 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Eran Ben Elisha, Daniel Jurgens,
	Mark Bloch, Leon Romanovsky, Doug Ledford

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

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

From: Eran Ben Elisha <eranbe@mellanox.com>

commit 1f22e454df2eb99ba6b7ace3f594f6805cdf5cbc upstream.

According to the firmware spec, FLOW_STEERING_IB_UC_QP_RANGE command is
supported only if dmfs_ipoib bit is set.

If it isn't set we want to ensure allocating NET_IF QPs fail. We do so
by filling out the allocation bitmap. By thus, the NET_IF QPs allocating
function won't find any free QP and will fail.

Fixes: c1c98501121e ('IB/mlx4: Add support for steerable IB UD QPs')
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Daniel Jurgens <danielj@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/hw/mlx4/main.c |   21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -2822,14 +2822,19 @@ static void *mlx4_ib_add(struct mlx4_dev
 			goto err_steer_qp_release;
 		}
 
-		bitmap_zero(ibdev->ib_uc_qpns_bitmap, ibdev->steer_qpn_count);
-
-		err = mlx4_FLOW_STEERING_IB_UC_QP_RANGE(
-				dev, ibdev->steer_qpn_base,
-				ibdev->steer_qpn_base +
-				ibdev->steer_qpn_count - 1);
-		if (err)
-			goto err_steer_free_bitmap;
+		if (dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_DMFS_IPOIB) {
+			bitmap_zero(ibdev->ib_uc_qpns_bitmap,
+				    ibdev->steer_qpn_count);
+			err = mlx4_FLOW_STEERING_IB_UC_QP_RANGE(
+					dev, ibdev->steer_qpn_base,
+					ibdev->steer_qpn_base +
+					ibdev->steer_qpn_count - 1);
+			if (err)
+				goto err_steer_free_bitmap;
+		} else {
+			bitmap_fill(ibdev->ib_uc_qpns_bitmap,
+				    ibdev->steer_qpn_count);
+		}
 	}
 
 	for (j = 1; j <= ibdev->dev->caps.num_ports; j++)

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 013/130] IB/mlx4: Check if GRH is available before using it
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (11 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 012/130] IB/mlx4: When no DMFS for IPoIB, dont allow NET_IF QPs Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 014/130] IB/IPoIB: Remove cant use GFP_NOIO warning Greg Kroah-Hartman
                     ` (113 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Eran Ben Elisha, Daniel Jurgens,
	Mark Bloch, Leon Romanovsky, Doug Ledford

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

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

From: Eran Ben Elisha <eranbe@mellanox.com>

commit bf08e884bfd5be068fd2ccf2bc450f085d8dd853 upstream.

Before reading GRH attributes, need to make sure AH contains GRH,
and in addition, initialize GID type.

Fixes: dbf727de7440 ('IB/core: Use GID table in AH creation and dmac resolution')
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Daniel Jurgens <danielj@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/hw/mlx4/qp.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -1765,14 +1765,14 @@ static int __mlx4_ib_modify_qp(struct ib
 		u8 port_num = mlx4_is_bonded(to_mdev(ibqp->device)->dev) ? 1 :
 			attr_mask & IB_QP_PORT ? attr->port_num : qp->port;
 		union ib_gid gid;
-		struct ib_gid_attr gid_attr;
+		struct ib_gid_attr gid_attr = {.gid_type = IB_GID_TYPE_IB};
 		u16 vlan = 0xffff;
 		u8 smac[ETH_ALEN];
 		int status = 0;
 		int is_eth = rdma_cap_eth_ah(&dev->ib_dev, port_num) &&
 			attr->ah_attr.ah_flags & IB_AH_GRH;
 
-		if (is_eth) {
+		if (is_eth && attr->ah_attr.ah_flags & IB_AH_GRH) {
 			int index = attr->ah_attr.grh.sgid_index;
 
 			status = ib_get_cached_gid(ibqp->device, port_num,

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 014/130] IB/IPoIB: Remove cant use GFP_NOIO warning
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (12 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 013/130] IB/mlx4: Check if GRH is available before using it Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 015/130] perf trace: Use the syscall raw_syscalls:sys_enter timestamp Greg Kroah-Hartman
                     ` (112 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Kamal Heib, Leon Romanovsky,
	Yuval Shaia, Doug Ledford

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

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

From: Kamal Heib <kamalh@mellanox.com>

commit 0b59970e7d96edcb3c7f651d9d48e1a59af3c3b0 upstream.

Remove the warning print of "can't use of GFP_NOIO" to avoid prints in
each QP creation when devices aren't supporting IB_QP_CREATE_USE_GFP_NOIO.

This print become more annoying when the IPoIB interface is configured
to work in connected mode.

Fixes: 09b93088d750 ('IB: Add a QP creation flag to use GFP_NOIO allocations')
Signed-off-by: Kamal Heib <kamalh@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/ulp/ipoib/ipoib_cm.c |    2 --
 1 file changed, 2 deletions(-)

--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -1054,8 +1054,6 @@ static struct ib_qp *ipoib_cm_create_tx_
 
 	tx_qp = ib_create_qp(priv->pd, &attr);
 	if (PTR_ERR(tx_qp) == -EINVAL) {
-		ipoib_warn(priv, "can't use GFP_NOIO for QPs on device %s, using GFP_KERNEL\n",
-			   priv->ca->name);
 		attr.create_flags &= ~IB_QP_CREATE_USE_GFP_NOIO;
 		tx_qp = ib_create_qp(priv->pd, &attr);
 	}

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 015/130] perf trace: Use the syscall raw_syscalls:sys_enter timestamp
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (13 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 014/130] IB/IPoIB: Remove cant use GFP_NOIO warning Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 016/130] perf mem: Fix --all-user/--all-kernel options Greg Kroah-Hartman
                     ` (111 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Adrian Hunter, David Ahern,
	Jiri Olsa, Namhyung Kim, Wang Nan, Arnaldo Carvalho de Melo

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

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

From: Arnaldo Carvalho de Melo <acme@redhat.com>

commit ecf1e2253ea79c6204f4d6a5e756e8fb4aed5a7e upstream.

Instead of the one when another syscall takes place while another is being
processed (in another CPU, but we show it serialized, so need to "interrupt"
the other), and also when finally showing the sys_enter + sys_exit + duration,
where we were showing the sample->time for the sys_exit, duh.

Before:

  # perf trace sleep 1
  <SNIP>
     0.373 (   0.001 ms): close(fd: 3                   ) = 0
  1000.626 (1000.211 ms): nanosleep(rqtp: 0x7ffd6ddddfb0) = 0
  1000.653 (   0.003 ms): close(fd: 1                   ) = 0
  1000.657 (   0.002 ms): close(fd: 2                   ) = 0
  1000.667 (   0.000 ms): exit_group(                   )
  #

After:

  # perf trace sleep 1
  <SNIP>
     0.336 (   0.001 ms): close(fd: 3                   ) = 0
     0.373 (1000.086 ms): nanosleep(rqtp: 0x7ffe303e9550) = 0
  1000.481 (   0.002 ms): close(fd: 1                   ) = 0
  1000.485 (   0.001 ms): close(fd: 2                   ) = 0
  1000.494 (   0.000 ms): exit_group(                   )
[root@jouet linux]#

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-ecbzgmu2ni6glc6zkw8p1zmx@git.kernel.org
Fixes: 752fde44fd1c ("perf trace: Support interrupted syscalls")
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 tools/perf/builtin-trace.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1452,7 +1452,7 @@ static int trace__printf_interrupted_ent
 
 	duration = sample->time - ttrace->entry_time;
 
-	printed  = trace__fprintf_entry_head(trace, trace->current, duration, sample->time, trace->output);
+	printed  = trace__fprintf_entry_head(trace, trace->current, duration, ttrace->entry_time, trace->output);
 	printed += fprintf(trace->output, "%-70s) ...\n", ttrace->entry_str);
 	ttrace->entry_pending = false;
 
@@ -1499,7 +1499,7 @@ static int trace__sys_enter(struct trace
 
 	if (sc->is_exit) {
 		if (!(trace->duration_filter || trace->summary_only || trace->min_stack)) {
-			trace__fprintf_entry_head(trace, thread, 1, sample->time, trace->output);
+			trace__fprintf_entry_head(trace, thread, 1, ttrace->entry_time, trace->output);
 			fprintf(trace->output, "%-70s)\n", ttrace->entry_str);
 		}
 	} else {
@@ -1592,7 +1592,7 @@ static int trace__sys_exit(struct trace
 	if (trace->summary_only)
 		goto out;
 
-	trace__fprintf_entry_head(trace, thread, duration, sample->time, trace->output);
+	trace__fprintf_entry_head(trace, thread, duration, ttrace->entry_time, trace->output);
 
 	if (ttrace->entry_pending) {
 		fprintf(trace->output, "%-70s", ttrace->entry_str);

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 016/130] perf mem: Fix --all-user/--all-kernel options
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (14 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 015/130] perf trace: Use the syscall raw_syscalls:sys_enter timestamp Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 017/130] perf trace: Check if MAP_32BIT is defined (again) Greg Kroah-Hartman
                     ` (110 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jiri Olsa, David Ahern, Namhyung Kim,
	Peter Zijlstra, Arnaldo Carvalho de Melo

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

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

From: Jiri Olsa <jolsa@kernel.org>

commit 631ac41b46d293fb3ee43a809776c1663de8d9c6 upstream.

Removing extra '--' prefix.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Fixes: ad16511b0e40 ("perf mem: Add -U/-K (--all-user/--all-kernel) options")
Link: http://lkml.kernel.org/r/1481538943-21874-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 tools/perf/builtin-mem.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/tools/perf/builtin-mem.c
+++ b/tools/perf/builtin-mem.c
@@ -70,8 +70,8 @@ static int __cmd_record(int argc, const
 	OPT_UINTEGER(0, "ldlat", &perf_mem_events__loads_ldlat, "mem-loads latency"),
 	OPT_INCR('v', "verbose", &verbose,
 		 "be more verbose (show counter open errors, etc)"),
-	OPT_BOOLEAN('U', "--all-user", &all_user, "collect only user level data"),
-	OPT_BOOLEAN('K', "--all-kernel", &all_kernel, "collect only kernel level data"),
+	OPT_BOOLEAN('U', "all-user", &all_user, "collect only user level data"),
+	OPT_BOOLEAN('K', "all-kernel", &all_kernel, "collect only kernel level data"),
 	OPT_END()
 	};
 

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 017/130] perf trace: Check if MAP_32BIT is defined (again)
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (15 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 016/130] perf mem: Fix --all-user/--all-kernel options Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 018/130] perf diff: Do not overwrite valid build id Greg Kroah-Hartman
                     ` (109 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jiri Olsa, David Ahern,
	Kyle McMartin, Namhyung Kim, Peter Zijlstra,
	Arnaldo Carvalho de Melo

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

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

From: Jiri Olsa <jolsa@kernel.org>

commit 2bd42f3aaa53ebe78b9be6f898b7945dd61f9773 upstream.

There might be systems where MAP_32BIT is not defined, like some some
RHEL7 powerpc versions.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Kyle McMartin <kyle@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Fixes: 256763b01741 ("perf trace beauty mmap: Add more conditional defines")
Link: http://lkml.kernel.org/r/1481831814-23683-1-git-send-email-jolsa@kernel.org
[ Changed the Fixme cset to the one removing the conditional switch case for MAP_32BIT ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 tools/perf/trace/beauty/mmap.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/tools/perf/trace/beauty/mmap.c
+++ b/tools/perf/trace/beauty/mmap.c
@@ -42,7 +42,9 @@ static size_t syscall_arg__scnprintf_mma
 
 	P_MMAP_FLAG(SHARED);
 	P_MMAP_FLAG(PRIVATE);
+#ifdef MAP_32BIT
 	P_MMAP_FLAG(32BIT);
+#endif
 	P_MMAP_FLAG(ANONYMOUS);
 	P_MMAP_FLAG(DENYWRITE);
 	P_MMAP_FLAG(EXECUTABLE);

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 018/130] perf diff: Do not overwrite valid build id
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (16 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 017/130] perf trace: Check if MAP_32BIT is defined (again) Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 019/130] perf callchain: Fixup help/config for no-unwinding Greg Kroah-Hartman
                     ` (108 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Kan Liang, Andi Kleen, Dima Kogan,
	Jiri Olsa, Namhyung Kim, Arnaldo Carvalho de Melo

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

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

From: Kan Liang <kan.liang@intel.com>

commit ed6c166cc7dc329736cace3affd2df984fb22ec8 upstream.

Fixes a perf diff regression issue which was introduced by commit
5baecbcd9c9a ("perf symbols: we can now read separate debug-info files
based on a build ID")

The binary name could be same when perf diff different binaries. Build
id is used to distinguish between them.
However, the previous patch assumes the same binary name has same build
id. So it overwrites the build id according to the binary name,
regardless of whether the build id is set or not.

Check the has_build_id in dso__load. If the build id is already set, use
it.

Before the fix:

  $ perf diff 1.perf.data 2.perf.data
  # Event 'cycles'
  #
  # Baseline    Delta  Shared Object     Symbol
  # ........  .......  ................  .............................
  #
    99.83%  -99.80%  tchain_edit       [.] f2
     0.12%  +99.81%  tchain_edit       [.] f3
     0.02%   -0.01%  [ixgbe]           [k] ixgbe_read_reg

  After the fix:
  $ perf diff 1.perf.data 2.perf.data
  # Event 'cycles'
  #
  # Baseline    Delta  Shared Object     Symbol
  # ........  .......  ................  .............................
  #
    99.83%   +0.10%  tchain_edit       [.] f3
     0.12%   -0.08%  tchain_edit       [.] f2

Signed-off-by: Kan Liang <kan.liang@intel.com>
Cc: Andi Kleen <andi@firstfloor.org>
CC: Dima Kogan <dima@secretsauce.net>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Fixes: 5baecbcd9c9a ("perf symbols: we can now read separate debug-info files based on a build ID")
Link: http://lkml.kernel.org/r/1481642984-13593-1-git-send-email-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 tools/perf/util/symbol.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1459,7 +1459,8 @@ int dso__load(struct dso *dso, struct ma
 	 * Read the build id if possible. This is required for
 	 * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work
 	 */
-	if (is_regular_file(dso->long_name) &&
+	if (!dso->has_build_id &&
+	    is_regular_file(dso->long_name) &&
 	    filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0)
 		dso__set_build_id(dso, build_id);
 

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 019/130] perf callchain: Fixup help/config for no-unwinding
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (17 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 018/130] perf diff: Do not overwrite valid build id Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 020/130] perf scripting: Avoid leaking the scripting_context variable Greg Kroah-Hartman
                     ` (107 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Rabin Vincent, He Kuang,
	Arnaldo Carvalho de Melo

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

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

From: Rabin Vincent <rabinv@axis.com>

commit c56cb33b56c13493eeb95612f80e4dd6e35cd109 upstream.

Since 841e3558b2d ("perf callchain: Recording 'dwarf' callchains do not
need DWARF unwinding support"), --call-graph dwarf is allowed in 'perf
record' even without unwind support.  A couple of other places don't
reflect this yet though: the help text should list dwarf as a valid
record mode and the dump_size config should be respected too.

Signed-off-by: Rabin Vincent <rabinv@axis.com>
Cc: He Kuang <hekuang@huawei.com>
Fixes: 841e3558b2de ("perf callchain: Recording 'dwarf' callchains do not need DWARF unwinding support")
Link: http://lkml.kernel.org/r/1470837148-7642-1-git-send-email-rabin.vincent@axis.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 tools/perf/util/callchain.c |    2 --
 tools/perf/util/callchain.h |    4 ----
 2 files changed, 6 deletions(-)

--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -193,7 +193,6 @@ int perf_callchain_config(const char *va
 
 	if (!strcmp(var, "record-mode"))
 		return parse_callchain_record_opt(value, &callchain_param);
-#ifdef HAVE_DWARF_UNWIND_SUPPORT
 	if (!strcmp(var, "dump-size")) {
 		unsigned long size = 0;
 		int ret;
@@ -203,7 +202,6 @@ int perf_callchain_config(const char *va
 
 		return ret;
 	}
-#endif
 	if (!strcmp(var, "print-type"))
 		return parse_callchain_mode(value);
 	if (!strcmp(var, "order"))
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -11,11 +11,7 @@
 
 #define CALLCHAIN_HELP "setup and enables call-graph (stack chain/backtrace):\n\n"
 
-#ifdef HAVE_DWARF_UNWIND_SUPPORT
 # define RECORD_MODE_HELP  HELP_PAD "record_mode:\tcall graph recording mode (fp|dwarf|lbr)\n"
-#else
-# define RECORD_MODE_HELP  HELP_PAD "record_mode:\tcall graph recording mode (fp|lbr)\n"
-#endif
 
 #define RECORD_SIZE_HELP						\
 	HELP_PAD "record_size:\tif record_mode is 'dwarf', max size of stack recording (<bytes>)\n" \

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 020/130] perf scripting: Avoid leaking the scripting_context variable
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (18 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 019/130] perf callchain: Fixup help/config for no-unwinding Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 021/130] perf jit: Enable jitdump support without dwarf Greg Kroah-Hartman
                     ` (106 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Adrian Hunter, David Ahern,
	Frederic Weisbecker, Jiri Olsa, Namhyung Kim, Tom Zanussi,
	Wang Nan, Arnaldo Carvalho de Melo

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

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

From: Arnaldo Carvalho de Melo <acme@redhat.com>

commit cf346d5bd4b9d61656df2f72565c9b354ef3ca0d upstream.

Both register_perl_scripting() and register_python_scripting() allocate
this variable, fix it by checking if it already was.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Tom Zanussi <tzanussi@gmail.com>
Cc: Wang Nan <wangnan0@huawei.com>
Fixes: 7e4b21b84c43 ("perf/scripts: Add Python scripting engine")
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 tools/perf/util/trace-event-scripting.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/tools/perf/util/trace-event-scripting.c
+++ b/tools/perf/util/trace-event-scripting.c
@@ -95,7 +95,8 @@ static void register_python_scripting(st
 	if (err)
 		die("error registering py script extension");
 
-	scripting_context = malloc(sizeof(struct scripting_context));
+	if (scripting_context == NULL)
+		scripting_context = malloc(sizeof(*scripting_context));
 }
 
 #ifdef NO_LIBPYTHON
@@ -159,7 +160,8 @@ static void register_perl_scripting(stru
 	if (err)
 		die("error registering pl script extension");
 
-	scripting_context = malloc(sizeof(struct scripting_context));
+	if (scripting_context == NULL)
+		scripting_context = malloc(sizeof(*scripting_context));
 }
 
 #ifdef NO_LIBPERL

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 021/130] perf jit: Enable jitdump support without dwarf
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (19 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 020/130] perf scripting: Avoid leaking the scripting_context variable Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 023/130] ARM: dts: r8a7794: Use SYSC "always-on" PM Domain for sound Greg Kroah-Hartman
                     ` (105 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Maciej Debski, Stephane Eranian,
	Anton Blanchard, Jiri Olsa, Namhyung Kim, Peter Zijlstra,
	Arnaldo Carvalho de Melo

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

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

From: Maciej Debski <maciejd@google.com>

commit 621cb4e7837e39d25a5af5a785ad282cdd2b4ce8 upstream.

This patch modifies the build dependencies on the jitdump support in
perf. As it stands jitdump was wrongfully made dependent 100% on using
DWARF. However, the dwarf dependency, only exist if generating the
source line table in genelf_debug.c. The rest of the support does not
need DWARF.

This patch removes the dependency on DWARF for the entire jitdump
support. It keeps it only for the genelf_debug.c support.

Signed-off-by: Maciej Debski <maciejd@google.com>
Reviewed-by: Stephane Eranian <eranian@google.com>
Cc: Anton Blanchard <anton@ozlabs.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1476356383-30100-3-git-send-email-eranian@google.com
Fixes: e12b202f8fb9 ("perf jitdump: Build only on supported archs")
[ Make it build only if NO_LIBELF isn't defined, as jitdump.o will only be built in that case ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 tools/perf/Makefile.config |    2 +-
 tools/perf/util/Build      |    2 +-
 tools/perf/util/genelf.c   |    9 +++++++--
 tools/perf/util/genelf.h   |    2 ++
 4 files changed, 11 insertions(+), 4 deletions(-)

--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -366,7 +366,7 @@ ifndef NO_SDT
 endif
 
 ifdef PERF_HAVE_JITDUMP
-  ifndef NO_DWARF
+  ifndef NO_LIBELF
     $(call detected,CONFIG_JITDUMP)
     CFLAGS += -DHAVE_JITDUMP
   endif
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -120,7 +120,7 @@ libperf-y += demangle-rust.o
 ifdef CONFIG_JITDUMP
 libperf-$(CONFIG_LIBELF) += jitdump.o
 libperf-$(CONFIG_LIBELF) += genelf.o
-libperf-$(CONFIG_LIBELF) += genelf_debug.o
+libperf-$(CONFIG_DWARF) += genelf_debug.o
 endif
 
 CFLAGS_config.o   += -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
--- a/tools/perf/util/genelf.c
+++ b/tools/perf/util/genelf.c
@@ -19,7 +19,9 @@
 #include <limits.h>
 #include <fcntl.h>
 #include <err.h>
+#ifdef HAVE_DWARF_SUPPORT
 #include <dwarf.h>
+#endif
 
 #include "perf.h"
 #include "genelf.h"
@@ -157,7 +159,7 @@ gen_build_id(struct buildid_note *note,
 int
 jit_write_elf(int fd, uint64_t load_addr, const char *sym,
 	      const void *code, int csize,
-	      void *debug, int nr_debug_entries)
+	      void *debug __maybe_unused, int nr_debug_entries __maybe_unused)
 {
 	Elf *e;
 	Elf_Data *d;
@@ -386,11 +388,14 @@ jit_write_elf(int fd, uint64_t load_addr
 	shdr->sh_size = sizeof(bnote);
 	shdr->sh_entsize = 0;
 
+#ifdef HAVE_DWARF_SUPPORT
 	if (debug && nr_debug_entries) {
 		retval = jit_add_debug_info(e, load_addr, debug, nr_debug_entries);
 		if (retval)
 			goto error;
-	} else {
+	} else
+#endif
+	{
 		if (elf_update(e, ELF_C_WRITE) < 0) {
 			warnx("elf_update 4 failed");
 			goto error;
--- a/tools/perf/util/genelf.h
+++ b/tools/perf/util/genelf.h
@@ -4,8 +4,10 @@
 /* genelf.c */
 int jit_write_elf(int fd, uint64_t code_addr, const char *sym,
 		  const void *code, int csize, void *debug, int nr_debug_entries);
+#ifdef HAVE_DWARF_SUPPORT
 /* genelf_debug.c */
 int jit_add_debug_info(Elf *e, uint64_t code_addr, void *debug, int nr_debug_entries);
+#endif
 
 #if   defined(__arm__)
 #define GEN_ELF_ARCH	EM_ARM

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 023/130] ARM: dts: r8a7794: Use SYSC "always-on" PM Domain for sound
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (20 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 021/130] perf jit: Enable jitdump support without dwarf Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 024/130] ARM: dts: r8a7794: remove Z clock Greg Kroah-Hartman
                     ` (104 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Geert Uytterhoeven, Simon Horman

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

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

From: Geert Uytterhoeven <geert+renesas@glider.be>

commit 24b2d930a50662c11918fd0c22931f1448488da4 upstream.

Hook up the Audio-DMAC and sound device nodes to the SYSC "always-on" PM
Domain, for a more consistent device-power-area description in DT.

Cfr. commit 0761ff2ad0c581f3 ("ARM: dts: r8a7794: Add SYSC PM Domains").

Fixes: 320d6c5a08a4abd3 ("ARM: dts: r8a7794: add sound support")
Fixes: 298e4ee3d213a076 ("ARM: dts: r8a7794: add Audio-DMAC support")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/r8a7794.dtsi |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/arm/boot/dts/r8a7794.dtsi
+++ b/arch/arm/boot/dts/r8a7794.dtsi
@@ -319,7 +319,7 @@
 				  "ch12";
 		clocks = <&mstp5_clks R8A7794_CLK_AUDIO_DMAC0>;
 		clock-names = "fck";
-		power-domains = <&cpg_clocks>;
+		power-domains = <&sysc R8A7794_PD_ALWAYS_ON>;
 		#dma-cells = <1>;
 		dma-channels = <13>;
 	};
@@ -1483,7 +1483,7 @@
 			      "mix.0", "mix.1",
 			      "dvc.0", "dvc.1",
 			      "clk_a", "clk_b", "clk_c", "clk_i";
-		power-domains = <&cpg_clocks>;
+		power-domains = <&sysc R8A7794_PD_ALWAYS_ON>;
 
 		status = "disabled";
 

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 024/130] ARM: dts: r8a7794: remove Z clock
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (21 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 023/130] ARM: dts: r8a7794: Use SYSC "always-on" PM Domain for sound Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 025/130] ARM: dts: imx6q-cm-fx6: fix fec pinctrl Greg Kroah-Hartman
                     ` (103 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Sergei Shtylyov, Geert Uytterhoeven,
	Simon Horman

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

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

From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

commit 68cc085a4daaa32f7138de1e918331c05165a484 upstream.

R8A7794 doesn't have Cortex-A15 CPUs, thus there's no Z clock...

Fixes: 0dce5454d5c2 ("ARM: shmobile: Initial r8a7794 SoC device tree")
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/r8a7794.dtsi            |    3 +--
 include/dt-bindings/clock/r8a7794-clock.h |    3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

--- a/arch/arm/boot/dts/r8a7794.dtsi
+++ b/arch/arm/boot/dts/r8a7794.dtsi
@@ -1025,8 +1025,7 @@
 			clocks = <&extal_clk &usb_extal_clk>;
 			#clock-cells = <1>;
 			clock-output-names = "main", "pll0", "pll1", "pll3",
-					     "lb", "qspi", "sdh", "sd0", "z",
-					     "rcan";
+					     "lb", "qspi", "sdh", "sd0", "rcan";
 			#power-domain-cells = <0>;
 		};
 		/* Variable factor clocks */
--- a/include/dt-bindings/clock/r8a7794-clock.h
+++ b/include/dt-bindings/clock/r8a7794-clock.h
@@ -20,8 +20,7 @@
 #define R8A7794_CLK_QSPI		5
 #define R8A7794_CLK_SDH			6
 #define R8A7794_CLK_SD0			7
-#define R8A7794_CLK_Z			8
-#define R8A7794_CLK_RCAN		9
+#define R8A7794_CLK_RCAN		8
 
 /* MSTP0 */
 #define R8A7794_CLK_MSIOF0		0

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 025/130] ARM: dts: imx6q-cm-fx6: fix fec pinctrl
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (22 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 024/130] ARM: dts: r8a7794: remove Z clock Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 026/130] ARM: dts: imx31: fix clock control module interrupts description Greg Kroah-Hartman
                     ` (102 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Christopher Spinrath, Shawn Guo

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

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

From: Christopher Spinrath <christopher.spinrath@rwth-aachen.de>

commit 72649a46067903d00f46e2ebef6543768224f1a0 upstream.

According to the schematics of CompuLab's sbc-fx6 baseboard and the
vendor devicetree GPIO_16 is *not* muxed to ENET_REF_CLK but to SPDIF_IN.

Remove the wrong pinctrl setting.

Fixes: 682d055e6ac5 ("ARM: dts: Add initial support for cm-fx6.")
Signed-off-by: Christopher Spinrath <christopher.spinrath@rwth-aachen.de>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/imx6q-cm-fx6.dts |    1 -
 1 file changed, 1 deletion(-)

--- a/arch/arm/boot/dts/imx6q-cm-fx6.dts
+++ b/arch/arm/boot/dts/imx6q-cm-fx6.dts
@@ -183,7 +183,6 @@
 			MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK	0x1b0b0
 			MX6QDL_PAD_ENET_MDIO__ENET_MDIO		0x1b0b0
 			MX6QDL_PAD_ENET_MDC__ENET_MDC		0x1b0b0
-			MX6QDL_PAD_GPIO_16__ENET_REF_CLK	0x4001b0a8
 		>;
 	};
 

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 026/130] ARM: dts: imx31: fix clock control module interrupts description
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (23 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 025/130] ARM: dts: imx6q-cm-fx6: fix fec pinctrl Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 028/130] ARM: dts: imx31: fix AVIC base address Greg Kroah-Hartman
                     ` (101 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Rob Herring, Vladimir Zapolskiy, Shawn Guo

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

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

From: Vladimir Zapolskiy <vz@mleia.com>

commit 2e575cbc930901718cc18e084566ecbb9a4b5ebb upstream.

The type of AVIC interrupt controller found on i.MX31 is one-cell,
namely 31 for CCM DVFS and 53 for CCM, however for clock control
module its interrupts are specified as 3-cells, fix it.

Fixes: ef0e4a606fb6 ("ARM: mx31: Replace clk_register_clkdev with clock DT lookup")
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 Documentation/devicetree/bindings/clock/imx31-clock.txt |    2 +-
 arch/arm/boot/dts/imx31.dtsi                            |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--- a/Documentation/devicetree/bindings/clock/imx31-clock.txt
+++ b/Documentation/devicetree/bindings/clock/imx31-clock.txt
@@ -77,7 +77,7 @@ Examples:
 clks: ccm@53f80000{
 	compatible = "fsl,imx31-ccm";
 	reg = <0x53f80000 0x4000>;
-	interrupts = <0 31 0x04 0 53 0x04>;
+	interrupts = <31>, <53>;
 	#clock-cells = <1>;
 };
 
--- a/arch/arm/boot/dts/imx31.dtsi
+++ b/arch/arm/boot/dts/imx31.dtsi
@@ -122,7 +122,7 @@
 			clks: ccm@53f80000{
 				compatible = "fsl,imx31-ccm";
 				reg = <0x53f80000 0x4000>;
-				interrupts = <0 31 0x04 0 53 0x04>;
+				interrupts = <31>, <53>;
 				#clock-cells = <1>;
 			};
 		};

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 028/130] ARM: dts: imx31: fix AVIC base address
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (24 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 026/130] ARM: dts: imx31: fix clock control module interrupts description Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 029/130] ARM: dts: omap3: Add DTS for Logic PD SOM-LV 37xx Dev Kit Greg Kroah-Hartman
                     ` (100 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Vladimir Zapolskiy, Fabio Estevam, Shawn Guo

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

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

From: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>

commit af92305e567b7f4c9cf48b9e46c1f48ec9ffb1fb upstream.

On i.MX31 AVIC interrupt controller base address is at 0x68000000.

The problem was shadowed by the AVIC driver, which takes the correct
base address from a SoC specific header file.

Fixes: d2a37b3d91f4 ("ARM i.MX31: Add devicetree support")
Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/imx31.dtsi |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/arm/boot/dts/imx31.dtsi
+++ b/arch/arm/boot/dts/imx31.dtsi
@@ -30,11 +30,11 @@
 		};
 	};
 
-	avic: avic-interrupt-controller@60000000 {
+	avic: interrupt-controller@68000000 {
 		compatible = "fsl,imx31-avic", "fsl,avic";
 		interrupt-controller;
 		#interrupt-cells = <1>;
-		reg = <0x60000000 0x100000>;
+		reg = <0x68000000 0x100000>;
 	};
 
 	soc {

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 029/130] ARM: dts: omap3: Add DTS for Logic PD SOM-LV 37xx Dev Kit
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (25 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 028/130] ARM: dts: imx31: fix AVIC base address Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 030/130] tmpfs: clear S_ISGID when setting posix ACLs Greg Kroah-Hartman
                     ` (99 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Javier Martinez Canillas, Adam Ford,
	Tony Lindgren

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

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

From: Adam Ford <aford173@gmail.com>

commit 7245f67f86e847769f41dacad26bb8f5b5d74bf4 upstream.

Fixes: ("ab8dd3aed011 ARM: DTS: Add minimal Support for Logic PD
DM3730 SOM-LV")

This adds the dts file into the Makefile. This should have been included in
the original patch.

V2:  Update patch description - same source code
V1:  Original patch

Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Adam Ford <aford173@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/Makefile |    1 +
 1 file changed, 1 insertion(+)

--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -485,6 +485,7 @@ dtb-$(CONFIG_ARCH_OMAP3) += \
 	am3517-evm.dtb \
 	am3517_mt_ventoux.dtb \
 	logicpd-torpedo-37xx-devkit.dtb \
+	logicpd-som-lv-37xx-devkit.dtb \
 	omap3430-sdp.dtb \
 	omap3-beagle.dtb \
 	omap3-beagle-xm.dtb \

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 030/130] tmpfs: clear S_ISGID when setting posix ACLs
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (26 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 029/130] ARM: dts: omap3: Add DTS for Logic PD SOM-LV 37xx Dev Kit Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 031/130] x86/PCI: Ignore _CRS on Supermicro X8DTH-i/6/iF/6F Greg Kroah-Hartman
                     ` (98 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Gu Zheng, Al Viro, Brad Spengler

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

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

From: Gu Zheng <guzheng1@huawei.com>

commit 497de07d89c1410d76a15bec2bb41f24a2a89f31 upstream.

This change was missed the tmpfs modification in In CVE-2016-7097
commit 073931017b49 ("posix_acl: Clear SGID bit when setting
file permissions")
It can test by xfstest generic/375, which failed to clear
setgid bit in the following test case on tmpfs:

  touch $testfile
  chown 100:100 $testfile
  chmod 2755 $testfile
  _runas -u 100 -g 101 -- setfacl -m u::rwx,g::rwx,o::rwx $testfile

Signed-off-by: Gu Zheng <guzheng1@huawei.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: Brad Spengler <spender@grsecurity.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/posix_acl.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -922,11 +922,10 @@ int simple_set_acl(struct inode *inode,
 	int error;
 
 	if (type == ACL_TYPE_ACCESS) {
-		error = posix_acl_equiv_mode(acl, &inode->i_mode);
-		if (error < 0)
-			return 0;
-		if (error == 0)
-			acl = NULL;
+		error = posix_acl_update_mode(inode,
+				&inode->i_mode, &acl);
+		if (error)
+			return error;
 	}
 
 	inode->i_ctime = current_time(inode);

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 031/130] x86/PCI: Ignore _CRS on Supermicro X8DTH-i/6/iF/6F
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (27 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 030/130] tmpfs: clear S_ISGID when setting posix ACLs Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 032/130] rcu: Remove cond_resched() from Tiny synchronize_sched() Greg Kroah-Hartman
                     ` (97 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Martin Burnicki, Bjorn Helgaas

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

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

From: Bjorn Helgaas <bhelgaas@google.com>

commit 89e9f7bcd8744ea25fcf0ac671b8d72c10d7d790 upstream.

Martin reported that the Supermicro X8DTH-i/6/iF/6F advertises incorrect
host bridge windows via _CRS:

  pci_root PNP0A08:00: host bridge window [io  0xf000-0xffff]
  pci_root PNP0A08:01: host bridge window [io  0xf000-0xffff]

Both bridges advertise the 0xf000-0xffff window, which cannot be correct.

Work around this by ignoring _CRS on this system.  The downside is that we
may not assign resources correctly to hot-added PCI devices (if they are
possible on this system).

Link: https://bugzilla.kernel.org/show_bug.cgi?id=42606
Reported-by: Martin Burnicki <martin.burnicki@meinberg.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/pci/acpi.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -114,6 +114,16 @@ static const struct dmi_system_id pci_cr
 			DMI_MATCH(DMI_BIOS_VERSION, "6JET85WW (1.43 )"),
 		},
 	},
+	/* https://bugzilla.kernel.org/show_bug.cgi?id=42606 */
+	{
+		.callback = set_nouse_crs,
+		.ident = "Supermicro X8DTH",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Supermicro"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "X8DTH-i/6/iF/6F"),
+			DMI_MATCH(DMI_BIOS_VERSION, "2.0a"),
+		},
+	},
 
 	/* https://bugzilla.kernel.org/show_bug.cgi?id=15362 */
 	{

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 032/130] rcu: Remove cond_resched() from Tiny synchronize_sched()
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (28 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 031/130] x86/PCI: Ignore _CRS on Supermicro X8DTH-i/6/iF/6F Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 033/130] rcu: Narrow early boot window of illegal synchronous grace periods Greg Kroah-Hartman
                     ` (96 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Paul E. McKenney

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

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

From: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

commit f466ae66fa6a599f9a53b5f9bafea4b8cfffa7fb upstream.

It is now legal to invoke synchronize_sched() at early boot, which causes
Tiny RCU's synchronize_sched() to emit spurious splats.  This commit
therefore removes the cond_resched() from Tiny RCU's synchronize_sched().

Fixes: 8b355e3bc140 ("rcu: Drive expedited grace periods from workqueue")
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 kernel/rcu/tiny.c |    4 ----
 1 file changed, 4 deletions(-)

--- a/kernel/rcu/tiny.c
+++ b/kernel/rcu/tiny.c
@@ -185,9 +185,6 @@ static __latent_entropy void rcu_process
  * benefits of doing might_sleep() to reduce latency.)
  *
  * Cool, huh?  (Due to Josh Triplett.)
- *
- * But we want to make this a static inline later.  The cond_resched()
- * currently makes this problematic.
  */
 void synchronize_sched(void)
 {
@@ -195,7 +192,6 @@ void synchronize_sched(void)
 			 lock_is_held(&rcu_lock_map) ||
 			 lock_is_held(&rcu_sched_lock_map),
 			 "Illegal synchronize_sched() in RCU read-side critical section");
-	cond_resched();
 }
 EXPORT_SYMBOL_GPL(synchronize_sched);
 

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 033/130] rcu: Narrow early boot window of illegal synchronous grace periods
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (29 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 032/130] rcu: Remove cond_resched() from Tiny synchronize_sched() Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 034/130] sunrpc: dont call sleeping functions from the notifier block callbacks Greg Kroah-Hartman
                     ` (95 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Zheng, Lv, Borislav Petkov,
	Paul E. McKenney, Stan Kain, Ivan, Emanuel Castelo,
	Bruno Pesavento, Borislav Petkov, Frederic Bezies

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

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

From: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

commit 52d7e48b86fc108e45a656d8e53e4237993c481d upstream.

The current preemptible RCU implementation goes through three phases
during bootup.  In the first phase, there is only one CPU that is running
with preemption disabled, so that a no-op is a synchronous grace period.
In the second mid-boot phase, the scheduler is running, but RCU has
not yet gotten its kthreads spawned (and, for expedited grace periods,
workqueues are not yet running.  During this time, any attempt to do
a synchronous grace period will hang the system (or complain bitterly,
depending).  In the third and final phase, RCU is fully operational and
everything works normally.

This has been OK for some time, but there has recently been some
synchronous grace periods showing up during the second mid-boot phase.
This code worked "by accident" for awhile, but started failing as soon
as expedited RCU grace periods switched over to workqueues in commit
8b355e3bc140 ("rcu: Drive expedited grace periods from workqueue").
Note that the code was buggy even before this commit, as it was subject
to failure on real-time systems that forced all expedited grace periods
to run as normal grace periods (for example, using the rcu_normal ksysfs
parameter).  The callchain from the failure case is as follows:

early_amd_iommu_init()
|-> acpi_put_table(ivrs_base);
|-> acpi_tb_put_table(table_desc);
|-> acpi_tb_invalidate_table(table_desc);
|-> acpi_tb_release_table(...)
|-> acpi_os_unmap_memory
|-> acpi_os_unmap_iomem
|-> acpi_os_map_cleanup
|-> synchronize_rcu_expedited

The kernel showing this callchain was built with CONFIG_PREEMPT_RCU=y,
which caused the code to try using workqueues before they were
initialized, which did not go well.

This commit therefore reworks RCU to permit synchronous grace periods
to proceed during this mid-boot phase.  This commit is therefore a
fix to a regression introduced in v4.9, and is therefore being put
forward post-merge-window in v4.10.

This commit sets a flag from the existing rcu_scheduler_starting()
function which causes all synchronous grace periods to take the expedited
path.  The expedited path now checks this flag, using the requesting task
to drive the expedited grace period forward during the mid-boot phase.
Finally, this flag is updated by a core_initcall() function named
rcu_exp_runtime_mode(), which causes the runtime codepaths to be used.

Note that this arrangement assumes that tasks are not sent POSIX signals
(or anything similar) from the time that the first task is spawned
through core_initcall() time.

Fixes: 8b355e3bc140 ("rcu: Drive expedited grace periods from workqueue")
Reported-by: "Zheng, Lv" <lv.zheng@intel.com>
Reported-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Tested-by: Stan Kain <stan.kain@gmail.com>
Tested-by: Ivan <waffolz@hotmail.com>
Tested-by: Emanuel Castelo <emanuel.castelo@gmail.com>
Tested-by: Bruno Pesavento <bpesavento@infinito.it>
Tested-by: Borislav Petkov <bp@suse.de>
Tested-by: Frederic Bezies <fredbezies@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 include/linux/rcupdate.h |    4 +++
 kernel/rcu/rcu.h         |    1 
 kernel/rcu/tiny_plugin.h |    9 ++++++--
 kernel/rcu/tree.c        |   33 ++++++++++++++++++-----------
 kernel/rcu/tree_exp.h    |   52 +++++++++++++++++++++++++++++++++++++----------
 kernel/rcu/tree_plugin.h |    2 -
 kernel/rcu/update.c      |   38 +++++++++++++++++++++++++++-------
 7 files changed, 104 insertions(+), 35 deletions(-)

--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -444,6 +444,10 @@ bool __rcu_is_watching(void);
 #error "Unknown RCU implementation specified to kernel configuration"
 #endif
 
+#define RCU_SCHEDULER_INACTIVE	0
+#define RCU_SCHEDULER_INIT	1
+#define RCU_SCHEDULER_RUNNING	2
+
 /*
  * init_rcu_head_on_stack()/destroy_rcu_head_on_stack() are needed for dynamic
  * initialization and destruction of rcu_head on the stack. rcu_head structures
--- a/kernel/rcu/rcu.h
+++ b/kernel/rcu/rcu.h
@@ -136,6 +136,7 @@ int rcu_jiffies_till_stall_check(void);
 #define TPS(x)  tracepoint_string(x)
 
 void rcu_early_boot_tests(void);
+void rcu_test_sync_prims(void);
 
 /*
  * This function really isn't for public consumption, but RCU is special in
--- a/kernel/rcu/tiny_plugin.h
+++ b/kernel/rcu/tiny_plugin.h
@@ -60,12 +60,17 @@ EXPORT_SYMBOL_GPL(rcu_scheduler_active);
 
 /*
  * During boot, we forgive RCU lockdep issues.  After this function is
- * invoked, we start taking RCU lockdep issues seriously.
+ * invoked, we start taking RCU lockdep issues seriously.  Note that unlike
+ * Tree RCU, Tiny RCU transitions directly from RCU_SCHEDULER_INACTIVE
+ * to RCU_SCHEDULER_RUNNING, skipping the RCU_SCHEDULER_INIT stage.
+ * The reason for this is that Tiny RCU does not need kthreads, so does
+ * not have to care about the fact that the scheduler is half-initialized
+ * at a certain phase of the boot process.
  */
 void __init rcu_scheduler_starting(void)
 {
 	WARN_ON(nr_context_switches() > 0);
-	rcu_scheduler_active = 1;
+	rcu_scheduler_active = RCU_SCHEDULER_RUNNING;
 }
 
 #endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -127,13 +127,16 @@ int rcu_num_nodes __read_mostly = NUM_RC
 int sysctl_panic_on_rcu_stall __read_mostly;
 
 /*
- * The rcu_scheduler_active variable transitions from zero to one just
- * before the first task is spawned.  So when this variable is zero, RCU
- * can assume that there is but one task, allowing RCU to (for example)
+ * The rcu_scheduler_active variable is initialized to the value
+ * RCU_SCHEDULER_INACTIVE and transitions RCU_SCHEDULER_INIT just before the
+ * first task is spawned.  So when this variable is RCU_SCHEDULER_INACTIVE,
+ * RCU can assume that there is but one task, allowing RCU to (for example)
  * optimize synchronize_rcu() to a simple barrier().  When this variable
- * is one, RCU must actually do all the hard work required to detect real
- * grace periods.  This variable is also used to suppress boot-time false
- * positives from lockdep-RCU error checking.
+ * is RCU_SCHEDULER_INIT, RCU must actually do all the hard work required
+ * to detect real grace periods.  This variable is also used to suppress
+ * boot-time false positives from lockdep-RCU error checking.  Finally, it
+ * transitions from RCU_SCHEDULER_INIT to RCU_SCHEDULER_RUNNING after RCU
+ * is fully initialized, including all of its kthreads having been spawned.
  */
 int rcu_scheduler_active __read_mostly;
 EXPORT_SYMBOL_GPL(rcu_scheduler_active);
@@ -3985,18 +3988,22 @@ static int __init rcu_spawn_gp_kthread(v
 early_initcall(rcu_spawn_gp_kthread);
 
 /*
- * This function is invoked towards the end of the scheduler's initialization
- * process.  Before this is called, the idle task might contain
- * RCU read-side critical sections (during which time, this idle
- * task is booting the system).  After this function is called, the
- * idle tasks are prohibited from containing RCU read-side critical
- * sections.  This function also enables RCU lockdep checking.
+ * This function is invoked towards the end of the scheduler's
+ * initialization process.  Before this is called, the idle task might
+ * contain synchronous grace-period primitives (during which time, this idle
+ * task is booting the system, and such primitives are no-ops).  After this
+ * function is called, any synchronous grace-period primitives are run as
+ * expedited, with the requesting task driving the grace period forward.
+ * A later core_initcall() rcu_exp_runtime_mode() will switch to full
+ * runtime RCU functionality.
  */
 void rcu_scheduler_starting(void)
 {
 	WARN_ON(num_online_cpus() != 1);
 	WARN_ON(nr_context_switches() > 0);
-	rcu_scheduler_active = 1;
+	rcu_test_sync_prims();
+	rcu_scheduler_active = RCU_SCHEDULER_INIT;
+	rcu_test_sync_prims();
 }
 
 /*
--- a/kernel/rcu/tree_exp.h
+++ b/kernel/rcu/tree_exp.h
@@ -522,18 +522,28 @@ struct rcu_exp_work {
 };
 
 /*
+ * Common code to drive an expedited grace period forward, used by
+ * workqueues and mid-boot-time tasks.
+ */
+static void rcu_exp_sel_wait_wake(struct rcu_state *rsp,
+				  smp_call_func_t func, unsigned long s)
+{
+	/* Initialize the rcu_node tree in preparation for the wait. */
+	sync_rcu_exp_select_cpus(rsp, func);
+
+	/* Wait and clean up, including waking everyone. */
+	rcu_exp_wait_wake(rsp, s);
+}
+
+/*
  * Work-queue handler to drive an expedited grace period forward.
  */
 static void wait_rcu_exp_gp(struct work_struct *wp)
 {
 	struct rcu_exp_work *rewp;
 
-	/* Initialize the rcu_node tree in preparation for the wait. */
 	rewp = container_of(wp, struct rcu_exp_work, rew_work);
-	sync_rcu_exp_select_cpus(rewp->rew_rsp, rewp->rew_func);
-
-	/* Wait and clean up, including waking everyone. */
-	rcu_exp_wait_wake(rewp->rew_rsp, rewp->rew_s);
+	rcu_exp_sel_wait_wake(rewp->rew_rsp, rewp->rew_func, rewp->rew_s);
 }
 
 /*
@@ -559,12 +569,18 @@ static void _synchronize_rcu_expedited(s
 	if (exp_funnel_lock(rsp, s))
 		return;  /* Someone else did our work for us. */
 
-	/* Marshall arguments and schedule the expedited grace period. */
-	rew.rew_func = func;
-	rew.rew_rsp = rsp;
-	rew.rew_s = s;
-	INIT_WORK_ONSTACK(&rew.rew_work, wait_rcu_exp_gp);
-	schedule_work(&rew.rew_work);
+	/* Ensure that load happens before action based on it. */
+	if (unlikely(rcu_scheduler_active == RCU_SCHEDULER_INIT)) {
+		/* Direct call during scheduler init and early_initcalls(). */
+		rcu_exp_sel_wait_wake(rsp, func, s);
+	} else {
+		/* Marshall arguments & schedule the expedited grace period. */
+		rew.rew_func = func;
+		rew.rew_rsp = rsp;
+		rew.rew_s = s;
+		INIT_WORK_ONSTACK(&rew.rew_work, wait_rcu_exp_gp);
+		schedule_work(&rew.rew_work);
+	}
 
 	/* Wait for expedited grace period to complete. */
 	rdp = per_cpu_ptr(rsp->rda, raw_smp_processor_id());
@@ -666,6 +682,8 @@ void synchronize_rcu_expedited(void)
 {
 	struct rcu_state *rsp = rcu_state_p;
 
+	if (rcu_scheduler_active == RCU_SCHEDULER_INACTIVE)
+		return;
 	_synchronize_rcu_expedited(rsp, sync_rcu_exp_handler);
 }
 EXPORT_SYMBOL_GPL(synchronize_rcu_expedited);
@@ -683,3 +701,15 @@ void synchronize_rcu_expedited(void)
 EXPORT_SYMBOL_GPL(synchronize_rcu_expedited);
 
 #endif /* #else #ifdef CONFIG_PREEMPT_RCU */
+
+/*
+ * Switch to run-time mode once Tree RCU has fully initialized.
+ */
+static int __init rcu_exp_runtime_mode(void)
+{
+	rcu_test_sync_prims();
+	rcu_scheduler_active = RCU_SCHEDULER_RUNNING;
+	rcu_test_sync_prims();
+	return 0;
+}
+core_initcall(rcu_exp_runtime_mode);
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -670,7 +670,7 @@ void synchronize_rcu(void)
 			 lock_is_held(&rcu_lock_map) ||
 			 lock_is_held(&rcu_sched_lock_map),
 			 "Illegal synchronize_rcu() in RCU read-side critical section");
-	if (!rcu_scheduler_active)
+	if (rcu_scheduler_active == RCU_SCHEDULER_INACTIVE)
 		return;
 	if (rcu_gp_is_expedited())
 		synchronize_rcu_expedited();
--- a/kernel/rcu/update.c
+++ b/kernel/rcu/update.c
@@ -121,11 +121,14 @@ EXPORT_SYMBOL(rcu_read_lock_sched_held);
  * Should expedited grace-period primitives always fall back to their
  * non-expedited counterparts?  Intended for use within RCU.  Note
  * that if the user specifies both rcu_expedited and rcu_normal, then
- * rcu_normal wins.
+ * rcu_normal wins.  (Except during the time period during boot from
+ * when the first task is spawned until the rcu_exp_runtime_mode()
+ * core_initcall() is invoked, at which point everything is expedited.)
  */
 bool rcu_gp_is_normal(void)
 {
-	return READ_ONCE(rcu_normal);
+	return READ_ONCE(rcu_normal) &&
+	       rcu_scheduler_active != RCU_SCHEDULER_INIT;
 }
 EXPORT_SYMBOL_GPL(rcu_gp_is_normal);
 
@@ -135,13 +138,14 @@ static atomic_t rcu_expedited_nesting =
 /*
  * Should normal grace-period primitives be expedited?  Intended for
  * use within RCU.  Note that this function takes the rcu_expedited
- * sysfs/boot variable into account as well as the rcu_expedite_gp()
- * nesting.  So looping on rcu_unexpedite_gp() until rcu_gp_is_expedited()
- * returns false is a -really- bad idea.
+ * sysfs/boot variable and rcu_scheduler_active into account as well
+ * as the rcu_expedite_gp() nesting.  So looping on rcu_unexpedite_gp()
+ * until rcu_gp_is_expedited() returns false is a -really- bad idea.
  */
 bool rcu_gp_is_expedited(void)
 {
-	return rcu_expedited || atomic_read(&rcu_expedited_nesting);
+	return rcu_expedited || atomic_read(&rcu_expedited_nesting) ||
+	       rcu_scheduler_active == RCU_SCHEDULER_INIT;
 }
 EXPORT_SYMBOL_GPL(rcu_gp_is_expedited);
 
@@ -257,7 +261,7 @@ EXPORT_SYMBOL_GPL(rcu_callback_map);
 
 int notrace debug_lockdep_rcu_enabled(void)
 {
-	return rcu_scheduler_active && debug_locks &&
+	return rcu_scheduler_active != RCU_SCHEDULER_INACTIVE && debug_locks &&
 	       current->lockdep_recursion == 0;
 }
 EXPORT_SYMBOL_GPL(debug_lockdep_rcu_enabled);
@@ -591,7 +595,7 @@ EXPORT_SYMBOL_GPL(call_rcu_tasks);
 void synchronize_rcu_tasks(void)
 {
 	/* Complain if the scheduler has not started.  */
-	RCU_LOCKDEP_WARN(!rcu_scheduler_active,
+	RCU_LOCKDEP_WARN(rcu_scheduler_active == RCU_SCHEDULER_INACTIVE,
 			 "synchronize_rcu_tasks called too soon");
 
 	/* Wait for the grace period. */
@@ -813,6 +817,23 @@ static void rcu_spawn_tasks_kthread(void
 
 #endif /* #ifdef CONFIG_TASKS_RCU */
 
+/*
+ * Test each non-SRCU synchronous grace-period wait API.  This is
+ * useful just after a change in mode for these primitives, and
+ * during early boot.
+ */
+void rcu_test_sync_prims(void)
+{
+	if (!IS_ENABLED(CONFIG_PROVE_RCU))
+		return;
+	synchronize_rcu();
+	synchronize_rcu_bh();
+	synchronize_sched();
+	synchronize_rcu_expedited();
+	synchronize_rcu_bh_expedited();
+	synchronize_sched_expedited();
+}
+
 #ifdef CONFIG_PROVE_RCU
 
 /*
@@ -865,6 +886,7 @@ void rcu_early_boot_tests(void)
 		early_boot_test_call_rcu_bh();
 	if (rcu_self_test_sched)
 		early_boot_test_call_rcu_sched();
+	rcu_test_sync_prims();
 }
 
 static int rcu_verify_early_boot_tests(void)

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 034/130] sunrpc: dont call sleeping functions from the notifier block callbacks
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (30 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 033/130] rcu: Narrow early boot window of illegal synchronous grace periods Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 035/130] svcrpc: dont leak contexts on PROC_DESTROY Greg Kroah-Hartman
                     ` (94 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Scott Mayhew, J. Bruce Fields

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

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

From: Scott Mayhew <smayhew@redhat.com>

commit 546125d1614264d26080817d0c8cddb9b25081fa upstream.

The inet6addr_chain is an atomic notifier chain, so we can't call
anything that might sleep (like lock_sock)... instead of closing the
socket from svc_age_temp_xprts_now (which is called by the notifier
function), just have the rpc service threads do it instead.

Fixes: c3d4879e01be "sunrpc: Add a function to close..."
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 include/linux/sunrpc/svc_xprt.h |    1 +
 net/sunrpc/svc_xprt.c           |   10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -66,6 +66,7 @@ struct svc_xprt {
 #define XPT_LISTENER	10		/* listening endpoint */
 #define XPT_CACHE_AUTH	11		/* cache auth info */
 #define XPT_LOCAL	12		/* connection from loopback interface */
+#define XPT_KILL_TEMP   13		/* call xpo_kill_temp_xprt before closing */
 
 	struct svc_serv		*xpt_server;	/* service for transport */
 	atomic_t    	    	xpt_reserved;	/* space on outq that is rsvd */
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -799,6 +799,8 @@ static int svc_handle_xprt(struct svc_rq
 
 	if (test_bit(XPT_CLOSE, &xprt->xpt_flags)) {
 		dprintk("svc_recv: found XPT_CLOSE\n");
+		if (test_and_clear_bit(XPT_KILL_TEMP, &xprt->xpt_flags))
+			xprt->xpt_ops->xpo_kill_temp_xprt(xprt);
 		svc_delete_xprt(xprt);
 		/* Leave XPT_BUSY set on the dead xprt: */
 		goto out;
@@ -1020,9 +1022,11 @@ void svc_age_temp_xprts_now(struct svc_s
 		le = to_be_closed.next;
 		list_del_init(le);
 		xprt = list_entry(le, struct svc_xprt, xpt_list);
-		dprintk("svc_age_temp_xprts_now: closing %p\n", xprt);
-		xprt->xpt_ops->xpo_kill_temp_xprt(xprt);
-		svc_close_xprt(xprt);
+		set_bit(XPT_CLOSE, &xprt->xpt_flags);
+		set_bit(XPT_KILL_TEMP, &xprt->xpt_flags);
+		dprintk("svc_age_temp_xprts_now: queuing xprt %p for closing\n",
+				xprt);
+		svc_xprt_enqueue(xprt);
 	}
 }
 EXPORT_SYMBOL_GPL(svc_age_temp_xprts_now);

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 035/130] svcrpc: dont leak contexts on PROC_DESTROY
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (31 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 034/130] sunrpc: dont call sleeping functions from the notifier block callbacks Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 036/130] libnvdimm, namespace: fix pmem namespace leak, delete when size set to zero Greg Kroah-Hartman
                     ` (93 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Andy Adamson, J. Bruce Fields

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

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

From: J. Bruce Fields <bfields@redhat.com>

commit 78794d1890708cf94e3961261e52dcec2cc34722 upstream.

Context expiry times are in units of seconds since boot, not unix time.

The use of get_seconds() here therefore sets the expiry time decades in
the future.  This prevents timely freeing of contexts destroyed by
client RPC_GSS_PROC_DESTROY requests.  We'd still free them eventually
(when the module is unloaded or the container shut down), but a lot of
contexts could pile up before then.

Fixes: c5b29f885afe "sunrpc: use seconds since boot in expiry cache"
Reported-by: Andy Adamson <andros@netapp.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/sunrpc/auth_gss/svcauth_gss.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -1489,7 +1489,7 @@ svcauth_gss_accept(struct svc_rqst *rqst
 	case RPC_GSS_PROC_DESTROY:
 		if (gss_write_verf(rqstp, rsci->mechctx, gc->gc_seq))
 			goto auth_err;
-		rsci->h.expiry_time = get_seconds();
+		rsci->h.expiry_time = seconds_since_boot();
 		set_bit(CACHE_NEGATIVE, &rsci->h.flags);
 		if (resv->iov_len + 4 > PAGE_SIZE)
 			goto drop;

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 036/130] libnvdimm, namespace: fix pmem namespace leak, delete when size set to zero
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (32 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 035/130] svcrpc: dont leak contexts on PROC_DESTROY Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 037/130] ARC: module: Fix !CONFIG_ARC_DW2_UNWIND builds Greg Kroah-Hartman
                     ` (92 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Dan Williams

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

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

From: Dan Williams <dan.j.williams@intel.com>

commit 1f19b983a8877f81763fab3e693c6befe212736d upstream.

Commit 98a29c39dc68 ("libnvdimm, namespace: allow creation of multiple
pmem-namespaces per region") added support for establishing additional
pmem namespace beyond the seed device, similar to blk namespaces.
However, it neglected to delete the namespace when the size is set to
zero.

Fixes: 98a29c39dc68 ("libnvdimm, namespace: allow creation of multiple pmem-namespaces per region")
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/nvdimm/namespace_devs.c |   23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

--- a/drivers/nvdimm/namespace_devs.c
+++ b/drivers/nvdimm/namespace_devs.c
@@ -957,6 +957,7 @@ static ssize_t __size_store(struct devic
 {
 	resource_size_t allocated = 0, available = 0;
 	struct nd_region *nd_region = to_nd_region(dev->parent);
+	struct nd_namespace_common *ndns = to_ndns(dev);
 	struct nd_mapping *nd_mapping;
 	struct nvdimm_drvdata *ndd;
 	struct nd_label_id label_id;
@@ -964,7 +965,7 @@ static ssize_t __size_store(struct devic
 	u8 *uuid = NULL;
 	int rc, i;
 
-	if (dev->driver || to_ndns(dev)->claim)
+	if (dev->driver || ndns->claim)
 		return -EBUSY;
 
 	if (is_namespace_pmem(dev)) {
@@ -1034,20 +1035,16 @@ static ssize_t __size_store(struct devic
 
 		nd_namespace_pmem_set_resource(nd_region, nspm,
 				val * nd_region->ndr_mappings);
-	} else if (is_namespace_blk(dev)) {
-		struct nd_namespace_blk *nsblk = to_nd_namespace_blk(dev);
-
-		/*
-		 * Try to delete the namespace if we deleted all of its
-		 * allocation, this is not the seed device for the
-		 * region, and it is not actively claimed by a btt
-		 * instance.
-		 */
-		if (val == 0 && nd_region->ns_seed != dev
-				&& !nsblk->common.claim)
-			nd_device_unregister(dev, ND_ASYNC);
 	}
 
+	/*
+	 * Try to delete the namespace if we deleted all of its
+	 * allocation, this is not the seed device for the region, and
+	 * it is not actively claimed by a btt instance.
+	 */
+	if (val == 0 && nd_region->ns_seed != dev && !ndns->claim)
+		nd_device_unregister(dev, ND_ASYNC);
+
 	return rc;
 }
 

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 037/130] ARC: module: Fix !CONFIG_ARC_DW2_UNWIND builds
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (33 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 036/130] libnvdimm, namespace: fix pmem namespace leak, delete when size set to zero Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 038/130] fuse: clear FR_PENDING flag when moving requests out of pending queue Greg Kroah-Hartman
                     ` (91 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Waldemar Brodkorb, Anton Kolesov,
	Alexey Brodkin, Vineet Gupta

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

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

From: Vineet Gupta <vgupta@synopsys.com>

commit eb1357d942e5d96de6b4c20a8ffa55acf96233a2 upstream.

commit d65283f7b695b5 added mod->arch.secstr under
CONFIG_ARC_DW2_UNWIND, but used it unconditionally which broke builds
when the option was disabled. Fix that by adjusting the #ifdef guard.

And while at it add a missing guard (for unwinder) in module.c as well

Reported-by: Waldemar Brodkorb <wbx@openadk.org>
Fixes: d65283f7b695b5 ("ARC: module: elide loop to save reference to .eh_frame")
Tested-by: Anton Kolesov <akolesov@synopsys.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
[abrodkin: provided fixlet to Kconfig per failure in allnoconfig build]
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arc/Kconfig              |    2 +-
 arch/arc/include/asm/module.h |    4 ++--
 arch/arc/kernel/module.c      |    4 +++-
 3 files changed, 6 insertions(+), 4 deletions(-)

--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -28,7 +28,7 @@ config ARC
 	select HAVE_KPROBES
 	select HAVE_KRETPROBES
 	select HAVE_MEMBLOCK
-	select HAVE_MOD_ARCH_SPECIFIC if ARC_DW2_UNWIND
+	select HAVE_MOD_ARCH_SPECIFIC
 	select HAVE_OPROFILE
 	select HAVE_PERF_EVENTS
 	select HANDLE_DOMAIN_IRQ
--- a/arch/arc/include/asm/module.h
+++ b/arch/arc/include/asm/module.h
@@ -14,13 +14,13 @@
 
 #include <asm-generic/module.h>
 
-#ifdef CONFIG_ARC_DW2_UNWIND
 struct mod_arch_specific {
+#ifdef CONFIG_ARC_DW2_UNWIND
 	void *unw_info;
 	int unw_sec_idx;
+#endif
 	const char *secstr;
 };
-#endif
 
 #define MODULE_PROC_FAMILY "ARC700"
 
--- a/arch/arc/kernel/module.c
+++ b/arch/arc/kernel/module.c
@@ -32,8 +32,8 @@ int module_frob_arch_sections(Elf_Ehdr *
 #ifdef CONFIG_ARC_DW2_UNWIND
 	mod->arch.unw_sec_idx = 0;
 	mod->arch.unw_info = NULL;
-	mod->arch.secstr = secstr;
 #endif
+	mod->arch.secstr = secstr;
 	return 0;
 }
 
@@ -113,8 +113,10 @@ int apply_relocate_add(Elf32_Shdr *sechd
 
 	}
 
+#ifdef CONFIG_ARC_DW2_UNWIND
 	if (strcmp(module->arch.secstr+sechdrs[tgtsec].sh_name, ".eh_frame") == 0)
 		module->arch.unw_sec_idx = tgtsec;
+#endif
 
 	return 0;
 

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 038/130] fuse: clear FR_PENDING flag when moving requests out of pending queue
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (34 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 037/130] ARC: module: Fix !CONFIG_ARC_DW2_UNWIND builds Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 039/130] fuse: fix time_to_jiffies nsec sanity check Greg Kroah-Hartman
                     ` (90 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Tahsin Erdogan, Miklos Szeredi

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

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

From: Tahsin Erdogan <tahsin@google.com>

commit a8a86d78d673b1c99fe9b0064739fde9e9774184 upstream.

fuse_abort_conn() moves requests from pending list to a temporary list
before canceling them. This operation races with request_wait_answer()
which also tries to remove the request after it gets a fatal signal. It
checks FR_PENDING flag to determine whether the request is still in the
pending list.

Make fuse_abort_conn() clear FR_PENDING flag so that request_wait_answer()
does not remove the request from temporary list.

This bug causes an Oops when trying to delete an already deleted list entry
in end_requests().

Fixes: ee314a870e40 ("fuse: abort: no fc->lock needed for request ending")
Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/fuse/dev.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -2025,7 +2025,6 @@ static void end_requests(struct fuse_con
 		struct fuse_req *req;
 		req = list_entry(head->next, struct fuse_req, list);
 		req->out.h.error = -ECONNABORTED;
-		clear_bit(FR_PENDING, &req->flags);
 		clear_bit(FR_SENT, &req->flags);
 		list_del_init(&req->list);
 		request_end(fc, req);
@@ -2103,6 +2102,8 @@ void fuse_abort_conn(struct fuse_conn *f
 		spin_lock(&fiq->waitq.lock);
 		fiq->connected = 0;
 		list_splice_init(&fiq->pending, &to_end2);
+		list_for_each_entry(req, &to_end2, list)
+			clear_bit(FR_PENDING, &req->flags);
 		while (forget_pending(fiq))
 			kfree(dequeue_forget(fiq, 1, NULL));
 		wake_up_all_locked(&fiq->waitq);

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 039/130] fuse: fix time_to_jiffies nsec sanity check
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (35 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 038/130] fuse: clear FR_PENDING flag when moving requests out of pending queue Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 040/130] PCI: designware: Check for iATU unroll only on platforms that use ATU Greg Kroah-Hartman
                     ` (89 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, David Sheets, Miklos Szeredi

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

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

From: David Sheets <david.sheets@docker.com>

commit 210675270caa33253e4c33f3c5e657e7d6060812 upstream.

Commit bcb6f6d2b9c2 ("fuse: use timespec64") introduced clamped nsec values
in time_to_jiffies but used the max of nsec and NSEC_PER_SEC - 1 instead of
the min. Because of this, dentries would stay in the cache longer than
requested and go stale in scenarios that relied on their timely eviction.

Fixes: bcb6f6d2b9c2 ("fuse: use timespec64")
Signed-off-by: David Sheets <dsheets@docker.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/fuse/dir.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -68,7 +68,7 @@ static u64 time_to_jiffies(u64 sec, u32
 	if (sec || nsec) {
 		struct timespec64 ts = {
 			sec,
-			max_t(u32, nsec, NSEC_PER_SEC - 1)
+			min_t(u32, nsec, NSEC_PER_SEC - 1)
 		};
 
 		return get_jiffies_64() + timespec64_to_jiffies(&ts);

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 040/130] PCI: designware: Check for iATU unroll only on platforms that use ATU
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (36 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 039/130] fuse: fix time_to_jiffies nsec sanity check Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 041/130] PCI: Enumerate switches below PCI-to-PCIe bridges Greg Kroah-Hartman
                     ` (88 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Kishon Vijay Abraham I,
	Murali Karicheri, Bjorn Helgaas, Joao Pinto

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

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

From: Murali Karicheri <m-karicheri2@ti.com>

commit a782b5f986c3fa1cfa7f2b57941200c6a5809242 upstream.

Previously we checked for iATU unroll support by reading PCIE_ATU_VIEWPORT
even on platforms, e.g., Keystone, that do not have ATU ports.  This can
cause bad behavior such as asynchronous external aborts:

  OF: PCI:   MEM 0x60000000..0x6fffffff -> 0x60000000
  Unhandled fault: asynchronous external abort (0x1211) at 0x00000000
  pgd = c0003000
  [00000000] *pgd=80000800004003, *pmd=00000000
  Internal error: : 1211 [#1] PREEMPT SMP ARM
  Modules linked in:
  CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.9.0-00009-g6ff59d2-dirty #7
  Hardware name: Keystone
  task: eb878000 task.stack: eb866000
  PC is at dw_pcie_setup_rc+0x24/0x380
  LR is at ks_pcie_host_init+0x10/0x170

Move the dw_pcie_iatu_unroll_enabled() check so we only call it on
platforms that do not use the ATU.  These platforms supply their own
->rd_other_conf() and ->wr_other_conf() methods.

[bhelgaas: changelog]
Fixes: a0601a470537 ("PCI: designware: Add iATU Unroll feature")
Fixes: 416379f9ebde ("PCI: designware: Check for iATU unroll support after initializing host")
Tested-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-By: Joao Pinto <jpinto@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/pci/host/pcie-designware.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

--- a/drivers/pci/host/pcie-designware.c
+++ b/drivers/pci/host/pcie-designware.c
@@ -807,11 +807,6 @@ void dw_pcie_setup_rc(struct pcie_port *
 {
 	u32 val;
 
-	/* get iATU unroll support */
-	pp->iatu_unroll_enabled = dw_pcie_iatu_unroll_enabled(pp);
-	dev_dbg(pp->dev, "iATU unroll: %s\n",
-		pp->iatu_unroll_enabled ? "enabled" : "disabled");
-
 	/* set the number of lanes */
 	val = dw_pcie_readl_rc(pp, PCIE_PORT_LINK_CONTROL);
 	val &= ~PORT_LINK_MODE_MASK;
@@ -882,6 +877,11 @@ void dw_pcie_setup_rc(struct pcie_port *
 	 * we should not program the ATU here.
 	 */
 	if (!pp->ops->rd_other_conf) {
+		/* get iATU unroll support */
+		pp->iatu_unroll_enabled = dw_pcie_iatu_unroll_enabled(pp);
+		dev_dbg(pp->dev, "iATU unroll: %s\n",
+			pp->iatu_unroll_enabled ? "enabled" : "disabled");
+
 		dw_pcie_prog_outbound_atu(pp, PCIE_ATU_REGION_INDEX0,
 					  PCIE_ATU_TYPE_MEM, pp->mem_base,
 					  pp->mem_bus_addr, pp->mem_size);

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 041/130] PCI: Enumerate switches below PCI-to-PCIe bridges
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (37 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 040/130] PCI: designware: Check for iATU unroll only on platforms that use ATU Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 042/130] HID: corsair: fix DMA buffers on stack Greg Kroah-Hartman
                     ` (87 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Blake Moore, Bjorn Helgaas

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

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

From: Bjorn Helgaas <bhelgaas@google.com>

commit 51ebfc92b72b4f7dac1ab45683bf56741e454b8c upstream.

A PCI-to-PCIe bridge (a "reverse bridge") has a PCI or PCI-X primary
interface and a PCI Express secondary interface.  The PCIe interface is a
Downstream Port that originates a Link.  See the "PCI Express to PCI/PCI-X
Bridge Specification", rev 1.0, sections 1.2 and A.6.

The bug report below involves a PCI-to-PCIe bridge and a PCIe switch below
the bridge:

  00:1e.0 Intel 82801 PCI Bridge to [bus 01-0a]
  01:00.0 Pericom PI7C9X111SL PCIe-to-PCI Reversible Bridge to [bus 02-0a]
  02:00.0 Pericom Device 8608 [PCIe Upstream Port] to [bus 03-0a]
  03:01.0 Pericom Device 8608 [PCIe Downstream Port] to [bus 0a]

01:00.0 is configured as a PCI-to-PCIe bridge (despite the name printed by
lspci).  As we traverse a PCIe hierarchy, device connections alternate
between PCIe Links and internal Switch logic.  Previously we did not
recognize that 01:00.0 had a secondary link, so we thought the 02:00.0
Upstream Port *did* have a secondary link.  In fact, it's the other way
around: 01:00.0 has a secondary link, and 02:00.0 has internal Switch logic
on its secondary side.

When we thought 02:00.0 had a secondary link, the pci_scan_slot() ->
only_one_child() path assumed 02:00.0 could have only one child, so 03:00.0
was the only possible downstream device.  But 03:00.0 doesn't exist, so we
didn't look for any other devices on bus 03.

Booting with "pci=pcie_scan_all" is a workaround, but we don't want users
to have to do that.

Recognize that PCI-to-PCIe bridges originate links on their secondary
interfaces.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=189361
Fixes: d0751b98dfa3 ("PCI: Add dev->has_secondary_link to track downstream PCIe links")
Tested-by: Blake Moore <blake.moore@men.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/pci/probe.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1050,6 +1050,7 @@ void set_pcie_port_type(struct pci_dev *
 	pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
 	if (!pos)
 		return;
+
 	pdev->pcie_cap = pos;
 	pci_read_config_word(pdev, pos + PCI_EXP_FLAGS, &reg16);
 	pdev->pcie_flags_reg = reg16;
@@ -1057,13 +1058,14 @@ void set_pcie_port_type(struct pci_dev *
 	pdev->pcie_mpss = reg16 & PCI_EXP_DEVCAP_PAYLOAD;
 
 	/*
-	 * A Root Port is always the upstream end of a Link.  No PCIe
-	 * component has two Links.  Two Links are connected by a Switch
-	 * that has a Port on each Link and internal logic to connect the
-	 * two Ports.
+	 * A Root Port or a PCI-to-PCIe bridge is always the upstream end
+	 * of a Link.  No PCIe component has two Links.  Two Links are
+	 * connected by a Switch that has a Port on each Link and internal
+	 * logic to connect the two Ports.
 	 */
 	type = pci_pcie_type(pdev);
-	if (type == PCI_EXP_TYPE_ROOT_PORT)
+	if (type == PCI_EXP_TYPE_ROOT_PORT ||
+	    type == PCI_EXP_TYPE_PCIE_BRIDGE)
 		pdev->has_secondary_link = 1;
 	else if (type == PCI_EXP_TYPE_UPSTREAM ||
 		 type == PCI_EXP_TYPE_DOWNSTREAM) {

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 042/130] HID: corsair: fix DMA buffers on stack
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (38 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 041/130] PCI: Enumerate switches below PCI-to-PCIe bridges Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 043/130] HID: corsair: fix control-transfer error handling Greg Kroah-Hartman
                     ` (86 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold, Jiri Kosina

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

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

From: Johan Hovold <johan@kernel.org>

commit 6d104af38b570d37aa32a5803b04c354f8ed513d upstream.

Not all platforms support DMA to the stack, and specifically since v4.9
this is no longer supported on x86 with VMAP_STACK either.

Note that the macro-mode buffer was larger than necessary.

Fixes: 6f78193ee9ea ("HID: corsair: Add Corsair Vengeance K90 driver")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/hid/hid-corsair.c |   54 +++++++++++++++++++++++++++++++++++-----------
 1 file changed, 42 insertions(+), 12 deletions(-)

--- a/drivers/hid/hid-corsair.c
+++ b/drivers/hid/hid-corsair.c
@@ -148,7 +148,11 @@ static enum led_brightness k90_backlight
 	struct usb_interface *usbif = to_usb_interface(dev->parent);
 	struct usb_device *usbdev = interface_to_usbdev(usbif);
 	int brightness;
-	char data[8];
+	char *data;
+
+	data = kmalloc(8, GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
 
 	ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0),
 			      K90_REQUEST_STATUS,
@@ -158,16 +162,22 @@ static enum led_brightness k90_backlight
 	if (ret < 0) {
 		dev_warn(dev, "Failed to get K90 initial state (error %d).\n",
 			 ret);
-		return -EIO;
+		ret = -EIO;
+		goto out;
 	}
 	brightness = data[4];
 	if (brightness < 0 || brightness > 3) {
 		dev_warn(dev,
 			 "Read invalid backlight brightness: %02hhx.\n",
 			 data[4]);
-		return -EIO;
+		ret = -EIO;
+		goto out;
 	}
-	return brightness;
+	ret = brightness;
+out:
+	kfree(data);
+
+	return ret;
 }
 
 static enum led_brightness k90_record_led_get(struct led_classdev *led_cdev)
@@ -253,7 +263,11 @@ static ssize_t k90_show_macro_mode(struc
 	struct usb_interface *usbif = to_usb_interface(dev->parent);
 	struct usb_device *usbdev = interface_to_usbdev(usbif);
 	const char *macro_mode;
-	char data[8];
+	char *data;
+
+	data = kmalloc(2, GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
 
 	ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0),
 			      K90_REQUEST_GET_MODE,
@@ -263,7 +277,8 @@ static ssize_t k90_show_macro_mode(struc
 	if (ret < 0) {
 		dev_warn(dev, "Failed to get K90 initial mode (error %d).\n",
 			 ret);
-		return -EIO;
+		ret = -EIO;
+		goto out;
 	}
 
 	switch (data[0]) {
@@ -277,10 +292,15 @@ static ssize_t k90_show_macro_mode(struc
 	default:
 		dev_warn(dev, "K90 in unknown mode: %02hhx.\n",
 			 data[0]);
-		return -EIO;
+		ret = -EIO;
+		goto out;
 	}
 
-	return snprintf(buf, PAGE_SIZE, "%s\n", macro_mode);
+	ret = snprintf(buf, PAGE_SIZE, "%s\n", macro_mode);
+out:
+	kfree(data);
+
+	return ret;
 }
 
 static ssize_t k90_store_macro_mode(struct device *dev,
@@ -320,7 +340,11 @@ static ssize_t k90_show_current_profile(
 	struct usb_interface *usbif = to_usb_interface(dev->parent);
 	struct usb_device *usbdev = interface_to_usbdev(usbif);
 	int current_profile;
-	char data[8];
+	char *data;
+
+	data = kmalloc(8, GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
 
 	ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0),
 			      K90_REQUEST_STATUS,
@@ -330,16 +354,22 @@ static ssize_t k90_show_current_profile(
 	if (ret < 0) {
 		dev_warn(dev, "Failed to get K90 initial state (error %d).\n",
 			 ret);
-		return -EIO;
+		ret = -EIO;
+		goto out;
 	}
 	current_profile = data[7];
 	if (current_profile < 1 || current_profile > 3) {
 		dev_warn(dev, "Read invalid current profile: %02hhx.\n",
 			 data[7]);
-		return -EIO;
+		ret = -EIO;
+		goto out;
 	}
 
-	return snprintf(buf, PAGE_SIZE, "%d\n", current_profile);
+	ret = snprintf(buf, PAGE_SIZE, "%d\n", current_profile);
+out:
+	kfree(data);
+
+	return ret;
 }
 
 static ssize_t k90_store_current_profile(struct device *dev,

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 043/130] HID: corsair: fix control-transfer error handling
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (39 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 042/130] HID: corsair: fix DMA buffers on stack Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 044/130] mmc: sdhci-acpi: Only powered up enabled acpi child devices Greg Kroah-Hartman
                     ` (85 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold, Jiri Kosina

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

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

From: Johan Hovold <johan@kernel.org>

commit 7a546af50eb78ab99840903083231eb635c8a566 upstream.

Make sure to check for short control transfers in order to avoid parsing
uninitialised buffer data and leaking it to user space.

Note that the backlight and macro-mode buffer constraints are kept as
loose as possible in order to avoid any regressions should the current
buffer sizes be larger than necessary.

Fixes: 6f78193ee9ea ("HID: corsair: Add Corsair Vengeance K90 driver")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/hid/hid-corsair.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/hid/hid-corsair.c
+++ b/drivers/hid/hid-corsair.c
@@ -159,7 +159,7 @@ static enum led_brightness k90_backlight
 			      USB_DIR_IN | USB_TYPE_VENDOR |
 			      USB_RECIP_DEVICE, 0, 0, data, 8,
 			      USB_CTRL_SET_TIMEOUT);
-	if (ret < 0) {
+	if (ret < 5) {
 		dev_warn(dev, "Failed to get K90 initial state (error %d).\n",
 			 ret);
 		ret = -EIO;
@@ -274,7 +274,7 @@ static ssize_t k90_show_macro_mode(struc
 			      USB_DIR_IN | USB_TYPE_VENDOR |
 			      USB_RECIP_DEVICE, 0, 0, data, 2,
 			      USB_CTRL_SET_TIMEOUT);
-	if (ret < 0) {
+	if (ret < 1) {
 		dev_warn(dev, "Failed to get K90 initial mode (error %d).\n",
 			 ret);
 		ret = -EIO;
@@ -351,7 +351,7 @@ static ssize_t k90_show_current_profile(
 			      USB_DIR_IN | USB_TYPE_VENDOR |
 			      USB_RECIP_DEVICE, 0, 0, data, 8,
 			      USB_CTRL_SET_TIMEOUT);
-	if (ret < 0) {
+	if (ret < 8) {
 		dev_warn(dev, "Failed to get K90 initial state (error %d).\n",
 			 ret);
 		ret = -EIO;

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 044/130] mmc: sdhci-acpi: Only powered up enabled acpi child devices
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (40 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 043/130] HID: corsair: fix control-transfer error handling Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 045/130] mmc: mxs-mmc: Fix additional cycles after transmission stop Greg Kroah-Hartman
                     ` (84 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Hans de Goede, Adrian Hunter, Ulf Hansson

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

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

From: Hans de Goede <hdegoede@redhat.com>

commit e1d070c3793a2766122865a7c2142853b48808c5 upstream.

Commit e5bbf30733f9 ("mmc: sdhci-acpi: Ensure connected devices are
powered when probing") introduced code to powerup any acpi child
nodes listed in the dstd. But some dstd-s list all possible devices
used on some board variants, while reporting if the device is actually
present and enabled in the status field of the device.

So we end up calling the acpi _PS0 (power-on) method for devices which
are not actually present. This does not always end well, e.g. on my
cube iwork8 air tablet, this results in freezing the entire tablet as
soon as the r8723bs module is loaded.

This commit fixes this by checking the child device's status.present
and status.enabled bits and only call acpi_device_fix_up_power()
if both are set.

Fixes: e5bbf30733f9 ("mmc: sdhci-acpi: Ensure connected devices are powered when probing")
BugLink: https://github.com/hadess/rtl8723bs/issues/80
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/mmc/host/sdhci-acpi.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -394,7 +394,8 @@ static int sdhci_acpi_probe(struct platf
 	/* Power on the SDHCI controller and its children */
 	acpi_device_fix_up_power(device);
 	list_for_each_entry(child, &device->children, node)
-		acpi_device_fix_up_power(child);
+		if (child->status.present && child->status.enabled)
+			acpi_device_fix_up_power(child);
 
 	if (acpi_bus_get_status(device) || !device->status.present)
 		return -ENODEV;

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 045/130] mmc: mxs-mmc: Fix additional cycles after transmission stop
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (41 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 044/130] mmc: sdhci-acpi: Only powered up enabled acpi child devices Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 046/130] ieee802154: atusb: do not use the stack for buffers to make them DMA able Greg Kroah-Hartman
                     ` (83 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Stefan Wahren, Ulf Hansson

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

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

From: Stefan Wahren <stefan.wahren@i2se.com>

commit 01167c7b9cbf099c69fe411a228e4e9c7104e123 upstream.

According to the code the intention is to append 8 SCK cycles
instead of 4 at end of a MMC_STOP_TRANSMISSION command. But this
will never happened because it's an AC command not an ADTC command.
So fix this by moving the statement into the right function.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Fixes: e4243f13d10e (mmc: mxs-mmc: add mmc host driver for i.MX23/28)
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/mmc/host/mxs-mmc.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -309,6 +309,9 @@ static void mxs_mmc_ac(struct mxs_mmc_ho
 	cmd0 = BF_SSP(cmd->opcode, CMD0_CMD);
 	cmd1 = cmd->arg;
 
+	if (cmd->opcode == MMC_STOP_TRANSMISSION)
+		cmd0 |= BM_SSP_CMD0_APPEND_8CYC;
+
 	if (host->sdio_irq_en) {
 		ctrl0 |= BM_SSP_CTRL0_SDIO_IRQ_CHECK;
 		cmd0 |= BM_SSP_CMD0_CONT_CLKING_EN | BM_SSP_CMD0_SLOW_CLKING_EN;
@@ -417,8 +420,7 @@ static void mxs_mmc_adtc(struct mxs_mmc_
 		       ssp->base + HW_SSP_BLOCK_SIZE);
 	}
 
-	if ((cmd->opcode == MMC_STOP_TRANSMISSION) ||
-	    (cmd->opcode == SD_IO_RW_EXTENDED))
+	if (cmd->opcode == SD_IO_RW_EXTENDED)
 		cmd0 |= BM_SSP_CMD0_APPEND_8CYC;
 
 	cmd1 = cmd->arg;

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 046/130] ieee802154: atusb: do not use the stack for buffers to make them DMA able
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (42 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 045/130] mmc: mxs-mmc: Fix additional cycles after transmission stop Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 047/130] mtd: nand: lpc32xx: fix invalid error handling of a requested irq Greg Kroah-Hartman
                     ` (82 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Stefan Schmidt,
	Marcel Holtmann

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

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

From: Stefan Schmidt <stefan@osg.samsung.com>

commit 05a974efa4bdf6e2a150e3f27dc6fcf0a9ad5655 upstream.

>From 4.9 we should really avoid using the stack here as this will not be DMA
able on various platforms. This changes the buffers already being present in
time of 4.9 being released. This should go into stable as well.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/ieee802154/atusb.c |   31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)

--- a/drivers/net/ieee802154/atusb.c
+++ b/drivers/net/ieee802154/atusb.c
@@ -112,13 +112,26 @@ static int atusb_read_reg(struct atusb *
 {
 	struct usb_device *usb_dev = atusb->usb_dev;
 	int ret;
+	uint8_t *buffer;
 	uint8_t value;
 
+	buffer = kmalloc(1, GFP_KERNEL);
+	if (!buffer)
+		return -ENOMEM;
+
 	dev_dbg(&usb_dev->dev, "atusb: reg = 0x%x\n", reg);
 	ret = atusb_control_msg(atusb, usb_rcvctrlpipe(usb_dev, 0),
 				ATUSB_REG_READ, ATUSB_REQ_FROM_DEV,
-				0, reg, &value, 1, 1000);
-	return ret >= 0 ? value : ret;
+				0, reg, buffer, 1, 1000);
+
+	if (ret >= 0) {
+		value = buffer[0];
+		kfree(buffer);
+		return value;
+	} else {
+		kfree(buffer);
+		return ret;
+	}
 }
 
 static int atusb_write_subreg(struct atusb *atusb, uint8_t reg, uint8_t mask,
@@ -587,9 +600,13 @@ static struct ieee802154_ops atusb_ops =
 static int atusb_get_and_show_revision(struct atusb *atusb)
 {
 	struct usb_device *usb_dev = atusb->usb_dev;
-	unsigned char buffer[3];
+	unsigned char *buffer;
 	int ret;
 
+	buffer = kmalloc(3, GFP_KERNEL);
+	if (!buffer)
+		return -ENOMEM;
+
 	/* Get a couple of the ATMega Firmware values */
 	ret = atusb_control_msg(atusb, usb_rcvctrlpipe(usb_dev, 0),
 				ATUSB_ID, ATUSB_REQ_FROM_DEV, 0, 0,
@@ -605,15 +622,20 @@ static int atusb_get_and_show_revision(s
 		dev_info(&usb_dev->dev, "Please update to version 0.2 or newer");
 	}
 
+	kfree(buffer);
 	return ret;
 }
 
 static int atusb_get_and_show_build(struct atusb *atusb)
 {
 	struct usb_device *usb_dev = atusb->usb_dev;
-	char build[ATUSB_BUILD_SIZE + 1];
+	char *build;
 	int ret;
 
+	build = kmalloc(ATUSB_BUILD_SIZE + 1, GFP_KERNEL);
+	if (!build)
+		return -ENOMEM;
+
 	ret = atusb_control_msg(atusb, usb_rcvctrlpipe(usb_dev, 0),
 				ATUSB_BUILD, ATUSB_REQ_FROM_DEV, 0, 0,
 				build, ATUSB_BUILD_SIZE, 1000);
@@ -622,6 +644,7 @@ static int atusb_get_and_show_build(stru
 		dev_info(&usb_dev->dev, "Firmware: build %s\n", build);
 	}
 
+	kfree(build);
 	return ret;
 }
 

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 047/130] mtd: nand: lpc32xx: fix invalid error handling of a requested irq
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (43 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 046/130] ieee802154: atusb: do not use the stack for buffers to make them DMA able Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 048/130] mtd: nand: xway: disable module support Greg Kroah-Hartman
                     ` (81 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Vladimir Zapolskiy, Sylvain Lemieux,
	Boris Brezillon

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

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

From: Vladimir Zapolskiy <vz@mleia.com>

commit cf9e1672a66c49ed8903c01b4c380a2f2dc91b40 upstream.

Semantics of NR_IRQS is different on machines with SPARSE_IRQ option
disabled or enabled, in the latter case IRQs are allocated starting
at least from the value specified by NR_IRQS and going upwards, so
the check of (irq >= NR_IRQ) to decide about an error code returned by
platform_get_irq() is completely invalid, don't attempt to overrule
irq subsystem in the driver.

The change fixes LPC32xx NAND MLC driver initialization on boot.

Fixes: 8cb17b5ed017 ("irqchip: Add LPC32xx interrupt controller driver")
Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Acked-by: Sylvain Lemieux <slemieux.tyco@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/mtd/nand/lpc32xx_mlc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/mtd/nand/lpc32xx_mlc.c
+++ b/drivers/mtd/nand/lpc32xx_mlc.c
@@ -776,7 +776,7 @@ static int lpc32xx_nand_probe(struct pla
 	init_completion(&host->comp_controller);
 
 	host->irq = platform_get_irq(pdev, 0);
-	if ((host->irq < 0) || (host->irq >= NR_IRQS)) {
+	if (host->irq < 0) {
 		dev_err(&pdev->dev, "failed to get platform irq\n");
 		res = -EINVAL;
 		goto err_exit3;

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 048/130] mtd: nand: xway: disable module support
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (44 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 047/130] mtd: nand: lpc32xx: fix invalid error handling of a requested irq Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 049/130] mtd: nand: xway: fix build because of module functions Greg Kroah-Hartman
                     ` (80 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Hauke Mehrtens, Boris Brezillon

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

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

From: Hauke Mehrtens <hauke@hauke-m.de>

commit 73529c872a189c747bdb528ce9b85b67b0e28dec upstream.

The xway_nand driver accesses the ltq_ebu_membase symbol which is not
exported. This also should not get exported and we should handle the
EBU interface in a better way later. This quick fix just deactivated
support for building as module.

Fixes: 99f2b107924c ("mtd: lantiq: Add NAND support on Lantiq XWAY SoC.")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/mtd/nand/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -537,7 +537,7 @@ config MTD_NAND_FSMC
 	  Flexible Static Memory Controller (FSMC)
 
 config MTD_NAND_XWAY
-	tristate "Support for NAND on Lantiq XWAY SoC"
+	bool "Support for NAND on Lantiq XWAY SoC"
 	depends on LANTIQ && SOC_TYPE_XWAY
 	help
 	  Enables support for NAND Flash chips on Lantiq XWAY SoCs. NAND is attached

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 049/130] mtd: nand: xway: fix build because of module functions
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (45 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 048/130] mtd: nand: xway: disable module support Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 050/130] KVM: s390: do not expose random data via facility bitmap Greg Kroah-Hartman
                     ` (79 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Hauke Mehrtens, Boris Brezillon

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

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

From: Hauke Mehrtens <hauke@hauke-m.de>

commit a2724663494f7313f53da10d8c0a729c5e3c4dea upstream.

Remove the usage of modules functions to make this driver compile
again. Otherwise an include of linux/modules.h would be needed.

Fixes: 024366750c2e ("mtd: nand: xway: convert to normal platform driver")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/mtd/nand/xway_nand.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

--- a/drivers/mtd/nand/xway_nand.c
+++ b/drivers/mtd/nand/xway_nand.c
@@ -232,7 +232,6 @@ static const struct of_device_id xway_na
 	{ .compatible = "lantiq,nand-xway" },
 	{},
 };
-MODULE_DEVICE_TABLE(of, xway_nand_match);
 
 static struct platform_driver xway_nand_driver = {
 	.probe	= xway_nand_probe,
@@ -243,6 +242,4 @@ static struct platform_driver xway_nand_
 	},
 };
 
-module_platform_driver(xway_nand_driver);
-
-MODULE_LICENSE("GPL");
+builtin_platform_driver(xway_nand_driver);

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 050/130] KVM: s390: do not expose random data via facility bitmap
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (46 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 049/130] mtd: nand: xway: fix build because of module functions Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 051/130] KVM: arm/arm64: vgic: Fix deadlock on error handling Greg Kroah-Hartman
                     ` (78 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Heiko Carstens,
	Christian Borntraeger, Cornelia Huck

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

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

From: Christian Borntraeger <borntraeger@de.ibm.com>

commit 04478197416e3a302e9ebc917ba1aa884ef9bfab upstream.

kvm_s390_get_machine() populates the facility bitmap by copying bytes
from the host results that are stored in a 256 byte array in the prefix
page. The KVM code does use the size of the target buffer (2k), thus
copying and exposing unrelated kernel memory (mostly machine check
related logout data).

Let's use the size of the source buffer instead.  This is ok, as the
target buffer will always be greater or equal than the source buffer as
the KVM internal buffers (and thus S390_ARCH_FAC_LIST_SIZE_BYTE) cover
the maximum possible size that is allowed by STFLE, which is 256
doublewords. All structures are zero allocated so we can leave bytes
256-2047 unchanged.

Add a similar fix for kvm_arch_init_vm().

Reported-by: Heiko Carstens <heiko.carstens@de.ibm.com>
[found with smatch]
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/s390/kvm/kvm-s390.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -916,7 +916,7 @@ static int kvm_s390_get_machine(struct k
 	memcpy(&mach->fac_mask, kvm->arch.model.fac_mask,
 	       S390_ARCH_FAC_LIST_SIZE_BYTE);
 	memcpy((unsigned long *)&mach->fac_list, S390_lowcore.stfle_fac_list,
-	       S390_ARCH_FAC_LIST_SIZE_BYTE);
+	       sizeof(S390_lowcore.stfle_fac_list));
 	if (copy_to_user((void __user *)attr->addr, mach, sizeof(*mach)))
 		ret = -EFAULT;
 	kfree(mach);
@@ -1437,7 +1437,7 @@ int kvm_arch_init_vm(struct kvm *kvm, un
 
 	/* Populate the facility mask initially. */
 	memcpy(kvm->arch.model.fac_mask, S390_lowcore.stfle_fac_list,
-	       S390_ARCH_FAC_LIST_SIZE_BYTE);
+	       sizeof(S390_lowcore.stfle_fac_list));
 	for (i = 0; i < S390_ARCH_FAC_LIST_SIZE_U64; i++) {
 		if (i < kvm_s390_fac_list_mask_size())
 			kvm->arch.model.fac_mask[i] &= kvm_s390_fac_list_mask[i];

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 051/130] KVM: arm/arm64: vgic: Fix deadlock on error handling
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (47 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 050/130] KVM: s390: do not expose random data via facility bitmap Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 052/130] powerpc/icp-opal: Fix missing KVM case and harden replay Greg Kroah-Hartman
                     ` (77 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dmitry Vyukov, Christoffer Dall,
	Eric Auger, Marc Zyngier

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

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

From: Marc Zyngier <marc.zyngier@arm.com>

commit 1193e6aeecb36c74c48c7cd0f641acbbed9ddeef upstream.

Dmitry Vyukov reported that the syzkaller fuzzer triggered a
deadlock in the vgic setup code when an error was detected, as
the cleanup code tries to take a lock that is already held by
the setup code.

The fix is to avoid retaking the lock when cleaning up, by
telling the cleanup function that we already hold it.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 virt/kvm/arm/vgic/vgic-init.c |   18 +++++++++++++-----
 virt/kvm/arm/vgic/vgic-v2.c   |    2 --
 virt/kvm/arm/vgic/vgic-v3.c   |    2 --
 3 files changed, 13 insertions(+), 9 deletions(-)

--- a/virt/kvm/arm/vgic/vgic-init.c
+++ b/virt/kvm/arm/vgic/vgic-init.c
@@ -268,15 +268,11 @@ static void kvm_vgic_dist_destroy(struct
 {
 	struct vgic_dist *dist = &kvm->arch.vgic;
 
-	mutex_lock(&kvm->lock);
-
 	dist->ready = false;
 	dist->initialized = false;
 
 	kfree(dist->spis);
 	dist->nr_spis = 0;
-
-	mutex_unlock(&kvm->lock);
 }
 
 void kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu)
@@ -286,7 +282,8 @@ void kvm_vgic_vcpu_destroy(struct kvm_vc
 	INIT_LIST_HEAD(&vgic_cpu->ap_list_head);
 }
 
-void kvm_vgic_destroy(struct kvm *kvm)
+/* To be called with kvm->lock held */
+static void __kvm_vgic_destroy(struct kvm *kvm)
 {
 	struct kvm_vcpu *vcpu;
 	int i;
@@ -297,6 +294,13 @@ void kvm_vgic_destroy(struct kvm *kvm)
 		kvm_vgic_vcpu_destroy(vcpu);
 }
 
+void kvm_vgic_destroy(struct kvm *kvm)
+{
+	mutex_lock(&kvm->lock);
+	__kvm_vgic_destroy(kvm);
+	mutex_unlock(&kvm->lock);
+}
+
 /**
  * vgic_lazy_init: Lazy init is only allowed if the GIC exposed to the guest
  * is a GICv2. A GICv3 must be explicitly initialized by the guest using the
@@ -348,6 +352,10 @@ int kvm_vgic_map_resources(struct kvm *k
 		ret = vgic_v2_map_resources(kvm);
 	else
 		ret = vgic_v3_map_resources(kvm);
+
+	if (ret)
+		__kvm_vgic_destroy(kvm);
+
 out:
 	mutex_unlock(&kvm->lock);
 	return ret;
--- a/virt/kvm/arm/vgic/vgic-v2.c
+++ b/virt/kvm/arm/vgic/vgic-v2.c
@@ -293,8 +293,6 @@ int vgic_v2_map_resources(struct kvm *kv
 	dist->ready = true;
 
 out:
-	if (ret)
-		kvm_vgic_destroy(kvm);
 	return ret;
 }
 
--- a/virt/kvm/arm/vgic/vgic-v3.c
+++ b/virt/kvm/arm/vgic/vgic-v3.c
@@ -302,8 +302,6 @@ int vgic_v3_map_resources(struct kvm *kv
 	dist->ready = true;
 
 out:
-	if (ret)
-		kvm_vgic_destroy(kvm);
 	return ret;
 }
 

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 052/130] powerpc/icp-opal: Fix missing KVM case and harden replay
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (48 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 051/130] KVM: arm/arm64: vgic: Fix deadlock on error handling Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 053/130] powerpc/perf: Fix PM_BRU_CMPL event code for power9 Greg Kroah-Hartman
                     ` (76 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Benjamin Herrenschmidt, Michael Ellerman

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

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

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

commit 9728a7c8ab2f7a1c8d5c95278d2e4f4ac1285385 upstream.

The icp-opal call is missing the code from icp-native to recover
interrupts snatched by KVM. Without that, when running KVM, we can
get into a situation where an interrupt is lost and the CPU stuck
with an elevated CPPR.

Also harden replay by always checking the return from opal_int_eoi().

Fixes: d74361881f0d ("powerpc/xics: Add ICP OPAL backend")
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/sysdev/xics/icp-opal.c |   31 ++++++++++++++++++++++++-------
 1 file changed, 24 insertions(+), 7 deletions(-)

--- a/arch/powerpc/sysdev/xics/icp-opal.c
+++ b/arch/powerpc/sysdev/xics/icp-opal.c
@@ -20,6 +20,7 @@
 #include <asm/xics.h>
 #include <asm/io.h>
 #include <asm/opal.h>
+#include <asm/kvm_ppc.h>
 
 static void icp_opal_teardown_cpu(void)
 {
@@ -39,7 +40,26 @@ static void icp_opal_flush_ipi(void)
 	 * Should we be flagging idle loop instead?
 	 * Or creating some task to be scheduled?
 	 */
-	opal_int_eoi((0x00 << 24) | XICS_IPI);
+	if (opal_int_eoi((0x00 << 24) | XICS_IPI) > 0)
+		force_external_irq_replay();
+}
+
+static unsigned int icp_opal_get_xirr(void)
+{
+	unsigned int kvm_xirr;
+	__be32 hw_xirr;
+	int64_t rc;
+
+	/* Handle an interrupt latched by KVM first */
+	kvm_xirr = kvmppc_get_xics_latch();
+	if (kvm_xirr)
+		return kvm_xirr;
+
+	/* Then ask OPAL */
+	rc = opal_int_get_xirr(&hw_xirr, false);
+	if (rc < 0)
+		return 0;
+	return be32_to_cpu(hw_xirr);
 }
 
 static unsigned int icp_opal_get_irq(void)
@@ -47,12 +67,8 @@ static unsigned int icp_opal_get_irq(voi
 	unsigned int xirr;
 	unsigned int vec;
 	unsigned int irq;
-	int64_t rc;
 
-	rc = opal_int_get_xirr(&xirr, false);
-	if (rc < 0)
-		return 0;
-	xirr = be32_to_cpu(xirr);
+	xirr = icp_opal_get_xirr();
 	vec = xirr & 0x00ffffff;
 	if (vec == XICS_IRQ_SPURIOUS)
 		return 0;
@@ -67,7 +83,8 @@ static unsigned int icp_opal_get_irq(voi
 	xics_mask_unknown_vec(vec);
 
 	/* We might learn about it later, so EOI it */
-	opal_int_eoi(xirr);
+	if (opal_int_eoi(xirr) > 0)
+		force_external_irq_replay();
 
 	return 0;
 }

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 053/130] powerpc/perf: Fix PM_BRU_CMPL event code for power9
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (49 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 052/130] powerpc/icp-opal: Fix missing KVM case and harden replay Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 054/130] powerpc/ptrace: Preserve previous fprs/vsrs on short regset write Greg Kroah-Hartman
                     ` (75 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Madhavan Srinivasan, Michael Ellerman

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

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

From: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>

commit d89f473ff6f84872e761419f7233d6e00f99c340 upstream.

Use 0x10012 event code for PM_BRU_CMPL event in power9 event list
instead of current 0x40060.

Fixes: 34922527a2bcb ('powerpc/perf: Add power9 event list macros for generic and cache events')
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/perf/power9-events-list.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/powerpc/perf/power9-events-list.h
+++ b/arch/powerpc/perf/power9-events-list.h
@@ -16,7 +16,7 @@ EVENT(PM_CYC,					0x0001e)
 EVENT(PM_ICT_NOSLOT_CYC,			0x100f8)
 EVENT(PM_CMPLU_STALL,				0x1e054)
 EVENT(PM_INST_CMPL,				0x00002)
-EVENT(PM_BRU_CMPL,				0x40060)
+EVENT(PM_BRU_CMPL,				0x10012)
 EVENT(PM_BR_MPRED_CMPL,				0x400f6)
 
 /* All L1 D cache load references counted at finish, gated by reject */

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 054/130] powerpc/ptrace: Preserve previous fprs/vsrs on short regset write
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (50 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 053/130] powerpc/perf: Fix PM_BRU_CMPL event code for power9 Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 055/130] powerpc/ptrace: Preserve previous TM " Greg Kroah-Hartman
                     ` (74 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Dave Martin, Michael Ellerman

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

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

From: Dave Martin <Dave.Martin@arm.com>

commit 99dfe80a2a246c600440a815741fd2e74a8b4977 upstream.

Ensure that if userspace supplies insufficient data to PTRACE_SETREGSET
to fill all the registers, the thread's old registers are preserved.

Fixes: c6e6771b87d4 ("powerpc: Introduce VSX thread_struct and CONFIG_VSX")
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/kernel/ptrace.c |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -463,6 +463,10 @@ static int fpr_set(struct task_struct *t
 
 	flush_fp_to_thread(target);
 
+	for (i = 0; i < 32 ; i++)
+		buf[i] = target->thread.TS_FPR(i);
+	buf[32] = target->thread.fp_state.fpscr;
+
 	/* copy to local buffer then write that out */
 	i = user_regset_copyin(&pos, &count, &kbuf, &ubuf, buf, 0, -1);
 	if (i)
@@ -672,6 +676,9 @@ static int vsr_set(struct task_struct *t
 	flush_altivec_to_thread(target);
 	flush_vsx_to_thread(target);
 
+	for (i = 0; i < 32 ; i++)
+		buf[i] = target->thread.fp_state.fpr[i][TS_VSRLOWOFFSET];
+
 	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
 				 buf, 0, 32 * sizeof(double));
 	if (!ret)

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 055/130] powerpc/ptrace: Preserve previous TM fprs/vsrs on short regset write
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (51 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 054/130] powerpc/ptrace: Preserve previous fprs/vsrs on short regset write Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 056/130] powerpc: Ignore reserved field in DCSR and PVR reads and writes Greg Kroah-Hartman
                     ` (73 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Dave Martin, Michael Ellerman

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

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

From: Dave Martin <Dave.Martin@arm.com>

commit b34ca60148c53971d373643195cc5c4d5d20be78 upstream.

Ensure that if userspace supplies insufficient data to PTRACE_SETREGSET
to fill all the check pointed registers, the thread's old check pointed
registers are preserved.

Fixes: 9d3918f7c0e5 ("powerpc/ptrace: Enable support for NT_PPC_CVSX")
Fixes: 19cbcbf75a0c ("powerpc/ptrace: Enable support for NT_PPC_CFPR")
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/kernel/ptrace.c |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -1026,6 +1026,10 @@ static int tm_cfpr_set(struct task_struc
 	flush_fp_to_thread(target);
 	flush_altivec_to_thread(target);
 
+	for (i = 0; i < 32; i++)
+		buf[i] = target->thread.TS_CKFPR(i);
+	buf[32] = target->thread.ckfp_state.fpscr;
+
 	/* copy to local buffer then write that out */
 	i = user_regset_copyin(&pos, &count, &kbuf, &ubuf, buf, 0, -1);
 	if (i)
@@ -1290,6 +1294,9 @@ static int tm_cvsx_set(struct task_struc
 	flush_altivec_to_thread(target);
 	flush_vsx_to_thread(target);
 
+	for (i = 0; i < 32 ; i++)
+		buf[i] = target->thread.ckfp_state.fpr[i][TS_VSRLOWOFFSET];
+
 	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
 				 buf, 0, 32 * sizeof(double));
 	if (!ret)

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 056/130] powerpc: Ignore reserved field in DCSR and PVR reads and writes
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (52 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 055/130] powerpc/ptrace: Preserve previous TM " Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 057/130] x86/ioapic: Restore IO-APIC irq_chip retrigger callback Greg Kroah-Hartman
                     ` (72 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Anton Blanchard, Michael Ellerman

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

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

From: Anton Blanchard <anton@samba.org>

commit 178f358208ceb8b38e5cff3f815e0db4a6a70a07 upstream.

IBM bit 31 (for the rest of us - bit 0) is a reserved field in the
instruction definition of mtspr and mfspr. Hardware is encouraged to
(and does) ignore it.

As a result, if userspace executes an mtspr DSCR with the reserved bit
set, we get a DSCR facility unavailable exception. The kernel fails to
match against the expected value/mask, and we silently return to
userspace to try and re-execute the same mtspr DSCR instruction. We
loop forever until the process is killed.

We should do something here, and it seems mirroring what hardware does
is the better option vs killing the process. While here, relax the
matching of mfspr PVR too.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/include/asm/ppc-opcode.h |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -157,7 +157,7 @@
 #define PPC_INST_MCRXR			0x7c000400
 #define PPC_INST_MCRXR_MASK		0xfc0007fe
 #define PPC_INST_MFSPR_PVR		0x7c1f42a6
-#define PPC_INST_MFSPR_PVR_MASK		0xfc1fffff
+#define PPC_INST_MFSPR_PVR_MASK		0xfc1ffffe
 #define PPC_INST_MFTMR			0x7c0002dc
 #define PPC_INST_MSGSND			0x7c00019c
 #define PPC_INST_MSGCLR			0x7c0001dc
@@ -174,13 +174,13 @@
 #define PPC_INST_RFDI			0x4c00004e
 #define PPC_INST_RFMCI			0x4c00004c
 #define PPC_INST_MFSPR_DSCR		0x7c1102a6
-#define PPC_INST_MFSPR_DSCR_MASK	0xfc1fffff
+#define PPC_INST_MFSPR_DSCR_MASK	0xfc1ffffe
 #define PPC_INST_MTSPR_DSCR		0x7c1103a6
-#define PPC_INST_MTSPR_DSCR_MASK	0xfc1fffff
+#define PPC_INST_MTSPR_DSCR_MASK	0xfc1ffffe
 #define PPC_INST_MFSPR_DSCR_USER	0x7c0302a6
-#define PPC_INST_MFSPR_DSCR_USER_MASK	0xfc1fffff
+#define PPC_INST_MFSPR_DSCR_USER_MASK	0xfc1ffffe
 #define PPC_INST_MTSPR_DSCR_USER	0x7c0303a6
-#define PPC_INST_MTSPR_DSCR_USER_MASK	0xfc1fffff
+#define PPC_INST_MTSPR_DSCR_USER_MASK	0xfc1ffffe
 #define PPC_INST_MFVSRD			0x7c000066
 #define PPC_INST_MTVSRD			0x7c000166
 #define PPC_INST_SLBFEE			0x7c0007a7

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 057/130] x86/ioapic: Restore IO-APIC irq_chip retrigger callback
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (53 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 056/130] powerpc: Ignore reserved field in DCSR and PVR reads and writes Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 058/130] qla2xxx: Fix crash due to null pointer access Greg Kroah-Hartman
                     ` (71 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Ruslan Ruslichenko,
	xe-linux-external, Thomas Gleixner

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

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

From: Ruslan Ruslichenko <rruslich@cisco.com>

commit 020eb3daaba2857b32c4cf4c82f503d6a00a67de upstream.

commit d32932d02e18 removed the irq_retrigger callback from the IO-APIC
chip and did not add it to the new IO-APIC-IR irq chip.

Unfortunately the software resend fallback is not enabled on X86, so edge
interrupts which are received during the lazy disabled state of the
interrupt line are not retriggered and therefor lost.

Restore the callbacks.

[ tglx: Massaged changelog ]

Fixes: d32932d02e18  ("x86/irq: Convert IOAPIC to use hierarchical irqdomain interfaces")
Signed-off-by: Ruslan Ruslichenko <rruslich@cisco.com>
Cc: xe-linux-external@cisco.com
Link: http://lkml.kernel.org/r/1484662432-13580-1-git-send-email-rruslich@cisco.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/kernel/apic/io_apic.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1876,6 +1876,7 @@ static struct irq_chip ioapic_chip __rea
 	.irq_ack		= irq_chip_ack_parent,
 	.irq_eoi		= ioapic_ack_level,
 	.irq_set_affinity	= ioapic_set_affinity,
+	.irq_retrigger		= irq_chip_retrigger_hierarchy,
 	.flags			= IRQCHIP_SKIP_SET_WAKE,
 };
 
@@ -1887,6 +1888,7 @@ static struct irq_chip ioapic_ir_chip __
 	.irq_ack		= irq_chip_ack_parent,
 	.irq_eoi		= ioapic_ir_ack_level,
 	.irq_set_affinity	= ioapic_set_affinity,
+	.irq_retrigger		= irq_chip_retrigger_hierarchy,
 	.flags			= IRQCHIP_SKIP_SET_WAKE,
 };
 

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 058/130] qla2xxx: Fix crash due to null pointer access
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (54 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 057/130] x86/ioapic: Restore IO-APIC irq_chip retrigger callback Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:54   ` [PATCH 4.9 059/130] mac80211: implement multicast forwarding on fast-RX path Greg Kroah-Hartman
                     ` (70 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Quinn Tran, Himanshu Madhani,
	Christoph Hellwig, Bart Van Assche

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

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

From: Quinn Tran <quinn.tran@cavium.com>

commit fc1ffd6cb38a1c1af625b9833c41928039e733f5 upstream.

During code inspection, while investigating following stack trace
seen on one of the test setup, we found out there was possibility
of memory leak becuase driver was not unwinding the stack properly.

This issue has not been reproduced in a test environment or on a
customer setup.

Here's stack trace that was seen.

[1469877.797315] Call Trace:
[1469877.799940]  [<ffffffffa03ab6e9>] qla2x00_mem_alloc+0xb09/0x10c0 [qla2xxx]
[1469877.806980]  [<ffffffffa03ac50a>] qla2x00_probe_one+0x86a/0x1b50 [qla2xxx]
[1469877.814013]  [<ffffffff813b6d01>] ? __pm_runtime_resume+0x51/0xa0
[1469877.820265]  [<ffffffff8157c1f5>] ? _raw_spin_lock_irqsave+0x25/0x90
[1469877.826776]  [<ffffffff8157cd2d>] ? _raw_spin_unlock_irqrestore+0x6d/0x80
[1469877.833720]  [<ffffffff810741d1>] ? preempt_count_sub+0xb1/0x100
[1469877.839885]  [<ffffffff8157cd0c>] ? _raw_spin_unlock_irqrestore+0x4c/0x80
[1469877.846830]  [<ffffffff81319b9c>] local_pci_probe+0x4c/0xb0
[1469877.852562]  [<ffffffff810741d1>] ? preempt_count_sub+0xb1/0x100
[1469877.858727]  [<ffffffff81319c89>] pci_call_probe+0x89/0xb0

Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
[ bvanassche: Fixed spelling in patch description ]
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/scsi/qla2xxx/qla_os.c |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -3489,7 +3489,7 @@ qla2x00_mem_alloc(struct qla_hw_data *ha
 				sizeof(struct ct6_dsd), 0,
 				SLAB_HWCACHE_ALIGN, NULL);
 			if (!ctx_cachep)
-				goto fail_free_gid_list;
+				goto fail_free_srb_mempool;
 		}
 		ha->ctx_mempool = mempool_create_slab_pool(SRB_MIN_REQ,
 			ctx_cachep);
@@ -3642,7 +3642,7 @@ qla2x00_mem_alloc(struct qla_hw_data *ha
 	ha->loop_id_map = kzalloc(BITS_TO_LONGS(LOOPID_MAP_SIZE) * sizeof(long),
 	    GFP_KERNEL);
 	if (!ha->loop_id_map)
-		goto fail_async_pd;
+		goto fail_loop_id_map;
 	else {
 		qla2x00_set_reserved_loop_ids(ha);
 		ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0123,
@@ -3651,6 +3651,8 @@ qla2x00_mem_alloc(struct qla_hw_data *ha
 
 	return 0;
 
+fail_loop_id_map:
+	dma_pool_free(ha->s_dma_pool, ha->async_pd, ha->async_pd_dma);
 fail_async_pd:
 	dma_pool_free(ha->s_dma_pool, ha->ex_init_cb, ha->ex_init_cb_dma);
 fail_ex_init_cb:
@@ -3678,6 +3680,10 @@ fail_free_ms_iocb:
 	dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma);
 	ha->ms_iocb = NULL;
 	ha->ms_iocb_dma = 0;
+
+	if (ha->sns_cmd)
+		dma_free_coherent(&ha->pdev->dev, sizeof(struct sns_cmd_pkt),
+		    ha->sns_cmd, ha->sns_cmd_dma);
 fail_dma_pool:
 	if (IS_QLA82XX(ha) || ql2xenabledif) {
 		dma_pool_destroy(ha->fcp_cmnd_dma_pool);
@@ -3695,10 +3701,12 @@ fail_free_nvram:
 	kfree(ha->nvram);
 	ha->nvram = NULL;
 fail_free_ctx_mempool:
-	mempool_destroy(ha->ctx_mempool);
+	if (ha->ctx_mempool)
+		mempool_destroy(ha->ctx_mempool);
 	ha->ctx_mempool = NULL;
 fail_free_srb_mempool:
-	mempool_destroy(ha->srb_mempool);
+	if (ha->srb_mempool)
+		mempool_destroy(ha->srb_mempool);
 	ha->srb_mempool = NULL;
 fail_free_gid_list:
 	dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha),

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 059/130] mac80211: implement multicast forwarding on fast-RX path
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (55 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 058/130] qla2xxx: Fix crash due to null pointer access Greg Kroah-Hartman
@ 2017-01-24  7:54   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 060/130] ubifs: Fix journal replay wrt. xattr nodes Greg Kroah-Hartman
                     ` (69 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johannes Berg

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

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

From: Johannes Berg <johannes.berg@intel.com>

commit eeb0d56fab4cd7848cf2be6704fa48900dbc1381 upstream.

In AP (or VLAN) mode, when unicast 802.11 packets are received,
they might actually be multicast after conversion. In this case
the fast-RX path didn't handle them properly to send them back
to the wireless medium. Implement that by copying the SKB and
sending it back out.

The possible alternative would be to just punt the packet back
to the regular (slow) RX path, but since we have almost all of
the required code here already it's not so complicated to add
here. Punting it back would also mean acquiring the spinlock,
which would be bad for the stated purpose of the fast-RX path,
to enable well-performing parallel RX.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/mac80211/rx.c |   26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -3939,21 +3939,31 @@ static bool ieee80211_invoke_fast_rx(str
 	u64_stats_update_end(&stats->syncp);
 
 	if (fast_rx->internal_forward) {
-		struct sta_info *dsta = sta_info_get(rx->sdata, skb->data);
+		struct sk_buff *xmit_skb = NULL;
+		bool multicast = is_multicast_ether_addr(skb->data);
 
-		if (dsta) {
+		if (multicast) {
+			xmit_skb = skb_copy(skb, GFP_ATOMIC);
+		} else if (sta_info_get(rx->sdata, skb->data)) {
+			xmit_skb = skb;
+			skb = NULL;
+		}
+
+		if (xmit_skb) {
 			/*
 			 * Send to wireless media and increase priority by 256
 			 * to keep the received priority instead of
 			 * reclassifying the frame (see cfg80211_classify8021d).
 			 */
-			skb->priority += 256;
-			skb->protocol = htons(ETH_P_802_3);
-			skb_reset_network_header(skb);
-			skb_reset_mac_header(skb);
-			dev_queue_xmit(skb);
-			return true;
+			xmit_skb->priority += 256;
+			xmit_skb->protocol = htons(ETH_P_802_3);
+			skb_reset_network_header(xmit_skb);
+			skb_reset_mac_header(xmit_skb);
+			dev_queue_xmit(xmit_skb);
 		}
+
+		if (!skb)
+			return true;
 	}
 
 	/* deliver to local stack */

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 060/130] ubifs: Fix journal replay wrt. xattr nodes
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (56 preceding siblings ...)
  2017-01-24  7:54   ` [PATCH 4.9 059/130] mac80211: implement multicast forwarding on fast-RX path Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 061/130] clocksource/exynos_mct: Clear interrupt when cpu is shut down Greg Kroah-Hartman
                     ` (68 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Rock Lee, David Gstir, Richard Weinberger

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

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

From: Richard Weinberger <richard@nod.at>

commit 1cb51a15b576ee325d527726afff40947218fd5e upstream.

When replaying the journal it can happen that a journal entry points to
a garbage collected node.
This is the case when a power-cut occurred between a garbage collect run
and a commit. In such a case nodes have to be read using the failable
read functions to detect whether the found node matches what we expect.

One corner case was forgotten, when the journal contains an entry to
remove an inode all xattrs have to be removed too. UBIFS models xattr
like directory entries, so the TNC code iterates over
all xattrs of the inode and removes them too. This code re-uses the
functions for walking directories and calls ubifs_tnc_next_ent().
ubifs_tnc_next_ent() expects to be used only after the journal and
aborts when a node does not match the expected result. This behavior can
render an UBIFS volume unmountable after a power-cut when xattrs are
used.

Fix this issue by using failable read functions in ubifs_tnc_next_ent()
too when replaying the journal.
Fixes: 1e51764a3c2ac05a ("UBIFS: add new flash file system")
Reported-by: Rock Lee <rockdotlee@gmail.com>
Reviewed-by: David Gstir <david@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ubifs/tnc.c |   25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

--- a/fs/ubifs/tnc.c
+++ b/fs/ubifs/tnc.c
@@ -34,6 +34,11 @@
 #include <linux/slab.h>
 #include "ubifs.h"
 
+static int try_read_node(const struct ubifs_info *c, void *buf, int type,
+			 int len, int lnum, int offs);
+static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key,
+			      struct ubifs_zbranch *zbr, void *node);
+
 /*
  * Returned codes of 'matches_name()' and 'fallible_matches_name()' functions.
  * @NAME_LESS: name corresponding to the first argument is less than second
@@ -402,7 +407,19 @@ static int tnc_read_node_nm(struct ubifs
 		return 0;
 	}
 
-	err = ubifs_tnc_read_node(c, zbr, node);
+	if (c->replaying) {
+		err = fallible_read_node(c, &zbr->key, zbr, node);
+		/*
+		 * When the node was not found, return -ENOENT, 0 otherwise.
+		 * Negative return codes stay as-is.
+		 */
+		if (err == 0)
+			err = -ENOENT;
+		else if (err == 1)
+			err = 0;
+	} else {
+		err = ubifs_tnc_read_node(c, zbr, node);
+	}
 	if (err)
 		return err;
 
@@ -2766,7 +2783,11 @@ struct ubifs_dent_node *ubifs_tnc_next_e
 	if (nm->name) {
 		if (err) {
 			/* Handle collisions */
-			err = resolve_collision(c, key, &znode, &n, nm);
+			if (c->replaying)
+				err = fallible_resolve_collision(c, key, &znode, &n,
+							 nm, 0);
+			else
+				err = resolve_collision(c, key, &znode, &n, nm);
 			dbg_tnc("rc returned %d, znode %p, n %d",
 				err, znode, n);
 			if (unlikely(err < 0))

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 061/130] clocksource/exynos_mct: Clear interrupt when cpu is shut down
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (57 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 060/130] ubifs: Fix journal replay wrt. xattr nodes Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 062/130] svcrdma: avoid duplicate dma unmapping during error recovery Greg Kroah-Hartman
                     ` (67 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Seung-Woo Kim, Joonyoung Shim,
	linux-samsung-soc, cw00.choi, daniel.lezcano, javier, kgene,
	krzk, linux-arm-kernel, Thomas Gleixner

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

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

From: Joonyoung Shim <jy0922.shim@samsung.com>

commit bc7c36eedb0c7004aa06c2afc3c5385adada8fa3 upstream.

When a CPU goes offline a potentially pending timer interrupt is not
cleared. When the CPU comes online again then the pending interrupt is
delivered before the per cpu clockevent device is initialized. As a
consequence the tick interrupt handler dereferences a NULL pointer.

[   51.251378] Unable to handle kernel NULL pointer dereference at virtual address 00000040
[   51.289348] task: ee942d00 task.stack: ee960000
[   51.293861] PC is at tick_periodic+0x38/0xb0
[   51.298102] LR is at tick_handle_periodic+0x1c/0x90

Clear the pending interrupt in the cpu dying path.

Fixes: 56a94f13919c ("clocksource: exynos_mct: Avoid blocking calls in the cpu hotplug notifier")
Reported-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Cc: linux-samsung-soc@vger.kernel.org
Cc: cw00.choi@samsung.com
Cc: daniel.lezcano@linaro.org
Cc: javier@osg.samsung.com
Cc: kgene@kernel.org
Cc: krzk@kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/1484628876-22065-1-git-send-email-jy0922.shim@samsung.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/clocksource/exynos_mct.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/clocksource/exynos_mct.c
+++ b/drivers/clocksource/exynos_mct.c
@@ -495,6 +495,7 @@ static int exynos4_mct_dying_cpu(unsigne
 	if (mct_int_type == MCT_INT_SPI) {
 		if (evt->irq != -1)
 			disable_irq_nosync(evt->irq);
+		exynos4_mct_write(0x1, mevt->base + MCT_L_INT_CSTAT_OFFSET);
 	} else {
 		disable_percpu_irq(mct_irqs[MCT_L0_IRQ]);
 	}

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 062/130] svcrdma: avoid duplicate dma unmapping during error recovery
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (58 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 061/130] clocksource/exynos_mct: Clear interrupt when cpu is shut down Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 063/130] ARM: 8634/1: hw_breakpoint: blacklist Scorpion CPUs Greg Kroah-Hartman
                     ` (66 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Sriharsha Basavapatna, Chuck Lever,
	Yuval Shaia, J. Bruce Fields

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

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

From: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>

commit ce1ca7d2d140a1f4aaffd297ac487f246963dd2f upstream.

In rdma_read_chunk_frmr() when ib_post_send() fails, the error code path
invokes ib_dma_unmap_sg() to unmap the sg list. It then invokes
svc_rdma_put_frmr() which in turn tries to unmap the same sg list through
ib_dma_unmap_sg() again. This second unmap is invalid and could lead to
problems when the iova being unmapped is subsequently reused. Remove
the call to unmap in rdma_read_chunk_frmr() and let svc_rdma_put_frmr()
handle it.

Fixes: 412a15c0fe53 ("svcrdma: Port to new memory registration API")
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/sunrpc/xprtrdma/svc_rdma_recvfrom.c |    2 --
 1 file changed, 2 deletions(-)

--- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
@@ -348,8 +348,6 @@ int rdma_read_chunk_frmr(struct svcxprt_
 	atomic_inc(&rdma_stat_read);
 	return ret;
  err:
-	ib_dma_unmap_sg(xprt->sc_cm_id->device,
-			frmr->sg, frmr->sg_nents, frmr->direction);
 	svc_rdma_put_context(ctxt, 0);
 	svc_rdma_put_frmr(xprt, frmr);
 	return ret;

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 063/130] ARM: 8634/1: hw_breakpoint: blacklist Scorpion CPUs
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (59 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 062/130] svcrdma: avoid duplicate dma unmapping during error recovery Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 064/130] ibmvscsis: Fix sleeping in interrupt context Greg Kroah-Hartman
                     ` (65 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Mark Rutland, Linus Walleij,
	Stephen Boyd, Will Deacon, Russell King, Russell King

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

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

From: Mark Rutland <mark.rutland@arm.com>

commit ddc37832a1349f474c4532de381498020ed71d31 upstream.

On APQ8060, the kernel crashes in arch_hw_breakpoint_init, taking an
undefined instruction trap within write_wb_reg. This is because Scorpion
CPUs erroneously appear to set DBGPRSR.SPD when WFI is issued, even if
the core is not powered down. When DBGPRSR.SPD is set, breakpoint and
watchpoint registers are treated as undefined.

It's possible to trigger similar crashes later on from userspace, by
requesting the kernel to install a breakpoint or watchpoint, as we can
go idle at any point between the reset of the debug registers and their
later use. This has always been the case.

Given that this has always been broken, no-one has complained until now,
and there is no clear workaround, disable hardware breakpoints and
watchpoints on Scorpion to avoid these issues.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Reported-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Cc: Russell King <linux@armlinux.org.uk>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/include/asm/cputype.h  |    3 +++
 arch/arm/kernel/hw_breakpoint.c |   16 ++++++++++++++++
 2 files changed, 19 insertions(+)

--- a/arch/arm/include/asm/cputype.h
+++ b/arch/arm/include/asm/cputype.h
@@ -94,6 +94,9 @@
 #define ARM_CPU_XSCALE_ARCH_V2		0x4000
 #define ARM_CPU_XSCALE_ARCH_V3		0x6000
 
+/* Qualcomm implemented cores */
+#define ARM_CPU_PART_SCORPION		0x510002d0
+
 extern unsigned int processor_id;
 
 #ifdef CONFIG_CPU_CP15
--- a/arch/arm/kernel/hw_breakpoint.c
+++ b/arch/arm/kernel/hw_breakpoint.c
@@ -1066,6 +1066,22 @@ static int __init arch_hw_breakpoint_ini
 		return 0;
 	}
 
+	/*
+	 * Scorpion CPUs (at least those in APQ8060) seem to set DBGPRSR.SPD
+	 * whenever a WFI is issued, even if the core is not powered down, in
+	 * violation of the architecture.  When DBGPRSR.SPD is set, accesses to
+	 * breakpoint and watchpoint registers are treated as undefined, so
+	 * this results in boot time and runtime failures when these are
+	 * accessed and we unexpectedly take a trap.
+	 *
+	 * It's not clear if/how this can be worked around, so we blacklist
+	 * Scorpion CPUs to avoid these issues.
+	*/
+	if (read_cpuid_part() == ARM_CPU_PART_SCORPION) {
+		pr_info("Scorpion CPU detected. Hardware breakpoints and watchpoints disabled\n");
+		return 0;
+	}
+
 	has_ossr = core_has_os_save_restore();
 
 	/* Determine how many BRPs/WRPs are available. */

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 064/130] ibmvscsis: Fix sleeping in interrupt context
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (60 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 063/130] ARM: 8634/1: hw_breakpoint: blacklist Scorpion CPUs Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 065/130] ibmvscsis: Fix max transfer length Greg Kroah-Hartman
                     ` (64 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Steven Royer, Michael Cyr,
	Bryant G. Ly, Bart Van Assche

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

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

From: Bryant G. Ly <bryantly@linux.vnet.ibm.com>

commit a5b0e4062fb225155189e593699bbfcd0597f8b5 upstream.

Currently, dma_alloc_coherent is being called with a GFP_KERNEL
flag which allows it to sleep in an interrupt context, need to
change to GFP_ATOMIC.

Tested-by: Steven Royer <seroyer@linux.vnet.ibm.com>
Reviewed-by: Michael Cyr <mikecyr@linux.vnet.ibm.com>
Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
@@ -1239,7 +1239,7 @@ static long ibmvscsis_adapter_info(struc
 	}
 
 	info = dma_alloc_coherent(&vscsi->dma_dev->dev, sizeof(*info), &token,
-				  GFP_KERNEL);
+				  GFP_ATOMIC);
 	if (!info) {
 		dev_err(&vscsi->dev, "bad dma_alloc_coherent %p\n",
 			iue->target);
@@ -1357,7 +1357,7 @@ static int ibmvscsis_cap_mad(struct scsi
 	}
 
 	cap = dma_alloc_coherent(&vscsi->dma_dev->dev, olen, &token,
-				 GFP_KERNEL);
+				 GFP_ATOMIC);
 	if (!cap) {
 		dev_err(&vscsi->dev, "bad dma_alloc_coherent %p\n",
 			iue->target);

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 065/130] ibmvscsis: Fix max transfer length
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (61 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 064/130] ibmvscsis: Fix sleeping in interrupt context Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 066/130] ceph: fix bad endianness handling in parse_reply_info_extra Greg Kroah-Hartman
                     ` (63 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Steven Royer, Bryant G. Ly, Bart Van Assche

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

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

From: Bryant G. Ly <bryantly@linux.vnet.ibm.com>

commit 387b978cb0d12cf3720ecb17e652e0a9991a08e2 upstream.

Current code incorrectly calculates the max transfer length, since
it is assuming a 4k page table, but ppc64 all run on 64k page tables.

Reported-by: Steven Royer <seroyer@linux.vnet.ibm.com>
Tested-by: Steven Royer <seroyer@linux.vnet.ibm.com>
Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
@@ -45,6 +45,7 @@
 
 #define	INITIAL_SRP_LIMIT	800
 #define	DEFAULT_MAX_SECTORS	256
+#define MAX_TXU			1024 * 1024
 
 static uint max_vdma_size = MAX_H_COPY_RDMA;
 
@@ -1291,7 +1292,7 @@ static long ibmvscsis_adapter_info(struc
 	info->mad_version = cpu_to_be32(MAD_VERSION_1);
 	info->os_type = cpu_to_be32(LINUX);
 	memset(&info->port_max_txu[0], 0, sizeof(info->port_max_txu));
-	info->port_max_txu[0] = cpu_to_be32(128 * PAGE_SIZE);
+	info->port_max_txu[0] = cpu_to_be32(MAX_TXU);
 
 	dma_wmb();
 	rc = h_copy_rdma(sizeof(*info), vscsi->dds.window[LOCAL].liobn,

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 066/130] ceph: fix bad endianness handling in parse_reply_info_extra
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (62 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 065/130] ibmvscsis: Fix max transfer length Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 067/130] ARM: dts: OMAP5 / DRA7: indicate that SATA port 0 is available Greg Kroah-Hartman
                     ` (62 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jeff Layton, Sage Weil, Ilya Dryomov

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

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

From: Jeff Layton <jlayton@redhat.com>

commit 6df8c9d80a27cb587f61b4f06b57e248d8bc3f86 upstream.

sparse says:

    fs/ceph/mds_client.c:291:23: warning: restricted __le32 degrades to integer
    fs/ceph/mds_client.c:293:28: warning: restricted __le32 degrades to integer
    fs/ceph/mds_client.c:294:28: warning: restricted __le32 degrades to integer
    fs/ceph/mds_client.c:296:28: warning: restricted __le32 degrades to integer

The op value is __le32, so we need to convert it before comparing it.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Sage Weil <sage@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ceph/mds_client.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -288,12 +288,13 @@ static int parse_reply_info_extra(void *
 				  struct ceph_mds_reply_info_parsed *info,
 				  u64 features)
 {
-	if (info->head->op == CEPH_MDS_OP_GETFILELOCK)
+	u32 op = le32_to_cpu(info->head->op);
+
+	if (op == CEPH_MDS_OP_GETFILELOCK)
 		return parse_reply_info_filelock(p, end, info, features);
-	else if (info->head->op == CEPH_MDS_OP_READDIR ||
-		 info->head->op == CEPH_MDS_OP_LSSNAP)
+	else if (op == CEPH_MDS_OP_READDIR || op == CEPH_MDS_OP_LSSNAP)
 		return parse_reply_info_dir(p, end, info, features);
-	else if (info->head->op == CEPH_MDS_OP_CREATE)
+	else if (op == CEPH_MDS_OP_CREATE)
 		return parse_reply_info_create(p, end, info, features);
 	else
 		return -EIO;

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 067/130] ARM: dts: OMAP5 / DRA7: indicate that SATA port 0 is available.
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (63 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 066/130] ceph: fix bad endianness handling in parse_reply_info_extra Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 068/130] ARM: dts: da850-evm: fix read access to SPI flash Greg Kroah-Hartman
                     ` (61 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jean-Jacques Hiblot, Roger Quadros,
	Tony Lindgren

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

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

From: Jean-Jacques Hiblot <jjhiblot@ti.com>

commit 87cb12910a2ab6ed41ae951ea4d9c1cc1120199a upstream.

AHCI provides the register PORTS_IMPL to let the software know which port
is supported. The register must be initialized by the bootloader. However
in some cases u-boot doesn't properly initialize this value (if it is not
compiled with SATA support for example or if the SATA initialization fails).
The DTS entry "ports-implemented" can be used to override the value in
PORTS_IMPL.

Without this patch the SATA will not work in the following two cases:

* if there has been a failure to initialize SATA in u-boot.

* if ahci_platform module has been removed and re-inserted. The reason is
  that the content of PORTS_IMPL is lost after the module is removed.
  I suspect that it's because the controller is reset by the hwmod.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Acked-by: Roger Quadros <rogerq@ti.com>
[tony@atomide.com: updated comments with what goes wrong]
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/dra7.dtsi  |    1 +
 arch/arm/boot/dts/omap5.dtsi |    1 +
 2 files changed, 2 insertions(+)

--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -1376,6 +1376,7 @@
 			phy-names = "sata-phy";
 			clocks = <&sata_ref_clk>;
 			ti,hwmods = "sata";
+			ports-implemented = <0x1>;
 		};
 
 		rtc: rtc@48838000 {
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -985,6 +985,7 @@
 			phy-names = "sata-phy";
 			clocks = <&sata_ref_clk>;
 			ti,hwmods = "sata";
+			ports-implemented = <0x1>;
 		};
 
 		dss: dss@58000000 {

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 068/130] ARM: dts: da850-evm: fix read access to SPI flash
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (64 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 067/130] ARM: dts: OMAP5 / DRA7: indicate that SATA port 0 is available Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 069/130] arm64: avoid returning from bad_mode Greg Kroah-Hartman
                     ` (60 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Kevin Hilman, Fabien Parent,
	Sekhar Nori, Olof Johansson

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

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

From: Fabien Parent <fparent@baylibre.com>

commit 43849785e1079f6606a31cb7fda92d1200849728 upstream.

Read access to the SPI flash are broken on da850-evm, i.e. the data
read is not what is actually programmed on the flash.
According to the datasheet for the M25P64 part present on the da850-evm,
if the SPI frequency is higher than 20MHz then the READ command is not
usable anymore and only the FAST_READ command can be used to read data.

This commit specifies in the DTS that we should use FAST_READ command
instead of the READ command.

Tested-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Fabien Parent <fparent@baylibre.com>
[nsekhar@ti.com: subject line adjustment]
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Olof Johansson <olof@lixom.net>

---
 arch/arm/boot/dts/da850-evm.dts |    1 +
 1 file changed, 1 insertion(+)

--- a/arch/arm/boot/dts/da850-evm.dts
+++ b/arch/arm/boot/dts/da850-evm.dts
@@ -99,6 +99,7 @@
 				#size-cells = <1>;
 				compatible = "m25p64";
 				spi-max-frequency = <30000000>;
+				m25p,fast-read;
 				reg = <0>;
 				partition@0 {
 					label = "U-Boot-SPL";

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 069/130] arm64: avoid returning from bad_mode
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (65 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 068/130] ARM: dts: da850-evm: fix read access to SPI flash Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 070/130] arm64/ptrace: Preserve previous registers for short regset write Greg Kroah-Hartman
                     ` (59 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Mark Rutland, Mark Salter,
	Will Deacon, Catalin Marinas

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

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

From: Mark Rutland <mark.rutland@arm.com>

commit 7d9e8f71b989230bc613d121ca38507d34ada849 upstream.

Generally, taking an unexpected exception should be a fatal event, and
bad_mode is intended to cater for this. However, it should be possible
to contain unexpected synchronous exceptions from EL0 without bringing
the kernel down, by sending a SIGILL to the task.

We tried to apply this approach in commit 9955ac47f4ba1c95 ("arm64:
don't kill the kernel on a bad esr from el0"), by sending a signal for
any bad_mode call resulting from an EL0 exception.

However, this also applies to other unexpected exceptions, such as
SError and FIQ. The entry paths for these exceptions branch to bad_mode
without configuring the link register, and have no kernel_exit. Thus, if
we take one of these exceptions from EL0, bad_mode will eventually
return to the original user link register value.

This patch fixes this by introducing a new bad_el0_sync handler to cater
for the recoverable case, and restoring bad_mode to its original state,
whereby it calls panic() and never returns. The recoverable case
branches to bad_el0_sync with a bl, and returns to userspace via the
usual ret_to_user mechanism.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Fixes: 9955ac47f4ba1c95 ("arm64: don't kill the kernel on a bad esr from el0")
Reported-by: Mark Salter <msalter@redhat.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/kernel/entry.S |    2 +-
 arch/arm64/kernel/traps.c |   28 ++++++++++++++++++++++++----
 2 files changed, 25 insertions(+), 5 deletions(-)

--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -624,7 +624,7 @@ el0_inv:
 	mov	x0, sp
 	mov	x1, #BAD_SYNC
 	mov	x2, x25
-	bl	bad_mode
+	bl	bad_el0_sync
 	b	ret_to_user
 ENDPROC(el0_sync)
 
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -596,17 +596,34 @@ const char *esr_get_class_string(u32 esr
 }
 
 /*
- * bad_mode handles the impossible case in the exception vector.
+ * bad_mode handles the impossible case in the exception vector. This is always
+ * fatal.
  */
 asmlinkage void bad_mode(struct pt_regs *regs, int reason, unsigned int esr)
 {
-	siginfo_t info;
-	void __user *pc = (void __user *)instruction_pointer(regs);
 	console_verbose();
 
 	pr_crit("Bad mode in %s handler detected on CPU%d, code 0x%08x -- %s\n",
 		handler[reason], smp_processor_id(), esr,
 		esr_get_class_string(esr));
+
+	die("Oops - bad mode", regs, 0);
+	local_irq_disable();
+	panic("bad mode");
+}
+
+/*
+ * bad_el0_sync handles unexpected, but potentially recoverable synchronous
+ * exceptions taken from EL0. Unlike bad_mode, this returns.
+ */
+asmlinkage void bad_el0_sync(struct pt_regs *regs, int reason, unsigned int esr)
+{
+	siginfo_t info;
+	void __user *pc = (void __user *)instruction_pointer(regs);
+	console_verbose();
+
+	pr_crit("Bad EL0 synchronous exception detected on CPU%d, code 0x%08x -- %s\n",
+		smp_processor_id(), esr, esr_get_class_string(esr));
 	__show_regs(regs);
 
 	info.si_signo = SIGILL;
@@ -614,7 +631,10 @@ asmlinkage void bad_mode(struct pt_regs
 	info.si_code  = ILL_ILLOPC;
 	info.si_addr  = pc;
 
-	arm64_notify_die("Oops - bad mode", regs, &info, 0);
+	current->thread.fault_address = 0;
+	current->thread.fault_code = 0;
+
+	force_sig_info(info.si_signo, &info, current);
 }
 
 void __pte_error(const char *file, int line, unsigned long val)

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 070/130] arm64/ptrace: Preserve previous registers for short regset write
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (66 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 069/130] arm64: avoid returning from bad_mode Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 071/130] arm64/ptrace: Preserve previous registers for short regset write - 2 Greg Kroah-Hartman
                     ` (58 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dave Martin, Will Deacon, Catalin Marinas

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

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

From: Dave Martin <Dave.Martin@arm.com>

commit 9a17b876b573441bfb3387ad55d98bf7184daf9d upstream.

Ensure that if userspace supplies insufficient data to
PTRACE_SETREGSET to fill all the registers, the thread's old
registers are preserved.

Fixes: 478fcb2cdb23 ("arm64: Debugging support")
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Acked-by: Will Deacon <Will.Deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/kernel/ptrace.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -595,7 +595,7 @@ static int gpr_set(struct task_struct *t
 		   const void *kbuf, const void __user *ubuf)
 {
 	int ret;
-	struct user_pt_regs newregs;
+	struct user_pt_regs newregs = task_pt_regs(target)->user_regs;
 
 	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &newregs, 0, -1);
 	if (ret)
@@ -625,7 +625,8 @@ static int fpr_set(struct task_struct *t
 		   const void *kbuf, const void __user *ubuf)
 {
 	int ret;
-	struct user_fpsimd_state newstate;
+	struct user_fpsimd_state newstate =
+		target->thread.fpsimd_state.user_fpsimd;
 
 	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &newstate, 0, -1);
 	if (ret)
@@ -649,7 +650,7 @@ static int tls_set(struct task_struct *t
 		   const void *kbuf, const void __user *ubuf)
 {
 	int ret;
-	unsigned long tls;
+	unsigned long tls = target->thread.tp_value;
 
 	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &tls, 0, -1);
 	if (ret)

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 071/130] arm64/ptrace: Preserve previous registers for short regset write - 2
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (67 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 070/130] arm64/ptrace: Preserve previous registers for short regset write Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 072/130] arm64/ptrace: Preserve previous registers for short regset write - 3 Greg Kroah-Hartman
                     ` (57 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dave Martin, Will Deacon, Catalin Marinas

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

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

From: Dave Martin <Dave.Martin@arm.com>

commit 9dd73f72f218320c6c90da5f834996e7360dc227 upstream.

Ensure that if userspace supplies insufficient data to
PTRACE_SETREGSET to fill all the registers, the thread's old
registers are preserved.

Fixes: 766a85d7bc5d ("arm64: ptrace: add NT_ARM_SYSTEM_CALL regset")
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Acked-by: Will Deacon <Will.Deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/kernel/ptrace.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -676,7 +676,8 @@ static int system_call_set(struct task_s
 			   unsigned int pos, unsigned int count,
 			   const void *kbuf, const void __user *ubuf)
 {
-	int syscallno, ret;
+	int syscallno = task_pt_regs(target)->syscallno;
+	int ret;
 
 	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &syscallno, 0, -1);
 	if (ret)

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 072/130] arm64/ptrace: Preserve previous registers for short regset write - 3
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (68 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 071/130] arm64/ptrace: Preserve previous registers for short regset write - 2 Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 073/130] arm64/ptrace: Avoid uninitialised struct padding in fpr_set() Greg Kroah-Hartman
                     ` (56 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dave Martin, Will Deacon, Catalin Marinas

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

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

From: Dave Martin <Dave.Martin@arm.com>

commit a672401c00f82e4e19704aff361d9bad18003714 upstream.

Ensure that if userspace supplies insufficient data to
PTRACE_SETREGSET to fill all the registers, the thread's old
registers are preserved.

Fixes: 5d220ff9420f ("arm64: Better native ptrace support for compat tasks")
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Acked-by: Will Deacon <Will.Deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/kernel/ptrace.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -949,7 +949,7 @@ static int compat_tls_set(struct task_st
 			  const void __user *ubuf)
 {
 	int ret;
-	compat_ulong_t tls;
+	compat_ulong_t tls = target->thread.tp_value;
 
 	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &tls, 0, -1);
 	if (ret)

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 073/130] arm64/ptrace: Avoid uninitialised struct padding in fpr_set()
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (69 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 072/130] arm64/ptrace: Preserve previous registers for short regset write - 3 Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 074/130] arm64/ptrace: Reject attempts to set incomplete hardware breakpoint fields Greg Kroah-Hartman
                     ` (55 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dave Martin, Will Deacon, Catalin Marinas

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

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

From: Dave Martin <Dave.Martin@arm.com>

commit aeb1f39d814b2e21e5e5706a48834bfd553d0059 upstream.

This patch adds an explicit __reserved[] field to user_fpsimd_state
to replace what was previously unnamed padding.

This ensures that data in this region are propagated across
assignment rather than being left possibly uninitialised at the
destination.

Fixes: 60ffc30d5652 ("arm64: Exception handling")
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Acked-by: Will Deacon <Will.Deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/include/uapi/asm/ptrace.h |    1 +
 1 file changed, 1 insertion(+)

--- a/arch/arm64/include/uapi/asm/ptrace.h
+++ b/arch/arm64/include/uapi/asm/ptrace.h
@@ -77,6 +77,7 @@ struct user_fpsimd_state {
 	__uint128_t	vregs[32];
 	__u32		fpsr;
 	__u32		fpcr;
+	__u32		__reserved[2];
 };
 
 struct user_hwdebug_state {

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 074/130] arm64/ptrace: Reject attempts to set incomplete hardware breakpoint fields
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (70 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 073/130] arm64/ptrace: Avoid uninitialised struct padding in fpr_set() Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 076/130] libceph: ceph_x_encrypt_buflen() takes in_len Greg Kroah-Hartman
                     ` (54 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dave Martin, Will Deacon, Catalin Marinas

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

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

From: Dave Martin <Dave.Martin@arm.com>

commit ad9e202aa1ce571b1d7fed969d06f66067f8a086 upstream.

We cannot preserve partial fields for hardware breakpoints, because
the values written by userspace to the hardware breakpoint
registers can't subsequently be recovered intact from the hardware.

So, just reject attempts to write incomplete fields with -EINVAL.

Fixes: 478fcb2cdb23 ("arm64: Debugging support")
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Acked-by: Will Deacon <Will.Deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/kernel/ptrace.c |    4 ++++
 1 file changed, 4 insertions(+)

--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -550,6 +550,8 @@ static int hw_break_set(struct task_stru
 	/* (address, ctrl) registers */
 	limit = regset->n * regset->size;
 	while (count && offset < limit) {
+		if (count < PTRACE_HBP_ADDR_SZ)
+			return -EINVAL;
 		ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &addr,
 					 offset, offset + PTRACE_HBP_ADDR_SZ);
 		if (ret)
@@ -559,6 +561,8 @@ static int hw_break_set(struct task_stru
 			return ret;
 		offset += PTRACE_HBP_ADDR_SZ;
 
+		if (!count)
+			break;
 		ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &ctrl,
 					 offset, offset + PTRACE_HBP_CTRL_SZ);
 		if (ret)

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 076/130] libceph: ceph_x_encrypt_buflen() takes in_len
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (71 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 074/130] arm64/ptrace: Reject attempts to set incomplete hardware breakpoint fields Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 077/130] libceph: old_key in process_one_ticket() is redundant Greg Kroah-Hartman
                     ` (53 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ilya Dryomov, Sage Weil

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

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

From: Ilya Dryomov <idryomov@gmail.com>

commit 36721ece1e84a25130c4befb930509b3f96de020 upstream.

Pass what's going to be encrypted - that's msg_b, not ticket_blob.
ceph_x_encrypt_buflen() returns the upper bound, so this doesn't change
the maxlen calculation, but makes it a bit clearer.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Sage Weil <sage@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/ceph/auth_x.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/net/ceph/auth_x.c
+++ b/net/ceph/auth_x.c
@@ -308,8 +308,8 @@ static int ceph_x_build_authorizer(struc
 	if (ret)
 		goto out_au;
 
-	maxlen = sizeof(*msg_a) + sizeof(msg_b) +
-		ceph_x_encrypt_buflen(ticket_blob_len);
+	maxlen = sizeof(*msg_a) + ticket_blob_len +
+		ceph_x_encrypt_buflen(sizeof(msg_b));
 	dout("  need len %d\n", maxlen);
 	if (au->buf && au->buf->alloc_len < maxlen) {
 		ceph_buffer_put(au->buf);
@@ -350,11 +350,12 @@ static int ceph_x_build_authorizer(struc
 			     p, end - p);
 	if (ret < 0)
 		goto out_au;
+
 	p += ret;
+	WARN_ON(p > end);
 	au->buf->vec.iov_len = p - au->buf->vec.iov_base;
 	dout(" built authorizer nonce %llx len %d\n", au->nonce,
 	     (int)au->buf->vec.iov_len);
-	BUG_ON(au->buf->vec.iov_len > maxlen);
 	return 0;
 
 out_au:

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 077/130] libceph: old_key in process_one_ticket() is redundant
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (72 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 076/130] libceph: ceph_x_encrypt_buflen() takes in_len Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 078/130] libceph: introduce ceph_x_encrypt_offset() Greg Kroah-Hartman
                     ` (52 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ilya Dryomov, Sage Weil

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

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

From: Ilya Dryomov <idryomov@gmail.com>

commit 462e650451c577d15eeb4d883d70fa9e4e529fad upstream.

Since commit 0a990e709356 ("ceph: clean up service ticket decoding"),
th->session_key isn't assigned until everything is decoded.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Sage Weil <sage@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/ceph/auth_x.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/net/ceph/auth_x.c
+++ b/net/ceph/auth_x.c
@@ -148,7 +148,6 @@ static int process_one_ticket(struct cep
 	int dlen;
 	char is_enc;
 	struct timespec validity;
-	struct ceph_crypto_key old_key;
 	void *ticket_buf = NULL;
 	void *tp, *tpend;
 	void **ptp;
@@ -187,7 +186,6 @@ static int process_one_ticket(struct cep
 	if (tkt_struct_v != 1)
 		goto bad;
 
-	memcpy(&old_key, &th->session_key, sizeof(old_key));
 	ret = ceph_crypto_key_decode(&new_session_key, &dp, dend);
 	if (ret)
 		goto out;
@@ -204,7 +202,7 @@ static int process_one_ticket(struct cep
 	if (is_enc) {
 		/* encrypted */
 		dout(" encrypted ticket\n");
-		dlen = ceph_x_decrypt(&old_key, p, end, &ticket_buf, 0);
+		dlen = ceph_x_decrypt(&th->session_key, p, end, &ticket_buf, 0);
 		if (dlen < 0) {
 			ret = dlen;
 			goto out;

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 078/130] libceph: introduce ceph_x_encrypt_offset()
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (73 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 077/130] libceph: old_key in process_one_ticket() is redundant Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 079/130] libceph: introduce ceph_crypt() for in-place en/decryption Greg Kroah-Hartman
                     ` (51 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ilya Dryomov, Sage Weil

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

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

From: Ilya Dryomov <idryomov@gmail.com>

commit 55d9cc834f933698fc864f0d36f3cca533d30a8d upstream.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Sage Weil <sage@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/ceph/auth_x.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/net/ceph/auth_x.c
+++ b/net/ceph/auth_x.c
@@ -39,10 +39,14 @@ static int ceph_x_should_authenticate(st
 	return need != 0;
 }
 
+static int ceph_x_encrypt_offset(void)
+{
+	return sizeof(u32) + sizeof(struct ceph_x_encrypt_header);
+}
+
 static int ceph_x_encrypt_buflen(int ilen)
 {
-	return sizeof(struct ceph_x_encrypt_header) + ilen + 16 +
-		sizeof(u32);
+	return ceph_x_encrypt_offset() + ilen + 16;
 }
 
 static int ceph_x_encrypt(struct ceph_crypto_key *secret,

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 079/130] libceph: introduce ceph_crypt() for in-place en/decryption
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (74 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 078/130] libceph: introduce ceph_x_encrypt_offset() Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 080/130] libceph: rename and align ceph_x_authorizer::reply_buf Greg Kroah-Hartman
                     ` (50 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ilya Dryomov, Sage Weil

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

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

From: Ilya Dryomov <idryomov@gmail.com>

commit a45f795c65b479b4ba107b6ccde29b896d51ee98 upstream.

Starting with 4.9, kernel stacks may be vmalloced and therefore not
guaranteed to be physically contiguous; the new CONFIG_VMAP_STACK
option is enabled by default on x86.  This makes it invalid to use
on-stack buffers with the crypto scatterlist API, as sg_set_buf()
expects a logical address and won't work with vmalloced addresses.

There isn't a different (e.g. kvec-based) crypto API we could switch
net/ceph/crypto.c to and the current scatterlist.h API isn't getting
updated to accommodate this use case.  Allocating a new header and
padding for each operation is a non-starter, so do the en/decryption
in-place on a single pre-assembled (header + data + padding) heap
buffer.  This is explicitly supported by the crypto API:

    "... the caller may provide the same scatter/gather list for the
     plaintext and cipher text. After the completion of the cipher
     operation, the plaintext data is replaced with the ciphertext data
     in case of an encryption and vice versa for a decryption."

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Sage Weil <sage@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/ceph/crypto.c |   87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 net/ceph/crypto.h |    2 +
 2 files changed, 89 insertions(+)

--- a/net/ceph/crypto.c
+++ b/net/ceph/crypto.c
@@ -526,6 +526,93 @@ int ceph_encrypt2(struct ceph_crypto_key
 	}
 }
 
+static int ceph_aes_crypt(const struct ceph_crypto_key *key, bool encrypt,
+			  void *buf, int buf_len, int in_len, int *pout_len)
+{
+	struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher();
+	SKCIPHER_REQUEST_ON_STACK(req, tfm);
+	struct sg_table sgt;
+	struct scatterlist prealloc_sg;
+	char iv[AES_BLOCK_SIZE];
+	int pad_byte = AES_BLOCK_SIZE - (in_len & (AES_BLOCK_SIZE - 1));
+	int crypt_len = encrypt ? in_len + pad_byte : in_len;
+	int ret;
+
+	if (IS_ERR(tfm))
+		return PTR_ERR(tfm);
+
+	WARN_ON(crypt_len > buf_len);
+	if (encrypt)
+		memset(buf + in_len, pad_byte, pad_byte);
+	ret = setup_sgtable(&sgt, &prealloc_sg, buf, crypt_len);
+	if (ret)
+		goto out_tfm;
+
+	crypto_skcipher_setkey((void *)tfm, key->key, key->len);
+	memcpy(iv, aes_iv, AES_BLOCK_SIZE);
+
+	skcipher_request_set_tfm(req, tfm);
+	skcipher_request_set_callback(req, 0, NULL, NULL);
+	skcipher_request_set_crypt(req, sgt.sgl, sgt.sgl, crypt_len, iv);
+
+	/*
+	print_hex_dump(KERN_ERR, "key: ", DUMP_PREFIX_NONE, 16, 1,
+		       key->key, key->len, 1);
+	print_hex_dump(KERN_ERR, " in: ", DUMP_PREFIX_NONE, 16, 1,
+		       buf, crypt_len, 1);
+	*/
+	if (encrypt)
+		ret = crypto_skcipher_encrypt(req);
+	else
+		ret = crypto_skcipher_decrypt(req);
+	skcipher_request_zero(req);
+	if (ret) {
+		pr_err("%s %scrypt failed: %d\n", __func__,
+		       encrypt ? "en" : "de", ret);
+		goto out_sgt;
+	}
+	/*
+	print_hex_dump(KERN_ERR, "out: ", DUMP_PREFIX_NONE, 16, 1,
+		       buf, crypt_len, 1);
+	*/
+
+	if (encrypt) {
+		*pout_len = crypt_len;
+	} else {
+		pad_byte = *(char *)(buf + in_len - 1);
+		if (pad_byte > 0 && pad_byte <= AES_BLOCK_SIZE &&
+		    in_len >= pad_byte) {
+			*pout_len = in_len - pad_byte;
+		} else {
+			pr_err("%s got bad padding %d on in_len %d\n",
+			       __func__, pad_byte, in_len);
+			ret = -EPERM;
+			goto out_sgt;
+		}
+	}
+
+out_sgt:
+	teardown_sgtable(&sgt);
+out_tfm:
+	crypto_free_skcipher(tfm);
+	return ret;
+}
+
+int ceph_crypt(const struct ceph_crypto_key *key, bool encrypt,
+	       void *buf, int buf_len, int in_len, int *pout_len)
+{
+	switch (key->type) {
+	case CEPH_CRYPTO_NONE:
+		*pout_len = in_len;
+		return 0;
+	case CEPH_CRYPTO_AES:
+		return ceph_aes_crypt(key, encrypt, buf, buf_len, in_len,
+				      pout_len);
+	default:
+		return -ENOTSUPP;
+	}
+}
+
 static int ceph_key_preparse(struct key_preparsed_payload *prep)
 {
 	struct ceph_crypto_key *ckey;
--- a/net/ceph/crypto.h
+++ b/net/ceph/crypto.h
@@ -43,6 +43,8 @@ int ceph_encrypt2(struct ceph_crypto_key
 		  void *dst, size_t *dst_len,
 		  const void *src1, size_t src1_len,
 		  const void *src2, size_t src2_len);
+int ceph_crypt(const struct ceph_crypto_key *key, bool encrypt,
+	       void *buf, int buf_len, int in_len, int *pout_len);
 int ceph_crypto_init(void);
 void ceph_crypto_shutdown(void);
 

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 080/130] libceph: rename and align ceph_x_authorizer::reply_buf
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (75 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 079/130] libceph: introduce ceph_crypt() for in-place en/decryption Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 081/130] libceph: tweak calcu_signature() a little Greg Kroah-Hartman
                     ` (49 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ilya Dryomov, Sage Weil

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

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

From: Ilya Dryomov <idryomov@gmail.com>

commit 7882a26d2e2e520099e2961d5e2e870f8e4172dc upstream.

It's going to be used as a temporary buffer for in-place en/decryption
with ceph_crypt() instead of on-stack buffers, so rename to enc_buf.
Ensure alignment to avoid GFP_ATOMIC allocations in the crypto stack.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Sage Weil <sage@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/ceph/auth_x.c |   10 +++++-----
 net/ceph/auth_x.h |    3 ++-
 2 files changed, 7 insertions(+), 6 deletions(-)

--- a/net/ceph/auth_x.c
+++ b/net/ceph/auth_x.c
@@ -603,8 +603,8 @@ static int ceph_x_create_authorizer(
 	auth->authorizer = (struct ceph_authorizer *) au;
 	auth->authorizer_buf = au->buf->vec.iov_base;
 	auth->authorizer_buf_len = au->buf->vec.iov_len;
-	auth->authorizer_reply_buf = au->reply_buf;
-	auth->authorizer_reply_buf_len = sizeof (au->reply_buf);
+	auth->authorizer_reply_buf = au->enc_buf;
+	auth->authorizer_reply_buf_len = CEPHX_AU_ENC_BUF_LEN;
 	auth->sign_message = ac->ops->sign_message;
 	auth->check_message_signature = ac->ops->check_message_signature;
 
@@ -638,10 +638,10 @@ static int ceph_x_verify_authorizer_repl
 	int ret = 0;
 	struct ceph_x_authorize_reply reply;
 	void *preply = &reply;
-	void *p = au->reply_buf;
-	void *end = p + sizeof(au->reply_buf);
+	void *p = au->enc_buf;
 
-	ret = ceph_x_decrypt(&au->session_key, &p, end, &preply, sizeof(reply));
+	ret = ceph_x_decrypt(&au->session_key, &p, p + CEPHX_AU_ENC_BUF_LEN,
+			     &preply, sizeof(reply));
 	if (ret < 0)
 		return ret;
 	if (ret != sizeof(reply))
--- a/net/ceph/auth_x.h
+++ b/net/ceph/auth_x.h
@@ -24,6 +24,7 @@ struct ceph_x_ticket_handler {
 	unsigned long renew_after, expires;
 };
 
+#define CEPHX_AU_ENC_BUF_LEN	128  /* big enough for encrypted blob */
 
 struct ceph_x_authorizer {
 	struct ceph_authorizer base;
@@ -32,7 +33,7 @@ struct ceph_x_authorizer {
 	unsigned int service;
 	u64 nonce;
 	u64 secret_id;
-	char reply_buf[128];  /* big enough for encrypted blob */
+	char enc_buf[CEPHX_AU_ENC_BUF_LEN] __aligned(8);
 };
 
 struct ceph_x_info {

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 081/130] libceph: tweak calcu_signature() a little
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (76 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 080/130] libceph: rename and align ceph_x_authorizer::reply_buf Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 082/130] libceph: switch ceph_x_encrypt() to ceph_crypt() Greg Kroah-Hartman
                     ` (48 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ilya Dryomov, Sage Weil

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

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

From: Ilya Dryomov <idryomov@gmail.com>

commit 4eb4517ce7c9c573b6c823de403aeccb40018cfc upstream.

- replace an ad-hoc array with a struct
- rename to calc_signature() for consistency

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Sage Weil <sage@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/ceph/auth_x.c |   43 ++++++++++++++++++++++++++++---------------
 1 file changed, 28 insertions(+), 15 deletions(-)

--- a/net/ceph/auth_x.c
+++ b/net/ceph/auth_x.c
@@ -707,35 +707,48 @@ static void ceph_x_invalidate_authorizer
 	invalidate_ticket(ac, CEPH_ENTITY_TYPE_AUTH);
 }
 
-static int calcu_signature(struct ceph_x_authorizer *au,
-			   struct ceph_msg *msg, __le64 *sig)
+static int calc_signature(struct ceph_x_authorizer *au, struct ceph_msg *msg,
+			  __le64 *psig)
 {
-	int ret;
 	char tmp_enc[40];
-	__le32 tmp[5] = {
-		cpu_to_le32(16), msg->hdr.crc, msg->footer.front_crc,
-		msg->footer.middle_crc, msg->footer.data_crc,
-	};
-	ret = ceph_x_encrypt(&au->session_key, &tmp, sizeof(tmp),
+	struct {
+		__le32 len;
+		__le32 header_crc;
+		__le32 front_crc;
+		__le32 middle_crc;
+		__le32 data_crc;
+	} __packed sigblock;
+	int ret;
+
+	sigblock.len = cpu_to_le32(4*sizeof(u32));
+	sigblock.header_crc = msg->hdr.crc;
+	sigblock.front_crc = msg->footer.front_crc;
+	sigblock.middle_crc = msg->footer.middle_crc;
+	sigblock.data_crc =  msg->footer.data_crc;
+	ret = ceph_x_encrypt(&au->session_key, &sigblock, sizeof(sigblock),
 			     tmp_enc, sizeof(tmp_enc));
 	if (ret < 0)
 		return ret;
-	*sig = *(__le64*)(tmp_enc + 4);
+
+	*psig = *(__le64 *)(tmp_enc + sizeof(u32));
 	return 0;
 }
 
 static int ceph_x_sign_message(struct ceph_auth_handshake *auth,
 			       struct ceph_msg *msg)
 {
+	__le64 sig;
 	int ret;
 
 	if (ceph_test_opt(from_msgr(msg->con->msgr), NOMSGSIGN))
 		return 0;
 
-	ret = calcu_signature((struct ceph_x_authorizer *)auth->authorizer,
-			      msg, &msg->footer.sig);
-	if (ret < 0)
+	ret = calc_signature((struct ceph_x_authorizer *)auth->authorizer,
+			     msg, &sig);
+	if (ret)
 		return ret;
+
+	msg->footer.sig = sig;
 	msg->footer.flags |= CEPH_MSG_FOOTER_SIGNED;
 	return 0;
 }
@@ -749,9 +762,9 @@ static int ceph_x_check_message_signatur
 	if (ceph_test_opt(from_msgr(msg->con->msgr), NOMSGSIGN))
 		return 0;
 
-	ret = calcu_signature((struct ceph_x_authorizer *)auth->authorizer,
-			      msg, &sig_check);
-	if (ret < 0)
+	ret = calc_signature((struct ceph_x_authorizer *)auth->authorizer,
+			     msg, &sig_check);
+	if (ret)
 		return ret;
 	if (sig_check == msg->footer.sig)
 		return 0;

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 082/130] libceph: switch ceph_x_encrypt() to ceph_crypt()
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (77 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 081/130] libceph: tweak calcu_signature() a little Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 083/130] libceph: switch ceph_x_decrypt() " Greg Kroah-Hartman
                     ` (47 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ilya Dryomov, Sage Weil

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

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

From: Ilya Dryomov <idryomov@gmail.com>

commit d03857c63bb036edff0aa7a107276360173aca4e upstream.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Sage Weil <sage@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/ceph/auth_x.c |   71 ++++++++++++++++++++++++++++--------------------------
 1 file changed, 37 insertions(+), 34 deletions(-)

--- a/net/ceph/auth_x.c
+++ b/net/ceph/auth_x.c
@@ -49,22 +49,24 @@ static int ceph_x_encrypt_buflen(int ile
 	return ceph_x_encrypt_offset() + ilen + 16;
 }
 
-static int ceph_x_encrypt(struct ceph_crypto_key *secret,
-			  void *ibuf, int ilen, void *obuf, size_t olen)
+static int ceph_x_encrypt(struct ceph_crypto_key *secret, void *buf,
+			  int buf_len, int plaintext_len)
 {
-	struct ceph_x_encrypt_header head = {
-		.struct_v = 1,
-		.magic = cpu_to_le64(CEPHX_ENC_MAGIC)
-	};
-	size_t len = olen - sizeof(u32);
+	struct ceph_x_encrypt_header *hdr = buf + sizeof(u32);
+	int ciphertext_len;
 	int ret;
 
-	ret = ceph_encrypt2(secret, obuf + sizeof(u32), &len,
-			    &head, sizeof(head), ibuf, ilen);
+	hdr->struct_v = 1;
+	hdr->magic = cpu_to_le64(CEPHX_ENC_MAGIC);
+
+	ret = ceph_crypt(secret, true, buf + sizeof(u32), buf_len - sizeof(u32),
+			 plaintext_len + sizeof(struct ceph_x_encrypt_header),
+			 &ciphertext_len);
 	if (ret)
 		return ret;
-	ceph_encode_32(&obuf, len);
-	return len + sizeof(u32);
+
+	ceph_encode_32(&buf, ciphertext_len);
+	return sizeof(u32) + ciphertext_len;
 }
 
 static int ceph_x_decrypt(struct ceph_crypto_key *secret,
@@ -296,7 +298,7 @@ static int ceph_x_build_authorizer(struc
 {
 	int maxlen;
 	struct ceph_x_authorize_a *msg_a;
-	struct ceph_x_authorize_b msg_b;
+	struct ceph_x_authorize_b *msg_b;
 	void *p, *end;
 	int ret;
 	int ticket_blob_len =
@@ -311,7 +313,7 @@ static int ceph_x_build_authorizer(struc
 		goto out_au;
 
 	maxlen = sizeof(*msg_a) + ticket_blob_len +
-		ceph_x_encrypt_buflen(sizeof(msg_b));
+		ceph_x_encrypt_buflen(sizeof(*msg_b));
 	dout("  need len %d\n", maxlen);
 	if (au->buf && au->buf->alloc_len < maxlen) {
 		ceph_buffer_put(au->buf);
@@ -345,11 +347,11 @@ static int ceph_x_build_authorizer(struc
 	p += ticket_blob_len;
 	end = au->buf->vec.iov_base + au->buf->vec.iov_len;
 
+	msg_b = p + ceph_x_encrypt_offset();
+	msg_b->struct_v = 1;
 	get_random_bytes(&au->nonce, sizeof(au->nonce));
-	msg_b.struct_v = 1;
-	msg_b.nonce = cpu_to_le64(au->nonce);
-	ret = ceph_x_encrypt(&au->session_key, &msg_b, sizeof(msg_b),
-			     p, end - p);
+	msg_b->nonce = cpu_to_le64(au->nonce);
+	ret = ceph_x_encrypt(&au->session_key, p, end - p, sizeof(*msg_b));
 	if (ret < 0)
 		goto out_au;
 
@@ -455,8 +457,9 @@ static int ceph_x_build_request(struct c
 	if (need & CEPH_ENTITY_TYPE_AUTH) {
 		struct ceph_x_authenticate *auth = (void *)(head + 1);
 		void *p = auth + 1;
-		struct ceph_x_challenge_blob tmp;
-		char tmp_enc[40];
+		void *enc_buf = xi->auth_authorizer.enc_buf;
+		struct ceph_x_challenge_blob *blob = enc_buf +
+							ceph_x_encrypt_offset();
 		u64 *u;
 
 		if (p > end)
@@ -467,16 +470,16 @@ static int ceph_x_build_request(struct c
 
 		/* encrypt and hash */
 		get_random_bytes(&auth->client_challenge, sizeof(u64));
-		tmp.client_challenge = auth->client_challenge;
-		tmp.server_challenge = cpu_to_le64(xi->server_challenge);
-		ret = ceph_x_encrypt(&xi->secret, &tmp, sizeof(tmp),
-				     tmp_enc, sizeof(tmp_enc));
+		blob->client_challenge = auth->client_challenge;
+		blob->server_challenge = cpu_to_le64(xi->server_challenge);
+		ret = ceph_x_encrypt(&xi->secret, enc_buf, CEPHX_AU_ENC_BUF_LEN,
+				     sizeof(*blob));
 		if (ret < 0)
 			return ret;
 
 		auth->struct_v = 1;
 		auth->key = 0;
-		for (u = (u64 *)tmp_enc; u + 1 <= (u64 *)(tmp_enc + ret); u++)
+		for (u = (u64 *)enc_buf; u + 1 <= (u64 *)(enc_buf + ret); u++)
 			auth->key ^= *(__le64 *)u;
 		dout(" server_challenge %llx client_challenge %llx key %llx\n",
 		     xi->server_challenge, le64_to_cpu(auth->client_challenge),
@@ -710,27 +713,27 @@ static void ceph_x_invalidate_authorizer
 static int calc_signature(struct ceph_x_authorizer *au, struct ceph_msg *msg,
 			  __le64 *psig)
 {
-	char tmp_enc[40];
+	void *enc_buf = au->enc_buf;
 	struct {
 		__le32 len;
 		__le32 header_crc;
 		__le32 front_crc;
 		__le32 middle_crc;
 		__le32 data_crc;
-	} __packed sigblock;
+	} __packed *sigblock = enc_buf + ceph_x_encrypt_offset();
 	int ret;
 
-	sigblock.len = cpu_to_le32(4*sizeof(u32));
-	sigblock.header_crc = msg->hdr.crc;
-	sigblock.front_crc = msg->footer.front_crc;
-	sigblock.middle_crc = msg->footer.middle_crc;
-	sigblock.data_crc =  msg->footer.data_crc;
-	ret = ceph_x_encrypt(&au->session_key, &sigblock, sizeof(sigblock),
-			     tmp_enc, sizeof(tmp_enc));
+	sigblock->len = cpu_to_le32(4*sizeof(u32));
+	sigblock->header_crc = msg->hdr.crc;
+	sigblock->front_crc = msg->footer.front_crc;
+	sigblock->middle_crc = msg->footer.middle_crc;
+	sigblock->data_crc =  msg->footer.data_crc;
+	ret = ceph_x_encrypt(&au->session_key, enc_buf, CEPHX_AU_ENC_BUF_LEN,
+			     sizeof(*sigblock));
 	if (ret < 0)
 		return ret;
 
-	*psig = *(__le64 *)(tmp_enc + sizeof(u32));
+	*psig = *(__le64 *)(enc_buf + sizeof(u32));
 	return 0;
 }
 

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 083/130] libceph: switch ceph_x_decrypt() to ceph_crypt()
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (78 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 082/130] libceph: switch ceph_x_encrypt() to ceph_crypt() Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 084/130] libceph: remove now unused ceph_*{en,de}crypt*() functions Greg Kroah-Hartman
                     ` (46 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ilya Dryomov, Sage Weil

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

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

From: Ilya Dryomov <idryomov@gmail.com>

commit e15fd0a11db00fc7f470a9fc804657ec3f6d04a5 upstream.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Sage Weil <sage@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/ceph/auth_x.c |   78 ++++++++++++++++++++++--------------------------------
 1 file changed, 32 insertions(+), 46 deletions(-)

--- a/net/ceph/auth_x.c
+++ b/net/ceph/auth_x.c
@@ -69,32 +69,28 @@ static int ceph_x_encrypt(struct ceph_cr
 	return sizeof(u32) + ciphertext_len;
 }
 
-static int ceph_x_decrypt(struct ceph_crypto_key *secret,
-			  void **p, void *end, void **obuf, size_t olen)
+static int ceph_x_decrypt(struct ceph_crypto_key *secret, void **p, void *end)
 {
-	struct ceph_x_encrypt_header head;
-	size_t head_len = sizeof(head);
-	int len, ret;
-
-	len = ceph_decode_32(p);
-	if (*p + len > end)
-		return -EINVAL;
+	struct ceph_x_encrypt_header *hdr = *p + sizeof(u32);
+	int ciphertext_len, plaintext_len;
+	int ret;
 
-	dout("ceph_x_decrypt len %d\n", len);
-	if (*obuf == NULL) {
-		*obuf = kmalloc(len, GFP_NOFS);
-		if (!*obuf)
-			return -ENOMEM;
-		olen = len;
-	}
+	ceph_decode_32_safe(p, end, ciphertext_len, e_inval);
+	ceph_decode_need(p, end, ciphertext_len, e_inval);
 
-	ret = ceph_decrypt2(secret, &head, &head_len, *obuf, &olen, *p, len);
+	ret = ceph_crypt(secret, false, *p, end - *p, ciphertext_len,
+			 &plaintext_len);
 	if (ret)
 		return ret;
-	if (head.struct_v != 1 || le64_to_cpu(head.magic) != CEPHX_ENC_MAGIC)
+
+	if (hdr->struct_v != 1 || le64_to_cpu(hdr->magic) != CEPHX_ENC_MAGIC)
 		return -EPERM;
-	*p += len;
-	return olen;
+
+	*p += ciphertext_len;
+	return plaintext_len - sizeof(struct ceph_x_encrypt_header);
+
+e_inval:
+	return -EINVAL;
 }
 
 /*
@@ -149,12 +145,10 @@ static int process_one_ticket(struct cep
 	int type;
 	u8 tkt_struct_v, blob_struct_v;
 	struct ceph_x_ticket_handler *th;
-	void *dbuf = NULL;
 	void *dp, *dend;
 	int dlen;
 	char is_enc;
 	struct timespec validity;
-	void *ticket_buf = NULL;
 	void *tp, *tpend;
 	void **ptp;
 	struct ceph_crypto_key new_session_key;
@@ -179,14 +173,12 @@ static int process_one_ticket(struct cep
 	}
 
 	/* blob for me */
-	dlen = ceph_x_decrypt(secret, p, end, &dbuf, 0);
-	if (dlen <= 0) {
-		ret = dlen;
+	dp = *p + ceph_x_encrypt_offset();
+	ret = ceph_x_decrypt(secret, p, end);
+	if (ret < 0)
 		goto out;
-	}
-	dout(" decrypted %d bytes\n", dlen);
-	dp = dbuf;
-	dend = dp + dlen;
+	dout(" decrypted %d bytes\n", ret);
+	dend = dp + ret;
 
 	tkt_struct_v = ceph_decode_8(&dp);
 	if (tkt_struct_v != 1)
@@ -207,15 +199,13 @@ static int process_one_ticket(struct cep
 	ceph_decode_8_safe(p, end, is_enc, bad);
 	if (is_enc) {
 		/* encrypted */
-		dout(" encrypted ticket\n");
-		dlen = ceph_x_decrypt(&th->session_key, p, end, &ticket_buf, 0);
-		if (dlen < 0) {
-			ret = dlen;
+		tp = *p + ceph_x_encrypt_offset();
+		ret = ceph_x_decrypt(&th->session_key, p, end);
+		if (ret < 0)
 			goto out;
-		}
-		tp = ticket_buf;
+		dout(" encrypted ticket, decrypted %d bytes\n", ret);
 		ptp = &tp;
-		tpend = *ptp + dlen;
+		tpend = tp + ret;
 	} else {
 		/* unencrypted */
 		ptp = p;
@@ -246,8 +236,6 @@ static int process_one_ticket(struct cep
 	xi->have_keys |= th->service;
 
 out:
-	kfree(ticket_buf);
-	kfree(dbuf);
 	return ret;
 
 bad:
@@ -638,24 +626,22 @@ static int ceph_x_verify_authorizer_repl
 					  struct ceph_authorizer *a, size_t len)
 {
 	struct ceph_x_authorizer *au = (void *)a;
-	int ret = 0;
-	struct ceph_x_authorize_reply reply;
-	void *preply = &reply;
 	void *p = au->enc_buf;
+	struct ceph_x_authorize_reply *reply = p + ceph_x_encrypt_offset();
+	int ret;
 
-	ret = ceph_x_decrypt(&au->session_key, &p, p + CEPHX_AU_ENC_BUF_LEN,
-			     &preply, sizeof(reply));
+	ret = ceph_x_decrypt(&au->session_key, &p, p + CEPHX_AU_ENC_BUF_LEN);
 	if (ret < 0)
 		return ret;
-	if (ret != sizeof(reply))
+	if (ret != sizeof(*reply))
 		return -EPERM;
 
-	if (au->nonce + 1 != le64_to_cpu(reply.nonce_plus_one))
+	if (au->nonce + 1 != le64_to_cpu(reply->nonce_plus_one))
 		ret = -EPERM;
 	else
 		ret = 0;
 	dout("verify_authorizer_reply nonce %llx got %llx ret %d\n",
-	     au->nonce, le64_to_cpu(reply.nonce_plus_one), ret);
+	     au->nonce, le64_to_cpu(reply->nonce_plus_one), ret);
 	return ret;
 }
 

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 084/130] libceph: remove now unused ceph_*{en,de}crypt*() functions
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (79 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 083/130] libceph: switch ceph_x_decrypt() " Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 085/130] ARM: dts: dra7: Add an empty chosen node to top level DTSI Greg Kroah-Hartman
                     ` (45 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ilya Dryomov, Sage Weil

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

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

From: Ilya Dryomov <idryomov@gmail.com>

commit 2b1e1a7cd0a615d57455567a549f9965023321b5 upstream.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Sage Weil <sage@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/ceph/crypto.c |  369 ------------------------------------------------------
 net/ceph/crypto.h |   14 --
 2 files changed, 383 deletions(-)

--- a/net/ceph/crypto.c
+++ b/net/ceph/crypto.c
@@ -157,375 +157,6 @@ static void teardown_sgtable(struct sg_t
 		sg_free_table(sgt);
 }
 
-static int ceph_aes_encrypt(const void *key, int key_len,
-			    void *dst, size_t *dst_len,
-			    const void *src, size_t src_len)
-{
-	struct scatterlist sg_in[2], prealloc_sg;
-	struct sg_table sg_out;
-	struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher();
-	SKCIPHER_REQUEST_ON_STACK(req, tfm);
-	int ret;
-	char iv[AES_BLOCK_SIZE];
-	size_t zero_padding = (0x10 - (src_len & 0x0f));
-	char pad[16];
-
-	if (IS_ERR(tfm))
-		return PTR_ERR(tfm);
-
-	memset(pad, zero_padding, zero_padding);
-
-	*dst_len = src_len + zero_padding;
-
-	sg_init_table(sg_in, 2);
-	sg_set_buf(&sg_in[0], src, src_len);
-	sg_set_buf(&sg_in[1], pad, zero_padding);
-	ret = setup_sgtable(&sg_out, &prealloc_sg, dst, *dst_len);
-	if (ret)
-		goto out_tfm;
-
-	crypto_skcipher_setkey((void *)tfm, key, key_len);
-	memcpy(iv, aes_iv, AES_BLOCK_SIZE);
-
-	skcipher_request_set_tfm(req, tfm);
-	skcipher_request_set_callback(req, 0, NULL, NULL);
-	skcipher_request_set_crypt(req, sg_in, sg_out.sgl,
-				   src_len + zero_padding, iv);
-
-	/*
-	print_hex_dump(KERN_ERR, "enc key: ", DUMP_PREFIX_NONE, 16, 1,
-		       key, key_len, 1);
-	print_hex_dump(KERN_ERR, "enc src: ", DUMP_PREFIX_NONE, 16, 1,
-			src, src_len, 1);
-	print_hex_dump(KERN_ERR, "enc pad: ", DUMP_PREFIX_NONE, 16, 1,
-			pad, zero_padding, 1);
-	*/
-	ret = crypto_skcipher_encrypt(req);
-	skcipher_request_zero(req);
-	if (ret < 0) {
-		pr_err("ceph_aes_crypt failed %d\n", ret);
-		goto out_sg;
-	}
-	/*
-	print_hex_dump(KERN_ERR, "enc out: ", DUMP_PREFIX_NONE, 16, 1,
-		       dst, *dst_len, 1);
-	*/
-
-out_sg:
-	teardown_sgtable(&sg_out);
-out_tfm:
-	crypto_free_skcipher(tfm);
-	return ret;
-}
-
-static int ceph_aes_encrypt2(const void *key, int key_len, void *dst,
-			     size_t *dst_len,
-			     const void *src1, size_t src1_len,
-			     const void *src2, size_t src2_len)
-{
-	struct scatterlist sg_in[3], prealloc_sg;
-	struct sg_table sg_out;
-	struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher();
-	SKCIPHER_REQUEST_ON_STACK(req, tfm);
-	int ret;
-	char iv[AES_BLOCK_SIZE];
-	size_t zero_padding = (0x10 - ((src1_len + src2_len) & 0x0f));
-	char pad[16];
-
-	if (IS_ERR(tfm))
-		return PTR_ERR(tfm);
-
-	memset(pad, zero_padding, zero_padding);
-
-	*dst_len = src1_len + src2_len + zero_padding;
-
-	sg_init_table(sg_in, 3);
-	sg_set_buf(&sg_in[0], src1, src1_len);
-	sg_set_buf(&sg_in[1], src2, src2_len);
-	sg_set_buf(&sg_in[2], pad, zero_padding);
-	ret = setup_sgtable(&sg_out, &prealloc_sg, dst, *dst_len);
-	if (ret)
-		goto out_tfm;
-
-	crypto_skcipher_setkey((void *)tfm, key, key_len);
-	memcpy(iv, aes_iv, AES_BLOCK_SIZE);
-
-	skcipher_request_set_tfm(req, tfm);
-	skcipher_request_set_callback(req, 0, NULL, NULL);
-	skcipher_request_set_crypt(req, sg_in, sg_out.sgl,
-				   src1_len + src2_len + zero_padding, iv);
-
-	/*
-	print_hex_dump(KERN_ERR, "enc  key: ", DUMP_PREFIX_NONE, 16, 1,
-		       key, key_len, 1);
-	print_hex_dump(KERN_ERR, "enc src1: ", DUMP_PREFIX_NONE, 16, 1,
-			src1, src1_len, 1);
-	print_hex_dump(KERN_ERR, "enc src2: ", DUMP_PREFIX_NONE, 16, 1,
-			src2, src2_len, 1);
-	print_hex_dump(KERN_ERR, "enc  pad: ", DUMP_PREFIX_NONE, 16, 1,
-			pad, zero_padding, 1);
-	*/
-	ret = crypto_skcipher_encrypt(req);
-	skcipher_request_zero(req);
-	if (ret < 0) {
-		pr_err("ceph_aes_crypt2 failed %d\n", ret);
-		goto out_sg;
-	}
-	/*
-	print_hex_dump(KERN_ERR, "enc  out: ", DUMP_PREFIX_NONE, 16, 1,
-		       dst, *dst_len, 1);
-	*/
-
-out_sg:
-	teardown_sgtable(&sg_out);
-out_tfm:
-	crypto_free_skcipher(tfm);
-	return ret;
-}
-
-static int ceph_aes_decrypt(const void *key, int key_len,
-			    void *dst, size_t *dst_len,
-			    const void *src, size_t src_len)
-{
-	struct sg_table sg_in;
-	struct scatterlist sg_out[2], prealloc_sg;
-	struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher();
-	SKCIPHER_REQUEST_ON_STACK(req, tfm);
-	char pad[16];
-	char iv[AES_BLOCK_SIZE];
-	int ret;
-	int last_byte;
-
-	if (IS_ERR(tfm))
-		return PTR_ERR(tfm);
-
-	sg_init_table(sg_out, 2);
-	sg_set_buf(&sg_out[0], dst, *dst_len);
-	sg_set_buf(&sg_out[1], pad, sizeof(pad));
-	ret = setup_sgtable(&sg_in, &prealloc_sg, src, src_len);
-	if (ret)
-		goto out_tfm;
-
-	crypto_skcipher_setkey((void *)tfm, key, key_len);
-	memcpy(iv, aes_iv, AES_BLOCK_SIZE);
-
-	skcipher_request_set_tfm(req, tfm);
-	skcipher_request_set_callback(req, 0, NULL, NULL);
-	skcipher_request_set_crypt(req, sg_in.sgl, sg_out,
-				   src_len, iv);
-
-	/*
-	print_hex_dump(KERN_ERR, "dec key: ", DUMP_PREFIX_NONE, 16, 1,
-		       key, key_len, 1);
-	print_hex_dump(KERN_ERR, "dec  in: ", DUMP_PREFIX_NONE, 16, 1,
-		       src, src_len, 1);
-	*/
-	ret = crypto_skcipher_decrypt(req);
-	skcipher_request_zero(req);
-	if (ret < 0) {
-		pr_err("ceph_aes_decrypt failed %d\n", ret);
-		goto out_sg;
-	}
-
-	if (src_len <= *dst_len)
-		last_byte = ((char *)dst)[src_len - 1];
-	else
-		last_byte = pad[src_len - *dst_len - 1];
-	if (last_byte <= 16 && src_len >= last_byte) {
-		*dst_len = src_len - last_byte;
-	} else {
-		pr_err("ceph_aes_decrypt got bad padding %d on src len %d\n",
-		       last_byte, (int)src_len);
-		return -EPERM;  /* bad padding */
-	}
-	/*
-	print_hex_dump(KERN_ERR, "dec out: ", DUMP_PREFIX_NONE, 16, 1,
-		       dst, *dst_len, 1);
-	*/
-
-out_sg:
-	teardown_sgtable(&sg_in);
-out_tfm:
-	crypto_free_skcipher(tfm);
-	return ret;
-}
-
-static int ceph_aes_decrypt2(const void *key, int key_len,
-			     void *dst1, size_t *dst1_len,
-			     void *dst2, size_t *dst2_len,
-			     const void *src, size_t src_len)
-{
-	struct sg_table sg_in;
-	struct scatterlist sg_out[3], prealloc_sg;
-	struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher();
-	SKCIPHER_REQUEST_ON_STACK(req, tfm);
-	char pad[16];
-	char iv[AES_BLOCK_SIZE];
-	int ret;
-	int last_byte;
-
-	if (IS_ERR(tfm))
-		return PTR_ERR(tfm);
-
-	sg_init_table(sg_out, 3);
-	sg_set_buf(&sg_out[0], dst1, *dst1_len);
-	sg_set_buf(&sg_out[1], dst2, *dst2_len);
-	sg_set_buf(&sg_out[2], pad, sizeof(pad));
-	ret = setup_sgtable(&sg_in, &prealloc_sg, src, src_len);
-	if (ret)
-		goto out_tfm;
-
-	crypto_skcipher_setkey((void *)tfm, key, key_len);
-	memcpy(iv, aes_iv, AES_BLOCK_SIZE);
-
-	skcipher_request_set_tfm(req, tfm);
-	skcipher_request_set_callback(req, 0, NULL, NULL);
-	skcipher_request_set_crypt(req, sg_in.sgl, sg_out,
-				   src_len, iv);
-
-	/*
-	print_hex_dump(KERN_ERR, "dec  key: ", DUMP_PREFIX_NONE, 16, 1,
-		       key, key_len, 1);
-	print_hex_dump(KERN_ERR, "dec   in: ", DUMP_PREFIX_NONE, 16, 1,
-		       src, src_len, 1);
-	*/
-	ret = crypto_skcipher_decrypt(req);
-	skcipher_request_zero(req);
-	if (ret < 0) {
-		pr_err("ceph_aes_decrypt failed %d\n", ret);
-		goto out_sg;
-	}
-
-	if (src_len <= *dst1_len)
-		last_byte = ((char *)dst1)[src_len - 1];
-	else if (src_len <= *dst1_len + *dst2_len)
-		last_byte = ((char *)dst2)[src_len - *dst1_len - 1];
-	else
-		last_byte = pad[src_len - *dst1_len - *dst2_len - 1];
-	if (last_byte <= 16 && src_len >= last_byte) {
-		src_len -= last_byte;
-	} else {
-		pr_err("ceph_aes_decrypt got bad padding %d on src len %d\n",
-		       last_byte, (int)src_len);
-		return -EPERM;  /* bad padding */
-	}
-
-	if (src_len < *dst1_len) {
-		*dst1_len = src_len;
-		*dst2_len = 0;
-	} else {
-		*dst2_len = src_len - *dst1_len;
-	}
-	/*
-	print_hex_dump(KERN_ERR, "dec  out1: ", DUMP_PREFIX_NONE, 16, 1,
-		       dst1, *dst1_len, 1);
-	print_hex_dump(KERN_ERR, "dec  out2: ", DUMP_PREFIX_NONE, 16, 1,
-		       dst2, *dst2_len, 1);
-	*/
-
-out_sg:
-	teardown_sgtable(&sg_in);
-out_tfm:
-	crypto_free_skcipher(tfm);
-	return ret;
-}
-
-
-int ceph_decrypt(struct ceph_crypto_key *secret, void *dst, size_t *dst_len,
-		 const void *src, size_t src_len)
-{
-	switch (secret->type) {
-	case CEPH_CRYPTO_NONE:
-		if (*dst_len < src_len)
-			return -ERANGE;
-		memcpy(dst, src, src_len);
-		*dst_len = src_len;
-		return 0;
-
-	case CEPH_CRYPTO_AES:
-		return ceph_aes_decrypt(secret->key, secret->len, dst,
-					dst_len, src, src_len);
-
-	default:
-		return -EINVAL;
-	}
-}
-
-int ceph_decrypt2(struct ceph_crypto_key *secret,
-			void *dst1, size_t *dst1_len,
-			void *dst2, size_t *dst2_len,
-			const void *src, size_t src_len)
-{
-	size_t t;
-
-	switch (secret->type) {
-	case CEPH_CRYPTO_NONE:
-		if (*dst1_len + *dst2_len < src_len)
-			return -ERANGE;
-		t = min(*dst1_len, src_len);
-		memcpy(dst1, src, t);
-		*dst1_len = t;
-		src += t;
-		src_len -= t;
-		if (src_len) {
-			t = min(*dst2_len, src_len);
-			memcpy(dst2, src, t);
-			*dst2_len = t;
-		}
-		return 0;
-
-	case CEPH_CRYPTO_AES:
-		return ceph_aes_decrypt2(secret->key, secret->len,
-					 dst1, dst1_len, dst2, dst2_len,
-					 src, src_len);
-
-	default:
-		return -EINVAL;
-	}
-}
-
-int ceph_encrypt(struct ceph_crypto_key *secret, void *dst, size_t *dst_len,
-		 const void *src, size_t src_len)
-{
-	switch (secret->type) {
-	case CEPH_CRYPTO_NONE:
-		if (*dst_len < src_len)
-			return -ERANGE;
-		memcpy(dst, src, src_len);
-		*dst_len = src_len;
-		return 0;
-
-	case CEPH_CRYPTO_AES:
-		return ceph_aes_encrypt(secret->key, secret->len, dst,
-					dst_len, src, src_len);
-
-	default:
-		return -EINVAL;
-	}
-}
-
-int ceph_encrypt2(struct ceph_crypto_key *secret, void *dst, size_t *dst_len,
-		  const void *src1, size_t src1_len,
-		  const void *src2, size_t src2_len)
-{
-	switch (secret->type) {
-	case CEPH_CRYPTO_NONE:
-		if (*dst_len < src1_len + src2_len)
-			return -ERANGE;
-		memcpy(dst, src1, src1_len);
-		memcpy(dst + src1_len, src2, src2_len);
-		*dst_len = src1_len + src2_len;
-		return 0;
-
-	case CEPH_CRYPTO_AES:
-		return ceph_aes_encrypt2(secret->key, secret->len, dst, dst_len,
-					 src1, src1_len, src2, src2_len);
-
-	default:
-		return -EINVAL;
-	}
-}
-
 static int ceph_aes_crypt(const struct ceph_crypto_key *key, bool encrypt,
 			  void *buf, int buf_len, int in_len, int *pout_len)
 {
--- a/net/ceph/crypto.h
+++ b/net/ceph/crypto.h
@@ -29,20 +29,6 @@ int ceph_crypto_key_decode(struct ceph_c
 int ceph_crypto_key_unarmor(struct ceph_crypto_key *key, const char *in);
 
 /* crypto.c */
-int ceph_decrypt(struct ceph_crypto_key *secret,
-		 void *dst, size_t *dst_len,
-		 const void *src, size_t src_len);
-int ceph_encrypt(struct ceph_crypto_key *secret,
-		 void *dst, size_t *dst_len,
-		 const void *src, size_t src_len);
-int ceph_decrypt2(struct ceph_crypto_key *secret,
-		  void *dst1, size_t *dst1_len,
-		  void *dst2, size_t *dst2_len,
-		  const void *src, size_t src_len);
-int ceph_encrypt2(struct ceph_crypto_key *secret,
-		  void *dst, size_t *dst_len,
-		  const void *src1, size_t src1_len,
-		  const void *src2, size_t src2_len);
 int ceph_crypt(const struct ceph_crypto_key *key, bool encrypt,
 	       void *buf, int buf_len, int in_len, int *pout_len);
 int ceph_crypto_init(void);

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 085/130] ARM: dts: dra7: Add an empty chosen node to top level DTSI
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (80 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 084/130] libceph: remove now unused ceph_*{en,de}crypt*() functions Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 086/130] ARM: dts: dm816x: " Greg Kroah-Hartman
                     ` (44 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Pali Rohar, Javier Martinez Canillas,
	Tony Lindgren

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

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

From: Javier Martinez Canillas <javier@osg.samsung.com>

commit 7f6c857b12911ed56b2056f9d5491e16b5fc95ea upstream.

Commit 55871eb6e2cc ("ARM: dts: dra7: Remove skeleton.dtsi usage")
removed the skeleton.dtsi usage since we want to get rid of it.

But this can cause issues when booting a kernel with a boot-loader
that doesn't create a chosen node if this isn't present in the DTB
since the decompressor relies on a pre-existing chosen node to be
available to insert the command line and merge other ATAGS info.

Fixes: 55871eb6e2cc ("ARM: dts: dra7: Remove skeleton.dtsi usage")
Reported-by: Pali Rohar <pali.rohar@gmail.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/dra7.dtsi |    1 +
 1 file changed, 1 insertion(+)

--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -18,6 +18,7 @@
 
 	compatible = "ti,dra7xx";
 	interrupt-parent = <&crossbar_mpu>;
+	chosen { };
 
 	aliases {
 		i2c0 = &i2c1;

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 086/130] ARM: dts: dm816x: Add an empty chosen node to top level DTSI
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (81 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 085/130] ARM: dts: dra7: Add an empty chosen node to top level DTSI Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 087/130] ARM: dts: dm814x: " Greg Kroah-Hartman
                     ` (43 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Pali Rohar, Javier Martinez Canillas,
	Tony Lindgren

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

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

From: Javier Martinez Canillas <javier@osg.samsung.com>

commit 6ed80b3a232e61da6d0189bbbe2b2b9afaefe3b3 upstream.

Commit 06bfb9c19957 ("ARM: dts: dm816x: Remove skeleton.dtsi usage")
removed the skeleton.dtsi usage since we want to get rid of it.

But this can cause issues when booting a kernel with a boot-loader
that doesn't create a chosen node if this isn't present in the DTB
since the decompressor relies on a pre-existing chosen node to be
available to insert the command line and merge other ATAGS info.

Fixes: 06bfb9c19957 ("ARM: dts: dm816x: Remove skeleton.dtsi usage")
Reported-by: Pali Rohar <pali.rohar@gmail.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/dm816x.dtsi |    1 +
 1 file changed, 1 insertion(+)

--- a/arch/arm/boot/dts/dm816x.dtsi
+++ b/arch/arm/boot/dts/dm816x.dtsi
@@ -12,6 +12,7 @@
 	interrupt-parent = <&intc>;
 	#address-cells = <1>;
 	#size-cells = <1>;
+	chosen { };
 
 	aliases {
 		i2c0 = &i2c1;

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 087/130] ARM: dts: dm814x: Add an empty chosen node to top level DTSI
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (82 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 086/130] ARM: dts: dm816x: " Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 088/130] ARM: dts: am33xx: " Greg Kroah-Hartman
                     ` (42 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Pali Rohar, Javier Martinez Canillas,
	Tony Lindgren

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

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

From: Javier Martinez Canillas <javier@osg.samsung.com>

commit 9536fd30d41ae4f30d04762676e5f5f602e16aa8 upstream.

Commit 76155b378c59 ("ARM: dts: dm814x: Remove skeleton.dtsi usage")
removed the skeleton.dtsi usage since we want to get rid of it.

But this can cause issues when booting a kernel with a boot-loader
that doesn't create a chosen node if this isn't present in the DTB
since the decompressor relies on a pre-existing chosen node to be
available to insert the command line and merge other ATAGS info.

Fixes: 76155b378c59 ("ARM: dts: dm814x: Remove skeleton.dtsi usage")
Reported-by: Pali Rohar <pali.rohar@gmail.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/dm814x.dtsi |    1 +
 1 file changed, 1 insertion(+)

--- a/arch/arm/boot/dts/dm814x.dtsi
+++ b/arch/arm/boot/dts/dm814x.dtsi
@@ -12,6 +12,7 @@
 	interrupt-parent = <&intc>;
 	#address-cells = <1>;
 	#size-cells = <1>;
+	chosen { };
 
 	aliases {
 		i2c0 = &i2c1;

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 088/130] ARM: dts: am33xx: Add an empty chosen node to top level DTSI
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (83 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 087/130] ARM: dts: dm814x: " Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 089/130] ARM: dts: omap4: " Greg Kroah-Hartman
                     ` (41 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Pali Rohar, Javier Martinez Canillas,
	Tony Lindgren

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

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

From: Javier Martinez Canillas <javier@osg.samsung.com>

commit 1d8d6d3f2f7d553c479f24ab93767974a8c2dfad upstream.

Commit f8bf01611c99 ("ARM: dts: am33xx: Remove skeleton.dtsi usage")
removed the skeleton.dtsi usage since we want to get rid of it.

But this can cause issues when booting a kernel with a boot-loader
that doesn't create a chosen node if this isn't present in the DTB
since the decompressor relies on a pre-existing chosen node to be
available to insert the command line and merge other ATAGS info.

Fixes: f8bf01611c99 ("ARM: dts: am33xx: Remove skeleton.dtsi usage")
Reported-by: Pali Rohar <pali.rohar@gmail.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/am33xx.dtsi |    1 +
 1 file changed, 1 insertion(+)

--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -16,6 +16,7 @@
 	interrupt-parent = <&intc>;
 	#address-cells = <1>;
 	#size-cells = <1>;
+	chosen { };
 
 	aliases {
 		i2c0 = &i2c0;

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 089/130] ARM: dts: omap4: Add an empty chosen node to top level DTSI
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (84 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 088/130] ARM: dts: am33xx: " Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 090/130] ARM: dts: omap5: " Greg Kroah-Hartman
                     ` (40 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Pali Rohar, Javier Martinez Canillas,
	Tony Lindgren

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

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

From: Javier Martinez Canillas <javier@osg.samsung.com>

commit 6c565d1a63ce241a0100f5d327c48dde87b4df76 upstream.

Commit da6269e7e3dd ("ARM: dts: omap4: Remove skeleton.dtsi usage")
removed the skeleton.dtsi usage since we want to get rid of it.

But this can cause issues when booting a kernel with a boot-loader
that doesn't create a chosen node if this isn't present in the DTB
since the decompressor relies on a pre-existing chosen node to be
available to insert the command line and merge other ATAGS info.

Fixes: da6269e7e3dd ("ARM: dts: omap4: Remove skeleton.dtsi usage")
Reported-by: Pali Rohar <pali.rohar@gmail.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/omap4.dtsi |    1 +
 1 file changed, 1 insertion(+)

--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -15,6 +15,7 @@
 	interrupt-parent = <&wakeupgen>;
 	#address-cells = <1>;
 	#size-cells = <1>;
+	chosen { };
 
 	aliases {
 		i2c0 = &i2c1;

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 090/130] ARM: dts: omap5: Add an empty chosen node to top level DTSI
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (85 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 089/130] ARM: dts: omap4: " Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 091/130] ARM: dts: am4372: " Greg Kroah-Hartman
                     ` (39 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Pali Rohar, Javier Martinez Canillas,
	Tony Lindgren

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

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

From: Javier Martinez Canillas <javier@osg.samsung.com>

commit c9faa84cb9c34852ad70cb175457ae21fc06f39b upstream.

Commit 76a8548ea987 ("ARM: dts: omap5: Remove skeleton.dtsi usage")
removed the skeleton.dtsi usage since we want to get rid of it.

But this can cause issues when booting a kernel with a boot-loader
that doesn't create a chosen node if this isn't present in the DTB
since the decompressor relies on a pre-existing chosen node to be
available to insert the command line and merge other ATAGS info.

Fixes: 76a8548ea987 ("ARM: dts: omap5: Remove skeleton.dtsi usage")
Reported-by: Pali Rohar <pali.rohar@gmail.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/omap5.dtsi |    1 +
 1 file changed, 1 insertion(+)

--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -17,6 +17,7 @@
 
 	compatible = "ti,omap5";
 	interrupt-parent = <&wakeupgen>;
+	chosen { };
 
 	aliases {
 		i2c0 = &i2c1;

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 091/130] ARM: dts: am4372: Add an empty chosen node to top level DTSI
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (86 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 090/130] ARM: dts: omap5: " Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 092/130] ARM: dts: omap3: " Greg Kroah-Hartman
                     ` (38 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Pali Rohar, Javier Martinez Canillas,
	Tony Lindgren

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

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

From: Javier Martinez Canillas <javier@osg.samsung.com>

commit ce95077d0cdfcc8e40dea10a1680249831ccec77 upstream.

Commit 75813028bbd7 ("ARM: dts: am4372: Remove skeleton.dtsi usage")
removed the skeleton.dtsi usage since we want to get rid of it.

But this can cause issues when booting a kernel with a boot-loader
that doesn't create a chosen node if this isn't present in the DTB
since the decompressor relies on a pre-existing chosen node to be
available to insert the command line and merge other ATAGS info.

Fixes: 75813028bbd7 ("ARM: dts: am4372: Remove skeleton.dtsi usage")
Reported-by: Pali Rohar <pali.rohar@gmail.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/am4372.dtsi |    1 +
 1 file changed, 1 insertion(+)

--- a/arch/arm/boot/dts/am4372.dtsi
+++ b/arch/arm/boot/dts/am4372.dtsi
@@ -16,6 +16,7 @@
 	interrupt-parent = <&wakeupgen>;
 	#address-cells = <1>;
 	#size-cells = <1>;
+	chosen { };
 
 	memory@0 {
 		device_type = "memory";

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 092/130] ARM: dts: omap3: Add an empty chosen node to top level DTSI
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (87 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 091/130] ARM: dts: am4372: " Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 093/130] ARM: dts: omap2: " Greg Kroah-Hartman
                     ` (37 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Pali Rohar, Javier Martinez Canillas,
	Tony Lindgren

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

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

From: Javier Martinez Canillas <javier@osg.samsung.com>

commit 23ab4c6183ac0679d80888b5c4cc1d528fcc21c2 upstream.

Commit 008a2ebcd677 ("ARM: dts: omap3: Remove skeleton.dtsi usage")
removed the skeleton.dtsi usage since we want to get rid of it.

But this can cause issues when booting a kernel with a boot-loader
that doesn't create a chosen node if this isn't present in the DTB
since the decompressor relies on a pre-existing chosen node to be
available to insert the command line and merge other ATAGS info.

Fixes: 008a2ebcd677 ("ARM: dts: omap3: Remove skeleton.dtsi usage")
Reported-by: Pali Rohar <pali.rohar@gmail.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/omap3.dtsi |    1 +
 1 file changed, 1 insertion(+)

--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -17,6 +17,7 @@
 	interrupt-parent = <&intc>;
 	#address-cells = <1>;
 	#size-cells = <1>;
+	chosen { };
 
 	aliases {
 		i2c0 = &i2c1;

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 093/130] ARM: dts: omap2: Add an empty chosen node to top level DTSI
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (88 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 092/130] ARM: dts: omap3: " Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 094/130] ARM: dts: imx6qdl-nitrogen6_max: fix sgtl5000 pinctrl init Greg Kroah-Hartman
                     ` (36 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Pali Rohar, Javier Martinez Canillas,
	Tony Lindgren

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

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

From: Javier Martinez Canillas <javier@osg.samsung.com>

commit 3d37d41a148c32389ed360e10a9f8a7cd37ce166 upstream.

Commit d1f3156fc8c7 ("ARM: dts: omap2: Remove skeleton.dtsi usage")
removed the skeleton.dtsi usage since we want to get rid of it.

But this can cause issues when booting a kernel with a boot-loader
that doesn't create a chosen node if this isn't present in the DTB
since the decompressor relies on a pre-existing chosen node to be
available to insert the command line and merge other ATAGS info.

Fixes: d1f3156fc8c7 ("ARM: dts: omap2: Remove skeleton.dtsi usage")
Reported-by: Pali Rohar <pali.rohar@gmail.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/omap2.dtsi |    1 +
 1 file changed, 1 insertion(+)

--- a/arch/arm/boot/dts/omap2.dtsi
+++ b/arch/arm/boot/dts/omap2.dtsi
@@ -17,6 +17,7 @@
 	interrupt-parent = <&intc>;
 	#address-cells = <1>;
 	#size-cells = <1>;
+	chosen { };
 
 	aliases {
 		serial0 = &uart1;

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 094/130] ARM: dts: imx6qdl-nitrogen6_max: fix sgtl5000 pinctrl init
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (89 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 093/130] ARM: dts: omap2: " Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 095/130] ARM: dts: omap3: Fix Card Detect and Write Protect on Logic PD SOM-LV Greg Kroah-Hartman
                     ` (35 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Gary Bisson, Shawn Guo

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

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

From: Gary Bisson <gary.bisson@boundarydevices.com>

commit 6ab5c2b662e2dcbb964099bf7f19e9dbc9ae5a41 upstream.

This patch fixes the following error:
sgtl5000 0-000a: Error reading chip id -6
imx-sgtl5000 sound: ASoC: CODEC DAI sgtl5000 not registered
imx-sgtl5000 sound: snd_soc_register_card failed (-517)

The problem was that the pinctrl group was linked to the sound driver
instead of the codec node. Since the codec is probed first, the sys_mclk
was missing and it would therefore fail to initialize.

Fixes: b32e700256bc ("ARM: dts: imx: add Boundary Devices Nitrogen6_Max board")
Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi
@@ -319,8 +319,6 @@
 		compatible = "fsl,imx6q-nitrogen6_max-sgtl5000",
 			     "fsl,imx-audio-sgtl5000";
 		model = "imx6q-nitrogen6_max-sgtl5000";
-		pinctrl-names = "default";
-		pinctrl-0 = <&pinctrl_sgtl5000>;
 		ssi-controller = <&ssi1>;
 		audio-codec = <&codec>;
 		audio-routing =
@@ -402,6 +400,8 @@
 
 	codec: sgtl5000@0a {
 		compatible = "fsl,sgtl5000";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_sgtl5000>;
 		reg = <0x0a>;
 		clocks = <&clks IMX6QDL_CLK_CKO>;
 		VDDA-supply = <&reg_2p5v>;

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 095/130] ARM: dts: omap3: Fix Card Detect and Write Protect on Logic PD SOM-LV
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (90 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 094/130] ARM: dts: imx6qdl-nitrogen6_max: fix sgtl5000 pinctrl init Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 096/130] ARM: ux500: fix prcmu_is_cpu_in_wfi() calculation Greg Kroah-Hartman
                     ` (34 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Adam Ford, Tony Lindgren

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

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

From: Adam Ford <aford173@gmail.com>

commit 1ea6af3216b092ec97129ac81bd95cf254c4b140 upstream.

This fixes commit ab8dd3aed011 ("ARM: DTS: Add minimal Support for
Logic PD DM3730 SOM-LV") where the Card Detect and Write Protect
pins were improperly configured.

Fixes: ab8dd3aed011 ("ARM: DTS: Add minimal Support for Logic PD DM3730 SOM-LV")
Signed-off-by: Adam Ford <aford173@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/logicpd-som-lv-37xx-devkit.dts |   11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

--- a/arch/arm/boot/dts/logicpd-som-lv-37xx-devkit.dts
+++ b/arch/arm/boot/dts/logicpd-som-lv-37xx-devkit.dts
@@ -158,7 +158,7 @@
 &mmc1 {
 	interrupts-extended = <&intc 83 &omap3_pmx_core 0x11a>;
 	pinctrl-names = "default";
-	pinctrl-0 = <&mmc1_pins &mmc1_cd>;
+	pinctrl-0 = <&mmc1_pins>;
 	wp-gpios = <&gpio4 30 GPIO_ACTIVE_HIGH>;		/* gpio_126 */
 	cd-gpios = <&gpio4 14 IRQ_TYPE_LEVEL_LOW>;		/* gpio_110 */
 	vmmc-supply = <&vmmc1>;
@@ -193,7 +193,8 @@
 			OMAP3_CORE1_IOPAD(0x214a, PIN_INPUT | MUX_MODE0)	/* sdmmc1_dat1.sdmmc1_dat1 */
 			OMAP3_CORE1_IOPAD(0x214c, PIN_INPUT | MUX_MODE0)	/* sdmmc1_dat2.sdmmc1_dat2 */
 			OMAP3_CORE1_IOPAD(0x214e, PIN_INPUT | MUX_MODE0)	/* sdmmc1_dat3.sdmmc1_dat3 */
-			OMAP3_CORE1_IOPAD(0x2132, PIN_INPUT_PULLUP | MUX_MODE4)	/* cam_strobe.gpio_126 sdmmc1_wp*/
+			OMAP3_CORE1_IOPAD(0x2132, PIN_INPUT_PULLUP | MUX_MODE4)	/* cam_strobe.gpio_126 */
+			OMAP3_CORE1_IOPAD(0x212c, PIN_INPUT_PULLUP | MUX_MODE4)	/* cam_d11.gpio_110 */
 		>;
 	};
 
@@ -242,12 +243,6 @@
 			OMAP3_WKUP_IOPAD(0x2a16, PIN_OUTPUT | PIN_OFF_OUTPUT_LOW | MUX_MODE4)       /* sys_boot6.gpio_8 */
 		>;
 	};
-
-	mmc1_cd: pinmux_mmc1_cd {
-		pinctrl-single,pins = <
-			OMAP3_WKUP_IOPAD(0x212c, PIN_INPUT_PULLUP | MUX_MODE4)	/* cam_d11.gpio_110 */
-		>;
-	};
 };
 
 

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 096/130] ARM: ux500: fix prcmu_is_cpu_in_wfi() calculation
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (91 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 095/130] ARM: dts: omap3: Fix Card Detect and Write Protect on Logic PD SOM-LV Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 097/130] ARM: 8613/1: Fix the uaccess crash on PB11MPCore Greg Kroah-Hartman
                     ` (33 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Arnd Bergmann, Daniel Lezcano, Linus Walleij

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

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

From: Arnd Bergmann <arnd@arndb.de>

commit f0e8faa7a5e894b0fc99d24be1b18685a92ea466 upstream.

This function clearly never worked and always returns true,
as pointed out by gcc-7:

arch/arm/mach-ux500/pm.c: In function 'prcmu_is_cpu_in_wfi':
arch/arm/mach-ux500/pm.c:137:212: error: ?:
using integer constants in boolean context, the expression
will always evaluate to 'true' [-Werror=int-in-bool-context]

With the added braces, the condition actually makes sense.

Fixes: 34fe6f107eab ("mfd : Check if the other db8500 core is in WFI")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/mach-ux500/pm.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/arm/mach-ux500/pm.c
+++ b/arch/arm/mach-ux500/pm.c
@@ -134,8 +134,8 @@ bool prcmu_pending_irq(void)
  */
 bool prcmu_is_cpu_in_wfi(int cpu)
 {
-	return readl(PRCM_ARM_WFI_STANDBY) & cpu ? PRCM_ARM_WFI_STANDBY_WFI1 :
-		     PRCM_ARM_WFI_STANDBY_WFI0;
+	return readl(PRCM_ARM_WFI_STANDBY) &
+		(cpu ? PRCM_ARM_WFI_STANDBY_WFI1 : PRCM_ARM_WFI_STANDBY_WFI0);
 }
 
 /*

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 097/130] ARM: 8613/1: Fix the uaccess crash on PB11MPCore
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (92 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 096/130] ARM: ux500: fix prcmu_is_cpu_in_wfi() calculation Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 098/130] ceph: fix scheduler warning due to nested blocking Greg Kroah-Hartman
                     ` (32 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Russell King, Will Deacon,
	Neil Armstrong, Linus Walleij, Russell King

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

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

From: Linus Walleij <linus.walleij@linaro.org>

commit 90f92c631b210c1e97080b53a9d863783281a932 upstream.

The following patch was sketched by Russell in response to my
crashes on the PB11MPCore after the patch for software-based
priviledged no access support for ARMv8.1. See this thread:
http://marc.info/?l=linux-arm-kernel&m=144051749807214&w=2

I am unsure what is going on, I suspect everyone involved in
the discussion is. I just want to repost this to get the
discussion restarted, as I still have to apply this patch
with every kernel iteration to get my PB11MPCore Realview
running.

Testing by Neil Armstrong on the Oxnas NAS has revealed that
this bug exist also on that widely deployed hardware, so
we are probably currently regressing all ARM11MPCore systems.

Cc: Russell King <linux@armlinux.org.uk>
Cc: Will Deacon <will.deacon@arm.com>
Fixes: a5e090acbf54 ("ARM: software-based priviledged-no-access support")
Tested-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/kernel/smp_tlb.c |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/arch/arm/kernel/smp_tlb.c
+++ b/arch/arm/kernel/smp_tlb.c
@@ -9,6 +9,7 @@
  */
 #include <linux/preempt.h>
 #include <linux/smp.h>
+#include <linux/uaccess.h>
 
 #include <asm/smp_plat.h>
 #include <asm/tlbflush.h>
@@ -40,8 +41,11 @@ static inline void ipi_flush_tlb_mm(void
 static inline void ipi_flush_tlb_page(void *arg)
 {
 	struct tlb_args *ta = (struct tlb_args *)arg;
+	unsigned int __ua_flags = uaccess_save_and_enable();
 
 	local_flush_tlb_page(ta->ta_vma, ta->ta_start);
+
+	uaccess_restore(__ua_flags);
 }
 
 static inline void ipi_flush_tlb_kernel_page(void *arg)
@@ -54,8 +58,11 @@ static inline void ipi_flush_tlb_kernel_
 static inline void ipi_flush_tlb_range(void *arg)
 {
 	struct tlb_args *ta = (struct tlb_args *)arg;
+	unsigned int __ua_flags = uaccess_save_and_enable();
 
 	local_flush_tlb_range(ta->ta_vma, ta->ta_start, ta->ta_end);
+
+	uaccess_restore(__ua_flags);
 }
 
 static inline void ipi_flush_tlb_kernel_range(void *arg)

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 098/130] ceph: fix scheduler warning due to nested blocking
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (93 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 097/130] ARM: 8613/1: Fix the uaccess crash on PB11MPCore Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 099/130] ceph: fix ceph_get_caps() interruption Greg Kroah-Hartman
                     ` (31 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Nikolay Borisov, Yan, Zheng

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

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

From: Nikolay Borisov <kernel@kyup.com>

commit 5c341ee32881c554727ec14b71ec3e8832f01989 upstream.

try_get_cap_refs can be used as a condition in a wait_event* calls.
This is all fine until it has to call __ceph_do_pending_vmtruncate,
which in turn acquires the i_truncate_mutex. This leads to a situation
in which a task's state is !TASK_RUNNING and at the same time it's
trying to acquire a sleeping primitive. In essence a nested sleeping
primitives are being used. This causes the following warning:

WARNING: CPU: 22 PID: 11064 at kernel/sched/core.c:7631 __might_sleep+0x9f/0xb0()
do not call blocking ops when !TASK_RUNNING; state=1 set at [<ffffffff8109447d>] prepare_to_wait_event+0x5d/0x110
 ipmi_msghandler tcp_scalable ib_qib dca ib_mad ib_core ib_addr ipv6
CPU: 22 PID: 11064 Comm: fs_checker.pl Tainted: G           O    4.4.20-clouder2 #6
Hardware name: Supermicro X10DRi/X10DRi, BIOS 1.1a 10/16/2015
 0000000000000000 ffff8838b416fa88 ffffffff812f4409 ffff8838b416fad0
 ffffffff81a034f2 ffff8838b416fac0 ffffffff81052b46 ffffffff81a0432c
 0000000000000061 0000000000000000 0000000000000000 ffff88167bda54a0
Call Trace:
 [<ffffffff812f4409>] dump_stack+0x67/0x9e
 [<ffffffff81052b46>] warn_slowpath_common+0x86/0xc0
 [<ffffffff81052bcc>] warn_slowpath_fmt+0x4c/0x50
 [<ffffffff8109447d>] ? prepare_to_wait_event+0x5d/0x110
 [<ffffffff8109447d>] ? prepare_to_wait_event+0x5d/0x110
 [<ffffffff8107767f>] __might_sleep+0x9f/0xb0
 [<ffffffff81612d30>] mutex_lock+0x20/0x40
 [<ffffffffa04eea14>] __ceph_do_pending_vmtruncate+0x44/0x1a0 [ceph]
 [<ffffffffa04fa692>] try_get_cap_refs+0xa2/0x320 [ceph]
 [<ffffffffa04fd6f5>] ceph_get_caps+0x255/0x2b0 [ceph]
 [<ffffffff81094370>] ? wait_woken+0xb0/0xb0
 [<ffffffffa04f2c11>] ceph_write_iter+0x2b1/0xde0 [ceph]
 [<ffffffff81613f22>] ? schedule_timeout+0x202/0x260
 [<ffffffff8117f01a>] ? kmem_cache_free+0x1ea/0x200
 [<ffffffff811b46ce>] ? iput+0x9e/0x230
 [<ffffffff81077632>] ? __might_sleep+0x52/0xb0
 [<ffffffff81156147>] ? __might_fault+0x37/0x40
 [<ffffffff8119e123>] ? cp_new_stat+0x153/0x170
 [<ffffffff81198cfa>] __vfs_write+0xaa/0xe0
 [<ffffffff81199369>] vfs_write+0xa9/0x190
 [<ffffffff811b6d01>] ? set_close_on_exec+0x31/0x70
 [<ffffffff8119a056>] SyS_write+0x46/0xa0

This happens since wait_event_interruptible can interfere with the
mutex locking code, since they both fiddle with the task state.

Fix the issue by using the newly-added nested blocking infrastructure
in 61ada528dea0 ("sched/wait: Provide infrastructure to deal with
nested blocking")

Link: https://lwn.net/Articles/628628/
Signed-off-by: Nikolay Borisov <kernel@kyup.com>
Signed-off-by: Yan, Zheng <zyan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ceph/caps.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -2507,9 +2507,15 @@ int ceph_get_caps(struct ceph_inode_info
 			if (err < 0)
 				ret = err;
 		} else {
-			ret = wait_event_interruptible(ci->i_cap_wq,
-					try_get_cap_refs(ci, need, want, endoff,
-							 true, &_got, &err));
+			DEFINE_WAIT_FUNC(wait, woken_wake_function);
+			add_wait_queue(&ci->i_cap_wq, &wait);
+
+			while (!try_get_cap_refs(ci, need, want, endoff,
+						 true, &_got, &err))
+				wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
+
+			remove_wait_queue(&ci->i_cap_wq, &wait);
+
 			if (err == -EAGAIN)
 				continue;
 			if (err < 0)

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 099/130] ceph: fix ceph_get_caps() interruption
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (94 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 098/130] ceph: fix scheduler warning due to nested blocking Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 100/130] ceph: fix endianness of getattr mask in ceph_d_revalidate Greg Kroah-Hartman
                     ` (30 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Yan, Zheng, Ilya Dryomov

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

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

From: Yan, Zheng <zyan@redhat.com>

commit 6e09d0fb64402cec579f029ca4c7f39f5c48fc60 upstream.

Commit 5c341ee32881 ("ceph: fix scheduler warning due to nested
blocking") causes infinite loop when process is interrupted.  Fix it.

Signed-off-by: Yan, Zheng <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ceph/caps.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -2511,8 +2511,13 @@ int ceph_get_caps(struct ceph_inode_info
 			add_wait_queue(&ci->i_cap_wq, &wait);
 
 			while (!try_get_cap_refs(ci, need, want, endoff,
-						 true, &_got, &err))
+						 true, &_got, &err)) {
+				if (signal_pending(current)) {
+					ret = -ERESTARTSYS;
+					break;
+				}
 				wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
+			}
 
 			remove_wait_queue(&ci->i_cap_wq, &wait);
 

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 100/130] ceph: fix endianness of getattr mask in ceph_d_revalidate
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (95 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 099/130] ceph: fix ceph_get_caps() interruption Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 101/130] ceph: fix endianness bug in frag_tree_split_cmp Greg Kroah-Hartman
                     ` (29 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jeff Layton, Sage Weil, Ilya Dryomov

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

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

From: Jeff Layton <jlayton@redhat.com>

commit 1097680d759918ce4a8705381c0ab2ed7bd60cf1 upstream.

sparse says:

    fs/ceph/dir.c:1248:50: warning: incorrect type in assignment (different base types)
    fs/ceph/dir.c:1248:50:    expected restricted __le32 [usertype] mask
    fs/ceph/dir.c:1248:50:    got int [signed] [assigned] mask

Fixes: 200fd27c8fa2 ("ceph: use lookup request to revalidate dentry")
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Sage Weil <sage@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ceph/dir.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -1255,7 +1255,8 @@ static int ceph_d_revalidate(struct dent
 		struct ceph_mds_client *mdsc =
 			ceph_sb_to_client(dir->i_sb)->mdsc;
 		struct ceph_mds_request *req;
-		int op, mask, err;
+		int op, err;
+		u32 mask;
 
 		if (flags & LOOKUP_RCU)
 			return -ECHILD;
@@ -1270,7 +1271,7 @@ static int ceph_d_revalidate(struct dent
 			mask = CEPH_STAT_CAP_INODE | CEPH_CAP_AUTH_SHARED;
 			if (ceph_security_xattr_wanted(dir))
 				mask |= CEPH_CAP_XATTR_SHARED;
-			req->r_args.getattr.mask = mask;
+			req->r_args.getattr.mask = cpu_to_le32(mask);
 
 			err = ceph_mdsc_do_request(mdsc, NULL, req);
 			switch (err) {

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 101/130] ceph: fix endianness bug in frag_tree_split_cmp
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (96 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 100/130] ceph: fix endianness of getattr mask in ceph_d_revalidate Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 102/130] libceph: make sure ceph_aes_crypt() IV is aligned Greg Kroah-Hartman
                     ` (28 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jeff Layton, Sage Weil, Ilya Dryomov

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

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

From: Jeff Layton <jlayton@redhat.com>

commit fe2ed42517533068ac03eed5630fffafff27eacf upstream.

sparse says:

    fs/ceph/inode.c:308:36: warning: incorrect type in argument 1 (different base types)
    fs/ceph/inode.c:308:36:    expected unsigned int [unsigned] [usertype] a
    fs/ceph/inode.c:308:36:    got restricted __le32 [usertype] frag
    fs/ceph/inode.c:308:46: warning: incorrect type in argument 2 (different base types)
    fs/ceph/inode.c:308:46:    expected unsigned int [unsigned] [usertype] b
    fs/ceph/inode.c:308:46:    got restricted __le32 [usertype] frag

We need to convert these values to host-endian before calling the
comparator.

Fixes: a407846ef7c6 ("ceph: don't assume frag tree splits in mds reply are sorted")
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Sage Weil <sage@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ceph/inode.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -305,7 +305,8 @@ static int frag_tree_split_cmp(const voi
 {
 	struct ceph_frag_tree_split *ls = (struct ceph_frag_tree_split*)l;
 	struct ceph_frag_tree_split *rs = (struct ceph_frag_tree_split*)r;
-	return ceph_frag_compare(ls->frag, rs->frag);
+	return ceph_frag_compare(le32_to_cpu(ls->frag),
+				 le32_to_cpu(rs->frag));
 }
 
 static bool is_frag_child(u32 f, struct ceph_inode_frag *frag)

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 102/130] libceph: make sure ceph_aes_crypt() IV is aligned
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (97 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 101/130] ceph: fix endianness bug in frag_tree_split_cmp Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 103/130] xprtrdma: Make FRWR send queue entry accounting more accurate Greg Kroah-Hartman
                     ` (27 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ilya Dryomov

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

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

From: Ilya Dryomov <idryomov@gmail.com>

commit 124f930b8cbc4ac11236e6eb1c5f008318864588 upstream.

... otherwise the crypto stack will align it for us with a GFP_ATOMIC
allocation and a memcpy() -- see skcipher_walk_first().

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/ceph/crypto.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/ceph/crypto.c
+++ b/net/ceph/crypto.c
@@ -164,7 +164,7 @@ static int ceph_aes_crypt(const struct c
 	SKCIPHER_REQUEST_ON_STACK(req, tfm);
 	struct sg_table sgt;
 	struct scatterlist prealloc_sg;
-	char iv[AES_BLOCK_SIZE];
+	char iv[AES_BLOCK_SIZE] __aligned(8);
 	int pad_byte = AES_BLOCK_SIZE - (in_len & (AES_BLOCK_SIZE - 1));
 	int crypt_len = encrypt ? in_len + pad_byte : in_len;
 	int ret;

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 103/130] xprtrdma: Make FRWR send queue entry accounting more accurate
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (98 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 102/130] libceph: make sure ceph_aes_crypt() IV is aligned Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 104/130] xprtrdma: Squelch "max send, max recv" messages at connect time Greg Kroah-Hartman
                     ` (26 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Chuck Lever, Anna Schumaker

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

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

From: Chuck Lever <chuck.lever@oracle.com>

commit 8d38de65644d900199f035277aa5f3da4aa9fc17 upstream.

Verbs providers may perform house-keeping on the Send Queue during
each signaled send completion. It is necessary therefore for a verbs
consumer (like xprtrdma) to occasionally force a signaled send
completion if it runs unsignaled most of the time.

xprtrdma does not require signaled completions for Send or FastReg
Work Requests, but does signal some LocalInv Work Requests. To
ensure that Send Queue house-keeping can run before the Send Queue
is more than half-consumed, xprtrdma forces a signaled completion
on occasion by counting the number of Send Queue Entries it
consumes. It currently does this by counting each ib_post_send as
one Entry.

Commit c9918ff56dfb ("xprtrdma: Add ro_unmap_sync method for FRWR")
introduced the ability for frwr_op_unmap_sync to post more than one
Work Request with a single post_send. Thus the underlying assumption
of one Send Queue Entry per ib_post_send is no longer true.

Also, FastReg Work Requests are currently never signaled. They
should be signaled once in a while, just as Send is, to keep the
accounting of consumed SQEs accurate.

While we're here, convert the CQCOUNT macros to the currently
preferred kernel coding style, which is inline functions.

Fixes: c9918ff56dfb ("xprtrdma: Add ro_unmap_sync method for FRWR")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/sunrpc/xprtrdma/frwr_ops.c  |   13 ++++++++++---
 net/sunrpc/xprtrdma/verbs.c     |   10 ++--------
 net/sunrpc/xprtrdma/xprt_rdma.h |   20 ++++++++++++++++++--
 3 files changed, 30 insertions(+), 13 deletions(-)

--- a/net/sunrpc/xprtrdma/frwr_ops.c
+++ b/net/sunrpc/xprtrdma/frwr_ops.c
@@ -421,7 +421,7 @@ frwr_op_map(struct rpcrdma_xprt *r_xprt,
 			 IB_ACCESS_REMOTE_WRITE | IB_ACCESS_LOCAL_WRITE :
 			 IB_ACCESS_REMOTE_READ;
 
-	DECR_CQCOUNT(&r_xprt->rx_ep);
+	rpcrdma_set_signaled(&r_xprt->rx_ep, &reg_wr->wr);
 	rc = ib_post_send(ia->ri_id->qp, &reg_wr->wr, &bad_wr);
 	if (rc)
 		goto out_senderr;
@@ -486,7 +486,7 @@ frwr_op_unmap_sync(struct rpcrdma_xprt *
 	struct rpcrdma_ia *ia = &r_xprt->rx_ia;
 	struct rpcrdma_mw *mw, *tmp;
 	struct rpcrdma_frmr *f;
-	int rc;
+	int count, rc;
 
 	dprintk("RPC:       %s: req %p\n", __func__, req);
 
@@ -496,6 +496,7 @@ frwr_op_unmap_sync(struct rpcrdma_xprt *
 	 * a single ib_post_send() call.
 	 */
 	f = NULL;
+	count = 0;
 	invalidate_wrs = pos = prev = NULL;
 	list_for_each_entry(mw, &req->rl_registered, mw_list) {
 		if ((rep->rr_wc_flags & IB_WC_WITH_INVALIDATE) &&
@@ -505,6 +506,7 @@ frwr_op_unmap_sync(struct rpcrdma_xprt *
 		}
 
 		pos = __frwr_prepare_linv_wr(mw);
+		count++;
 
 		if (!invalidate_wrs)
 			invalidate_wrs = pos;
@@ -523,7 +525,12 @@ frwr_op_unmap_sync(struct rpcrdma_xprt *
 	f->fr_invwr.send_flags = IB_SEND_SIGNALED;
 	f->fr_cqe.done = frwr_wc_localinv_wake;
 	reinit_completion(&f->fr_linv_done);
-	INIT_CQCOUNT(&r_xprt->rx_ep);
+
+	/* Initialize CQ count, since there is always a signaled
+	 * WR being posted here.  The new cqcount depends on how
+	 * many SQEs are about to be consumed.
+	 */
+	rpcrdma_init_cqcount(&r_xprt->rx_ep, count);
 
 	/* Transport disconnect drains the receive CQ before it
 	 * replaces the QP. The RPC reply handler won't call us
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -532,7 +532,7 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep,
 	ep->rep_cqinit = ep->rep_attr.cap.max_send_wr/2 - 1;
 	if (ep->rep_cqinit <= 2)
 		ep->rep_cqinit = 0;	/* always signal? */
-	INIT_CQCOUNT(ep);
+	rpcrdma_init_cqcount(ep, 0);
 	init_waitqueue_head(&ep->rep_connect_wait);
 	INIT_DELAYED_WORK(&ep->rep_connect_worker, rpcrdma_connect_worker);
 
@@ -1311,13 +1311,7 @@ rpcrdma_ep_post(struct rpcrdma_ia *ia,
 	dprintk("RPC:       %s: posting %d s/g entries\n",
 		__func__, send_wr->num_sge);
 
-	if (DECR_CQCOUNT(ep) > 0)
-		send_wr->send_flags = 0;
-	else { /* Provider must take a send completion every now and then */
-		INIT_CQCOUNT(ep);
-		send_wr->send_flags = IB_SEND_SIGNALED;
-	}
-
+	rpcrdma_set_signaled(ep, send_wr);
 	rc = ib_post_send(ia->ri_id->qp, send_wr, &send_wr_fail);
 	if (rc)
 		goto out_postsend_err;
--- a/net/sunrpc/xprtrdma/xprt_rdma.h
+++ b/net/sunrpc/xprtrdma/xprt_rdma.h
@@ -95,8 +95,24 @@ struct rpcrdma_ep {
 	struct delayed_work	rep_connect_worker;
 };
 
-#define INIT_CQCOUNT(ep) atomic_set(&(ep)->rep_cqcount, (ep)->rep_cqinit)
-#define DECR_CQCOUNT(ep) atomic_sub_return(1, &(ep)->rep_cqcount)
+static inline void
+rpcrdma_init_cqcount(struct rpcrdma_ep *ep, int count)
+{
+	atomic_set(&ep->rep_cqcount, ep->rep_cqinit - count);
+}
+
+/* To update send queue accounting, provider must take a
+ * send completion every now and then.
+ */
+static inline void
+rpcrdma_set_signaled(struct rpcrdma_ep *ep, struct ib_send_wr *send_wr)
+{
+	send_wr->send_flags = 0;
+	if (unlikely(atomic_sub_return(1, &ep->rep_cqcount) <= 0)) {
+		rpcrdma_init_cqcount(ep, 0);
+		send_wr->send_flags = IB_SEND_SIGNALED;
+	}
+}
 
 /* Pre-allocate extra Work Requests for handling backward receives
  * and sends. This is a fixed value because the Work Queues are

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 104/130] xprtrdma: Squelch "max send, max recv" messages at connect time
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (99 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 103/130] xprtrdma: Make FRWR send queue entry accounting more accurate Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 105/130] arm64: mm: avoid name clash in __page_to_voff() Greg Kroah-Hartman
                     ` (25 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Chuck Lever, Anna Schumaker

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

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

From: Chuck Lever <chuck.lever@oracle.com>

commit 6d6bf72de914059b304f7b99530a7856e5c846aa upstream.

Clean up: This message was intended to be a dprintk, as it is on the
server-side.

Fixes: 87cfb9a0c85c ('xprtrdma: Client-side support for ...')
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/sunrpc/xprtrdma/verbs.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -223,8 +223,8 @@ rpcrdma_update_connect_private(struct rp
 		cdata->inline_rsize = rsize;
 	if (wsize < cdata->inline_wsize)
 		cdata->inline_wsize = wsize;
-	pr_info("rpcrdma: max send %u, max recv %u\n",
-		cdata->inline_wsize, cdata->inline_rsize);
+	dprintk("RPC:       %s: max send %u, max recv %u\n",
+		__func__, cdata->inline_wsize, cdata->inline_rsize);
 	rpcrdma_set_max_header_sizes(r_xprt);
 }
 

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 105/130] arm64: mm: avoid name clash in __page_to_voff()
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (100 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 104/130] xprtrdma: Squelch "max send, max recv" messages at connect time Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 106/130] arm64: Fix swiotlb fallback allocation Greg Kroah-Hartman
                     ` (24 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Mark Rutland, Volodymyr Babchuk,
	Oleksandr Andrushchenko, Catalin Marinas

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

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

From: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@epam.com>

commit 1c8a946bf3754a59cba1fc373949a8114bfe5aaa upstream.

The arm64 __page_to_voff() macro takes a parameter called 'page', and
also refers to 'struct page'. Thus, if the value passed in is not
called 'page', we'll refer to the wrong struct name (which might not
exist).

Fixes: 3fa72fe9c614 ("arm64: mm: fix __page_to_voff definition")
Acked-by: Mark Rutland <mark.rutland@arm.com>
Suggested-by: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Signed-off-by: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@epam.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/include/asm/memory.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/arm64/include/asm/memory.h
+++ b/arch/arm64/include/asm/memory.h
@@ -217,7 +217,7 @@ static inline void *phys_to_virt(phys_ad
 #define _virt_addr_valid(kaddr)	pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
 #else
 #define __virt_to_pgoff(kaddr)	(((u64)(kaddr) & ~PAGE_OFFSET) / PAGE_SIZE * sizeof(struct page))
-#define __page_to_voff(page)	(((u64)(page) & ~VMEMMAP_START) * PAGE_SIZE / sizeof(struct page))
+#define __page_to_voff(kaddr)	(((u64)(kaddr) & ~VMEMMAP_START) * PAGE_SIZE / sizeof(struct page))
 
 #define page_to_virt(page)	((void *)((__page_to_voff(page)) | PAGE_OFFSET))
 #define virt_to_page(vaddr)	((struct page *)((__virt_to_pgoff(vaddr)) | VMEMMAP_START))

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 106/130] arm64: Fix swiotlb fallback allocation
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (101 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 105/130] arm64: mm: avoid name clash in __page_to_voff() Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 107/130] swiotlb: Convert swiotlb_force from int to enum Greg Kroah-Hartman
                     ` (23 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Alexander Graf, Jisheng Zhang,
	Geert Uytterhoeven, Konrad Rzeszutek Wilk, Catalin Marinas

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

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

From: Alexander Graf <agraf@suse.de>

commit 524dabe1c68e0bca25ce7b108099e5d89472a101 upstream.

Commit b67a8b29df introduced logic to skip swiotlb allocation when all memory
is DMA accessible anyway.

While this is a great idea, __dma_alloc still calls swiotlb code unconditionally
to allocate memory when there is no CMA memory available. The swiotlb code is
called to ensure that we at least try get_free_pages().

Without initialization, swiotlb allocation code tries to access io_tlb_list
which is NULL. That results in a stack trace like this:

  Unable to handle kernel NULL pointer dereference at virtual address 00000000
  [...]
  [<ffff00000845b908>] swiotlb_tbl_map_single+0xd0/0x2b0
  [<ffff00000845be94>] swiotlb_alloc_coherent+0x10c/0x198
  [<ffff000008099dc0>] __dma_alloc+0x68/0x1a8
  [<ffff000000a1b410>] drm_gem_cma_create+0x98/0x108 [drm]
  [<ffff000000abcaac>] drm_fbdev_cma_create_with_funcs+0xbc/0x368 [drm_kms_helper]
  [<ffff000000abcd84>] drm_fbdev_cma_create+0x2c/0x40 [drm_kms_helper]
  [<ffff000000abc040>] drm_fb_helper_initial_config+0x238/0x410 [drm_kms_helper]
  [<ffff000000abce88>] drm_fbdev_cma_init_with_funcs+0x98/0x160 [drm_kms_helper]
  [<ffff000000abcf90>] drm_fbdev_cma_init+0x40/0x58 [drm_kms_helper]
  [<ffff000000b47980>] vc4_kms_load+0x90/0xf0 [vc4]
  [<ffff000000b46a94>] vc4_drm_bind+0xec/0x168 [vc4]
  [...]

Thankfully swiotlb code just learned how to not do allocations with the FORCE_NO
option. This patch configures the swiotlb code to use that if we decide not to
initialize the swiotlb framework.

Fixes: b67a8b29df ("arm64: mm: only initialize swiotlb when necessary")
Signed-off-by: Alexander Graf <agraf@suse.de>
CC: Jisheng Zhang <jszhang@marvell.com>
CC: Geert Uytterhoeven <geert+renesas@glider.be>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/mm/init.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -403,6 +403,8 @@ void __init mem_init(void)
 {
 	if (swiotlb_force || max_pfn > (arm64_dma_phys_limit >> PAGE_SHIFT))
 		swiotlb_init(1);
+	else
+		swiotlb_force = SWIOTLB_NO_FORCE;
 
 	set_max_mapnr(pfn_to_page(max_pfn) - mem_map);
 

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 107/130] swiotlb: Convert swiotlb_force from int to enum
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (102 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 106/130] arm64: Fix swiotlb fallback allocation Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 108/130] swiotlb: Add swiotlb=noforce debug option Greg Kroah-Hartman
                     ` (22 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Konrad Rzeszutek Wilk, Geert Uytterhoeven

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

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

From: Geert Uytterhoeven <geert+renesas@glider.be>

commit ae7871be189cb41184f1e05742b4a99e2c59774d upstream.

Convert the flag swiotlb_force from an int to an enum, to prepare for
the advent of more possible values.

Suggested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/mm/dma-mapping.c    |    3 ++-
 arch/arm64/mm/init.c           |    3 ++-
 arch/x86/kernel/pci-swiotlb.c  |    2 +-
 arch/x86/xen/pci-swiotlb-xen.c |    2 +-
 drivers/xen/swiotlb-xen.c      |    4 ++--
 include/linux/swiotlb.h        |    7 ++++++-
 include/trace/events/swiotlb.h |   16 +++++++++-------
 lib/swiotlb.c                  |    8 ++++----
 8 files changed, 27 insertions(+), 18 deletions(-)

--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -524,7 +524,8 @@ EXPORT_SYMBOL(dummy_dma_ops);
 
 static int __init arm64_dma_init(void)
 {
-	if (swiotlb_force || max_pfn > (arm64_dma_phys_limit >> PAGE_SHIFT))
+	if (swiotlb_force == SWIOTLB_FORCE ||
+	    max_pfn > (arm64_dma_phys_limit >> PAGE_SHIFT))
 		swiotlb = 1;
 
 	return atomic_pool_init();
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -401,7 +401,8 @@ static void __init free_unused_memmap(vo
  */
 void __init mem_init(void)
 {
-	if (swiotlb_force || max_pfn > (arm64_dma_phys_limit >> PAGE_SHIFT))
+	if (swiotlb_force == SWIOTLB_FORCE ||
+	    max_pfn > (arm64_dma_phys_limit >> PAGE_SHIFT))
 		swiotlb_init(1);
 	else
 		swiotlb_force = SWIOTLB_NO_FORCE;
--- a/arch/x86/kernel/pci-swiotlb.c
+++ b/arch/x86/kernel/pci-swiotlb.c
@@ -70,7 +70,7 @@ int __init pci_swiotlb_detect_override(v
 {
 	int use_swiotlb = swiotlb | swiotlb_force;
 
-	if (swiotlb_force)
+	if (swiotlb_force == SWIOTLB_FORCE)
 		swiotlb = 1;
 
 	return use_swiotlb;
--- a/arch/x86/xen/pci-swiotlb-xen.c
+++ b/arch/x86/xen/pci-swiotlb-xen.c
@@ -49,7 +49,7 @@ int __init pci_xen_swiotlb_detect(void)
 	 * activate this IOMMU. If running as PV privileged, activate it
 	 * irregardless.
 	 */
-	if ((xen_initial_domain() || swiotlb || swiotlb_force))
+	if (xen_initial_domain() || swiotlb || swiotlb_force == SWIOTLB_FORCE)
 		xen_swiotlb = 1;
 
 	/* If we are running under Xen, we MUST disable the native SWIOTLB.
--- a/drivers/xen/swiotlb-xen.c
+++ b/drivers/xen/swiotlb-xen.c
@@ -392,7 +392,7 @@ dma_addr_t xen_swiotlb_map_page(struct d
 	if (dma_capable(dev, dev_addr, size) &&
 	    !range_straddles_page_boundary(phys, size) &&
 		!xen_arch_need_swiotlb(dev, phys, dev_addr) &&
-		!swiotlb_force) {
+		(swiotlb_force != SWIOTLB_FORCE)) {
 		/* we are not interested in the dma_addr returned by
 		 * xen_dma_map_page, only in the potential cache flushes executed
 		 * by the function. */
@@ -549,7 +549,7 @@ xen_swiotlb_map_sg_attrs(struct device *
 		phys_addr_t paddr = sg_phys(sg);
 		dma_addr_t dev_addr = xen_phys_to_bus(paddr);
 
-		if (swiotlb_force ||
+		if (swiotlb_force == SWIOTLB_FORCE ||
 		    xen_arch_need_swiotlb(hwdev, paddr, dev_addr) ||
 		    !dma_capable(hwdev, dev_addr, sg->length) ||
 		    range_straddles_page_boundary(paddr, sg->length)) {
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -9,7 +9,12 @@ struct device;
 struct page;
 struct scatterlist;
 
-extern int swiotlb_force;
+enum swiotlb_force {
+	SWIOTLB_NORMAL,		/* Default - depending on HW DMA mask etc. */
+	SWIOTLB_FORCE,		/* swiotlb=force */
+};
+
+extern enum swiotlb_force swiotlb_force;
 
 /*
  * Maximum allowable number of contiguous slabs to map,
--- a/include/trace/events/swiotlb.h
+++ b/include/trace/events/swiotlb.h
@@ -11,16 +11,16 @@ TRACE_EVENT(swiotlb_bounced,
 	TP_PROTO(struct device *dev,
 		 dma_addr_t dev_addr,
 		 size_t size,
-		 int swiotlb_force),
+		 enum swiotlb_force swiotlb_force),
 
 	TP_ARGS(dev, dev_addr, size, swiotlb_force),
 
 	TP_STRUCT__entry(
-		__string(	dev_name,	dev_name(dev)	)
-		__field(	u64,	dma_mask		)
-		__field(	dma_addr_t,	dev_addr	)
-		__field(	size_t,	size			)
-		__field(	int,	swiotlb_force		)
+		__string(	dev_name,	dev_name(dev)		)
+		__field(	u64,	dma_mask			)
+		__field(	dma_addr_t,	dev_addr		)
+		__field(	size_t,	size				)
+		__field(	enum swiotlb_force,	swiotlb_force	)
 	),
 
 	TP_fast_assign(
@@ -37,7 +37,9 @@ TRACE_EVENT(swiotlb_bounced,
 		__entry->dma_mask,
 		(unsigned long long)__entry->dev_addr,
 		__entry->size,
-		__entry->swiotlb_force ? "swiotlb_force" : "" )
+		__print_symbolic(__entry->swiotlb_force,
+			{ SWIOTLB_NORMAL,	"NORMAL" },
+			{ SWIOTLB_FORCE,	"FORCE" }))
 );
 
 #endif /*  _TRACE_SWIOTLB_H */
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -53,7 +53,7 @@
  */
 #define IO_TLB_MIN_SLABS ((1<<20) >> IO_TLB_SHIFT)
 
-int swiotlb_force;
+enum swiotlb_force swiotlb_force;
 
 /*
  * Used to do a quick range check in swiotlb_tbl_unmap_single and
@@ -107,7 +107,7 @@ setup_io_tlb_npages(char *str)
 	if (*str == ',')
 		++str;
 	if (!strcmp(str, "force"))
-		swiotlb_force = 1;
+		swiotlb_force = SWIOTLB_FORCE;
 
 	return 0;
 }
@@ -749,7 +749,7 @@ dma_addr_t swiotlb_map_page(struct devic
 	 * we can safely return the device addr and not worry about bounce
 	 * buffering it.
 	 */
-	if (dma_capable(dev, dev_addr, size) && !swiotlb_force)
+	if (dma_capable(dev, dev_addr, size) && swiotlb_force != SWIOTLB_FORCE)
 		return dev_addr;
 
 	trace_swiotlb_bounced(dev, dev_addr, size, swiotlb_force);
@@ -888,7 +888,7 @@ swiotlb_map_sg_attrs(struct device *hwde
 		phys_addr_t paddr = sg_phys(sg);
 		dma_addr_t dev_addr = phys_to_dma(hwdev, paddr);
 
-		if (swiotlb_force ||
+		if (swiotlb_force == SWIOTLB_FORCE ||
 		    !dma_capable(hwdev, dev_addr, sg->length)) {
 			phys_addr_t map = map_single(hwdev, sg_phys(sg),
 						     sg->length, dir);

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 108/130] swiotlb: Add swiotlb=noforce debug option
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (103 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 107/130] swiotlb: Convert swiotlb_force from int to enum Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 109/130] scsi: ses: Fix SAS device detection in enclosure Greg Kroah-Hartman
                     ` (21 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Geert Uytterhoeven, Konrad Rzeszutek Wilk

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

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

From: Geert Uytterhoeven <geert+renesas@glider.be>

commit fff5d99225107f5f13fe4a9805adc2a1c4b5fb00 upstream.

On architectures like arm64, swiotlb is tied intimately to the core
architecture DMA support. In addition, ZONE_DMA cannot be disabled.

To aid debugging and catch devices not supporting DMA to memory outside
the 32-bit address space, add a kernel command line option
"swiotlb=noforce", which disables the use of bounce buffers.
If specified, trying to map memory that cannot be used with DMA will
fail, and a rate-limited warning will be printed.

Note that io_tlb_nslabs is set to 1, which is the minimal supported
value.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 Documentation/kernel-parameters.txt |    3 ++-
 include/linux/swiotlb.h             |    1 +
 include/trace/events/swiotlb.h      |    3 ++-
 lib/swiotlb.c                       |   18 ++++++++++++++++--
 4 files changed, 21 insertions(+), 4 deletions(-)

--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -3998,10 +3998,11 @@ bytes respectively. Such letter suffixes
 			it if 0 is given (See Documentation/cgroup-v1/memory.txt)
 
 	swiotlb=	[ARM,IA-64,PPC,MIPS,X86]
-			Format: { <int> | force }
+			Format: { <int> | force | noforce }
 			<int> -- Number of I/O TLB slabs
 			force -- force using of bounce buffers even if they
 			         wouldn't be automatically used by the kernel
+			noforce -- Never use bounce buffers (for debugging)
 
 	switches=	[HW,M68k]
 
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -12,6 +12,7 @@ struct scatterlist;
 enum swiotlb_force {
 	SWIOTLB_NORMAL,		/* Default - depending on HW DMA mask etc. */
 	SWIOTLB_FORCE,		/* swiotlb=force */
+	SWIOTLB_NO_FORCE,	/* swiotlb=noforce */
 };
 
 extern enum swiotlb_force swiotlb_force;
--- a/include/trace/events/swiotlb.h
+++ b/include/trace/events/swiotlb.h
@@ -39,7 +39,8 @@ TRACE_EVENT(swiotlb_bounced,
 		__entry->size,
 		__print_symbolic(__entry->swiotlb_force,
 			{ SWIOTLB_NORMAL,	"NORMAL" },
-			{ SWIOTLB_FORCE,	"FORCE" }))
+			{ SWIOTLB_FORCE,	"FORCE" },
+			{ SWIOTLB_NO_FORCE,	"NO_FORCE" }))
 );
 
 #endif /*  _TRACE_SWIOTLB_H */
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -106,8 +106,12 @@ setup_io_tlb_npages(char *str)
 	}
 	if (*str == ',')
 		++str;
-	if (!strcmp(str, "force"))
+	if (!strcmp(str, "force")) {
 		swiotlb_force = SWIOTLB_FORCE;
+	} else if (!strcmp(str, "noforce")) {
+		swiotlb_force = SWIOTLB_NO_FORCE;
+		io_tlb_nslabs = 1;
+	}
 
 	return 0;
 }
@@ -541,8 +545,15 @@ static phys_addr_t
 map_single(struct device *hwdev, phys_addr_t phys, size_t size,
 	   enum dma_data_direction dir)
 {
-	dma_addr_t start_dma_addr = phys_to_dma(hwdev, io_tlb_start);
+	dma_addr_t start_dma_addr;
+
+	if (swiotlb_force == SWIOTLB_NO_FORCE) {
+		dev_warn_ratelimited(hwdev, "Cannot do DMA to address %pa\n",
+				     &phys);
+		return SWIOTLB_MAP_ERROR;
+	}
 
+	start_dma_addr = phys_to_dma(hwdev, io_tlb_start);
 	return swiotlb_tbl_map_single(hwdev, start_dma_addr, phys, size, dir);
 }
 
@@ -707,6 +718,9 @@ static void
 swiotlb_full(struct device *dev, size_t size, enum dma_data_direction dir,
 	     int do_panic)
 {
+	if (swiotlb_force == SWIOTLB_NO_FORCE)
+		return;
+
 	/*
 	 * Ran out of IOMMU space for this operation. This is very bad.
 	 * Unfortunately the drivers cannot handle this operation properly.

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 109/130] scsi: ses: Fix SAS device detection in enclosure
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (104 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 108/130] swiotlb: Add swiotlb=noforce debug option Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 110/130] scsi: mpt3sas: fix hang on ata passthrough commands Greg Kroah-Hartman
                     ` (20 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Ewan D. Milne, Johannes Thumshirn,
	James Bottomley, Martin K. Petersen

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

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

From: Ewan D. Milne <emilne@redhat.com>

commit 9373eba6cfae48911b977d14323032cd5d161aae upstream.

The call to scsi_is_sas_rphy() needs to be made on the SAS end_device,
not on the SCSI device.

Fixes: 835831c57e9b ("ses: use scsi_is_sas_rphy instead of is_sas_attached")
Signed-off-by: Ewan D. Milne <emilne@redhat.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/scsi/ses.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/scsi/ses.c
+++ b/drivers/scsi/ses.c
@@ -587,7 +587,7 @@ static void ses_match_to_enclosure(struc
 
 	ses_enclosure_data_process(edev, to_scsi_device(edev->edev.parent), 0);
 
-	if (scsi_is_sas_rphy(&sdev->sdev_gendev))
+	if (scsi_is_sas_rphy(sdev->sdev_target->dev.parent))
 		efd.addr = sas_get_address(sdev);
 
 	if (efd.addr) {

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 110/130] scsi: mpt3sas: fix hang on ata passthrough commands
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (105 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 109/130] scsi: ses: Fix SAS device detection in enclosure Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 111/130] PM / devfreq: exynos-bus: Fix the wrong return value Greg Kroah-Hartman
                     ` (19 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, James Bottomley, Sreekanth Reddy,
	Christoph Hellwig, Ingo Molnar, Martin K. Petersen

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

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

From: James Bottomley <James.Bottomley@HansenPartnership.com>

commit ffb58456589443ca572221fabbdef3db8483a779 upstream.

mpt3sas has a firmware failure where it can only handle one pass through
ATA command at a time.  If another comes in, contrary to the SAT
standard, it will hang until the first one completes (causing long
commands like secure erase to timeout).  The original fix was to block
the device when an ATA command came in, but this caused a regression
with

commit 669f044170d8933c3d66d231b69ea97cb8447338
Author: Bart Van Assche <bart.vanassche@sandisk.com>
Date:   Tue Nov 22 16:17:13 2016 -0800

    scsi: srp_transport: Move queuecommand() wait code to SCSI core

So fix the original fix of the secure erase timeout by properly
returning SAM_STAT_BUSY like the SAT recommends.  The original patch
also had a concurrency problem since scsih_qcmd is lockless at that
point (this is fixed by using atomic bitops to set and test the flag).

[mkp: addressed feedback wrt. test_bit and fixed whitespace]

Fixes: 18f6084a989ba1b (mpt3sas: Fix secure erase premature termination)
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Acked-by: Sreekanth Reddy <Sreekanth.Reddy@broadcom.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reported-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/scsi/mpt3sas/mpt3sas_base.h  |   12 ++++++++++
 drivers/scsi/mpt3sas/mpt3sas_scsih.c |   40 ++++++++++++++++++++++-------------
 2 files changed, 38 insertions(+), 14 deletions(-)

--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -393,6 +393,7 @@ struct MPT3SAS_TARGET {
  * @eedp_enable: eedp support enable bit
  * @eedp_type: 0(type_1), 1(type_2), 2(type_3)
  * @eedp_block_length: block size
+ * @ata_command_pending: SATL passthrough outstanding for device
  */
 struct MPT3SAS_DEVICE {
 	struct MPT3SAS_TARGET *sas_target;
@@ -402,6 +403,17 @@ struct MPT3SAS_DEVICE {
 	u8	block;
 	u8	tlr_snoop_check;
 	u8	ignore_delay_remove;
+	/*
+	 * Bug workaround for SATL handling: the mpt2/3sas firmware
+	 * doesn't return BUSY or TASK_SET_FULL for subsequent
+	 * commands while a SATL pass through is in operation as the
+	 * spec requires, it simply does nothing with them until the
+	 * pass through completes, causing them possibly to timeout if
+	 * the passthrough is a long executing command (like format or
+	 * secure erase).  This variable allows us to do the right
+	 * thing while a SATL command is pending.
+	 */
+	unsigned long ata_command_pending;
 };
 
 #define MPT3_CMD_NOT_USED	0x8000	/* free */
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -3885,9 +3885,18 @@ _scsih_temp_threshold_events(struct MPT3
 	}
 }
 
-static inline bool ata_12_16_cmd(struct scsi_cmnd *scmd)
+static int _scsih_set_satl_pending(struct scsi_cmnd *scmd, bool pending)
 {
-	return (scmd->cmnd[0] == ATA_12 || scmd->cmnd[0] == ATA_16);
+	struct MPT3SAS_DEVICE *priv = scmd->device->hostdata;
+
+	if (scmd->cmnd[0] != ATA_12 && scmd->cmnd[0] != ATA_16)
+		return 0;
+
+	if (pending)
+		return test_and_set_bit(0, &priv->ata_command_pending);
+
+	clear_bit(0, &priv->ata_command_pending);
+	return 0;
 }
 
 /**
@@ -3911,9 +3920,7 @@ _scsih_flush_running_cmds(struct MPT3SAS
 		if (!scmd)
 			continue;
 		count++;
-		if (ata_12_16_cmd(scmd))
-			scsi_internal_device_unblock(scmd->device,
-							SDEV_RUNNING);
+		_scsih_set_satl_pending(scmd, false);
 		mpt3sas_base_free_smid(ioc, smid);
 		scsi_dma_unmap(scmd);
 		if (ioc->pci_error_recovery)
@@ -4044,13 +4051,6 @@ scsih_qcmd(struct Scsi_Host *shost, stru
 	if (ioc->logging_level & MPT_DEBUG_SCSI)
 		scsi_print_command(scmd);
 
-	/*
-	 * Lock the device for any subsequent command until command is
-	 * done.
-	 */
-	if (ata_12_16_cmd(scmd))
-		scsi_internal_device_block(scmd->device);
-
 	sas_device_priv_data = scmd->device->hostdata;
 	if (!sas_device_priv_data || !sas_device_priv_data->sas_target) {
 		scmd->result = DID_NO_CONNECT << 16;
@@ -4064,6 +4064,19 @@ scsih_qcmd(struct Scsi_Host *shost, stru
 		return 0;
 	}
 
+	/*
+	 * Bug work around for firmware SATL handling.  The loop
+	 * is based on atomic operations and ensures consistency
+	 * since we're lockless at this point
+	 */
+	do {
+		if (test_bit(0, &sas_device_priv_data->ata_command_pending)) {
+			scmd->result = SAM_STAT_BUSY;
+			scmd->scsi_done(scmd);
+			return 0;
+		}
+	} while (_scsih_set_satl_pending(scmd, true));
+
 	sas_target_priv_data = sas_device_priv_data->sas_target;
 
 	/* invalid device handle */
@@ -4626,8 +4639,7 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *i
 	if (scmd == NULL)
 		return 1;
 
-	if (ata_12_16_cmd(scmd))
-		scsi_internal_device_unblock(scmd->device, SDEV_RUNNING);
+	_scsih_set_satl_pending(scmd, false);
 
 	mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
 

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 111/130] PM / devfreq: exynos-bus: Fix the wrong return value
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (106 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 110/130] scsi: mpt3sas: fix hang on ata passthrough commands Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 112/130] PM / devfreq: Fix the bug of devfreq_add_device when governor is NULL Greg Kroah-Hartman
                     ` (18 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Chanwoo Choi, Rafael J. Wysocki

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

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

From: Chanwoo Choi <cw00.choi@samsung.com>

commit 32dd7731699765f21dbe6df9020e613d4ed73fc3 upstream.

This patch fixes the wrong return value. If devfreq driver requires the wrong
and non-available governor, it is fail. So, this patch returns the error
insead of -EPROBE_DEFER.

Fixes: 403e0689d2a9 (PM / devfreq: exynos: Add support of bus frequency of sub-blocks using passive governor)
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/devfreq/exynos-bus.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/devfreq/exynos-bus.c
+++ b/drivers/devfreq/exynos-bus.c
@@ -498,7 +498,7 @@ passive:
 	if (IS_ERR(bus->devfreq)) {
 		dev_err(dev,
 			"failed to add devfreq dev with passive governor\n");
-		ret = -EPROBE_DEFER;
+		ret = PTR_ERR(bus->devfreq);
 		goto err;
 	}
 

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 112/130] PM / devfreq: Fix the bug of devfreq_add_device when governor is NULL
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (107 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 111/130] PM / devfreq: exynos-bus: Fix the wrong return value Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 113/130] mtd: spi-nor: Off by one in cqspi_setup_flash() Greg Kroah-Hartman
                     ` (17 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Chanwoo Choi, Rafael J. Wysocki

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

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

From: Chanwoo Choi <cw00.choi@samsung.com>

commit 73613b16cb5c5d5a659fc8832eff99eead3f9afb upstream.

This patch fixes the bug of devfreq_add_device(). The devfreq device must
have the default governor. If find_devfreq_governor() returns error,
devfreq_add_device() fail to add the devfreq instance.

Fixes: 1b5c1be2c88e (PM / devfreq: map devfreq drivers to governor using name)
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/devfreq/devfreq.c |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -593,11 +593,16 @@ struct devfreq *devfreq_add_device(struc
 	list_add(&devfreq->node, &devfreq_list);
 
 	governor = find_devfreq_governor(devfreq->governor_name);
-	if (!IS_ERR(governor))
-		devfreq->governor = governor;
-	if (devfreq->governor)
-		err = devfreq->governor->event_handler(devfreq,
-					DEVFREQ_GOV_START, NULL);
+	if (IS_ERR(governor)) {
+		dev_err(dev, "%s: Unable to find governor for the device\n",
+			__func__);
+		err = PTR_ERR(governor);
+		goto err_init;
+	}
+
+	devfreq->governor = governor;
+	err = devfreq->governor->event_handler(devfreq, DEVFREQ_GOV_START,
+						NULL);
 	if (err) {
 		dev_err(dev, "%s: Unable to start governor for the device\n",
 			__func__);

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 113/130] mtd: spi-nor: Off by one in cqspi_setup_flash()
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (108 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 112/130] PM / devfreq: Fix the bug of devfreq_add_device when governor is NULL Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 114/130] mtd: spi-nor: Fix some error codes " Greg Kroah-Hartman
                     ` (16 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Marek Vasut, Cyrille Pitchen

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

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

From: Dan Carpenter <dan.carpenter@oracle.com>

commit 193e87143c290ec16838f5368adc0e0bc94eb931 upstream.

There are CQSPI_MAX_CHIPSELECT elements in the ->f_pdata array so the >
should be >=.

Fixes: 140623410536 ('mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/mtd/spi-nor/cadence-quadspi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/mtd/spi-nor/cadence-quadspi.c
+++ b/drivers/mtd/spi-nor/cadence-quadspi.c
@@ -1082,7 +1082,7 @@ static int cqspi_setup_flash(struct cqsp
 			goto err;
 		}
 
-		if (cs > CQSPI_MAX_CHIPSELECT) {
+		if (cs >= CQSPI_MAX_CHIPSELECT) {
 			dev_err(dev, "Chip select %d out of range.\n", cs);
 			goto err;
 		}

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 114/130] mtd: spi-nor: Fix some error codes in cqspi_setup_flash()
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (109 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 113/130] mtd: spi-nor: Off by one in cqspi_setup_flash() Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 115/130] rpmsg: virtio_rpmsg_bus: fix channel creation Greg Kroah-Hartman
                     ` (15 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Marek Vasut,
	Moritz Fischer, Cyrille Pitchen

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

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

From: Dan Carpenter <dan.carpenter@oracle.com>

commit 10ad1d754a434c024ce7eeb1cec9f69fd3ecc863 upstream.

We return success or possibly uninitialized values on these error paths
instead of proper error codes.

Fixes: 140623410536 ("mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Moritz Fischer <moritz.fischer@ettus.com>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/mtd/spi-nor/cadence-quadspi.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/mtd/spi-nor/cadence-quadspi.c
+++ b/drivers/mtd/spi-nor/cadence-quadspi.c
@@ -1077,12 +1077,14 @@ static int cqspi_setup_flash(struct cqsp
 
 	/* Get flash device data */
 	for_each_available_child_of_node(dev->of_node, np) {
-		if (of_property_read_u32(np, "reg", &cs)) {
+		ret = of_property_read_u32(np, "reg", &cs);
+		if (ret) {
 			dev_err(dev, "Couldn't determine chip select.\n");
 			goto err;
 		}
 
 		if (cs >= CQSPI_MAX_CHIPSELECT) {
+			ret = -EINVAL;
 			dev_err(dev, "Chip select %d out of range.\n", cs);
 			goto err;
 		}

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 115/130] rpmsg: virtio_rpmsg_bus: fix channel creation
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (110 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 114/130] mtd: spi-nor: Fix some error codes " Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 116/130] [media] blackfin: check devm_pinctrl_get() for errors Greg Kroah-Hartman
                     ` (14 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Peter Griffin, Loic Pallardy,
	Bjorn Andersson

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

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

From: Loic Pallardy <loic.pallardy@st.com>

commit 63447646ac657fde00bb658ce21a3431940ae0ad upstream.

Since commit 4dffed5b3ac796b ("rpmsg: Name rpmsg devices based on
channel id"), it is no more possible for a firmware to register twice
a service (on different endpoints). rpmsg_register_device function
is failing when calling device_add for the second time as second
device has the same name as first one already register.
It is because name is based only on service name and so is not more
unique. Previously name was unique thanks to the use of rpmsg_dev_index.

This patch adds destination and source endpoint numbers device name to
create an unique identifier.

Fixes: 4dffed5b3ac7 ("rpmsg: Name rpmsg devices based on channel id")
Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
[bjorn: flipped name and address in device name]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/rpmsg/rpmsg_core.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/rpmsg/rpmsg_core.c
+++ b/drivers/rpmsg/rpmsg_core.c
@@ -411,8 +411,8 @@ int rpmsg_register_device(struct rpmsg_d
 	struct device *dev = &rpdev->dev;
 	int ret;
 
-	dev_set_name(&rpdev->dev, "%s:%s",
-		     dev_name(dev->parent), rpdev->id.name);
+	dev_set_name(&rpdev->dev, "%s.%s.%d.%d", dev_name(dev->parent),
+		     rpdev->id.name, rpdev->src, rpdev->dst);
 
 	rpdev->dev.bus = &rpmsg_bus;
 	rpdev->dev.release = rpmsg_release_device;

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 116/130] [media] blackfin: check devm_pinctrl_get() for errors
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (111 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 115/130] rpmsg: virtio_rpmsg_bus: fix channel creation Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 117/130] [media] platform: pxa_camera: add VIDEO_V4L2 dependency Greg Kroah-Hartman
                     ` (13 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Mauro Carvalho Chehab

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

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

From: Dan Carpenter <dan.carpenter@oracle.com>

commit c9205e18b41a6ef5ad73e1c4b86a78b2ea3ccb9b upstream.

devm_pinctrl_get() can fail so we should check for that.

Fixes: 0a6824bc10de ('[media] v4l2: blackfin: select proper pinctrl state in ppi_set_params if CONFIG_PINCTRL is enabled')

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/media/platform/blackfin/ppi.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/media/platform/blackfin/ppi.c
+++ b/drivers/media/platform/blackfin/ppi.c
@@ -214,6 +214,8 @@ static int ppi_set_params(struct ppi_if
 	if (params->dlen > 24 || params->dlen <= 0)
 		return -EINVAL;
 	pctrl = devm_pinctrl_get(ppi->dev);
+	if (IS_ERR(pctrl))
+		return PTR_ERR(pctrl);
 	pstate = pinctrl_lookup_state(pctrl,
 				      pin_state[(params->dlen + 7) / 8 - 1]);
 	if (pinctrl_select_state(pctrl, pstate))

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 117/130] [media] platform: pxa_camera: add VIDEO_V4L2 dependency
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (112 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 116/130] [media] blackfin: check devm_pinctrl_get() for errors Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 118/130] [media] gs1662: drop kfree for memory allocated with devm_kzalloc Greg Kroah-Hartman
                     ` (12 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Arnd Bergmann, Robert Jarzmik,
	Mauro Carvalho Chehab

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

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

From: Arnd Bergmann <arnd@arndb.de>

commit ff681022c6639c194fbb6893c50ace9e52a44788 upstream.

Moving the pxa_camera driver from soc_camera lots the implied
VIDEO_V4L2 Kconfig dependency, and building the driver without
V4L2 results in a kernel that cannot link:

drivers/media/platform/pxa_camera.o: In function `pxa_camera_remove':
pxa_camera.c:(.text.pxa_camera_remove+0x10): undefined reference to `v4l2_clk_unregister'
pxa_camera.c:(.text.pxa_camera_remove+0x18): undefined reference to `v4l2_device_unregister'
drivers/media/platform/pxa_camera.o: In function `pxa_camera_probe':
pxa_camera.c:(.text.pxa_camera_probe+0x458): undefined reference to `v4l2_of_parse_endpoint'
drivers/media/v4l2-core/videobuf2-core.o: In function `__enqueue_in_driver':
drivers/media/v4l2-core/videobuf2-core.o: In function `vb2_core_streamon':
videobuf2-core.c:(.text.vb2_core_streamon+0x1b4): undefined reference to `v4l_vb2q_enable_media_source'
drivers/media/v4l2-core/videobuf2-v4l2.o: In function `vb2_ioctl_reqbufs':
videobuf2-v4l2.c:(.text.vb2_ioctl_reqbufs+0xc): undefined reference to `video_devdata'

This adds back an explicit dependency.

Fixes: 3050b9985024 ("[media] media: platform: pxa_camera: move pxa_camera out of soc_camera")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/media/platform/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -93,7 +93,7 @@ config VIDEO_OMAP3_DEBUG
 
 config VIDEO_PXA27x
 	tristate "PXA27x Quick Capture Interface driver"
-	depends on VIDEO_DEV && HAS_DMA
+	depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA
 	depends on PXA27x || COMPILE_TEST
 	select VIDEOBUF2_DMA_SG
 	select SG_SPLIT

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 118/130] [media] gs1662: drop kfree for memory allocated with devm_kzalloc
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (113 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 117/130] [media] platform: pxa_camera: add VIDEO_V4L2 dependency Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:55   ` [PATCH 4.9 119/130] [media] ite-cir: initialize use_demodulator before using it Greg Kroah-Hartman
                     ` (11 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Wei Yongjun, Mauro Carvalho Chehab

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

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

From: Wei Yongjun <weiyongjun1@huawei.com>

commit df94121f02ecce435d6b5277071eb94b764caa89 upstream.

It's not necessary to free memory allocated with devm_kzalloc
and using kfree leads to a double free.

Fixes: 7aae6e2df127 ("[media] Add GS1662 driver, a video serializer")

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/media/spi/gs1662.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/drivers/media/spi/gs1662.c
+++ b/drivers/media/spi/gs1662.c
@@ -453,10 +453,9 @@ static int gs_probe(struct spi_device *s
 static int gs_remove(struct spi_device *spi)
 {
 	struct v4l2_subdev *sd = spi_get_drvdata(spi);
-	struct gs *gs = to_gs(sd);
 
 	v4l2_device_unregister_subdev(sd);
-	kfree(gs);
+
 	return 0;
 }
 

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 119/130] [media] ite-cir: initialize use_demodulator before using it
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (114 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 118/130] [media] gs1662: drop kfree for memory allocated with devm_kzalloc Greg Kroah-Hartman
@ 2017-01-24  7:55   ` Greg Kroah-Hartman
  2017-01-24  7:56   ` [PATCH 4.9 120/130] [media] st-hva: fix some error handling in hva_hw_probe() Greg Kroah-Hartman
                     ` (10 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Nicolas Iooss, Mauro Carvalho Chehab

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

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

From: Nicolas Iooss <nicolas.iooss_linux@m4x.org>

commit 7ec03e60ef81c19b5d3a46dd070ee966774b860f upstream.

Function ite_set_carrier_params() uses variable use_demodulator after
having initialized it to false in some if branches, but this variable is
never set to true otherwise.

This bug has been found using clang -Wsometimes-uninitialized warning
flag.

Fixes: 620a32bba4a2 ("[media] rc: New rc-based ite-cir driver for
several ITE CIRs")

Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/media/rc/ite-cir.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/media/rc/ite-cir.c
+++ b/drivers/media/rc/ite-cir.c
@@ -263,6 +263,8 @@ static void ite_set_carrier_params(struc
 
 			if (allowance > ITE_RXDCR_MAX)
 				allowance = ITE_RXDCR_MAX;
+
+			use_demodulator = true;
 		}
 	}
 

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 120/130] [media] st-hva: fix some error handling in hva_hw_probe()
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (115 preceding siblings ...)
  2017-01-24  7:55   ` [PATCH 4.9 119/130] [media] ite-cir: initialize use_demodulator before using it Greg Kroah-Hartman
@ 2017-01-24  7:56   ` Greg Kroah-Hartman
  2017-01-24  7:56   ` [PATCH 4.9 122/130] [media] s5p-mfc: Fix clock management in s5p_mfc_release() function Greg Kroah-Hartman
                     ` (9 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dan Carpenter,
	Jean-Christophe Trotin, Hans Verkuil, Mauro Carvalho Chehab

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

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

From: Dan Carpenter <dan.carpenter@oracle.com>

commit 6b2bed891253c08e7f4c17dbd46b71fc87f22eef upstream.

The devm_ioremap_resource() returns error pointers, never NULL.  The
platform_get_resource() returns NULL on error, never error pointers.
The error code needs to be set, as well.  The current code returns
PTR_ERR(NULL) which is success.

Fixes: 57b2c0628b60 ("[media] st-hva: multi-format video encoder V4L2 driver")

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Jean-Christophe Trotin <jean-christophe.trotin@st.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/media/platform/sti/hva/hva-hw.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/media/platform/sti/hva/hva-hw.c
+++ b/drivers/media/platform/sti/hva/hva-hw.c
@@ -305,16 +305,16 @@ int hva_hw_probe(struct platform_device
 	/* get memory for registers */
 	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	hva->regs = devm_ioremap_resource(dev, regs);
-	if (IS_ERR_OR_NULL(hva->regs)) {
+	if (IS_ERR(hva->regs)) {
 		dev_err(dev, "%s     failed to get regs\n", HVA_PREFIX);
 		return PTR_ERR(hva->regs);
 	}
 
 	/* get memory for esram */
 	esram = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	if (IS_ERR_OR_NULL(esram)) {
+	if (!esram) {
 		dev_err(dev, "%s     failed to get esram\n", HVA_PREFIX);
-		return PTR_ERR(esram);
+		return -ENODEV;
 	}
 	hva->esram_addr = esram->start;
 	hva->esram_size = resource_size(esram);

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 122/130] [media] s5p-mfc: Fix clock management in s5p_mfc_release() function
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (116 preceding siblings ...)
  2017-01-24  7:56   ` [PATCH 4.9 120/130] [media] st-hva: fix some error handling in hva_hw_probe() Greg Kroah-Hartman
@ 2017-01-24  7:56   ` Greg Kroah-Hartman
  2017-01-24  7:56   ` [PATCH 4.9 124/130] dmaengine: pl330: Fix runtime PM support for terminated transfers Greg Kroah-Hartman
                     ` (8 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Marek Szyprowski, Sylwester Nawrocki,
	Mauro Carvalho Chehab

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

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

From: Marek Szyprowski <m.szyprowski@samsung.com>

commit c0026c7bfb95c250c3e34fde59f96ad72fd730d6 upstream.

Clock control indirectly requires access to MFC device, so call it only
if we are sure that the device exists in s5p_mfc_release function.
s5p_mfc_remove() calls s5p_mfc_final_pm(), which releases all PM related
resources, including clocks, so any call to clocks related functions
is not valid after s5p_mfc_final_pm().

Fixes: d695c12 ("[media] media: s5p-mfc fix invalid memory access from
s5p_mfc_release()")

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/media/platform/s5p-mfc/s5p_mfc.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -926,10 +926,11 @@ static int s5p_mfc_release(struct file *
 	mfc_debug_enter();
 	if (dev)
 		mutex_lock(&dev->mfc_mutex);
-	s5p_mfc_clock_on();
 	vb2_queue_release(&ctx->vq_src);
 	vb2_queue_release(&ctx->vq_dst);
 	if (dev) {
+		s5p_mfc_clock_on();
+
 		/* Mark context as idle */
 		clear_work_bit_irqsave(ctx);
 		/*
@@ -951,9 +952,9 @@ static int s5p_mfc_release(struct file *
 			if (s5p_mfc_power_off() < 0)
 				mfc_err("Power off failed\n");
 		}
+		mfc_debug(2, "Shutting down clock\n");
+		s5p_mfc_clock_off();
 	}
-	mfc_debug(2, "Shutting down clock\n");
-	s5p_mfc_clock_off();
 	if (dev)
 		dev->ctx[ctx->num] = NULL;
 	s5p_mfc_dec_ctrls_delete(ctx);

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 124/130] dmaengine: pl330: Fix runtime PM support for terminated transfers
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (117 preceding siblings ...)
  2017-01-24  7:56   ` [PATCH 4.9 122/130] [media] s5p-mfc: Fix clock management in s5p_mfc_release() function Greg Kroah-Hartman
@ 2017-01-24  7:56   ` Greg Kroah-Hartman
  2017-01-24  7:56   ` [PATCH 4.9 125/130] spi: pxa2xx: add missed break Greg Kroah-Hartman
                     ` (7 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Marek Szyprowski,
	Krzysztof Kozlowski, Vinod Koul

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

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

From: Marek Szyprowski <m.szyprowski@samsung.com>

commit 5c9e6c2b2ba3ec3a442e2fb5b4286498f8b4dcb7 upstream.

PL330 DMA engine driver is leaking a runtime reference after any terminated
DMA transactions. This patch fixes this issue by tracking runtime PM state
of the device and making additional call to pm_runtime_put() in terminate_all
callback if needed.

Fixes: ae43b3289186 ("ARM: 8202/1: dmaengine: pl330: Add runtime Power Management support v12")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/dma/pl330.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -448,6 +448,9 @@ struct dma_pl330_chan {
 
 	/* for cyclic capability */
 	bool cyclic;
+
+	/* for runtime pm tracking */
+	bool active;
 };
 
 struct pl330_dmac {
@@ -2031,6 +2034,7 @@ static void pl330_tasklet(unsigned long
 		_stop(pch->thread);
 		spin_unlock(&pch->thread->dmac->lock);
 		power_down = true;
+		pch->active = false;
 	} else {
 		/* Make sure the PL330 Channel thread is active */
 		spin_lock(&pch->thread->dmac->lock);
@@ -2050,6 +2054,7 @@ static void pl330_tasklet(unsigned long
 			desc->status = PREP;
 			list_move_tail(&desc->node, &pch->work_list);
 			if (power_down) {
+				pch->active = true;
 				spin_lock(&pch->thread->dmac->lock);
 				_start(pch->thread);
 				spin_unlock(&pch->thread->dmac->lock);
@@ -2164,6 +2169,7 @@ static int pl330_terminate_all(struct dm
 	unsigned long flags;
 	struct pl330_dmac *pl330 = pch->dmac;
 	LIST_HEAD(list);
+	bool power_down = false;
 
 	pm_runtime_get_sync(pl330->ddma.dev);
 	spin_lock_irqsave(&pch->lock, flags);
@@ -2174,6 +2180,8 @@ static int pl330_terminate_all(struct dm
 	pch->thread->req[0].desc = NULL;
 	pch->thread->req[1].desc = NULL;
 	pch->thread->req_running = -1;
+	power_down = pch->active;
+	pch->active = false;
 
 	/* Mark all desc done */
 	list_for_each_entry(desc, &pch->submitted_list, node) {
@@ -2191,6 +2199,8 @@ static int pl330_terminate_all(struct dm
 	list_splice_tail_init(&pch->completed_list, &pl330->desc_pool);
 	spin_unlock_irqrestore(&pch->lock, flags);
 	pm_runtime_mark_last_busy(pl330->ddma.dev);
+	if (power_down)
+		pm_runtime_put_autosuspend(pl330->ddma.dev);
 	pm_runtime_put_autosuspend(pl330->ddma.dev);
 
 	return 0;
@@ -2350,6 +2360,7 @@ static void pl330_issue_pending(struct d
 		 * updated on work_list emptiness status.
 		 */
 		WARN_ON(list_empty(&pch->submitted_list));
+		pch->active = true;
 		pm_runtime_get_sync(pch->dmac->ddma.dev);
 	}
 	list_splice_tail_init(&pch->submitted_list, &pch->work_list);

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 125/130] spi: pxa2xx: add missed break
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (118 preceding siblings ...)
  2017-01-24  7:56   ` [PATCH 4.9 124/130] dmaengine: pl330: Fix runtime PM support for terminated transfers Greg Kroah-Hartman
@ 2017-01-24  7:56   ` Greg Kroah-Hartman
  2017-01-24  7:56   ` [PATCH 4.9 126/130] soc: ti: wkup_m3_ipc: Fix error return code in wkup_m3_ipc_probe() Greg Kroah-Hartman
                     ` (6 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Andy Shevchenko, Mark Brown

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

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

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

commit a2dd8af00ca7fff4972425a4a6b19dd1840dc807 upstream.

The commit 7c7289a40425 ("spi: pxa2xx: Default thresholds to PXA
configuration") while splitting up CE4100 code obviously missed a break
condition in one chunk. Add it here.

Looks like we have no active user of CE4100, though better to fix this later
than never.

Fixes: commit 7c7289a40425 ("spi: pxa2xx: Default thresholds to PXA configuration")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/spi/spi-pxa2xx.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -1690,6 +1690,7 @@ static int pxa2xx_spi_probe(struct platf
 		pxa2xx_spi_write(drv_data, SSCR1, tmp);
 		tmp = SSCR0_SCR(2) | SSCR0_Motorola | SSCR0_DataSize(8);
 		pxa2xx_spi_write(drv_data, SSCR0, tmp);
+		break;
 	default:
 		tmp = SSCR1_RxTresh(RX_THRESH_DFLT) |
 		      SSCR1_TxTresh(TX_THRESH_DFLT);

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 126/130] soc: ti: wkup_m3_ipc: Fix error return code in wkup_m3_ipc_probe()
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (119 preceding siblings ...)
  2017-01-24  7:56   ` [PATCH 4.9 125/130] spi: pxa2xx: add missed break Greg Kroah-Hartman
@ 2017-01-24  7:56   ` Greg Kroah-Hartman
  2017-01-24  7:56   ` [PATCH 4.9 127/130] selftest/powerpc: Wrong PMC initialized in pmc56_overflow test Greg Kroah-Hartman
                     ` (5 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Wei Yongjun, Tony Lindgren

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

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

From: Wei Yongjun <weiyongjun1@huawei.com>

commit 36b29eb30ee0f6c99f06bea406c23a3fd4cbb80b upstream.

Fix to return a negative error code from the kthread_run() error
handling case instead of 0, as done elsewhere in this function.

Fixes: cdd5de500b2c ("soc: ti: Add wkup_m3_ipc driver")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/soc/ti/wkup_m3_ipc.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/soc/ti/wkup_m3_ipc.c
+++ b/drivers/soc/ti/wkup_m3_ipc.c
@@ -459,6 +459,7 @@ static int wkup_m3_ipc_probe(struct plat
 
 	if (IS_ERR(task)) {
 		dev_err(dev, "can't create rproc_boot thread\n");
+		ret = PTR_ERR(task);
 		goto err_put_rproc;
 	}
 

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 127/130] selftest/powerpc: Wrong PMC initialized in pmc56_overflow test
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (120 preceding siblings ...)
  2017-01-24  7:56   ` [PATCH 4.9 126/130] soc: ti: wkup_m3_ipc: Fix error return code in wkup_m3_ipc_probe() Greg Kroah-Hartman
@ 2017-01-24  7:56   ` Greg Kroah-Hartman
  2017-01-24  7:56   ` [PATCH 4.9 128/130] tools/virtio/ringtest: fix run-on-all.sh for offline cpus Greg Kroah-Hartman
                     ` (4 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Madhavan Srinivasan, Michael Ellerman

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

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

From: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>

commit df21d2fa733035e4d414379960f94b2516b41296 upstream.

Test uses PMC2 to count the event. But PMC1 is being initialized.
Patch to fix it.

Fixes: 3752e453f6ba ('selftests/powerpc: Add tests of PMU EBBs')
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c
+++ b/tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c
@@ -66,7 +66,7 @@ int pmc56_overflow(void)
 
 	FAIL_IF(ebb_event_enable(&event));
 
-	mtspr(SPRN_PMC1, pmc_sample_period(sample_period));
+	mtspr(SPRN_PMC2, pmc_sample_period(sample_period));
 	mtspr(SPRN_PMC5, 0);
 	mtspr(SPRN_PMC6, 0);
 

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 128/130] tools/virtio/ringtest: fix run-on-all.sh for offline cpus
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (121 preceding siblings ...)
  2017-01-24  7:56   ` [PATCH 4.9 127/130] selftest/powerpc: Wrong PMC initialized in pmc56_overflow test Greg Kroah-Hartman
@ 2017-01-24  7:56   ` Greg Kroah-Hartman
  2017-01-24  7:56   ` [PATCH 4.9 129/130] libceph: uninline ceph_crypto_key_destroy() Greg Kroah-Hartman
                     ` (3 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Halil Pasic, Sascha Silbe, Cornelia Huck

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

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

From: Halil Pasic <pasic@linux.vnet.ibm.com>

commit 21f5eda9b8671744539c8295b9df62991fffb2ce upstream.

Since ef1b144d ("tools/virtio/ringtest: fix run-on-all.sh to work
without /dev/cpu") run-on-all.sh uses seq 0 $HOST_AFFINITY as the list
of ids of the CPUs to run the command on (assuming ids of online CPUs
are consecutive and start from 0), where $HOST_AFFINITY is the highest
CPU id in the system previously determined using lscpu.  This can fail
on systems with offline CPUs.

Instead let's use lscpu to determine the list of online CPUs.

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Fixes: ef1b144d ("tools/virtio/ringtest: fix run-on-all.sh to work without
/dev/cpu")
Reviewed-by: Sascha Silbe <silbe@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 tools/virtio/ringtest/run-on-all.sh |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/tools/virtio/ringtest/run-on-all.sh
+++ b/tools/virtio/ringtest/run-on-all.sh
@@ -1,12 +1,13 @@
 #!/bin/sh
 
+CPUS_ONLINE=$(lscpu --online -p=cpu|grep -v -e '#')
 #use last CPU for host. Why not the first?
 #many devices tend to use cpu0 by default so
 #it tends to be busier
-HOST_AFFINITY=$(lscpu -p=cpu | tail -1)
+HOST_AFFINITY=$(echo "${CPUS_ONLINE}"|tail -n 1)
 
 #run command on all cpus
-for cpu in $(seq 0 $HOST_AFFINITY)
+for cpu in $CPUS_ONLINE
 do
 	#Don't run guest and host on same CPU
 	#It actually works ok if using signalling

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 129/130] libceph: uninline ceph_crypto_key_destroy()
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (122 preceding siblings ...)
  2017-01-24  7:56   ` [PATCH 4.9 128/130] tools/virtio/ringtest: fix run-on-all.sh for offline cpus Greg Kroah-Hartman
@ 2017-01-24  7:56   ` Greg Kroah-Hartman
  2017-01-24  7:56   ` [PATCH 4.9 130/130] libceph: stop allocating a new cipher on every crypto request Greg Kroah-Hartman
                     ` (2 subsequent siblings)
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ilya Dryomov, Sage Weil

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

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

From: Ilya Dryomov <idryomov@gmail.com>

commit 6db2304aabb070261ad34923bfd83c43dfb000e3 upstream.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Sage Weil <sage@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/ceph/crypto.c |    8 ++++++++
 net/ceph/crypto.h |    9 +--------
 2 files changed, 9 insertions(+), 8 deletions(-)

--- a/net/ceph/crypto.c
+++ b/net/ceph/crypto.c
@@ -80,6 +80,14 @@ int ceph_crypto_key_unarmor(struct ceph_
 	return 0;
 }
 
+void ceph_crypto_key_destroy(struct ceph_crypto_key *key)
+{
+	if (key) {
+		kfree(key->key);
+		key->key = NULL;
+	}
+}
+
 static struct crypto_skcipher *ceph_crypto_alloc_cipher(void)
 {
 	return crypto_alloc_skcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC);
--- a/net/ceph/crypto.h
+++ b/net/ceph/crypto.h
@@ -14,19 +14,12 @@ struct ceph_crypto_key {
 	void *key;
 };
 
-static inline void ceph_crypto_key_destroy(struct ceph_crypto_key *key)
-{
-	if (key) {
-		kfree(key->key);
-		key->key = NULL;
-	}
-}
-
 int ceph_crypto_key_clone(struct ceph_crypto_key *dst,
 			  const struct ceph_crypto_key *src);
 int ceph_crypto_key_encode(struct ceph_crypto_key *key, void **p, void *end);
 int ceph_crypto_key_decode(struct ceph_crypto_key *key, void **p, void *end);
 int ceph_crypto_key_unarmor(struct ceph_crypto_key *key, const char *in);
+void ceph_crypto_key_destroy(struct ceph_crypto_key *key);
 
 /* crypto.c */
 int ceph_crypt(const struct ceph_crypto_key *key, bool encrypt,

^ permalink raw reply	[flat|nested] 130+ messages in thread

* [PATCH 4.9 130/130] libceph: stop allocating a new cipher on every crypto request
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (123 preceding siblings ...)
  2017-01-24  7:56   ` [PATCH 4.9 129/130] libceph: uninline ceph_crypto_key_destroy() Greg Kroah-Hartman
@ 2017-01-24  7:56   ` Greg Kroah-Hartman
  2017-01-24 18:26   ` [PATCH 4.9 000/130] 4.9.6-stable review Shuah Khan
  2017-01-24 19:07   ` Guenter Roeck
  126 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-24  7:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Lucas Stach, Ilya Dryomov, Sage Weil

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

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

From: Ilya Dryomov <idryomov@gmail.com>

commit 7af3ea189a9a13f090de51c97f676215dabc1205 upstream.

This is useless and more importantly not allowed on the writeback path,
because crypto_alloc_skcipher() allocates memory with GFP_KERNEL, which
can recurse back into the filesystem:

    kworker/9:3     D ffff92303f318180     0 20732      2 0x00000080
    Workqueue: ceph-msgr ceph_con_workfn [libceph]
     ffff923035dd4480 ffff923038f8a0c0 0000000000000001 000000009eb27318
     ffff92269eb28000 ffff92269eb27338 ffff923036b145ac ffff923035dd4480
     00000000ffffffff ffff923036b145b0 ffffffff951eb4e1 ffff923036b145a8
    Call Trace:
     [<ffffffff951eb4e1>] ? schedule+0x31/0x80
     [<ffffffff951eb77a>] ? schedule_preempt_disabled+0xa/0x10
     [<ffffffff951ed1f4>] ? __mutex_lock_slowpath+0xb4/0x130
     [<ffffffff951ed28b>] ? mutex_lock+0x1b/0x30
     [<ffffffffc0a974b3>] ? xfs_reclaim_inodes_ag+0x233/0x2d0 [xfs]
     [<ffffffff94d92ba5>] ? move_active_pages_to_lru+0x125/0x270
     [<ffffffff94f2b985>] ? radix_tree_gang_lookup_tag+0xc5/0x1c0
     [<ffffffff94dad0f3>] ? __list_lru_walk_one.isra.3+0x33/0x120
     [<ffffffffc0a98331>] ? xfs_reclaim_inodes_nr+0x31/0x40 [xfs]
     [<ffffffff94e05bfe>] ? super_cache_scan+0x17e/0x190
     [<ffffffff94d919f3>] ? shrink_slab.part.38+0x1e3/0x3d0
     [<ffffffff94d9616a>] ? shrink_node+0x10a/0x320
     [<ffffffff94d96474>] ? do_try_to_free_pages+0xf4/0x350
     [<ffffffff94d967ba>] ? try_to_free_pages+0xea/0x1b0
     [<ffffffff94d863bd>] ? __alloc_pages_nodemask+0x61d/0xe60
     [<ffffffff94ddf42d>] ? cache_grow_begin+0x9d/0x560
     [<ffffffff94ddfb88>] ? fallback_alloc+0x148/0x1c0
     [<ffffffff94ed84e7>] ? __crypto_alloc_tfm+0x37/0x130
     [<ffffffff94de09db>] ? __kmalloc+0x1eb/0x580
     [<ffffffffc09fe2db>] ? crush_choose_firstn+0x3eb/0x470 [libceph]
     [<ffffffff94ed84e7>] ? __crypto_alloc_tfm+0x37/0x130
     [<ffffffff94ed9c19>] ? crypto_spawn_tfm+0x39/0x60
     [<ffffffffc08b30a3>] ? crypto_cbc_init_tfm+0x23/0x40 [cbc]
     [<ffffffff94ed857c>] ? __crypto_alloc_tfm+0xcc/0x130
     [<ffffffff94edcc23>] ? crypto_skcipher_init_tfm+0x113/0x180
     [<ffffffff94ed7cc3>] ? crypto_create_tfm+0x43/0xb0
     [<ffffffff94ed83b0>] ? crypto_larval_lookup+0x150/0x150
     [<ffffffff94ed7da2>] ? crypto_alloc_tfm+0x72/0x120
     [<ffffffffc0a01dd7>] ? ceph_aes_encrypt2+0x67/0x400 [libceph]
     [<ffffffffc09fd264>] ? ceph_pg_to_up_acting_osds+0x84/0x5b0 [libceph]
     [<ffffffff950d40a0>] ? release_sock+0x40/0x90
     [<ffffffff95139f94>] ? tcp_recvmsg+0x4b4/0xae0
     [<ffffffffc0a02714>] ? ceph_encrypt2+0x54/0xc0 [libceph]
     [<ffffffffc0a02b4d>] ? ceph_x_encrypt+0x5d/0x90 [libceph]
     [<ffffffffc0a02bdf>] ? calcu_signature+0x5f/0x90 [libceph]
     [<ffffffffc0a02ef5>] ? ceph_x_sign_message+0x35/0x50 [libceph]
     [<ffffffffc09e948c>] ? prepare_write_message_footer+0x5c/0xa0 [libceph]
     [<ffffffffc09ecd18>] ? ceph_con_workfn+0x2258/0x2dd0 [libceph]
     [<ffffffffc09e9903>] ? queue_con_delay+0x33/0xd0 [libceph]
     [<ffffffffc09f68ed>] ? __submit_request+0x20d/0x2f0 [libceph]
     [<ffffffffc09f6ef8>] ? ceph_osdc_start_request+0x28/0x30 [libceph]
     [<ffffffffc0b52603>] ? rbd_queue_workfn+0x2f3/0x350 [rbd]
     [<ffffffff94c94ec0>] ? process_one_work+0x160/0x410
     [<ffffffff94c951bd>] ? worker_thread+0x4d/0x480
     [<ffffffff94c95170>] ? process_one_work+0x410/0x410
     [<ffffffff94c9af8d>] ? kthread+0xcd/0xf0
     [<ffffffff951efb2f>] ? ret_from_fork+0x1f/0x40
     [<ffffffff94c9aec0>] ? kthread_create_on_node+0x190/0x190

Allocating the cipher along with the key fixes the issue - as long the
key doesn't change, a single cipher context can be used concurrently in
multiple requests.

We still can't take that GFP_KERNEL allocation though.  Both
ceph_crypto_key_clone() and ceph_crypto_key_decode() are called from
GFP_NOFS context, so resort to memalloc_noio_{save,restore}() here.

Reported-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Sage Weil <sage@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/ceph/crypto.c |   85 ++++++++++++++++++++++++++++++++++++++----------------
 net/ceph/crypto.h |    1 
 2 files changed, 61 insertions(+), 25 deletions(-)

--- a/net/ceph/crypto.c
+++ b/net/ceph/crypto.c
@@ -13,14 +13,60 @@
 #include <linux/ceph/decode.h>
 #include "crypto.h"
 
+/*
+ * Set ->key and ->tfm.  The rest of the key should be filled in before
+ * this function is called.
+ */
+static int set_secret(struct ceph_crypto_key *key, void *buf)
+{
+	unsigned int noio_flag;
+	int ret;
+
+	key->key = NULL;
+	key->tfm = NULL;
+
+	switch (key->type) {
+	case CEPH_CRYPTO_NONE:
+		return 0; /* nothing to do */
+	case CEPH_CRYPTO_AES:
+		break;
+	default:
+		return -ENOTSUPP;
+	}
+
+	WARN_ON(!key->len);
+	key->key = kmemdup(buf, key->len, GFP_NOIO);
+	if (!key->key) {
+		ret = -ENOMEM;
+		goto fail;
+	}
+
+	/* crypto_alloc_skcipher() allocates with GFP_KERNEL */
+	noio_flag = memalloc_noio_save();
+	key->tfm = crypto_alloc_skcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC);
+	memalloc_noio_restore(noio_flag);
+	if (IS_ERR(key->tfm)) {
+		ret = PTR_ERR(key->tfm);
+		key->tfm = NULL;
+		goto fail;
+	}
+
+	ret = crypto_skcipher_setkey(key->tfm, key->key, key->len);
+	if (ret)
+		goto fail;
+
+	return 0;
+
+fail:
+	ceph_crypto_key_destroy(key);
+	return ret;
+}
+
 int ceph_crypto_key_clone(struct ceph_crypto_key *dst,
 			  const struct ceph_crypto_key *src)
 {
 	memcpy(dst, src, sizeof(struct ceph_crypto_key));
-	dst->key = kmemdup(src->key, src->len, GFP_NOFS);
-	if (!dst->key)
-		return -ENOMEM;
-	return 0;
+	return set_secret(dst, src->key);
 }
 
 int ceph_crypto_key_encode(struct ceph_crypto_key *key, void **p, void *end)
@@ -37,16 +83,16 @@ int ceph_crypto_key_encode(struct ceph_c
 
 int ceph_crypto_key_decode(struct ceph_crypto_key *key, void **p, void *end)
 {
+	int ret;
+
 	ceph_decode_need(p, end, 2*sizeof(u16) + sizeof(key->created), bad);
 	key->type = ceph_decode_16(p);
 	ceph_decode_copy(p, &key->created, sizeof(key->created));
 	key->len = ceph_decode_16(p);
 	ceph_decode_need(p, end, key->len, bad);
-	key->key = kmalloc(key->len, GFP_NOFS);
-	if (!key->key)
-		return -ENOMEM;
-	ceph_decode_copy(p, key->key, key->len);
-	return 0;
+	ret = set_secret(key, *p);
+	*p += key->len;
+	return ret;
 
 bad:
 	dout("failed to decode crypto key\n");
@@ -85,14 +131,11 @@ void ceph_crypto_key_destroy(struct ceph
 	if (key) {
 		kfree(key->key);
 		key->key = NULL;
+		crypto_free_skcipher(key->tfm);
+		key->tfm = NULL;
 	}
 }
 
-static struct crypto_skcipher *ceph_crypto_alloc_cipher(void)
-{
-	return crypto_alloc_skcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC);
-}
-
 static const u8 *aes_iv = (u8 *)CEPH_AES_IV;
 
 /*
@@ -168,8 +211,7 @@ static void teardown_sgtable(struct sg_t
 static int ceph_aes_crypt(const struct ceph_crypto_key *key, bool encrypt,
 			  void *buf, int buf_len, int in_len, int *pout_len)
 {
-	struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher();
-	SKCIPHER_REQUEST_ON_STACK(req, tfm);
+	SKCIPHER_REQUEST_ON_STACK(req, key->tfm);
 	struct sg_table sgt;
 	struct scatterlist prealloc_sg;
 	char iv[AES_BLOCK_SIZE] __aligned(8);
@@ -177,20 +219,15 @@ static int ceph_aes_crypt(const struct c
 	int crypt_len = encrypt ? in_len + pad_byte : in_len;
 	int ret;
 
-	if (IS_ERR(tfm))
-		return PTR_ERR(tfm);
-
 	WARN_ON(crypt_len > buf_len);
 	if (encrypt)
 		memset(buf + in_len, pad_byte, pad_byte);
 	ret = setup_sgtable(&sgt, &prealloc_sg, buf, crypt_len);
 	if (ret)
-		goto out_tfm;
+		return ret;
 
-	crypto_skcipher_setkey((void *)tfm, key->key, key->len);
 	memcpy(iv, aes_iv, AES_BLOCK_SIZE);
-
-	skcipher_request_set_tfm(req, tfm);
+	skcipher_request_set_tfm(req, key->tfm);
 	skcipher_request_set_callback(req, 0, NULL, NULL);
 	skcipher_request_set_crypt(req, sgt.sgl, sgt.sgl, crypt_len, iv);
 
@@ -232,8 +269,6 @@ static int ceph_aes_crypt(const struct c
 
 out_sgt:
 	teardown_sgtable(&sgt);
-out_tfm:
-	crypto_free_skcipher(tfm);
 	return ret;
 }
 
--- a/net/ceph/crypto.h
+++ b/net/ceph/crypto.h
@@ -12,6 +12,7 @@ struct ceph_crypto_key {
 	struct ceph_timespec created;
 	int len;
 	void *key;
+	struct crypto_skcipher *tfm;
 };
 
 int ceph_crypto_key_clone(struct ceph_crypto_key *dst,

^ permalink raw reply	[flat|nested] 130+ messages in thread

* Re: [PATCH 4.9 000/130] 4.9.6-stable review
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (124 preceding siblings ...)
  2017-01-24  7:56   ` [PATCH 4.9 130/130] libceph: stop allocating a new cipher on every crypto request Greg Kroah-Hartman
@ 2017-01-24 18:26   ` Shuah Khan
  2017-01-25 11:02     ` Greg Kroah-Hartman
  2017-01-24 19:07   ` Guenter Roeck
  126 siblings, 1 reply; 130+ messages in thread
From: Shuah Khan @ 2017-01-24 18:26 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: torvalds, akpm, linux, patches, ben.hutchings, stable, Shuah Khan

On 01/24/2017 12:54 AM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.9.6 release.
> There are 130 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 Thu Jan 26 07:55:13 UTC 2017.
> 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.9.6-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.9.y
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h
> 

Compiled and booted on my test system. No dmesg regressions.

thanks,
-- Shuah

-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America(Silicon Valley)
shuah.kh@samsung.com

^ permalink raw reply	[flat|nested] 130+ messages in thread

* Re: [PATCH 4.9 000/130] 4.9.6-stable review
  2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
                     ` (125 preceding siblings ...)
  2017-01-24 18:26   ` [PATCH 4.9 000/130] 4.9.6-stable review Shuah Khan
@ 2017-01-24 19:07   ` Guenter Roeck
  2017-01-25 11:02     ` Greg Kroah-Hartman
  126 siblings, 1 reply; 130+ messages in thread
From: Guenter Roeck @ 2017-01-24 19:07 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, torvalds, akpm, shuah.kh, patches, ben.hutchings, stable

On Tue, Jan 24, 2017 at 08:54:00AM +0100, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.9.6 release.
> There are 130 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 Thu Jan 26 07:55:13 UTC 2017.
> Anything received after that time might be too late.
> 

Build results:
	total: 149 pass: 149 fail: 0
Qemu test results:
	total: 122 pass: 122 fail: 0

Details are available at http://kerneltests.org/builders.

Guenter

^ permalink raw reply	[flat|nested] 130+ messages in thread

* Re: [PATCH 4.9 000/130] 4.9.6-stable review
  2017-01-24 18:26   ` [PATCH 4.9 000/130] 4.9.6-stable review Shuah Khan
@ 2017-01-25 11:02     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-25 11:02 UTC (permalink / raw)
  To: Shuah Khan
  Cc: linux-kernel, torvalds, akpm, linux, patches, ben.hutchings, stable

On Tue, Jan 24, 2017 at 11:26:04AM -0700, Shuah Khan wrote:
> On 01/24/2017 12:54 AM, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.9.6 release.
> > There are 130 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 Thu Jan 26 07:55:13 UTC 2017.
> > 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.9.6-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.9.y
> > and the diffstat can be found below.
> > 
> > thanks,
> > 
> > greg k-h
> > 
> 
> Compiled and booted on my test system. No dmesg regressions.

Thanks for testing both of these and letting me know.

greg k-h

^ permalink raw reply	[flat|nested] 130+ messages in thread

* Re: [PATCH 4.9 000/130] 4.9.6-stable review
  2017-01-24 19:07   ` Guenter Roeck
@ 2017-01-25 11:02     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 130+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-25 11:02 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: linux-kernel, torvalds, akpm, shuah.kh, patches, ben.hutchings, stable

On Tue, Jan 24, 2017 at 11:07:29AM -0800, Guenter Roeck wrote:
> On Tue, Jan 24, 2017 at 08:54:00AM +0100, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.9.6 release.
> > There are 130 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 Thu Jan 26 07:55:13 UTC 2017.
> > Anything received after that time might be too late.
> > 
> 
> Build results:
> 	total: 149 pass: 149 fail: 0
> Qemu test results:
> 	total: 122 pass: 122 fail: 0
> 
> Details are available at http://kerneltests.org/builders.

Thanks for testing both of these and letting me know.

greg k-h

^ permalink raw reply	[flat|nested] 130+ messages in thread

end of thread, other threads:[~2017-01-25 11:02 UTC | newest]

Thread overview: 130+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170124080037epcas2p270f8226e76503a60d8fcf6925a8c918b@epcas2p2.samsung.com>
2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 001/130] IB/core: Release allocated memory in cache setup failure Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 002/130] IB/rxe: Increase max number of completions to 32k Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 003/130] IB/rxe: avoid putting a large struct rxe_qp on stack Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 004/130] IB/mlx5: Avoid system crash when enabling many VFs Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 005/130] IB/mlx5: Fix reported max SGE calculation Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 006/130] IB/mlx5: Assign SRQ type earlier Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 007/130] IB/mlx5: Wait for all async command completions to complete Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 008/130] IB/mlx4: Set traffic class in AH Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 009/130] IB/mlx4: Fix out-of-range array index in destroy qp flow Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 010/130] IB/mlx4: Handle well-known-gid in mad_demux processing Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 011/130] IB/mlx4: Fix port query for 56Gb Ethernet links Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 012/130] IB/mlx4: When no DMFS for IPoIB, dont allow NET_IF QPs Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 013/130] IB/mlx4: Check if GRH is available before using it Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 014/130] IB/IPoIB: Remove cant use GFP_NOIO warning Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 015/130] perf trace: Use the syscall raw_syscalls:sys_enter timestamp Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 016/130] perf mem: Fix --all-user/--all-kernel options Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 017/130] perf trace: Check if MAP_32BIT is defined (again) Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 018/130] perf diff: Do not overwrite valid build id Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 019/130] perf callchain: Fixup help/config for no-unwinding Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 020/130] perf scripting: Avoid leaking the scripting_context variable Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 021/130] perf jit: Enable jitdump support without dwarf Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 023/130] ARM: dts: r8a7794: Use SYSC "always-on" PM Domain for sound Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 024/130] ARM: dts: r8a7794: remove Z clock Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 025/130] ARM: dts: imx6q-cm-fx6: fix fec pinctrl Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 026/130] ARM: dts: imx31: fix clock control module interrupts description Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 028/130] ARM: dts: imx31: fix AVIC base address Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 029/130] ARM: dts: omap3: Add DTS for Logic PD SOM-LV 37xx Dev Kit Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 030/130] tmpfs: clear S_ISGID when setting posix ACLs Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 031/130] x86/PCI: Ignore _CRS on Supermicro X8DTH-i/6/iF/6F Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 032/130] rcu: Remove cond_resched() from Tiny synchronize_sched() Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 033/130] rcu: Narrow early boot window of illegal synchronous grace periods Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 034/130] sunrpc: dont call sleeping functions from the notifier block callbacks Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 035/130] svcrpc: dont leak contexts on PROC_DESTROY Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 036/130] libnvdimm, namespace: fix pmem namespace leak, delete when size set to zero Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 037/130] ARC: module: Fix !CONFIG_ARC_DW2_UNWIND builds Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 038/130] fuse: clear FR_PENDING flag when moving requests out of pending queue Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 039/130] fuse: fix time_to_jiffies nsec sanity check Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 040/130] PCI: designware: Check for iATU unroll only on platforms that use ATU Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 041/130] PCI: Enumerate switches below PCI-to-PCIe bridges Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 042/130] HID: corsair: fix DMA buffers on stack Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 043/130] HID: corsair: fix control-transfer error handling Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 044/130] mmc: sdhci-acpi: Only powered up enabled acpi child devices Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 045/130] mmc: mxs-mmc: Fix additional cycles after transmission stop Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 046/130] ieee802154: atusb: do not use the stack for buffers to make them DMA able Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 047/130] mtd: nand: lpc32xx: fix invalid error handling of a requested irq Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 048/130] mtd: nand: xway: disable module support Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 049/130] mtd: nand: xway: fix build because of module functions Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 050/130] KVM: s390: do not expose random data via facility bitmap Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 051/130] KVM: arm/arm64: vgic: Fix deadlock on error handling Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 052/130] powerpc/icp-opal: Fix missing KVM case and harden replay Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 053/130] powerpc/perf: Fix PM_BRU_CMPL event code for power9 Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 054/130] powerpc/ptrace: Preserve previous fprs/vsrs on short regset write Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 055/130] powerpc/ptrace: Preserve previous TM " Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 056/130] powerpc: Ignore reserved field in DCSR and PVR reads and writes Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 057/130] x86/ioapic: Restore IO-APIC irq_chip retrigger callback Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 058/130] qla2xxx: Fix crash due to null pointer access Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 059/130] mac80211: implement multicast forwarding on fast-RX path Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 060/130] ubifs: Fix journal replay wrt. xattr nodes Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 061/130] clocksource/exynos_mct: Clear interrupt when cpu is shut down Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 062/130] svcrdma: avoid duplicate dma unmapping during error recovery Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 063/130] ARM: 8634/1: hw_breakpoint: blacklist Scorpion CPUs Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 064/130] ibmvscsis: Fix sleeping in interrupt context Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 065/130] ibmvscsis: Fix max transfer length Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 066/130] ceph: fix bad endianness handling in parse_reply_info_extra Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 067/130] ARM: dts: OMAP5 / DRA7: indicate that SATA port 0 is available Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 068/130] ARM: dts: da850-evm: fix read access to SPI flash Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 069/130] arm64: avoid returning from bad_mode Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 070/130] arm64/ptrace: Preserve previous registers for short regset write Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 071/130] arm64/ptrace: Preserve previous registers for short regset write - 2 Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 072/130] arm64/ptrace: Preserve previous registers for short regset write - 3 Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 073/130] arm64/ptrace: Avoid uninitialised struct padding in fpr_set() Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 074/130] arm64/ptrace: Reject attempts to set incomplete hardware breakpoint fields Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 076/130] libceph: ceph_x_encrypt_buflen() takes in_len Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 077/130] libceph: old_key in process_one_ticket() is redundant Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 078/130] libceph: introduce ceph_x_encrypt_offset() Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 079/130] libceph: introduce ceph_crypt() for in-place en/decryption Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 080/130] libceph: rename and align ceph_x_authorizer::reply_buf Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 081/130] libceph: tweak calcu_signature() a little Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 082/130] libceph: switch ceph_x_encrypt() to ceph_crypt() Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 083/130] libceph: switch ceph_x_decrypt() " Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 084/130] libceph: remove now unused ceph_*{en,de}crypt*() functions Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 085/130] ARM: dts: dra7: Add an empty chosen node to top level DTSI Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 086/130] ARM: dts: dm816x: " Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 087/130] ARM: dts: dm814x: " Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 088/130] ARM: dts: am33xx: " Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 089/130] ARM: dts: omap4: " Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 090/130] ARM: dts: omap5: " Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 091/130] ARM: dts: am4372: " Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 092/130] ARM: dts: omap3: " Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 093/130] ARM: dts: omap2: " Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 094/130] ARM: dts: imx6qdl-nitrogen6_max: fix sgtl5000 pinctrl init Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 095/130] ARM: dts: omap3: Fix Card Detect and Write Protect on Logic PD SOM-LV Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 096/130] ARM: ux500: fix prcmu_is_cpu_in_wfi() calculation Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 097/130] ARM: 8613/1: Fix the uaccess crash on PB11MPCore Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 098/130] ceph: fix scheduler warning due to nested blocking Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 099/130] ceph: fix ceph_get_caps() interruption Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 100/130] ceph: fix endianness of getattr mask in ceph_d_revalidate Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 101/130] ceph: fix endianness bug in frag_tree_split_cmp Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 102/130] libceph: make sure ceph_aes_crypt() IV is aligned Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 103/130] xprtrdma: Make FRWR send queue entry accounting more accurate Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 104/130] xprtrdma: Squelch "max send, max recv" messages at connect time Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 105/130] arm64: mm: avoid name clash in __page_to_voff() Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 106/130] arm64: Fix swiotlb fallback allocation Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 107/130] swiotlb: Convert swiotlb_force from int to enum Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 108/130] swiotlb: Add swiotlb=noforce debug option Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 109/130] scsi: ses: Fix SAS device detection in enclosure Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 110/130] scsi: mpt3sas: fix hang on ata passthrough commands Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 111/130] PM / devfreq: exynos-bus: Fix the wrong return value Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 112/130] PM / devfreq: Fix the bug of devfreq_add_device when governor is NULL Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 113/130] mtd: spi-nor: Off by one in cqspi_setup_flash() Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 114/130] mtd: spi-nor: Fix some error codes " Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 115/130] rpmsg: virtio_rpmsg_bus: fix channel creation Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 116/130] [media] blackfin: check devm_pinctrl_get() for errors Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 117/130] [media] platform: pxa_camera: add VIDEO_V4L2 dependency Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 118/130] [media] gs1662: drop kfree for memory allocated with devm_kzalloc Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 119/130] [media] ite-cir: initialize use_demodulator before using it Greg Kroah-Hartman
2017-01-24  7:56   ` [PATCH 4.9 120/130] [media] st-hva: fix some error handling in hva_hw_probe() Greg Kroah-Hartman
2017-01-24  7:56   ` [PATCH 4.9 122/130] [media] s5p-mfc: Fix clock management in s5p_mfc_release() function Greg Kroah-Hartman
2017-01-24  7:56   ` [PATCH 4.9 124/130] dmaengine: pl330: Fix runtime PM support for terminated transfers Greg Kroah-Hartman
2017-01-24  7:56   ` [PATCH 4.9 125/130] spi: pxa2xx: add missed break Greg Kroah-Hartman
2017-01-24  7:56   ` [PATCH 4.9 126/130] soc: ti: wkup_m3_ipc: Fix error return code in wkup_m3_ipc_probe() Greg Kroah-Hartman
2017-01-24  7:56   ` [PATCH 4.9 127/130] selftest/powerpc: Wrong PMC initialized in pmc56_overflow test Greg Kroah-Hartman
2017-01-24  7:56   ` [PATCH 4.9 128/130] tools/virtio/ringtest: fix run-on-all.sh for offline cpus Greg Kroah-Hartman
2017-01-24  7:56   ` [PATCH 4.9 129/130] libceph: uninline ceph_crypto_key_destroy() Greg Kroah-Hartman
2017-01-24  7:56   ` [PATCH 4.9 130/130] libceph: stop allocating a new cipher on every crypto request Greg Kroah-Hartman
2017-01-24 18:26   ` [PATCH 4.9 000/130] 4.9.6-stable review Shuah Khan
2017-01-25 11:02     ` Greg Kroah-Hartman
2017-01-24 19:07   ` Guenter Roeck
2017-01-25 11:02     ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).