All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4.4 000/118] 4.4.22-stable review
@ 2016-09-22 17:28 ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 001/118] ext4: use __GFP_NOFAIL in ext4_free_blocks() Greg Kroah-Hartman
                     ` (116 more replies)
  0 siblings, 117 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 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.4.22 release.
There are 118 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 Sat Sep 24 17:29:17 UTC 2016.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
	kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.22-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.4.y
and the diffstat can be found below.

thanks,

greg k-h

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

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

Al Viro <viro@zeniv.linux.org.uk>
    ia64: copy_from_user() should zero the destination on access_ok() failure

Thomas Gleixner <tglx@linutronix.de>
    genirq/msi: Fix broken debug output

Al Viro <viro@zeniv.linux.org.uk>
    ppc32: fix copy_from_user()

Al Viro <viro@zeniv.linux.org.uk>
    sparc32: fix copy_from_user()

Al Viro <viro@zeniv.linux.org.uk>
    mn10300: copy_from_user() should zero on access_ok() failure...

Al Viro <viro@zeniv.linux.org.uk>
    nios2: copy_from_user() should zero the tail of destination

Al Viro <viro@zeniv.linux.org.uk>
    openrisc: fix copy_from_user()

Al Viro <viro@zeniv.linux.org.uk>
    parisc: fix copy_from_user()

Al Viro <viro@zeniv.linux.org.uk>
    metag: copy_from_user() should zero the destination on access_ok() failure

Al Viro <viro@zeniv.linux.org.uk>
    alpha: fix copy_from_user()

Al Viro <viro@zeniv.linux.org.uk>
    asm-generic: make copy_from_user() zero the destination properly

Al Viro <viro@zeniv.linux.org.uk>
    mips: copy_from_user() must zero the destination on access_ok() failure

Al Viro <viro@zeniv.linux.org.uk>
    hexagon: fix strncpy_from_user() error return

Al Viro <viro@zeniv.linux.org.uk>
    sh: fix copy_from_user()

Al Viro <viro@zeniv.linux.org.uk>
    score: fix copy_from_user() and friends

Al Viro <viro@zeniv.linux.org.uk>
    blackfin: fix copy_from_user()

Al Viro <viro@zeniv.linux.org.uk>
    cris: buggered copy_from_user/copy_to_user/clear_user

Al Viro <viro@zeniv.linux.org.uk>
    frv: fix clear_user()

Al Viro <viro@zeniv.linux.org.uk>
    asm-generic: make get_user() clear the destination on errors

Vineet Gupta <Vineet.Gupta1@synopsys.com>
    ARC: uaccess: get_user to zero out dest in cause of fault

Al Viro <viro@zeniv.linux.org.uk>
    s390: get_user() should zero on failure

Al Viro <viro@zeniv.linux.org.uk>
    score: fix __get_user/get_user

Al Viro <viro@zeniv.linux.org.uk>
    nios2: fix __get_user()

Al Viro <viro@zeniv.linux.org.uk>
    sh64: failing __get_user() should zero

Al Viro <viro@zeniv.linux.org.uk>
    m32r: fix __get_user()

Al Viro <viro@zeniv.linux.org.uk>
    mn10300: failing __get_user() and get_user() should zero

Al Viro <viro@ZenIV.linux.org.uk>
    fix minor infoleak in get_user_ex()

Al Viro <viro@zeniv.linux.org.uk>
    microblaze: fix copy_from_user()

Al Viro <viro@zeniv.linux.org.uk>
    avr32: fix copy_from_user()

Al Viro <viro@zeniv.linux.org.uk>
    microblaze: fix __get_user()

Al Viro <viro@ZenIV.linux.org.uk>
    fix iov_iter_fault_in_readable()

Boris Brezillon <boris.brezillon@free-electrons.com>
    irqchip/atmel-aic: Fix potential deadlock in ->xlate()

Boris Brezillon <boris.brezillon@free-electrons.com>
    genirq: Provide irq_gc_{lock_irqsave,unlock_irqrestore}() helpers

Kristian H. Kristensen <hoegsberg@gmail.com>
    drm: Only use compat ioctl for addfb2 on X86/IA64

Jan Leupold <leupold@rsi-elektrotechnik.de>
    drm: atmel-hlcdc: Fix vertical scaling

Arnd Bergmann <arnd@arndb.de>
    net: simplify napi_synchronize() to avoid warnings

Arnd Bergmann <arnd@arndb.de>
    kconfig: tinyconfig: provide whole choice blocks to avoid warnings

Arnd Bergmann <arnd@arndb.de>
    soc: qcom/spm: shut up uninitialized variable warning

Arnd Bergmann <arnd@arndb.de>
    pinctrl: at91-pio4: use %pr format string for resource

Arnd Bergmann <arnd@arndb.de>
    mmc: dw_mmc: use resource_size_t to store physical address

Mika Kuoppala <mika.kuoppala@linux.intel.com>
    drm/i915: Avoid pointer arithmetic in calculating plane surface offset

Mike Danese <mikedanese@google.com>
    mpssd: fix buffer overflow warning

Linus Torvalds <torvalds@linux-foundation.org>
    gma500: remove annoying deprecation warning

Wei Yongjun <weiyongjun1@huawei.com>
    ipv6: addrconf: fix dev refcont leak when DAD failed

Balbir Singh <bsingharora@gmail.com>
    sched/core: Fix a race between try_to_wake_up() and a woken up task

Johannes Berg <johannes.berg@intel.com>
    Revert "wext: Fix 32 bit iwpriv compatibility issue with 64 bit Kernel"

Felix Fietkau <nbd@nbd.name>
    ath9k: fix using sta->drv_priv before initializing it

Guoqing Jiang <gqjiang@suse.com>
    md-cluster: make md-cluster also can work when compiled into kernel

Mathias Nyman <mathias.nyman@linux.intel.com>
    xhci: fix null pointer dereference in stop command timeout function

Miklos Szeredi <mszeredi@redhat.com>
    fuse: direct-io: don't dirty ITER_BVEC pages

Chris Mason <clm@fb.com>
    Btrfs: remove root_log_ctx from ctx list before btrfs_sync_log returns

Ard Biesheuvel <ard.biesheuvel@linaro.org>
    crypto: cryptd - initialize child shash_desc on import

Will Deacon <will.deacon@arm.com>
    arm64: spinlocks: implement smp_mb__before_spinlock() as smp_mb()

Icenowy Zheng <icenowy@aosc.xyz>
    pinctrl: sunxi: fix uart1 CTS/RTS pins at PG on A23/A33

James Hartley <james.hartley@imgtec.com>
    pinctrl: pistachio: fix mfio pll_lock pinmux

Mikulas Patocka <mpatocka@redhat.com>
    dm crypt: fix error with too large bios

Mikulas Patocka <mpatocka@redhat.com>
    dm log writes: move IO accounting earlier to fix error path

Vladimir Zapolskiy <vz@mleia.com>
    dm log writes: fix check of kthread_run() return value

Pawel Moll <pawel.moll@arm.com>
    bus: arm-ccn: Fix XP watchpoint settings bitmask

Pawel Moll <pawel.moll@arm.com>
    bus: arm-ccn: Do not attempt to configure XPs for cycle counter

Pawel Moll <pawel.moll@arm.com>
    bus: arm-ccn: Fix PMU handling of MN

Lee Jones <lee.jones@linaro.org>
    ARM: dts: STiH407-family: Provide interconnect clock for consumption in ST SDHCI

Johan Hovold <johan@kernel.org>
    ARM: dts: overo: fix gpmc nand on boards with ethernet

Johan Hovold <johan@kernel.org>
    ARM: dts: overo: fix gpmc nand cs0 range

Fabio Estevam <fabio.estevam@nxp.com>
    ARM: dts: imx6qdl: Fix SPDIF regression

Sebastian Reichel <sre@kernel.org>
    ARM: OMAP3: hwmod data: Add sysc information for DSI

Simon Baatz <gmbnomis@gmail.com>
    ARM: kirkwood: ib62x0: fix size of u-boot environment partition

Anson Huang <Anson.Huang@nxp.com>
    ARM: imx6: add missing BM_CLPCR_BYPASS_PMIC_READY setting for imx6sx

Peter Chen <peter.chen@nxp.com>
    ARM: imx6: add missing BM_CLPCR_BYP_MMDC_CH0_LPM_HS setting for imx6ul

Keerthy <j-keerthy@ti.com>
    ARM: AM43XX: hwmod: Fix RSTST register offset for pruss

Zefan Li <lizefan@huawei.com>
    cpuset: make sure new tasks conform to the current config of the cpuset

David Daney <david.daney@cavium.com>
    net: thunderx: Fix OOPs with ethtool --register-dump

Andrew Donnellan <andrew.donnellan@au1.ibm.com>
    cxl: use pcibios_free_controller_deferred() when removing vPHBs

Alan Stern <stern@rowland.harvard.edu>
    USB: change bInterval default to 10 ms

Lee Jones <lee.jones@linaro.org>
    ARM: dts: STiH410: Handle interconnect clock required by EHCI/OHCI (USB)

Clemens Gruber <clemens.gruber@pqgruber.com>
    usb: chipidea: udc: fix NULL ptr dereference in isr_setup_status_phase

Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    usb: renesas_usbhs: fix clearing the {BRDY,BEMP}STS condition

Daniele Palmas <dnlplm@gmail.com>
    USB: serial: simple: add support for another Infineon flashloader

Jimi Damon <jdamon@accesio.com>
    serial: 8250: added acces i/o products quad and octal serial cards

Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    serial: 8250_mid: fix divide error bug if baud rate is 0

Colin Ian King <colin.king@canonical.com>
    iio: ensure ret is initialized to zero before entering do loop

Gregor Boirie <gregor.boirie@parrot.com>
    iio:core: fix IIO_VAL_FRACTIONAL sign handling

Linus Walleij <linus.walleij@linaro.org>
    iio: accel: kxsd9: Fix scaling bug

Kweh, Hock Leong <hock.leong.kweh@intel.com>
    iio: fix pressure data output unit in hid-sensor-attributes

Olof Johansson <olof@lixom.net>
    iio: accel: bmc150: reset chip at init time

Anders Darander <anders@chargestorm.se>
    iio: adc: at91: unbreak channel adc channel 3

Lars-Peter Clausen <lars@metafoo.de>
    iio: ad799x: Fix buffered capture for ad7991/ad7995/ad7999

Vignesh R <vigneshr@ti.com>
    iio: adc: ti_am335x_adc: Increase timeout value waiting for ADC sample

Vignesh R <vigneshr@ti.com>
    iio: adc: ti_am335x_adc: Protect FIFO1 from concurrent access

Caesar Wang <wxt@rock-chips.com>
    iio: adc: rockchip_saradc: reset saradc controller before programming it

Alison Schofield <amsfield22@gmail.com>
    iio: proximity: as3935: set up buffer timestamps for non-zero values

Linus Walleij <linus.walleij@linaro.org>
    iio: accel: kxsd9: Fix raw read return

Suzuki K Poulose <suzuki.poulose@arm.com>
    kvm-arm: Unmap shadow pagetables properly

Emanuel Czirai <icanrealizeum@gmail.com>
    x86/AMD: Apply erratum 665 on machines without a BIOS fix

Steven Rostedt <rostedt@goodmis.org>
    x86/paravirt: Do not trace _paravirt_ident_*() functions

Vineet Gupta <vgupta@synopsys.com>
    ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS

Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
    IB/uverbs: Fix race between uverbs_close and remove_one

Mike Snitzer <snitzer@redhat.com>
    dm flakey: fix reads to be issued if drop_writes configured

Mateusz Guzik <mguzik@redhat.com>
    audit: fix exe_file access in audit_exe_compare

Mateusz Guzik <mguzik@redhat.com>
    mm: introduce get_task_exe_file

Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
    kexec: fix double-free when failing to relocate the purgatory

Trond Myklebust <trond.myklebust@primarydata.com>
    NFSv4.1: Fix the CREATE_SESSION slot number accounting

Trond Myklebust <trond.myklebust@primarydata.com>
    pNFS: Ensure LAYOUTGET and LAYOUTRETURN are properly serialised

Chuck Lever <chuck.lever@oracle.com>
    nfsd: Close race between nfsd4_release_lockowner and nfsd4_lock

Trond Myklebust <trond.myklebust@primarydata.com>
    NFSv4.x: Fix a refcount leak in nfs_callback_up_net

Trond Myklebust <trond.myklebust@primarydata.com>
    pNFS: The client must not do I/O to the DS if it's lease has expired

Tejun Heo <tj@kernel.org>
    kernfs: don't depend on d_find_any_alias() when generating notifications

Paul Mackerras <paulus@ozlabs.org>
    powerpc/mm: Don't alias user region to other regions below PAGE_OFFSET

Mukesh Ojha <mukesh02@linux.vnet.ibm.com>
    powerpc/powernv : Drop reference added by kset_find_obj()

Nicholas Piggin <npiggin@gmail.com>
    powerpc/tm: do not use r13 for tabort_syscall

Jon Paul Maloy <jon.maloy@ericsson.com>
    tipc: move linearization of buffers to generic code

Wenwei Tao <ww.tao0320@gmail.com>
    lightnvm: put bio before return

Eric Biggers <ebiggers@google.com>
    fscrypto: require write access to mount to set encryption policy

Paolo Bonzini <pbonzini@redhat.com>
    Revert "KVM: x86: fix missed hardware breakpoints"

James Hogan <james.hogan@imgtec.com>
    MIPS: KVM: Check for pfn noslot case

Chen-Yu Tsai <wens@csie.org>
    clocksource/drivers/sun4i: Clear interrupts after stopping timer in probe function

Eric Biggers <ebiggers@google.com>
    fscrypto: add authorization check for setting encryption policy

Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
    ext4: use __GFP_NOFAIL in ext4_free_blocks()


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

Diffstat:

 .../bindings/iio/adc/rockchip-saradc.txt           |   7 ++
 Documentation/mic/mpssd/mpssd.c                    |   4 +-
 Makefile                                           |   4 +-
 arch/alpha/include/asm/uaccess.h                   |  19 ++-
 arch/arc/include/asm/pgtable.h                     |   3 +-
 arch/arc/include/asm/uaccess.h                     |  11 +-
 arch/arm/boot/dts/imx6qdl.dtsi                     |   2 +-
 arch/arm/boot/dts/kirkwood-ib62x0.dts              |   2 +-
 arch/arm/boot/dts/omap3-overo-base.dtsi            |   4 +-
 .../boot/dts/omap3-overo-chestnut43-common.dtsi    |   2 -
 arch/arm/boot/dts/omap3-overo-tobi-common.dtsi     |   2 -
 arch/arm/boot/dts/omap3-overo-tobiduo-common.dtsi  |   3 -
 arch/arm/boot/dts/stih407-family.dtsi              |  10 +-
 arch/arm/boot/dts/stih410.dtsi                     |  12 +-
 arch/arm/kvm/arm.c                                 |   2 -
 arch/arm/kvm/mmu.c                                 |   1 +
 arch/arm/mach-imx/pm-imx6.c                        |   4 +-
 .../mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c |   1 +
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c         |  12 ++
 arch/arm/mach-omap2/prcm43xx.h                     |   1 +
 arch/arm64/include/asm/spinlock.h                  |  10 ++
 arch/avr32/include/asm/uaccess.h                   |  11 +-
 arch/avr32/kernel/avr32_ksyms.c                    |   2 +-
 arch/avr32/lib/copy_user.S                         |   4 +-
 arch/blackfin/include/asm/uaccess.h                |   9 +-
 arch/cris/include/asm/uaccess.h                    |  71 +++++------
 arch/frv/include/asm/uaccess.h                     |  12 +-
 arch/hexagon/include/asm/uaccess.h                 |   3 +-
 arch/ia64/include/asm/uaccess.h                    |  20 ++-
 arch/m32r/include/asm/uaccess.h                    |   2 +-
 arch/metag/include/asm/uaccess.h                   |   3 +-
 arch/microblaze/include/asm/uaccess.h              |  11 +-
 arch/mips/include/asm/uaccess.h                    |   3 +
 arch/mips/kvm/tlb.c                                |   2 +-
 arch/mn10300/include/asm/uaccess.h                 |   1 +
 arch/mn10300/lib/usercopy.c                        |   4 +-
 arch/nios2/include/asm/uaccess.h                   |  13 +-
 arch/openrisc/include/asm/uaccess.h                |  35 ++----
 arch/parisc/include/asm/uaccess.h                  |   6 +-
 arch/powerpc/include/asm/uaccess.h                 |  21 +---
 arch/powerpc/kernel/entry_64.S                     |  12 +-
 arch/powerpc/mm/slb_low.S                          |   7 +-
 arch/powerpc/platforms/powernv/opal-dump.c         |   7 +-
 arch/powerpc/platforms/powernv/opal-elog.c         |   7 +-
 arch/s390/include/asm/uaccess.h                    |   8 +-
 arch/score/include/asm/uaccess.h                   |  46 +++----
 arch/sh/include/asm/uaccess.h                      |   5 +-
 arch/sh/include/asm/uaccess_64.h                   |   1 +
 arch/sparc/include/asm/uaccess_32.h                |   4 +-
 arch/x86/configs/tiny.config                       |   2 +
 arch/x86/include/asm/uaccess.h                     |   6 +-
 arch/x86/kernel/cpu/amd.c                          |  12 ++
 arch/x86/kernel/paravirt.c                         |   4 +-
 arch/x86/kvm/x86.c                                 |   1 -
 crypto/cryptd.c                                    |   9 +-
 drivers/bus/arm-ccn.c                              |  27 +++-
 drivers/clocksource/sun4i_timer.c                  |   9 +-
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c    |  10 +-
 drivers/gpu/drm/drm_ioc32.c                        |   4 +
 drivers/gpu/drm/gma500/cdv_intel_dp.c              |   2 +-
 drivers/gpu/drm/i915/intel_display.c               |  16 +--
 drivers/gpu/drm/i915/intel_drv.h                   |   6 +-
 drivers/gpu/drm/i915/intel_sprite.c                |   2 +-
 drivers/iio/accel/bmc150-accel-core.c              |  11 ++
 drivers/iio/accel/kxsd9.c                          |   2 +
 drivers/iio/adc/Kconfig                            |   1 +
 drivers/iio/adc/ad799x.c                           |   1 +
 drivers/iio/adc/at91_adc.c                         |   4 +-
 drivers/iio/adc/rockchip_saradc.c                  |  30 +++++
 drivers/iio/adc/ti_am335x_adc.c                    |  16 ++-
 .../iio/common/hid-sensors/hid-sensor-attributes.c |   4 +-
 drivers/iio/industrialio-buffer.c                  |   4 +-
 drivers/iio/industrialio-core.c                    |   5 +-
 drivers/iio/proximity/as3935.c                     |   2 +-
 drivers/infiniband/core/uverbs.h                   |   1 +
 drivers/infiniband/core/uverbs_main.c              |  37 ++++--
 drivers/irqchip/irq-atmel-aic.c                    |   5 +-
 drivers/irqchip/irq-atmel-aic5.c                   |   5 +-
 drivers/lightnvm/rrpc.c                            |   4 +-
 drivers/md/dm-crypt.c                              |   7 ++
 drivers/md/dm-flakey.c                             |  27 ++--
 drivers/md/dm-log-writes.c                         |   6 +-
 drivers/md/md.c                                    |  12 +-
 drivers/misc/cxl/vphb.c                            |  10 +-
 drivers/mmc/host/dw_mmc-pltfm.c                    |   2 +-
 drivers/mmc/host/dw_mmc.c                          |   2 +-
 drivers/net/ethernet/cavium/thunder/nic_reg.h      |   1 -
 .../net/ethernet/cavium/thunder/nicvf_ethtool.c    |   5 +-
 drivers/net/wireless/ath/ath9k/main.c              |   8 +-
 drivers/pci/host-bridge.c                          |   1 +
 drivers/pinctrl/pinctrl-at91-pio4.c                |   2 +-
 drivers/pinctrl/pinctrl-pistachio.c                |  12 +-
 drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c          |   4 +-
 drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c          |   4 +-
 drivers/soc/qcom/spm.c                             |   2 +-
 drivers/tty/serial/8250/8250_mid.c                 |   3 +
 drivers/tty/serial/8250/8250_pci.c                 | 139 +++++++++++++++++++++
 drivers/usb/chipidea/udc.c                         |   9 ++
 drivers/usb/core/config.c                          |  28 +++--
 drivers/usb/host/xhci-ring.c                       |   6 +-
 drivers/usb/renesas_usbhs/mod.c                    |  11 +-
 drivers/usb/serial/usb-serial-simple.c             |   3 +-
 fs/btrfs/tree-log.c                                |   1 +
 fs/ext4/crypto_policy.c                            |   3 +
 fs/ext4/ioctl.c                                    |   6 +
 fs/ext4/mballoc.c                                  |  47 ++++---
 fs/f2fs/crypto_policy.c                            |   3 +
 fs/fuse/file.c                                     |   7 +-
 fs/kernfs/file.c                                   |  28 +++--
 fs/nfs/callback.c                                  |   1 +
 fs/nfs/nfs4proc.c                                  |  12 +-
 fs/nfs/pnfs.c                                      |   4 +
 fs/nfsd/nfs4state.c                                |  40 +++---
 fs/proc/base.c                                     |   7 +-
 include/asm-generic/uaccess.h                      |  20 +--
 include/linux/irq.h                                |  10 ++
 include/linux/mfd/ti_am335x_tscadc.h               |   8 +-
 include/linux/mm.h                                 |   1 +
 include/linux/mmc/dw_mmc.h                         |   2 +-
 include/linux/netdevice.h                          |  11 +-
 include/linux/uio.h                                |   2 +-
 kernel/audit_watch.c                               |   8 +-
 kernel/configs/tiny.config                         |   8 ++
 kernel/cpuset.c                                    |  15 +++
 kernel/fork.c                                      |  23 ++++
 kernel/irq/msi.c                                   |   1 +
 kernel/kexec_file.c                                |   3 +
 kernel/sched/core.c                                |  22 ++++
 lib/iov_iter.c                                     |  24 +---
 net/ipv6/addrconf.c                                |   2 +
 net/tipc/link.c                                    |   2 +
 net/tipc/name_distr.c                              |   1 +
 net/tipc/udp_media.c                               |   5 -
 net/wireless/wext-core.c                           |  25 +---
 134 files changed, 895 insertions(+), 449 deletions(-)

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

* [PATCH 4.4 001/118] ext4: use __GFP_NOFAIL in ext4_free_blocks()
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 002/118] fscrypto: add authorization check for setting encryption policy Greg Kroah-Hartman
                     ` (115 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Konstantin Khlebnikov, Theodore Tso,
	Jan Kara

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

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

From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>

commit adb7ef600cc9d9d15ecc934cc26af5c1379777df upstream.

This might be unexpected but pages allocated for sbi->s_buddy_cache are
charged to current memory cgroup. So, GFP_NOFS allocation could fail if
current task has been killed by OOM or if current memory cgroup has no
free memory left. Block allocator cannot handle such failures here yet.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ext4/mballoc.c |   47 ++++++++++++++++++++++++++++-------------------
 1 file changed, 28 insertions(+), 19 deletions(-)

--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -815,7 +815,7 @@ static void mb_regenerate_buddy(struct e
  * for this page; do not hold this lock when calling this routine!
  */
 
-static int ext4_mb_init_cache(struct page *page, char *incore)
+static int ext4_mb_init_cache(struct page *page, char *incore, gfp_t gfp)
 {
 	ext4_group_t ngroups;
 	int blocksize;
@@ -848,7 +848,7 @@ static int ext4_mb_init_cache(struct pag
 	/* allocate buffer_heads to read bitmaps */
 	if (groups_per_page > 1) {
 		i = sizeof(struct buffer_head *) * groups_per_page;
-		bh = kzalloc(i, GFP_NOFS);
+		bh = kzalloc(i, gfp);
 		if (bh == NULL) {
 			err = -ENOMEM;
 			goto out;
@@ -983,7 +983,7 @@ out:
  * are on the same page e4b->bd_buddy_page is NULL and return value is 0.
  */
 static int ext4_mb_get_buddy_page_lock(struct super_block *sb,
-		ext4_group_t group, struct ext4_buddy *e4b)
+		ext4_group_t group, struct ext4_buddy *e4b, gfp_t gfp)
 {
 	struct inode *inode = EXT4_SB(sb)->s_buddy_cache;
 	int block, pnum, poff;
@@ -1002,7 +1002,7 @@ static int ext4_mb_get_buddy_page_lock(s
 	block = group * 2;
 	pnum = block / blocks_per_page;
 	poff = block % blocks_per_page;
-	page = find_or_create_page(inode->i_mapping, pnum, GFP_NOFS);
+	page = find_or_create_page(inode->i_mapping, pnum, gfp);
 	if (!page)
 		return -ENOMEM;
 	BUG_ON(page->mapping != inode->i_mapping);
@@ -1016,7 +1016,7 @@ static int ext4_mb_get_buddy_page_lock(s
 
 	block++;
 	pnum = block / blocks_per_page;
-	page = find_or_create_page(inode->i_mapping, pnum, GFP_NOFS);
+	page = find_or_create_page(inode->i_mapping, pnum, gfp);
 	if (!page)
 		return -ENOMEM;
 	BUG_ON(page->mapping != inode->i_mapping);
@@ -1042,7 +1042,7 @@ static void ext4_mb_put_buddy_page_lock(
  * calling this routine!
  */
 static noinline_for_stack
-int ext4_mb_init_group(struct super_block *sb, ext4_group_t group)
+int ext4_mb_init_group(struct super_block *sb, ext4_group_t group, gfp_t gfp)
 {
 
 	struct ext4_group_info *this_grp;
@@ -1062,7 +1062,7 @@ int ext4_mb_init_group(struct super_bloc
 	 * The call to ext4_mb_get_buddy_page_lock will mark the
 	 * page accessed.
 	 */
-	ret = ext4_mb_get_buddy_page_lock(sb, group, &e4b);
+	ret = ext4_mb_get_buddy_page_lock(sb, group, &e4b, gfp);
 	if (ret || !EXT4_MB_GRP_NEED_INIT(this_grp)) {
 		/*
 		 * somebody initialized the group
@@ -1072,7 +1072,7 @@ int ext4_mb_init_group(struct super_bloc
 	}
 
 	page = e4b.bd_bitmap_page;
-	ret = ext4_mb_init_cache(page, NULL);
+	ret = ext4_mb_init_cache(page, NULL, gfp);
 	if (ret)
 		goto err;
 	if (!PageUptodate(page)) {
@@ -1091,7 +1091,7 @@ int ext4_mb_init_group(struct super_bloc
 	}
 	/* init buddy cache */
 	page = e4b.bd_buddy_page;
-	ret = ext4_mb_init_cache(page, e4b.bd_bitmap);
+	ret = ext4_mb_init_cache(page, e4b.bd_bitmap, gfp);
 	if (ret)
 		goto err;
 	if (!PageUptodate(page)) {
@@ -1109,8 +1109,8 @@ err:
  * calling this routine!
  */
 static noinline_for_stack int
-ext4_mb_load_buddy(struct super_block *sb, ext4_group_t group,
-					struct ext4_buddy *e4b)
+ext4_mb_load_buddy_gfp(struct super_block *sb, ext4_group_t group,
+		       struct ext4_buddy *e4b, gfp_t gfp)
 {
 	int blocks_per_page;
 	int block;
@@ -1140,7 +1140,7 @@ ext4_mb_load_buddy(struct super_block *s
 		 * we need full data about the group
 		 * to make a good selection
 		 */
-		ret = ext4_mb_init_group(sb, group);
+		ret = ext4_mb_init_group(sb, group, gfp);
 		if (ret)
 			return ret;
 	}
@@ -1168,11 +1168,11 @@ ext4_mb_load_buddy(struct super_block *s
 			 * wait for it to initialize.
 			 */
 			page_cache_release(page);
-		page = find_or_create_page(inode->i_mapping, pnum, GFP_NOFS);
+		page = find_or_create_page(inode->i_mapping, pnum, gfp);
 		if (page) {
 			BUG_ON(page->mapping != inode->i_mapping);
 			if (!PageUptodate(page)) {
-				ret = ext4_mb_init_cache(page, NULL);
+				ret = ext4_mb_init_cache(page, NULL, gfp);
 				if (ret) {
 					unlock_page(page);
 					goto err;
@@ -1204,11 +1204,12 @@ ext4_mb_load_buddy(struct super_block *s
 	if (page == NULL || !PageUptodate(page)) {
 		if (page)
 			page_cache_release(page);
-		page = find_or_create_page(inode->i_mapping, pnum, GFP_NOFS);
+		page = find_or_create_page(inode->i_mapping, pnum, gfp);
 		if (page) {
 			BUG_ON(page->mapping != inode->i_mapping);
 			if (!PageUptodate(page)) {
-				ret = ext4_mb_init_cache(page, e4b->bd_bitmap);
+				ret = ext4_mb_init_cache(page, e4b->bd_bitmap,
+							 gfp);
 				if (ret) {
 					unlock_page(page);
 					goto err;
@@ -1247,6 +1248,12 @@ err:
 	return ret;
 }
 
+static int ext4_mb_load_buddy(struct super_block *sb, ext4_group_t group,
+			      struct ext4_buddy *e4b)
+{
+	return ext4_mb_load_buddy_gfp(sb, group, e4b, GFP_NOFS);
+}
+
 static void ext4_mb_unload_buddy(struct ext4_buddy *e4b)
 {
 	if (e4b->bd_bitmap_page)
@@ -2047,7 +2054,7 @@ static int ext4_mb_good_group(struct ext
 
 	/* We only do this if the grp has never been initialized */
 	if (unlikely(EXT4_MB_GRP_NEED_INIT(grp))) {
-		int ret = ext4_mb_init_group(ac->ac_sb, group);
+		int ret = ext4_mb_init_group(ac->ac_sb, group, GFP_NOFS);
 		if (ret)
 			return ret;
 	}
@@ -4808,7 +4815,9 @@ do_more:
 #endif
 	trace_ext4_mballoc_free(sb, inode, block_group, bit, count_clusters);
 
-	err = ext4_mb_load_buddy(sb, block_group, &e4b);
+	/* __GFP_NOFAIL: retry infinitely, ignore TIF_MEMDIE and memcg limit. */
+	err = ext4_mb_load_buddy_gfp(sb, block_group, &e4b,
+				     GFP_NOFS|__GFP_NOFAIL);
 	if (err)
 		goto error_return;
 
@@ -5210,7 +5219,7 @@ int ext4_trim_fs(struct super_block *sb,
 		grp = ext4_get_group_info(sb, group);
 		/* We only do this if the grp has never been initialized */
 		if (unlikely(EXT4_MB_GRP_NEED_INIT(grp))) {
-			ret = ext4_mb_init_group(sb, group);
+			ret = ext4_mb_init_group(sb, group, GFP_NOFS);
 			if (ret)
 				break;
 		}

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

* [PATCH 4.4 002/118] fscrypto: add authorization check for setting encryption policy
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 001/118] ext4: use __GFP_NOFAIL in ext4_free_blocks() Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 003/118] clocksource/drivers/sun4i: Clear interrupts after stopping timer in probe function Greg Kroah-Hartman
                     ` (114 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Eric Biggers, Theodore Tso

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

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

From: Eric Biggers <ebiggers@google.com>

commit 163ae1c6ad6299b19e22b4a35d5ab24a89791a98 upstream.

On an ext4 or f2fs filesystem with file encryption supported, a user
could set an encryption policy on any empty directory(*) to which they
had readonly access.  This is obviously problematic, since such a
directory might be owned by another user and the new encryption policy
would prevent that other user from creating files in their own directory
(for example).

Fix this by requiring inode_owner_or_capable() permission to set an
encryption policy.  This means that either the caller must own the file,
or the caller must have the capability CAP_FOWNER.

(*) Or also on any regular file, for f2fs v4.6 and later and ext4
    v4.8-rc1 and later; a separate bug fix is coming for that.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/ext4/crypto_policy.c |    3 +++
 fs/f2fs/crypto_policy.c |    3 +++
 2 files changed, 6 insertions(+)

--- a/fs/ext4/crypto_policy.c
+++ b/fs/ext4/crypto_policy.c
@@ -102,6 +102,9 @@ static int ext4_create_encryption_contex
 int ext4_process_policy(const struct ext4_encryption_policy *policy,
 			struct inode *inode)
 {
+	if (!inode_owner_or_capable(inode))
+		return -EACCES;
+
 	if (policy->version != 0)
 		return -EINVAL;
 
--- a/fs/f2fs/crypto_policy.c
+++ b/fs/f2fs/crypto_policy.c
@@ -89,6 +89,9 @@ static int f2fs_create_encryption_contex
 int f2fs_process_policy(const struct f2fs_encryption_policy *policy,
 			struct inode *inode)
 {
+	if (!inode_owner_or_capable(inode))
+		return -EACCES;
+
 	if (policy->version != 0)
 		return -EINVAL;
 

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

* [PATCH 4.4 003/118] clocksource/drivers/sun4i: Clear interrupts after stopping timer in probe function
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 001/118] ext4: use __GFP_NOFAIL in ext4_free_blocks() Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 002/118] fscrypto: add authorization check for setting encryption policy Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 004/118] MIPS: KVM: Check for pfn noslot case Greg Kroah-Hartman
                     ` (113 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Chen-Yu Tsai, Daniel Lezcano, Maxime Ripard

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

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

From: Chen-Yu Tsai <wens@csie.org>

commit b53e7d000d9e6e9fd2c6eb6b82d2783c67fd599e upstream.

The bootloader (U-boot) sometimes uses this timer for various delays.
It uses it as a ongoing counter, and does comparisons on the current
counter value. The timer counter is never stopped.

In some cases when the user interacts with the bootloader, or lets
it idle for some time before loading Linux, the timer may expire,
and an interrupt will be pending. This results in an unexpected
interrupt when the timer interrupt is enabled by the kernel, at
which point the event_handler isn't set yet. This results in a NULL
pointer dereference exception, panic, and no way to reboot.

Clear any pending interrupts after we stop the timer in the probe
function to avoid this.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/clocksource/sun4i_timer.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

--- a/drivers/clocksource/sun4i_timer.c
+++ b/drivers/clocksource/sun4i_timer.c
@@ -123,12 +123,16 @@ static struct clock_event_device sun4i_c
 	.set_next_event = sun4i_clkevt_next_event,
 };
 
+static void sun4i_timer_clear_interrupt(void)
+{
+	writel(TIMER_IRQ_EN(0), timer_base + TIMER_IRQ_ST_REG);
+}
 
 static irqreturn_t sun4i_timer_interrupt(int irq, void *dev_id)
 {
 	struct clock_event_device *evt = (struct clock_event_device *)dev_id;
 
-	writel(0x1, timer_base + TIMER_IRQ_ST_REG);
+	sun4i_timer_clear_interrupt();
 	evt->event_handler(evt);
 
 	return IRQ_HANDLED;
@@ -193,6 +197,9 @@ static void __init sun4i_timer_init(stru
 	/* Make sure timer is stopped before playing with interrupts */
 	sun4i_clkevt_time_stop(0);
 
+	/* clear timer0 interrupt */
+	sun4i_timer_clear_interrupt();
+
 	sun4i_clockevent.cpumask = cpu_possible_mask;
 	sun4i_clockevent.irq = irq;
 

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

* [PATCH 4.4 004/118] MIPS: KVM: Check for pfn noslot case
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (2 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 003/118] clocksource/drivers/sun4i: Clear interrupts after stopping timer in probe function Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 005/118] Revert "KVM: x86: fix missed hardware breakpoints" Greg Kroah-Hartman
                     ` (112 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, James Hogan, Paolo Bonzini,
	Radim Krčmář,
	Ralf Baechle, linux-mips, kvm

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

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

From: James Hogan <james.hogan@imgtec.com>

commit ba913e4f72fc9cfd03dad968dfb110eb49211d80 upstream.

When mapping a page into the guest we error check using is_error_pfn(),
however this doesn't detect a value of KVM_PFN_NOSLOT, indicating an
error HVA for the page. This can only happen on MIPS right now due to
unusual memslot management (e.g. being moved / removed / resized), or
with an Enhanced Virtual Memory (EVA) configuration where the default
KVM_HVA_ERR_* and kvm_is_error_hva() definitions are unsuitable (fixed
in a later patch). This case will be treated as a pfn of zero, mapping
the first page of physical memory into the guest.

It would appear the MIPS KVM port wasn't updated prior to being merged
(in v3.10) to take commit 81c52c56e2b4 ("KVM: do not treat noslot pfn as
a error pfn") into account (merged v3.8), which converted a bunch of
is_error_pfn() calls to is_error_noslot_pfn(). Switch to using
is_error_noslot_pfn() instead to catch this case properly.

Fixes: 858dd5d45733 ("KVM/MIPS32: MMU/TLB operations for the Guest.")
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Cc: kvm@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[james.hogan@imgtec.com: Backport to v4.7.y]
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/mips/kvm/tlb.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/mips/kvm/tlb.c
+++ b/arch/mips/kvm/tlb.c
@@ -152,7 +152,7 @@ static int kvm_mips_map_page(struct kvm
 	srcu_idx = srcu_read_lock(&kvm->srcu);
 	pfn = kvm_mips_gfn_to_pfn(kvm, gfn);
 
-	if (kvm_mips_is_error_pfn(pfn)) {
+	if (is_error_noslot_pfn(pfn)) {
 		kvm_err("Couldn't get pfn for gfn %#" PRIx64 "!\n", gfn);
 		err = -EFAULT;
 		goto out;

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

* [PATCH 4.4 005/118] Revert "KVM: x86: fix missed hardware breakpoints"
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (3 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 004/118] MIPS: KVM: Check for pfn noslot case Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 006/118] fscrypto: require write access to mount to set encryption policy Greg Kroah-Hartman
                     ` (111 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, matt@codeblueprint.co.uk, Paolo Bonzini,
	Matt Fleming, Paolo Bonzini

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

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

From: Paolo Bonzini <pbonzini@redhat.com>

[the change is part of 70e4da7a8ff62f2775337b705f45c804bb450454, which
is already in stable kernels 4.1.y to 4.4.y.  this part of the fix
however was later undone, so remove the line again]

The following patches were applied in the wrong order in -stable. This
is the order as they appear in Linus' tree,

 [0] commit 4e422bdd2f84 ("KVM: x86: fix missed hardware breakpoints")
 [1] commit 172b2386ed16 ("KVM: x86: fix missed hardware breakpoints")
 [2] commit 70e4da7a8ff6 ("KVM: x86: fix root cause for missed hardware breakpoints")

but this is the order for linux-4.4.y

 [1] commit fc90441e728a ("KVM: x86: fix missed hardware breakpoints")
 [2] commit 25e8618619a5 ("KVM: x86: fix root cause for missed hardware breakpoints")
 [0] commit 0f6e5e26e68f ("KVM: x86: fix missed hardware breakpoints")

The upshot is that KVM_DEBUGREG_RELOAD is always set when returning
from kvm_arch_vcpu_load() in stable, but not in Linus' tree.

This happened because [0] and [1] are the same patch.  [0] and [1] come from two
different merges, and the later merge is trivially resolved; when [2]
is applied it reverts both of them.  Instead, when using the [1][2][0]
order, patches applies normally but "KVM: x86: fix missed hardware
breakpoints" is present in the final tree.

Reported-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/kvm/x86.c |    1 -
 1 file changed, 1 deletion(-)

--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2735,7 +2735,6 @@ void kvm_arch_vcpu_load(struct kvm_vcpu
 	}
 
 	kvm_make_request(KVM_REQ_STEAL_UPDATE, vcpu);
-	vcpu->arch.switch_db_regs |= KVM_DEBUGREG_RELOAD;
 }
 
 void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)

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

* [PATCH 4.4 006/118] fscrypto: require write access to mount to set encryption policy
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (4 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 005/118] Revert "KVM: x86: fix missed hardware breakpoints" Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 008/118] tipc: move linearization of buffers to generic code Greg Kroah-Hartman
                     ` (110 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Eric Biggers, Theodore Tso, Jaegeuk Kim

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

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

From: Eric Biggers <ebiggers@google.com>

commit ba63f23d69a3a10e7e527a02702023da68ef8a6d upstream.

Since setting an encryption policy requires writing metadata to the
filesystem, it should be guarded by mnt_want_write/mnt_drop_write.
Otherwise, a user could cause a write to a frozen or readonly
filesystem.  This was handled correctly by f2fs but not by ext4.  Make
fscrypt_process_policy() handle it rather than relying on the filesystem
to get it right.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Cc: stable@vger.kernel.org # 4.1+; check fs/{ext4,f2fs}
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Acked-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ext4/ioctl.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -629,7 +629,13 @@ resizefs_out:
 			goto encryption_policy_out;
 		}
 
+		err = mnt_want_write_file(filp);
+		if (err)
+			goto encryption_policy_out;
+
 		err = ext4_process_policy(&policy, inode);
+
+		mnt_drop_write_file(filp);
 encryption_policy_out:
 		return err;
 #else

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

* [PATCH 4.4 008/118] tipc: move linearization of buffers to generic code
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (5 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 006/118] fscrypto: require write access to mount to set encryption policy Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 009/118] powerpc/tm: do not use r13 for tabort_syscall Greg Kroah-Hartman
                     ` (109 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Ying Xue, Jon Maloy, David S. Miller,
	Juerg Haefliger

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

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

From: Jon Paul Maloy <jon.maloy@ericsson.com>

commit c7cad0d6f70cd4ce8644ffe528a4df1cdc2e77f5 upstream.

In commit 5cbb28a4bf65c7e4 ("tipc: linearize arriving NAME_DISTR
and LINK_PROTO buffers") we added linearization of NAME_DISTRIBUTOR,
LINK_PROTOCOL/RESET and LINK_PROTOCOL/ACTIVATE to the function
tipc_udp_recv(). The location of the change was selected in order
to make the commit easily appliable to 'net' and 'stable'.

We now move this linearization to where it should be done, in the
functions tipc_named_rcv() and tipc_link_proto_rcv() respectively.

Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Juerg Haefliger <juerg.haefliger@hpe.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/tipc/link.c       |    2 ++
 net/tipc/name_distr.c |    1 +
 net/tipc/udp_media.c  |    5 -----
 3 files changed, 3 insertions(+), 5 deletions(-)

--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -1262,6 +1262,8 @@ static int tipc_link_proto_rcv(struct ti
 		/* fall thru' */
 
 	case ACTIVATE_MSG:
+		skb_linearize(skb);
+		hdr = buf_msg(skb);
 
 		/* Complete own link name with peer's interface name */
 		if_name =  strrchr(l->name, ':') + 1;
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -397,6 +397,7 @@ void tipc_named_rcv(struct net *net, str
 
 	spin_lock_bh(&tn->nametbl_lock);
 	for (skb = skb_dequeue(inputq); skb; skb = skb_dequeue(inputq)) {
+		skb_linearize(skb);
 		msg = buf_msg(skb);
 		mtype = msg_type(msg);
 		item = (struct distr_item *)msg_data(msg);
--- a/net/tipc/udp_media.c
+++ b/net/tipc/udp_media.c
@@ -48,7 +48,6 @@
 #include <linux/tipc_netlink.h>
 #include "core.h"
 #include "bearer.h"
-#include "msg.h"
 
 /* IANA assigned UDP port */
 #define UDP_PORT_DEFAULT	6118
@@ -224,10 +223,6 @@ static int tipc_udp_recv(struct sock *sk
 {
 	struct udp_bearer *ub;
 	struct tipc_bearer *b;
-	int usr = msg_user(buf_msg(skb));
-
-	if ((usr == LINK_PROTOCOL) || (usr == NAME_DISTRIBUTOR))
-		skb_linearize(skb);
 
 	ub = rcu_dereference_sk_user_data(sk);
 	if (!ub) {

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

* [PATCH 4.4 009/118] powerpc/tm: do not use r13 for tabort_syscall
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (6 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 008/118] tipc: move linearization of buffers to generic code Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 010/118] powerpc/powernv : Drop reference added by kset_find_obj() Greg Kroah-Hartman
                     ` (108 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Nick Piggin, Benjamin Herrenschmidt

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

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

From: Nicholas Piggin <npiggin@gmail.com>

commit cc7786d3ee7e3c979799db834b528db2c0834c2e upstream.

tabort_syscall runs with RI=1, so a nested recoverable machine
check will load the paca into r13 and overwrite what we loaded
it with, because exceptions returning to privileged mode do not
restore r13.

Fixes: b4b56f9ecab4 (powerpc/tm: Abort syscalls in active transactions)
Signed-off-by: Nick Piggin <npiggin@gmail.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/kernel/entry_64.S |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -334,13 +334,13 @@ syscall_exit_work:
 tabort_syscall:
 	/* Firstly we need to enable TM in the kernel */
 	mfmsr	r10
-	li	r13, 1
-	rldimi	r10, r13, MSR_TM_LG, 63-MSR_TM_LG
+	li	r9, 1
+	rldimi	r10, r9, MSR_TM_LG, 63-MSR_TM_LG
 	mtmsrd	r10, 0
 
 	/* tabort, this dooms the transaction, nothing else */
-	li	r13, (TM_CAUSE_SYSCALL|TM_CAUSE_PERSISTENT)
-	TABORT(R13)
+	li	r9, (TM_CAUSE_SYSCALL|TM_CAUSE_PERSISTENT)
+	TABORT(R9)
 
 	/*
 	 * Return directly to userspace. We have corrupted user register state,
@@ -348,8 +348,8 @@ tabort_syscall:
 	 * resume after the tbegin of the aborted transaction with the
 	 * checkpointed register state.
 	 */
-	li	r13, MSR_RI
-	andc	r10, r10, r13
+	li	r9, MSR_RI
+	andc	r10, r10, r9
 	mtmsrd	r10, 1
 	mtspr	SPRN_SRR0, r11
 	mtspr	SPRN_SRR1, r12

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

* [PATCH 4.4 010/118] powerpc/powernv : Drop reference added by kset_find_obj()
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (7 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 009/118] powerpc/tm: do not use r13 for tabort_syscall Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 011/118] powerpc/mm: Dont alias user region to other regions below PAGE_OFFSET Greg Kroah-Hartman
                     ` (107 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Mukesh Ojha, Vasant Hegde,
	Benjamin Herrenschmidt

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

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

From: Mukesh Ojha <mukesh02@linux.vnet.ibm.com>

commit a9cbf0b2195b695cbeeeecaa4e2770948c212e9a upstream.

In a situation, where Linux kernel gets notified about duplicate error log
from OPAL, it is been observed that kernel fails to remove sysfs entries
(/sys/firmware/opal/elog/0xXXXXXXXX) of such error logs. This is because,
we currently search the error log/dump kobject in the kset list via
'kset_find_obj()' routine. Which eventually increment the reference count
by one, once it founds the kobject.

So, unless we decrement the reference count by one after it found the kobject,
we would not be able to release the kobject properly later.

This patch adds the 'kobject_put()' which was missing earlier.

Signed-off-by: Mukesh Ojha <mukesh02@linux.vnet.ibm.com>
Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/platforms/powernv/opal-dump.c |    7 ++++++-
 arch/powerpc/platforms/powernv/opal-elog.c |    7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

--- a/arch/powerpc/platforms/powernv/opal-dump.c
+++ b/arch/powerpc/platforms/powernv/opal-dump.c
@@ -370,6 +370,7 @@ static irqreturn_t process_dump(int irq,
 	uint32_t dump_id, dump_size, dump_type;
 	struct dump_obj *dump;
 	char name[22];
+	struct kobject *kobj;
 
 	rc = dump_read_info(&dump_id, &dump_size, &dump_type);
 	if (rc != OPAL_SUCCESS)
@@ -381,8 +382,12 @@ static irqreturn_t process_dump(int irq,
 	 * that gracefully and not create two conflicting
 	 * entries.
 	 */
-	if (kset_find_obj(dump_kset, name))
+	kobj = kset_find_obj(dump_kset, name);
+	if (kobj) {
+		/* Drop reference added by kset_find_obj() */
+		kobject_put(kobj);
 		return 0;
+	}
 
 	dump = create_dump_obj(dump_id, dump_size, dump_type);
 	if (!dump)
--- a/arch/powerpc/platforms/powernv/opal-elog.c
+++ b/arch/powerpc/platforms/powernv/opal-elog.c
@@ -247,6 +247,7 @@ static irqreturn_t elog_event(int irq, v
 	uint64_t elog_type;
 	int rc;
 	char name[2+16+1];
+	struct kobject *kobj;
 
 	rc = opal_get_elog_size(&id, &size, &type);
 	if (rc != OPAL_SUCCESS) {
@@ -269,8 +270,12 @@ static irqreturn_t elog_event(int irq, v
 	 * that gracefully and not create two conflicting
 	 * entries.
 	 */
-	if (kset_find_obj(elog_kset, name))
+	kobj = kset_find_obj(elog_kset, name);
+	if (kobj) {
+		/* Drop reference added by kset_find_obj() */
+		kobject_put(kobj);
 		return IRQ_HANDLED;
+	}
 
 	create_elog_obj(log_id, elog_size, elog_type);
 

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

* [PATCH 4.4 011/118] powerpc/mm: Dont alias user region to other regions below PAGE_OFFSET
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (8 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 010/118] powerpc/powernv : Drop reference added by kset_find_obj() Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 012/118] kernfs: dont depend on d_find_any_alias() when generating notifications Greg Kroah-Hartman
                     ` (106 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Paul Mackerras, Aneesh Kumar K.V,
	Michael Ellerman

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

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

From: Paul Mackerras <paulus@ozlabs.org>

commit f077aaf0754bcba0fffdbd925bc12f09cd1e38aa upstream.

In commit c60ac5693c47 ("powerpc: Update kernel VSID range", 2013-03-13)
we lost a check on the region number (the top four bits of the effective
address) for addresses below PAGE_OFFSET.  That commit replaced a check
that the top 18 bits were all zero with a check that bits 46 - 59 were
zero (performed for all addresses, not just user addresses).

This means that userspace can access an address like 0x1000_0xxx_xxxx_xxxx
and we will insert a valid SLB entry for it.  The VSID used will be the
same as if the top 4 bits were 0, but the page size will be some random
value obtained by indexing beyond the end of the mm_ctx_high_slices_psize
array in the paca.  If that page size is the same as would be used for
region 0, then userspace just has an alias of the region 0 space.  If the
page size is different, then no HPTE will be found for the access, and
the process will get a SIGSEGV (since hash_page_mm() will refuse to create
a HPTE for the bogus address).

The access beyond the end of the mm_ctx_high_slices_psize can be at most
5.5MB past the array, and so will be in RAM somewhere.  Since the access
is a load performed in real mode, it won't fault or crash the kernel.
At most this bug could perhaps leak a little bit of information about
blocks of 32 bytes of memory located at offsets of i * 512kB past the
paca->mm_ctx_high_slices_psize array, for 1 <= i <= 11.

Fixes: c60ac5693c47 ("powerpc: Update kernel VSID range")
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/mm/slb_low.S |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- a/arch/powerpc/mm/slb_low.S
+++ b/arch/powerpc/mm/slb_low.S
@@ -113,7 +113,12 @@ BEGIN_FTR_SECTION
 END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT)
 	b	slb_finish_load_1T
 
-0:
+0:	/*
+	 * For userspace addresses, make sure this is region 0.
+	 */
+	cmpdi	r9, 0
+	bne	8f
+
 	/* when using slices, we extract the psize off the slice bitmaps
 	 * and then we need to get the sllp encoding off the mmu_psize_defs
 	 * array.

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

* [PATCH 4.4 012/118] kernfs: dont depend on d_find_any_alias() when generating notifications
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (9 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 011/118] powerpc/mm: Dont alias user region to other regions below PAGE_OFFSET Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 013/118] pNFS: The client must not do I/O to the DS if its lease has expired Greg Kroah-Hartman
                     ` (105 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Tejun Heo, Evgeny Vereshchagin,
	John McCutchan, Robert Love, Eric Paris

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

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

From: Tejun Heo <tj@kernel.org>

commit df6a58c5c5aa8ecb1e088ecead3fa33ae70181f1 upstream.

kernfs_notify_workfn() sends out file modified events for the
scheduled kernfs_nodes.  Because the modifications aren't from
userland, it doesn't have the matching file struct at hand and can't
use fsnotify_modify().  Instead, it looked up the inode and then used
d_find_any_alias() to find the dentry and used fsnotify_parent() and
fsnotify() directly to generate notifications.

The assumption was that the relevant dentries would have been pinned
if there are listeners, which isn't true as inotify doesn't pin
dentries at all and watching the parent doesn't pin the child dentries
even for dnotify.  This led to, for example, inotify watchers not
getting notifications if the system is under memory pressure and the
matching dentries got reclaimed.  It can also be triggered through
/proc/sys/vm/drop_caches or a remount attempt which involves shrinking
dcache.

fsnotify_parent() only uses the dentry to access the parent inode,
which kernfs can do easily.  Update kernfs_notify_workfn() so that it
uses fsnotify() directly for both the parent and target inodes without
going through d_find_any_alias().  While at it, supply the target file
name to fsnotify() from kernfs_node->name.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Evgeny Vereshchagin <evvers@ya.ru>
Fixes: d911d9874801 ("kernfs: make kernfs_notify() trigger inotify events too")
Cc: John McCutchan <john@johnmccutchan.com>
Cc: Robert Love <rlove@rlove.org>
Cc: Eric Paris <eparis@parisplace.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/kernfs/file.c |   28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

--- a/fs/kernfs/file.c
+++ b/fs/kernfs/file.c
@@ -833,21 +833,35 @@ repeat:
 	mutex_lock(&kernfs_mutex);
 
 	list_for_each_entry(info, &kernfs_root(kn)->supers, node) {
+		struct kernfs_node *parent;
 		struct inode *inode;
-		struct dentry *dentry;
 
+		/*
+		 * We want fsnotify_modify() on @kn but as the
+		 * modifications aren't originating from userland don't
+		 * have the matching @file available.  Look up the inodes
+		 * and generate the events manually.
+		 */
 		inode = ilookup(info->sb, kn->ino);
 		if (!inode)
 			continue;
 
-		dentry = d_find_any_alias(inode);
-		if (dentry) {
-			fsnotify_parent(NULL, dentry, FS_MODIFY);
-			fsnotify(inode, FS_MODIFY, inode, FSNOTIFY_EVENT_INODE,
-				 NULL, 0);
-			dput(dentry);
+		parent = kernfs_get_parent(kn);
+		if (parent) {
+			struct inode *p_inode;
+
+			p_inode = ilookup(info->sb, parent->ino);
+			if (p_inode) {
+				fsnotify(p_inode, FS_MODIFY | FS_EVENT_ON_CHILD,
+					 inode, FSNOTIFY_EVENT_INODE, kn->name, 0);
+				iput(p_inode);
+			}
+
+			kernfs_put(parent);
 		}
 
+		fsnotify(inode, FS_MODIFY, inode, FSNOTIFY_EVENT_INODE,
+			 kn->name, 0);
 		iput(inode);
 	}
 

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

* [PATCH 4.4 013/118] pNFS: The client must not do I/O to the DS if its lease has expired
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (10 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 012/118] kernfs: dont depend on d_find_any_alias() when generating notifications Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 014/118] NFSv4.x: Fix a refcount leak in nfs_callback_up_net Greg Kroah-Hartman
                     ` (104 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Trond Myklebust

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

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

From: Trond Myklebust <trond.myklebust@primarydata.com>

commit b88fa69eaa8649f11828158c7b65c4bcd886ebd5 upstream.

Ensure that the client conforms to the normative behaviour described in
RFC5661 Section 12.7.2: "If a client believes its lease has expired,
it MUST NOT send I/O to the storage device until it has validated its
lease."

So ensure that we wait for the lease to be validated before using
the layout.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/nfs/pnfs.c |    1 +
 1 file changed, 1 insertion(+)

--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1530,6 +1530,7 @@ pnfs_update_layout(struct inode *ino,
 		goto out;
 
 lookup_again:
+	nfs4_client_recover_expired_lease(clp);
 	first = false;
 	spin_lock(&ino->i_lock);
 	lo = pnfs_find_alloc_layout(ino, ctx, gfp_flags);

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

* [PATCH 4.4 014/118] NFSv4.x: Fix a refcount leak in nfs_callback_up_net
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (11 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 013/118] pNFS: The client must not do I/O to the DS if its lease has expired Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 015/118] nfsd: Close race between nfsd4_release_lockowner and nfsd4_lock Greg Kroah-Hartman
                     ` (103 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Trond Myklebust

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

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

From: Trond Myklebust <trond.myklebust@primarydata.com>

commit 98b0f80c2396224bbbed81792b526e6c72ba9efa upstream.

On error, the callers expect us to return without bumping
nn->cb_users[].

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/nfs/callback.c |    1 +
 1 file changed, 1 insertion(+)

--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -275,6 +275,7 @@ static int nfs_callback_up_net(int minor
 err_socks:
 	svc_rpcb_cleanup(serv, net);
 err_bind:
+	nn->cb_users[minorversion]--;
 	dprintk("NFS: Couldn't create callback socket: err = %d; "
 			"net = %p\n", ret, net);
 	return ret;

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

* [PATCH 4.4 015/118] nfsd: Close race between nfsd4_release_lockowner and nfsd4_lock
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (12 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 014/118] NFSv4.x: Fix a refcount leak in nfs_callback_up_net Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 016/118] pNFS: Ensure LAYOUTGET and LAYOUTRETURN are properly serialised Greg Kroah-Hartman
                     ` (102 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jeff Layton, Chuck Lever, J. Bruce Fields

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

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

From: Chuck Lever <chuck.lever@oracle.com>

commit 885848186fbc2d1d8fb6d2fdc2156638ae289a46 upstream.

nfsd4_release_lockowner finds a lock owner that has no lock state,
and drops cl_lock. Then release_lockowner picks up cl_lock and
unhashes the lock owner.

During the window where cl_lock is dropped, I don't see anything
preventing a concurrent nfsd4_lock from finding that same lock owner
and adding lock state to it.

Move release_lockowner() into nfsd4_release_lockowner and hang onto
the cl_lock until after the lock owner's state cannot be found
again.

Found by inspection, we don't currently have a reproducer.

Fixes: 2c41beb0e5cf ("nfsd: reduce cl_lock thrashing in ... ")
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/nfsd/nfs4state.c |   40 +++++++++++++++++-----------------------
 1 file changed, 17 insertions(+), 23 deletions(-)

--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1200,27 +1200,6 @@ free_ol_stateid_reaplist(struct list_hea
 	}
 }
 
-static void release_lockowner(struct nfs4_lockowner *lo)
-{
-	struct nfs4_client *clp = lo->lo_owner.so_client;
-	struct nfs4_ol_stateid *stp;
-	struct list_head reaplist;
-
-	INIT_LIST_HEAD(&reaplist);
-
-	spin_lock(&clp->cl_lock);
-	unhash_lockowner_locked(lo);
-	while (!list_empty(&lo->lo_owner.so_stateids)) {
-		stp = list_first_entry(&lo->lo_owner.so_stateids,
-				struct nfs4_ol_stateid, st_perstateowner);
-		WARN_ON(!unhash_lock_stateid(stp));
-		put_ol_stateid_locked(stp, &reaplist);
-	}
-	spin_unlock(&clp->cl_lock);
-	free_ol_stateid_reaplist(&reaplist);
-	nfs4_put_stateowner(&lo->lo_owner);
-}
-
 static void release_open_stateid_locks(struct nfs4_ol_stateid *open_stp,
 				       struct list_head *reaplist)
 {
@@ -5952,6 +5931,7 @@ nfsd4_release_lockowner(struct svc_rqst
 	__be32 status;
 	struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
 	struct nfs4_client *clp;
+	LIST_HEAD (reaplist);
 
 	dprintk("nfsd4_release_lockowner clientid: (%08x/%08x):\n",
 		clid->cl_boot, clid->cl_id);
@@ -5982,9 +5962,23 @@ nfsd4_release_lockowner(struct svc_rqst
 		nfs4_get_stateowner(sop);
 		break;
 	}
+	if (!lo) {
+		spin_unlock(&clp->cl_lock);
+		return status;
+	}
+
+	unhash_lockowner_locked(lo);
+	while (!list_empty(&lo->lo_owner.so_stateids)) {
+		stp = list_first_entry(&lo->lo_owner.so_stateids,
+				       struct nfs4_ol_stateid,
+				       st_perstateowner);
+		WARN_ON(!unhash_lock_stateid(stp));
+		put_ol_stateid_locked(stp, &reaplist);
+	}
 	spin_unlock(&clp->cl_lock);
-	if (lo)
-		release_lockowner(lo);
+	free_ol_stateid_reaplist(&reaplist);
+	nfs4_put_stateowner(&lo->lo_owner);
+
 	return status;
 }
 

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

* [PATCH 4.4 016/118] pNFS: Ensure LAYOUTGET and LAYOUTRETURN are properly serialised
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (13 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 015/118] nfsd: Close race between nfsd4_release_lockowner and nfsd4_lock Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 017/118] NFSv4.1: Fix the CREATE_SESSION slot number accounting Greg Kroah-Hartman
                     ` (101 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Trond Myklebust

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

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

From: Trond Myklebust <trond.myklebust@primarydata.com>

commit bf0291dd2267a2b9a4cd74d65249553d11bb45d6 upstream.

According to RFC5661, the client is responsible for serialising
LAYOUTGET and LAYOUTRETURN to avoid ambiguity. Consider the case
where we send both in parallel.

Client					Server
======					======
LAYOUTGET(seqid=X)
LAYOUTRETURN(seqid=X)
					LAYOUTGET return seqid=X+1
					LAYOUTRETURN return seqid=X+2
Process LAYOUTRETURN
          Forget layout stateid
Process LAYOUTGET
          Set seqid=X+1

The client processes the layoutget/layoutreturn in the wrong order,
and since the result of the layoutreturn was to clear the only
existing layout segment, the client forgets the layout stateid.

When the LAYOUTGET comes in, it is treated as having a completely
new stateid, and so the client sets the wrong sequence id...

Fix is to check if there are outstanding LAYOUTGET requests
before we send the LAYOUTRETURN (note that LAYOUGET will already
wait if it sees an outstanding LAYOUTRETURN).

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/nfs/pnfs.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -365,6 +365,9 @@ pnfs_layout_need_return(struct pnfs_layo
 static bool
 pnfs_prepare_layoutreturn(struct pnfs_layout_hdr *lo)
 {
+	/* Serialise LAYOUTGET/LAYOUTRETURN */
+	if (atomic_read(&lo->plh_outstanding) != 0)
+		return false;
 	if (test_and_set_bit(NFS_LAYOUT_RETURN, &lo->plh_flags))
 		return false;
 	lo->plh_return_iomode = 0;

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

* [PATCH 4.4 017/118] NFSv4.1: Fix the CREATE_SESSION slot number accounting
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (14 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 016/118] pNFS: Ensure LAYOUTGET and LAYOUTRETURN are properly serialised Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 018/118] kexec: fix double-free when failing to relocate the purgatory Greg Kroah-Hartman
                     ` (100 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Trond Myklebust

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

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

From: Trond Myklebust <trond.myklebust@primarydata.com>

commit b519d408ea32040b1c7e10b155a3ee9a36660947 upstream.

Ensure that we conform to the algorithm described in RFC5661, section
18.36.4 for when to bump the sequence id. In essence we do it for all
cases except when the RPC call timed out, or in case of the server returning
NFS4ERR_DELAY or NFS4ERR_STALE_CLIENTID.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/nfs/nfs4proc.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -7424,12 +7424,20 @@ static int _nfs4_proc_create_session(str
 	status = rpc_call_sync(session->clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);
 	trace_nfs4_create_session(clp, status);
 
+	switch (status) {
+	case -NFS4ERR_STALE_CLIENTID:
+	case -NFS4ERR_DELAY:
+	case -ETIMEDOUT:
+	case -EACCES:
+	case -EAGAIN:
+		goto out;
+	};
+
+	clp->cl_seqid++;
 	if (!status) {
 		/* Verify the session's negotiated channel_attrs values */
 		status = nfs4_verify_channel_attrs(&args, &res);
 		/* Increment the clientid slot sequence id */
-		if (clp->cl_seqid == res.seqid)
-			clp->cl_seqid++;
 		if (status)
 			goto out;
 		nfs4_update_session(session, &res);

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

* [PATCH 4.4 018/118] kexec: fix double-free when failing to relocate the purgatory
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (15 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 017/118] NFSv4.1: Fix the CREATE_SESSION slot number accounting Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 019/118] mm: introduce get_task_exe_file Greg Kroah-Hartman
                     ` (99 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Thiago Jung Bauermann, Baoquan He,
	Eric W. Biederman, Vivek Goyal, Dave Young, Andrew Morton,
	Linus Torvalds

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

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

From: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>

commit 070c43eea5043e950daa423707ae3c77e2f48edb upstream.

If kexec_apply_relocations fails, kexec_load_purgatory frees pi->sechdrs
and pi->purgatory_buf.  This is redundant, because in case of error
kimage_file_prepare_segments calls kimage_file_post_load_cleanup, which
will also free those buffers.

This causes two warnings like the following, one for pi->sechdrs and the
other for pi->purgatory_buf:

  kexec-bzImage64: Loading purgatory failed
  ------------[ cut here ]------------
  WARNING: CPU: 1 PID: 2119 at mm/vmalloc.c:1490 __vunmap+0xc1/0xd0
  Trying to vfree() nonexistent vm area (ffffc90000e91000)
  Modules linked in:
  CPU: 1 PID: 2119 Comm: kexec Not tainted 4.8.0-rc3+ #5
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
  Call Trace:
    dump_stack+0x4d/0x65
    __warn+0xcb/0xf0
    warn_slowpath_fmt+0x4f/0x60
    ? find_vmap_area+0x19/0x70
    ? kimage_file_post_load_cleanup+0x47/0xb0
    __vunmap+0xc1/0xd0
    vfree+0x2e/0x70
    kimage_file_post_load_cleanup+0x5e/0xb0
    SyS_kexec_file_load+0x448/0x680
    ? putname+0x54/0x60
    ? do_sys_open+0x190/0x1f0
    entry_SYSCALL_64_fastpath+0x13/0x8f
  ---[ end trace 158bb74f5950ca2b ]---

Fix by setting pi->sechdrs an pi->purgatory_buf to NULL, since vfree
won't try to free a NULL pointer.

Link: http://lkml.kernel.org/r/1472083546-23683-1-git-send-email-bauerman@linux.vnet.ibm.com
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
Acked-by: Baoquan He <bhe@redhat.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 kernel/kexec_file.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -934,7 +934,10 @@ int kexec_load_purgatory(struct kimage *
 	return 0;
 out:
 	vfree(pi->sechdrs);
+	pi->sechdrs = NULL;
+
 	vfree(pi->purgatory_buf);
+	pi->purgatory_buf = NULL;
 	return ret;
 }
 

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

* [PATCH 4.4 019/118] mm: introduce get_task_exe_file
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (16 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 018/118] kexec: fix double-free when failing to relocate the purgatory Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 020/118] audit: fix exe_file access in audit_exe_compare Greg Kroah-Hartman
                     ` (98 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Mateusz Guzik, Konstantin Khlebnikov,
	Richard Guy Briggs, Paul Moore

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

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

From: Mateusz Guzik <mguzik@redhat.com>

commit cd81a9170e69e018bbaba547c1fd85a585f5697a upstream.

For more convenient access if one has a pointer to the task.

As a minor nit take advantage of the fact that only task lock + rcu are
needed to safely grab ->exe_file. This saves mm refcount dance.

Use the helper in proc_exe_link.

Signed-off-by: Mateusz Guzik <mguzik@redhat.com>
Acked-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Acked-by: Richard Guy Briggs <rgb@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/proc/base.c     |    7 +------
 include/linux/mm.h |    1 +
 kernel/fork.c      |   23 +++++++++++++++++++++++
 3 files changed, 25 insertions(+), 6 deletions(-)

--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1545,18 +1545,13 @@ static const struct file_operations proc
 static int proc_exe_link(struct dentry *dentry, struct path *exe_path)
 {
 	struct task_struct *task;
-	struct mm_struct *mm;
 	struct file *exe_file;
 
 	task = get_proc_task(d_inode(dentry));
 	if (!task)
 		return -ENOENT;
-	mm = get_task_mm(task);
+	exe_file = get_task_exe_file(task);
 	put_task_struct(task);
-	if (!mm)
-		return -ENOENT;
-	exe_file = get_mm_exe_file(mm);
-	mmput(mm);
 	if (exe_file) {
 		*exe_path = exe_file->f_path;
 		path_get(&exe_file->f_path);
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1898,6 +1898,7 @@ extern void mm_drop_all_locks(struct mm_
 
 extern void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file);
 extern struct file *get_mm_exe_file(struct mm_struct *mm);
+extern struct file *get_task_exe_file(struct task_struct *task);
 
 extern int may_expand_vm(struct mm_struct *mm, unsigned long npages);
 extern struct vm_area_struct *_install_special_mapping(struct mm_struct *mm,
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -764,6 +764,29 @@ struct file *get_mm_exe_file(struct mm_s
 EXPORT_SYMBOL(get_mm_exe_file);
 
 /**
+ * get_task_exe_file - acquire a reference to the task's executable file
+ *
+ * Returns %NULL if task's mm (if any) has no associated executable file or
+ * this is a kernel thread with borrowed mm (see the comment above get_task_mm).
+ * User must release file via fput().
+ */
+struct file *get_task_exe_file(struct task_struct *task)
+{
+	struct file *exe_file = NULL;
+	struct mm_struct *mm;
+
+	task_lock(task);
+	mm = task->mm;
+	if (mm) {
+		if (!(task->flags & PF_KTHREAD))
+			exe_file = get_mm_exe_file(mm);
+	}
+	task_unlock(task);
+	return exe_file;
+}
+EXPORT_SYMBOL(get_task_exe_file);
+
+/**
  * get_task_mm - acquire a reference to the task's mm
  *
  * Returns %NULL if the task has no mm.  Checks PF_KTHREAD (meaning

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

* [PATCH 4.4 020/118] audit: fix exe_file access in audit_exe_compare
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (17 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 019/118] mm: introduce get_task_exe_file Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 021/118] dm flakey: fix reads to be issued if drop_writes configured Greg Kroah-Hartman
                     ` (97 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Mateusz Guzik, Konstantin Khlebnikov,
	Richard Guy Briggs, Paul Moore

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

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

From: Mateusz Guzik <mguzik@redhat.com>

commit 5efc244346f9f338765da3d592f7947b0afdc4b5 upstream.

Prior to the change the function would blindly deference mm, exe_file
and exe_file->f_inode, each of which could have been NULL or freed.

Use get_task_exe_file to safely obtain stable exe_file.

Signed-off-by: Mateusz Guzik <mguzik@redhat.com>
Acked-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Acked-by: Richard Guy Briggs <rgb@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 kernel/audit_watch.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

--- a/kernel/audit_watch.c
+++ b/kernel/audit_watch.c
@@ -19,6 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include <linux/file.h>
 #include <linux/kernel.h>
 #include <linux/audit.h>
 #include <linux/kthread.h>
@@ -544,10 +545,11 @@ int audit_exe_compare(struct task_struct
 	unsigned long ino;
 	dev_t dev;
 
-	rcu_read_lock();
-	exe_file = rcu_dereference(tsk->mm->exe_file);
+	exe_file = get_task_exe_file(tsk);
+	if (!exe_file)
+		return 0;
 	ino = exe_file->f_inode->i_ino;
 	dev = exe_file->f_inode->i_sb->s_dev;
-	rcu_read_unlock();
+	fput(exe_file);
 	return audit_mark_compare(mark, ino, dev);
 }

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

* [PATCH 4.4 021/118] dm flakey: fix reads to be issued if drop_writes configured
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (18 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 020/118] audit: fix exe_file access in audit_exe_compare Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 022/118] IB/uverbs: Fix race between uverbs_close and remove_one Greg Kroah-Hartman
                     ` (96 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Qu Wenruo, Mike Snitzer

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

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

From: Mike Snitzer <snitzer@redhat.com>

commit 299f6230bc6d0ccd5f95bb0fb865d80a9c7d5ccc upstream.

v4.8-rc3 commit 99f3c90d0d ("dm flakey: error READ bios during the
down_interval") overlooked the 'drop_writes' feature, which is meant to
allow reads to be issued rather than errored, during the down_interval.

Fixes: 99f3c90d0d ("dm flakey: error READ bios during the down_interval")
Reported-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/md/dm-flakey.c |   27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

--- a/drivers/md/dm-flakey.c
+++ b/drivers/md/dm-flakey.c
@@ -289,15 +289,13 @@ static int flakey_map(struct dm_target *
 		pb->bio_submitted = true;
 
 		/*
-		 * Map reads as normal only if corrupt_bio_byte set.
+		 * Error reads if neither corrupt_bio_byte or drop_writes are set.
+		 * Otherwise, flakey_end_io() will decide if the reads should be modified.
 		 */
 		if (bio_data_dir(bio) == READ) {
-			/* If flags were specified, only corrupt those that match. */
-			if (fc->corrupt_bio_byte && (fc->corrupt_bio_rw == READ) &&
-			    all_corrupt_bio_flags_match(bio, fc))
-				goto map_bio;
-			else
+			if (!fc->corrupt_bio_byte && !test_bit(DROP_WRITES, &fc->flags))
 				return -EIO;
+			goto map_bio;
 		}
 
 		/*
@@ -334,14 +332,21 @@ static int flakey_end_io(struct dm_targe
 	struct flakey_c *fc = ti->private;
 	struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data));
 
-	/*
-	 * Corrupt successful READs while in down state.
-	 */
 	if (!error && pb->bio_submitted && (bio_data_dir(bio) == READ)) {
-		if (fc->corrupt_bio_byte)
+		if (fc->corrupt_bio_byte && (fc->corrupt_bio_rw == READ) &&
+		    all_corrupt_bio_flags_match(bio, fc)) {
+			/*
+			 * Corrupt successful matching READs while in down state.
+			 */
 			corrupt_bio_data(bio, fc);
-		else
+
+		} else if (!test_bit(DROP_WRITES, &fc->flags)) {
+			/*
+			 * Error read during the down_interval if drop_writes
+			 * wasn't configured.
+			 */
 			return -EIO;
+		}
 	}
 
 	return error;

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

* [PATCH 4.4 022/118] IB/uverbs: Fix race between uverbs_close and remove_one
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (19 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 021/118] dm flakey: fix reads to be issued if drop_writes configured Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-10-03 12:28     ` Vegard Nossum
  2016-09-22 17:28   ` [PATCH 4.4 025/118] x86/AMD: Apply erratum 665 on machines without a BIOS fix Greg Kroah-Hartman
                     ` (95 subsequent siblings)
  116 siblings, 1 reply; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Devesh Sharma, Jason Gunthorpe,
	Yishai Hadas, Leon Romanovsky, Doug Ledford

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

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

From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>

commit d1e09f304a1d9651c5059ebfeb696dc2effc9b32 upstream.

Fixes an oops that might happen if uverbs_close races with
remove_one.

Both contexts may run ib_uverbs_cleanup_ucontext, it depends
on the flow.

Currently, there is no protection for a case that remove_one
didn't make the cleanup it runs to its end, the underlying
ib_device was freed then uverbs_close will call
ib_uverbs_cleanup_ucontext and OOPs.

Above might happen if uverbs_close deleted the file from the list
then remove_one didn't find it and runs to its end.

Fixes to protect against that case by a new cleanup lock so that
ib_uverbs_cleanup_ucontext will be called always before that
remove_one is ended.

Fixes: 35d4a0b63dc0 ("IB/uverbs: Fix race between ib_uverbs_open and remove_one")
Reported-by: Devesh Sharma <devesh.sharma@broadcom.com>
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Yishai Hadas <yishaih@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/core/uverbs.h      |    1 
 drivers/infiniband/core/uverbs_main.c |   37 ++++++++++++++++++++++------------
 2 files changed, 25 insertions(+), 13 deletions(-)

--- a/drivers/infiniband/core/uverbs.h
+++ b/drivers/infiniband/core/uverbs.h
@@ -116,6 +116,7 @@ struct ib_uverbs_event_file {
 struct ib_uverbs_file {
 	struct kref				ref;
 	struct mutex				mutex;
+	struct mutex                            cleanup_mutex; /* protect cleanup */
 	struct ib_uverbs_device		       *device;
 	struct ib_ucontext		       *ucontext;
 	struct ib_event_handler			event_handler;
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -922,6 +922,7 @@ static int ib_uverbs_open(struct inode *
 	file->async_file = NULL;
 	kref_init(&file->ref);
 	mutex_init(&file->mutex);
+	mutex_init(&file->cleanup_mutex);
 
 	filp->private_data = file;
 	kobject_get(&dev->kobj);
@@ -947,18 +948,20 @@ static int ib_uverbs_close(struct inode
 {
 	struct ib_uverbs_file *file = filp->private_data;
 	struct ib_uverbs_device *dev = file->device;
-	struct ib_ucontext *ucontext = NULL;
+
+	mutex_lock(&file->cleanup_mutex);
+	if (file->ucontext) {
+		ib_uverbs_cleanup_ucontext(file, file->ucontext);
+		file->ucontext = NULL;
+	}
+	mutex_unlock(&file->cleanup_mutex);
 
 	mutex_lock(&file->device->lists_mutex);
-	ucontext = file->ucontext;
-	file->ucontext = NULL;
 	if (!file->is_closed) {
 		list_del(&file->list);
 		file->is_closed = 1;
 	}
 	mutex_unlock(&file->device->lists_mutex);
-	if (ucontext)
-		ib_uverbs_cleanup_ucontext(file, ucontext);
 
 	if (file->async_file)
 		kref_put(&file->async_file->ref, ib_uverbs_release_event_file);
@@ -1172,22 +1175,30 @@ static void ib_uverbs_free_hw_resources(
 	mutex_lock(&uverbs_dev->lists_mutex);
 	while (!list_empty(&uverbs_dev->uverbs_file_list)) {
 		struct ib_ucontext *ucontext;
-
 		file = list_first_entry(&uverbs_dev->uverbs_file_list,
 					struct ib_uverbs_file, list);
 		file->is_closed = 1;
-		ucontext = file->ucontext;
 		list_del(&file->list);
-		file->ucontext = NULL;
 		kref_get(&file->ref);
 		mutex_unlock(&uverbs_dev->lists_mutex);
-		/* We must release the mutex before going ahead and calling
-		 * disassociate_ucontext. disassociate_ucontext might end up
-		 * indirectly calling uverbs_close, for example due to freeing
-		 * the resources (e.g mmput).
-		 */
+
 		ib_uverbs_event_handler(&file->event_handler, &event);
+
+		mutex_lock(&file->cleanup_mutex);
+		ucontext = file->ucontext;
+		file->ucontext = NULL;
+		mutex_unlock(&file->cleanup_mutex);
+
+		/* At this point ib_uverbs_close cannot be running
+		 * ib_uverbs_cleanup_ucontext
+		 */
 		if (ucontext) {
+			/* We must release the mutex before going ahead and
+			 * calling disassociate_ucontext. disassociate_ucontext
+			 * might end up indirectly calling uverbs_close,
+			 * for example due to freeing the resources
+			 * (e.g mmput).
+			 */
 			ib_dev->disassociate_ucontext(ucontext);
 			ib_uverbs_cleanup_ucontext(file, ucontext);
 		}

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

* [PATCH 4.4 025/118] x86/AMD: Apply erratum 665 on machines without a BIOS fix
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (20 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 022/118] IB/uverbs: Fix race between uverbs_close and remove_one Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 026/118] kvm-arm: Unmap shadow pagetables properly Greg Kroah-Hartman
                     ` (94 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Emanuel Czirai, Borislav Petkov,
	Yaowu Xu, Thomas Gleixner

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

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

From: Emanuel Czirai <icanrealizeum@gmail.com>

commit d1992996753132e2dafe955cccb2fb0714d3cfc4 upstream.

AMD F12h machines have an erratum which can cause DIV/IDIV to behave
unpredictably. The workaround is to set MSRC001_1029[31] but sometimes
there is no BIOS update containing that workaround so let's do it
ourselves unconditionally. It is simple enough.

[ Borislav: Wrote commit message. ]

Signed-off-by: Emanuel Czirai <icanrealizeum@gmail.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Yaowu Xu <yaowu@google.com>
Link: http://lkml.kernel.org/r/20160902053550.18097-1-bp@alien8.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/kernel/cpu/amd.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -656,6 +656,17 @@ static void init_amd_gh(struct cpuinfo_x
 		set_cpu_bug(c, X86_BUG_AMD_TLB_MMATCH);
 }
 
+#define MSR_AMD64_DE_CFG	0xC0011029
+
+static void init_amd_ln(struct cpuinfo_x86 *c)
+{
+	/*
+	 * Apply erratum 665 fix unconditionally so machines without a BIOS
+	 * fix work.
+	 */
+	msr_set_bit(MSR_AMD64_DE_CFG, 31);
+}
+
 static void init_amd_bd(struct cpuinfo_x86 *c)
 {
 	u64 value;
@@ -713,6 +724,7 @@ static void init_amd(struct cpuinfo_x86
 	case 6:	   init_amd_k7(c); break;
 	case 0xf:  init_amd_k8(c); break;
 	case 0x10: init_amd_gh(c); break;
+	case 0x12: init_amd_ln(c); break;
 	case 0x15: init_amd_bd(c); break;
 	}
 

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

* [PATCH 4.4 026/118] kvm-arm: Unmap shadow pagetables properly
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (21 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 025/118] x86/AMD: Apply erratum 665 on machines without a BIOS fix Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 027/118] iio: accel: kxsd9: Fix raw read return Greg Kroah-Hartman
                     ` (93 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Itaru Kitayama, James Morse,
	Marc Zyngier, Catalin Marinas, Christoffer Dall,
	Suzuki K Poulose

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

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

From: Suzuki K Poulose <suzuki.poulose@arm.com>

commit 293f293637b55db4f9f522a5a72514e98a541076 upstream.

On arm/arm64, we depend on the kvm_unmap_hva* callbacks (via
mmu_notifiers::invalidate_*) to unmap the stage2 pagetables when
the userspace buffer gets unmapped. However, when the Hypervisor
process exits without explicit unmap of the guest buffers, the only
notifier we get is kvm_arch_flush_shadow_all() (via mmu_notifier::release
) which does nothing on arm. Later this causes us to access pages that
were already released [via exit_mmap() -> unmap_vmas()] when we actually
get to unmap the stage2 pagetable [via kvm_arch_destroy_vm() ->
kvm_free_stage2_pgd()]. This triggers crashes with CONFIG_DEBUG_PAGEALLOC,
which unmaps any free'd pages from the linear map.

 [  757.644120] Unable to handle kernel paging request at virtual address
  ffff800661e00000
 [  757.652046] pgd = ffff20000b1a2000
 [  757.655471] [ffff800661e00000] *pgd=00000047fffe3003, *pud=00000047fcd8c003,
  *pmd=00000047fcc7c003, *pte=00e8004661e00712
 [  757.666492] Internal error: Oops: 96000147 [#3] PREEMPT SMP
 [  757.672041] Modules linked in:
 [  757.675100] CPU: 7 PID: 3630 Comm: qemu-system-aar Tainted: G      D
 4.8.0-rc1 #3
 [  757.683240] Hardware name: AppliedMicro X-Gene Mustang Board/X-Gene Mustang Board,
  BIOS 3.06.15 Aug 19 2016
 [  757.692938] task: ffff80069cdd3580 task.stack: ffff8006adb7c000
 [  757.698840] PC is at __flush_dcache_area+0x1c/0x40
 [  757.703613] LR is at kvm_flush_dcache_pmd+0x60/0x70
 [  757.708469] pc : [<ffff20000809dbdc>] lr : [<ffff2000080b4a70>] pstate: 20000145
 ...
 [  758.357249] [<ffff20000809dbdc>] __flush_dcache_area+0x1c/0x40
 [  758.363059] [<ffff2000080b6748>] unmap_stage2_range+0x458/0x5f0
 [  758.368954] [<ffff2000080b708c>] kvm_free_stage2_pgd+0x34/0x60
 [  758.374761] [<ffff2000080b2280>] kvm_arch_destroy_vm+0x20/0x68
 [  758.380570] [<ffff2000080aa330>] kvm_put_kvm+0x210/0x358
 [  758.385860] [<ffff2000080aa524>] kvm_vm_release+0x2c/0x40
 [  758.391239] [<ffff2000082ad234>] __fput+0x114/0x2e8
 [  758.396096] [<ffff2000082ad46c>] ____fput+0xc/0x18
 [  758.400869] [<ffff200008104658>] task_work_run+0x108/0x138
 [  758.406332] [<ffff2000080dc8ec>] do_exit+0x48c/0x10e8
 [  758.411363] [<ffff2000080dd5fc>] do_group_exit+0x6c/0x130
 [  758.416739] [<ffff2000080ed924>] get_signal+0x284/0xa18
 [  758.421943] [<ffff20000808a098>] do_signal+0x158/0x860
 [  758.427060] [<ffff20000808aad4>] do_notify_resume+0x6c/0x88
 [  758.432608] [<ffff200008083624>] work_pending+0x10/0x14
 [  758.437812] Code: 9ac32042 8b010001 d1000443 8a230000 (d50b7e20)

This patch fixes the issue by moving the kvm_free_stage2_pgd() to
kvm_arch_flush_shadow_all().

Tested-by: Itaru Kitayama <itaru.kitayama@riken.jp>
Reported-by: Itaru Kitayama <itaru.kitayama@riken.jp>
Reported-by: James Morse <james.morse@arm.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/kvm/arm.c |    2 --
 arch/arm/kvm/mmu.c |    1 +
 2 files changed, 1 insertion(+), 2 deletions(-)

--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -155,8 +155,6 @@ void kvm_arch_destroy_vm(struct kvm *kvm
 {
 	int i;
 
-	kvm_free_stage2_pgd(kvm);
-
 	for (i = 0; i < KVM_MAX_VCPUS; ++i) {
 		if (kvm->vcpus[i]) {
 			kvm_arch_vcpu_free(kvm->vcpus[i]);
--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -1852,6 +1852,7 @@ void kvm_arch_memslots_updated(struct kv
 
 void kvm_arch_flush_shadow_all(struct kvm *kvm)
 {
+	kvm_free_stage2_pgd(kvm);
 }
 
 void kvm_arch_flush_shadow_memslot(struct kvm *kvm,

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

* [PATCH 4.4 027/118] iio: accel: kxsd9: Fix raw read return
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (22 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 026/118] kvm-arm: Unmap shadow pagetables properly Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 028/118] iio: proximity: as3935: set up buffer timestamps for non-zero values Greg Kroah-Hartman
                     ` (92 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Linus Walleij, Jonathan Cameron

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

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

From: Linus Walleij <linus.walleij@linaro.org>

commit 7ac61a062f3147dc23e3f12b9dfe7c4dd35f9cb8 upstream.

Any readings from the raw interface of the KXSD9 driver will
return an empty string, because it does not return
IIO_VAL_INT but rather some random value from the accelerometer
to the caller.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/iio/accel/kxsd9.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/iio/accel/kxsd9.c
+++ b/drivers/iio/accel/kxsd9.c
@@ -160,6 +160,7 @@ static int kxsd9_read_raw(struct iio_dev
 		if (ret < 0)
 			goto error_ret;
 		*val = ret;
+		ret = IIO_VAL_INT;
 		break;
 	case IIO_CHAN_INFO_SCALE:
 		ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C));

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

* [PATCH 4.4 028/118] iio: proximity: as3935: set up buffer timestamps for non-zero values
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (23 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 027/118] iio: accel: kxsd9: Fix raw read return Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28     ` Greg Kroah-Hartman
                     ` (91 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Alison Schofield, Daniel Baluta,
	Jonathan Cameron

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

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

From: Alison Schofield <amsfield22@gmail.com>

commit f8adf645db03345af2d9a8b6095b02327ea50885 upstream.

Use the iio_pollfunc_store_time parameter during triggered buffer
set-up to get valid timestamps.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/iio/proximity/as3935.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/iio/proximity/as3935.c
+++ b/drivers/iio/proximity/as3935.c
@@ -392,7 +392,7 @@ static int as3935_probe(struct spi_devic
 		return ret;
 	}
 
-	ret = iio_triggered_buffer_setup(indio_dev, NULL,
+	ret = iio_triggered_buffer_setup(indio_dev, iio_pollfunc_store_time,
 		&as3935_trigger_handler, NULL);
 
 	if (ret) {

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

* [PATCH 4.4 029/118] iio: adc: rockchip_saradc: reset saradc controller before programming it
@ 2016-09-22 17:28     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Caesar Wang, Jonathan Cameron,
	Heiko Stuebner, Rob Herring, linux-iio, linux-rockchip,
	Guenter Roeck

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

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

From: Caesar Wang <wxt@rock-chips.com>

commit 543852af8e5902aee8f7c72c89e1513663e0f696 upstream.

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

Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: linux-iio@vger.kernel.org
Cc: linux-rockchip@lists.infradead.org
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 Documentation/devicetree/bindings/iio/adc/rockchip-saradc.txt |    7 ++
 drivers/iio/adc/Kconfig                                       |    1 
 drivers/iio/adc/rockchip_saradc.c                             |   30 ++++++++++
 3 files changed, 38 insertions(+)

--- a/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.txt
+++ b/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.txt
@@ -12,6 +12,11 @@ Required properties:
 - vref-supply: The regulator supply ADC reference voltage.
 - #io-channel-cells: Should be 1, see ../iio-bindings.txt
 
+Optional properties:
+- resets: Must contain an entry for each entry in reset-names if need support
+	  this option. See ../reset/reset.txt for details.
+- reset-names: Must include the name "saradc-apb".
+
 Example:
 	saradc: saradc@2006c000 {
 		compatible = "rockchip,saradc";
@@ -19,6 +24,8 @@ Example:
 		interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&cru SCLK_SARADC>, <&cru PCLK_SARADC>;
 		clock-names = "saradc", "apb_pclk";
+		resets = <&cru SRST_SARADC>;
+		reset-names = "saradc-apb";
 		#io-channel-cells = <1>;
 		vref-supply = <&vcc18>;
 	};
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -306,6 +306,7 @@ config QCOM_SPMI_VADC
 config ROCKCHIP_SARADC
 	tristate "Rockchip SARADC driver"
 	depends on ARCH_ROCKCHIP || (ARM && COMPILE_TEST)
+	depends on RESET_CONTROLLER
 	help
 	  Say yes here to build support for the SARADC found in SoCs from
 	  Rockchip.
--- a/drivers/iio/adc/rockchip_saradc.c
+++ b/drivers/iio/adc/rockchip_saradc.c
@@ -21,6 +21,8 @@
 #include <linux/of_device.h>
 #include <linux/clk.h>
 #include <linux/completion.h>
+#include <linux/delay.h>
+#include <linux/reset.h>
 #include <linux/regulator/consumer.h>
 #include <linux/iio/iio.h>
 
@@ -53,6 +55,7 @@ struct rockchip_saradc {
 	struct clk		*clk;
 	struct completion	completion;
 	struct regulator	*vref;
+	struct reset_control	*reset;
 	const struct rockchip_saradc_data *data;
 	u16			last_val;
 };
@@ -171,6 +174,16 @@ static const struct of_device_id rockchi
 };
 MODULE_DEVICE_TABLE(of, rockchip_saradc_match);
 
+/**
+ * Reset SARADC Controller.
+ */
+static void rockchip_saradc_reset_controller(struct reset_control *reset)
+{
+	reset_control_assert(reset);
+	usleep_range(10, 20);
+	reset_control_deassert(reset);
+}
+
 static int rockchip_saradc_probe(struct platform_device *pdev)
 {
 	struct rockchip_saradc *info = NULL;
@@ -199,6 +212,20 @@ static int rockchip_saradc_probe(struct
 	if (IS_ERR(info->regs))
 		return PTR_ERR(info->regs);
 
+	/*
+	 * The reset should be an optional property, as it should work
+	 * with old devicetrees as well
+	 */
+	info->reset = devm_reset_control_get(&pdev->dev, "saradc-apb");
+	if (IS_ERR(info->reset)) {
+		ret = PTR_ERR(info->reset);
+		if (ret != -ENOENT)
+			return ret;
+
+		dev_dbg(&pdev->dev, "no reset control found\n");
+		info->reset = NULL;
+	}
+
 	init_completion(&info->completion);
 
 	irq = platform_get_irq(pdev, 0);
@@ -233,6 +260,9 @@ static int rockchip_saradc_probe(struct
 		return PTR_ERR(info->vref);
 	}
 
+	if (info->reset)
+		rockchip_saradc_reset_controller(info->reset);
+
 	/*
 	 * Use a default value for the converter clock.
 	 * This may become user-configurable in the future.

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

* [PATCH 4.4 029/118] iio: adc: rockchip_saradc: reset saradc controller before programming it
@ 2016-09-22 17:28     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: Heiko Stuebner, linux-iio-u79uwXL29TY76Z2rM5mHXA,
	Greg Kroah-Hartman, stable-u79uwXL29TY76Z2rM5mHXA,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Rob Herring,
	Guenter Roeck, Jonathan Cameron, Caesar Wang

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

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

From: Caesar Wang <wxt-TNX95d0MmH7DzftRWevZcw@public.gmane.org>

commit 543852af8e5902aee8f7c72c89e1513663e0f696 upstream.

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

Signed-off-by: Caesar Wang <wxt-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
Cc: Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
Cc: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Tested-by: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
Signed-off-by: Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Signed-off-by: Greg Kroah-Hartman <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>

---
 Documentation/devicetree/bindings/iio/adc/rockchip-saradc.txt |    7 ++
 drivers/iio/adc/Kconfig                                       |    1 
 drivers/iio/adc/rockchip_saradc.c                             |   30 ++++++++++
 3 files changed, 38 insertions(+)

--- a/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.txt
+++ b/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.txt
@@ -12,6 +12,11 @@ Required properties:
 - vref-supply: The regulator supply ADC reference voltage.
 - #io-channel-cells: Should be 1, see ../iio-bindings.txt
 
+Optional properties:
+- resets: Must contain an entry for each entry in reset-names if need support
+	  this option. See ../reset/reset.txt for details.
+- reset-names: Must include the name "saradc-apb".
+
 Example:
 	saradc: saradc@2006c000 {
 		compatible = "rockchip,saradc";
@@ -19,6 +24,8 @@ Example:
 		interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&cru SCLK_SARADC>, <&cru PCLK_SARADC>;
 		clock-names = "saradc", "apb_pclk";
+		resets = <&cru SRST_SARADC>;
+		reset-names = "saradc-apb";
 		#io-channel-cells = <1>;
 		vref-supply = <&vcc18>;
 	};
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -306,6 +306,7 @@ config QCOM_SPMI_VADC
 config ROCKCHIP_SARADC
 	tristate "Rockchip SARADC driver"
 	depends on ARCH_ROCKCHIP || (ARM && COMPILE_TEST)
+	depends on RESET_CONTROLLER
 	help
 	  Say yes here to build support for the SARADC found in SoCs from
 	  Rockchip.
--- a/drivers/iio/adc/rockchip_saradc.c
+++ b/drivers/iio/adc/rockchip_saradc.c
@@ -21,6 +21,8 @@
 #include <linux/of_device.h>
 #include <linux/clk.h>
 #include <linux/completion.h>
+#include <linux/delay.h>
+#include <linux/reset.h>
 #include <linux/regulator/consumer.h>
 #include <linux/iio/iio.h>
 
@@ -53,6 +55,7 @@ struct rockchip_saradc {
 	struct clk		*clk;
 	struct completion	completion;
 	struct regulator	*vref;
+	struct reset_control	*reset;
 	const struct rockchip_saradc_data *data;
 	u16			last_val;
 };
@@ -171,6 +174,16 @@ static const struct of_device_id rockchi
 };
 MODULE_DEVICE_TABLE(of, rockchip_saradc_match);
 
+/**
+ * Reset SARADC Controller.
+ */
+static void rockchip_saradc_reset_controller(struct reset_control *reset)
+{
+	reset_control_assert(reset);
+	usleep_range(10, 20);
+	reset_control_deassert(reset);
+}
+
 static int rockchip_saradc_probe(struct platform_device *pdev)
 {
 	struct rockchip_saradc *info = NULL;
@@ -199,6 +212,20 @@ static int rockchip_saradc_probe(struct
 	if (IS_ERR(info->regs))
 		return PTR_ERR(info->regs);
 
+	/*
+	 * The reset should be an optional property, as it should work
+	 * with old devicetrees as well
+	 */
+	info->reset = devm_reset_control_get(&pdev->dev, "saradc-apb");
+	if (IS_ERR(info->reset)) {
+		ret = PTR_ERR(info->reset);
+		if (ret != -ENOENT)
+			return ret;
+
+		dev_dbg(&pdev->dev, "no reset control found\n");
+		info->reset = NULL;
+	}
+
 	init_completion(&info->completion);
 
 	irq = platform_get_irq(pdev, 0);
@@ -233,6 +260,9 @@ static int rockchip_saradc_probe(struct
 		return PTR_ERR(info->vref);
 	}
 
+	if (info->reset)
+		rockchip_saradc_reset_controller(info->reset);
+
 	/*
 	 * Use a default value for the converter clock.
 	 * This may become user-configurable in the future.

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

* [PATCH 4.4 030/118] iio: adc: ti_am335x_adc: Protect FIFO1 from concurrent access
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (25 preceding siblings ...)
  2016-09-22 17:28     ` Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 031/118] iio: adc: ti_am335x_adc: Increase timeout value waiting for ADC sample Greg Kroah-Hartman
                     ` (89 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Vignesh R, Jonathan Cameron

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

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

From: Vignesh R <vigneshr@ti.com>

commit 90c43ec6997a892448f1f86180a515f59cafd8a3 upstream.

It is possible that two or more ADC channels can be simultaneously
requested for raw samples, in which case there can be race in access to
FIFO data resulting in loss of samples.
If am335x_tsc_se_set_once() is called again from tiadc_read_raw(), when
ADC is still acquired to sample one of the channels, the second process
might be put into uninterruptible sleep state. Fix these issues, by
protecting FIFO access and channel configurations with a mutex. Since
tiadc_read_raw() might take anywhere between few microseconds to few
milliseconds to finish execution (depending on averaging and delay
values supplied via DT), its better to use mutex instead of spinlock.

Fixes: 7ca6740cd1cd4 ("mfd: input: iio: ti_amm335x: Rework TSC/ADC synchronization")
Signed-off-by: Vignesh R <vigneshr@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/iio/adc/ti_am335x_adc.c |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -32,6 +32,7 @@
 
 struct tiadc_device {
 	struct ti_tscadc_dev *mfd_tscadc;
+	struct mutex fifo1_lock; /* to protect fifo access */
 	int channels;
 	u8 channel_line[8];
 	u8 channel_step[8];
@@ -360,6 +361,7 @@ static int tiadc_read_raw(struct iio_dev
 		int *val, int *val2, long mask)
 {
 	struct tiadc_device *adc_dev = iio_priv(indio_dev);
+	int ret = IIO_VAL_INT;
 	int i, map_val;
 	unsigned int fifo1count, read, stepid;
 	bool found = false;
@@ -373,6 +375,7 @@ static int tiadc_read_raw(struct iio_dev
 	if (!step_en)
 		return -EINVAL;
 
+	mutex_lock(&adc_dev->fifo1_lock);
 	fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT);
 	while (fifo1count--)
 		tiadc_readl(adc_dev, REG_FIFO1);
@@ -389,7 +392,8 @@ static int tiadc_read_raw(struct iio_dev
 
 		if (time_after(jiffies, timeout)) {
 			am335x_tsc_se_adc_done(adc_dev->mfd_tscadc);
-			return -EAGAIN;
+			ret = -EAGAIN;
+			goto err_unlock;
 		}
 	}
 	map_val = adc_dev->channel_step[chan->scan_index];
@@ -415,8 +419,11 @@ static int tiadc_read_raw(struct iio_dev
 	am335x_tsc_se_adc_done(adc_dev->mfd_tscadc);
 
 	if (found == false)
-		return -EBUSY;
-	return IIO_VAL_INT;
+		ret =  -EBUSY;
+
+err_unlock:
+	mutex_unlock(&adc_dev->fifo1_lock);
+	return ret;
 }
 
 static const struct iio_info tiadc_info = {
@@ -485,6 +492,7 @@ static int tiadc_probe(struct platform_d
 
 	tiadc_step_config(indio_dev);
 	tiadc_writel(adc_dev, REG_FIFO1THR, FIFO1_THRESHOLD);
+	mutex_init(&adc_dev->fifo1_lock);
 
 	err = tiadc_channel_init(indio_dev, adc_dev->channels);
 	if (err < 0)

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

* [PATCH 4.4 031/118] iio: adc: ti_am335x_adc: Increase timeout value waiting for ADC sample
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (26 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 030/118] iio: adc: ti_am335x_adc: Protect FIFO1 from concurrent access Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 032/118] iio: ad799x: Fix buffered capture for ad7991/ad7995/ad7999 Greg Kroah-Hartman
                     ` (88 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Vignesh R, Lee Jones, Jonathan Cameron

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

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

From: Vignesh R <vigneshr@ti.com>

commit 7175cce1c3f1d8c8840d2004f78f96a3904249b5 upstream.

Now that open delay and sample delay for each channel is configurable
via DT, the default IDLE_TIMEOUT value is not enough as this is
calculated based on hardcoded macros. This results in driver returning
EBUSY sometimes. Fix this by increasing the timeout
value based on maximum value possible to open delay and sample delays
for each channel.

Fixes: 5dc11e810676e ("iio: adc: ti_am335x_adc: make sample delay, open delay, averaging DT parameters")
Signed-off-by: Vignesh R <vigneshr@ti.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/iio/adc/ti_am335x_adc.c      |    2 +-
 include/linux/mfd/ti_am335x_tscadc.h |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -382,7 +382,7 @@ static int tiadc_read_raw(struct iio_dev
 
 	am335x_tsc_se_set_once(adc_dev->mfd_tscadc, step_en);
 
-	timeout = jiffies + usecs_to_jiffies
+	timeout = jiffies + msecs_to_jiffies
 				(IDLE_TIMEOUT * adc_dev->channels);
 	/* Wait for Fifo threshold interrupt */
 	while (1) {
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -138,16 +138,16 @@
 /*
  * time in us for processing a single channel, calculated as follows:
  *
- * num cycles = open delay + (sample delay + conv time) * averaging
+ * max num cycles = open delay + (sample delay + conv time) * averaging
  *
- * num cycles: 152 + (1 + 13) * 16 = 376
+ * max num cycles: 262143 + (255 + 13) * 16 = 266431
  *
  * clock frequency: 26MHz / 8 = 3.25MHz
  * clock period: 1 / 3.25MHz = 308ns
  *
- * processing time: 376 * 308ns = 116us
+ * max processing time: 266431 * 308ns = 83ms(approx)
  */
-#define IDLE_TIMEOUT 116 /* microsec */
+#define IDLE_TIMEOUT 83 /* milliseconds */
 
 #define TSCADC_CELLS		2
 

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

* [PATCH 4.4 032/118] iio: ad799x: Fix buffered capture for ad7991/ad7995/ad7999
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (27 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 031/118] iio: adc: ti_am335x_adc: Increase timeout value waiting for ADC sample Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 033/118] iio: adc: at91: unbreak channel adc channel 3 Greg Kroah-Hartman
                     ` (87 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Lars-Peter Clausen, Jonathan Cameron

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

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

From: Lars-Peter Clausen <lars@metafoo.de>

commit 7d3cc21dab5313a02f2f3ca8164529b828a030d1 upstream.

The data buffer for captured mode for the ad799x driver is allocated in the
update_scan_mode() callback. This callback is not set in the iio_info
struct for the ad7791/ad7995/ad7999, which means that the data buffer is
not allocated when a captured transfer is started. As a result the driver
crashes when the first sample is received. To fix this properly set the
update_scan_mode() callback.

Fixes: d8dca33027c1 ("staging:iio:ad799x: Preallocate sample buffer")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/iio/adc/ad799x.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/iio/adc/ad799x.c
+++ b/drivers/iio/adc/ad799x.c
@@ -533,6 +533,7 @@ static struct attribute_group ad799x_eve
 static const struct iio_info ad7991_info = {
 	.read_raw = &ad799x_read_raw,
 	.driver_module = THIS_MODULE,
+	.update_scan_mode = ad799x_update_scan_mode,
 };
 
 static const struct iio_info ad7993_4_7_8_noirq_info = {

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

* [PATCH 4.4 033/118] iio: adc: at91: unbreak channel adc channel 3
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (28 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 032/118] iio: ad799x: Fix buffered capture for ad7991/ad7995/ad7999 Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 034/118] iio: accel: bmc150: reset chip at init time Greg Kroah-Hartman
                     ` (86 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Anders Darander, Alexandre Belloni,
	Jonathan Cameron

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

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

From: Anders Darander <anders@chargestorm.se>

commit c2ab447454d498e709d9011c0f2d2945ee321f9b upstream.

The driver always assumes that an input device has been created when
reading channel 3. This causes a kernel panic when dereferencing
st->ts_input.

The change was introduced in
commit 84882b060301 ("iio: adc: at91_adc: Add support for touchscreens
without TSMR"). Earlier versions only entered that part of the if-else
statement if only the following flags are set:

AT91_ADC_IER_XRDY | AT91_ADC_IER_YRDY | AT91_ADC_IER_PRDY

Signed-off-by: Anders Darander <anders@chargestorm.se>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/iio/adc/at91_adc.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -381,8 +381,8 @@ static irqreturn_t at91_adc_rl_interrupt
 		st->ts_bufferedmeasure = false;
 		input_report_key(st->ts_input, BTN_TOUCH, 0);
 		input_sync(st->ts_input);
-	} else if (status & AT91_ADC_EOC(3)) {
-		/* Conversion finished */
+	} else if (status & AT91_ADC_EOC(3) && st->ts_input) {
+		/* Conversion finished and we've a touchscreen */
 		if (st->ts_bufferedmeasure) {
 			/*
 			 * Last measurement is always discarded, since it can

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

* [PATCH 4.4 034/118] iio: accel: bmc150: reset chip at init time
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (29 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 033/118] iio: adc: at91: unbreak channel adc channel 3 Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 035/118] iio: fix pressure data output unit in hid-sensor-attributes Greg Kroah-Hartman
                     ` (85 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Olof Johansson, Srinivas Pandruvada,
	Jonathan Cameron

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

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

From: Olof Johansson <olof@lixom.net>

commit 1c500840934a138bd6b13556c210516e9301fbee upstream.

In at least one known setup, the chip comes up in a state where reading
the chip ID returns garbage unless it's been reset, due to noise on the
wires during system boot.

All supported chips have the same reset method, and based on the
datasheets they all need 1.3 or 1.8ms to recover after reset. So, do
the conservative thing here and always reset the chip.

Signed-off-by: Olof Johansson <olof@lixom.net>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/iio/accel/bmc150-accel-core.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

--- a/drivers/iio/accel/bmc150-accel-core.c
+++ b/drivers/iio/accel/bmc150-accel-core.c
@@ -68,6 +68,9 @@
 #define BMC150_ACCEL_REG_PMU_BW		0x10
 #define BMC150_ACCEL_DEF_BW			125
 
+#define BMC150_ACCEL_REG_RESET			0x14
+#define BMC150_ACCEL_RESET_VAL			0xB6
+
 #define BMC150_ACCEL_REG_INT_MAP_0		0x19
 #define BMC150_ACCEL_INT_MAP_0_BIT_SLOPE	BIT(2)
 
@@ -1487,6 +1490,14 @@ static int bmc150_accel_chip_init(struct
 	int ret, i;
 	unsigned int val;
 
+	/*
+	 * Reset chip to get it in a known good state. A delay of 1.8ms after
+	 * reset is required according to the data sheets of supported chips.
+	 */
+	regmap_write(data->regmap, BMC150_ACCEL_REG_RESET,
+		     BMC150_ACCEL_RESET_VAL);
+	usleep_range(1800, 2500);
+
 	ret = regmap_read(data->regmap, BMC150_ACCEL_REG_CHIP_ID, &val);
 	if (ret < 0) {
 		dev_err(data->dev,

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

* [PATCH 4.4 035/118] iio: fix pressure data output unit in hid-sensor-attributes
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (30 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 034/118] iio: accel: bmc150: reset chip at init time Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 036/118] iio: accel: kxsd9: Fix scaling bug Greg Kroah-Hartman
                     ` (84 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Kweh, Hock Leong,
	Srinivas Pandruvada, Jonathan Cameron

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

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

From: Kweh, Hock Leong <hock.leong.kweh@intel.com>

commit 36afb176d3c9580651d7f410ed7f000ec48b5137 upstream.

According to IIO ABI definition, IIO_PRESSURE data output unit is
kilopascal:
http://lxr.free-electrons.com/source/Documentation/ABI/testing/sysfs-bus-iio

This patch fix output unit of HID pressure sensor IIO driver from pascal to
kilopascal to follow IIO ABI definition.

Signed-off-by: Kweh, Hock Leong <hock.leong.kweh@intel.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/iio/common/hid-sensors/hid-sensor-attributes.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
+++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
@@ -56,8 +56,8 @@ static struct {
 	{HID_USAGE_SENSOR_ALS, 0, 1, 0},
 	{HID_USAGE_SENSOR_ALS, HID_USAGE_SENSOR_UNITS_LUX, 1, 0},
 
-	{HID_USAGE_SENSOR_PRESSURE, 0, 100000, 0},
-	{HID_USAGE_SENSOR_PRESSURE, HID_USAGE_SENSOR_UNITS_PASCAL, 1, 0},
+	{HID_USAGE_SENSOR_PRESSURE, 0, 100, 0},
+	{HID_USAGE_SENSOR_PRESSURE, HID_USAGE_SENSOR_UNITS_PASCAL, 0, 1000},
 };
 
 static int pow_10(unsigned power)

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

* [PATCH 4.4 036/118] iio: accel: kxsd9: Fix scaling bug
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (31 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 035/118] iio: fix pressure data output unit in hid-sensor-attributes Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 037/118] iio:core: fix IIO_VAL_FRACTIONAL sign handling Greg Kroah-Hartman
                     ` (83 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Jonathan Cameron, Linus Walleij

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

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

From: Linus Walleij <linus.walleij@linaro.org>

commit 307fe9dd11ae44d4f8881ee449a7cbac36e1f5de upstream.

All the scaling of the KXSD9 involves multiplication with a
fraction number < 1.

However the scaling value returned from IIO_INFO_SCALE was
unpredictable as only the micros of the value was assigned, and
not the integer part, resulting in scaling like this:

$cat in_accel_scale
-1057462640.011978

Fix this by assigning zero to the integer part.

Tested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/iio/accel/kxsd9.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/iio/accel/kxsd9.c
+++ b/drivers/iio/accel/kxsd9.c
@@ -166,6 +166,7 @@ static int kxsd9_read_raw(struct iio_dev
 		ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C));
 		if (ret < 0)
 			goto error_ret;
+		*val = 0;
 		*val2 = kxsd9_micro_scales[ret & KXSD9_FS_MASK];
 		ret = IIO_VAL_INT_PLUS_MICRO;
 		break;

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

* [PATCH 4.4 037/118] iio:core: fix IIO_VAL_FRACTIONAL sign handling
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (32 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 036/118] iio: accel: kxsd9: Fix scaling bug Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 038/118] iio: ensure ret is initialized to zero before entering do loop Greg Kroah-Hartman
                     ` (82 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Gregor Boirie, Lars-Peter Clausen,
	Jonathan Cameron

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

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

From: Gregor Boirie <gregor.boirie@parrot.com>

commit 171c0091837c81ed5c949fec6966bb5afff2d1cf upstream.

7985e7c100 ("iio: Introduce a new fractional value type") introduced a
new IIO_VAL_FRACTIONAL value type meant to represent rational type numbers
expressed by a numerator and denominator combination.

Formating of IIO_VAL_FRACTIONAL values relies upon do_div() usage. This
fails handling negative values properly since parameters are reevaluated
as unsigned values.
Fix this by using div_s64_rem() instead. Computed integer part will carry
properly signed value. Formatted fractional part will always be positive.

Fixes: 7985e7c100 ("iio: Introduce a new fractional value type")
Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/iio/industrialio-core.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -447,9 +447,8 @@ ssize_t iio_format_value(char *buf, unsi
 			return sprintf(buf, "%d.%09u\n", vals[0], vals[1]);
 	case IIO_VAL_FRACTIONAL:
 		tmp = div_s64((s64)vals[0] * 1000000000LL, vals[1]);
-		vals[1] = do_div(tmp, 1000000000LL);
-		vals[0] = tmp;
-		return sprintf(buf, "%d.%09u\n", vals[0], vals[1]);
+		vals[0] = (int)div_s64_rem(tmp, 1000000000, &vals[1]);
+		return sprintf(buf, "%d.%09u\n", vals[0], abs(vals[1]));
 	case IIO_VAL_FRACTIONAL_LOG2:
 		tmp = (s64)vals[0] * 1000000000LL >> vals[1];
 		vals[1] = do_div(tmp, 1000000000LL);

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

* [PATCH 4.4 038/118] iio: ensure ret is initialized to zero before entering do loop
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (33 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 037/118] iio:core: fix IIO_VAL_FRACTIONAL sign handling Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 039/118] serial: 8250_mid: fix divide error bug if baud rate is 0 Greg Kroah-Hartman
                     ` (81 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Colin Ian King, Jonathan Cameron

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

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

From: Colin Ian King <colin.king@canonical.com>

commit 5dba4b14bafe801083d01e1f400816df7e5a8f2e upstream.

A recent fix to iio_buffer_read_first_n_outer removed ret from being set by
a return from wait_event_interruptible and also added a continue in a loop
which causes the variable ret to not be set when it reaches the end of the
loop.  Fix this by initializing ret to zero.

Also remove extraneous white space at the end of the loop.

Fixes: fcf68f3c0bb2a5 ("fix sched WARNING "do not call blocking ops when !TASK_RUNNING")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/iio/industrialio-buffer.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -110,7 +110,7 @@ ssize_t iio_buffer_read_first_n_outer(st
 	DEFINE_WAIT_FUNC(wait, woken_wake_function);
 	size_t datum_size;
 	size_t to_wait;
-	int ret;
+	int ret = 0;
 
 	if (!indio_dev->info)
 		return -ENODEV;
@@ -153,7 +153,7 @@ ssize_t iio_buffer_read_first_n_outer(st
 		ret = rb->access->read_first_n(rb, n, buf);
 		if (ret == 0 && (filp->f_flags & O_NONBLOCK))
 			ret = -EAGAIN;
-	 } while (ret == 0);
+	} while (ret == 0);
 	remove_wait_queue(&rb->pollq, &wait);
 
 	return ret;

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

* [PATCH 4.4 039/118] serial: 8250_mid: fix divide error bug if baud rate is 0
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (34 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 038/118] iio: ensure ret is initialized to zero before entering do loop Greg Kroah-Hartman
@ 2016-09-22 17:28   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 040/118] serial: 8250: added acces i/o products quad and octal serial cards Greg Kroah-Hartman
                     ` (80 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Mendez Salinas, Fernando, Andy Shevchenko

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

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

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

commit 47b34d2ef266e2c283b514d65c8963c2ccd42474 upstream.

Since the commit c1a67b48f6a5 ("serial: 8250_pci: replace switch-case by
formula for Intel MID"), the 8250 driver crashes in the byt_set_termios()
function with a divide error. This is caused by the fact that a baud rate of 0
(B0) is not handled properly. Fix it by falling back to B9600 in this case.

Reported-by: "Mendez Salinas, Fernando" <fernando.mendez.salinas@intel.com>
Fixes: c1a67b48f6a5 ("serial: 8250_pci: replace switch-case by formula for Intel MID")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/tty/serial/8250/8250_mid.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/tty/serial/8250/8250_mid.c
+++ b/drivers/tty/serial/8250/8250_mid.c
@@ -149,6 +149,9 @@ static void mid8250_set_termios(struct u
 	unsigned long w = BIT(24) - 1;
 	unsigned long mul, div;
 
+	/* Gracefully handle the B0 case: fall back to B9600 */
+	fuart = fuart ? fuart : 9600 * 16;
+
 	if (mid->board->freq < fuart) {
 		/* Find prescaler value that satisfies Fuart < Fref */
 		if (mid->board->freq > baud)

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

* [PATCH 4.4 040/118] serial: 8250: added acces i/o products quad and octal serial cards
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (35 preceding siblings ...)
  2016-09-22 17:28   ` [PATCH 4.4 039/118] serial: 8250_mid: fix divide error bug if baud rate is 0 Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 041/118] USB: serial: simple: add support for another Infineon flashloader Greg Kroah-Hartman
                     ` (79 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Jimi Damon

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

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

From: Jimi Damon <jdamon@accesio.com>

commit c8d192428f52f244130b84650ad616df09f2b1e1 upstream.

Added devices ids for acces i/o products quad and octal serial cards
that make use of existing Pericom PI7C9X7954 and PI7C9X7958
configurations .

Signed-off-by: Jimi Damon <jdamon@accesio.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/tty/serial/8250/8250_pci.c |  139 +++++++++++++++++++++++++++++++++++++
 1 file changed, 139 insertions(+)

--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -1952,6 +1952,43 @@ pci_wch_ch38x_setup(struct serial_privat
 #define PCI_DEVICE_ID_PERICOM_PI7C9X7954	0x7954
 #define PCI_DEVICE_ID_PERICOM_PI7C9X7958	0x7958
 
+#define PCI_VENDOR_ID_ACCESIO			0x494f
+#define PCI_DEVICE_ID_ACCESIO_PCIE_COM_2SDB	0x1051
+#define PCI_DEVICE_ID_ACCESIO_MPCIE_COM_2S	0x1053
+#define PCI_DEVICE_ID_ACCESIO_PCIE_COM_4SDB	0x105C
+#define PCI_DEVICE_ID_ACCESIO_MPCIE_COM_4S	0x105E
+#define PCI_DEVICE_ID_ACCESIO_PCIE_COM232_2DB	0x1091
+#define PCI_DEVICE_ID_ACCESIO_MPCIE_COM232_2	0x1093
+#define PCI_DEVICE_ID_ACCESIO_PCIE_COM232_4DB	0x1099
+#define PCI_DEVICE_ID_ACCESIO_MPCIE_COM232_4	0x109B
+#define PCI_DEVICE_ID_ACCESIO_PCIE_COM_2SMDB	0x10D1
+#define PCI_DEVICE_ID_ACCESIO_MPCIE_COM_2SM	0x10D3
+#define PCI_DEVICE_ID_ACCESIO_PCIE_COM_4SMDB	0x10DA
+#define PCI_DEVICE_ID_ACCESIO_MPCIE_COM_4SM	0x10DC
+#define PCI_DEVICE_ID_ACCESIO_MPCIE_ICM485_1	0x1108
+#define PCI_DEVICE_ID_ACCESIO_MPCIE_ICM422_2	0x1110
+#define PCI_DEVICE_ID_ACCESIO_MPCIE_ICM485_2	0x1111
+#define PCI_DEVICE_ID_ACCESIO_MPCIE_ICM422_4	0x1118
+#define PCI_DEVICE_ID_ACCESIO_MPCIE_ICM485_4	0x1119
+#define PCI_DEVICE_ID_ACCESIO_PCIE_ICM_2S	0x1152
+#define PCI_DEVICE_ID_ACCESIO_PCIE_ICM_4S	0x115A
+#define PCI_DEVICE_ID_ACCESIO_PCIE_ICM232_2	0x1190
+#define PCI_DEVICE_ID_ACCESIO_MPCIE_ICM232_2	0x1191
+#define PCI_DEVICE_ID_ACCESIO_PCIE_ICM232_4	0x1198
+#define PCI_DEVICE_ID_ACCESIO_MPCIE_ICM232_4	0x1199
+#define PCI_DEVICE_ID_ACCESIO_PCIE_ICM_2SM	0x11D0
+#define PCI_DEVICE_ID_ACCESIO_PCIE_COM422_4	0x105A
+#define PCI_DEVICE_ID_ACCESIO_PCIE_COM485_4	0x105B
+#define PCI_DEVICE_ID_ACCESIO_PCIE_COM422_8	0x106A
+#define PCI_DEVICE_ID_ACCESIO_PCIE_COM485_8	0x106B
+#define PCI_DEVICE_ID_ACCESIO_PCIE_COM232_4	0x1098
+#define PCI_DEVICE_ID_ACCESIO_PCIE_COM232_8	0x10A9
+#define PCI_DEVICE_ID_ACCESIO_PCIE_COM_4SM	0x10D9
+#define PCI_DEVICE_ID_ACCESIO_PCIE_COM_8SM	0x10E9
+#define PCI_DEVICE_ID_ACCESIO_PCIE_ICM_4SM	0x11D8
+
+
+
 /* Unknown vendors/cards - this should not be in linux/pci_ids.h */
 #define PCI_SUBDEVICE_ID_UNKNOWN_0x1584	0x1584
 #define PCI_SUBDEVICE_ID_UNKNOWN_0x1588	0x1588
@@ -5120,6 +5157,108 @@ static struct pci_device_id serial_pci_t
 		0,
 		0, pbn_pericom_PI7C9X7958 },
 	/*
+	 * ACCES I/O Products quad
+	 */
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM_2SDB,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7954 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_COM_2S,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7954 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM_4SDB,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7954 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_COM_4S,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7954 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM232_2DB,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7954 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_COM232_2,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7954 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM232_4DB,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7954 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_COM232_4,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7954 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM_2SMDB,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7954 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_COM_2SM,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7954 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM_4SMDB,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7954 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_COM_4SM,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7954 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_ICM485_1,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7954 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_ICM422_2,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7954 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_ICM485_2,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7954 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_ICM422_4,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7954 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_ICM485_4,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7954 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_ICM_2S,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7954 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_ICM_4S,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7954 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_ICM232_2,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7954 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_ICM232_2,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7954 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_ICM232_4,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7954 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_ICM232_4,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7954 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_ICM_2SM,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7954 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM422_4,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7958 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM485_4,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7958 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM422_8,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7958 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM485_8,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7958 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM232_4,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7958 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM232_8,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7958 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM_4SM,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7958 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM_8SM,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7958 },
+	{	PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_ICM_4SM,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_pericom_PI7C9X7958 },
+	/*
 	 * Topic TP560 Data/Fax/Voice 56k modem (reported by Evan Clarke)
 	 */
 	{	PCI_VENDOR_ID_TOPIC, PCI_DEVICE_ID_TOPIC_TP560,

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

* [PATCH 4.4 041/118] USB: serial: simple: add support for another Infineon flashloader
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (36 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 040/118] serial: 8250: added acces i/o products quad and octal serial cards Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 042/118] usb: renesas_usbhs: fix clearing the {BRDY,BEMP}STS condition Greg Kroah-Hartman
                     ` (78 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Daniele Palmas, Johan Hovold

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

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

From: Daniele Palmas <dnlplm@gmail.com>

commit f190fd92458da3e869b4e2c6289e2c617490ae53 upstream.

This patch adds support for Infineon flashloader 0x8087/0x0801.

The flashloader is used in Telit LE940B modem family with Telit
flashing application.

Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/usb-serial-simple.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/usb/serial/usb-serial-simple.c
+++ b/drivers/usb/serial/usb-serial-simple.c
@@ -54,7 +54,8 @@ DEVICE(funsoft, FUNSOFT_IDS);
 /* Infineon Flashloader driver */
 #define FLASHLOADER_IDS()		\
 	{ USB_DEVICE_INTERFACE_CLASS(0x058b, 0x0041, USB_CLASS_CDC_DATA) }, \
-	{ USB_DEVICE(0x8087, 0x0716) }
+	{ USB_DEVICE(0x8087, 0x0716) }, \
+	{ USB_DEVICE(0x8087, 0x0801) }
 DEVICE(flashloader, FLASHLOADER_IDS);
 
 /* Google Serial USB SubClass */

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

* [PATCH 4.4 042/118] usb: renesas_usbhs: fix clearing the {BRDY,BEMP}STS condition
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (37 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 041/118] USB: serial: simple: add support for another Infineon flashloader Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 043/118] usb: chipidea: udc: fix NULL ptr dereference in isr_setup_status_phase Greg Kroah-Hartman
                     ` (77 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Yoshihiro Shimoda, Felipe Balbi

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

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

From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

commit 519d8bd4b5d3d82c413eac5bb42b106bb4b9ec15 upstream.

The previous driver is possible to stop the transfer wrongly.
For example:
 1) An interrupt happens, but not BRDY interruption.
 2) Read INTSTS0. And than state->intsts0 is not set to BRDY.
 3) BRDY is set to 1 here.
 4) Read BRDYSTS.
 5) Clear the BRDYSTS. And then. the BRDY is cleared wrongly.

Remarks:
 - The INTSTS0.BRDY is read only.
  - If any bits of BRDYSTS are set to 1, the BRDY is set to 1.
  - If BRDYSTS is 0, the BRDY is set to 0.

So, this patch adds condition to avoid such situation. (And about
NRDYSTS, this is not used for now. But, avoiding any side effects,
this patch doesn't touch it.)

Fixes: d5c6a1e024dd ("usb: renesas_usbhs: fixup interrupt status clear method")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/renesas_usbhs/mod.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

--- a/drivers/usb/renesas_usbhs/mod.c
+++ b/drivers/usb/renesas_usbhs/mod.c
@@ -282,9 +282,16 @@ static irqreturn_t usbhs_interrupt(int i
 	if (usbhs_mod_is_host(priv))
 		usbhs_write(priv, INTSTS1, ~irq_state.intsts1 & INTSTS1_MAGIC);
 
-	usbhs_write(priv, BRDYSTS, ~irq_state.brdysts);
+	/*
+	 * The driver should not clear the xxxSTS after the line of
+	 * "call irq callback functions" because each "if" statement is
+	 * possible to call the callback function for avoiding any side effects.
+	 */
+	if (irq_state.intsts0 & BRDY)
+		usbhs_write(priv, BRDYSTS, ~irq_state.brdysts);
 	usbhs_write(priv, NRDYSTS, ~irq_state.nrdysts);
-	usbhs_write(priv, BEMPSTS, ~irq_state.bempsts);
+	if (irq_state.intsts0 & BEMP)
+		usbhs_write(priv, BEMPSTS, ~irq_state.bempsts);
 
 	/*
 	 * call irq callback functions

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

* [PATCH 4.4 043/118] usb: chipidea: udc: fix NULL ptr dereference in isr_setup_status_phase
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (38 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 042/118] usb: renesas_usbhs: fix clearing the {BRDY,BEMP}STS condition Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 044/118] ARM: dts: STiH410: Handle interconnect clock required by EHCI/OHCI (USB) Greg Kroah-Hartman
                     ` (76 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Clemens Gruber, Peter Chen

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

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

From: Clemens Gruber <clemens.gruber@pqgruber.com>

commit 6f3c4fb6d05e63c9c6d8968302491c3a5457be61 upstream.

Problems with the signal integrity of the high speed USB data lines or
noise on reference ground lines can cause the i.MX6 USB controller to
violate USB specs and exhibit unexpected behavior.

It was observed that USBi_UI interrupts were triggered first and when
isr_setup_status_phase was called, ci->status was NULL, which lead to a
NULL pointer dereference kernel panic.

This patch fixes the kernel panic, emits a warning once and returns
-EPIPE to halt the device and let the host get stalled.
It also adds a comment to point people, who are experiencing this issue,
to their USB hardware design.

Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/chipidea/udc.c |    9 +++++++++
 1 file changed, 9 insertions(+)

--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -939,6 +939,15 @@ static int isr_setup_status_phase(struct
 	int retval;
 	struct ci_hw_ep *hwep;
 
+	/*
+	 * Unexpected USB controller behavior, caused by bad signal integrity
+	 * or ground reference problems, can lead to isr_setup_status_phase
+	 * being called with ci->status equal to NULL.
+	 * If this situation occurs, you should review your USB hardware design.
+	 */
+	if (WARN_ON_ONCE(!ci->status))
+		return -EPIPE;
+
 	hwep = (ci->ep0_dir == TX) ? ci->ep0out : ci->ep0in;
 	ci->status->context = ci;
 	ci->status->complete = isr_setup_status_complete;

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

* [PATCH 4.4 044/118] ARM: dts: STiH410: Handle interconnect clock required by EHCI/OHCI (USB)
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (39 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 043/118] usb: chipidea: udc: fix NULL ptr dereference in isr_setup_status_phase Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 045/118] USB: change bInterval default to 10 ms Greg Kroah-Hartman
                     ` (75 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Peter Griffin, Lee Jones, Patrice Chotard

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

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

From: Lee Jones <lee.jones@linaro.org>

commit 7e9d2850a8db4e0d85a20bb692198bf2cc4be3b7 upstream.

The STiH4{07,10} platform contains some interconnect clocks which are used
by various IPs.  If this clock isn't handled correctly by ST's EHCI/OHCI
drivers, their hub won't be found, the following error be shown and the
result will be non-working USB:

  [   97.221963] hub 2-1:1.0: hub_ext_port_status failed (err = -110)

Tested-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/stih410.dtsi |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

--- a/arch/arm/boot/dts/stih410.dtsi
+++ b/arch/arm/boot/dts/stih410.dtsi
@@ -41,7 +41,8 @@
 			compatible = "st,st-ohci-300x";
 			reg = <0x9a03c00 0x100>;
 			interrupts = <GIC_SPI 180 IRQ_TYPE_NONE>;
-			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>;
+			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>,
+				 <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>;
 			resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>,
 				 <&softreset STIH407_USB2_PORT0_SOFTRESET>;
 			reset-names = "power", "softreset";
@@ -57,7 +58,8 @@
 			interrupts = <GIC_SPI 151 IRQ_TYPE_NONE>;
 			pinctrl-names = "default";
 			pinctrl-0 = <&pinctrl_usb0>;
-			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>;
+			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>,
+				 <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>;
 			resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>,
 				 <&softreset STIH407_USB2_PORT0_SOFTRESET>;
 			reset-names = "power", "softreset";
@@ -71,7 +73,8 @@
 			compatible = "st,st-ohci-300x";
 			reg = <0x9a83c00 0x100>;
 			interrupts = <GIC_SPI 181 IRQ_TYPE_NONE>;
-			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>;
+			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>,
+				 <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>;
 			resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>,
 				 <&softreset STIH407_USB2_PORT1_SOFTRESET>;
 			reset-names = "power", "softreset";
@@ -87,7 +90,8 @@
 			interrupts = <GIC_SPI 153 IRQ_TYPE_NONE>;
 			pinctrl-names = "default";
 			pinctrl-0 = <&pinctrl_usb1>;
-			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>;
+			clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>,
+				 <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>;
 			resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>,
 				 <&softreset STIH407_USB2_PORT1_SOFTRESET>;
 			reset-names = "power", "softreset";

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

* [PATCH 4.4 045/118] USB: change bInterval default to 10 ms
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (40 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 044/118] ARM: dts: STiH410: Handle interconnect clock required by EHCI/OHCI (USB) Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 046/118] cxl: use pcibios_free_controller_deferred() when removing vPHBs Greg Kroah-Hartman
                     ` (74 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Alan Stern, Wade Berrier

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

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

From: Alan Stern <stern@rowland.harvard.edu>

commit 08c5cd37480f59ea39682f4585d92269be6b1424 upstream.

Some full-speed mceusb infrared transceivers contain invalid endpoint
descriptors for their interrupt endpoints, with bInterval set to 0.
In the past they have worked out okay with the mceusb driver, because
the driver sets the bInterval field in the descriptor to 1,
overwriting whatever value may have been there before.  However, this
approach was never sanctioned by the USB core, and in fact it does not
work with xHCI controllers, because they use the bInterval value that
was present when the configuration was installed.

Currently usbcore uses 32 ms as the default interval if the value in
the endpoint descriptor is invalid.  It turns out that these IR
transceivers don't work properly unless the interval is set to 10 ms
or below.  To work around this mceusb problem, this patch changes the
endpoint-descriptor parsing routine, making the default interval value
be 10 ms rather than 32 ms.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Wade Berrier <wberrier@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/core/config.c |   28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -211,8 +211,10 @@ static int usb_parse_endpoint(struct dev
 	memcpy(&endpoint->desc, d, n);
 	INIT_LIST_HEAD(&endpoint->urb_list);
 
-	/* Fix up bInterval values outside the legal range. Use 32 ms if no
-	 * proper value can be guessed. */
+	/*
+	 * Fix up bInterval values outside the legal range.
+	 * Use 10 or 8 ms if no proper value can be guessed.
+	 */
 	i = 0;		/* i = min, j = max, n = default */
 	j = 255;
 	if (usb_endpoint_xfer_int(d)) {
@@ -221,13 +223,15 @@ static int usb_parse_endpoint(struct dev
 		case USB_SPEED_SUPER_PLUS:
 		case USB_SPEED_SUPER:
 		case USB_SPEED_HIGH:
-			/* Many device manufacturers are using full-speed
+			/*
+			 * Many device manufacturers are using full-speed
 			 * bInterval values in high-speed interrupt endpoint
-			 * descriptors. Try to fix those and fall back to a
-			 * 32 ms default value otherwise. */
+			 * descriptors. Try to fix those and fall back to an
+			 * 8-ms default value otherwise.
+			 */
 			n = fls(d->bInterval*8);
 			if (n == 0)
-				n = 9;	/* 32 ms = 2^(9-1) uframes */
+				n = 7;	/* 8 ms = 2^(7-1) uframes */
 			j = 16;
 
 			/*
@@ -242,10 +246,12 @@ static int usb_parse_endpoint(struct dev
 			}
 			break;
 		default:		/* USB_SPEED_FULL or _LOW */
-			/* For low-speed, 10 ms is the official minimum.
+			/*
+			 * For low-speed, 10 ms is the official minimum.
 			 * But some "overclocked" devices might want faster
-			 * polling so we'll allow it. */
-			n = 32;
+			 * polling so we'll allow it.
+			 */
+			n = 10;
 			break;
 		}
 	} else if (usb_endpoint_xfer_isoc(d)) {
@@ -253,10 +259,10 @@ static int usb_parse_endpoint(struct dev
 		j = 16;
 		switch (to_usb_device(ddev)->speed) {
 		case USB_SPEED_HIGH:
-			n = 9;		/* 32 ms = 2^(9-1) uframes */
+			n = 7;		/* 8 ms = 2^(7-1) uframes */
 			break;
 		default:		/* USB_SPEED_FULL */
-			n = 6;		/* 32 ms = 2^(6-1) frames */
+			n = 4;		/* 8 ms = 2^(4-1) frames */
 			break;
 		}
 	}

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

* [PATCH 4.4 046/118] cxl: use pcibios_free_controller_deferred() when removing vPHBs
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (41 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 045/118] USB: change bInterval default to 10 ms Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 047/118] net: thunderx: Fix OOPs with ethtool --register-dump Greg Kroah-Hartman
                     ` (73 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Andrew Donnellan, Matthew R. Ochs,
	Ian Munsie, Benjamin Herrenschmidt

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

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

From: Andrew Donnellan <andrew.donnellan@au1.ibm.com>

commit 6f38a8b9a45833495dc878c335c5431cd98a16ed upstream.

When cxl removes a vPHB, it's possible that the pci_controller may be freed
before all references to the devices on the vPHB have been released. This
in turn causes an invalid memory access when the devices are eventually
released, as pcibios_release_device() attempts to call the phb's
release_device hook.

In cxl_pci_vphb_remove(), remove the existing call to
pcibios_free_controller(). Instead, use
pcibios_free_controller_deferred() to free the pci_controller after all
devices have been released. Export pci_set_host_bridge_release() so we can
do this.

Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Acked-by: Ian Munsie <imunsie@au1.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/misc/cxl/vphb.c   |   10 +++++++++-
 drivers/pci/host-bridge.c |    1 +
 2 files changed, 10 insertions(+), 1 deletion(-)

--- a/drivers/misc/cxl/vphb.c
+++ b/drivers/misc/cxl/vphb.c
@@ -258,6 +258,11 @@ int cxl_pci_vphb_add(struct cxl_afu *afu
 	if (phb->bus == NULL)
 		return -ENXIO;
 
+	/* Set release hook on root bus */
+	pci_set_host_bridge_release(to_pci_host_bridge(phb->bus->bridge),
+				    pcibios_free_controller_deferred,
+				    (void *) phb);
+
 	/* Claim resources. This might need some rework as well depending
 	 * whether we are doing probe-only or not, like assigning unassigned
 	 * resources etc...
@@ -293,7 +298,10 @@ void cxl_pci_vphb_remove(struct cxl_afu
 	afu->phb = NULL;
 
 	pci_remove_root_bus(phb->bus);
-	pcibios_free_controller(phb);
+	/*
+	 * We don't free phb here - that's handled by
+	 * pcibios_free_controller_deferred()
+	 */
 }
 
 struct cxl_afu *cxl_pci_to_afu(struct pci_dev *dev)
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -44,6 +44,7 @@ void pci_set_host_bridge_release(struct
 	bridge->release_fn = release_fn;
 	bridge->release_data = release_data;
 }
+EXPORT_SYMBOL_GPL(pci_set_host_bridge_release);
 
 void pcibios_resource_to_bus(struct pci_bus *bus, struct pci_bus_region *region,
 			     struct resource *res)

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

* [PATCH 4.4 047/118] net: thunderx: Fix OOPs with ethtool --register-dump
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (42 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 046/118] cxl: use pcibios_free_controller_deferred() when removing vPHBs Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 048/118] cpuset: make sure new tasks conform to the current config of the cpuset Greg Kroah-Hartman
                     ` (72 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, David Daney, David S. Miller

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

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

From: David Daney <david.daney@cavium.com>

commit 1423661fed2c40d6d71b5e2e3aa390f85157f9d5 upstream.

The ethtool_ops .get_regs function attempts to read the nonexistent
register NIC_QSET_SQ_0_7_CNM_CHG, which produces a "bus error" type
OOPs.

Fix by not attempting to read, and removing the definition of,
NIC_QSET_SQ_0_7_CNM_CHG.  A zero is written into the register dump to
keep the layout unchanged.

Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/ethernet/cavium/thunder/nic_reg.h       |    1 -
 drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c |    5 ++++-
 2 files changed, 4 insertions(+), 2 deletions(-)

--- a/drivers/net/ethernet/cavium/thunder/nic_reg.h
+++ b/drivers/net/ethernet/cavium/thunder/nic_reg.h
@@ -170,7 +170,6 @@
 #define   NIC_QSET_SQ_0_7_DOOR			(0x010838)
 #define   NIC_QSET_SQ_0_7_STATUS		(0x010840)
 #define   NIC_QSET_SQ_0_7_DEBUG			(0x010848)
-#define   NIC_QSET_SQ_0_7_CNM_CHG		(0x010860)
 #define   NIC_QSET_SQ_0_7_STAT_0_1		(0x010900)
 
 #define   NIC_QSET_RBDR_0_1_CFG			(0x010C00)
--- a/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c
@@ -380,7 +380,10 @@ static void nicvf_get_regs(struct net_de
 		p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_DOOR, q);
 		p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_STATUS, q);
 		p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_DEBUG, q);
-		p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_CNM_CHG, q);
+		/* Padding, was NIC_QSET_SQ_0_7_CNM_CHG, which
+		 * produces bus errors when read
+		 */
+		p[i++] = 0;
 		p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_STAT_0_1, q);
 		reg_offset = NIC_QSET_SQ_0_7_STAT_0_1 | (1 << 3);
 		p[i++] = nicvf_queue_reg_read(nic, reg_offset, q);

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

* [PATCH 4.4 048/118] cpuset: make sure new tasks conform to the current config of the cpuset
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (43 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 047/118] net: thunderx: Fix OOPs with ethtool --register-dump Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-26 12:34     ` Takashi Iwai
  2016-09-22 17:29   ` [PATCH 4.4 049/118] ARM: AM43XX: hwmod: Fix RSTST register offset for pruss Greg Kroah-Hartman
                     ` (71 subsequent siblings)
  116 siblings, 1 reply; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Zefan Li, Tejun Heo

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

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

From: Zefan Li <lizefan@huawei.com>

commit 06f4e94898918bcad00cdd4d349313a439d6911e upstream.

A new task inherits cpus_allowed and mems_allowed masks from its parent,
but if someone changes cpuset's config by writing to cpuset.cpus/cpuset.mems
before this new task is inserted into the cgroup's task list, the new task
won't be updated accordingly.

Signed-off-by: Zefan Li <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 kernel/cpuset.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -2074,6 +2074,20 @@ static void cpuset_bind(struct cgroup_su
 	mutex_unlock(&cpuset_mutex);
 }
 
+/*
+ * Make sure the new task conform to the current state of its parent,
+ * which could have been changed by cpuset just after it inherits the
+ * state from the parent and before it sits on the cgroup's task list.
+ */
+void cpuset_fork(struct task_struct *task)
+{
+	if (task_css_is_root(task, cpuset_cgrp_id))
+		return;
+
+	set_cpus_allowed_ptr(task, &current->cpus_allowed);
+	task->mems_allowed = current->mems_allowed;
+}
+
 struct cgroup_subsys cpuset_cgrp_subsys = {
 	.css_alloc	= cpuset_css_alloc,
 	.css_online	= cpuset_css_online,
@@ -2084,6 +2098,7 @@ struct cgroup_subsys cpuset_cgrp_subsys
 	.attach		= cpuset_attach,
 	.post_attach	= cpuset_post_attach,
 	.bind		= cpuset_bind,
+	.fork		= cpuset_fork,
 	.legacy_cftypes	= files,
 	.early_init	= 1,
 };

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

* [PATCH 4.4 049/118] ARM: AM43XX: hwmod: Fix RSTST register offset for pruss
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (44 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 048/118] cpuset: make sure new tasks conform to the current config of the cpuset Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 050/118] ARM: imx6: add missing BM_CLPCR_BYP_MMDC_CH0_LPM_HS setting for imx6ul Greg Kroah-Hartman
                     ` (70 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Keerthy, Tony Lindgren

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

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

From: Keerthy <j-keerthy@ti.com>

commit b00ccf5b684992829610d162e78a7836933a1b19 upstream.

pruss hwmod RSTST register wrongly points to PWRSTCTRL register in case of
am43xx. Fix the RSTST register offset value.

This can lead to setting of wrong power state values for PER domain.

Fixes: 1c7e224d ("ARM: OMAP2+: hwmod: AM335x: runtime register update")
Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c |    1 +
 arch/arm/mach-omap2/prcm43xx.h                          |    1 +
 2 files changed, 2 insertions(+)

--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
@@ -1474,6 +1474,7 @@ static void omap_hwmod_am43xx_rst(void)
 {
 	RSTCTRL(am33xx_pruss_hwmod, AM43XX_RM_PER_RSTCTRL_OFFSET);
 	RSTCTRL(am33xx_gfx_hwmod, AM43XX_RM_GFX_RSTCTRL_OFFSET);
+	RSTST(am33xx_pruss_hwmod, AM43XX_RM_PER_RSTST_OFFSET);
 	RSTST(am33xx_gfx_hwmod, AM43XX_RM_GFX_RSTST_OFFSET);
 }
 
--- a/arch/arm/mach-omap2/prcm43xx.h
+++ b/arch/arm/mach-omap2/prcm43xx.h
@@ -39,6 +39,7 @@
 
 /* RM RSTST offsets */
 #define AM43XX_RM_GFX_RSTST_OFFSET			0x0014
+#define AM43XX_RM_PER_RSTST_OFFSET			0x0014
 #define AM43XX_RM_WKUP_RSTST_OFFSET			0x0014
 
 /* CM instances */

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

* [PATCH 4.4 050/118] ARM: imx6: add missing BM_CLPCR_BYP_MMDC_CH0_LPM_HS setting for imx6ul
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (45 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 049/118] ARM: AM43XX: hwmod: Fix RSTST register offset for pruss Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 051/118] ARM: imx6: add missing BM_CLPCR_BYPASS_PMIC_READY setting for imx6sx Greg Kroah-Hartman
                     ` (69 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Peter Chen, Anson Huang, Shawn Guo

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

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

From: Peter Chen <peter.chen@nxp.com>

commit f5a49057c71433e35a4712ab8d8f00641b3e1ec0 upstream.

There is a missing BM_CLPCR_BYP_MMDC_CH0_LPM_HS setting for imx6ul,
without it, the "standby" mode can't work well, the system can't be
resumed.

With this commit, the "standby" mode works well.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Cc: Anson Huang <anson.huang@nxp.com>
Fixes: ee4a5f838c84 ("ARM: imx: add suspend/resume support for i.mx6ul")
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/mach-imx/pm-imx6.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/arm/mach-imx/pm-imx6.c
+++ b/arch/arm/mach-imx/pm-imx6.c
@@ -295,7 +295,7 @@ int imx6_set_lpm(enum mxc_cpu_pwr_mode m
 		val &= ~BM_CLPCR_SBYOS;
 		if (cpu_is_imx6sl())
 			val |= BM_CLPCR_BYPASS_PMIC_READY;
-		if (cpu_is_imx6sl() || cpu_is_imx6sx())
+		if (cpu_is_imx6sl() || cpu_is_imx6sx() || cpu_is_imx6ul())
 			val |= BM_CLPCR_BYP_MMDC_CH0_LPM_HS;
 		else
 			val |= BM_CLPCR_BYP_MMDC_CH1_LPM_HS;

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

* [PATCH 4.4 051/118] ARM: imx6: add missing BM_CLPCR_BYPASS_PMIC_READY setting for imx6sx
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (46 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 050/118] ARM: imx6: add missing BM_CLPCR_BYP_MMDC_CH0_LPM_HS setting for imx6ul Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 052/118] ARM: kirkwood: ib62x0: fix size of u-boot environment partition Greg Kroah-Hartman
                     ` (68 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Anson Huang, Peter Chen, Shawn Guo

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

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

From: Anson Huang <Anson.Huang@nxp.com>

commit 8aade778f787305fdbfd3c1d54e6b583601b5902 upstream.

i.MX6SX has bypass PMIC ready function, as this function
is normally NOT enabled on the board design, so we need
to bypass the PMIC ready pin check during DSM mode resume
flow, otherwise, the internal DSM resume logic will be
waiting for this signal to be ready forever and cause
resume fail.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Fixes: ff843d621bfc ("ARM: imx: add suspend support for i.mx6sx")
Tested-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/mach-imx/pm-imx6.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/arm/mach-imx/pm-imx6.c
+++ b/arch/arm/mach-imx/pm-imx6.c
@@ -310,7 +310,7 @@ int imx6_set_lpm(enum mxc_cpu_pwr_mode m
 		val |= 0x3 << BP_CLPCR_STBY_COUNT;
 		val |= BM_CLPCR_VSTBY;
 		val |= BM_CLPCR_SBYOS;
-		if (cpu_is_imx6sl())
+		if (cpu_is_imx6sl() || cpu_is_imx6sx())
 			val |= BM_CLPCR_BYPASS_PMIC_READY;
 		if (cpu_is_imx6sl() || cpu_is_imx6sx() || cpu_is_imx6ul())
 			val |= BM_CLPCR_BYP_MMDC_CH0_LPM_HS;

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

* [PATCH 4.4 052/118] ARM: kirkwood: ib62x0: fix size of u-boot environment partition
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (47 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 051/118] ARM: imx6: add missing BM_CLPCR_BYPASS_PMIC_READY setting for imx6sx Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 053/118] ARM: OMAP3: hwmod data: Add sysc information for DSI Greg Kroah-Hartman
                     ` (67 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Simon Baatz, Jason Cooper,
	Andrew Lunn, Gregory Clement, Sebastian Hesselbarth, Luka Perkov

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

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

From: Simon Baatz <gmbnomis@gmail.com>

commit a778937888867aac17a33887d1c429120790fbc2 upstream.

Commit 148c274ea644 ("ARM: kirkwood: ib62x0: add u-boot environment
partition") split the "u-boot" partition into "u-boot" and "u-boot
environment".  However, instead of the size of the environment, an offset
was given, resulting in overlapping partitions.

Signed-off-by: Simon Baatz <gmbnomis@gmail.com>
Fixes: 148c274ea644 ("ARM: kirkwood: ib62x0: add u-boot environment partition")
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Gregory Clement <gregory.clement@free-electrons.com>
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Luka Perkov <luka@openwrt.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/kirkwood-ib62x0.dts |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/arm/boot/dts/kirkwood-ib62x0.dts
+++ b/arch/arm/boot/dts/kirkwood-ib62x0.dts
@@ -113,7 +113,7 @@
 
 	partition@e0000 {
 		label = "u-boot environment";
-		reg = <0xe0000 0x100000>;
+		reg = <0xe0000 0x20000>;
 	};
 
 	partition@100000 {

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

* [PATCH 4.4 053/118] ARM: OMAP3: hwmod data: Add sysc information for DSI
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (48 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 052/118] ARM: kirkwood: ib62x0: fix size of u-boot environment partition Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 054/118] ARM: dts: imx6qdl: Fix SPDIF regression Greg Kroah-Hartman
                     ` (66 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Sebastian Reichel, Tony Lindgren

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

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

From: Sebastian Reichel <sre@kernel.org>

commit b46211d6dcfb81a8af66b8684a42d629183670d4 upstream.

Add missing sysconfig/sysstatus information
to OMAP3 hwmod. The information has been
checked against OMAP34xx and OMAP36xx TRM.

Without this change DSI block is not reset
during boot, which is required for working
Nokia N950 display.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -723,8 +723,20 @@ static struct omap_hwmod omap3xxx_dss_di
  * display serial interface controller
  */
 
+static struct omap_hwmod_class_sysconfig omap3xxx_dsi_sysc = {
+	.rev_offs	= 0x0000,
+	.sysc_offs	= 0x0010,
+	.syss_offs	= 0x0014,
+	.sysc_flags	= (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY |
+			   SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE |
+			   SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
+	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+	.sysc_fields	= &omap_hwmod_sysc_type1,
+};
+
 static struct omap_hwmod_class omap3xxx_dsi_hwmod_class = {
 	.name = "dsi",
+	.sysc	= &omap3xxx_dsi_sysc,
 };
 
 static struct omap_hwmod_irq_info omap3xxx_dsi1_irqs[] = {

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

* [PATCH 4.4 054/118] ARM: dts: imx6qdl: Fix SPDIF regression
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (49 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 053/118] ARM: OMAP3: hwmod data: Add sysc information for DSI Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 055/118] ARM: dts: overo: fix gpmc nand cs0 range Greg Kroah-Hartman
                     ` (65 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Xavi Drudis Ferran, Fabio Estevam, Shawn Guo

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

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

From: Fabio Estevam <fabio.estevam@nxp.com>

commit f065e9e4addd75c21bb976bb2558648bf4f61de6 upstream.

Commit 833f2cbf7091 ("ARM: dts: imx6: change the core clock of spdif")
changed many more clocks than only the SPDIF core clock as stated in
the commit message.

The MLB clock has been added and this causes SPDIF regression as
reported by Xavi Drudis Ferran and also in this forum post:
https://forum.digikey.com/thread/34240

The MX6Q Reference Manual does not mention that MLB is a clock related
to SPDIF, so change it back to a dummy clock to restore SPDIF
functionality.

Thanks to Ambika for providing the fix at:
https://community.nxp.com/thread/387131

Fixes: 833f2cbf7091 ("ARM: dts: imx6: change the core clock of spdif")
Reported-by: Xavi Drudis Ferran <xdrudis@tinet.cat>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Tested-by:  Xavi Drudis Ferran <xdrudis@tinet.cat>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/imx6qdl.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -221,7 +221,7 @@
 					clocks = <&clks IMX6QDL_CLK_SPDIF_GCLK>, <&clks IMX6QDL_CLK_OSC>,
 						 <&clks IMX6QDL_CLK_SPDIF>, <&clks IMX6QDL_CLK_ASRC>,
 						 <&clks IMX6QDL_CLK_DUMMY>, <&clks IMX6QDL_CLK_ESAI_EXTAL>,
-						 <&clks IMX6QDL_CLK_IPG>, <&clks IMX6QDL_CLK_MLB>,
+						 <&clks IMX6QDL_CLK_IPG>, <&clks IMX6QDL_CLK_DUMMY>,
 						 <&clks IMX6QDL_CLK_DUMMY>, <&clks IMX6QDL_CLK_SPBA>;
 					clock-names = "core",  "rxtx0",
 						      "rxtx1", "rxtx2",

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

* [PATCH 4.4 055/118] ARM: dts: overo: fix gpmc nand cs0 range
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (50 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 054/118] ARM: dts: imx6qdl: Fix SPDIF regression Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 056/118] ARM: dts: overo: fix gpmc nand on boards with ethernet Greg Kroah-Hartman
                     ` (64 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold, Tony Lindgren

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

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

From: Johan Hovold <johan@kernel.org>

commit 5e0568dfbfb8c13cdb69c9fd06d600593ad4b430 upstream.

The gpmc ranges property for NAND at CS0 has been broken since it was
first added.

This currently prevents the nand gpmc child node from being probed:

	omap-gpmc 6e000000.gpmc: /ocp/gpmc@6e000000/nand@0,0 has
	malformed 'reg' property

and consequently the NAND device from being registered.

Fixes: 98ce6007efb4 ("ARM: dts: overo: Support PoP NAND")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/omap3-overo-base.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/arm/boot/dts/omap3-overo-base.dtsi
+++ b/arch/arm/boot/dts/omap3-overo-base.dtsi
@@ -223,7 +223,7 @@
 };
 
 &gpmc {
-	ranges = <0 0 0x00000000 0x20000000>;
+	ranges = <0 0 0x30000000 0x1000000>;	/* CS0 */
 
 	nand@0,0 {
 		linux,mtd-name= "micron,mt29c4g96maz";

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

* [PATCH 4.4 056/118] ARM: dts: overo: fix gpmc nand on boards with ethernet
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (51 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 055/118] ARM: dts: overo: fix gpmc nand cs0 range Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 057/118] ARM: dts: STiH407-family: Provide interconnect clock for consumption in ST SDHCI Greg Kroah-Hartman
                     ` (63 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold, Tony Lindgren

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

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

From: Johan Hovold <johan@kernel.org>

commit 153b58ea932b2d0642fa5cd41c93bb0555f3f09b upstream.

The gpmc ranges property for NAND at CS0 was being overridden by later
includes that defined gpmc ethernet nodes, effectively breaking NAND on
these systems:

	omap-gpmc 6e000000.gpmc: /ocp/gpmc@6e000000/nand@0,0 has
	malformed 'reg' property

Instead of redefining the NAND range in every such dtsi, define all
currently used ranges in omap3-overo-base.dtsi.

Fixes: 98ce6007efb4 ("ARM: dts: overo: Support PoP NAND")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/omap3-overo-base.dtsi              |    4 +++-
 arch/arm/boot/dts/omap3-overo-chestnut43-common.dtsi |    2 --
 arch/arm/boot/dts/omap3-overo-tobi-common.dtsi       |    2 --
 arch/arm/boot/dts/omap3-overo-tobiduo-common.dtsi    |    3 ---
 4 files changed, 3 insertions(+), 8 deletions(-)

--- a/arch/arm/boot/dts/omap3-overo-base.dtsi
+++ b/arch/arm/boot/dts/omap3-overo-base.dtsi
@@ -223,7 +223,9 @@
 };
 
 &gpmc {
-	ranges = <0 0 0x30000000 0x1000000>;	/* CS0 */
+	ranges = <0 0 0x30000000 0x1000000>,	/* CS0 */
+		 <4 0 0x2b000000 0x1000000>,	/* CS4 */
+		 <5 0 0x2c000000 0x1000000>;	/* CS5 */
 
 	nand@0,0 {
 		linux,mtd-name= "micron,mt29c4g96maz";
--- a/arch/arm/boot/dts/omap3-overo-chestnut43-common.dtsi
+++ b/arch/arm/boot/dts/omap3-overo-chestnut43-common.dtsi
@@ -55,8 +55,6 @@
 #include "omap-gpmc-smsc9221.dtsi"
 
 &gpmc {
-	ranges = <5 0 0x2c000000 0x1000000>;	/* CS5 */
-
 	ethernet@gpmc {
 		reg = <5 0 0xff>;
 		interrupt-parent = <&gpio6>;
--- a/arch/arm/boot/dts/omap3-overo-tobi-common.dtsi
+++ b/arch/arm/boot/dts/omap3-overo-tobi-common.dtsi
@@ -27,8 +27,6 @@
 #include "omap-gpmc-smsc9221.dtsi"
 
 &gpmc {
-	ranges = <5 0 0x2c000000 0x1000000>;	/* CS5 */
-
 	ethernet@gpmc {
 		reg = <5 0 0xff>;
 		interrupt-parent = <&gpio6>;
--- a/arch/arm/boot/dts/omap3-overo-tobiduo-common.dtsi
+++ b/arch/arm/boot/dts/omap3-overo-tobiduo-common.dtsi
@@ -15,9 +15,6 @@
 #include "omap-gpmc-smsc9221.dtsi"
 
 &gpmc {
-	ranges = <4 0 0x2b000000 0x1000000>,	/* CS4 */
-		 <5 0 0x2c000000 0x1000000>;	/* CS5 */
-
 	smsc1: ethernet@gpmc {
 		reg = <5 0 0xff>;
 		interrupt-parent = <&gpio6>;

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

* [PATCH 4.4 057/118] ARM: dts: STiH407-family: Provide interconnect clock for consumption in ST SDHCI
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (52 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 056/118] ARM: dts: overo: fix gpmc nand on boards with ethernet Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 058/118] bus: arm-ccn: Fix PMU handling of MN Greg Kroah-Hartman
                     ` (62 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Peter Griffin, Lee Jones, Patrice Chotard

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

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

From: Lee Jones <lee.jones@linaro.org>

commit 78567f135d9bbbaf4538f63656d3e4d957c35fe9 upstream.

The STiH4{07,10} platform contains some interconnect clocks which are used
by various IPs.  If these clocks aren't handled correctly by ST's SDHCI
driver MMC will break and the following output can be observed:

[   13.916949] mmc0: Timeout waiting for hardware interrupt.
[   13.922349] sdhci: =========== REGISTER DUMP (mmc0)===========
[   13.928175] sdhci: Sys addr: 0x00000000 | Version:  0x00001002
[   13.933999] sdhci: Blk size: 0x00007040 | Blk cnt:  0x00000001
[   13.939825] sdhci: Argument: 0x00fffff0 | Trn mode: 0x00000013
[   13.945650] sdhci: Present:  0x1fff0206 | Host ctl: 0x00000011
[   13.951475] sdhci: Power:    0x0000000f | Blk gap:  0x00000080
[   13.957300] sdhci: Wake-up:  0x00000000 | Clock:    0x00003f07
[   13.963126] sdhci: Timeout:  0x00000004 | Int stat: 0x00000000
[   13.968952] sdhci: Int enab: 0x02ff008b | Sig enab: 0x02ff008b
[   13.974777] sdhci: AC12 err: 0x00000000 | Slot int: 0x00000000
[   13.980602] sdhci: Caps:     0x21ed3281 | Caps_1:   0x00000000
[   13.986428] sdhci: Cmd:      0x0000063a | Max curr: 0x00000000
[   13.992252] sdhci: Host ctl2: 0x00000000
[   13.996166] sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0x7c048200
[   14.001990] sdhci: ===========================================
[   14.009802] mmc0: Got data interrupt 0x02000000 even though no data operation was in progress.

Tested-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/stih407-family.dtsi |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

--- a/arch/arm/boot/dts/stih407-family.dtsi
+++ b/arch/arm/boot/dts/stih407-family.dtsi
@@ -497,8 +497,9 @@
 			interrupt-names = "mmcirq";
 			pinctrl-names = "default";
 			pinctrl-0 = <&pinctrl_mmc0>;
-			clock-names = "mmc";
-			clocks = <&clk_s_c0_flexgen CLK_MMC_0>;
+			clock-names = "mmc", "icn";
+			clocks = <&clk_s_c0_flexgen CLK_MMC_0>,
+				 <&clk_s_c0_flexgen CLK_RX_ICN_HVA>;
 			bus-width = <8>;
 			non-removable;
 		};
@@ -512,8 +513,9 @@
 			interrupt-names = "mmcirq";
 			pinctrl-names = "default";
 			pinctrl-0 = <&pinctrl_sd1>;
-			clock-names = "mmc";
-			clocks = <&clk_s_c0_flexgen CLK_MMC_1>;
+			clock-names = "mmc", "icn";
+			clocks = <&clk_s_c0_flexgen CLK_MMC_1>,
+				 <&clk_s_c0_flexgen CLK_RX_ICN_HVA>;
 			resets = <&softreset STIH407_MMC1_SOFTRESET>;
 			bus-width = <4>;
 		};

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

* [PATCH 4.4 058/118] bus: arm-ccn: Fix PMU handling of MN
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (53 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 057/118] ARM: dts: STiH407-family: Provide interconnect clock for consumption in ST SDHCI Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 059/118] bus: arm-ccn: Do not attempt to configure XPs for cycle counter Greg Kroah-Hartman
                     ` (61 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Pawel Moll

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

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

From: Pawel Moll <pawel.moll@arm.com>

commit 4e486cba285ff06a1f28f0fc2991dde1482d1dcf upstream.

The "Miscellaneous Node" fell through cracks of node initialisation,
as its ID is shared with HN-I.

This patch treats MN as a special case (which it is), adding separate
validation check for it and pre-defining the node ID in relevant events
descriptions. That way one can simply run:

	# perf stat -a -e ccn/mn_ecbarrier/ <workload>

Additionally, direction in the MN pseudo-events XP watchpoint
definitions is corrected to be "TX" (1) as they are defined from the
crosspoint point of view (thus barriers are transmitted from XP to MN).

Signed-off-by: Pawel Moll <pawel.moll@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/bus/arm-ccn.c |   19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

--- a/drivers/bus/arm-ccn.c
+++ b/drivers/bus/arm-ccn.c
@@ -187,6 +187,7 @@ struct arm_ccn {
 	struct arm_ccn_component *xp;
 
 	struct arm_ccn_dt dt;
+	int mn_id;
 };
 
 
@@ -326,6 +327,7 @@ struct arm_ccn_pmu_event {
 static ssize_t arm_ccn_pmu_event_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
+	struct arm_ccn *ccn = pmu_to_arm_ccn(dev_get_drvdata(dev));
 	struct arm_ccn_pmu_event *event = container_of(attr,
 			struct arm_ccn_pmu_event, attr);
 	ssize_t res;
@@ -352,6 +354,9 @@ static ssize_t arm_ccn_pmu_event_show(st
 			res += snprintf(buf + res, PAGE_SIZE - res,
 					",cmp_l=?,cmp_h=?,mask=?");
 		break;
+	case CCN_TYPE_MN:
+		res += snprintf(buf + res, PAGE_SIZE - res, ",node=%d", ccn->mn_id);
+		break;
 	default:
 		res += snprintf(buf + res, PAGE_SIZE - res, ",node=?");
 		break;
@@ -381,9 +386,9 @@ static umode_t arm_ccn_pmu_events_is_vis
 }
 
 static struct arm_ccn_pmu_event arm_ccn_pmu_events[] = {
-	CCN_EVENT_MN(eobarrier, "dir=0,vc=0,cmp_h=0x1c00", CCN_IDX_MASK_OPCODE),
-	CCN_EVENT_MN(ecbarrier, "dir=0,vc=0,cmp_h=0x1e00", CCN_IDX_MASK_OPCODE),
-	CCN_EVENT_MN(dvmop, "dir=0,vc=0,cmp_h=0x2800", CCN_IDX_MASK_OPCODE),
+	CCN_EVENT_MN(eobarrier, "dir=1,vc=0,cmp_h=0x1c00", CCN_IDX_MASK_OPCODE),
+	CCN_EVENT_MN(ecbarrier, "dir=1,vc=0,cmp_h=0x1e00", CCN_IDX_MASK_OPCODE),
+	CCN_EVENT_MN(dvmop, "dir=1,vc=0,cmp_h=0x2800", CCN_IDX_MASK_OPCODE),
 	CCN_EVENT_HNI(txdatflits, "dir=1,vc=3", CCN_IDX_MASK_ANY),
 	CCN_EVENT_HNI(rxdatflits, "dir=0,vc=3", CCN_IDX_MASK_ANY),
 	CCN_EVENT_HNI(txreqflits, "dir=1,vc=0", CCN_IDX_MASK_ANY),
@@ -757,6 +762,12 @@ static int arm_ccn_pmu_event_init(struct
 
 	/* Validate node/xp vs topology */
 	switch (type) {
+	case CCN_TYPE_MN:
+		if (node_xp != ccn->mn_id) {
+			dev_warn(ccn->dev, "Invalid MN ID %d!\n", node_xp);
+			return -EINVAL;
+		}
+		break;
 	case CCN_TYPE_XP:
 		if (node_xp >= ccn->num_xps) {
 			dev_warn(ccn->dev, "Invalid XP ID %d!\n", node_xp);
@@ -1368,6 +1379,8 @@ static int arm_ccn_init_nodes(struct arm
 
 	switch (type) {
 	case CCN_TYPE_MN:
+		ccn->mn_id = id;
+		return 0;
 	case CCN_TYPE_DT:
 		return 0;
 	case CCN_TYPE_XP:

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

* [PATCH 4.4 059/118] bus: arm-ccn: Do not attempt to configure XPs for cycle counter
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (54 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 058/118] bus: arm-ccn: Fix PMU handling of MN Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 060/118] bus: arm-ccn: Fix XP watchpoint settings bitmask Greg Kroah-Hartman
                     ` (60 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Mark Rutland, Pawel Moll

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

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

From: Pawel Moll <pawel.moll@arm.com>

commit b7c1beb278e8e3dc664ed3df3fc786db126120a9 upstream.

Fuzzing the CCN perf driver revealed a small but definitely dangerous
mistake in the event setup code. When a cycle counter is requested, the
driver should not reconfigure the events bus at all, otherwise it will
corrupt (in most but the simplest cases) its configuration and may end
up accessing XP array out of its bounds and corrupting control
registers.

Reported-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Tested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Pawel Moll <pawel.moll@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/bus/arm-ccn.c |    4 ++++
 1 file changed, 4 insertions(+)

--- a/drivers/bus/arm-ccn.c
+++ b/drivers/bus/arm-ccn.c
@@ -895,6 +895,10 @@ static void arm_ccn_pmu_xp_dt_config(str
 	struct arm_ccn_component *xp;
 	u32 val, dt_cfg;
 
+	/* Nothing to do for cycle counter */
+	if (hw->idx == CCN_IDX_PMU_CYCLE_COUNTER)
+		return;
+
 	if (CCN_CONFIG_TYPE(event->attr.config) == CCN_TYPE_XP)
 		xp = &ccn->xp[CCN_CONFIG_XP(event->attr.config)];
 	else

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

* [PATCH 4.4 060/118] bus: arm-ccn: Fix XP watchpoint settings bitmask
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (55 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 059/118] bus: arm-ccn: Do not attempt to configure XPs for cycle counter Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 061/118] dm log writes: fix check of kthread_run() return value Greg Kroah-Hartman
                     ` (59 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Pawel Moll

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

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

From: Pawel Moll <pawel.moll@arm.com>

commit b928466b2169e061822daad48ecf55b005445547 upstream.

The code setting XP watchpoint comparator and mask registers should, in
order to be fully compliant with specification, zero one or more most
significant bits of each field. In both L cases it means zeroing bit 63.
The bitmask doing this was wrong, though, zeroing bit 60 instead.
Fortunately, due to a lucky coincidence, this turned out to be fairly
innocent with the existing hardware.

Fixed now.

Signed-off-by: Pawel Moll <pawel.moll@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/bus/arm-ccn.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/bus/arm-ccn.c
+++ b/drivers/bus/arm-ccn.c
@@ -1001,7 +1001,7 @@ static void arm_ccn_pmu_xp_watchpoint_co
 
 	/* Comparison values */
 	writel(cmp_l & 0xffffffff, source->base + CCN_XP_DT_CMP_VAL_L(wp));
-	writel((cmp_l >> 32) & 0xefffffff,
+	writel((cmp_l >> 32) & 0x7fffffff,
 			source->base + CCN_XP_DT_CMP_VAL_L(wp) + 4);
 	writel(cmp_h & 0xffffffff, source->base + CCN_XP_DT_CMP_VAL_H(wp));
 	writel((cmp_h >> 32) & 0x0fffffff,
@@ -1009,7 +1009,7 @@ static void arm_ccn_pmu_xp_watchpoint_co
 
 	/* Mask */
 	writel(mask_l & 0xffffffff, source->base + CCN_XP_DT_CMP_MASK_L(wp));
-	writel((mask_l >> 32) & 0xefffffff,
+	writel((mask_l >> 32) & 0x7fffffff,
 			source->base + CCN_XP_DT_CMP_MASK_L(wp) + 4);
 	writel(mask_h & 0xffffffff, source->base + CCN_XP_DT_CMP_MASK_H(wp));
 	writel((mask_h >> 32) & 0x0fffffff,

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

* [PATCH 4.4 061/118] dm log writes: fix check of kthread_run() return value
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (56 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 060/118] bus: arm-ccn: Fix XP watchpoint settings bitmask Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 062/118] dm log writes: move IO accounting earlier to fix error path Greg Kroah-Hartman
                     ` (58 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Vladimir Zapolskiy, Mike Snitzer

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

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

From: Vladimir Zapolskiy <vz@mleia.com>

commit 91e630d9ae6de6f740ef7c8176736eb55366833e upstream.

The kthread_run() function returns either a valid task_struct or
ERR_PTR() value, check for NULL is invalid.  This change fixes potential
for oops, e.g. in OOM situation.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/md/dm-log-writes.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/md/dm-log-writes.c
+++ b/drivers/md/dm-log-writes.c
@@ -456,9 +456,9 @@ static int log_writes_ctr(struct dm_targ
 		goto bad;
 	}
 
-	ret = -EINVAL;
 	lc->log_kthread = kthread_run(log_writes_kthread, lc, "log-write");
-	if (!lc->log_kthread) {
+	if (IS_ERR(lc->log_kthread)) {
+		ret = PTR_ERR(lc->log_kthread);
 		ti->error = "Couldn't alloc kthread";
 		dm_put_device(ti, lc->dev);
 		dm_put_device(ti, lc->logdev);

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

* [PATCH 4.4 062/118] dm log writes: move IO accounting earlier to fix error path
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (57 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 061/118] dm log writes: fix check of kthread_run() return value Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 063/118] dm crypt: fix error with too large bios Greg Kroah-Hartman
                     ` (57 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Mikulas Patocka, Josef Bacik, Mike Snitzer

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

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

From: Mikulas Patocka <mpatocka@redhat.com>

commit a5d60783df61fbb67b7596b8a0f6b4b2e05251d5 upstream.

Move log_one_block()'s atomic_inc(&lc->io_blocks) before bio_alloc() to
fix a bug that the target hangs if bio_alloc() fails.  The error path
does put_io_block(lc), so atomic_inc(&lc->io_blocks) must occur before
invoking the error path to avoid underflow of lc->io_blocks.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/md/dm-log-writes.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/md/dm-log-writes.c
+++ b/drivers/md/dm-log-writes.c
@@ -258,12 +258,12 @@ static int log_one_block(struct log_writ
 		goto out;
 	sector++;
 
+	atomic_inc(&lc->io_blocks);
 	bio = bio_alloc(GFP_KERNEL, block->vec_cnt);
 	if (!bio) {
 		DMERR("Couldn't alloc log bio");
 		goto error;
 	}
-	atomic_inc(&lc->io_blocks);
 	bio->bi_iter.bi_size = 0;
 	bio->bi_iter.bi_sector = sector;
 	bio->bi_bdev = lc->logdev->bdev;

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

* [PATCH 4.4 063/118] dm crypt: fix error with too large bios
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (58 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 062/118] dm log writes: move IO accounting earlier to fix error path Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 064/118] pinctrl: pistachio: fix mfio pll_lock pinmux Greg Kroah-Hartman
                     ` (56 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Mikulas Patocka, Mike Snitzer

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

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

From: Mikulas Patocka <mpatocka@redhat.com>

commit 4e870e948fbabf62b78e8410f04c67703e7c816b upstream.

When dm-crypt processes writes, it allocates a new bio in
crypt_alloc_buffer().  The bio is allocated from a bio set and it can
have at most BIO_MAX_PAGES vector entries, however the incoming bio can be
larger (e.g. if it was allocated by bcache).  If the incoming bio is
larger, bio_alloc_bioset() fails and an error is returned.

To avoid the error, we test for a too large bio in the function
crypt_map() and use dm_accept_partial_bio() to split the bio.
dm_accept_partial_bio() trims the current bio to the desired size and
asks DM core to send another bio with the rest of the data.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/md/dm-crypt.c |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -1920,6 +1920,13 @@ static int crypt_map(struct dm_target *t
 		return DM_MAPIO_REMAPPED;
 	}
 
+	/*
+	 * Check if bio is too large, split as needed.
+	 */
+	if (unlikely(bio->bi_iter.bi_size > (BIO_MAX_PAGES << PAGE_SHIFT)) &&
+	    bio_data_dir(bio) == WRITE)
+		dm_accept_partial_bio(bio, ((BIO_MAX_PAGES << PAGE_SHIFT) >> SECTOR_SHIFT));
+
 	io = dm_per_bio_data(bio, cc->per_bio_data_size);
 	crypt_io_init(io, cc, bio, dm_target_offset(ti, bio->bi_iter.bi_sector));
 	io->ctx.req = (struct ablkcipher_request *)(io + 1);

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

* [PATCH 4.4 064/118] pinctrl: pistachio: fix mfio pll_lock pinmux
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (59 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 063/118] dm crypt: fix error with too large bios Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 065/118] pinctrl: sunxi: fix uart1 CTS/RTS pins at PG on A23/A33 Greg Kroah-Hartman
                     ` (55 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, James Hartley, Sifan Naeem, Linus Walleij

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

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

From: James Hartley <james.hartley@imgtec.com>

commit a32ac2912f97d7ea9b67eb67bb4aa30b9156a88e upstream.

A previous patch attempted to fix the pinmuxes for mfio 84 - 89, but it
omitted a change to pistachio_pin_group pistachio_groups, which results
in incorrect pll_lock signals being routed.

Apply the correct mux settings throughout the driver.

fixes: cefc03e5995e ("pinctrl: Add Pistachio SoC pin control driver")
fixes: e9adb336d0bf ("pinctrl: pistachio: fix mfio84-89 function description and pinmux.")
Signed-off-by: James Hartley <james.hartley@imgtec.com>
Reviewed-by: Sifan Naeem <Sifan.Naeem@imgtec.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/pinctrl/pinctrl-pistachio.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- a/drivers/pinctrl/pinctrl-pistachio.c
+++ b/drivers/pinctrl/pinctrl-pistachio.c
@@ -809,17 +809,17 @@ static const struct pistachio_pin_group
 			   PADS_FUNCTION_SELECT2, 12, 0x3),
 	MFIO_MUX_PIN_GROUP(83, MIPS_PLL_LOCK, MIPS_TRACE_DATA, USB_DEBUG,
 			   PADS_FUNCTION_SELECT2, 14, 0x3),
-	MFIO_MUX_PIN_GROUP(84, SYS_PLL_LOCK, MIPS_TRACE_DATA, USB_DEBUG,
+	MFIO_MUX_PIN_GROUP(84, AUDIO_PLL_LOCK, MIPS_TRACE_DATA, USB_DEBUG,
 			   PADS_FUNCTION_SELECT2, 16, 0x3),
-	MFIO_MUX_PIN_GROUP(85, WIFI_PLL_LOCK, MIPS_TRACE_DATA, SDHOST_DEBUG,
+	MFIO_MUX_PIN_GROUP(85, RPU_V_PLL_LOCK, MIPS_TRACE_DATA, SDHOST_DEBUG,
 			   PADS_FUNCTION_SELECT2, 18, 0x3),
-	MFIO_MUX_PIN_GROUP(86, BT_PLL_LOCK, MIPS_TRACE_DATA, SDHOST_DEBUG,
+	MFIO_MUX_PIN_GROUP(86, RPU_L_PLL_LOCK, MIPS_TRACE_DATA, SDHOST_DEBUG,
 			   PADS_FUNCTION_SELECT2, 20, 0x3),
-	MFIO_MUX_PIN_GROUP(87, RPU_V_PLL_LOCK, DREQ2, SOCIF_DEBUG,
+	MFIO_MUX_PIN_GROUP(87, SYS_PLL_LOCK, DREQ2, SOCIF_DEBUG,
 			   PADS_FUNCTION_SELECT2, 22, 0x3),
-	MFIO_MUX_PIN_GROUP(88, RPU_L_PLL_LOCK, DREQ3, SOCIF_DEBUG,
+	MFIO_MUX_PIN_GROUP(88, WIFI_PLL_LOCK, DREQ3, SOCIF_DEBUG,
 			   PADS_FUNCTION_SELECT2, 24, 0x3),
-	MFIO_MUX_PIN_GROUP(89, AUDIO_PLL_LOCK, DREQ4, DREQ5,
+	MFIO_MUX_PIN_GROUP(89, BT_PLL_LOCK, DREQ4, DREQ5,
 			   PADS_FUNCTION_SELECT2, 26, 0x3),
 	PIN_GROUP(TCK, "tck"),
 	PIN_GROUP(TRSTN, "trstn"),

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

* [PATCH 4.4 065/118] pinctrl: sunxi: fix uart1 CTS/RTS pins at PG on A23/A33
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (60 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 064/118] pinctrl: pistachio: fix mfio pll_lock pinmux Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 066/118] arm64: spinlocks: implement smp_mb__before_spinlock() as smp_mb() Greg Kroah-Hartman
                     ` (54 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Icenowy Zheng, Maxime Ripard, Linus Walleij

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

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

From: Icenowy Zheng <icenowy@aosc.xyz>

commit 486095fae3a8a6b1ae07c51844699d9bd5cfbebc upstream.

PG8, PG9 is said to be the CTS/RTS pins for UART1 according to the A23/33
datasheets. However, the function is wrongly named "uart2" in the pinctrl
driver. This patch fixes this by modifying them to be named "uart1".

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c |    4 ++--
 drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

--- a/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c
@@ -485,12 +485,12 @@ static const struct sunxi_desc_pin sun8i
 	SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 8),
 		  SUNXI_FUNCTION(0x0, "gpio_in"),
 		  SUNXI_FUNCTION(0x1, "gpio_out"),
-		  SUNXI_FUNCTION(0x2, "uart2"),		/* RTS */
+		  SUNXI_FUNCTION(0x2, "uart1"),		/* RTS */
 		  SUNXI_FUNCTION_IRQ_BANK(0x4, 2, 8)),	/* PG_EINT8 */
 	SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 9),
 		  SUNXI_FUNCTION(0x0, "gpio_in"),
 		  SUNXI_FUNCTION(0x1, "gpio_out"),
-		  SUNXI_FUNCTION(0x2, "uart2"),		/* CTS */
+		  SUNXI_FUNCTION(0x2, "uart1"),		/* CTS */
 		  SUNXI_FUNCTION_IRQ_BANK(0x4, 2, 9)),	/* PG_EINT9 */
 	SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 10),
 		  SUNXI_FUNCTION(0x0, "gpio_in"),
--- a/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c
@@ -407,12 +407,12 @@ static const struct sunxi_desc_pin sun8i
 	SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 8),
 		  SUNXI_FUNCTION(0x0, "gpio_in"),
 		  SUNXI_FUNCTION(0x1, "gpio_out"),
-		  SUNXI_FUNCTION(0x2, "uart2"),		/* RTS */
+		  SUNXI_FUNCTION(0x2, "uart1"),		/* RTS */
 		  SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 8)),	/* PG_EINT8 */
 	SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 9),
 		  SUNXI_FUNCTION(0x0, "gpio_in"),
 		  SUNXI_FUNCTION(0x1, "gpio_out"),
-		  SUNXI_FUNCTION(0x2, "uart2"),		/* CTS */
+		  SUNXI_FUNCTION(0x2, "uart1"),		/* CTS */
 		  SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 9)),	/* PG_EINT9 */
 	SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 10),
 		  SUNXI_FUNCTION(0x0, "gpio_in"),

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

* [PATCH 4.4 066/118] arm64: spinlocks: implement smp_mb__before_spinlock() as smp_mb()
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (61 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 065/118] pinctrl: sunxi: fix uart1 CTS/RTS pins at PG on A23/A33 Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 067/118] crypto: cryptd - initialize child shash_desc on import Greg Kroah-Hartman
                     ` (53 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Peter Zijlstra, Alan Stern,
	Will Deacon, Catalin Marinas

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

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

From: Will Deacon <will.deacon@arm.com>

commit 872c63fbf9e153146b07f0cece4da0d70b283eeb upstream.

smp_mb__before_spinlock() is intended to upgrade a spin_lock() operation
to a full barrier, such that prior stores are ordered with respect to
loads and stores occuring inside the critical section.

Unfortunately, the core code defines the barrier as smp_wmb(), which
is insufficient to provide the required ordering guarantees when used in
conjunction with our load-acquire-based spinlock implementation.

This patch overrides the arm64 definition of smp_mb__before_spinlock()
to map to a full smp_mb().

Cc: Peter Zijlstra <peterz@infradead.org>
Reported-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-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/asm/spinlock.h |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/arch/arm64/include/asm/spinlock.h
+++ b/arch/arm64/include/asm/spinlock.h
@@ -312,4 +312,14 @@ static inline int arch_read_trylock(arch
 #define arch_read_relax(lock)	cpu_relax()
 #define arch_write_relax(lock)	cpu_relax()
 
+/*
+ * Accesses appearing in program order before a spin_lock() operation
+ * can be reordered with accesses inside the critical section, by virtue
+ * of arch_spin_lock being constructed using acquire semantics.
+ *
+ * In cases where this is problematic (e.g. try_to_wake_up), an
+ * smp_mb__before_spinlock() can restore the required ordering.
+ */
+#define smp_mb__before_spinlock()	smp_mb()
+
 #endif /* __ASM_SPINLOCK_H */

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

* [PATCH 4.4 067/118] crypto: cryptd - initialize child shash_desc on import
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (62 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 066/118] arm64: spinlocks: implement smp_mb__before_spinlock() as smp_mb() Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 068/118] Btrfs: remove root_log_ctx from ctx list before btrfs_sync_log returns Greg Kroah-Hartman
                     ` (52 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ard Biesheuvel, Herbert Xu

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

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

From: Ard Biesheuvel <ard.biesheuvel@linaro.org>

commit 0bd2223594a4dcddc1e34b15774a3a4776f7749e upstream.

When calling .import() on a cryptd ahash_request, the structure members
that describe the child transform in the shash_desc need to be initialized
like they are when calling .init()

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 crypto/cryptd.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

--- a/crypto/cryptd.c
+++ b/crypto/cryptd.c
@@ -594,9 +594,14 @@ static int cryptd_hash_export(struct aha
 
 static int cryptd_hash_import(struct ahash_request *req, const void *in)
 {
-	struct cryptd_hash_request_ctx *rctx = ahash_request_ctx(req);
+	struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
+	struct cryptd_hash_ctx *ctx = crypto_ahash_ctx(tfm);
+	struct shash_desc *desc = cryptd_shash_desc(req);
 
-	return crypto_shash_import(&rctx->desc, in);
+	desc->tfm = ctx->child;
+	desc->flags = req->base.flags;
+
+	return crypto_shash_import(desc, in);
 }
 
 static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb,

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

* [PATCH 4.4 068/118] Btrfs: remove root_log_ctx from ctx list before btrfs_sync_log returns
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (63 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 067/118] crypto: cryptd - initialize child shash_desc on import Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 069/118] fuse: direct-io: dont dirty ITER_BVEC pages Greg Kroah-Hartman
                     ` (51 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Chris Mason

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

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

From: Chris Mason <clm@fb.com>

commit cbd60aa7cd17d81a434234268c55192862147439 upstream.

We use a btrfs_log_ctx structure to pass information into the
tree log commit, and get error values out.  It gets added to a per
log-transaction list which we walk when things go bad.

Commit d1433debe added an optimization to skip waiting for the log
commit, but didn't take root_log_ctx out of the list.  This
patch makes sure we remove things before exiting.

Signed-off-by: Chris Mason <clm@fb.com>
Fixes: d1433debe7f4346cf9fc0dafc71c3137d2a97bc4
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/btrfs/tree-log.c |    1 +
 1 file changed, 1 insertion(+)

--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -2850,6 +2850,7 @@ int btrfs_sync_log(struct btrfs_trans_ha
 
 	if (log_root_tree->log_transid_committed >= root_log_ctx.log_transid) {
 		blk_finish_plug(&plug);
+		list_del_init(&root_log_ctx.list);
 		mutex_unlock(&log_root_tree->log_mutex);
 		ret = root_log_ctx.log_ret;
 		goto out;

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

* [PATCH 4.4 069/118] fuse: direct-io: dont dirty ITER_BVEC pages
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (64 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 068/118] Btrfs: remove root_log_ctx from ctx list before btrfs_sync_log returns Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 070/118] xhci: fix null pointer dereference in stop command timeout function Greg Kroah-Hartman
                     ` (50 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Sheng Yang, Miklos Szeredi, Ashish Samant

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

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

From: Miklos Szeredi <mszeredi@redhat.com>

commit 8fba54aebbdf1f999738121922e74bf796ad60ee upstream.

When reading from a loop device backed by a fuse file it deadlocks on
lock_page().

This is because the page is already locked by the read() operation done on
the loop device.  In this case we don't want to either lock the page or
dirty it.

So do what fs/direct-io.c does: only dirty the page for ITER_IOVEC vectors.

Reported-by: Sheng Yang <sheng@yasker.org>
Fixes: aa4d86163e4e ("block: loop: switch to VFS ITER_BVEC")
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Reviewed-by: Sheng Yang <sheng@yasker.org>
Reviewed-by: Ashish Samant <ashish.samant@oracle.com>
Tested-by: Sheng Yang <sheng@yasker.org>
Tested-by: Ashish Samant <ashish.samant@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/fuse/file.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -540,13 +540,13 @@ void fuse_read_fill(struct fuse_req *req
 	req->out.args[0].size = count;
 }
 
-static void fuse_release_user_pages(struct fuse_req *req, int write)
+static void fuse_release_user_pages(struct fuse_req *req, bool should_dirty)
 {
 	unsigned i;
 
 	for (i = 0; i < req->num_pages; i++) {
 		struct page *page = req->pages[i];
-		if (write)
+		if (should_dirty)
 			set_page_dirty_lock(page);
 		put_page(page);
 	}
@@ -1331,6 +1331,7 @@ ssize_t fuse_direct_io(struct fuse_io_pr
 		       loff_t *ppos, int flags)
 {
 	int write = flags & FUSE_DIO_WRITE;
+	bool should_dirty = !write && iter_is_iovec(iter);
 	int cuse = flags & FUSE_DIO_CUSE;
 	struct file *file = io->file;
 	struct inode *inode = file->f_mapping->host;
@@ -1375,7 +1376,7 @@ ssize_t fuse_direct_io(struct fuse_io_pr
 			nres = fuse_send_read(req, io, pos, nbytes, owner);
 
 		if (!io->async)
-			fuse_release_user_pages(req, !write);
+			fuse_release_user_pages(req, should_dirty);
 		if (req->out.h.error) {
 			if (!res)
 				res = req->out.h.error;

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

* [PATCH 4.4 070/118] xhci: fix null pointer dereference in stop command timeout function
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (65 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 069/118] fuse: direct-io: dont dirty ITER_BVEC pages Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 071/118] md-cluster: make md-cluster also can work when compiled into kernel Greg Kroah-Hartman
                     ` (49 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Mathias Nyman

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

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

From: Mathias Nyman <mathias.nyman@linux.intel.com>

commit bcf42aa60c2832510b9be0f30c090bfd35bb172d upstream.

The stop endpoint command has its own 5 second timeout timer.
If the timeout function is triggered between USB3 and USB2 host
removal it will try to call usb_hc_died(xhci_to_hcd(xhci)->primary_hcd)

the ->primary_hcd will be set to NULL at USB3 hcd removal.

Fix this by first checking if the PCI host is being removed, and
also by using only xhci_to_hcd() as it will always return the primary
hcd.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/host/xhci-ring.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -846,6 +846,10 @@ void xhci_stop_endpoint_command_watchdog
 	spin_lock_irqsave(&xhci->lock, flags);
 
 	ep->stop_cmds_pending--;
+	if (xhci->xhc_state & XHCI_STATE_REMOVING) {
+		spin_unlock_irqrestore(&xhci->lock, flags);
+		return;
+	}
 	if (xhci->xhc_state & XHCI_STATE_DYING) {
 		xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb,
 				"Stop EP timer ran, but another timer marked "
@@ -899,7 +903,7 @@ void xhci_stop_endpoint_command_watchdog
 	spin_unlock_irqrestore(&xhci->lock, flags);
 	xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb,
 			"Calling usb_hc_died()");
-	usb_hc_died(xhci_to_hcd(xhci)->primary_hcd);
+	usb_hc_died(xhci_to_hcd(xhci));
 	xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb,
 			"xHCI host controller is dead.");
 }

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

* [PATCH 4.4 071/118] md-cluster: make md-cluster also can work when compiled into kernel
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (66 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 070/118] xhci: fix null pointer dereference in stop command timeout function Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 072/118] ath9k: fix using sta->drv_priv before initializing it Greg Kroah-Hartman
                     ` (48 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Marc Smith, NeilBrown, Guoqing Jiang,
	Shaohua Li

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

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

From: Guoqing Jiang <gqjiang@suse.com>

commit 47a7b0d8888c04c9746812820b6e60553cc77bbc upstream.

The md-cluster is compiled as module by default,
if it is compiled by built-in way, then we can't
make md-cluster works.

[64782.630008] md/raid1:md127: active with 2 out of 2 mirrors
[64782.630528] md-cluster module not found.
[64782.630530] md127: Could not setup cluster service (-2)

Fixes: edb39c9 ("Introduce md_cluster_operations to handle cluster functions")
Reported-by: Marc Smith <marc.smith@mcc.edu>
Reviewed-by: NeilBrown <neilb@suse.com>
Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/md/md.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -7572,16 +7572,12 @@ EXPORT_SYMBOL(unregister_md_cluster_oper
 
 int md_setup_cluster(struct mddev *mddev, int nodes)
 {
-	int err;
-
-	err = request_module("md-cluster");
-	if (err) {
-		pr_err("md-cluster module not found.\n");
-		return -ENOENT;
-	}
-
+	if (!md_cluster_ops)
+		request_module("md-cluster");
 	spin_lock(&pers_lock);
+	/* ensure module won't be unloaded */
 	if (!md_cluster_ops || !try_module_get(md_cluster_mod)) {
+		pr_err("can't find md-cluster module or get it's reference.\n");
 		spin_unlock(&pers_lock);
 		return -ENOENT;
 	}

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

* [PATCH 4.4 072/118] ath9k: fix using sta->drv_priv before initializing it
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (67 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 071/118] md-cluster: make md-cluster also can work when compiled into kernel Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 073/118] Revert "wext: Fix 32 bit iwpriv compatibility issue with 64 bit Kernel" Greg Kroah-Hartman
                     ` (47 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Felix Fietkau, Kalle Valo

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

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

From: Felix Fietkau <nbd@nbd.name>

commit 7711aaf08ad3fc4d0e937eec1de0a63620444ce7 upstream.

A station pointer can be passed to the driver on tx, before it has been
marked as associated. Since ath9k_sta_state was initializing the entry
too late, it resulted in some spurious crashes.

Fixes: df3c6eb34da5 ("ath9k: Use sta_state() callback")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/wireless/ath/ath9k/main.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1550,13 +1550,13 @@ static int ath9k_sta_state(struct ieee80
 	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	int ret = 0;
 
-	if (old_state == IEEE80211_STA_AUTH &&
-	    new_state == IEEE80211_STA_ASSOC) {
+	if (old_state == IEEE80211_STA_NOTEXIST &&
+	    new_state == IEEE80211_STA_NONE) {
 		ret = ath9k_sta_add(hw, vif, sta);
 		ath_dbg(common, CONFIG,
 			"Add station: %pM\n", sta->addr);
-	} else if (old_state == IEEE80211_STA_ASSOC &&
-		   new_state == IEEE80211_STA_AUTH) {
+	} else if (old_state == IEEE80211_STA_NONE &&
+		   new_state == IEEE80211_STA_NOTEXIST) {
 		ret = ath9k_sta_remove(hw, vif, sta);
 		ath_dbg(common, CONFIG,
 			"Remove station: %pM\n", sta->addr);

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

* [PATCH 4.4 073/118] Revert "wext: Fix 32 bit iwpriv compatibility issue with 64 bit Kernel"
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (68 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 072/118] ath9k: fix using sta->drv_priv before initializing it Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 074/118] sched/core: Fix a race between try_to_wake_up() and a woken up task Greg Kroah-Hartman
                     ` (46 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ben Hutchings, Johannes Berg

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

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

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

commit 4d0bd46a4d55383f7b925e6cf7865a77e0f0e020 upstream.

This reverts commit 3d5fdff46c4b2b9534fa2f9fc78e90a48e0ff724.

Ben Hutchings pointed out that the commit isn't safe since it assumes
that the structure used by the driver is iw_point, when in fact there's
no way to know about that.

Fortunately, the only driver in the tree that ever runs this code path
is the wilc1000 staging driver, so it doesn't really matter.

Clearly I should have investigated this better before applying, sorry.

Reported-by: Ben Hutchings <ben@decadent.org.uk>
Fixes: 3d5fdff46c4b ("wext: Fix 32 bit iwpriv compatibility issue with 64 bit Kernel")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/wireless/wext-core.c |   25 ++-----------------------
 1 file changed, 2 insertions(+), 23 deletions(-)

--- a/net/wireless/wext-core.c
+++ b/net/wireless/wext-core.c
@@ -955,29 +955,8 @@ static int wireless_process_ioctl(struct
 			return private(dev, iwr, cmd, info, handler);
 	}
 	/* Old driver API : call driver ioctl handler */
-	if (dev->netdev_ops->ndo_do_ioctl) {
-#ifdef CONFIG_COMPAT
-		if (info->flags & IW_REQUEST_FLAG_COMPAT) {
-			int ret = 0;
-			struct iwreq iwr_lcl;
-			struct compat_iw_point *iwp_compat = (void *) &iwr->u.data;
-
-			memcpy(&iwr_lcl, iwr, sizeof(struct iwreq));
-			iwr_lcl.u.data.pointer = compat_ptr(iwp_compat->pointer);
-			iwr_lcl.u.data.length = iwp_compat->length;
-			iwr_lcl.u.data.flags = iwp_compat->flags;
-
-			ret = dev->netdev_ops->ndo_do_ioctl(dev, (void *) &iwr_lcl, cmd);
-
-			iwp_compat->pointer = ptr_to_compat(iwr_lcl.u.data.pointer);
-			iwp_compat->length = iwr_lcl.u.data.length;
-			iwp_compat->flags = iwr_lcl.u.data.flags;
-
-			return ret;
-		} else
-#endif
-			return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd);
-	}
+	if (dev->netdev_ops->ndo_do_ioctl)
+		return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd);
 	return -EOPNOTSUPP;
 }
 

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

* [PATCH 4.4 074/118] sched/core: Fix a race between try_to_wake_up() and a woken up task
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (69 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 073/118] Revert "wext: Fix 32 bit iwpriv compatibility issue with 64 bit Kernel" Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 075/118] ipv6: addrconf: fix dev refcont leak when DAD failed Greg Kroah-Hartman
                     ` (45 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Balbir Singh, Peter Zijlstra (Intel),
	Benjamin Herrenschmidt, Alexey Kardashevskiy, Linus Torvalds,
	Nicholas Piggin, Nicholas Piggin, Oleg Nesterov, Thomas Gleixner,
	Ingo Molnar

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

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

From: Balbir Singh <bsingharora@gmail.com>

commit 135e8c9250dd5c8c9aae5984fde6f230d0cbfeaf upstream.

The origin of the issue I've seen is related to
a missing memory barrier between check for task->state and
the check for task->on_rq.

The task being woken up is already awake from a schedule()
and is doing the following:

	do {
		schedule()
		set_current_state(TASK_(UN)INTERRUPTIBLE);
	} while (!cond);

The waker, actually gets stuck doing the following in
try_to_wake_up():

	while (p->on_cpu)
		cpu_relax();

Analysis:

The instance I've seen involves the following race:

 CPU1					CPU2

 while () {
   if (cond)
     break;
   do {
     schedule();
     set_current_state(TASK_UN..)
   } while (!cond);
					wakeup_routine()
					  spin_lock_irqsave(wait_lock)
   raw_spin_lock_irqsave(wait_lock)	  wake_up_process()
 }					  try_to_wake_up()
 set_current_state(TASK_RUNNING);	  ..
 list_del(&waiter.list);

CPU2 wakes up CPU1, but before it can get the wait_lock and set
current state to TASK_RUNNING the following occurs:

 CPU3
 wakeup_routine()
 raw_spin_lock_irqsave(wait_lock)
 if (!list_empty)
   wake_up_process()
   try_to_wake_up()
   raw_spin_lock_irqsave(p->pi_lock)
   ..
   if (p->on_rq && ttwu_wakeup())
   ..
   while (p->on_cpu)
     cpu_relax()
   ..

CPU3 tries to wake up the task on CPU1 again since it finds
it on the wait_queue, CPU1 is spinning on wait_lock, but immediately
after CPU2, CPU3 got it.

CPU3 checks the state of p on CPU1, it is TASK_UNINTERRUPTIBLE and
the task is spinning on the wait_lock. Interestingly since p->on_rq
is checked under pi_lock, I've noticed that try_to_wake_up() finds
p->on_rq to be 0. This was the most confusing bit of the analysis,
but p->on_rq is changed under runqueue lock, rq_lock, the p->on_rq
check is not reliable without this fix IMHO. The race is visible
(based on the analysis) only when ttwu_queue() does a remote wakeup
via ttwu_queue_remote. In which case the p->on_rq change is not
done uder the pi_lock.

The result is that after a while the entire system locks up on
the raw_spin_irqlock_save(wait_lock) and the holder spins infintely

Reproduction of the issue:

The issue can be reproduced after a long run on my system with 80
threads and having to tweak available memory to very low and running
memory stress-ng mmapfork test. It usually takes a long time to
reproduce. I am trying to work on a test case that can reproduce
the issue faster, but thats work in progress. I am still testing the
changes on my still in a loop and the tests seem OK thus far.

Big thanks to Benjamin and Nick for helping debug this as well.
Ben helped catch the missing barrier, Nick caught every missing
bit in my theory.

Signed-off-by: Balbir Singh <bsingharora@gmail.com>
[ Updated comment to clarify matching barriers. Many
  architectures do not have a full barrier in switch_to()
  so that cannot be relied upon. ]
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Nicholas Piggin <nicholas.piggin@gmail.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/e02cce7b-d9ca-1ad0-7a61-ea97c7582b37@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 kernel/sched/core.c |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1945,6 +1945,28 @@ try_to_wake_up(struct task_struct *p, un
 	success = 1; /* we're going to change ->state */
 	cpu = task_cpu(p);
 
+	/*
+	 * Ensure we load p->on_rq _after_ p->state, otherwise it would
+	 * be possible to, falsely, observe p->on_rq == 0 and get stuck
+	 * in smp_cond_load_acquire() below.
+	 *
+	 * sched_ttwu_pending()                 try_to_wake_up()
+	 *   [S] p->on_rq = 1;                  [L] P->state
+	 *       UNLOCK rq->lock  -----.
+	 *                              \
+	 *				 +---   RMB
+	 * schedule()                   /
+	 *       LOCK rq->lock    -----'
+	 *       UNLOCK rq->lock
+	 *
+	 * [task p]
+	 *   [S] p->state = UNINTERRUPTIBLE     [L] p->on_rq
+	 *
+	 * Pairs with the UNLOCK+LOCK on rq->lock from the
+	 * last wakeup of our task and the schedule that got our task
+	 * current.
+	 */
+	smp_rmb();
 	if (p->on_rq && ttwu_remote(p, wake_flags))
 		goto stat;
 

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

* [PATCH 4.4 075/118] ipv6: addrconf: fix dev refcont leak when DAD failed
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (70 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 074/118] sched/core: Fix a race between try_to_wake_up() and a woken up task Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 076/118] gma500: remove annoying deprecation warning Greg Kroah-Hartman
                     ` (44 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Wei Yongjun, David S. Miller

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

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

From: Wei Yongjun <weiyongjun1@huawei.com>

commit 751eb6b6042a596b0080967c1a529a9fe98dac1d upstream.

In general, when DAD detected IPv6 duplicate address, ifp->state
will be set to INET6_IFADDR_STATE_ERRDAD and DAD is stopped by a
delayed work, the call tree should be like this:

ndisc_recv_ns
  -> addrconf_dad_failure        <- missing ifp put
     -> addrconf_mod_dad_work
       -> schedule addrconf_dad_work()
         -> addrconf_dad_stop()  <- missing ifp hold before call it

addrconf_dad_failure() called with ifp refcont holding but not put.
addrconf_dad_work() call addrconf_dad_stop() without extra holding
refcount. This will not cause any issue normally.

But the race between addrconf_dad_failure() and addrconf_dad_work()
may cause ifp refcount leak and netdevice can not be unregister,
dmesg show the following messages:

IPv6: eth0: IPv6 duplicate address fe80::XX:XXXX:XXXX:XX detected!
...
unregister_netdevice: waiting for eth0 to become free. Usage count = 1

Fixes: c15b1ccadb32 ("ipv6: move DAD and addrconf_verify processing
to workqueue")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/ipv6/addrconf.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1898,6 +1898,7 @@ errdad:
 	spin_unlock_bh(&ifp->lock);
 
 	addrconf_mod_dad_work(ifp, 0);
+	in6_ifa_put(ifp);
 }
 
 /* Join to solicited addr multicast group.
@@ -3609,6 +3610,7 @@ static void addrconf_dad_work(struct wor
 		addrconf_dad_begin(ifp);
 		goto out;
 	} else if (action == DAD_ABORT) {
+		in6_ifa_hold(ifp);
 		addrconf_dad_stop(ifp, 1);
 		goto out;
 	}

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

* [PATCH 4.4 076/118] gma500: remove annoying deprecation warning
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (71 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 075/118] ipv6: addrconf: fix dev refcont leak when DAD failed Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 079/118] mmc: dw_mmc: use resource_size_t to store physical address Greg Kroah-Hartman
                     ` (43 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Daniel Vetter, Alan Cox, Linus Torvalds

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

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

From: Linus Torvalds <torvalds@linux-foundation.org>

commit 166c5a6ef765653848161e6f4af81c05e4b3ecf6 upstream.

In commit e45708976aea ("drm/dp-helper: Move the legacy helpers to
gma500") the legacy i2c helpers were moved to the only remaining user of
them, the gma500 driver.  Together with that move, i2c_dp_aux_add_bus()
was marked deprecated and started warning about its remaining use.

It's now been a year and a half of annoying warning, and apparently
nobody cares enough about gma500 to try to move it along to the more
modern models.

Get rid of the warning - if even the gma500 people don't care enough,
then they should certainly not spam other innocent developers with a
warning that might hide other, much more real issues.

Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/gpu/drm/gma500/cdv_intel_dp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/gpu/drm/gma500/cdv_intel_dp.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c
@@ -220,7 +220,7 @@ i2c_dp_aux_prepare_bus(struct i2c_adapte
  * FIXME: This is the old dp aux helper, gma500 is the last driver that needs to
  * be ported over to the new helper code in drm_dp_helper.c like i915 or radeon.
  */
-static int __deprecated
+static int
 i2c_dp_aux_add_bus(struct i2c_adapter *adapter)
 {
 	int error;

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

* [PATCH 4.4 079/118] mmc: dw_mmc: use resource_size_t to store physical address
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (72 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 076/118] gma500: remove annoying deprecation warning Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 080/118] pinctrl: at91-pio4: use %pr format string for resource Greg Kroah-Hartman
                     ` (42 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Arnd Bergmann, Jaehoon Chung, Ulf Hansson

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

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

From: Arnd Bergmann <arnd@arndb.de>

commit 260b31643691e8a58683a4ccc3bdf7abfd86f54a upstream.

The dw_mmc driver stores the physical address of the MMIO registers
in a pointer, which requires the use of type casts, and is actually
broken if anyone ever has this device on a 32-bit SoC in registers
above 4GB. Gcc warns about this possibility when the driver is built
with ARM LPAE enabled:

mmc/host/dw_mmc.c: In function 'dw_mci_edmac_start_dma':
mmc/host/dw_mmc.c:702:17: warning: cast from pointer to integer of different size
  cfg.dst_addr = (dma_addr_t)(host->phy_regs + fifo_offset);
                 ^
mmc/host/dw_mmc-pltfm.c: In function 'dw_mci_pltfm_register':
mmc/host/dw_mmc-pltfm.c:63:19: warning: cast to pointer from integer of different size
  host->phy_regs = (void *)(regs->start);

This changes the code to use resource_size_t, which gets rid of the
warning, the bug and the useless casts.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/mmc/host/dw_mmc-pltfm.c |    2 +-
 drivers/mmc/host/dw_mmc.c       |    2 +-
 include/linux/mmc/dw_mmc.h      |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/mmc/host/dw_mmc-pltfm.c
+++ b/drivers/mmc/host/dw_mmc-pltfm.c
@@ -60,7 +60,7 @@ int dw_mci_pltfm_register(struct platfor
 
 	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	/* Get registers' physical base address */
-	host->phy_regs = (void *)(regs->start);
+	host->phy_regs = regs->start;
 	host->regs = devm_ioremap_resource(&pdev->dev, regs);
 	if (IS_ERR(host->regs))
 		return PTR_ERR(host->regs);
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -699,7 +699,7 @@ static int dw_mci_edmac_start_dma(struct
 	int ret = 0;
 
 	/* Set external dma config: burst size, burst width */
-	cfg.dst_addr = (dma_addr_t)(host->phy_regs + fifo_offset);
+	cfg.dst_addr = host->phy_regs + fifo_offset;
 	cfg.src_addr = cfg.dst_addr;
 	cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
 	cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -172,7 +172,7 @@ struct dw_mci {
 	/* For edmac */
 	struct dw_mci_dma_slave *dms;
 	/* Registers's physical base address */
-	void                    *phy_regs;
+	resource_size_t		phy_regs;
 
 	u32			cmd_status;
 	u32			data_status;

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

* [PATCH 4.4 080/118] pinctrl: at91-pio4: use %pr format string for resource
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (73 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 079/118] mmc: dw_mmc: use resource_size_t to store physical address Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 081/118] soc: qcom/spm: shut up uninitialized variable warning Greg Kroah-Hartman
                     ` (41 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Arnd Bergmann, Ludovic Desroches,
	Linus Walleij

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

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

From: Arnd Bergmann <arnd@arndb.de>

commit 32844138e31347fc0f61d3bf2d7b9c4583f189e3 upstream.

resource_size_t may be defined as 32 or 64 bit depending on configuration,
so it cannot be printed using the normal format strings, as gcc correctly
warns:

pinctrl-at91-pio4.c: In function 'atmel_pinctrl_probe':
pinctrl-at91-pio4.c:1003:41: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'resource_size_t {aka long long unsigned int}' [-Wformat=]
   dev_dbg(dev, "bank %i: hwirq=%u\n", i, res->start);

This changes the format string to use the special "%pr" format
string that prints a resource, and changes the arguments so we
the resource structure directly.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/pinctrl/pinctrl-at91-pio4.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/pinctrl/pinctrl-at91-pio4.c
+++ b/drivers/pinctrl/pinctrl-at91-pio4.c
@@ -1002,7 +1002,7 @@ static int atmel_pinctrl_probe(struct pl
 		atmel_pioctrl->irqs[i] = res->start;
 		irq_set_chained_handler(res->start, atmel_gpio_irq_handler);
 		irq_set_handler_data(res->start, atmel_pioctrl);
-		dev_dbg(dev, "bank %i: hwirq=%u\n", i, res->start);
+		dev_dbg(dev, "bank %i: irq=%pr\n", i, res);
 	}
 
 	atmel_pioctrl->irq_domain = irq_domain_add_linear(dev->of_node,

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

* [PATCH 4.4 081/118] soc: qcom/spm: shut up uninitialized variable warning
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (74 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 080/118] pinctrl: at91-pio4: use %pr format string for resource Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 082/118] kconfig: tinyconfig: provide whole choice blocks to avoid warnings Greg Kroah-Hartman
                     ` (40 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Arnd Bergmann

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

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

From: Arnd Bergmann <arnd@arndb.de>

commit 00affcac69c7aae6c2cfcbc71f724e1c16d0b445 upstream.

gcc warns about the 'found' variable possibly being used uninitialized:

drivers/soc/qcom/spm.c: In function 'spm_dev_probe':
drivers/soc/qcom/spm.c:305:5: error: 'found' may be used uninitialized in this function [-Werror=maybe-uninitialized]

However, the code is correct because we know that there is
always at least one online CPU. This initializes the 'found'
variable to zero before the loop so the compiler knows
it does not have to warn about it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/soc/qcom/spm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/soc/qcom/spm.c
+++ b/drivers/soc/qcom/spm.c
@@ -288,7 +288,7 @@ static struct spm_driver_data *spm_get_d
 	struct spm_driver_data *drv = NULL;
 	struct device_node *cpu_node, *saw_node;
 	int cpu;
-	bool found;
+	bool found = 0;
 
 	for_each_possible_cpu(cpu) {
 		cpu_node = of_cpu_device_node_get(cpu);

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

* [PATCH 4.4 082/118] kconfig: tinyconfig: provide whole choice blocks to avoid warnings
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (75 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 081/118] soc: qcom/spm: shut up uninitialized variable warning Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 083/118] net: simplify napi_synchronize() " Greg Kroah-Hartman
                     ` (39 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Arnd Bergmann, Josh Triplett,
	Masahiro Yamada, Ingo Molnar, Andrew Morton, Linus Torvalds

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

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

From: Arnd Bergmann <arnd@arndb.de>

commit 236dec051078a8691950f56949612b4b74107e48 upstream.

Using "make tinyconfig" produces a couple of annoying warnings that show
up for build test machines all the time:

    .config:966:warning: override: NOHIGHMEM changes choice state
    .config:965:warning: override: SLOB changes choice state
    .config:963:warning: override: KERNEL_XZ changes choice state
    .config:962:warning: override: CC_OPTIMIZE_FOR_SIZE changes choice state
    .config:933:warning: override: SLOB changes choice state
    .config:930:warning: override: CC_OPTIMIZE_FOR_SIZE changes choice state
    .config:870:warning: override: SLOB changes choice state
    .config:868:warning: override: KERNEL_XZ changes choice state
    .config:867:warning: override: CC_OPTIMIZE_FOR_SIZE changes choice state

I've made a previous attempt at fixing them and we discussed a number of
alternatives.

I tried changing the Makefile to use "merge_config.sh -n
$(fragment-list)" but couldn't get that to work properly.

This is yet another approach, based on the observation that we do want
to see a warning for conflicting 'choice' options, and that we can
simply make them non-conflicting by listing all other options as
disabled.  This is a trivial patch that we can apply independent of
plans for other changes.

Link: http://lkml.kernel.org/r/20160829214952.1334674-2-arnd@arndb.de
Link: https://storage.kernelci.org/mainline/v4.7-rc6/x86-tinyconfig/build.log
https://patchwork.kernel.org/patch/9212749/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/configs/tiny.config |    2 ++
 kernel/configs/tiny.config   |    8 ++++++++
 2 files changed, 10 insertions(+)

--- a/arch/x86/configs/tiny.config
+++ b/arch/x86/configs/tiny.config
@@ -1 +1,3 @@
 CONFIG_NOHIGHMEM=y
+# CONFIG_HIGHMEM4G is not set
+# CONFIG_HIGHMEM64G is not set
--- a/kernel/configs/tiny.config
+++ b/kernel/configs/tiny.config
@@ -1,4 +1,12 @@
+# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set
 CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+# CONFIG_KERNEL_GZIP is not set
+# CONFIG_KERNEL_BZIP2 is not set
+# CONFIG_KERNEL_LZMA is not set
 CONFIG_KERNEL_XZ=y
+# CONFIG_KERNEL_LZO is not set
+# CONFIG_KERNEL_LZ4 is not set
 CONFIG_OPTIMIZE_INLINING=y
+# CONFIG_SLAB is not set
+# CONFIG_SLUB is not set
 CONFIG_SLOB=y

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

* [PATCH 4.4 083/118] net: simplify napi_synchronize() to avoid warnings
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (76 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 082/118] kconfig: tinyconfig: provide whole choice blocks to avoid warnings Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 084/118] drm: atmel-hlcdc: Fix vertical scaling Greg Kroah-Hartman
                     ` (38 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Arnd Bergmann, David S. Miller

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

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

From: Arnd Bergmann <arnd@arndb.de>

commit facc432faa59414bd7c60c307ff1645154a66c98 upstream.

The napi_synchronize() function is defined twice: The definition
for SMP builds waits for other CPUs to be done, while the uniprocessor
variant just contains a barrier and ignores its argument.

In the mvneta driver, this leads to a warning about an unused variable
when we lookup the NAPI struct of another CPU and then don't use it:

ethernet/marvell/mvneta.c: In function 'mvneta_percpu_notifier':
ethernet/marvell/mvneta.c:2910:30: error: unused variable 'other_port' [-Werror=unused-variable]

There are no other CPUs on a UP build, so that code never runs, but
gcc does not know this.

The nicest solution seems to be to turn the napi_synchronize() helper
into an inline function for the UP case as well, as that leads gcc to
not complain about the argument being unused. Once we do that, we can
also combine the two cases into a single function definition and use
if(IS_ENABLED()) rather than #ifdef to make it look a bit nicer.

The warning first came up in linux-4.4, but I failed to catch it
earlier.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: f86428854480 ("net: mvneta: Statically assign queues to CPUs")
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 include/linux/netdevice.h |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -511,7 +511,6 @@ static inline void napi_enable(struct na
 	clear_bit(NAPI_STATE_NPSVC, &n->state);
 }
 
-#ifdef CONFIG_SMP
 /**
  *	napi_synchronize - wait until NAPI is not running
  *	@n: napi context
@@ -522,12 +521,12 @@ static inline void napi_enable(struct na
  */
 static inline void napi_synchronize(const struct napi_struct *n)
 {
-	while (test_bit(NAPI_STATE_SCHED, &n->state))
-		msleep(1);
+	if (IS_ENABLED(CONFIG_SMP))
+		while (test_bit(NAPI_STATE_SCHED, &n->state))
+			msleep(1);
+	else
+		barrier();
 }
-#else
-# define napi_synchronize(n)	barrier()
-#endif
 
 enum netdev_queue_state_t {
 	__QUEUE_STATE_DRV_XOFF,

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

* [PATCH 4.4 084/118] drm: atmel-hlcdc: Fix vertical scaling
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (77 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 083/118] net: simplify napi_synchronize() " Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 085/118] drm: Only use compat ioctl for addfb2 on X86/IA64 Greg Kroah-Hartman
                     ` (37 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Jan Leupold, Boris Brezillon

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

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

From: Jan Leupold <leupold@rsi-elektrotechnik.de>

commit d31ed3f05763644840c654a384eaefa94c097ba2 upstream.

The code is applying the same scaling for the X and Y components,
thus making the scaling feature only functional when both components
have the same scaling factor.

Do the s/_w/_h/ replacement where appropriate to fix vertical scaling.

Signed-off-by: Jan Leupold <leupold@rsi-elektrotechnik.de>
Fixes: 1a396789f65a2 ("drm: add Atmel HLCDC Display Controller support")
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
@@ -316,19 +316,19 @@ atmel_hlcdc_plane_update_pos_and_size(st
 			u32 *coeff_tab = heo_upscaling_ycoef;
 			u32 max_memsize;
 
-			if (state->crtc_w < state->src_w)
+			if (state->crtc_h < state->src_h)
 				coeff_tab = heo_downscaling_ycoef;
 			for (i = 0; i < ARRAY_SIZE(heo_upscaling_ycoef); i++)
 				atmel_hlcdc_layer_update_cfg(&plane->layer,
 							     33 + i,
 							     0xffffffff,
 							     coeff_tab[i]);
-			factor = ((8 * 256 * state->src_w) - (256 * 4)) /
-				 state->crtc_w;
+			factor = ((8 * 256 * state->src_h) - (256 * 4)) /
+				 state->crtc_h;
 			factor++;
-			max_memsize = ((factor * state->crtc_w) + (256 * 4)) /
+			max_memsize = ((factor * state->crtc_h) + (256 * 4)) /
 				      2048;
-			if (max_memsize > state->src_w)
+			if (max_memsize > state->src_h)
 				factor--;
 			factor_reg |= (factor << 16) | 0x80000000;
 		}

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

* [PATCH 4.4 085/118] drm: Only use compat ioctl for addfb2 on X86/IA64
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (78 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 084/118] drm: atmel-hlcdc: Fix vertical scaling Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 086/118] genirq: Provide irq_gc_{lock_irqsave,unlock_irqrestore}() helpers Greg Kroah-Hartman
                     ` (36 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Rob Clark, Kristian H. Kristensen,
	Sean Paul, Dave Airlie

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

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

From: Kristian H. Kristensen <hoegsberg@gmail.com>

commit 47a66e45d7a7613322549c2475ea9d809baaf514 upstream.

Similar to struct drm_update_draw, struct drm_mode_fb_cmd2 has an
unaligned 64 bit field (modifier). This get packed differently between
32 bit and 64 bit modes on architectures that can handle unaligned 64
bit access (X86 and IA64).  Other architectures pack the structs the
same and don't need the compat wrapper. Use the same condition for
drm_mode_fb_cmd2 as we use for drm_update_draw.

Note that only the modifier will be packed differently between compat
and non-compat versions.

Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Kristian H. Kristensen <hoegsberg@chromium.org>
[seanpaul added not at bottom of commit msg re: modifier]
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1473801645-116011-1-git-send-email-hoegsberg@chromium.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/gpu/drm/drm_ioc32.c |    4 ++++
 1 file changed, 4 insertions(+)

--- a/drivers/gpu/drm/drm_ioc32.c
+++ b/drivers/gpu/drm/drm_ioc32.c
@@ -1015,6 +1015,7 @@ static int compat_drm_wait_vblank(struct
 	return 0;
 }
 
+#if defined(CONFIG_X86) || defined(CONFIG_IA64)
 typedef struct drm_mode_fb_cmd232 {
 	u32 fb_id;
 	u32 width;
@@ -1071,6 +1072,7 @@ static int compat_drm_mode_addfb2(struct
 
 	return 0;
 }
+#endif
 
 static drm_ioctl_compat_t *drm_compat_ioctls[] = {
 	[DRM_IOCTL_NR(DRM_IOCTL_VERSION32)] = compat_drm_version,
@@ -1104,7 +1106,9 @@ static drm_ioctl_compat_t *drm_compat_io
 	[DRM_IOCTL_NR(DRM_IOCTL_UPDATE_DRAW32)] = compat_drm_update_draw,
 #endif
 	[DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK32)] = compat_drm_wait_vblank,
+#if defined(CONFIG_X86) || defined(CONFIG_IA64)
 	[DRM_IOCTL_NR(DRM_IOCTL_MODE_ADDFB232)] = compat_drm_mode_addfb2,
+#endif
 };
 
 /**

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

* [PATCH 4.4 086/118] genirq: Provide irq_gc_{lock_irqsave,unlock_irqrestore}() helpers
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (79 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 085/118] drm: Only use compat ioctl for addfb2 on X86/IA64 Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 087/118] irqchip/atmel-aic: Fix potential deadlock in ->xlate() Greg Kroah-Hartman
                     ` (35 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Boris Brezillon, Jason Cooper,
	Marc Zyngier, Nicolas Ferre, Alexandre Belloni, Thomas Gleixner

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

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

From: Boris Brezillon <boris.brezillon@free-electrons.com>

commit ebf9ff753c041b296241990aef76163bbb2cc9c8 upstream.

Some irqchip drivers need to take the generic chip lock outside of the
irq context.

Provide the irq_gc_{lock_irqsave,unlock_irqrestore}() helpers to allow
one to disable irqs while entering a critical section protected by
gc->lock.

Note that we do not provide optimized version of these helpers for !SMP,
because they are not called from the hot-path.

[ tglx: Added a comment when these helpers should be [not] used ]

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Link: http://lkml.kernel.org/r/1473775109-4192-1-git-send-email-boris.brezillon@free-electrons.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 include/linux/irq.h |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -916,6 +916,16 @@ static inline void irq_gc_lock(struct ir
 static inline void irq_gc_unlock(struct irq_chip_generic *gc) { }
 #endif
 
+/*
+ * The irqsave variants are for usage in non interrupt code. Do not use
+ * them in irq_chip callbacks. Use irq_gc_lock() instead.
+ */
+#define irq_gc_lock_irqsave(gc, flags)	\
+	raw_spin_lock_irqsave(&(gc)->lock, flags)
+
+#define irq_gc_unlock_irqrestore(gc, flags)	\
+	raw_spin_unlock_irqrestore(&(gc)->lock, flags)
+
 static inline void irq_reg_writel(struct irq_chip_generic *gc,
 				  u32 val, int reg_offset)
 {

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

* [PATCH 4.4 087/118] irqchip/atmel-aic: Fix potential deadlock in ->xlate()
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (80 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 086/118] genirq: Provide irq_gc_{lock_irqsave,unlock_irqrestore}() helpers Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 088/118] fix iov_iter_fault_in_readable() Greg Kroah-Hartman
                     ` (34 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Boris Brezillon, Marc Zyngier,
	Jason Cooper, Nicolas Ferre, Alexandre Belloni, Thomas Gleixner

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

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

From: Boris Brezillon <boris.brezillon@free-electrons.com>

commit 5eb0d6eb3fac3daa60d9190eed9fa41cf809c756 upstream.

aic5_irq_domain_xlate() and aic_irq_domain_xlate() take the generic chip
lock without disabling interrupts, which can lead to a deadlock if an
interrupt occurs while the lock is held in one of these functions.

Replace irq_gc_{lock,unlock}() calls by
irq_gc_{lock_irqsave,unlock_irqrestore}() ones to prevent this bug from
happening.

Fixes: b1479ebb7720 ("irqchip: atmel-aic: Add atmel AIC/AIC5 drivers")
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Link: http://lkml.kernel.org/r/1473775109-4192-2-git-send-email-boris.brezillon@free-electrons.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/irqchip/irq-atmel-aic.c  |    5 +++--
 drivers/irqchip/irq-atmel-aic5.c |    5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

--- a/drivers/irqchip/irq-atmel-aic.c
+++ b/drivers/irqchip/irq-atmel-aic.c
@@ -176,6 +176,7 @@ static int aic_irq_domain_xlate(struct i
 {
 	struct irq_domain_chip_generic *dgc = d->gc;
 	struct irq_chip_generic *gc;
+	unsigned long flags;
 	unsigned smr;
 	int idx;
 	int ret;
@@ -194,12 +195,12 @@ static int aic_irq_domain_xlate(struct i
 
 	gc = dgc->gc[idx];
 
-	irq_gc_lock(gc);
+	irq_gc_lock_irqsave(gc, flags);
 	smr = irq_reg_readl(gc, AT91_AIC_SMR(*out_hwirq));
 	ret = aic_common_set_priority(intspec[2], &smr);
 	if (!ret)
 		irq_reg_writel(gc, smr, AT91_AIC_SMR(*out_hwirq));
-	irq_gc_unlock(gc);
+	irq_gc_unlock_irqrestore(gc, flags);
 
 	return ret;
 }
--- a/drivers/irqchip/irq-atmel-aic5.c
+++ b/drivers/irqchip/irq-atmel-aic5.c
@@ -258,6 +258,7 @@ static int aic5_irq_domain_xlate(struct
 				 unsigned int *out_type)
 {
 	struct irq_chip_generic *bgc = irq_get_domain_generic_chip(d, 0);
+	unsigned long flags;
 	unsigned smr;
 	int ret;
 
@@ -269,13 +270,13 @@ static int aic5_irq_domain_xlate(struct
 	if (ret)
 		return ret;
 
-	irq_gc_lock(bgc);
+	irq_gc_lock_irqsave(bgc, flags);
 	irq_reg_writel(bgc, *out_hwirq, AT91_AIC5_SSR);
 	smr = irq_reg_readl(bgc, AT91_AIC5_SMR);
 	ret = aic_common_set_priority(intspec[2], &smr);
 	if (!ret)
 		irq_reg_writel(bgc, intspec[2] | smr, AT91_AIC5_SMR);
-	irq_gc_unlock(bgc);
+	irq_gc_unlock_irqrestore(bgc, flags);
 
 	return ret;
 }

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

* [PATCH 4.4 088/118] fix iov_iter_fault_in_readable()
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (81 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 087/118] irqchip/atmel-aic: Fix potential deadlock in ->xlate() Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 089/118] microblaze: fix __get_user() Greg Kroah-Hartman
                     ` (33 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro, Linus Torvalds

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

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

From: Al Viro <viro@ZenIV.linux.org.uk>

commit d4690f1e1cdabb4d61207b6787b1605a0dc0aeab upstream.

... by turning it into what used to be multipages counterpart

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 include/linux/uio.h |    2 +-
 lib/iov_iter.c      |   24 ++----------------------
 2 files changed, 3 insertions(+), 23 deletions(-)

--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -76,7 +76,7 @@ size_t iov_iter_copy_from_user_atomic(st
 		struct iov_iter *i, unsigned long offset, size_t bytes);
 void iov_iter_advance(struct iov_iter *i, size_t bytes);
 int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes);
-int iov_iter_fault_in_multipages_readable(struct iov_iter *i, size_t bytes);
+#define iov_iter_fault_in_multipages_readable iov_iter_fault_in_readable
 size_t iov_iter_single_seg_count(const struct iov_iter *i);
 size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes,
 			 struct iov_iter *i);
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -298,33 +298,13 @@ done:
 }
 
 /*
- * Fault in the first iovec of the given iov_iter, to a maximum length
- * of bytes. Returns 0 on success, or non-zero if the memory could not be
- * accessed (ie. because it is an invalid address).
- *
- * writev-intensive code may want this to prefault several iovecs -- that
- * would be possible (callers must not rely on the fact that _only_ the
- * first iovec will be faulted with the current implementation).
- */
-int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes)
-{
-	if (!(i->type & (ITER_BVEC|ITER_KVEC))) {
-		char __user *buf = i->iov->iov_base + i->iov_offset;
-		bytes = min(bytes, i->iov->iov_len - i->iov_offset);
-		return fault_in_pages_readable(buf, bytes);
-	}
-	return 0;
-}
-EXPORT_SYMBOL(iov_iter_fault_in_readable);
-
-/*
  * Fault in one or more iovecs of the given iov_iter, to a maximum length of
  * bytes.  For each iovec, fault in each page that constitutes the iovec.
  *
  * Return 0 on success, or non-zero if the memory could not be accessed (i.e.
  * because it is an invalid address).
  */
-int iov_iter_fault_in_multipages_readable(struct iov_iter *i, size_t bytes)
+int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes)
 {
 	size_t skip = i->iov_offset;
 	const struct iovec *iov;
@@ -341,7 +321,7 @@ int iov_iter_fault_in_multipages_readabl
 	}
 	return 0;
 }
-EXPORT_SYMBOL(iov_iter_fault_in_multipages_readable);
+EXPORT_SYMBOL(iov_iter_fault_in_readable);
 
 void iov_iter_init(struct iov_iter *i, int direction,
 			const struct iovec *iov, unsigned long nr_segs,

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

* [PATCH 4.4 089/118] microblaze: fix __get_user()
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (82 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 088/118] fix iov_iter_fault_in_readable() Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 090/118] avr32: fix copy_from_user() Greg Kroah-Hartman
                     ` (32 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit e98b9e37ae04562d52c96f46b3cf4c2e80222dc1 upstream.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/microblaze/include/asm/uaccess.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/microblaze/include/asm/uaccess.h
+++ b/arch/microblaze/include/asm/uaccess.h
@@ -227,7 +227,7 @@ extern long __user_bad(void);
 
 #define __get_user(x, ptr)						\
 ({									\
-	unsigned long __gu_val;						\
+	unsigned long __gu_val = 0;					\
 	/*unsigned long __gu_ptr = (unsigned long)(ptr);*/		\
 	long __gu_err;							\
 	switch (sizeof(*(ptr))) {					\

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

* [PATCH 4.4 090/118] avr32: fix copy_from_user()
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (83 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 089/118] microblaze: fix __get_user() Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 091/118] microblaze: " Greg Kroah-Hartman
                     ` (31 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit 8630c32275bac2de6ffb8aea9d9b11663e7ad28e upstream.

really ugly, but apparently avr32 compilers turns access_ok() into
something so bad that they want it in assembler.  Left that way,
zeroing added in inline wrapper.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/avr32/include/asm/uaccess.h |   11 ++++++++++-
 arch/avr32/kernel/avr32_ksyms.c  |    2 +-
 arch/avr32/lib/copy_user.S       |    4 ++--
 3 files changed, 13 insertions(+), 4 deletions(-)

--- a/arch/avr32/include/asm/uaccess.h
+++ b/arch/avr32/include/asm/uaccess.h
@@ -74,7 +74,7 @@ extern __kernel_size_t __copy_user(void
 
 extern __kernel_size_t copy_to_user(void __user *to, const void *from,
 				    __kernel_size_t n);
-extern __kernel_size_t copy_from_user(void *to, const void __user *from,
+extern __kernel_size_t ___copy_from_user(void *to, const void __user *from,
 				      __kernel_size_t n);
 
 static inline __kernel_size_t __copy_to_user(void __user *to, const void *from,
@@ -88,6 +88,15 @@ static inline __kernel_size_t __copy_fro
 {
 	return __copy_user(to, (const void __force *)from, n);
 }
+static inline __kernel_size_t copy_from_user(void *to,
+					       const void __user *from,
+					       __kernel_size_t n)
+{
+	size_t res = ___copy_from_user(to, from, n);
+	if (unlikely(res))
+		memset(to + (n - res), 0, res);
+	return res;
+}
 
 #define __copy_to_user_inatomic __copy_to_user
 #define __copy_from_user_inatomic __copy_from_user
--- a/arch/avr32/kernel/avr32_ksyms.c
+++ b/arch/avr32/kernel/avr32_ksyms.c
@@ -36,7 +36,7 @@ EXPORT_SYMBOL(copy_page);
 /*
  * Userspace access stuff.
  */
-EXPORT_SYMBOL(copy_from_user);
+EXPORT_SYMBOL(___copy_from_user);
 EXPORT_SYMBOL(copy_to_user);
 EXPORT_SYMBOL(__copy_user);
 EXPORT_SYMBOL(strncpy_from_user);
--- a/arch/avr32/lib/copy_user.S
+++ b/arch/avr32/lib/copy_user.S
@@ -25,11 +25,11 @@
 	.align	1
 	.global	copy_from_user
 	.type	copy_from_user, @function
-copy_from_user:
+___copy_from_user:
 	branch_if_kernel r8, __copy_user
 	ret_if_privileged r8, r11, r10, r10
 	rjmp	__copy_user
-	.size	copy_from_user, . - copy_from_user
+	.size	___copy_from_user, . - ___copy_from_user
 
 	.global	copy_to_user
 	.type	copy_to_user, @function

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

* [PATCH 4.4 091/118] microblaze: fix copy_from_user()
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (84 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 090/118] avr32: fix copy_from_user() Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 092/118] fix minor infoleak in get_user_ex() Greg Kroah-Hartman
                     ` (30 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit d0cf385160c12abd109746cad1f13e3b3e8b50b8 upstream.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/microblaze/include/asm/uaccess.h |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

--- a/arch/microblaze/include/asm/uaccess.h
+++ b/arch/microblaze/include/asm/uaccess.h
@@ -373,10 +373,13 @@ extern long __user_bad(void);
 static inline long copy_from_user(void *to,
 		const void __user *from, unsigned long n)
 {
+	unsigned long res = n;
 	might_fault();
-	if (access_ok(VERIFY_READ, from, n))
-		return __copy_from_user(to, from, n);
-	return n;
+	if (likely(access_ok(VERIFY_READ, from, n)))
+		res = __copy_from_user(to, from, n);
+	if (unlikely(res))
+		memset(to + (n - res), 0, res);
+	return res;
 }
 
 #define __copy_to_user(to, from, n)	\

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

* [PATCH 4.4 092/118] fix minor infoleak in get_user_ex()
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (85 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 091/118] microblaze: " Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 093/118] mn10300: failing __get_user() and get_user() should zero Greg Kroah-Hartman
                     ` (29 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro, Linus Torvalds

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

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

From: Al Viro <viro@ZenIV.linux.org.uk>

commit 1c109fabbd51863475cd12ac206bdd249aee35af upstream.

get_user_ex(x, ptr) should zero x on failure.  It's not a lot of a leak
(at most we are leaking uninitialized 64bit value off the kernel stack,
and in a fairly constrained situation, at that), but the fix is trivial,
so...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
[ This sat in different branch from the uaccess fixes since mid-August ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/include/asm/uaccess.h |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/arch/x86/include/asm/uaccess.h
+++ b/arch/x86/include/asm/uaccess.h
@@ -394,7 +394,11 @@ do {									\
 #define __get_user_asm_ex(x, addr, itype, rtype, ltype)			\
 	asm volatile("1:	mov"itype" %1,%"rtype"0\n"		\
 		     "2:\n"						\
-		     _ASM_EXTABLE_EX(1b, 2b)				\
+		     ".section .fixup,\"ax\"\n"				\
+                     "3:xor"itype" %"rtype"0,%"rtype"0\n"		\
+		     "  jmp 2b\n"					\
+		     ".previous\n"					\
+		     _ASM_EXTABLE_EX(1b, 3b)				\
 		     : ltype(x) : "m" (__m(addr)))
 
 #define __put_user_nocheck(x, ptr, size)			\

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

* [PATCH 4.4 093/118] mn10300: failing __get_user() and get_user() should zero
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (86 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 092/118] fix minor infoleak in get_user_ex() Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 094/118] m32r: fix __get_user() Greg Kroah-Hartman
                     ` (28 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit 43403eabf558d2800b429cd886e996fd555aa542 upstream.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/mn10300/include/asm/uaccess.h |    1 +
 1 file changed, 1 insertion(+)

--- a/arch/mn10300/include/asm/uaccess.h
+++ b/arch/mn10300/include/asm/uaccess.h
@@ -181,6 +181,7 @@ struct __large_struct { unsigned long bu
 		"2:\n"						\
 		"	.section	.fixup,\"ax\"\n"	\
 		"3:\n\t"					\
+		"	mov		0,%1\n"			\
 		"	mov		%3,%0\n"		\
 		"	jmp		2b\n"			\
 		"	.previous\n"				\

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

* [PATCH 4.4 094/118] m32r: fix __get_user()
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (87 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 093/118] mn10300: failing __get_user() and get_user() should zero Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 095/118] sh64: failing __get_user() should zero Greg Kroah-Hartman
                     ` (27 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit c90a3bc5061d57e7931a9b7ad14784e1a0ed497d upstream.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/m32r/include/asm/uaccess.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/m32r/include/asm/uaccess.h
+++ b/arch/m32r/include/asm/uaccess.h
@@ -219,7 +219,7 @@ extern int fixup_exception(struct pt_reg
 #define __get_user_nocheck(x, ptr, size)				\
 ({									\
 	long __gu_err = 0;						\
-	unsigned long __gu_val;						\
+	unsigned long __gu_val = 0;					\
 	might_fault();							\
 	__get_user_size(__gu_val, (ptr), (size), __gu_err);		\
 	(x) = (__force __typeof__(*(ptr)))__gu_val;			\

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

* [PATCH 4.4 095/118] sh64: failing __get_user() should zero
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (88 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 094/118] m32r: fix __get_user() Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 096/118] nios2: fix __get_user() Greg Kroah-Hartman
                     ` (26 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit c6852389228df9fb3067f94f3b651de2a7921b36 upstream.

It could be done in exception-handling bits in __get_user_b() et.al.,
but the surgery involved would take more knowledge of sh64 details
than I have or _want_ to have.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/sh/include/asm/uaccess_64.h |    1 +
 1 file changed, 1 insertion(+)

--- a/arch/sh/include/asm/uaccess_64.h
+++ b/arch/sh/include/asm/uaccess_64.h
@@ -24,6 +24,7 @@
 #define __get_user_size(x,ptr,size,retval)			\
 do {								\
 	retval = 0;						\
+	x = 0;							\
 	switch (size) {						\
 	case 1:							\
 		retval = __get_user_asm_b((void *)&x,		\

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

* [PATCH 4.4 096/118] nios2: fix __get_user()
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (89 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 095/118] sh64: failing __get_user() should zero Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 097/118] score: fix __get_user/get_user Greg Kroah-Hartman
                     ` (25 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit 2e29f50ad5e23db37dde9be71410d95d50241ecd upstream.

a) should not leave crap on fault
b) should _not_ require access_ok() in any cases.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/nios2/include/asm/uaccess.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/nios2/include/asm/uaccess.h
+++ b/arch/nios2/include/asm/uaccess.h
@@ -139,7 +139,7 @@ extern long strnlen_user(const char __us
 
 #define __get_user_unknown(val, size, ptr, err) do {			\
 	err = 0;							\
-	if (copy_from_user(&(val), ptr, size)) {			\
+	if (__copy_from_user(&(val), ptr, size)) {			\
 		err = -EFAULT;						\
 	}								\
 	} while (0)
@@ -166,7 +166,7 @@ do {									\
 	({								\
 	long __gu_err = -EFAULT;					\
 	const __typeof__(*(ptr)) __user *__gu_ptr = (ptr);		\
-	unsigned long __gu_val;						\
+	unsigned long __gu_val = 0;					\
 	__get_user_common(__gu_val, sizeof(*(ptr)), __gu_ptr, __gu_err);\
 	(x) = (__force __typeof__(x))__gu_val;				\
 	__gu_err;							\

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

* [PATCH 4.4 097/118] score: fix __get_user/get_user
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (90 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 096/118] nios2: fix __get_user() Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29   ` [PATCH 4.4 098/118] s390: get_user() should zero on failure Greg Kroah-Hartman
                     ` (24 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit c2f18fa4cbb3ad92e033a24efa27583978ce9600 upstream.

* should zero on any failure
* __get_user() should use __copy_from_user(), not copy_from_user()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/score/include/asm/uaccess.h |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/arch/score/include/asm/uaccess.h
+++ b/arch/score/include/asm/uaccess.h
@@ -163,7 +163,7 @@ do {									\
 		__get_user_asm(val, "lw", ptr);				\
 		 break;							\
 	case 8: 							\
-		if ((copy_from_user((void *)&val, ptr, 8)) == 0)	\
+		if (__copy_from_user((void *)&val, ptr, 8) == 0)	\
 			__gu_err = 0;					\
 		else							\
 			__gu_err = -EFAULT;				\
@@ -188,6 +188,8 @@ do {									\
 									\
 	if (likely(access_ok(VERIFY_READ, __gu_ptr, size)))		\
 		__get_user_common((x), size, __gu_ptr);			\
+	else								\
+		(x) = 0;						\
 									\
 	__gu_err;							\
 })
@@ -201,6 +203,7 @@ do {									\
 		"2:\n"							\
 		".section .fixup,\"ax\"\n"				\
 		"3:li	%0, %4\n"					\
+		"li	%1, 0\n"					\
 		"j	2b\n"						\
 		".previous\n"						\
 		".section __ex_table,\"a\"\n"				\

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

* [PATCH 4.4 098/118] s390: get_user() should zero on failure
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (91 preceding siblings ...)
  2016-09-22 17:29   ` [PATCH 4.4 097/118] score: fix __get_user/get_user Greg Kroah-Hartman
@ 2016-09-22 17:29   ` Greg Kroah-Hartman
  2016-09-22 17:29     ` Greg Kroah-Hartman
                     ` (23 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit fd2d2b191fe75825c4c7a6f12f3fef35aaed7dd7 upstream.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/s390/include/asm/uaccess.h |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/arch/s390/include/asm/uaccess.h
+++ b/arch/s390/include/asm/uaccess.h
@@ -215,28 +215,28 @@ int __put_user_bad(void) __attribute__((
 	__chk_user_ptr(ptr);					\
 	switch (sizeof(*(ptr))) {				\
 	case 1: {						\
-		unsigned char __x;				\
+		unsigned char __x = 0;				\
 		__gu_err = __get_user_fn(&__x, ptr,		\
 					 sizeof(*(ptr)));	\
 		(x) = *(__force __typeof__(*(ptr)) *) &__x;	\
 		break;						\
 	};							\
 	case 2: {						\
-		unsigned short __x;				\
+		unsigned short __x = 0;				\
 		__gu_err = __get_user_fn(&__x, ptr,		\
 					 sizeof(*(ptr)));	\
 		(x) = *(__force __typeof__(*(ptr)) *) &__x;	\
 		break;						\
 	};							\
 	case 4: {						\
-		unsigned int __x;				\
+		unsigned int __x = 0;				\
 		__gu_err = __get_user_fn(&__x, ptr,		\
 					 sizeof(*(ptr)));	\
 		(x) = *(__force __typeof__(*(ptr)) *) &__x;	\
 		break;						\
 	};							\
 	case 8: {						\
-		unsigned long long __x;				\
+		unsigned long long __x = 0;			\
 		__gu_err = __get_user_fn(&__x, ptr,		\
 					 sizeof(*(ptr)));	\
 		(x) = *(__force __typeof__(*(ptr)) *) &__x;	\

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

* [PATCH 4.4 099/118] ARC: uaccess: get_user to zero out dest in cause of fault
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
@ 2016-09-22 17:29     ` Greg Kroah-Hartman
  2016-09-22 17:28   ` [PATCH 4.4 002/118] fscrypto: add authorization check for setting encryption policy Greg Kroah-Hartman
                       ` (115 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Al Viro, Linus Torvalds,
	linux-snps-arc, Vineet Gupta, Al Viro

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

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

From: Vineet Gupta <Vineet.Gupta1@synopsys.com>

commit 05d9d0b96e53c52a113fd783c0c97c830c8dc7af upstream.

Al reported potential issue with ARC get_user() as it wasn't clearing
out destination pointer in case of fault due to bad address etc.

Verified using following

| {
|  	u32 bogus1 = 0xdeadbeef;
|	u64 bogus2 = 0xdead;
|	int rc1, rc2;
|
|  	pr_info("Orig values %x %llx\n", bogus1, bogus2);
|	rc1 = get_user(bogus1, (u32 __user *)0x40000000);
|	rc2 = get_user(bogus2, (u64 __user *)0x50000000);
|	pr_info("access %d %d, new values %x %llx\n",
|		rc1, rc2, bogus1, bogus2);
| }

| [ARCLinux]# insmod /mnt/kernel-module/qtn.ko
| Orig values deadbeef dead
| access -14 -14, new values 0 0

Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-snps-arc@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arc/include/asm/uaccess.h |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

--- a/arch/arc/include/asm/uaccess.h
+++ b/arch/arc/include/asm/uaccess.h
@@ -83,7 +83,10 @@
 	"2:	;nop\n"				\
 	"	.section .fixup, \"ax\"\n"	\
 	"	.align 4\n"			\
-	"3:	mov %0, %3\n"			\
+	"3:	# return -EFAULT\n"		\
+	"	mov %0, %3\n"			\
+	"	# zero out dst ptr\n"		\
+	"	mov %1,  0\n"			\
 	"	j   2b\n"			\
 	"	.previous\n"			\
 	"	.section __ex_table, \"a\"\n"	\
@@ -101,7 +104,11 @@
 	"2:	;nop\n"				\
 	"	.section .fixup, \"ax\"\n"	\
 	"	.align 4\n"			\
-	"3:	mov %0, %3\n"			\
+	"3:	# return -EFAULT\n"		\
+	"	mov %0, %3\n"			\
+	"	# zero out dst ptr\n"		\
+	"	mov %1,  0\n"			\
+	"	mov %R1, 0\n"			\
 	"	j   2b\n"			\
 	"	.previous\n"			\
 	"	.section __ex_table, \"a\"\n"	\

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

* [PATCH 4.4 099/118] ARC: uaccess: get_user to zero out dest in cause of fault
@ 2016-09-22 17:29     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:29 UTC (permalink / raw)
  To: linux-snps-arc

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

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

From: Vineet Gupta <Vineet.Gupta1@synopsys.com>

commit 05d9d0b96e53c52a113fd783c0c97c830c8dc7af upstream.

Al reported potential issue with ARC get_user() as it wasn't clearing
out destination pointer in case of fault due to bad address etc.

Verified using following

| {
|  	u32 bogus1 = 0xdeadbeef;
|	u64 bogus2 = 0xdead;
|	int rc1, rc2;
|
|  	pr_info("Orig values %x %llx\n", bogus1, bogus2);
|	rc1 = get_user(bogus1, (u32 __user *)0x40000000);
|	rc2 = get_user(bogus2, (u64 __user *)0x50000000);
|	pr_info("access %d %d, new values %x %llx\n",
|		rc1, rc2, bogus1, bogus2);
| }

| [ARCLinux]# insmod /mnt/kernel-module/qtn.ko
| Orig values deadbeef dead
| access -14 -14, new values 0 0

Reported-by: Al Viro <viro at ZenIV.linux.org.uk>
Cc: Linus Torvalds <torvalds at linux-foundation.org>
Cc: linux-snps-arc at lists.infradead.org
Cc: linux-kernel at vger.kernel.org
Signed-off-by: Vineet Gupta <vgupta at synopsys.com>
Signed-off-by: Al Viro <viro at zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>

---
 arch/arc/include/asm/uaccess.h |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

--- a/arch/arc/include/asm/uaccess.h
+++ b/arch/arc/include/asm/uaccess.h
@@ -83,7 +83,10 @@
 	"2:	;nop\n"				\
 	"	.section .fixup, \"ax\"\n"	\
 	"	.align 4\n"			\
-	"3:	mov %0, %3\n"			\
+	"3:	# return -EFAULT\n"		\
+	"	mov %0, %3\n"			\
+	"	# zero out dst ptr\n"		\
+	"	mov %1,  0\n"			\
 	"	j   2b\n"			\
 	"	.previous\n"			\
 	"	.section __ex_table, \"a\"\n"	\
@@ -101,7 +104,11 @@
 	"2:	;nop\n"				\
 	"	.section .fixup, \"ax\"\n"	\
 	"	.align 4\n"			\
-	"3:	mov %0, %3\n"			\
+	"3:	# return -EFAULT\n"		\
+	"	mov %0, %3\n"			\
+	"	# zero out dst ptr\n"		\
+	"	mov %1,  0\n"			\
+	"	mov %R1, 0\n"			\
 	"	j   2b\n"			\
 	"	.previous\n"			\
 	"	.section __ex_table, \"a\"\n"	\

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

* [PATCH 4.4 100/118] asm-generic: make get_user() clear the destination on errors
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (93 preceding siblings ...)
  2016-09-22 17:29     ` Greg Kroah-Hartman
@ 2016-09-22 17:30   ` Greg Kroah-Hartman
  2016-09-22 17:30   ` [PATCH 4.4 101/118] frv: fix clear_user() Greg Kroah-Hartman
                     ` (21 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit 9ad18b75c2f6e4a78ce204e79f37781f8815c0fa upstream.

both for access_ok() failures and for faults halfway through

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 include/asm-generic/uaccess.h |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -230,14 +230,18 @@ extern int __put_user_bad(void) __attrib
 	might_fault();						\
 	access_ok(VERIFY_READ, __p, sizeof(*ptr)) ?		\
 		__get_user((x), (__typeof__(*(ptr)) *)__p) :	\
-		-EFAULT;					\
+		((x) = (__typeof__(*(ptr)))0,-EFAULT);		\
 })
 
 #ifndef __get_user_fn
 static inline int __get_user_fn(size_t size, const void __user *ptr, void *x)
 {
-	size = __copy_from_user(x, ptr, size);
-	return size ? -EFAULT : size;
+	size_t n = __copy_from_user(x, ptr, size);
+	if (unlikely(n)) {
+		memset(x + (size - n), 0, n);
+		return -EFAULT;
+	}
+	return 0;
 }
 
 #define __get_user_fn(sz, u, k)	__get_user_fn(sz, u, k)

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

* [PATCH 4.4 101/118] frv: fix clear_user()
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (94 preceding siblings ...)
  2016-09-22 17:30   ` [PATCH 4.4 100/118] asm-generic: make get_user() clear the destination on errors Greg Kroah-Hartman
@ 2016-09-22 17:30   ` Greg Kroah-Hartman
  2016-09-22 17:30   ` [PATCH 4.4 102/118] cris: buggered copy_from_user/copy_to_user/clear_user Greg Kroah-Hartman
                     ` (20 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit 3b8767a8f00cc6538ba6b1cf0f88502e2fd2eb90 upstream.

It should check access_ok().  Otherwise a bunch of places turn into
trivially exploitable rootholes.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/frv/include/asm/uaccess.h |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

--- a/arch/frv/include/asm/uaccess.h
+++ b/arch/frv/include/asm/uaccess.h
@@ -263,19 +263,25 @@ do {							\
 extern long __memset_user(void *dst, unsigned long count);
 extern long __memcpy_user(void *dst, const void *src, unsigned long count);
 
-#define clear_user(dst,count)			__memset_user(____force(dst), (count))
+#define __clear_user(dst,count)			__memset_user(____force(dst), (count))
 #define __copy_from_user_inatomic(to, from, n)	__memcpy_user((to), ____force(from), (n))
 #define __copy_to_user_inatomic(to, from, n)	__memcpy_user(____force(to), (from), (n))
 
 #else
 
-#define clear_user(dst,count)			(memset(____force(dst), 0, (count)), 0)
+#define __clear_user(dst,count)			(memset(____force(dst), 0, (count)), 0)
 #define __copy_from_user_inatomic(to, from, n)	(memcpy((to), ____force(from), (n)), 0)
 #define __copy_to_user_inatomic(to, from, n)	(memcpy(____force(to), (from), (n)), 0)
 
 #endif
 
-#define __clear_user clear_user
+static inline unsigned long __must_check
+clear_user(void __user *to, unsigned long n)
+{
+	if (likely(__access_ok(to, n)))
+		n = __clear_user(to, n);
+	return n;
+}
 
 static inline unsigned long __must_check
 __copy_to_user(void __user *to, const void *from, unsigned long n)

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

* [PATCH 4.4 102/118] cris: buggered copy_from_user/copy_to_user/clear_user
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (95 preceding siblings ...)
  2016-09-22 17:30   ` [PATCH 4.4 101/118] frv: fix clear_user() Greg Kroah-Hartman
@ 2016-09-22 17:30   ` Greg Kroah-Hartman
  2016-09-22 17:30   ` [PATCH 4.4 103/118] blackfin: fix copy_from_user() Greg Kroah-Hartman
                     ` (19 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Jesper Nilsson, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit eb47e0293baaa3044022059f1fa9ff474bfe35cb upstream.

* copy_from_user() on access_ok() failure ought to zero the destination
* none of those primitives should skip the access_ok() check in case of
small constant size.

Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/cris/include/asm/uaccess.h |   75 ++++++++++++++++++----------------------
 1 file changed, 34 insertions(+), 41 deletions(-)

--- a/arch/cris/include/asm/uaccess.h
+++ b/arch/cris/include/asm/uaccess.h
@@ -194,30 +194,6 @@ extern unsigned long __copy_user(void __
 extern unsigned long __copy_user_zeroing(void *to, const void __user *from, unsigned long n);
 extern unsigned long __do_clear_user(void __user *to, unsigned long n);
 
-static inline unsigned long
-__generic_copy_to_user(void __user *to, const void *from, unsigned long n)
-{
-	if (access_ok(VERIFY_WRITE, to, n))
-		return __copy_user(to, from, n);
-	return n;
-}
-
-static inline unsigned long
-__generic_copy_from_user(void *to, const void __user *from, unsigned long n)
-{
-	if (access_ok(VERIFY_READ, from, n))
-		return __copy_user_zeroing(to, from, n);
-	return n;
-}
-
-static inline unsigned long
-__generic_clear_user(void __user *to, unsigned long n)
-{
-	if (access_ok(VERIFY_WRITE, to, n))
-		return __do_clear_user(to, n);
-	return n;
-}
-
 static inline long
 __strncpy_from_user(char *dst, const char __user *src, long count)
 {
@@ -282,7 +258,7 @@ __constant_copy_from_user(void *to, cons
 	else if (n == 24)
 		__asm_copy_from_user_24(to, from, ret);
 	else
-		ret = __generic_copy_from_user(to, from, n);
+		ret = __copy_user_zeroing(to, from, n);
 
 	return ret;
 }
@@ -333,7 +309,7 @@ __constant_copy_to_user(void __user *to,
 	else if (n == 24)
 		__asm_copy_to_user_24(to, from, ret);
 	else
-		ret = __generic_copy_to_user(to, from, n);
+		ret = __copy_user(to, from, n);
 
 	return ret;
 }
@@ -366,26 +342,43 @@ __constant_clear_user(void __user *to, u
 	else if (n == 24)
 		__asm_clear_24(to, ret);
 	else
-		ret = __generic_clear_user(to, n);
+		ret = __do_clear_user(to, n);
 
 	return ret;
 }
 
 
-#define clear_user(to, n)				\
-	(__builtin_constant_p(n) ?			\
-	 __constant_clear_user(to, n) :			\
-	 __generic_clear_user(to, n))
-
-#define copy_from_user(to, from, n)			\
-	(__builtin_constant_p(n) ?			\
-	 __constant_copy_from_user(to, from, n) :	\
-	 __generic_copy_from_user(to, from, n))
-
-#define copy_to_user(to, from, n)			\
-	(__builtin_constant_p(n) ?			\
-	 __constant_copy_to_user(to, from, n) :		\
-	 __generic_copy_to_user(to, from, n))
+static inline size_t clear_user(void __user *to, size_t n)
+{
+	if (unlikely(!access_ok(VERIFY_WRITE, to, n)))
+		return n;
+	if (__builtin_constant_p(n))
+		return __constant_clear_user(to, n);
+	else
+		return __do_clear_user(to, n);
+}
+
+static inline size_t copy_from_user(void *to, const void __user *from, size_t n)
+{
+	if (unlikely(!access_ok(VERIFY_READ, from, n))) {
+		memset(to, 0, n);
+		return n;
+	}
+	if (__builtin_constant_p(n))
+		return __constant_copy_from_user(to, from, n);
+	else
+		return __copy_user_zeroing(to, from, n);
+}
+
+static inline size_t copy_to_user(void __user *to, const void *from, size_t n)
+{
+	if (unlikely(!access_ok(VERIFY_WRITE, to, n)))
+		return n;
+	if (__builtin_constant_p(n))
+		return __constant_copy_to_user(to, from, n);
+	else
+		return __copy_user(to, from, n);
+}
 
 /* We let the __ versions of copy_from/to_user inline, because they're often
  * used in fast paths and have only a small space overhead.

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

* [PATCH 4.4 103/118] blackfin: fix copy_from_user()
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (96 preceding siblings ...)
  2016-09-22 17:30   ` [PATCH 4.4 102/118] cris: buggered copy_from_user/copy_to_user/clear_user Greg Kroah-Hartman
@ 2016-09-22 17:30   ` Greg Kroah-Hartman
  2016-09-22 17:30   ` [PATCH 4.4 104/118] score: fix copy_from_user() and friends Greg Kroah-Hartman
                     ` (18 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit 8f035983dd826d7e04f67b28acf8e2f08c347e41 upstream.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/blackfin/include/asm/uaccess.h |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

--- a/arch/blackfin/include/asm/uaccess.h
+++ b/arch/blackfin/include/asm/uaccess.h
@@ -177,11 +177,12 @@ static inline int bad_user_access_length
 static inline unsigned long __must_check
 copy_from_user(void *to, const void __user *from, unsigned long n)
 {
-	if (access_ok(VERIFY_READ, from, n))
+	if (likely(access_ok(VERIFY_READ, from, n))) {
 		memcpy(to, (const void __force *)from, n);
-	else
-		return n;
-	return 0;
+		return 0;
+	}
+	memset(to, 0, n);
+	return n;
 }
 
 static inline unsigned long __must_check

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

* [PATCH 4.4 104/118] score: fix copy_from_user() and friends
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (97 preceding siblings ...)
  2016-09-22 17:30   ` [PATCH 4.4 103/118] blackfin: fix copy_from_user() Greg Kroah-Hartman
@ 2016-09-22 17:30   ` Greg Kroah-Hartman
  2016-09-22 17:30   ` [PATCH 4.4 105/118] sh: fix copy_from_user() Greg Kroah-Hartman
                     ` (17 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit b615e3c74621e06cd97f86373ca90d43d6d998aa upstream.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/score/include/asm/uaccess.h |   41 +++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 21 deletions(-)

--- a/arch/score/include/asm/uaccess.h
+++ b/arch/score/include/asm/uaccess.h
@@ -301,35 +301,34 @@ extern int __copy_tofrom_user(void *to,
 static inline unsigned long
 copy_from_user(void *to, const void *from, unsigned long len)
 {
-	unsigned long over;
+	unsigned long res = len;
 
-	if (access_ok(VERIFY_READ, from, len))
-		return __copy_tofrom_user(to, from, len);
+	if (likely(access_ok(VERIFY_READ, from, len)))
+		res = __copy_tofrom_user(to, from, len);
 
-	if ((unsigned long)from < TASK_SIZE) {
-		over = (unsigned long)from + len - TASK_SIZE;
-		return __copy_tofrom_user(to, from, len - over) + over;
-	}
-	return len;
+	if (unlikely(res))
+		memset(to + (len - res), 0, res);
+
+	return res;
 }
 
 static inline unsigned long
 copy_to_user(void *to, const void *from, unsigned long len)
 {
-	unsigned long over;
-
-	if (access_ok(VERIFY_WRITE, to, len))
-		return __copy_tofrom_user(to, from, len);
+	if (likely(access_ok(VERIFY_WRITE, to, len)))
+		len = __copy_tofrom_user(to, from, len);
 
-	if ((unsigned long)to < TASK_SIZE) {
-		over = (unsigned long)to + len - TASK_SIZE;
-		return __copy_tofrom_user(to, from, len - over) + over;
-	}
 	return len;
 }
 
-#define __copy_from_user(to, from, len)	\
-		__copy_tofrom_user((to), (from), (len))
+static inline unsigned long
+__copy_from_user(void *to, const void *from, unsigned long len)
+{
+	unsigned long left = __copy_tofrom_user(to, from, len);
+	if (unlikely(left))
+		memset(to + (len - left), 0, left);
+	return left;
+}
 
 #define __copy_to_user(to, from, len)		\
 		__copy_tofrom_user((to), (from), (len))
@@ -343,17 +342,17 @@ __copy_to_user_inatomic(void *to, const
 static inline unsigned long
 __copy_from_user_inatomic(void *to, const void *from, unsigned long len)
 {
-	return __copy_from_user(to, from, len);
+	return __copy_tofrom_user(to, from, len);
 }
 
-#define __copy_in_user(to, from, len)	__copy_from_user(to, from, len)
+#define __copy_in_user(to, from, len)	__copy_tofrom_user(to, from, len)
 
 static inline unsigned long
 copy_in_user(void *to, const void *from, unsigned long len)
 {
 	if (access_ok(VERIFY_READ, from, len) &&
 		      access_ok(VERFITY_WRITE, to, len))
-		return copy_from_user(to, from, len);
+		return __copy_tofrom_user(to, from, len);
 }
 
 /*

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

* [PATCH 4.4 105/118] sh: fix copy_from_user()
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (98 preceding siblings ...)
  2016-09-22 17:30   ` [PATCH 4.4 104/118] score: fix copy_from_user() and friends Greg Kroah-Hartman
@ 2016-09-22 17:30   ` Greg Kroah-Hartman
  2016-09-22 17:30   ` [PATCH 4.4 106/118] hexagon: fix strncpy_from_user() error return Greg Kroah-Hartman
                     ` (16 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit 6e050503a150b2126620c1a1e9b3a368fcd51eac upstream.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/sh/include/asm/uaccess.h |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/arch/sh/include/asm/uaccess.h
+++ b/arch/sh/include/asm/uaccess.h
@@ -151,7 +151,10 @@ copy_from_user(void *to, const void __us
 	__kernel_size_t __copy_size = (__kernel_size_t) n;
 
 	if (__copy_size && __access_ok(__copy_from, __copy_size))
-		return __copy_user(to, from, __copy_size);
+		__copy_size = __copy_user(to, from, __copy_size);
+
+	if (unlikely(__copy_size))
+		memset(to + (n - __copy_size), 0, __copy_size);
 
 	return __copy_size;
 }

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

* [PATCH 4.4 106/118] hexagon: fix strncpy_from_user() error return
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (99 preceding siblings ...)
  2016-09-22 17:30   ` [PATCH 4.4 105/118] sh: fix copy_from_user() Greg Kroah-Hartman
@ 2016-09-22 17:30   ` Greg Kroah-Hartman
  2016-09-22 17:30   ` [PATCH 4.4 107/118] mips: copy_from_user() must zero the destination on access_ok() failure Greg Kroah-Hartman
                     ` (15 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Richard Kuo, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit f35c1e0671728d1c9abc405d05ef548b5fcb2fc4 upstream.

It's -EFAULT, not -1 (and contrary to the comment in there,
__strnlen_user() can return 0 - on faults).

Acked-by: Richard Kuo <rkuo@codeaurora.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/hexagon/include/asm/uaccess.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/arch/hexagon/include/asm/uaccess.h
+++ b/arch/hexagon/include/asm/uaccess.h
@@ -103,7 +103,8 @@ static inline long hexagon_strncpy_from_
 {
 	long res = __strnlen_user(src, n);
 
-	/* return from strnlen can't be zero -- that would be rubbish. */
+	if (unlikely(!res))
+		return -EFAULT;
 
 	if (res > n) {
 		copy_from_user(dst, src, n);

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

* [PATCH 4.4 107/118] mips: copy_from_user() must zero the destination on access_ok() failure
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (100 preceding siblings ...)
  2016-09-22 17:30   ` [PATCH 4.4 106/118] hexagon: fix strncpy_from_user() error return Greg Kroah-Hartman
@ 2016-09-22 17:30   ` Greg Kroah-Hartman
  2016-09-22 17:30   ` [PATCH 4.4 108/118] asm-generic: make copy_from_user() zero the destination properly Greg Kroah-Hartman
                     ` (14 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit e69d700535ac43a18032b3c399c69bf4639e89a2 upstream.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/mips/include/asm/uaccess.h |    3 +++
 1 file changed, 3 insertions(+)

--- a/arch/mips/include/asm/uaccess.h
+++ b/arch/mips/include/asm/uaccess.h
@@ -14,6 +14,7 @@
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/thread_info.h>
+#include <linux/string.h>
 #include <asm/asm-eva.h>
 
 /*
@@ -1170,6 +1171,8 @@ extern size_t __copy_in_user_eva(void *_
 			__cu_len = __invoke_copy_from_user(__cu_to,	\
 							   __cu_from,	\
 							   __cu_len);   \
+		} else {						\
+			memset(__cu_to, 0, __cu_len);			\
 		}							\
 	}								\
 	__cu_len;							\

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

* [PATCH 4.4 108/118] asm-generic: make copy_from_user() zero the destination properly
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (101 preceding siblings ...)
  2016-09-22 17:30   ` [PATCH 4.4 107/118] mips: copy_from_user() must zero the destination on access_ok() failure Greg Kroah-Hartman
@ 2016-09-22 17:30   ` Greg Kroah-Hartman
  2016-09-22 17:30   ` [PATCH 4.4 109/118] alpha: fix copy_from_user() Greg Kroah-Hartman
                     ` (13 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit 2545e5da080b4839dd859e3b09343a884f6ab0e3 upstream.

... in all cases, including the failing access_ok()

Note that some architectures using asm-generic/uaccess.h have
__copy_from_user() not zeroing the tail on failure halfway
through.  This variant works either way.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 include/asm-generic/uaccess.h |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -261,11 +261,13 @@ extern int __get_user_bad(void) __attrib
 static inline long copy_from_user(void *to,
 		const void __user * from, unsigned long n)
 {
+	unsigned long res = n;
 	might_fault();
-	if (access_ok(VERIFY_READ, from, n))
-		return __copy_from_user(to, from, n);
-	else
-		return n;
+	if (likely(access_ok(VERIFY_READ, from, n)))
+		res = __copy_from_user(to, from, n);
+	if (unlikely(res))
+		memset(to + (n - res), 0, res);
+	return res;
 }
 
 static inline long copy_to_user(void __user *to,

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

* [PATCH 4.4 109/118] alpha: fix copy_from_user()
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (102 preceding siblings ...)
  2016-09-22 17:30   ` [PATCH 4.4 108/118] asm-generic: make copy_from_user() zero the destination properly Greg Kroah-Hartman
@ 2016-09-22 17:30   ` Greg Kroah-Hartman
  2016-09-22 17:30   ` [PATCH 4.4 110/118] metag: copy_from_user() should zero the destination on access_ok() failure Greg Kroah-Hartman
                     ` (12 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit 2561d309dfd1555e781484af757ed0115035ddb3 upstream.

it should clear the destination even when access_ok() fails.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/alpha/include/asm/uaccess.h |   19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

--- a/arch/alpha/include/asm/uaccess.h
+++ b/arch/alpha/include/asm/uaccess.h
@@ -371,14 +371,6 @@ __copy_tofrom_user_nocheck(void *to, con
 	return __cu_len;
 }
 
-extern inline long
-__copy_tofrom_user(void *to, const void *from, long len, const void __user *validate)
-{
-	if (__access_ok((unsigned long)validate, len, get_fs()))
-		len = __copy_tofrom_user_nocheck(to, from, len);
-	return len;
-}
-
 #define __copy_to_user(to, from, n)					\
 ({									\
 	__chk_user_ptr(to);						\
@@ -393,17 +385,22 @@ __copy_tofrom_user(void *to, const void
 #define __copy_to_user_inatomic __copy_to_user
 #define __copy_from_user_inatomic __copy_from_user
 
-
 extern inline long
 copy_to_user(void __user *to, const void *from, long n)
 {
-	return __copy_tofrom_user((__force void *)to, from, n, to);
+	if (likely(__access_ok((unsigned long)to, n, get_fs())))
+		n = __copy_tofrom_user_nocheck((__force void *)to, from, n);
+	return n;
 }
 
 extern inline long
 copy_from_user(void *to, const void __user *from, long n)
 {
-	return __copy_tofrom_user(to, (__force void *)from, n, from);
+	if (likely(__access_ok((unsigned long)from, n, get_fs())))
+		n = __copy_tofrom_user_nocheck(to, (__force void *)from, n);
+	else
+		memset(to, 0, n);
+	return n;
 }
 
 extern void __do_clear_user(void);

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

* [PATCH 4.4 110/118] metag: copy_from_user() should zero the destination on access_ok() failure
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (103 preceding siblings ...)
  2016-09-22 17:30   ` [PATCH 4.4 109/118] alpha: fix copy_from_user() Greg Kroah-Hartman
@ 2016-09-22 17:30   ` Greg Kroah-Hartman
  2016-09-22 17:30   ` [PATCH 4.4 111/118] parisc: fix copy_from_user() Greg Kroah-Hartman
                     ` (11 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, James Hogan, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit 8ae95ed4ae5fc7c3391ed668b2014c9e2079533b upstream.

Acked-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/metag/include/asm/uaccess.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/arch/metag/include/asm/uaccess.h
+++ b/arch/metag/include/asm/uaccess.h
@@ -204,8 +204,9 @@ extern unsigned long __must_check __copy
 static inline unsigned long
 copy_from_user(void *to, const void __user *from, unsigned long n)
 {
-	if (access_ok(VERIFY_READ, from, n))
+	if (likely(access_ok(VERIFY_READ, from, n)))
 		return __copy_user_zeroing(to, from, n);
+	memset(to, 0, n);
 	return n;
 }
 

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

* [PATCH 4.4 111/118] parisc: fix copy_from_user()
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (104 preceding siblings ...)
  2016-09-22 17:30   ` [PATCH 4.4 110/118] metag: copy_from_user() should zero the destination on access_ok() failure Greg Kroah-Hartman
@ 2016-09-22 17:30   ` Greg Kroah-Hartman
  2016-09-22 17:30   ` [PATCH 4.4 112/118] openrisc: " Greg Kroah-Hartman
                     ` (10 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit aace880feea38875fbc919761b77e5732a3659ef upstream.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/parisc/include/asm/uaccess.h |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/arch/parisc/include/asm/uaccess.h
+++ b/arch/parisc/include/asm/uaccess.h
@@ -10,6 +10,7 @@
 #include <asm-generic/uaccess-unaligned.h>
 
 #include <linux/bug.h>
+#include <linux/string.h>
 
 #define VERIFY_READ 0
 #define VERIFY_WRITE 1
@@ -245,13 +246,14 @@ static inline unsigned long __must_check
                                           unsigned long n)
 {
         int sz = __compiletime_object_size(to);
-        int ret = -EFAULT;
+        unsigned long ret = n;
 
         if (likely(sz == -1 || !__builtin_constant_p(n) || sz >= n))
                 ret = __copy_from_user(to, from, n);
         else
                 copy_from_user_overflow();
-
+	if (unlikely(ret))
+		memset(to + (n - ret), 0, ret);
         return ret;
 }
 

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

* [PATCH 4.4 112/118] openrisc: fix copy_from_user()
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (105 preceding siblings ...)
  2016-09-22 17:30   ` [PATCH 4.4 111/118] parisc: fix copy_from_user() Greg Kroah-Hartman
@ 2016-09-22 17:30   ` Greg Kroah-Hartman
  2016-09-22 17:30   ` [PATCH 4.4 113/118] nios2: copy_from_user() should zero the tail of destination Greg Kroah-Hartman
                     ` (9 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit acb2505d0119033a80c85ac8d02dccae41271667 upstream.

... that should zero on faults.  Also remove the <censored> helpful
logics wrt range truncation copied from ppc32.  Where it had ever
been needed only in case of copy_from_user() *and* had not been merged
into the mainline until a month after the need had disappeared.
A decade before openrisc went into mainline, I might add...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/openrisc/include/asm/uaccess.h |   33 ++++++++++-----------------------
 1 file changed, 10 insertions(+), 23 deletions(-)

--- a/arch/openrisc/include/asm/uaccess.h
+++ b/arch/openrisc/include/asm/uaccess.h
@@ -273,28 +273,20 @@ __copy_tofrom_user(void *to, const void
 static inline unsigned long
 copy_from_user(void *to, const void *from, unsigned long n)
 {
-	unsigned long over;
+	unsigned long res = n;
 
-	if (access_ok(VERIFY_READ, from, n))
-		return __copy_tofrom_user(to, from, n);
-	if ((unsigned long)from < TASK_SIZE) {
-		over = (unsigned long)from + n - TASK_SIZE;
-		return __copy_tofrom_user(to, from, n - over) + over;
-	}
-	return n;
+	if (likely(access_ok(VERIFY_READ, from, n)))
+		n = __copy_tofrom_user(to, from, n);
+	if (unlikely(res))
+		memset(to + (n - res), 0, res);
+	return res;
 }
 
 static inline unsigned long
 copy_to_user(void *to, const void *from, unsigned long n)
 {
-	unsigned long over;
-
-	if (access_ok(VERIFY_WRITE, to, n))
-		return __copy_tofrom_user(to, from, n);
-	if ((unsigned long)to < TASK_SIZE) {
-		over = (unsigned long)to + n - TASK_SIZE;
-		return __copy_tofrom_user(to, from, n - over) + over;
-	}
+	if (likely(access_ok(VERIFY_WRITE, to, n)))
+		n = __copy_tofrom_user(to, from, n);
 	return n;
 }
 
@@ -303,13 +295,8 @@ extern unsigned long __clear_user(void *
 static inline __must_check unsigned long
 clear_user(void *addr, unsigned long size)
 {
-
-	if (access_ok(VERIFY_WRITE, addr, size))
-		return __clear_user(addr, size);
-	if ((unsigned long)addr < TASK_SIZE) {
-		unsigned long over = (unsigned long)addr + size - TASK_SIZE;
-		return __clear_user(addr, size - over) + over;
-	}
+	if (likely(access_ok(VERIFY_WRITE, addr, size)))
+		size = __clear_user(addr, size);
 	return size;
 }
 

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

* [PATCH 4.4 113/118] nios2: copy_from_user() should zero the tail of destination
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (106 preceding siblings ...)
  2016-09-22 17:30   ` [PATCH 4.4 112/118] openrisc: " Greg Kroah-Hartman
@ 2016-09-22 17:30   ` Greg Kroah-Hartman
  2016-09-22 17:30   ` [PATCH 4.4 114/118] mn10300: copy_from_user() should zero on access_ok() failure Greg Kroah-Hartman
                     ` (8 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit e33d1f6f72cc82fcfc3d1fb20c9e3ad83b1928fa upstream.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/nios2/include/asm/uaccess.h |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

--- a/arch/nios2/include/asm/uaccess.h
+++ b/arch/nios2/include/asm/uaccess.h
@@ -102,9 +102,12 @@ extern long __copy_to_user(void __user *
 static inline long copy_from_user(void *to, const void __user *from,
 				unsigned long n)
 {
-	if (!access_ok(VERIFY_READ, from, n))
-		return n;
-	return __copy_from_user(to, from, n);
+	unsigned long res = n;
+	if (access_ok(VERIFY_READ, from, n))
+		res = __copy_from_user(to, from, n);
+	if (unlikely(res))
+		memset(to + (n - res), 0, res);
+	return res;
 }
 
 static inline long copy_to_user(void __user *to, const void *from,

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

* [PATCH 4.4 114/118] mn10300: copy_from_user() should zero on access_ok() failure...
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (107 preceding siblings ...)
  2016-09-22 17:30   ` [PATCH 4.4 113/118] nios2: copy_from_user() should zero the tail of destination Greg Kroah-Hartman
@ 2016-09-22 17:30   ` Greg Kroah-Hartman
  2016-09-22 17:30   ` [PATCH 4.4 115/118] sparc32: fix copy_from_user() Greg Kroah-Hartman
                     ` (7 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit ae7cc577ec2a4a6151c9e928fd1f595d953ecef1 upstream.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/mn10300/lib/usercopy.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/arch/mn10300/lib/usercopy.c
+++ b/arch/mn10300/lib/usercopy.c
@@ -9,7 +9,7 @@
  * as published by the Free Software Foundation; either version
  * 2 of the Licence, or (at your option) any later version.
  */
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 unsigned long
 __generic_copy_to_user(void *to, const void *from, unsigned long n)
@@ -24,6 +24,8 @@ __generic_copy_from_user(void *to, const
 {
 	if (access_ok(VERIFY_READ, from, n))
 		__copy_user_zeroing(to, from, n);
+	else
+		memset(to, 0, n);
 	return n;
 }
 

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

* [PATCH 4.4 115/118] sparc32: fix copy_from_user()
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (108 preceding siblings ...)
  2016-09-22 17:30   ` [PATCH 4.4 114/118] mn10300: copy_from_user() should zero on access_ok() failure Greg Kroah-Hartman
@ 2016-09-22 17:30   ` Greg Kroah-Hartman
  2016-09-22 17:30   ` [PATCH 4.4 116/118] ppc32: " Greg Kroah-Hartman
                     ` (6 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, David S. Miller, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit 917400cecb4b52b5cde5417348322bb9c8272fa6 upstream.

Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/sparc/include/asm/uaccess_32.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/arch/sparc/include/asm/uaccess_32.h
+++ b/arch/sparc/include/asm/uaccess_32.h
@@ -328,8 +328,10 @@ static inline unsigned long copy_from_us
 {
 	if (n && __access_ok((unsigned long) from, n))
 		return __copy_user((__force void __user *) to, from, n);
-	else
+	else {
+		memset(to, 0, n);
 		return n;
+	}
 }
 
 static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n)

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

* [PATCH 4.4 116/118] ppc32: fix copy_from_user()
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (109 preceding siblings ...)
  2016-09-22 17:30   ` [PATCH 4.4 115/118] sparc32: fix copy_from_user() Greg Kroah-Hartman
@ 2016-09-22 17:30   ` Greg Kroah-Hartman
  2016-09-22 17:30   ` [PATCH 4.4 117/118] genirq/msi: Fix broken debug output Greg Kroah-Hartman
                     ` (5 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit 224264657b8b228f949b42346e09ed8c90136a8e upstream.

should clear on access_ok() failures.  Also remove the useless
range truncation logics.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/include/asm/uaccess.h |   21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)

--- a/arch/powerpc/include/asm/uaccess.h
+++ b/arch/powerpc/include/asm/uaccess.h
@@ -323,30 +323,17 @@ extern unsigned long __copy_tofrom_user(
 static inline unsigned long copy_from_user(void *to,
 		const void __user *from, unsigned long n)
 {
-	unsigned long over;
-
-	if (access_ok(VERIFY_READ, from, n))
+	if (likely(access_ok(VERIFY_READ, from, n)))
 		return __copy_tofrom_user((__force void __user *)to, from, n);
-	if ((unsigned long)from < TASK_SIZE) {
-		over = (unsigned long)from + n - TASK_SIZE;
-		return __copy_tofrom_user((__force void __user *)to, from,
-				n - over) + over;
-	}
++	memset(to, 0, n);
 	return n;
 }
 
 static inline unsigned long copy_to_user(void __user *to,
 		const void *from, unsigned long n)
 {
-	unsigned long over;
-
 	if (access_ok(VERIFY_WRITE, to, n))
 		return __copy_tofrom_user(to, (__force void __user *)from, n);
-	if ((unsigned long)to < TASK_SIZE) {
-		over = (unsigned long)to + n - TASK_SIZE;
-		return __copy_tofrom_user(to, (__force void __user *)from,
-				n - over) + over;
-	}
 	return n;
 }
 
@@ -437,10 +424,6 @@ static inline unsigned long clear_user(v
 	might_fault();
 	if (likely(access_ok(VERIFY_WRITE, addr, size)))
 		return __clear_user(addr, size);
-	if ((unsigned long)addr < TASK_SIZE) {
-		unsigned long over = (unsigned long)addr + size - TASK_SIZE;
-		return __clear_user(addr, size - over) + over;
-	}
 	return size;
 }
 

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

* [PATCH 4.4 117/118] genirq/msi: Fix broken debug output
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (110 preceding siblings ...)
  2016-09-22 17:30   ` [PATCH 4.4 116/118] ppc32: " Greg Kroah-Hartman
@ 2016-09-22 17:30   ` Greg Kroah-Hartman
  2016-09-22 17:30   ` [PATCH 4.4 118/118] ia64: copy_from_user() should zero the destination on access_ok() failure Greg Kroah-Hartman
                     ` (4 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ingo Molnar, Thomas Gleixner

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

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

From: Thomas Gleixner <tglx@linutronix.de>

commit 4364e1a29be16b2783c0bcbc263f61236af64281 upstream.

virq is not required to be the same for all msi descs. Use the base irq number
from the desc in the debug printk.

Reported-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 kernel/irq/msi.c |    1 +
 1 file changed, 1 insertion(+)

--- a/kernel/irq/msi.c
+++ b/kernel/irq/msi.c
@@ -298,6 +298,7 @@ int msi_domain_alloc_irqs(struct irq_dom
 		ops->msi_finish(&arg, 0);
 
 	for_each_msi_entry(desc, dev) {
+		virq = desc->irq;
 		if (desc->nvec_used == 1)
 			dev_dbg(dev, "irq %d for MSI\n", virq);
 		else

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

* [PATCH 4.4 118/118] ia64: copy_from_user() should zero the destination on access_ok() failure
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (111 preceding siblings ...)
  2016-09-22 17:30   ` [PATCH 4.4 117/118] genirq/msi: Fix broken debug output Greg Kroah-Hartman
@ 2016-09-22 17:30   ` Greg Kroah-Hartman
  2016-09-22 19:56   ` [PATCH 4.4 000/118] 4.4.22-stable review Holger Hoffstätte
                     ` (3 subsequent siblings)
  116 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-22 17:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit a5e541f796f17228793694d64b507f5f57db4cd7 upstream.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/ia64/include/asm/uaccess.h |   20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

--- a/arch/ia64/include/asm/uaccess.h
+++ b/arch/ia64/include/asm/uaccess.h
@@ -263,17 +263,15 @@ __copy_from_user (void *to, const void _
 	__cu_len;									\
 })
 
-#define copy_from_user(to, from, n)							\
-({											\
-	void *__cu_to = (to);								\
-	const void __user *__cu_from = (from);						\
-	long __cu_len = (n);								\
-											\
-	__chk_user_ptr(__cu_from);							\
-	if (__access_ok(__cu_from, __cu_len, get_fs()))					\
-		__cu_len = __copy_user((__force void __user *) __cu_to, __cu_from, __cu_len);	\
-	__cu_len;									\
-})
+static inline unsigned long
+copy_from_user(void *to, const void __user *from, unsigned long n)
+{
+	if (likely(__access_ok(from, n, get_fs())))
+		n = __copy_user((__force void __user *) to, from, n);
+	else
+		memset(to, 0, n);
+	return n;
+}
 
 #define __copy_in_user(to, from, size)	__copy_user((to), (from), (size))
 

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

* Re: [PATCH 4.4 000/118] 4.4.22-stable review
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (112 preceding siblings ...)
  2016-09-22 17:30   ` [PATCH 4.4 118/118] ia64: copy_from_user() should zero the destination on access_ok() failure Greg Kroah-Hartman
@ 2016-09-22 19:56   ` Holger Hoffstätte
  2016-09-23  8:14       ` Greg Kroah-Hartman
  2016-09-22 23:43   ` Guenter Roeck
                     ` (2 subsequent siblings)
  116 siblings, 1 reply; 143+ messages in thread
From: Holger Hoffstätte @ 2016-09-22 19:56 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: torvalds, akpm, linux, shuah.kh, patches, ben.hutchings, stable

On 09/22/16 19:28, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.4.22 release.
> There are 118 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.

Greg,

did you forget to add the -net patches in stable-queue.git/tree/net-4.4
or are they on hold for some reason? I think they were supposed to go
into .22.

Holger

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

* Re: [PATCH 4.4 000/118] 4.4.22-stable review
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (113 preceding siblings ...)
  2016-09-22 19:56   ` [PATCH 4.4 000/118] 4.4.22-stable review Holger Hoffstätte
@ 2016-09-22 23:43   ` Guenter Roeck
  2016-09-23  3:01   ` Guenter Roeck
  2016-09-23 16:02   ` Shuah Khan
  116 siblings, 0 replies; 143+ messages in thread
From: Guenter Roeck @ 2016-09-22 23:43 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, torvalds, akpm, shuah.kh, patches, ben.hutchings, stable

On Thu, Sep 22, 2016 at 07:28:20PM +0200, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.4.22 release.
> There are 118 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 Sat Sep 24 17:29:17 UTC 2016.
> Anything received after that time might be too late.
> 
Build results:
	total: 149 pass: 136 fail: 13
Failed builds:
	avr32:defconfig
	avr32:allnoconfig
	avr32:merisc_defconfig
	avr32:atngw100mkii_evklcd101_defconfig
	powerpc:defconfig
	powerpc:allmodconfig
	powerpc:allnoconfig
	powerpc:ppc6xx_defconfig
	powerpc:mpc83xx_defconfig
	powerpc:tqm8xx_defconfig
	powerpc:85xx/sbc8548_defconfig
	powerpc:83xx/mpc834x_mds_defconfig
	powerpc:86xx/sbc8641d_defconfig

Qemu test results:
	total: 101 pass: 90 fail: 11
Failed tests:
	openrisc:or1ksim_defconfig
	powerpc:mac99:nosmp:ppc_book3s_defconfig
	powerpc:g3beige:nosmp:ppc_book3s_defconfig
	powerpc:mac99:smp:ppc_book3s_defconfig
	powerpc:virtex-ml507:44x/virtex5_defconfig
	powerpc:mpc8548cds:85xx/mpc85xx_cds_defconfig
	powerpc:mpc8548cds:smpdev:85xx/mpc85xx_cds_defconfig
	powerpc:bamboo:44x/bamboo_defconfig
	powerpc:mac99:ppc64_book3s_defconfig:nosmp
	powerpc:mac99:ppc64_book3s_defconfig:smp4
	powerpc:pseries:pseries_defconfig

Build errors:

avr32:

arch/avr32/kernel/built-in.o: In function `arch_ptrace':
(.text+0x810): undefined reference to `___copy_from_user'
arch/avr32/kernel/built-in.o:(___ksymtab+___copy_from_user+0x0): undefined
reference to `___copy_from_user'
kernel/built-in.o: In function `devm_request_resource':
(.text+0x52c8): undefined reference to `___copy_from_user'
kernel/built-in.o: In function `proc_do_large_bitmap':
(.text+0x588c): undefined reference to `___copy_from_user'
kernel/built-in.o: In function `proc_dostring':
(.text+0x5b20): undefined reference to `___copy_from_user'
kernel/built-in.o:sysctl.c:(.text+0x6088): more undefined references to
`___copy_from_user' follow

Hmm .. I've seen that before. Looks like a missing commit from upstream.
I'll check later tonight.

---

powerpc:

drivers/misc/cxl/vphb.c:263:9: error: 'pcibios_free_controller_deferred'
undeclared

arch/powerpc/include/asm/uaccess.h: In function 'copy_from_user':
arch/powerpc/include/asm/uaccess.h:328:1: error: wrong type argument to unary plus
 + memset(to, 0, n);

I'll have to look into those.

---

runtime:

qemu openrisc crashes with a NULL pointer dereference. There is no backtrace;
I'll have to bisect.

qemu ppc all fail to build with "drivers/misc/cxl/vphb.c:263:9: error:
'pcibios_free_controller_deferred' undeclared".


Details are available at http://kerneltests.org/builders.

Guenter

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

* Re: [PATCH 4.4 000/118] 4.4.22-stable review
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (114 preceding siblings ...)
  2016-09-22 23:43   ` Guenter Roeck
@ 2016-09-23  3:01   ` Guenter Roeck
  2016-09-23  8:05     ` Greg Kroah-Hartman
                       ` (3 more replies)
  2016-09-23 16:02   ` Shuah Khan
  116 siblings, 4 replies; 143+ messages in thread
From: Guenter Roeck @ 2016-09-23  3:01 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: torvalds, akpm, shuah.kh, patches, ben.hutchings, stable

On 09/22/2016 10:28 AM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.4.22 release.
> There are 118 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 Sat Sep 24 17:29:17 UTC 2016.
> Anything received after that time might be too late.
>

avr32:

upstream patch 65c0044ca8d7 ("avr32: fix 'undefined reference to `___copy_from_user'")
	is needed in both v4.4 and v4.7 to fix the build problem.

ppc:

5b675d932899 ("ppc32: fix copy_from_user()")
	is corrupt in both v4.4 and v4.7.

e5767a13d7cb ("cxl: use pcibios_free_controller_deferred() when removing vPHBs")
	does not apply to v4.4 nor to v4.7 (and isn't marked stable ???).

openrisc:

upstream patch 8e4b72054f55 ("openrisc: fix the fix of copy_from_user()")
	is needed in both v4.4 and v4.7 to fix the runtime problem.

Guenter

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

* Re: [PATCH 4.4 000/118] 4.4.22-stable review
  2016-09-23  3:01   ` Guenter Roeck
@ 2016-09-23  8:05     ` Greg Kroah-Hartman
  2016-09-23  8:08     ` Greg Kroah-Hartman
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-23  8:05 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: linux-kernel, torvalds, akpm, shuah.kh, patches, ben.hutchings, stable

On Thu, Sep 22, 2016 at 08:01:35PM -0700, Guenter Roeck wrote:
> ppc:
> 
> 5b675d932899 ("ppc32: fix copy_from_user()")
> 	is corrupt in both v4.4 and v4.7.

Ugh, my fault, now fixed up.

greg k-h

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

* Re: [PATCH 4.4 000/118] 4.4.22-stable review
  2016-09-23  3:01   ` Guenter Roeck
  2016-09-23  8:05     ` Greg Kroah-Hartman
@ 2016-09-23  8:08     ` Greg Kroah-Hartman
  2016-09-23 13:25       ` Guenter Roeck
  2016-09-23  8:10     ` Greg Kroah-Hartman
  2016-09-23  8:11     ` Greg Kroah-Hartman
  3 siblings, 1 reply; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-23  8:08 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: linux-kernel, torvalds, akpm, shuah.kh, patches, ben.hutchings, stable

On Thu, Sep 22, 2016 at 08:01:35PM -0700, Guenter Roeck wrote:
> e5767a13d7cb ("cxl: use pcibios_free_controller_deferred() when removing vPHBs")
> 	does not apply to v4.4 nor to v4.7 (and isn't marked stable ???).

I don't understand what you mean here.  It did apply, and it was marked
for stable inclusion.  It is commit
6f38a8b9a45833495dc878c335c5431cd98a16ed in Linus's tree.  Does it break
the build?

thanks,

greg k-h

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

* Re: [PATCH 4.4 000/118] 4.4.22-stable review
  2016-09-23  3:01   ` Guenter Roeck
  2016-09-23  8:05     ` Greg Kroah-Hartman
  2016-09-23  8:08     ` Greg Kroah-Hartman
@ 2016-09-23  8:10     ` Greg Kroah-Hartman
  2016-09-23  8:11     ` Greg Kroah-Hartman
  3 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-23  8:10 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: linux-kernel, torvalds, akpm, shuah.kh, patches, ben.hutchings, stable

On Thu, Sep 22, 2016 at 08:01:35PM -0700, Guenter Roeck wrote:
> On 09/22/2016 10:28 AM, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.4.22 release.
> > There are 118 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 Sat Sep 24 17:29:17 UTC 2016.
> > Anything received after that time might be too late.
> > 
> 
> avr32:
> 
> upstream patch 65c0044ca8d7 ("avr32: fix 'undefined reference to `___copy_from_user'")
> 	is needed in both v4.4 and v4.7 to fix the build problem.

Now applied, thanks.

greg k-h

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

* Re: [PATCH 4.4 000/118] 4.4.22-stable review
  2016-09-23  3:01   ` Guenter Roeck
                       ` (2 preceding siblings ...)
  2016-09-23  8:10     ` Greg Kroah-Hartman
@ 2016-09-23  8:11     ` Greg Kroah-Hartman
  3 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-23  8:11 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: linux-kernel, torvalds, akpm, shuah.kh, patches, ben.hutchings, stable

On Thu, Sep 22, 2016 at 08:01:35PM -0700, Guenter Roeck wrote:
> On 09/22/2016 10:28 AM, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.4.22 release.
> > There are 118 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 Sat Sep 24 17:29:17 UTC 2016.
> > Anything received after that time might be too late.
> > 
> 
> openrisc:
> 
> upstream patch 8e4b72054f55 ("openrisc: fix the fix of copy_from_user()")
> 	is needed in both v4.4 and v4.7 to fix the runtime problem.

Now applied.

So, I think we should have fixed all of the build issues, but I do still
have that question for you about the cxl driver that I don't understand.

thanks,

greg k-h

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

* Re: [PATCH 4.4 000/118] 4.4.22-stable review
  2016-09-22 19:56   ` [PATCH 4.4 000/118] 4.4.22-stable review Holger Hoffstätte
@ 2016-09-23  8:14       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-23  8:14 UTC (permalink / raw)
  To: Holger Hoffstätte
  Cc: linux-kernel, torvalds, akpm, linux, shuah.kh, patches,
	ben.hutchings, stable

On Thu, Sep 22, 2016 at 09:56:28PM +0200, Holger Hoffstätte wrote:
> On 09/22/16 19:28, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.4.22 release.
> > There are 118 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.
> 
> Greg,
> 
> did you forget to add the -net patches in stable-queue.git/tree/net-4.4
> or are they on hold for some reason? I think they were supposed to go
> into .22.

Really?  I just put them there as I was pondering applying them, waiting
for the network maintainer to send me some more patches, or not.  They
aren't all correct, and are missing some patches, I just haven't gotten
the chance to do the work yet.

Why do you think they should go into this release?

thanks,

greg k-h

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

* Re: [PATCH 4.4 000/118] 4.4.22-stable review
@ 2016-09-23  8:14       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-23  8:14 UTC (permalink / raw)
  To: Holger Hoffstätte
  Cc: linux-kernel, torvalds, akpm, linux, shuah.kh, patches,
	ben.hutchings, stable

On Thu, Sep 22, 2016 at 09:56:28PM +0200, Holger Hoffst�tte wrote:
> On 09/22/16 19:28, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.4.22 release.
> > There are 118 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.
> 
> Greg,
> 
> did you forget to add the -net patches in stable-queue.git/tree/net-4.4
> or are they on hold for some reason? I think they were supposed to go
> into .22.

Really?  I just put them there as I was pondering applying them, waiting
for the network maintainer to send me some more patches, or not.  They
aren't all correct, and are missing some patches, I just haven't gotten
the chance to do the work yet.

Why do you think they should go into this release?

thanks,

greg k-h

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

* Re: [PATCH 4.4 000/118] 4.4.22-stable review
  2016-09-23  8:14       ` Greg Kroah-Hartman
  (?)
@ 2016-09-23  8:43       ` Holger Hoffstätte
  2016-09-23  9:21           ` Greg Kroah-Hartman
  -1 siblings, 1 reply; 143+ messages in thread
From: Holger Hoffstätte @ 2016-09-23  8:43 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, torvalds, akpm, linux, shuah.kh, patches,
	ben.hutchings, stable

On 09/23/16 10:14, Greg Kroah-Hartman wrote:
> On Thu, Sep 22, 2016 at 09:56:28PM +0200, Holger Hoffstätte wrote:
>> did you forget to add the -net patches in stable-queue.git/tree/net-4.4
>> or are they on hold for some reason? I think they were supposed to go
>> into .22.
> 
> Really?  I just put them there as I was pondering applying them, waiting
> for the network maintainer to send me some more patches, or not.  They

Ahh..alright then.

> Why do you think they should go into this release?

Never mind - they are not really urgent. I just had most of them merged
locally already and was just wondering.

thanks.

Holger

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

* Re: [PATCH 4.4 000/118] 4.4.22-stable review
  2016-09-23  8:43       ` Holger Hoffstätte
@ 2016-09-23  9:21           ` Greg Kroah-Hartman
  0 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-23  9:21 UTC (permalink / raw)
  To: Holger Hoffstätte
  Cc: linux-kernel, torvalds, akpm, linux, shuah.kh, patches,
	ben.hutchings, stable

On Fri, Sep 23, 2016 at 10:43:27AM +0200, Holger Hoffstätte wrote:
> On 09/23/16 10:14, Greg Kroah-Hartman wrote:
> > On Thu, Sep 22, 2016 at 09:56:28PM +0200, Holger Hoffstätte wrote:
> >> did you forget to add the -net patches in stable-queue.git/tree/net-4.4
> >> or are they on hold for some reason? I think they were supposed to go
> >> into .22.
> > 
> > Really?  I just put them there as I was pondering applying them, waiting
> > for the network maintainer to send me some more patches, or not.  They
> 
> Ahh..alright then.
> 
> > Why do you think they should go into this release?
> 
> Never mind - they are not really urgent. I just had most of them merged
> locally already and was just wondering.

If you have them merged, and tested, mind sending them to me with your
tested-by mark on them?  That way I know they work and can focus on the
ones that will require backporting effort.

thanks,

greg k-h

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

* Re: [PATCH 4.4 000/118] 4.4.22-stable review
@ 2016-09-23  9:21           ` Greg Kroah-Hartman
  0 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-23  9:21 UTC (permalink / raw)
  To: Holger Hoffstätte
  Cc: linux-kernel, torvalds, akpm, linux, shuah.kh, patches,
	ben.hutchings, stable

On Fri, Sep 23, 2016 at 10:43:27AM +0200, Holger Hoffst�tte wrote:
> On 09/23/16 10:14, Greg Kroah-Hartman wrote:
> > On Thu, Sep 22, 2016 at 09:56:28PM +0200, Holger Hoffst�tte wrote:
> >> did you forget to add the -net patches in stable-queue.git/tree/net-4.4
> >> or are they on hold for some reason? I think they were supposed to go
> >> into .22.
> > 
> > Really?  I just put them there as I was pondering applying them, waiting
> > for the network maintainer to send me some more patches, or not.  They
> 
> Ahh..alright then.
> 
> > Why do you think they should go into this release?
> 
> Never mind - they are not really urgent. I just had most of them merged
> locally already and was just wondering.

If you have them merged, and tested, mind sending them to me with your
tested-by mark on them?  That way I know they work and can focus on the
ones that will require backporting effort.

thanks,

greg k-h

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

* Re: [PATCH 4.4 000/118] 4.4.22-stable review
  2016-09-23  9:21           ` Greg Kroah-Hartman
  (?)
@ 2016-09-23 10:57           ` Holger Hoffstätte
  2016-09-23 15:13             ` Greg Kroah-Hartman
  -1 siblings, 1 reply; 143+ messages in thread
From: Holger Hoffstätte @ 2016-09-23 10:57 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: patches, ben.hutchings, stable

[-- Attachment #1: Type: text/plain, Size: 1448 bytes --]

(trimmed To:)

On 09/23/16 11:21, Greg Kroah-Hartman wrote:
> On Fri, Sep 23, 2016 at 10:43:27AM +0200, Holger Hoffstätte wrote:
>> On 09/23/16 10:14, Greg Kroah-Hartman wrote:
>>> On Thu, Sep 22, 2016 at 09:56:28PM +0200, Holger Hoffstätte wrote:
>>>> did you forget to add the -net patches in stable-queue.git/tree/net-4.4
>>>> or are they on hold for some reason? I think they were supposed to go
>>>> into .22.
>>>
>>> Really?  I just put them there as I was pondering applying them, waiting
>>> for the network maintainer to send me some more patches, or not.  They
>>
>> Ahh..alright then.
>>
>>> Why do you think they should go into this release?
>>
>> Never mind - they are not really urgent. I just had most of them merged
>> locally already and was just wondering.
> 
> If you have them merged, and tested, mind sending them to me with your
> tested-by mark on them?  That way I know they work and can focus on the
> ones that will require backporting effort.

Attached. All with Tested-By are working and have done so for some
time without issue (mixed ipv4/6 network in various functions).

ipv6-addrconf-fix-dev-refcont-leak-when-dad-failed:
seems to be already applied from a previous series, not sure which.

tcp-cwnd-does-not-increase-in-tcp-yeah:
For this I can only offer a Reviewed-by: since I cannot test it,
but I did check that the code does what the comment says, and it
merges/compiles cleanly.

Hope this helps.

Holger


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ipv4-panic-in-leaf_walk_rcu-due-to-stale-node-pointer.patch --]
[-- Type: text/x-patch; name="ipv4-panic-in-leaf_walk_rcu-due-to-stale-node-pointer.patch", Size: 3992 bytes --]

>From foo@baz Wed Sep 21 12:45:10 CEST 2016
From: David Forster <dforster@brocade.com>
Date: Wed, 3 Aug 2016 15:13:01 +0100
Subject: ipv4: panic in leaf_walk_rcu due to stale node pointer

From: David Forster <dforster@brocade.com>


[ Upstream commit 94d9f1c5906b20053efe375b6d66610bca4b8b64 ]

Panic occurs when issuing "cat /proc/net/route" whilst
populating FIB with > 1M routes.

Use of cached node pointer in fib_route_get_idx is unsafe.

 BUG: unable to handle kernel paging request at ffffc90001630024
 IP: [<ffffffff814cf6a0>] leaf_walk_rcu+0x10/0xe0
 PGD 11b08d067 PUD 11b08e067 PMD dac4b067 PTE 0
 Oops: 0000 [#1] SMP
 Modules linked in: nfsd auth_rpcgss oid_registry nfs_acl nfs lockd grace fscac
 snd_hda_codec_generic snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep virti
 acpi_cpufreq button parport_pc ppdev lp parport autofs4 ext4 crc16 mbcache jbd
tio_ring virtio floppy uhci_hcd ehci_hcd usbcore usb_common libata scsi_mod
 CPU: 1 PID: 785 Comm: cat Not tainted 4.2.0-rc8+ #4
 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2007
 task: ffff8800da1c0bc0 ti: ffff88011a05c000 task.ti: ffff88011a05c000
 RIP: 0010:[<ffffffff814cf6a0>]  [<ffffffff814cf6a0>] leaf_walk_rcu+0x10/0xe0
 RSP: 0018:ffff88011a05fda0  EFLAGS: 00010202
 RAX: ffff8800d8a40c00 RBX: ffff8800da4af940 RCX: ffff88011a05ff20
 RDX: ffffc90001630020 RSI: 0000000001013531 RDI: ffff8800da4af950
 RBP: 0000000000000000 R08: ffff8800da1f9a00 R09: 0000000000000000
 R10: ffff8800db45b7e4 R11: 0000000000000246 R12: ffff8800da4af950
 R13: ffff8800d97a74c0 R14: 0000000000000000 R15: ffff8800d97a7480
 FS:  00007fd3970e0700(0000) GS:ffff88011fd00000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
 CR2: ffffc90001630024 CR3: 000000011a7e4000 CR4: 00000000000006e0
 Stack:
  ffffffff814d00d3 0000000000000000 ffff88011a05ff20 ffff8800da1f9a00
  ffffffff811dd8b9 0000000000000800 0000000000020000 00007fd396f35000
  ffffffff811f8714 0000000000003431 ffffffff8138dce0 0000000000000f80
 Call Trace:
  [<ffffffff814d00d3>] ? fib_route_seq_start+0x93/0xc0
  [<ffffffff811dd8b9>] ? seq_read+0x149/0x380
  [<ffffffff811f8714>] ? fsnotify+0x3b4/0x500
  [<ffffffff8138dce0>] ? process_echoes+0x70/0x70
  [<ffffffff8121cfa7>] ? proc_reg_read+0x47/0x70
  [<ffffffff811bb823>] ? __vfs_read+0x23/0xd0
  [<ffffffff811bbd42>] ? rw_verify_area+0x52/0xf0
  [<ffffffff811bbe61>] ? vfs_read+0x81/0x120
  [<ffffffff811bcbc2>] ? SyS_read+0x42/0xa0
  [<ffffffff81549ab2>] ? entry_SYSCALL_64_fastpath+0x16/0x75
 Code: 48 85 c0 75 d8 f3 c3 31 c0 c3 f3 c3 66 66 66 66 66 66 2e 0f 1f 84 00 00
a 04 89 f0 33 02 44 89 c9 48 d3 e8 0f b6 4a 05 49 89
 RIP  [<ffffffff814cf6a0>] leaf_walk_rcu+0x10/0xe0
  RSP <ffff88011a05fda0>
 CR2: ffffc90001630024

Signed-off-by: Dave Forster <dforster@brocade.com>
Acked-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tested-by: Holger Hoffstätte <holger@applied-asynchrony.com>
---
 net/ipv4/fib_trie.c |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -2453,9 +2453,7 @@ struct fib_route_iter {
 static struct key_vector *fib_route_get_idx(struct fib_route_iter *iter,
 					    loff_t pos)
 {
-	struct fib_table *tb = iter->main_tb;
 	struct key_vector *l, **tp = &iter->tnode;
-	struct trie *t;
 	t_key key;
 
 	/* use cache location of next-to-find key */
@@ -2463,8 +2461,6 @@ static struct key_vector *fib_route_get_
 		pos -= iter->pos;
 		key = iter->key;
 	} else {
-		t = (struct trie *)tb->tb_data;
-		iter->tnode = t->kv;
 		iter->pos = 0;
 		key = 0;
 	}
@@ -2505,12 +2501,12 @@ static void *fib_route_seq_start(struct
 		return NULL;
 
 	iter->main_tb = tb;
+	t = (struct trie *)tb->tb_data;
+	iter->tnode = t->kv;
 
 	if (*pos != 0)
 		return fib_route_get_idx(iter, *pos);
 
-	t = (struct trie *)tb->tb_data;
-	iter->tnode = t->kv;
 	iter->pos = 0;
 	iter->key = 0;
 

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: ipv6-release-dst-in-ping_v6_sendmsg.patch --]
[-- Type: text/x-patch; name="ipv6-release-dst-in-ping_v6_sendmsg.patch", Size: 1594 bytes --]

>From foo@baz Wed Sep 21 12:45:10 CEST 2016
From: Dave Jones <davej@codemonkey.org.uk>
Date: Fri, 2 Sep 2016 14:39:50 -0400
Subject: ipv6: release dst in ping_v6_sendmsg

From: Dave Jones <davej@codemonkey.org.uk>


[ Upstream commit 03c2778a938aaba0893f6d6cdc29511d91a79848 ]

Neither the failure or success paths of ping_v6_sendmsg release
the dst it acquires.  This leads to a flood of warnings from
"net/core/dst.c:288 dst_release" on older kernels that
don't have 8bf4ada2e21378816b28205427ee6b0e1ca4c5f1 backported.

That patch optimistically hoped this had been fixed post 3.10, but
it seems at least one case wasn't, where I've seen this triggered
a lot from machines doing unprivileged icmp sockets.

Cc: Martin Lau <kafai@fb.com>
Signed-off-by: Dave Jones <davej@codemonkey.org.uk>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tested-by: Holger Hoffstätte <holger@applied-asynchrony.com>
---
 net/ipv6/ping.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

--- a/net/ipv6/ping.c
+++ b/net/ipv6/ping.c
@@ -150,8 +150,10 @@ int ping_v6_sendmsg(struct sock *sk, str
 	rt = (struct rt6_info *) dst;
 
 	np = inet6_sk(sk);
-	if (!np)
-		return -EBADF;
+	if (!np) {
+		err = -EBADF;
+		goto dst_err_out;
+	}
 
 	if (!fl6.flowi6_oif && ipv6_addr_is_multicast(&fl6.daddr))
 		fl6.flowi6_oif = np->mcast_oif;
@@ -186,6 +188,9 @@ int ping_v6_sendmsg(struct sock *sk, str
 	}
 	release_sock(sk);
 
+dst_err_out:
+	dst_release(dst);
+
 	if (err)
 		return err;
 

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: tcp-cwnd-does-not-increase-in-tcp-yeah.patch --]
[-- Type: text/x-patch; name="tcp-cwnd-does-not-increase-in-tcp-yeah.patch", Size: 1398 bytes --]

>From foo@baz Wed Sep 21 12:45:10 CEST 2016
From: Artem Germanov <agermanov@anchorfree.com>
Date: Wed, 7 Sep 2016 10:49:36 -0700
Subject: tcp: cwnd does not increase in TCP YeAH

From: Artem Germanov <agermanov@anchorfree.com>


[ Upstream commit db7196a0d0984b933ccf2cd6a60e26abf466e8a3 ]

Commit 76174004a0f19785a328f40388e87e982bbf69b9
(tcp: do not slow start when cwnd equals ssthresh )
introduced regression in TCP YeAH. Using 100ms delay 1% loss virtual
ethernet link kernel 4.2 shows bandwidth ~500KB/s for single TCP
connection and kernel 4.3 and above (including 4.8-rc4) shows bandwidth
~100KB/s.
   That is caused by stalled cwnd when cwnd equals ssthresh. This patch
fixes it by proper increasing cwnd in this case.

Signed-off-by: Artem Germanov <agermanov@anchorfree.com>
Acked-by: Dmitry Adamushko <d.adamushko@anchorfree.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Holger Hoffstätte <holger@applied-asynchrony.com>
---
 net/ipv4/tcp_yeah.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/ipv4/tcp_yeah.c
+++ b/net/ipv4/tcp_yeah.c
@@ -75,7 +75,7 @@ static void tcp_yeah_cong_avoid(struct s
 	if (!tcp_is_cwnd_limited(sk))
 		return;
 
-	if (tp->snd_cwnd <= tp->snd_ssthresh)
+	if (tcp_in_slow_start(tp))
 		tcp_slow_start(tp, acked);
 
 	else if (!yeah->doing_reno_now) {

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: tcp-fix-use-after-free-in-tcp_xmit_retransmit_queue.patch --]
[-- Type: text/x-patch; name="tcp-fix-use-after-free-in-tcp_xmit_retransmit_queue.patch", Size: 2039 bytes --]

>From foo@baz Wed Sep 21 12:45:10 CEST 2016
From: Eric Dumazet <edumazet@google.com>
Date: Wed, 17 Aug 2016 05:56:26 -0700
Subject: tcp: fix use after free in tcp_xmit_retransmit_queue()

From: Eric Dumazet <edumazet@google.com>


[ Upstream commit bb1fceca22492109be12640d49f5ea5a544c6bb4 ]

When tcp_sendmsg() allocates a fresh and empty skb, it puts it at the
tail of the write queue using tcp_add_write_queue_tail()

Then it attempts to copy user data into this fresh skb.

If the copy fails, we undo the work and remove the fresh skb.

Unfortunately, this undo lacks the change done to tp->highest_sack and
we can leave a dangling pointer (to a freed skb)

Later, tcp_xmit_retransmit_queue() can dereference this pointer and
access freed memory. For regular kernels where memory is not unmapped,
this might cause SACK bugs because tcp_highest_sack_seq() is buggy,
returning garbage instead of tp->snd_nxt, but with various debug
features like CONFIG_DEBUG_PAGEALLOC, this can crash the kernel.

This bug was found by Marco Grassi thanks to syzkaller.

Fixes: 6859d49475d4 ("[TCP]: Abstract tp->highest_sack accessing & point to next skb")
Reported-by: Marco Grassi <marco.gra@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Ilpo J�rvinen <ilpo.jarvinen@helsinki.fi>
Cc: Yuchung Cheng <ycheng@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Reviewed-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tested-by: Holger Hoffst�tte <holger@applied-asynchrony.com>
---
 include/net/tcp.h |    2 ++
 1 file changed, 2 insertions(+)

--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1510,6 +1510,8 @@ static inline void tcp_check_send_head(s
 {
 	if (sk->sk_send_head == skb_unlinked)
 		sk->sk_send_head = NULL;
+	if (tcp_sk(sk)->highest_sack == skb_unlinked)
+		tcp_sk(sk)->highest_sack = NULL;
 }
 
 static inline void tcp_init_send_head(struct sock *sk)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: tcp-properly-scale-window-in-tcp_v_reqsk_send_ack.patch --]
[-- Type: text/x-patch; name="tcp-properly-scale-window-in-tcp_v_reqsk_send_ack.patch", Size: 2868 bytes --]

>From foo@baz Wed Sep 21 12:45:10 CEST 2016
From: Eric Dumazet <edumazet@google.com>
Date: Mon, 22 Aug 2016 11:31:10 -0700
Subject: tcp: properly scale window in tcp_v[46]_reqsk_send_ack()

From: Eric Dumazet <edumazet@google.com>


[ Upstream commit 20a2b49fc538540819a0c552877086548cff8d8d ]

When sending an ack in SYN_RECV state, we must scale the offered
window if wscale option was negotiated and accepted.

Tested:
 Following packetdrill test demonstrates the issue :

0.000 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0

+0 bind(3, ..., ...) = 0
+0 listen(3, 1) = 0

// Establish a connection.
+0 < S 0:0(0) win 20000 <mss 1000,sackOK,wscale 7, nop, TS val 100 ecr 0>
+0 > S. 0:0(0) ack 1 win 28960 <mss 1460,sackOK, TS val 100 ecr 100, nop, wscale 7>

+0 < . 1:11(10) ack 1 win 156 <nop,nop,TS val 99 ecr 100>
// check that window is properly scaled !
+0 > . 1:1(0) ack 1 win 226 <nop,nop,TS val 200 ecr 100>

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Yuchung Cheng <ycheng@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tested-by: Holger Hoffstätte <holger@applied-asynchrony.com>
---
 net/ipv4/tcp_ipv4.c |    8 +++++++-
 net/ipv6/tcp_ipv6.c |    8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -808,8 +808,14 @@ static void tcp_v4_reqsk_send_ack(const
 	u32 seq = (sk->sk_state == TCP_LISTEN) ? tcp_rsk(req)->snt_isn + 1 :
 					     tcp_sk(sk)->snd_nxt;
 
+	/* RFC 7323 2.3
+	 * The window field (SEG.WND) of every outgoing segment, with the
+	 * exception of <SYN> segments, MUST be right-shifted by
+	 * Rcv.Wind.Shift bits:
+	 */
 	tcp_v4_send_ack(sock_net(sk), skb, seq,
-			tcp_rsk(req)->rcv_nxt, req->rsk_rcv_wnd,
+			tcp_rsk(req)->rcv_nxt,
+			req->rsk_rcv_wnd >> inet_rsk(req)->rcv_wscale,
 			tcp_time_stamp,
 			req->ts_recent,
 			0,
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -932,9 +932,15 @@ static void tcp_v6_reqsk_send_ack(const
 	/* sk->sk_state == TCP_LISTEN -> for regular TCP_SYN_RECV
 	 * sk->sk_state == TCP_SYN_RECV -> for Fast Open.
 	 */
+	/* RFC 7323 2.3
+	 * The window field (SEG.WND) of every outgoing segment, with the
+	 * exception of <SYN> segments, MUST be right-shifted by
+	 * Rcv.Wind.Shift bits:
+	 */
 	tcp_v6_send_ack(sk, skb, (sk->sk_state == TCP_LISTEN) ?
 			tcp_rsk(req)->snt_isn + 1 : tcp_sk(sk)->snd_nxt,
-			tcp_rsk(req)->rcv_nxt, req->rsk_rcv_wnd,
+			tcp_rsk(req)->rcv_nxt,
+			req->rsk_rcv_wnd >> inet_rsk(req)->rcv_wscale,
 			tcp_time_stamp, req->ts_recent, sk->sk_bound_dev_if,
 			tcp_v6_md5_do_lookup(sk, &ipv6_hdr(skb)->daddr),
 			0, 0);

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

* Re: [PATCH 4.4 000/118] 4.4.22-stable review
  2016-09-23  8:08     ` Greg Kroah-Hartman
@ 2016-09-23 13:25       ` Guenter Roeck
  2016-09-23 15:11         ` Greg Kroah-Hartman
  0 siblings, 1 reply; 143+ messages in thread
From: Guenter Roeck @ 2016-09-23 13:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, torvalds, akpm, shuah.kh, patches, ben.hutchings, stable

On 09/23/2016 01:08 AM, Greg Kroah-Hartman wrote:
> On Thu, Sep 22, 2016 at 08:01:35PM -0700, Guenter Roeck wrote:
>> e5767a13d7cb ("cxl: use pcibios_free_controller_deferred() when removing vPHBs")
>> 	does not apply to v4.4 nor to v4.7 (and isn't marked stable ???).
>
> I don't understand what you mean here.  It did apply, and it was marked
> for stable inclusion.  It is commit
> 6f38a8b9a45833495dc878c335c5431cd98a16ed in Linus's tree.  Does it break
> the build?
>

drivers/misc/cxl/vphb.c: In function 'cxl_pci_vphb_add':
drivers/misc/cxl/vphb.c:263:9: error: 'pcibios_free_controller_deferred' undeclared

Yes, it does break the build, by calling a function which does not exist in 4.4 or 4.7.

Sorry, the Cc: stable was dropped in the 4.4/4.7 versions, so I didn't see it.
I meant to say "it doesn't build".

You will either have to drop e5767a13d7cb. or you'll also need commit 2dd9c11b9d4
("powerpc/pseries: use pci_host_bridge.release_fn() to kfree(phb)") from upstream.
I didn't check though if that applies (or works) with the older kernels.

Guenter

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

* Re: [PATCH 4.4 000/118] 4.4.22-stable review
  2016-09-23 13:25       ` Guenter Roeck
@ 2016-09-23 15:11         ` Greg Kroah-Hartman
  2016-09-23 15:30           ` Greg Kroah-Hartman
  0 siblings, 1 reply; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-23 15:11 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: linux-kernel, torvalds, akpm, shuah.kh, patches, ben.hutchings, stable

On Fri, Sep 23, 2016 at 06:25:33AM -0700, Guenter Roeck wrote:
> On 09/23/2016 01:08 AM, Greg Kroah-Hartman wrote:
> > On Thu, Sep 22, 2016 at 08:01:35PM -0700, Guenter Roeck wrote:
> > > e5767a13d7cb ("cxl: use pcibios_free_controller_deferred() when removing vPHBs")
> > > 	does not apply to v4.4 nor to v4.7 (and isn't marked stable ???).
> > 
> > I don't understand what you mean here.  It did apply, and it was marked
> > for stable inclusion.  It is commit
> > 6f38a8b9a45833495dc878c335c5431cd98a16ed in Linus's tree.  Does it break
> > the build?
> > 
> 
> drivers/misc/cxl/vphb.c: In function 'cxl_pci_vphb_add':
> drivers/misc/cxl/vphb.c:263:9: error: 'pcibios_free_controller_deferred' undeclared
> 
> Yes, it does break the build, by calling a function which does not exist in 4.4 or 4.7.
> 
> Sorry, the Cc: stable was dropped in the 4.4/4.7 versions, so I didn't see it.
> I meant to say "it doesn't build".
> 
> You will either have to drop e5767a13d7cb. or you'll also need commit 2dd9c11b9d4
> ("powerpc/pseries: use pci_host_bridge.release_fn() to kfree(phb)") from upstream.
> I didn't check though if that applies (or works) with the older kernels.

I'm going to drop it, thanks for pointing this out, I should have caught
it earlier too...

greg k-h

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

* Re: [PATCH 4.4 000/118] 4.4.22-stable review
  2016-09-23 10:57           ` Holger Hoffstätte
@ 2016-09-23 15:13             ` Greg Kroah-Hartman
  2016-09-25 15:08               ` Greg Kroah-Hartman
  0 siblings, 1 reply; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-23 15:13 UTC (permalink / raw)
  To: Holger Hoffstätte; +Cc: patches, ben.hutchings, stable

On Fri, Sep 23, 2016 at 12:57:40PM +0200, Holger Hoffst�tte wrote:
> (trimmed To:)
> 
> On 09/23/16 11:21, Greg Kroah-Hartman wrote:
> > On Fri, Sep 23, 2016 at 10:43:27AM +0200, Holger Hoffst�tte wrote:
> >> On 09/23/16 10:14, Greg Kroah-Hartman wrote:
> >>> On Thu, Sep 22, 2016 at 09:56:28PM +0200, Holger Hoffst�tte wrote:
> >>>> did you forget to add the -net patches in stable-queue.git/tree/net-4.4
> >>>> or are they on hold for some reason? I think they were supposed to go
> >>>> into .22.
> >>>
> >>> Really?  I just put them there as I was pondering applying them, waiting
> >>> for the network maintainer to send me some more patches, or not.  They
> >>
> >> Ahh..alright then.
> >>
> >>> Why do you think they should go into this release?
> >>
> >> Never mind - they are not really urgent. I just had most of them merged
> >> locally already and was just wondering.
> > 
> > If you have them merged, and tested, mind sending them to me with your
> > tested-by mark on them?  That way I know they work and can focus on the
> > ones that will require backporting effort.
> 
> Attached. All with Tested-By are working and have done so for some
> time without issue (mixed ipv4/6 network in various functions).
> 
> ipv6-addrconf-fix-dev-refcont-leak-when-dad-failed:
> seems to be already applied from a previous series, not sure which.
> 
> tcp-cwnd-does-not-increase-in-tcp-yeah:
> For this I can only offer a Reviewed-by: since I cannot test it,
> but I did check that the code does what the comment says, and it
> merges/compiles cleanly.
> 
> Hope this helps.

It does, I'll queue these up for the next round, many thanks.

greg k-h

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

* Re: [PATCH 4.4 000/118] 4.4.22-stable review
  2016-09-23 15:11         ` Greg Kroah-Hartman
@ 2016-09-23 15:30           ` Greg Kroah-Hartman
  2016-09-28  8:45             ` Andrew Donnellan
  0 siblings, 1 reply; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-23 15:30 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: linux-kernel, torvalds, akpm, shuah.kh, patches, ben.hutchings, stable

On Fri, Sep 23, 2016 at 05:11:48PM +0200, Greg Kroah-Hartman wrote:
> On Fri, Sep 23, 2016 at 06:25:33AM -0700, Guenter Roeck wrote:
> > On 09/23/2016 01:08 AM, Greg Kroah-Hartman wrote:
> > > On Thu, Sep 22, 2016 at 08:01:35PM -0700, Guenter Roeck wrote:
> > > > e5767a13d7cb ("cxl: use pcibios_free_controller_deferred() when removing vPHBs")
> > > > 	does not apply to v4.4 nor to v4.7 (and isn't marked stable ???).
> > > 
> > > I don't understand what you mean here.  It did apply, and it was marked
> > > for stable inclusion.  It is commit
> > > 6f38a8b9a45833495dc878c335c5431cd98a16ed in Linus's tree.  Does it break
> > > the build?
> > > 
> > 
> > drivers/misc/cxl/vphb.c: In function 'cxl_pci_vphb_add':
> > drivers/misc/cxl/vphb.c:263:9: error: 'pcibios_free_controller_deferred' undeclared
> > 
> > Yes, it does break the build, by calling a function which does not exist in 4.4 or 4.7.
> > 
> > Sorry, the Cc: stable was dropped in the 4.4/4.7 versions, so I didn't see it.
> > I meant to say "it doesn't build".
> > 
> > You will either have to drop e5767a13d7cb. or you'll also need commit 2dd9c11b9d4
> > ("powerpc/pseries: use pci_host_bridge.release_fn() to kfree(phb)") from upstream.
> > I didn't check though if that applies (or works) with the older kernels.
> 
> I'm going to drop it, thanks for pointing this out, I should have caught
> it earlier too...

Should be removed, hopefully all will build properly...

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

* Re: [PATCH 4.4 000/118] 4.4.22-stable review
  2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
                     ` (115 preceding siblings ...)
  2016-09-23  3:01   ` Guenter Roeck
@ 2016-09-23 16:02   ` Shuah Khan
  116 siblings, 0 replies; 143+ messages in thread
From: Shuah Khan @ 2016-09-23 16:02 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: torvalds, akpm, linux, patches, ben.hutchings, stable, Shuah Khan

On 09/22/2016 11:28 AM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.4.22 release.
> There are 118 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 Sat Sep 24 17:29:17 UTC 2016.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.22-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.4.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] 143+ messages in thread

* Re: [PATCH 4.4 000/118] 4.4.22-stable review
  2016-09-23 15:13             ` Greg Kroah-Hartman
@ 2016-09-25 15:08               ` Greg Kroah-Hartman
  0 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-25 15:08 UTC (permalink / raw)
  To: Holger Hoffstätte; +Cc: patches, ben.hutchings, stable

On Fri, Sep 23, 2016 at 05:13:02PM +0200, Greg Kroah-Hartman wrote:
> On Fri, Sep 23, 2016 at 12:57:40PM +0200, Holger Hoffst�tte wrote:
> > (trimmed To:)
> > 
> > On 09/23/16 11:21, Greg Kroah-Hartman wrote:
> > > On Fri, Sep 23, 2016 at 10:43:27AM +0200, Holger Hoffst�tte wrote:
> > >> On 09/23/16 10:14, Greg Kroah-Hartman wrote:
> > >>> On Thu, Sep 22, 2016 at 09:56:28PM +0200, Holger Hoffst�tte wrote:
> > >>>> did you forget to add the -net patches in stable-queue.git/tree/net-4.4
> > >>>> or are they on hold for some reason? I think they were supposed to go
> > >>>> into .22.
> > >>>
> > >>> Really?  I just put them there as I was pondering applying them, waiting
> > >>> for the network maintainer to send me some more patches, or not.  They
> > >>
> > >> Ahh..alright then.
> > >>
> > >>> Why do you think they should go into this release?
> > >>
> > >> Never mind - they are not really urgent. I just had most of them merged
> > >> locally already and was just wondering.
> > > 
> > > If you have them merged, and tested, mind sending them to me with your
> > > tested-by mark on them?  That way I know they work and can focus on the
> > > ones that will require backporting effort.
> > 
> > Attached. All with Tested-By are working and have done so for some
> > time without issue (mixed ipv4/6 network in various functions).
> > 
> > ipv6-addrconf-fix-dev-refcont-leak-when-dad-failed:
> > seems to be already applied from a previous series, not sure which.
> > 
> > tcp-cwnd-does-not-increase-in-tcp-yeah:
> > For this I can only offer a Reviewed-by: since I cannot test it,
> > but I did check that the code does what the comment says, and it
> > merges/compiles cleanly.
> > 
> > Hope this helps.
> 
> It does, I'll queue these up for the next round, many thanks.

Now all applied, thanks again!

greg k-h

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

* Re: [PATCH 4.4 048/118] cpuset: make sure new tasks conform to the current config of the cpuset
  2016-09-22 17:29   ` [PATCH 4.4 048/118] cpuset: make sure new tasks conform to the current config of the cpuset Greg Kroah-Hartman
@ 2016-09-26 12:34     ` Takashi Iwai
  2016-09-26 15:38       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 143+ messages in thread
From: Takashi Iwai @ 2016-09-26 12:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, stable, Zefan Li, Tejun Heo

On Thu, 22 Sep 2016 19:29:08 +0200,
Greg Kroah-Hartman wrote:
> 
> 4.4-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Zefan Li <lizefan@huawei.com>
> 
> commit 06f4e94898918bcad00cdd4d349313a439d6911e upstream.
> 
> A new task inherits cpus_allowed and mems_allowed masks from its parent,
> but if someone changes cpuset's config by writing to cpuset.cpus/cpuset.mems
> before this new task is inserted into the cgroup's task list, the new task
> won't be updated accordingly.
> 
> Signed-off-by: Zefan Li <lizefan@huawei.com>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> ---
>  kernel/cpuset.c |   15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> --- a/kernel/cpuset.c
> +++ b/kernel/cpuset.c
> @@ -2074,6 +2074,20 @@ static void cpuset_bind(struct cgroup_su
>  	mutex_unlock(&cpuset_mutex);
>  }
>  
> +/*
> + * Make sure the new task conform to the current state of its parent,
> + * which could have been changed by cpuset just after it inherits the
> + * state from the parent and before it sits on the cgroup's task list.
> + */
> +void cpuset_fork(struct task_struct *task)

This causes a build warning:

  kernel/cpuset.c:2101:2: warning: (near initialization for 'cpuset_cgrp_subsys.fork') [enabled by default]
  .fork  = cpuset_fork,
  ^

where fork op in 4.4 kernel has still priv argument that was dropped
recently.


Takashi

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

* Re: [PATCH 4.4 048/118] cpuset: make sure new tasks conform to the current config of the cpuset
  2016-09-26 12:34     ` Takashi Iwai
@ 2016-09-26 15:38       ` Greg Kroah-Hartman
  2016-09-26 15:44         ` Takashi Iwai
  0 siblings, 1 reply; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-26 15:38 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: linux-kernel, stable, Zefan Li, Tejun Heo

On Mon, Sep 26, 2016 at 02:34:33PM +0200, Takashi Iwai wrote:
> On Thu, 22 Sep 2016 19:29:08 +0200,
> Greg Kroah-Hartman wrote:
> > 
> > 4.4-stable review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Zefan Li <lizefan@huawei.com>
> > 
> > commit 06f4e94898918bcad00cdd4d349313a439d6911e upstream.
> > 
> > A new task inherits cpus_allowed and mems_allowed masks from its parent,
> > but if someone changes cpuset's config by writing to cpuset.cpus/cpuset.mems
> > before this new task is inserted into the cgroup's task list, the new task
> > won't be updated accordingly.
> > 
> > Signed-off-by: Zefan Li <lizefan@huawei.com>
> > Signed-off-by: Tejun Heo <tj@kernel.org>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > 
> > ---
> >  kernel/cpuset.c |   15 +++++++++++++++
> >  1 file changed, 15 insertions(+)
> > 
> > --- a/kernel/cpuset.c
> > +++ b/kernel/cpuset.c
> > @@ -2074,6 +2074,20 @@ static void cpuset_bind(struct cgroup_su
> >  	mutex_unlock(&cpuset_mutex);
> >  }
> >  
> > +/*
> > + * Make sure the new task conform to the current state of its parent,
> > + * which could have been changed by cpuset just after it inherits the
> > + * state from the parent and before it sits on the cgroup's task list.
> > + */
> > +void cpuset_fork(struct task_struct *task)
> 
> This causes a build warning:
> 
>   kernel/cpuset.c:2101:2: warning: (near initialization for 'cpuset_cgrp_subsys.fork') [enabled by default]
>   .fork  = cpuset_fork,
>   ^
> 
> where fork op in 4.4 kernel has still priv argument that was dropped
> recently.

Thanks, I have a patch in my tree already for this and it will show up
in the next release.

greg k-h

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

* Re: [PATCH 4.4 048/118] cpuset: make sure new tasks conform to the current config of the cpuset
  2016-09-26 15:38       ` Greg Kroah-Hartman
@ 2016-09-26 15:44         ` Takashi Iwai
  0 siblings, 0 replies; 143+ messages in thread
From: Takashi Iwai @ 2016-09-26 15:44 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, stable, Zefan Li, Tejun Heo

On Mon, 26 Sep 2016 17:38:22 +0200,
Greg Kroah-Hartman wrote:
> 
> On Mon, Sep 26, 2016 at 02:34:33PM +0200, Takashi Iwai wrote:
> > On Thu, 22 Sep 2016 19:29:08 +0200,
> > Greg Kroah-Hartman wrote:
> > > 
> > > 4.4-stable review patch.  If anyone has any objections, please let me know.
> > > 
> > > ------------------
> > > 
> > > From: Zefan Li <lizefan@huawei.com>
> > > 
> > > commit 06f4e94898918bcad00cdd4d349313a439d6911e upstream.
> > > 
> > > A new task inherits cpus_allowed and mems_allowed masks from its parent,
> > > but if someone changes cpuset's config by writing to cpuset.cpus/cpuset.mems
> > > before this new task is inserted into the cgroup's task list, the new task
> > > won't be updated accordingly.
> > > 
> > > Signed-off-by: Zefan Li <lizefan@huawei.com>
> > > Signed-off-by: Tejun Heo <tj@kernel.org>
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > 
> > > ---
> > >  kernel/cpuset.c |   15 +++++++++++++++
> > >  1 file changed, 15 insertions(+)
> > > 
> > > --- a/kernel/cpuset.c
> > > +++ b/kernel/cpuset.c
> > > @@ -2074,6 +2074,20 @@ static void cpuset_bind(struct cgroup_su
> > >  	mutex_unlock(&cpuset_mutex);
> > >  }
> > >  
> > > +/*
> > > + * Make sure the new task conform to the current state of its parent,
> > > + * which could have been changed by cpuset just after it inherits the
> > > + * state from the parent and before it sits on the cgroup's task list.
> > > + */
> > > +void cpuset_fork(struct task_struct *task)
> > 
> > This causes a build warning:
> > 
> >   kernel/cpuset.c:2101:2: warning: (near initialization for 'cpuset_cgrp_subsys.fork') [enabled by default]
> >   .fork  = cpuset_fork,
> >   ^
> > 
> > where fork op in 4.4 kernel has still priv argument that was dropped
> > recently.
> 
> Thanks, I have a patch in my tree already for this and it will show up
> in the next release.

Great, thanks!


Takashi

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

* Re: [PATCH 4.4 000/118] 4.4.22-stable review
  2016-09-23 15:30           ` Greg Kroah-Hartman
@ 2016-09-28  8:45             ` Andrew Donnellan
  2016-09-28 13:29               ` Mauricio Faria de Oliveira
  0 siblings, 1 reply; 143+ messages in thread
From: Andrew Donnellan @ 2016-09-28  8:45 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Guenter Roeck
  Cc: linux-kernel, torvalds, akpm, shuah.kh, patches, ben.hutchings,
	stable, Mauricio Faria de Oliveira

On 24/09/16 01:30, Greg Kroah-Hartman wrote:
> On Fri, Sep 23, 2016 at 05:11:48PM +0200, Greg Kroah-Hartman wrote:
>> On Fri, Sep 23, 2016 at 06:25:33AM -0700, Guenter Roeck wrote:
>>> On 09/23/2016 01:08 AM, Greg Kroah-Hartman wrote:
>>>> On Thu, Sep 22, 2016 at 08:01:35PM -0700, Guenter Roeck wrote:
>>>>> e5767a13d7cb ("cxl: use pcibios_free_controller_deferred() when removing vPHBs")
>>>>> 	does not apply to v4.4 nor to v4.7 (and isn't marked stable ???).
>>>>
>>>> I don't understand what you mean here.  It did apply, and it was marked
>>>> for stable inclusion.  It is commit
>>>> 6f38a8b9a45833495dc878c335c5431cd98a16ed in Linus's tree.  Does it break
>>>> the build?
>>>>
>>>
>>> drivers/misc/cxl/vphb.c: In function 'cxl_pci_vphb_add':
>>> drivers/misc/cxl/vphb.c:263:9: error: 'pcibios_free_controller_deferred' undeclared
>>>
>>> Yes, it does break the build, by calling a function which does not exist in 4.4 or 4.7.
>>>
>>> Sorry, the Cc: stable was dropped in the 4.4/4.7 versions, so I didn't see it.
>>> I meant to say "it doesn't build".
>>>
>>> You will either have to drop e5767a13d7cb. or you'll also need commit 2dd9c11b9d4
>>> ("powerpc/pseries: use pci_host_bridge.release_fn() to kfree(phb)") from upstream.
>>> I didn't check though if that applies (or works) with the older kernels.
>>
>> I'm going to drop it, thanks for pointing this out, I should have caught
>> it earlier too...
>
> Should be removed, hopefully all will build properly...
>

It would've been helpful if Mauricio and I were Cc'd on this, but in any 
case I was away for most of last week :)

Looks like I suggested that 2dd9c11b9d4 be Cc: stable on the list but 
that didn't quite make it in to the final commit. Probably didn't help 
that our patches were then applied to powerpc#fixes in the wrong order...

2dd9c11b9d4 applies cleanly on top of 4.4 and works for me in the cxl 
case. Mauricio - any objections from the pseries/dlpar side?


Andrew


-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan@au1.ibm.com  IBM Australia Limited

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

* Re: [PATCH 4.4 000/118] 4.4.22-stable review
  2016-09-28  8:45             ` Andrew Donnellan
@ 2016-09-28 13:29               ` Mauricio Faria de Oliveira
  2016-10-10  8:39                 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 143+ messages in thread
From: Mauricio Faria de Oliveira @ 2016-09-28 13:29 UTC (permalink / raw)
  To: Andrew Donnellan, Greg Kroah-Hartman, Guenter Roeck
  Cc: linux-kernel, torvalds, akpm, shuah.kh, patches, ben.hutchings, stable

On 09/28/2016 05:45 AM, Andrew Donnellan wrote:
> 2dd9c11b9d4 applies cleanly on top of 4.4 and works for me in the cxl
> case. Mauricio - any objections from the pseries/dlpar side?

No objections.


-- 
Mauricio Faria de Oliveira
IBM Linux Technology Center

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

* Re: [PATCH 4.4 022/118] IB/uverbs: Fix race between uverbs_close and remove_one
  2016-09-22 17:28   ` [PATCH 4.4 022/118] IB/uverbs: Fix race between uverbs_close and remove_one Greg Kroah-Hartman
@ 2016-10-03 12:28     ` Vegard Nossum
  2016-10-03 17:05       ` Jason Gunthorpe
  0 siblings, 1 reply; 143+ messages in thread
From: Vegard Nossum @ 2016-10-03 12:28 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: LKML, stable, Greg Kroah-Hartman, Devesh Sharma, Yishai Hadas,
	Leon Romanovsky, Doug Ledford

On 22 September 2016 at 19:28, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> 4.4-stable review patch.  If anyone has any objections, please let me know.
>
> ------------------
>
> From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
>
> commit d1e09f304a1d9651c5059ebfeb696dc2effc9b32 upstream.
>
> Fixes an oops that might happen if uverbs_close races with
> remove_one.
>
> Both contexts may run ib_uverbs_cleanup_ucontext, it depends
> on the flow.
>
> Currently, there is no protection for a case that remove_one
> didn't make the cleanup it runs to its end, the underlying
> ib_device was freed then uverbs_close will call
> ib_uverbs_cleanup_ucontext and OOPs.
>
> Above might happen if uverbs_close deleted the file from the list
> then remove_one didn't find it and runs to its end.
>
> Fixes to protect against that case by a new cleanup lock so that
> ib_uverbs_cleanup_ucontext will be called always before that
> remove_one is ended.
>
> Fixes: 35d4a0b63dc0 ("IB/uverbs: Fix race between ib_uverbs_open and remove_one")
> Reported-by: Devesh Sharma <devesh.sharma@broadcom.com>
> Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> Signed-off-by: Yishai Hadas <yishaih@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/core/uverbs.h      |    1
>  drivers/infiniband/core/uverbs_main.c |   37 ++++++++++++++++++++++------------
>  2 files changed, 25 insertions(+), 13 deletions(-)
>
> --- a/drivers/infiniband/core/uverbs.h
> +++ b/drivers/infiniband/core/uverbs.h
> @@ -116,6 +116,7 @@ struct ib_uverbs_event_file {
>  struct ib_uverbs_file {
>         struct kref                             ref;
>         struct mutex                            mutex;
> +       struct mutex                            cleanup_mutex; /* protect cleanup */
>         struct ib_uverbs_device                *device;
>         struct ib_ucontext                     *ucontext;
>         struct ib_event_handler                 event_handler;
> --- a/drivers/infiniband/core/uverbs_main.c
> +++ b/drivers/infiniband/core/uverbs_main.c
> @@ -922,6 +922,7 @@ static int ib_uverbs_open(struct inode *
>         file->async_file = NULL;
>         kref_init(&file->ref);
>         mutex_init(&file->mutex);
> +       mutex_init(&file->cleanup_mutex);
>
>         filp->private_data = file;
>         kobject_get(&dev->kobj);
> @@ -947,18 +948,20 @@ static int ib_uverbs_close(struct inode
>  {
>         struct ib_uverbs_file *file = filp->private_data;
>         struct ib_uverbs_device *dev = file->device;
> -       struct ib_ucontext *ucontext = NULL;
> +
> +       mutex_lock(&file->cleanup_mutex);
> +       if (file->ucontext) {
> +               ib_uverbs_cleanup_ucontext(file, file->ucontext);
> +               file->ucontext = NULL;
> +       }
> +       mutex_unlock(&file->cleanup_mutex);
>
>         mutex_lock(&file->device->lists_mutex);
> -       ucontext = file->ucontext;
> -       file->ucontext = NULL;
>         if (!file->is_closed) {
>                 list_del(&file->list);
>                 file->is_closed = 1;
>         }
>         mutex_unlock(&file->device->lists_mutex);
> -       if (ucontext)
> -               ib_uverbs_cleanup_ucontext(file, ucontext);
>
>         if (file->async_file)
>                 kref_put(&file->async_file->ref, ib_uverbs_release_event_file);
> @@ -1172,22 +1175,30 @@ static void ib_uverbs_free_hw_resources(
>         mutex_lock(&uverbs_dev->lists_mutex);
>         while (!list_empty(&uverbs_dev->uverbs_file_list)) {
>                 struct ib_ucontext *ucontext;
> -
>                 file = list_first_entry(&uverbs_dev->uverbs_file_list,
>                                         struct ib_uverbs_file, list);
>                 file->is_closed = 1;
> -               ucontext = file->ucontext;
>                 list_del(&file->list);
> -               file->ucontext = NULL;
>                 kref_get(&file->ref);
>                 mutex_unlock(&uverbs_dev->lists_mutex);
> -               /* We must release the mutex before going ahead and calling
> -                * disassociate_ucontext. disassociate_ucontext might end up
> -                * indirectly calling uverbs_close, for example due to freeing
> -                * the resources (e.g mmput).
> -                */
> +
>                 ib_uverbs_event_handler(&file->event_handler, &event);
> +
> +               mutex_lock(&file->cleanup_mutex);
> +               ucontext = file->ucontext;
> +               file->ucontext = NULL;
> +               mutex_unlock(&file->cleanup_mutex);
> +
> +               /* At this point ib_uverbs_close cannot be running
> +                * ib_uverbs_cleanup_ucontext
> +                */
>                 if (ucontext) {
> +                       /* We must release the mutex before going ahead and
> +                        * calling disassociate_ucontext. disassociate_ucontext
> +                        * might end up indirectly calling uverbs_close,
> +                        * for example due to freeing the resources
> +                        * (e.g mmput).
> +                        */
>                         ib_dev->disassociate_ucontext(ucontext);
>                         ib_uverbs_cleanup_ucontext(file, ucontext);
>                 }

Another code-quality (not stable) comment. We're told again and again
to "lock data, not code", e.g.

"And as Alan Cox says, “Lock data, not code”." (Unreliable Guide To
Locking, Rusty Russel, Documentation/DocBook/kernel-locking.tmpl)

"Big Fat Rule: Locks that simply wrap code regions are hard to
understand and prone to race conditions. Lock data, not code." (Linux
Kernel Development Second Edition, Robert Love)

This lock is literally called "cleanup mutex" and it's not really
documented what data it protects. Is there a better solution here?


Vegard

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

* Re: [PATCH 4.4 022/118] IB/uverbs: Fix race between uverbs_close and remove_one
  2016-10-03 12:28     ` Vegard Nossum
@ 2016-10-03 17:05       ` Jason Gunthorpe
  0 siblings, 0 replies; 143+ messages in thread
From: Jason Gunthorpe @ 2016-10-03 17:05 UTC (permalink / raw)
  To: Vegard Nossum
  Cc: LKML, stable, Greg Kroah-Hartman, Devesh Sharma, Yishai Hadas,
	Leon Romanovsky, Doug Ledford

On Mon, Oct 03, 2016 at 02:28:40PM +0200, Vegard Nossum wrote:

> This lock is literally called "cleanup mutex" and it's not really
> documented what data it protects. Is there a better solution here?

I agree it is very complex and hard to understand. This is why it
needed patching :| The mutex is in fact pretty much locking
code. (ensuring that ib_uverbs_cleanup_ucontext only runs on one
thread during this race)

There are at least three locks involved in this process. I didn't see
any obvious way to extend any of the other locks to handle this case.

The argument against most simple solutions (eg a rw lock rather than
the srcu) has been performance on these paths.

Jason

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

* Re: [PATCH 4.4 000/118] 4.4.22-stable review
  2016-09-28 13:29               ` Mauricio Faria de Oliveira
@ 2016-10-10  8:39                 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 143+ messages in thread
From: Greg Kroah-Hartman @ 2016-10-10  8:39 UTC (permalink / raw)
  To: Mauricio Faria de Oliveira
  Cc: Andrew Donnellan, Guenter Roeck, linux-kernel, torvalds, akpm,
	shuah.kh, patches, ben.hutchings, stable

On Wed, Sep 28, 2016 at 10:29:23AM -0300, Mauricio Faria de Oliveira wrote:
> On 09/28/2016 05:45 AM, Andrew Donnellan wrote:
> > 2dd9c11b9d4 applies cleanly on top of 4.4 and works for me in the cxl
> > case. Mauricio - any objections from the pseries/dlpar side?
> 
> No objections.

Thanks, have queued them up now.

greg k-h

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

end of thread, other threads:[~2016-10-10  8:45 UTC | newest]

Thread overview: 143+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20160922173501uscas1p243aed76c609383566946bc6ebe30e40d@uscas1p2.samsung.com>
2016-09-22 17:28 ` [PATCH 4.4 000/118] 4.4.22-stable review Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 001/118] ext4: use __GFP_NOFAIL in ext4_free_blocks() Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 002/118] fscrypto: add authorization check for setting encryption policy Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 003/118] clocksource/drivers/sun4i: Clear interrupts after stopping timer in probe function Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 004/118] MIPS: KVM: Check for pfn noslot case Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 005/118] Revert "KVM: x86: fix missed hardware breakpoints" Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 006/118] fscrypto: require write access to mount to set encryption policy Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 008/118] tipc: move linearization of buffers to generic code Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 009/118] powerpc/tm: do not use r13 for tabort_syscall Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 010/118] powerpc/powernv : Drop reference added by kset_find_obj() Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 011/118] powerpc/mm: Dont alias user region to other regions below PAGE_OFFSET Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 012/118] kernfs: dont depend on d_find_any_alias() when generating notifications Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 013/118] pNFS: The client must not do I/O to the DS if its lease has expired Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 014/118] NFSv4.x: Fix a refcount leak in nfs_callback_up_net Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 015/118] nfsd: Close race between nfsd4_release_lockowner and nfsd4_lock Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 016/118] pNFS: Ensure LAYOUTGET and LAYOUTRETURN are properly serialised Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 017/118] NFSv4.1: Fix the CREATE_SESSION slot number accounting Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 018/118] kexec: fix double-free when failing to relocate the purgatory Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 019/118] mm: introduce get_task_exe_file Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 020/118] audit: fix exe_file access in audit_exe_compare Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 021/118] dm flakey: fix reads to be issued if drop_writes configured Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 022/118] IB/uverbs: Fix race between uverbs_close and remove_one Greg Kroah-Hartman
2016-10-03 12:28     ` Vegard Nossum
2016-10-03 17:05       ` Jason Gunthorpe
2016-09-22 17:28   ` [PATCH 4.4 025/118] x86/AMD: Apply erratum 665 on machines without a BIOS fix Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 026/118] kvm-arm: Unmap shadow pagetables properly Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 027/118] iio: accel: kxsd9: Fix raw read return Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 028/118] iio: proximity: as3935: set up buffer timestamps for non-zero values Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 029/118] iio: adc: rockchip_saradc: reset saradc controller before programming it Greg Kroah-Hartman
2016-09-22 17:28     ` Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 030/118] iio: adc: ti_am335x_adc: Protect FIFO1 from concurrent access Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 031/118] iio: adc: ti_am335x_adc: Increase timeout value waiting for ADC sample Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 032/118] iio: ad799x: Fix buffered capture for ad7991/ad7995/ad7999 Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 033/118] iio: adc: at91: unbreak channel adc channel 3 Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 034/118] iio: accel: bmc150: reset chip at init time Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 035/118] iio: fix pressure data output unit in hid-sensor-attributes Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 036/118] iio: accel: kxsd9: Fix scaling bug Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 037/118] iio:core: fix IIO_VAL_FRACTIONAL sign handling Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 038/118] iio: ensure ret is initialized to zero before entering do loop Greg Kroah-Hartman
2016-09-22 17:28   ` [PATCH 4.4 039/118] serial: 8250_mid: fix divide error bug if baud rate is 0 Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 040/118] serial: 8250: added acces i/o products quad and octal serial cards Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 041/118] USB: serial: simple: add support for another Infineon flashloader Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 042/118] usb: renesas_usbhs: fix clearing the {BRDY,BEMP}STS condition Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 043/118] usb: chipidea: udc: fix NULL ptr dereference in isr_setup_status_phase Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 044/118] ARM: dts: STiH410: Handle interconnect clock required by EHCI/OHCI (USB) Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 045/118] USB: change bInterval default to 10 ms Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 046/118] cxl: use pcibios_free_controller_deferred() when removing vPHBs Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 047/118] net: thunderx: Fix OOPs with ethtool --register-dump Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 048/118] cpuset: make sure new tasks conform to the current config of the cpuset Greg Kroah-Hartman
2016-09-26 12:34     ` Takashi Iwai
2016-09-26 15:38       ` Greg Kroah-Hartman
2016-09-26 15:44         ` Takashi Iwai
2016-09-22 17:29   ` [PATCH 4.4 049/118] ARM: AM43XX: hwmod: Fix RSTST register offset for pruss Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 050/118] ARM: imx6: add missing BM_CLPCR_BYP_MMDC_CH0_LPM_HS setting for imx6ul Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 051/118] ARM: imx6: add missing BM_CLPCR_BYPASS_PMIC_READY setting for imx6sx Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 052/118] ARM: kirkwood: ib62x0: fix size of u-boot environment partition Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 053/118] ARM: OMAP3: hwmod data: Add sysc information for DSI Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 054/118] ARM: dts: imx6qdl: Fix SPDIF regression Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 055/118] ARM: dts: overo: fix gpmc nand cs0 range Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 056/118] ARM: dts: overo: fix gpmc nand on boards with ethernet Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 057/118] ARM: dts: STiH407-family: Provide interconnect clock for consumption in ST SDHCI Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 058/118] bus: arm-ccn: Fix PMU handling of MN Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 059/118] bus: arm-ccn: Do not attempt to configure XPs for cycle counter Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 060/118] bus: arm-ccn: Fix XP watchpoint settings bitmask Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 061/118] dm log writes: fix check of kthread_run() return value Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 062/118] dm log writes: move IO accounting earlier to fix error path Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 063/118] dm crypt: fix error with too large bios Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 064/118] pinctrl: pistachio: fix mfio pll_lock pinmux Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 065/118] pinctrl: sunxi: fix uart1 CTS/RTS pins at PG on A23/A33 Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 066/118] arm64: spinlocks: implement smp_mb__before_spinlock() as smp_mb() Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 067/118] crypto: cryptd - initialize child shash_desc on import Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 068/118] Btrfs: remove root_log_ctx from ctx list before btrfs_sync_log returns Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 069/118] fuse: direct-io: dont dirty ITER_BVEC pages Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 070/118] xhci: fix null pointer dereference in stop command timeout function Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 071/118] md-cluster: make md-cluster also can work when compiled into kernel Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 072/118] ath9k: fix using sta->drv_priv before initializing it Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 073/118] Revert "wext: Fix 32 bit iwpriv compatibility issue with 64 bit Kernel" Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 074/118] sched/core: Fix a race between try_to_wake_up() and a woken up task Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 075/118] ipv6: addrconf: fix dev refcont leak when DAD failed Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 076/118] gma500: remove annoying deprecation warning Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 079/118] mmc: dw_mmc: use resource_size_t to store physical address Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 080/118] pinctrl: at91-pio4: use %pr format string for resource Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 081/118] soc: qcom/spm: shut up uninitialized variable warning Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 082/118] kconfig: tinyconfig: provide whole choice blocks to avoid warnings Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 083/118] net: simplify napi_synchronize() " Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 084/118] drm: atmel-hlcdc: Fix vertical scaling Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 085/118] drm: Only use compat ioctl for addfb2 on X86/IA64 Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 086/118] genirq: Provide irq_gc_{lock_irqsave,unlock_irqrestore}() helpers Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 087/118] irqchip/atmel-aic: Fix potential deadlock in ->xlate() Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 088/118] fix iov_iter_fault_in_readable() Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 089/118] microblaze: fix __get_user() Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 090/118] avr32: fix copy_from_user() Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 091/118] microblaze: " Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 092/118] fix minor infoleak in get_user_ex() Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 093/118] mn10300: failing __get_user() and get_user() should zero Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 094/118] m32r: fix __get_user() Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 095/118] sh64: failing __get_user() should zero Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 096/118] nios2: fix __get_user() Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 097/118] score: fix __get_user/get_user Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 098/118] s390: get_user() should zero on failure Greg Kroah-Hartman
2016-09-22 17:29   ` [PATCH 4.4 099/118] ARC: uaccess: get_user to zero out dest in cause of fault Greg Kroah-Hartman
2016-09-22 17:29     ` Greg Kroah-Hartman
2016-09-22 17:30   ` [PATCH 4.4 100/118] asm-generic: make get_user() clear the destination on errors Greg Kroah-Hartman
2016-09-22 17:30   ` [PATCH 4.4 101/118] frv: fix clear_user() Greg Kroah-Hartman
2016-09-22 17:30   ` [PATCH 4.4 102/118] cris: buggered copy_from_user/copy_to_user/clear_user Greg Kroah-Hartman
2016-09-22 17:30   ` [PATCH 4.4 103/118] blackfin: fix copy_from_user() Greg Kroah-Hartman
2016-09-22 17:30   ` [PATCH 4.4 104/118] score: fix copy_from_user() and friends Greg Kroah-Hartman
2016-09-22 17:30   ` [PATCH 4.4 105/118] sh: fix copy_from_user() Greg Kroah-Hartman
2016-09-22 17:30   ` [PATCH 4.4 106/118] hexagon: fix strncpy_from_user() error return Greg Kroah-Hartman
2016-09-22 17:30   ` [PATCH 4.4 107/118] mips: copy_from_user() must zero the destination on access_ok() failure Greg Kroah-Hartman
2016-09-22 17:30   ` [PATCH 4.4 108/118] asm-generic: make copy_from_user() zero the destination properly Greg Kroah-Hartman
2016-09-22 17:30   ` [PATCH 4.4 109/118] alpha: fix copy_from_user() Greg Kroah-Hartman
2016-09-22 17:30   ` [PATCH 4.4 110/118] metag: copy_from_user() should zero the destination on access_ok() failure Greg Kroah-Hartman
2016-09-22 17:30   ` [PATCH 4.4 111/118] parisc: fix copy_from_user() Greg Kroah-Hartman
2016-09-22 17:30   ` [PATCH 4.4 112/118] openrisc: " Greg Kroah-Hartman
2016-09-22 17:30   ` [PATCH 4.4 113/118] nios2: copy_from_user() should zero the tail of destination Greg Kroah-Hartman
2016-09-22 17:30   ` [PATCH 4.4 114/118] mn10300: copy_from_user() should zero on access_ok() failure Greg Kroah-Hartman
2016-09-22 17:30   ` [PATCH 4.4 115/118] sparc32: fix copy_from_user() Greg Kroah-Hartman
2016-09-22 17:30   ` [PATCH 4.4 116/118] ppc32: " Greg Kroah-Hartman
2016-09-22 17:30   ` [PATCH 4.4 117/118] genirq/msi: Fix broken debug output Greg Kroah-Hartman
2016-09-22 17:30   ` [PATCH 4.4 118/118] ia64: copy_from_user() should zero the destination on access_ok() failure Greg Kroah-Hartman
2016-09-22 19:56   ` [PATCH 4.4 000/118] 4.4.22-stable review Holger Hoffstätte
2016-09-23  8:14     ` Greg Kroah-Hartman
2016-09-23  8:14       ` Greg Kroah-Hartman
2016-09-23  8:43       ` Holger Hoffstätte
2016-09-23  9:21         ` Greg Kroah-Hartman
2016-09-23  9:21           ` Greg Kroah-Hartman
2016-09-23 10:57           ` Holger Hoffstätte
2016-09-23 15:13             ` Greg Kroah-Hartman
2016-09-25 15:08               ` Greg Kroah-Hartman
2016-09-22 23:43   ` Guenter Roeck
2016-09-23  3:01   ` Guenter Roeck
2016-09-23  8:05     ` Greg Kroah-Hartman
2016-09-23  8:08     ` Greg Kroah-Hartman
2016-09-23 13:25       ` Guenter Roeck
2016-09-23 15:11         ` Greg Kroah-Hartman
2016-09-23 15:30           ` Greg Kroah-Hartman
2016-09-28  8:45             ` Andrew Donnellan
2016-09-28 13:29               ` Mauricio Faria de Oliveira
2016-10-10  8:39                 ` Greg Kroah-Hartman
2016-09-23  8:10     ` Greg Kroah-Hartman
2016-09-23  8:11     ` Greg Kroah-Hartman
2016-09-23 16:02   ` Shuah Khan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.