linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4.2 000/134] 4.2.2-stable review
@ 2015-09-26 20:54 Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 001/134] nfc: st-nci: Remove duplicate file platform_data/st_nci.h Greg Kroah-Hartman
                   ` (133 more replies)
  0 siblings, 134 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, torvalds, akpm, linux, shuah.kh, stable

This is the start of the stable review cycle for the 4.2.2 release.
There are 134 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 Mon Sep 28 20:51:27 UTC 2015.
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.2.2-rc1.gz
and the diffstat can be found below.

thanks,

greg k-h

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

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

Jan Kara <jack@suse.com>
    jbd2: avoid infinite loop when destroying aborted journal

Yinghai Lu <yinghai@kernel.org>
    lib/decompressors: use real out buf size for gunzip with kernel

Hin-Tak Leung <htl10@users.sourceforge.net>
    hfs,hfsplus: cache pages correctly between bnode_create and bnode_free

Alexey Brodkin <Alexey.Brodkin@synopsys.com>
    stmmac: fix check for phydev being open

Ariel Nahum <arieln@mellanox.com>
    IB/mlx4: Fix incorrect cq flushing in error state

Noa Osherovich <noaos@mellanox.com>
    IB/mlx4: Use correct SL on AH query under RoCE

Jack Morgenstein <jackm@dev.mellanox.co.il>
    IB/mlx4: Forbid using sysfs to change RoCE pkeys

Jack Morgenstein <jackm@dev.mellanox.co.il>
    IB/mlx4: Fix potential deadlock when sending mad to wire

Haggai Eran <haggaie@mellanox.com>
    IB/mlx5: avoid destroying a NULL mr in reg_user_mr error flow

Sagi Grimberg <sagig@mellanox.com>
    IB/iser: Fix possible bogus DMA unmapping

Sagi Grimberg <sagig@mellanox.com>
    IB/iser: Fix missing return status check in iser_send_data_out

Yishai Hadas <yishaih@mellanox.com>
    IB/uverbs: Fix race between ib_uverbs_open and remove_one

Christoph Hellwig <hch@lst.de>
    IB/uverbs: reject invalid or unknown opcodes

Mike Marciniszyn <mike.marciniszyn@intel.com>
    IB/qib: Change lkey table allocation to support more MRs

Bart Van Assche <bart.vanassche@sandisk.com>
    IB/srp: Stop the scsi_eh_<n> and scsi_tmf_<n> threads if login fails

Bart Van Assche <bart.vanassche@sandisk.com>
    IB/srp: Handle partial connection success correctly

Hans de Goede <hdegoede@redhat.com>
    ideapad-laptop: Add Lenovo Yoga 3 14 to no_hw_rfkill dmi list

Dan Carpenter <dan.carpenter@oracle.com>
    i2c: xgene-slimpro: dma_mapping_error() doesn't return an error code

Hin-Tak Leung <htl10@users.sourceforge.net>
    hfs: fix B-tree corruption after insertion at position 0

Tyler Hicks <tyhicks@canonical.com>
    eCryptfs: Invalidate dcache entries when lower i_nlink is zero

Joerg Roedel <jroedel@suse.de>
    iommu/vt-d: Really use upper context table when necessary

Thierry Reding <treding@nvidia.com>
    iommu/tegra-smmu: Parameterize number of TLB lines

Will Deacon <will.deacon@arm.com>
    iommu/io-pgtable-arm: Unmap and free table when overwriting with block

Emil Medve <Emilian.Medve@Freescale.com>
    iommu/fsl: Really fix init section(s) content

Jialing Fu <jlfu@marvell.com>
    mmc: core: fix race condition in mmc_wait_data_done

Haibo Chen <haibo.chen@freescale.com>
    mmc: sdhci: fix dma memory leak in sdhci_pre_req()

Jisheng Zhang <jszhang@marvell.com>
    mmc: sdhci: also get preset value and driver type for MMC_DDR52

Yangbo Lu <yangbo.lu@freescale.com>
    mmc: sdhci-of-esdhc: add workaround for pre divider initial value

Adam Lee <adam.lee@canonical.com>
    mmc: sdhci-pci: set the clear transfer mode register quirk for O2Micro

Jann Horn <jann@thejh.net>
    fs: Don't dump core if the corefile would become world-readable.

Jann Horn <jann@thejh.net>
    fs: if a coredump already exists, unlink and recreate with O_EXCL

Jaewon Kim <jaewon31.kim@samsung.com>
    vmscan: fix increasing nr_isolated incurred by putback unevictable pages

Tim Gardner <tim.gardner@canonical.com>
    workqueue: Make flush_workqueue() available again to non GPL modules

Helge Deller <deller@gmx.de>
    parisc: Filter out spurious interrupts in PA-RISC irq handler

John David Anglin <dave.anglin@bell.net>
    parisc: Use double word condition in 64bit CAS operation

Helge Deller <deller@gmx.de>
    PCI,parisc: Enable 64-bit bus addresses on PA-RISC

Mitja Spes <mitja@lxnav.com>
    rtc: abx80x: fix RTC write bit

Joonyoung Shim <jy0922.shim@samsung.com>
    rtc: s5m: fix to update ctrl register

Joonyoung Shim <jy0922.shim@samsung.com>
    rtc: s3c: fix disabled clocks for alarm

Trond Myklebust <trond.myklebust@primarydata.com>
    SUNRPC: Lock the transport layer on shutdown

Trond Myklebust <trond.myklebust@primarydata.com>
    SUNRPC: Ensure that we wait for connections to complete before retrying

Trond Myklebust <trond.myklebust@primarydata.com>
    SUNRPC: xs_reset_transport must mark the connection as disconnected

Trond Myklebust <trond.myklebust@primarydata.com>
    SUNRPC: Fix a thinko in xs_connect()

Pratyush Anand <panand@redhat.com>
    net: sunrpc: fix tracepoint Warning: unknown op '->'

Chuck Lever <chuck.lever@oracle.com>
    svcrdma: Change maximum server payload back to RPCSVC_MAXPAYLOAD

Trond Myklebust <trond.myklebust@primarydata.com>
    Revert "NFSv4: Remove incorrect check in can_open_delegated()"

Kinglong Mee <kinglongmee@gmail.com>
    nfs: Fix truncated client owner id without proto type

Trond Myklebust <trond.myklebust@primarydata.com>
    NFSv4.1: Fix a protocol issue with CLOSE stateids

Trond Myklebust <trond.myklebust@primarydata.com>
    NFSv4.1/flexfiles: Fix a protocol error in layoutreturn

Peng Tao <tao.peng@primarydata.com>
    NFS41/flexfiles: zero out DS write wcc

Trond Myklebust <trond.myklebust@primarydata.com>
    NFSv4: Force a post-op attribute update when holding a delegation

Peng Tao <tao.peng@primarydata.com>
    NFS41/flexfiles: update inode after write finishes

Trond Myklebust <trond.myklebust@primarydata.com>
    NFS: nfs_set_pgio_error sometimes misses errors

Kinglong Mee <kinglongmee@gmail.com>
    NFS: Fix a NULL pointer dereference of migration recovery ops for v4.2 client

Trond Myklebust <trond.myklebust@primarydata.com>
    NFSv4.1/pNFS: Fix borken function _same_data_server_addrs_locked()

Trond Myklebust <trond.myklebust@primarydata.com>
    NFS: Don't let the ctime override attribute barriers.

NeilBrown <neilb@suse.com>
    NFSv4: don't set SETATTR for O_RDONLY|O_EXCL

Trond Myklebust <trond.myklebust@primarydata.com>
    NFSv4.1/pnfs: Fix atomicity of commit list updates

Jeff Layton <jlayton@poochiereds.net>
    nfsd: ensure that delegation stateid hash references are only put once

Jeff Layton <jlayton@poochiereds.net>
    nfsd: ensure that the ol stateid hash reference is only put once

Kinglong Mee <kinglongmee@gmail.com>
    nfsd: Fix an FS_LAYOUT_TYPES/LAYOUT_TYPES encode bug

Filipe Manana <fdmanana@suse.com>
    Btrfs: check if previous transaction aborted to avoid fs corruption

Sakari Ailus <sakari.ailus@iki.fi>
    v4l: omap3isp: Fix async notifier registration order

Dan Carpenter <dan.carpenter@oracle.com>
    v4l: xilinx: missing error code

Benoit Parrot <bparrot@ti.com>
    media: am437x-vpfe: Fix a race condition during release

Benoit Parrot <bparrot@ti.com>
    media: am437x-vpfe: Requested frame size and fmt overwritten by current sensor setting

Sakari Ailus <sakari.ailus@iki.fi>
    v4l: omap3isp: Fix sub-device power management code

David Härdeman <david@hardeman.nu>
    rc-core: fix remove uevent generation

Daniel Axtens <dja@axtens.net>
    cxl: Don't remove AFUs/vPHBs in cxl_reset

Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
    i915: Set ddi_pll_sel in DP MST path

Ville Syrjälä <ville.syrjala@linux.intel.com>
    drm/i915: Don't use link_bw for PLL setup

Minfei Huang <mnfhuang@gmail.com>
    x86/mm: Initialize pmd_idx in page_table_range_init_count()

Yinghai Lu <yinghai@kernel.org>
    mm: check if section present during memory block registering

Jeffery Miller <jmiller@neverware.com>
    Add radeon suspend/resume quirk for HP Compaq dc5750.

Jann Horn <jann@thejh.net>
    CIFS: fix type confusion in copy offload ioctl

Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
    powerpc/mm: Recompute hash value after a failed update

Benjamin Herrenschmidt <benh@kernel.crashing.org>
    powerpc/boot: Specify ABI v2 when building an LE boot wrapper

Bharata B Rao <bharata@linux.vnet.ibm.com>
    powerpc/pseries: Release DRC when configure_connector fails

Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
    powerpc/powernv/pci-ioda: fix kdump with non-power-of-2 crashkernel=

Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
    powerpc/powernv/pci-ioda: fix 32-bit TCE table init in kdump kernel

Leonidas Da Silva Barbosa <leosilva@linux.vnet.ibm.com>
    crypto: vmx - Adding enable_kernel_vsx() to access VSX instructions

Leonidas Da Silva Barbosa <leosilva@linux.vnet.ibm.com>
    powerpc: Uncomment and make enable_kernel_vsx() routine available

Thomas Huth <thuth@redhat.com>
    powerpc/rtas: Introduce rtas_get_sensor_fast() for IRQ handlers

Michael Ellerman <mpe@ellerman.id.au>
    powerpc/mm: Fix pte_pagesize_index() crash on 4K w/64K hash

Gavin Shan <gwshan@linux.vnet.ibm.com>
    powerpc/eeh: Fix fenced PHB caused by eeh_slot_error_detail()

Daniel Axtens <dja@axtens.net>
    powerpc/eeh: Probe after unbalanced kref check

Gavin Shan <gwshan@linux.vnet.ibm.com>
    powerpc/pseries: Fix corrupted pdn list

David Dueck <davidcdueck@googlemail.com>
    pinctrl: at91: fix null pointer dereference

Hongzhou Yang <hongzhou.yang@mediatek.com>
    pinctrl: mediatek: Fix multiple registration issue.

Niranjan Sivakumar <ns253@cornell.edu>
    ALSA: hda - Fix white noise on Dell M3800

Woodrow Shen <woodrow.shen@canonical.com>
    ALSA: hda - Add some FIXUP quirks for white noise on Dell laptop.

Takashi Iwai <tiwai@suse.de>
    ALSA: hda - Use ALC880_FIXUP_FUJITSU for FSC Amilo M1437

Takashi Iwai <tiwai@suse.de>
    ALSA: hda - Enable headphone jack detect on old Fujitsu laptops

Takashi Iwai <tiwai@suse.de>
    ALSA: hda - Fix missing inline for dummy snd_hdac_set_codec_wakeup()

Yao-Wen Mao <yaowen@google.com>
    ALSA: usb-audio: correct the value cache check.

Takashi Iwai <tiwai@suse.de>
    Input: evdev - do not report errors form flush()

Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Input: synaptics - fix handling of disabling gesture mode

Marc Zyngier <marc.zyngier@arm.com>
    arm64: KVM: Disable virtual timer even if the guest is not using it

Will Deacon <will.deacon@arm.com>
    KVM: arm64: add workaround for Cortex-A57 erratum #852523

Pavel Fedin <p.fedin@samsung.com>
    arm/arm64: KVM: vgic: Check for !irqchip_in_kernel() when mapping resources

Will Deacon <will.deacon@arm.com>
    arm64: errata: add module build workaround for erratum #843419

Will Deacon <will.deacon@arm.com>
    arm64: head.S: initialise mdcr_el2 in el2_setup

Will Deacon <will.deacon@arm.com>
    arm64: compat: fix vfp save/restore across signal handlers in big-endian

Ard Biesheuvel <ard.biesheuvel@linaro.org>
    arm64: set MAX_MEMBLOCK_ADDR according to linear region size

Ard Biesheuvel <ard.biesheuvel@linaro.org>
    of/fdt: make memblock maximum physical address arch configurable

Ard Biesheuvel <ard.biesheuvel@linaro.org>
    arm64: flush FP/SIMD state correctly after execve()

Will Deacon <will.deacon@arm.com>
    arm64: entry: always restore x0 from the stack on syscall return

Jeff Vander Stoep <jeffv@google.com>
    arm64: kconfig: Move LIST_POISON to a safe value

Theodore Ts'o <tytso@mit.edu>
    Revert "ext4: remove block_device_ejected"

Eric Sandeen <sandeen@redhat.com>
    ext4: don't manipulate recovery flag when freezing no-journal fs

Daniel Axtens <dja@axtens.net>
    cxl: Fix unbalanced pci_dev_get in cxl_probe

Daniel Axtens <dja@axtens.net>
    cxl: Remove racy attempt to force EEH invocation in reset

Andrew Donnellan <andrew.donnellan@au1.ibm.com>
    cxl: Allow release of contexts which have been OPENED but not STARTED

Bob Copeland <me@bobcopeland.com>
    mac80211: enable assoc check for mesh interfaces

Markos Chandras <markos.chandras@imgtec.com>
    MIPS: math-emu: Emulate missing BC1{EQ,NE}Z instructions

Markos Chandras <markos.chandras@imgtec.com>
    MIPS: math-emu: Allow m{f,t}hc emulation on MIPS R6

Paul Burton <paul.burton@imgtec.com>
    MIPS: CPS: use 32b accesses to GCRs

Jean Delvare <jdelvare@suse.de>
    tg3: Fix temperature reporting

Shota Suzuki <suzuki_shota_t3@lab.ntt.co.jp>
    igb: Fix oops caused by missing queue pairing

Larry Finger <Larry.Finger@lwfinger.net>
    rtlwifi: rtl8821ae: Fix an expression that is always false

Adrien Schildknecht <adrien+dev@schischi.me>
    rtlwifi: rtl8192cu: Add new device ID

Eric W. Biederman <ebiederm@xmission.com>
    unshare: Unsharing a thread does not require unsharing a vm

Ming Lei <ming.lei@canonical.com>
    blk-mq: fix race between timeout and freeing request

Ming Lei <ming.lei@canonical.com>
    blk-mq: fix buffer overflow when reading sysfs file of 'pending'

Christophe Ricard <christophe.ricard@gmail.com>
    nfc: nci: hci: Add check on skb nci_hci_send_cmd parameter

Christophe Ricard <christophe.ricard@gmail.com>
    nfc: netlink: Warning fix

Christophe Ricard <christophe.ricard@gmail.com>
    nfc: netlink: Add check on NFC_ATTR_VENDOR_DATA

Christophe Ricard <christophe.ricard@gmail.com>
    nfc: st-nci: Free data with irrelevant NDLC PCB_SYNC value

Christophe Ricard <christophe.ricard@gmail.com>
    nfc: st-nci: Remove data from ack_pending_q when receiving a SYNC_ACK

Christophe Ricard <christophe.ricard@gmail.com>
    NFC: st-nci: fix use of uninitialized variables in error path

Christophe Ricard <christophe.ricard@gmail.com>
    NFC: st21nfca: fix use of uninitialized variables in error path

Christophe Ricard <christophe.ricard@gmail.com>
    nfc: st-nci: Fix non accurate comment for st_nci_i2c_read

Christophe Ricard <christophe.ricard@gmail.com>
    nfc: st-nci: Fix typo when changing from st21nfcb to st-nci

Christophe Ricard <christophe.ricard@gmail.com>
    nfc: st-nci: Remove duplicate file platform_data/st_nci.h


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

Diffstat:

 Makefile                                          |  4 +-
 arch/arm/boot/compressed/decompress.c             |  2 +-
 arch/arm/kvm/arm.c                                |  2 +-
 arch/arm64/Kconfig                                | 20 ++++++
 arch/arm64/Makefile                               |  4 ++
 arch/arm64/include/asm/memory.h                   |  8 +++
 arch/arm64/kernel/entry.S                         | 17 ++---
 arch/arm64/kernel/fpsimd.c                        |  1 +
 arch/arm64/kernel/head.S                          |  5 ++
 arch/arm64/kernel/module.c                        |  2 +
 arch/arm64/kernel/signal32.c                      | 47 ++++++++++---
 arch/arm64/kvm/hyp.S                              |  9 ++-
 arch/h8300/boot/compressed/misc.c                 |  2 +-
 arch/m32r/boot/compressed/misc.c                  |  3 +-
 arch/mips/boot/compressed/decompress.c            |  4 +-
 arch/mips/kernel/cps-vec.S                        |  4 +-
 arch/mips/math-emu/cp1emu.c                       | 24 ++++++-
 arch/parisc/kernel/irq.c                          |  8 ++-
 arch/parisc/kernel/syscall.S                      |  2 +-
 arch/powerpc/boot/Makefile                        |  3 +
 arch/powerpc/include/asm/pgtable-ppc64.h          | 14 +++-
 arch/powerpc/include/asm/rtas.h                   |  1 +
 arch/powerpc/include/asm/switch_to.h              |  1 +
 arch/powerpc/kernel/eeh.c                         | 27 ++++++--
 arch/powerpc/kernel/process.c                     |  3 -
 arch/powerpc/kernel/rtas.c                        | 17 +++++
 arch/powerpc/mm/hugepage-hash64.c                 |  3 +-
 arch/powerpc/platforms/powernv/pci-ioda.c         | 16 ++++-
 arch/powerpc/platforms/pseries/dlpar.c            |  4 +-
 arch/powerpc/platforms/pseries/ras.c              |  3 +-
 arch/powerpc/platforms/pseries/setup.c            |  5 ++
 arch/s390/boot/compressed/misc.c                  |  2 +-
 arch/sh/boot/compressed/misc.c                    |  2 +-
 arch/unicore32/boot/compressed/misc.c             |  4 +-
 arch/x86/boot/compressed/misc.c                   |  3 +-
 arch/x86/mm/init_32.c                             |  1 +
 block/blk-flush.c                                 | 15 +++-
 block/blk-mq-sysfs.c                              | 25 +++++--
 block/blk-mq-tag.c                                |  4 +-
 block/blk-mq-tag.h                                | 12 ++++
 block/blk-mq.c                                    | 16 +----
 block/blk.h                                       |  6 ++
 drivers/base/node.c                               | 10 +++
 drivers/crypto/vmx/aes.c                          |  3 +
 drivers/crypto/vmx/aes_cbc.c                      |  3 +
 drivers/crypto/vmx/aes_ctr.c                      |  3 +
 drivers/crypto/vmx/ghash.c                        |  4 ++
 drivers/gpu/drm/i915/intel_ddi.c                  | 11 ++-
 drivers/gpu/drm/i915/intel_dp.c                   | 46 ++++++-------
 drivers/gpu/drm/i915/intel_dp_mst.c               |  5 ++
 drivers/gpu/drm/i915/intel_drv.h                  |  1 +
 drivers/gpu/drm/radeon/radeon_combios.c           |  8 +++
 drivers/i2c/busses/i2c-xgene-slimpro.c            |  8 +--
 drivers/infiniband/core/uverbs.h                  |  3 +-
 drivers/infiniband/core/uverbs_cmd.c              | 10 ++-
 drivers/infiniband/core/uverbs_main.c             | 43 ++++++++----
 drivers/infiniband/hw/mlx4/ah.c                   |  6 +-
 drivers/infiniband/hw/mlx4/cq.c                   |  2 +-
 drivers/infiniband/hw/mlx4/mcg.c                  |  7 +-
 drivers/infiniband/hw/mlx4/sysfs.c                |  5 +-
 drivers/infiniband/hw/mlx5/mr.c                   | 12 ----
 drivers/infiniband/hw/qib/qib_keys.c              |  4 ++
 drivers/infiniband/hw/qib/qib_verbs.c             | 14 ++--
 drivers/infiniband/hw/qib/qib_verbs.h             |  2 +
 drivers/infiniband/ulp/iser/iscsi_iser.c          | 12 ++--
 drivers/infiniband/ulp/iser/iscsi_iser.h          |  2 +
 drivers/infiniband/ulp/iser/iser_initiator.c      |  8 ++-
 drivers/infiniband/ulp/srp/ib_srp.c               | 12 +++-
 drivers/input/evdev.c                             | 13 ++--
 drivers/input/mouse/synaptics.c                   | 12 ++--
 drivers/iommu/fsl_pamu.c                          | 26 +++----
 drivers/iommu/intel-iommu.c                       |  2 +-
 drivers/iommu/io-pgtable-arm.c                    | 17 ++++-
 drivers/iommu/tegra-smmu.c                        |  9 ++-
 drivers/media/platform/am437x/am437x-vpfe.c       | 16 ++++-
 drivers/media/platform/omap3isp/isp.c             | 27 ++++----
 drivers/media/platform/xilinx/xilinx-dma.c        |  4 +-
 drivers/media/rc/rc-main.c                        |  3 -
 drivers/memory/tegra/tegra114.c                   |  1 +
 drivers/memory/tegra/tegra124.c                   |  1 +
 drivers/memory/tegra/tegra30.c                    |  1 +
 drivers/misc/cxl/api.c                            |  2 +-
 drivers/misc/cxl/pci.c                            | 23 -------
 drivers/mmc/core/core.c                           |  6 +-
 drivers/mmc/host/sdhci-of-esdhc.c                 |  6 ++
 drivers/mmc/host/sdhci-pci.c                      |  1 +
 drivers/mmc/host/sdhci.c                          | 71 ++++++++-----------
 drivers/mmc/host/sdhci.h                          |  8 +--
 drivers/net/ethernet/broadcom/tg3.c               |  2 +-
 drivers/net/ethernet/intel/igb/igb.h              |  1 +
 drivers/net/ethernet/intel/igb/igb_ethtool.c      |  5 +-
 drivers/net/ethernet/intel/igb/igb_main.c         | 16 ++++-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |  5 +-
 drivers/net/wireless/rtlwifi/rtl8192cu/sw.c       |  1 +
 drivers/net/wireless/rtlwifi/rtl8821ae/hw.c       |  2 +-
 drivers/net/wireless/rtlwifi/rtl8821ae/reg.h      |  1 +
 drivers/nfc/st-nci/i2c.c                          | 23 +++----
 drivers/nfc/st-nci/ndlc.c                         |  6 +-
 drivers/nfc/st-nci/st-nci_se.c                    |  8 +--
 drivers/nfc/st21nfca/st21nfca.c                   | 11 +--
 drivers/of/fdt.c                                  | 12 ++--
 drivers/parisc/lba_pci.c                          |  7 +-
 drivers/pci/Kconfig                               |  2 +-
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c     | 21 +++---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h     |  1 +
 drivers/pinctrl/pinctrl-at91.c                    | 15 ++++
 drivers/platform/x86/ideapad-laptop.c             |  7 ++
 drivers/rtc/rtc-abx80x.c                          |  2 +-
 drivers/rtc/rtc-s3c.c                             | 24 +++++--
 drivers/rtc/rtc-s5m.c                             | 10 +++
 fs/btrfs/transaction.c                            |  3 +
 fs/cifs/ioctl.c                                   |  6 ++
 fs/coredump.c                                     | 46 ++++++++++---
 fs/ecryptfs/dentry.c                              | 16 ++---
 fs/ext4/super.c                                   | 30 ++++++--
 fs/hfs/bnode.c                                    |  9 ++-
 fs/hfs/brec.c                                     | 20 +++---
 fs/hfsplus/bnode.c                                |  3 -
 fs/jbd2/checkpoint.c                              | 39 +++++++++--
 fs/jbd2/commit.c                                  |  2 +-
 fs/jbd2/journal.c                                 | 11 ++-
 fs/nfs/flexfilelayout/flexfilelayout.c            |  5 ++
 fs/nfs/flexfilelayout/flexfilelayoutdev.c         |  7 +-
 fs/nfs/inode.c                                    | 15 ++--
 fs/nfs/internal.h                                 | 15 ++--
 fs/nfs/nfs4proc.c                                 | 22 ++++--
 fs/nfs/pagelist.c                                 |  4 +-
 fs/nfs/pnfs_nfs.c                                 | 38 +++++-----
 fs/nfs/write.c                                    | 29 ++++++--
 fs/nfsd/nfs4state.c                               | 84 ++++++++++++++---------
 fs/nfsd/nfs4xdr.c                                 | 45 ++++++++----
 include/linux/jbd2.h                              |  3 +-
 include/linux/platform_data/st_nci.h              | 29 --------
 include/linux/sunrpc/svc_rdma.h                   |  9 +--
 include/linux/sunrpc/xprtsock.h                   |  3 +
 include/soc/tegra/mc.h                            |  1 +
 include/sound/hda_i915.h                          |  2 +-
 include/trace/events/sunrpc.h                     | 21 ++++--
 kernel/fork.c                                     | 28 +++++---
 kernel/workqueue.c                                |  2 +-
 lib/decompress_bunzip2.c                          |  6 +-
 lib/decompress_inflate.c                          | 31 +++++++--
 lib/decompress_unlz4.c                            |  6 +-
 lib/decompress_unlzma.c                           |  7 +-
 lib/decompress_unlzo.c                            | 13 +++-
 lib/decompress_unxz.c                             | 12 +++-
 mm/vmscan.c                                       |  2 +-
 net/mac80211/tx.c                                 |  3 -
 net/nfc/nci/hci.c                                 |  2 +-
 net/nfc/netlink.c                                 |  5 +-
 net/sunrpc/xprt.c                                 |  6 ++
 net/sunrpc/xprtrdma/svc_rdma_transport.c          |  2 +-
 net/sunrpc/xprtrdma/xprt_rdma.h                   |  1 -
 net/sunrpc/xprtsock.c                             | 21 ++++--
 sound/pci/hda/patch_realtek.c                     | 12 ++--
 sound/usb/mixer.c                                 |  2 +-
 156 files changed, 1136 insertions(+), 572 deletions(-)



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

* [PATCH 4.2 001/134] nfc: st-nci: Remove duplicate file platform_data/st_nci.h
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 002/134] nfc: st-nci: Fix typo when changing from st21nfcb to st-nci Greg Kroah-Hartman
                   ` (132 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Hauke Mehrtens, Christophe Ricard,
	Samuel Ortiz

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

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

From: Christophe Ricard <christophe.ricard@gmail.com>

commit 76b733d15874128ee2d0365b4cbe7d51decd8d37 upstream.

commit "nfc: st-nci: Rename st21nfcb to st-nci" adds
include/linux/platform_data/st_nci.h duplicated with
include/linux/platform_data/st-nci.h.

Only drivers/nfc/st-nci/i2c.c uses platform_data/st_nci.h.

Reported-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/nfc/st-nci/i2c.c             |    2 +-
 include/linux/platform_data/st_nci.h |   29 -----------------------------
 2 files changed, 1 insertion(+), 30 deletions(-)

--- a/drivers/nfc/st-nci/i2c.c
+++ b/drivers/nfc/st-nci/i2c.c
@@ -25,7 +25,7 @@
 #include <linux/interrupt.h>
 #include <linux/delay.h>
 #include <linux/nfc.h>
-#include <linux/platform_data/st_nci.h>
+#include <linux/platform_data/st-nci.h>
 
 #include "ndlc.h"
 
--- a/include/linux/platform_data/st_nci.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Driver include for ST NCI NFC chip family.
- *
- * Copyright (C) 2014-2015  STMicroelectronics SAS. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _ST_NCI_H_
-#define _ST_NCI_H_
-
-#define ST_NCI_DRIVER_NAME "st_nci"
-
-struct st_nci_nfc_platform_data {
-	unsigned int gpio_reset;
-	unsigned int irq_polarity;
-};
-
-#endif /* _ST_NCI_H_ */



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

* [PATCH 4.2 002/134] nfc: st-nci: Fix typo when changing from st21nfcb to st-nci
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 001/134] nfc: st-nci: Remove duplicate file platform_data/st_nci.h Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 003/134] nfc: st-nci: Fix non accurate comment for st_nci_i2c_read Greg Kroah-Hartman
                   ` (131 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Christophe Ricard, Samuel Ortiz

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

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

From: Christophe Ricard <christophe.ricard@gmail.com>

commit 30458aac63c89771d19f023083d64d018562812e upstream.

Replace ST21NFCB with ST_NCI or st21nfcb with st_nci as it
was forgotten in commit "nfc: st-nci: Rename st21nfcb to st-nci"
ed06aeefdac348cfb91a3db5fe1067e3202afd70

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/nfc/st-nci/i2c.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

--- a/drivers/nfc/st-nci/i2c.c
+++ b/drivers/nfc/st-nci/i2c.c
@@ -29,11 +29,11 @@
 
 #include "ndlc.h"
 
-#define DRIVER_DESC "NCI NFC driver for ST21NFCB"
+#define DRIVER_DESC "NCI NFC driver for ST_NCI"
 
 /* ndlc header */
-#define ST21NFCB_FRAME_HEADROOM	1
-#define ST21NFCB_FRAME_TAILROOM 0
+#define ST_NCI_FRAME_HEADROOM	1
+#define ST_NCI_FRAME_TAILROOM 0
 
 #define ST_NCI_I2C_MIN_SIZE 4   /* PCB(1) + NCI Packet header(3) */
 #define ST_NCI_I2C_MAX_SIZE 250 /* req 4.2.1 */
@@ -118,14 +118,14 @@ static int st_nci_i2c_write(void *phy_id
 /*
  * Reads an ndlc frame and returns it in a newly allocated sk_buff.
  * returns:
- * frame size : if received frame is complete (find ST21NFCB_SOF_EOF at
+ * frame size : if received frame is complete (find ST_NCI_SOF_EOF at
  * end of read)
- * -EAGAIN : if received frame is incomplete (not find ST21NFCB_SOF_EOF
+ * -EAGAIN : if received frame is incomplete (not find ST_NCI_SOF_EOF
  * at end of read)
  * -EREMOTEIO : i2c read error (fatal)
  * -EBADMSG : frame was incorrect and discarded
  * (value returned from st_nci_i2c_repack)
- * -EIO : if no ST21NFCB_SOF_EOF is found after reaching
+ * -EIO : if no ST_NCI_SOF_EOF is found after reaching
  * the read length end sequence
  */
 static int st_nci_i2c_read(struct st_nci_i2c_phy *phy,
@@ -179,7 +179,7 @@ static int st_nci_i2c_read(struct st_nci
 /*
  * Reads an ndlc frame from the chip.
  *
- * On ST21NFCB, IRQ goes in idle state when read starts.
+ * On ST_NCI, IRQ goes in idle state when read starts.
  */
 static irqreturn_t st_nci_irq_thread_fn(int irq, void *phy_id)
 {
@@ -325,12 +325,12 @@ static int st_nci_i2c_probe(struct i2c_c
 		}
 	} else {
 		nfc_err(&client->dev,
-			"st21nfcb platform resources not available\n");
+			"st_nci platform resources not available\n");
 		return -ENODEV;
 	}
 
 	r = ndlc_probe(phy, &i2c_phy_ops, &client->dev,
-			ST21NFCB_FRAME_HEADROOM, ST21NFCB_FRAME_TAILROOM,
+			ST_NCI_FRAME_HEADROOM, ST_NCI_FRAME_TAILROOM,
 			&phy->ndlc);
 	if (r < 0) {
 		nfc_err(&client->dev, "Unable to register ndlc layer\n");



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

* [PATCH 4.2 003/134] nfc: st-nci: Fix non accurate comment for st_nci_i2c_read
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 001/134] nfc: st-nci: Remove duplicate file platform_data/st_nci.h Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 002/134] nfc: st-nci: Fix typo when changing from st21nfcb to st-nci Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 004/134] NFC: st21nfca: fix use of uninitialized variables in error path Greg Kroah-Hartman
                   ` (130 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Christophe Ricard, Samuel Ortiz

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

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

From: Christophe Ricard <christophe.ricard@gmail.com>

commit e7723b33077b04648213f043bc22654c54e375e4 upstream.

Due to a copy and paste error st_nci_i2c_read still contains
st21nfca header comment.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/nfc/st-nci/i2c.c |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

--- a/drivers/nfc/st-nci/i2c.c
+++ b/drivers/nfc/st-nci/i2c.c
@@ -118,15 +118,10 @@ static int st_nci_i2c_write(void *phy_id
 /*
  * Reads an ndlc frame and returns it in a newly allocated sk_buff.
  * returns:
- * frame size : if received frame is complete (find ST_NCI_SOF_EOF at
- * end of read)
- * -EAGAIN : if received frame is incomplete (not find ST_NCI_SOF_EOF
- * at end of read)
+ * 0 : if received frame is complete
  * -EREMOTEIO : i2c read error (fatal)
  * -EBADMSG : frame was incorrect and discarded
- * (value returned from st_nci_i2c_repack)
- * -EIO : if no ST_NCI_SOF_EOF is found after reaching
- * the read length end sequence
+ * -ENOMEM : cannot allocate skb, frame dropped
  */
 static int st_nci_i2c_read(struct st_nci_i2c_phy *phy,
 				 struct sk_buff **skb)



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

* [PATCH 4.2 004/134] NFC: st21nfca: fix use of uninitialized variables in error path
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (2 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 003/134] nfc: st-nci: Fix non accurate comment for st_nci_i2c_read Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 005/134] NFC: st-nci: " Greg Kroah-Hartman
                   ` (129 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christophe Ricard, Nicolas Iooss,
	Samuel Ortiz

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

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

From: Christophe Ricard <christophe.ricard@gmail.com>

commit 5a3570061a131309143a49e4bbdbce7e23f261e7 upstream.

st21nfca_hci_load_session() calls kfree_skb() on unitialized
variables skb_pipe_info and skb_pipe_list if the call to
nfc_hci_connect_gate() failed. Reword the error path to not use
these variables when they are not initialized. While at it, there
seemed to be a memory leak because skb_pipe_info was only freed
once, after the for-loop, even though several ones were created
by nfc_hci_send_cmd.

Fixes: ec03ff1a8f9a
("NFC: st21nfca: Remove skb_pipe_list and skb_pipe_info
useless allocation")

Acked-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/nfc/st21nfca/st21nfca.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

--- a/drivers/nfc/st21nfca/st21nfca.c
+++ b/drivers/nfc/st21nfca/st21nfca.c
@@ -148,14 +148,14 @@ static int st21nfca_hci_load_session(str
 				ST21NFCA_DEVICE_MGNT_GATE,
 				ST21NFCA_DEVICE_MGNT_PIPE);
 	if (r < 0)
-		goto free_info;
+		return r;
 
 	/* Get pipe list */
 	r = nfc_hci_send_cmd(hdev, ST21NFCA_DEVICE_MGNT_GATE,
 			ST21NFCA_DM_GETINFO, pipe_list, sizeof(pipe_list),
 			&skb_pipe_list);
 	if (r < 0)
-		goto free_info;
+		return r;
 
 	/* Complete the existing gate_pipe table */
 	for (i = 0; i < skb_pipe_list->len; i++) {
@@ -181,6 +181,7 @@ static int st21nfca_hci_load_session(str
 			info->src_host_id != ST21NFCA_ESE_HOST_ID) {
 			pr_err("Unexpected apdu_reader pipe on host %x\n",
 				info->src_host_id);
+			kfree_skb(skb_pipe_info);
 			continue;
 		}
 
@@ -200,6 +201,7 @@ static int st21nfca_hci_load_session(str
 			hdev->pipes[st21nfca_gates[j].pipe].dest_host =
 							info->src_host_id;
 		}
+		kfree_skb(skb_pipe_info);
 	}
 
 	/*
@@ -214,13 +216,12 @@ static int st21nfca_hci_load_session(str
 					st21nfca_gates[i].gate,
 					st21nfca_gates[i].pipe);
 			if (r < 0)
-				goto free_info;
+				goto free_list;
 		}
 	}
 
 	memcpy(hdev->init_data.gates, st21nfca_gates, sizeof(st21nfca_gates));
-free_info:
-	kfree_skb(skb_pipe_info);
+free_list:
 	kfree_skb(skb_pipe_list);
 	return r;
 }



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

* [PATCH 4.2 005/134] NFC: st-nci: fix use of uninitialized variables in error path
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (3 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 004/134] NFC: st21nfca: fix use of uninitialized variables in error path Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 006/134] nfc: st-nci: Remove data from ack_pending_q when receiving a SYNC_ACK Greg Kroah-Hartman
                   ` (128 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christophe Ricard, Nicolas Iooss,
	Samuel Ortiz

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

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

From: Christophe Ricard <christophe.ricard@gmail.com>

commit daaf1e1f1640eb11259954d1d847d8a72ab5b938 upstream.

st_nci_hci_load_session() calls kfree_skb() on unitialized
variables skb_pipe_info and skb_pipe_list if the call to
nci_hci_connect_gate() failed. Reword the error path to not use
these variables when they are not initialized. While at it, there
seemed to be a memory leak because skb_pipe_info was only freed
once, after the for-loop, even though several ones were created
by nci_hci_send_cmd.

Acked-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/nfc/st-nci/st-nci_se.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/drivers/nfc/st-nci/st-nci_se.c
+++ b/drivers/nfc/st-nci/st-nci_se.c
@@ -189,14 +189,14 @@ int st_nci_hci_load_session(struct nci_d
 				ST_NCI_DEVICE_MGNT_GATE,
 				ST_NCI_DEVICE_MGNT_PIPE);
 	if (r < 0)
-		goto free_info;
+		return r;
 
 	/* Get pipe list */
 	r = nci_hci_send_cmd(ndev, ST_NCI_DEVICE_MGNT_GATE,
 			ST_NCI_DM_GETINFO, pipe_list, sizeof(pipe_list),
 			&skb_pipe_list);
 	if (r < 0)
-		goto free_info;
+		return r;
 
 	/* Complete the existing gate_pipe table */
 	for (i = 0; i < skb_pipe_list->len; i++) {
@@ -222,6 +222,7 @@ int st_nci_hci_load_session(struct nci_d
 		    dm_pipe_info->src_host_id != ST_NCI_ESE_HOST_ID) {
 			pr_err("Unexpected apdu_reader pipe on host %x\n",
 			       dm_pipe_info->src_host_id);
+			kfree_skb(skb_pipe_info);
 			continue;
 		}
 
@@ -241,13 +242,12 @@ int st_nci_hci_load_session(struct nci_d
 			ndev->hci_dev->pipes[st_nci_gates[j].pipe].host =
 						dm_pipe_info->src_host_id;
 		}
+		kfree_skb(skb_pipe_info);
 	}
 
 	memcpy(ndev->hci_dev->init_data.gates, st_nci_gates,
 	       sizeof(st_nci_gates));
 
-free_info:
-	kfree_skb(skb_pipe_info);
 	kfree_skb(skb_pipe_list);
 	return r;
 }



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

* [PATCH 4.2 006/134] nfc: st-nci: Remove data from ack_pending_q when receiving a SYNC_ACK
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (4 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 005/134] NFC: st-nci: " Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 007/134] nfc: st-nci: Free data with irrelevant NDLC PCB_SYNC value Greg Kroah-Hartman
                   ` (127 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Christophe Ricard, Samuel Ortiz

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

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

From: Christophe Ricard <christophe.ricard@gmail.com>

commit 1d816b6eb513498aa28a0ff1e4db7632bded1707 upstream.

When receiving a NDLC PCB_SYNC_ACK the pending data was never
removed from ack_pending_q and cleared.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/nfc/st-nci/ndlc.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/nfc/st-nci/ndlc.c
+++ b/drivers/nfc/st-nci/ndlc.c
@@ -171,6 +171,8 @@ static void llt_ndlc_rcv_queue(struct ll
 		if ((pcb & PCB_TYPE_MASK) == PCB_TYPE_SUPERVISOR) {
 			switch (pcb & PCB_SYNC_MASK) {
 			case PCB_SYNC_ACK:
+				skb = skb_dequeue(&ndlc->ack_pending_q);
+				kfree_skb(skb);
 				del_timer_sync(&ndlc->t1_timer);
 				del_timer_sync(&ndlc->t2_timer);
 				ndlc->t2_active = false;



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

* [PATCH 4.2 007/134] nfc: st-nci: Free data with irrelevant NDLC PCB_SYNC value
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (5 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 006/134] nfc: st-nci: Remove data from ack_pending_q when receiving a SYNC_ACK Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 008/134] nfc: netlink: Add check on NFC_ATTR_VENDOR_DATA Greg Kroah-Hartman
                   ` (126 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Christophe Ricard, Samuel Ortiz

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

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

From: Christophe Ricard <christophe.ricard@gmail.com>

commit 8b706884eac958ec16518315053f77e052627084 upstream.

PCB_SYNC different than PCB_TYPE_SUPERVISOR or PCB_TYPE_DATAFRAME
should be discarded.

Irrelevant data may be forwarded up to the ndlc state machine by
phys like spi to prevent missing potential data during "write"
transactions.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/nfc/st-nci/ndlc.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/nfc/st-nci/ndlc.c
+++ b/drivers/nfc/st-nci/ndlc.c
@@ -198,8 +198,10 @@ static void llt_ndlc_rcv_queue(struct ll
 				kfree_skb(skb);
 				break;
 			}
-		} else {
+		} else if ((pcb & PCB_TYPE_MASK) == PCB_TYPE_DATAFRAME) {
 			nci_recv_frame(ndlc->ndev, skb);
+		} else {
+			kfree_skb(skb);
 		}
 	}
 }



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

* [PATCH 4.2 008/134] nfc: netlink: Add check on NFC_ATTR_VENDOR_DATA
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (6 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 007/134] nfc: st-nci: Free data with irrelevant NDLC PCB_SYNC value Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 009/134] nfc: netlink: Warning fix Greg Kroah-Hartman
                   ` (125 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Christophe Ricard, Samuel Ortiz

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

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

From: Christophe Ricard <christophe.ricard@gmail.com>

commit fe202fe95564023223ce1910c9e352f391abb1d5 upstream.

NFC_ATTR_VENDOR_DATA is an optional vendor_cmd argument.
The current code was potentially using a non existing argument
leading to potential catastrophic results.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/nfc/netlink.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/net/nfc/netlink.c
+++ b/net/nfc/netlink.c
@@ -1518,8 +1518,8 @@ static int nfc_genl_vendor_cmd(struct sk
 	if (!dev || !dev->vendor_cmds || !dev->n_vendor_cmds)
 		return -ENODEV;
 
-	data = nla_data(info->attrs[NFC_ATTR_VENDOR_DATA]);
-	if (data) {
+	if (info->attrs[NFC_ATTR_VENDOR_DATA]) {
+		data = nla_data(info->attrs[NFC_ATTR_VENDOR_DATA]);
 		data_len = nla_len(info->attrs[NFC_ATTR_VENDOR_DATA]);
 		if (data_len == 0)
 			return -EINVAL;



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

* [PATCH 4.2 009/134] nfc: netlink: Warning fix
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (7 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 008/134] nfc: netlink: Add check on NFC_ATTR_VENDOR_DATA Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 010/134] nfc: nci: hci: Add check on skb nci_hci_send_cmd parameter Greg Kroah-Hartman
                   ` (124 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Christophe Ricard, Samuel Ortiz

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

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

From: Christophe Ricard <christophe.ricard@gmail.com>

commit adca3c38d807b341a965d0aba8721d0784d8471b upstream.

When NFC_ATTR_VENDOR_DATA is not set, data_len is 0 and data is NULL.

Fixes the following warning:

net/nfc/netlink.c:1536:3: warning: 'data' may be used uninitialized
+in this function [-Wmaybe-uninitialized]
      return cmd->doit(dev, data, data_len);

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/nfc/netlink.c |    1 +
 1 file changed, 1 insertion(+)

--- a/net/nfc/netlink.c
+++ b/net/nfc/netlink.c
@@ -1524,6 +1524,7 @@ static int nfc_genl_vendor_cmd(struct sk
 		if (data_len == 0)
 			return -EINVAL;
 	} else {
+		data = NULL;
 		data_len = 0;
 	}
 



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

* [PATCH 4.2 010/134] nfc: nci: hci: Add check on skb nci_hci_send_cmd parameter
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (8 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 009/134] nfc: netlink: Warning fix Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 011/134] blk-mq: fix buffer overflow when reading sysfs file of pending Greg Kroah-Hartman
                   ` (123 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Christophe Ricard, Samuel Ortiz

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

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

From: Christophe Ricard <christophe.ricard@gmail.com>

commit 5a9e0ffc0f128ecdf7c770f76c268e4f9f3c9118 upstream.

skb can be NULL and may lead to a NULL pointer error.

Add a check condition before setting HCI rx buffer.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/nfc/nci/hci.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/nfc/nci/hci.c
+++ b/net/nfc/nci/hci.c
@@ -233,7 +233,7 @@ int nci_hci_send_cmd(struct nci_dev *nde
 	r = nci_request(ndev, nci_hci_send_data_req, (unsigned long)&data,
 			msecs_to_jiffies(NCI_DATA_TIMEOUT));
 
-	if (r == NCI_STATUS_OK)
+	if (r == NCI_STATUS_OK && skb)
 		*skb = conn_info->rx_skb;
 
 	return r;



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

* [PATCH 4.2 011/134] blk-mq: fix buffer overflow when reading sysfs file of pending
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (9 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 010/134] nfc: nci: hci: Add check on skb nci_hci_send_cmd parameter Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 012/134] blk-mq: fix race between timeout and freeing request Greg Kroah-Hartman
                   ` (122 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ming Lei, Jens Axboe

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

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

From: Ming Lei <ming.lei@canonical.com>

commit 596f5aad2a704b72934e5abec1b1b4114c16f45b upstream.

There may be lots of pending requests so that the buffer of PAGE_SIZE
can't hold them at all.

One typical example is scsi-mq, the queue depth(.can_queue) of
scsi_host and blk-mq is quite big but scsi_device's queue_depth
is a bit small(.cmd_per_lun), then it is quite easy to have lots
of pending requests in hw queue.

This patch fixes the following warning and the related memory
destruction.

[  359.025101] fill_read_buffer: blk_mq_hw_sysfs_show+0x0/0x7d returned bad count^M
[  359.055595] irq event stamp: 15537^M
[  359.055606] general protection fault: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC ^M
[  359.055614] Dumping ftrace buffer:^M
[  359.055660]    (ftrace buffer empty)^M
[  359.055672] Modules linked in: nbd ipv6 kvm_intel kvm serio_raw^M
[  359.055678] CPU: 4 PID: 21631 Comm: stress-ng-sysfs Not tainted 4.2.0-rc5-next-20150805 #434^M
[  359.055679] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011^M
[  359.055682] task: ffff8802161cc000 ti: ffff88021b4a8000 task.ti: ffff88021b4a8000^M
[  359.055693] RIP: 0010:[<ffffffff811541c5>]  [<ffffffff811541c5>] __kmalloc+0xe8/0x152^M

Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 block/blk-mq-sysfs.c |   21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

--- a/block/blk-mq-sysfs.c
+++ b/block/blk-mq-sysfs.c
@@ -141,15 +141,26 @@ static ssize_t blk_mq_sysfs_completed_sh
 
 static ssize_t sysfs_list_show(char *page, struct list_head *list, char *msg)
 {
-	char *start_page = page;
 	struct request *rq;
+	int len = snprintf(page, PAGE_SIZE - 1, "%s:\n", msg);
 
-	page += sprintf(page, "%s:\n", msg);
+	list_for_each_entry(rq, list, queuelist) {
+		const int rq_len = 2 * sizeof(rq) + 2;
 
-	list_for_each_entry(rq, list, queuelist)
-		page += sprintf(page, "\t%p\n", rq);
+		/* if the output will be truncated */
+		if (PAGE_SIZE - 1 < len + rq_len) {
+			/* backspacing if it can't hold '\t...\n' */
+			if (PAGE_SIZE - 1 < len + 5)
+				len -= rq_len;
+			len += snprintf(page + len, PAGE_SIZE - 1 - len,
+					"\t...\n");
+			break;
+		}
+		len += snprintf(page + len, PAGE_SIZE - 1 - len,
+				"\t%p\n", rq);
+	}
 
-	return page - start_page;
+	return len;
 }
 
 static ssize_t blk_mq_sysfs_rq_list_show(struct blk_mq_ctx *ctx, char *page)



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

* [PATCH 4.2 012/134] blk-mq: fix race between timeout and freeing request
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (10 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 011/134] blk-mq: fix buffer overflow when reading sysfs file of pending Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 013/134] unshare: Unsharing a thread does not require unsharing a vm Greg Kroah-Hartman
                   ` (121 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ming Lei, Jens Axboe

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

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

From: Ming Lei <ming.lei@canonical.com>

commit 0048b4837affd153897ed1222283492070027aa9 upstream.

Inside timeout handler, blk_mq_tag_to_rq() is called
to retrieve the request from one tag. This way is obviously
wrong because the request can be freed any time and some
fiedds of the request can't be trusted, then kernel oops
might be triggered[1].

Currently wrt. blk_mq_tag_to_rq(), the only special case is
that the flush request can share same tag with the request
cloned from, and the two requests can't be active at the same
time, so this patch fixes the above issue by updating tags->rqs[tag]
with the active request(either flush rq or the request cloned
from) of the tag.

Also blk_mq_tag_to_rq() gets much simplified with this patch.

Given blk_mq_tag_to_rq() is mainly for drivers and the caller must
make sure the request can't be freed, so in bt_for_each() this
helper is replaced with tags->rqs[tag].

[1] kernel oops log
[  439.696220] BUG: unable to handle kernel NULL pointer dereference at 0000000000000158^M
[  439.697162] IP: [<ffffffff812d89ba>] blk_mq_tag_to_rq+0x21/0x6e^M
[  439.700653] PGD 7ef765067 PUD 7ef764067 PMD 0 ^M
[  439.700653] Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC ^M
[  439.700653] Dumping ftrace buffer:^M
[  439.700653]    (ftrace buffer empty)^M
[  439.700653] Modules linked in: nbd ipv6 kvm_intel kvm serio_raw^M
[  439.700653] CPU: 6 PID: 2779 Comm: stress-ng-sigfd Not tainted 4.2.0-rc5-next-20150805+ #265^M
[  439.730500] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011^M
[  439.730500] task: ffff880605308000 ti: ffff88060530c000 task.ti: ffff88060530c000^M
[  439.730500] RIP: 0010:[<ffffffff812d89ba>]  [<ffffffff812d89ba>] blk_mq_tag_to_rq+0x21/0x6e^M
[  439.730500] RSP: 0018:ffff880819203da0  EFLAGS: 00010283^M
[  439.730500] RAX: ffff880811b0e000 RBX: ffff8800bb465f00 RCX: 0000000000000002^M
[  439.730500] RDX: 0000000000000000 RSI: 0000000000000202 RDI: 0000000000000000^M
[  439.730500] RBP: ffff880819203db0 R08: 0000000000000002 R09: 0000000000000000^M
[  439.730500] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000202^M
[  439.730500] R13: ffff880814104800 R14: 0000000000000002 R15: ffff880811a2ea00^M
[  439.730500] FS:  00007f165b3f5740(0000) GS:ffff880819200000(0000) knlGS:0000000000000000^M
[  439.730500] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b^M
[  439.730500] CR2: 0000000000000158 CR3: 00000007ef766000 CR4: 00000000000006e0^M
[  439.730500] Stack:^M
[  439.730500]  0000000000000008 ffff8808114eed90 ffff880819203e00 ffffffff812dc104^M
[  439.755663]  ffff880819203e40 ffffffff812d9f5e 0000020000000000 ffff8808114eed80^M
[  439.755663] Call Trace:^M
[  439.755663]  <IRQ> ^M
[  439.755663]  [<ffffffff812dc104>] bt_for_each+0x6e/0xc8^M
[  439.755663]  [<ffffffff812d9f5e>] ? blk_mq_rq_timed_out+0x6a/0x6a^M
[  439.755663]  [<ffffffff812d9f5e>] ? blk_mq_rq_timed_out+0x6a/0x6a^M
[  439.755663]  [<ffffffff812dc1b3>] blk_mq_tag_busy_iter+0x55/0x5e^M
[  439.755663]  [<ffffffff812d88b4>] ? blk_mq_bio_to_request+0x38/0x38^M
[  439.755663]  [<ffffffff812d8911>] blk_mq_rq_timer+0x5d/0xd4^M
[  439.755663]  [<ffffffff810a3e10>] call_timer_fn+0xf7/0x284^M
[  439.755663]  [<ffffffff810a3d1e>] ? call_timer_fn+0x5/0x284^M
[  439.755663]  [<ffffffff812d88b4>] ? blk_mq_bio_to_request+0x38/0x38^M
[  439.755663]  [<ffffffff810a46d6>] run_timer_softirq+0x1ce/0x1f8^M
[  439.755663]  [<ffffffff8104c367>] __do_softirq+0x181/0x3a4^M
[  439.755663]  [<ffffffff8104c76e>] irq_exit+0x40/0x94^M
[  439.755663]  [<ffffffff81031482>] smp_apic_timer_interrupt+0x33/0x3e^M
[  439.755663]  [<ffffffff815559a4>] apic_timer_interrupt+0x84/0x90^M
[  439.755663]  <EOI> ^M
[  439.755663]  [<ffffffff81554350>] ? _raw_spin_unlock_irq+0x32/0x4a^M
[  439.755663]  [<ffffffff8106a98b>] finish_task_switch+0xe0/0x163^M
[  439.755663]  [<ffffffff8106a94d>] ? finish_task_switch+0xa2/0x163^M
[  439.755663]  [<ffffffff81550066>] __schedule+0x469/0x6cd^M
[  439.755663]  [<ffffffff8155039b>] schedule+0x82/0x9a^M
[  439.789267]  [<ffffffff8119b28b>] signalfd_read+0x186/0x49a^M
[  439.790911]  [<ffffffff8106d86a>] ? wake_up_q+0x47/0x47^M
[  439.790911]  [<ffffffff811618c2>] __vfs_read+0x28/0x9f^M
[  439.790911]  [<ffffffff8117a289>] ? __fget_light+0x4d/0x74^M
[  439.790911]  [<ffffffff811620a7>] vfs_read+0x7a/0xc6^M
[  439.790911]  [<ffffffff8116292b>] SyS_read+0x49/0x7f^M
[  439.790911]  [<ffffffff81554c17>] entry_SYSCALL_64_fastpath+0x12/0x6f^M
[  439.790911] Code: 48 89 e5 e8 a9 b8 e7 ff 5d c3 0f 1f 44 00 00 55 89
f2 48 89 e5 41 54 41 89 f4 53 48 8b 47 60 48 8b 1c d0 48 8b 7b 30 48 8b
53 38 <48> 8b 87 58 01 00 00 48 85 c0 75 09 48 8b 97 88 0c 00 00 eb 10
^M
[  439.790911] RIP  [<ffffffff812d89ba>] blk_mq_tag_to_rq+0x21/0x6e^M
[  439.790911]  RSP <ffff880819203da0>^M
[  439.790911] CR2: 0000000000000158^M
[  439.790911] ---[ end trace d40af58949325661 ]---^M

Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 block/blk-flush.c  |   15 ++++++++++++++-
 block/blk-mq-tag.c |    4 ++--
 block/blk-mq-tag.h |   12 ++++++++++++
 block/blk-mq.c     |   16 +---------------
 block/blk.h        |    6 ++++++
 5 files changed, 35 insertions(+), 18 deletions(-)

--- a/block/blk-flush.c
+++ b/block/blk-flush.c
@@ -73,6 +73,7 @@
 
 #include "blk.h"
 #include "blk-mq.h"
+#include "blk-mq-tag.h"
 
 /* FLUSH/FUA sequences */
 enum {
@@ -226,7 +227,12 @@ static void flush_end_io(struct request
 	struct blk_flush_queue *fq = blk_get_flush_queue(q, flush_rq->mq_ctx);
 
 	if (q->mq_ops) {
+		struct blk_mq_hw_ctx *hctx;
+
+		/* release the tag's ownership to the req cloned from */
 		spin_lock_irqsave(&fq->mq_flush_lock, flags);
+		hctx = q->mq_ops->map_queue(q, flush_rq->mq_ctx->cpu);
+		blk_mq_tag_set_rq(hctx, flush_rq->tag, fq->orig_rq);
 		flush_rq->tag = -1;
 	}
 
@@ -308,11 +314,18 @@ static bool blk_kick_flush(struct reques
 
 	/*
 	 * Borrow tag from the first request since they can't
-	 * be in flight at the same time.
+	 * be in flight at the same time. And acquire the tag's
+	 * ownership for flush req.
 	 */
 	if (q->mq_ops) {
+		struct blk_mq_hw_ctx *hctx;
+
 		flush_rq->mq_ctx = first_rq->mq_ctx;
 		flush_rq->tag = first_rq->tag;
+		fq->orig_rq = first_rq;
+
+		hctx = q->mq_ops->map_queue(q, first_rq->mq_ctx->cpu);
+		blk_mq_tag_set_rq(hctx, first_rq->tag, flush_rq);
 	}
 
 	flush_rq->cmd_type = REQ_TYPE_FS;
--- a/block/blk-mq-tag.c
+++ b/block/blk-mq-tag.c
@@ -429,7 +429,7 @@ static void bt_for_each(struct blk_mq_hw
 		for (bit = find_first_bit(&bm->word, bm->depth);
 		     bit < bm->depth;
 		     bit = find_next_bit(&bm->word, bm->depth, bit + 1)) {
-		     	rq = blk_mq_tag_to_rq(hctx->tags, off + bit);
+			rq = hctx->tags->rqs[off + bit];
 			if (rq->q == hctx->queue)
 				fn(hctx, rq, data, reserved);
 		}
@@ -453,7 +453,7 @@ static void bt_tags_for_each(struct blk_
 		for (bit = find_first_bit(&bm->word, bm->depth);
 		     bit < bm->depth;
 		     bit = find_next_bit(&bm->word, bm->depth, bit + 1)) {
-			rq = blk_mq_tag_to_rq(tags, off + bit);
+			rq = tags->rqs[off + bit];
 			fn(rq, data, reserved);
 		}
 
--- a/block/blk-mq-tag.h
+++ b/block/blk-mq-tag.h
@@ -89,4 +89,16 @@ static inline void blk_mq_tag_idle(struc
 	__blk_mq_tag_idle(hctx);
 }
 
+/*
+ * This helper should only be used for flush request to share tag
+ * with the request cloned from, and both the two requests can't be
+ * in flight at the same time. The caller has to make sure the tag
+ * can't be freed.
+ */
+static inline void blk_mq_tag_set_rq(struct blk_mq_hw_ctx *hctx,
+		unsigned int tag, struct request *rq)
+{
+	hctx->tags->rqs[tag] = rq;
+}
+
 #endif
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -559,23 +559,9 @@ void blk_mq_abort_requeue_list(struct re
 }
 EXPORT_SYMBOL(blk_mq_abort_requeue_list);
 
-static inline bool is_flush_request(struct request *rq,
-		struct blk_flush_queue *fq, unsigned int tag)
-{
-	return ((rq->cmd_flags & REQ_FLUSH_SEQ) &&
-			fq->flush_rq->tag == tag);
-}
-
 struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag)
 {
-	struct request *rq = tags->rqs[tag];
-	/* mq_ctx of flush rq is always cloned from the corresponding req */
-	struct blk_flush_queue *fq = blk_get_flush_queue(rq->q, rq->mq_ctx);
-
-	if (!is_flush_request(rq, fq, tag))
-		return rq;
-
-	return fq->flush_rq;
+	return tags->rqs[tag];
 }
 EXPORT_SYMBOL(blk_mq_tag_to_rq);
 
--- a/block/blk.h
+++ b/block/blk.h
@@ -22,6 +22,12 @@ struct blk_flush_queue {
 	struct list_head	flush_queue[2];
 	struct list_head	flush_data_in_flight;
 	struct request		*flush_rq;
+
+	/*
+	 * flush_rq shares tag with this rq, both can't be active
+	 * at the same time
+	 */
+	struct request		*orig_rq;
 	spinlock_t		mq_flush_lock;
 };
 



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

* [PATCH 4.2 013/134] unshare: Unsharing a thread does not require unsharing a vm
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (11 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 012/134] blk-mq: fix race between timeout and freeing request Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 014/134] rtlwifi: rtl8192cu: Add new device ID Greg Kroah-Hartman
                   ` (120 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Ricky Zhou, Kees Cook, Eric W. Biederman

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

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

From: "Eric W. Biederman" <ebiederm@xmission.com>

commit 12c641ab8270f787dfcce08b5f20ce8b65008096 upstream.

In the logic in the initial commit of unshare made creating a new
thread group for a process, contingent upon creating a new memory
address space for that process.  That is wrong.  Two separate
processes in different thread groups can share a memory address space
and clone allows creation of such proceses.

This is significant because it was observed that mm_users > 1 does not
mean that a process is multi-threaded, as reading /proc/PID/maps
temporarily increments mm_users, which allows other processes to
(accidentally) interfere with unshare() calls.

Correct the check in check_unshare_flags() to test for
!thread_group_empty() for CLONE_THREAD, CLONE_SIGHAND, and CLONE_VM.
For sighand->count > 1 for CLONE_SIGHAND and CLONE_VM.
For !current_is_single_threaded instead of mm_users > 1 for CLONE_VM.

By using the correct checks in unshare this removes the possibility of
an accidental denial of service attack.

Additionally using the correct checks in unshare ensures that only an
explicit unshare(CLONE_VM) can possibly trigger the slow path of
current_is_single_threaded().  As an explict unshare(CLONE_VM) is
pointless it is not expected there are many applications that make
that call.

Fixes: b2e0d98705e60e45bbb3c0032c48824ad7ae0704 userns: Implement unshare of the user namespace
Reported-by: Ricky Zhou <rickyz@chromium.org>
Reported-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 kernel/fork.c |   28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1871,13 +1871,21 @@ static int check_unshare_flags(unsigned
 				CLONE_NEWUSER|CLONE_NEWPID))
 		return -EINVAL;
 	/*
-	 * Not implemented, but pretend it works if there is nothing to
-	 * unshare. Note that unsharing CLONE_THREAD or CLONE_SIGHAND
-	 * needs to unshare vm.
+	 * Not implemented, but pretend it works if there is nothing
+	 * to unshare.  Note that unsharing the address space or the
+	 * signal handlers also need to unshare the signal queues (aka
+	 * CLONE_THREAD).
 	 */
 	if (unshare_flags & (CLONE_THREAD | CLONE_SIGHAND | CLONE_VM)) {
-		/* FIXME: get_task_mm() increments ->mm_users */
-		if (atomic_read(&current->mm->mm_users) > 1)
+		if (!thread_group_empty(current))
+			return -EINVAL;
+	}
+	if (unshare_flags & (CLONE_SIGHAND | CLONE_VM)) {
+		if (atomic_read(&current->sighand->count) > 1)
+			return -EINVAL;
+	}
+	if (unshare_flags & CLONE_VM) {
+		if (!current_is_single_threaded())
 			return -EINVAL;
 	}
 
@@ -1946,16 +1954,16 @@ SYSCALL_DEFINE1(unshare, unsigned long,
 	if (unshare_flags & CLONE_NEWUSER)
 		unshare_flags |= CLONE_THREAD | CLONE_FS;
 	/*
-	 * If unsharing a thread from a thread group, must also unshare vm.
-	 */
-	if (unshare_flags & CLONE_THREAD)
-		unshare_flags |= CLONE_VM;
-	/*
 	 * If unsharing vm, must also unshare signal handlers.
 	 */
 	if (unshare_flags & CLONE_VM)
 		unshare_flags |= CLONE_SIGHAND;
 	/*
+	 * If unsharing a signal handlers, must also unshare the signal queues.
+	 */
+	if (unshare_flags & CLONE_SIGHAND)
+		unshare_flags |= CLONE_THREAD;
+	/*
 	 * If unsharing namespace, must also unshare filesystem information.
 	 */
 	if (unshare_flags & CLONE_NEWNS)



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

* [PATCH 4.2 014/134] rtlwifi: rtl8192cu: Add new device ID
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (12 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 013/134] unshare: Unsharing a thread does not require unsharing a vm Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 015/134] rtlwifi: rtl8821ae: Fix an expression that is always false Greg Kroah-Hartman
                   ` (119 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Adrien Schildknecht, Larry Finger,
	Kalle Valo

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

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

From: Adrien Schildknecht <adrien+dev@schischi.me>

commit 1642d09fb9b128e8e538b2a4179962a34f38dff9 upstream.

The v2 of NetGear WNA1000M uses a different idProduct: USB ID 0846:9043

Signed-off-by: Adrien Schildknecht <adrien+dev@schischi.me>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/wireless/rtlwifi/rtl8192cu/sw.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -321,6 +321,7 @@ static struct usb_device_id rtl8192c_usb
 	{RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/
 	{RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/
 	{RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/
+	{RTL_USB_DEVICE(0x0846, 0x9043, rtl92cu_hal_cfg)}, /*NG WNA1000Mv2*/
 	{RTL_USB_DEVICE(0x0b05, 0x17ba, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/
 	{RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/
 	{RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/



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

* [PATCH 4.2 015/134] rtlwifi: rtl8821ae: Fix an expression that is always false
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (13 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 014/134] rtlwifi: rtl8192cu: Add new device ID Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 016/134] igb: Fix oops caused by missing queue pairing Greg Kroah-Hartman
                   ` (118 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, David Binderman, Larry Finger, Kalle Valo

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

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

From: Larry Finger <Larry.Finger@lwfinger.net>

commit 251086f588720277a6f5782020a648ce32c4e00b upstream.

In routine _rtl8821ae_set_media_status(), an incorrect mask results in a test
for AP status to always be false. Similar bugs were fixed in rtl8192cu and
rtl8192de, but this instance was missed at that time.

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: David Binderman <dcb314@hotmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/wireless/rtlwifi/rtl8821ae/hw.c  |    2 +-
 drivers/net/wireless/rtlwifi/rtl8821ae/reg.h |    1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c
@@ -2180,7 +2180,7 @@ static int _rtl8821ae_set_media_status(s
 
 	rtl_write_byte(rtlpriv, MSR, bt_msr);
 	rtlpriv->cfg->ops->led_control(hw, ledaction);
-	if ((bt_msr & 0xfc) == MSR_AP)
+	if ((bt_msr & MSR_MASK) == MSR_AP)
 		rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x00);
 	else
 		rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x66);
--- a/drivers/net/wireless/rtlwifi/rtl8821ae/reg.h
+++ b/drivers/net/wireless/rtlwifi/rtl8821ae/reg.h
@@ -429,6 +429,7 @@
 #define	MSR_ADHOC				0x01
 #define	MSR_INFRA				0x02
 #define	MSR_AP					0x03
+#define MSR_MASK				0x03
 
 #define	RRSR_RSC_OFFSET				21
 #define	RRSR_SHORT_OFFSET			23



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

* [PATCH 4.2 016/134] igb: Fix oops caused by missing queue pairing
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (14 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 015/134] rtlwifi: rtl8821ae: Fix an expression that is always false Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 017/134] tg3: Fix temperature reporting Greg Kroah-Hartman
                   ` (117 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Shota Suzuki, Aaron Brown, Jeff Kirsher

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

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

From: Shota Suzuki <suzuki_shota_t3@lab.ntt.co.jp>

commit 72ddef0506da852dc82f078f37ced8ef4d74a2bf upstream.

When initializing igb driver (e.g. 82576, I350), IGB_FLAG_QUEUE_PAIRS is
set if adapter->rss_queues exceeds half of max_rss_queues in
igb_init_queue_configuration().
On the other hand, IGB_FLAG_QUEUE_PAIRS is not set even if the number of
queues exceeds half of max_combined in igb_set_channels() when changing
the number of queues by "ethtool -L".
In this case, if numvecs is larger than MAX_MSIX_ENTRIES (10), the size
of adapter->msix_entries[], an overflow can occur in
igb_set_interrupt_capability(), which in turn leads to an oops.

Fix this problem as follows:
 - When changing the number of queues by "ethtool -L", set
   IGB_FLAG_QUEUE_PAIRS in the same way as initializing igb driver.
 - When increasing the size of q_vector, reallocate it appropriately.
   (With IGB_FLAG_QUEUE_PAIRS set, the size of q_vector gets larger.)

Another possible way to fix this problem is to cap the queues at its
initial number, which is the number of the initial online cpus. But this
is not the optimal way because we cannot increase queues when another
cpu becomes online.

Note that before commit cd14ef54d25b ("igb: Change to use statically
allocated array for MSIx entries"), this problem did not cause oops
but just made the number of queues become 1 because of entering msi_only
mode in igb_set_interrupt_capability().

Fixes: 907b7835799f ("igb: Add ethtool support to configure number of channels")
Signed-off-by: Shota Suzuki <suzuki_shota_t3@lab.ntt.co.jp>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/ethernet/intel/igb/igb.h         |    1 +
 drivers/net/ethernet/intel/igb/igb_ethtool.c |    5 ++++-
 drivers/net/ethernet/intel/igb/igb_main.c    |   16 ++++++++++++++--
 3 files changed, 19 insertions(+), 3 deletions(-)

--- a/drivers/net/ethernet/intel/igb/igb.h
+++ b/drivers/net/ethernet/intel/igb/igb.h
@@ -540,6 +540,7 @@ void igb_ptp_rx_pktstamp(struct igb_q_ve
 			 struct sk_buff *skb);
 int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr);
 int igb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr);
+void igb_set_flag_queue_pairs(struct igb_adapter *, const u32);
 #ifdef CONFIG_IGB_HWMON
 void igb_sysfs_exit(struct igb_adapter *adapter);
 int igb_sysfs_init(struct igb_adapter *adapter);
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -2991,6 +2991,7 @@ static int igb_set_channels(struct net_d
 {
 	struct igb_adapter *adapter = netdev_priv(netdev);
 	unsigned int count = ch->combined_count;
+	unsigned int max_combined = 0;
 
 	/* Verify they are not requesting separate vectors */
 	if (!count || ch->rx_count || ch->tx_count)
@@ -3001,11 +3002,13 @@ static int igb_set_channels(struct net_d
 		return -EINVAL;
 
 	/* Verify the number of channels doesn't exceed hw limits */
-	if (count > igb_max_channels(adapter))
+	max_combined = igb_max_channels(adapter);
+	if (count > max_combined)
 		return -EINVAL;
 
 	if (count != adapter->rss_queues) {
 		adapter->rss_queues = count;
+		igb_set_flag_queue_pairs(adapter, max_combined);
 
 		/* Hardware has to reinitialize queues and interrupts to
 		 * match the new configuration.
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -1205,10 +1205,14 @@ static int igb_alloc_q_vector(struct igb
 
 	/* allocate q_vector and rings */
 	q_vector = adapter->q_vector[v_idx];
-	if (!q_vector)
+	if (!q_vector) {
 		q_vector = kzalloc(size, GFP_KERNEL);
-	else
+	} else if (size > ksize(q_vector)) {
+		kfree_rcu(q_vector, rcu);
+		q_vector = kzalloc(size, GFP_KERNEL);
+	} else {
 		memset(q_vector, 0, size);
+	}
 	if (!q_vector)
 		return -ENOMEM;
 
@@ -2888,6 +2892,14 @@ static void igb_init_queue_configuration
 
 	adapter->rss_queues = min_t(u32, max_rss_queues, num_online_cpus());
 
+	igb_set_flag_queue_pairs(adapter, max_rss_queues);
+}
+
+void igb_set_flag_queue_pairs(struct igb_adapter *adapter,
+			      const u32 max_rss_queues)
+{
+	struct e1000_hw *hw = &adapter->hw;
+
 	/* Determine if we need to pair queues. */
 	switch (hw->mac.type) {
 	case e1000_82575:



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

* [PATCH 4.2 017/134] tg3: Fix temperature reporting
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (15 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 016/134] igb: Fix oops caused by missing queue pairing Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 018/134] MIPS: CPS: use 32b accesses to GCRs Greg Kroah-Hartman
                   ` (116 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jean Delvare, Prashant Sreedharan,
	Michael Chan, David S. Miller

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

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

From: Jean Delvare <jdelvare@suse.de>

commit d3d11fe08ccc9bff174fc958722b5661f0932486 upstream.

The temperature registers appear to report values in degrees Celsius
while the hwmon API mandates values to be exposed in millidegrees
Celsius. Do the conversion so that the values reported by "sensors"
are correct.

Fixes: aed93e0bf493 ("tg3: Add hwmon support for temperature")
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Prashant Sreedharan <prashant@broadcom.com>
Cc: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/ethernet/broadcom/tg3.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -10757,7 +10757,7 @@ static ssize_t tg3_show_temp(struct devi
 	tg3_ape_scratchpad_read(tp, &temperature, attr->index,
 				sizeof(temperature));
 	spin_unlock_bh(&tp->lock);
-	return sprintf(buf, "%u\n", temperature);
+	return sprintf(buf, "%u\n", temperature * 1000);
 }
 
 



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

* [PATCH 4.2 018/134] MIPS: CPS: use 32b accesses to GCRs
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (16 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 017/134] tg3: Fix temperature reporting Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 019/134] MIPS: math-emu: Allow m{f,t}hc emulation on MIPS R6 Greg Kroah-Hartman
                   ` (115 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Paul Burton, Markos Chandras,
	linux-mips, James Hogan, Ralf Baechle

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

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

From: Paul Burton <paul.burton@imgtec.com>

commit 90996511187d6282db6d02d3f97006b4dbb5c457 upstream.

Commit b677bc03d757 ("MIPS: cps-vec: Use macros for various arithmetics
and memory operations") replaced various load & store instructions
through cps-vec.S with the PTR_L & PTR_S macros. However it was somewhat
overzealous in doing so for CM GCR accesses, since the bit width of the
CM doesn't necessarily match that of the CPU. The registers accessed
(GCR_CL_COHERENCE & GCR_CL_ID) should be safe to simply always access
using 32b instructions, so do so in order to avoid issues when using a
32b CM with a 64b CPU.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Cc: James Hogan <james.hogan@imgtec.com>
Patchwork: https://patchwork.linux-mips.org/patch/10864/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/mips/kernel/cps-vec.S |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/mips/kernel/cps-vec.S
+++ b/arch/mips/kernel/cps-vec.S
@@ -152,7 +152,7 @@ dcache_done:
 
 	/* Enter the coherent domain */
 	li	t0, 0xff
-	PTR_S	t0, GCR_CL_COHERENCE_OFS(v1)
+	sw	t0, GCR_CL_COHERENCE_OFS(v1)
 	ehb
 
 	/* Jump to kseg0 */
@@ -302,7 +302,7 @@ LEAF(mips_cps_boot_vpes)
 	PTR_L	t0, 0(t0)
 
 	/* Calculate a pointer to this cores struct core_boot_config */
-	PTR_L	t0, GCR_CL_ID_OFS(t0)
+	lw	t0, GCR_CL_ID_OFS(t0)
 	li	t1, COREBOOTCFG_SIZE
 	mul	t0, t0, t1
 	PTR_LA	t1, mips_cps_core_bootcfg



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

* [PATCH 4.2 019/134] MIPS: math-emu: Allow m{f,t}hc emulation on MIPS R6
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (17 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 018/134] MIPS: CPS: use 32b accesses to GCRs Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 020/134] MIPS: math-emu: Emulate missing BC1{EQ,NE}Z instructions Greg Kroah-Hartman
                   ` (114 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Markos Chandras, linux-mips, Ralf Baechle

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

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

From: Markos Chandras <markos.chandras@imgtec.com>

commit e8f80cc1a6d80587136b015e989a12827e1fcfe5 upstream.

The mfhc/mthc instructions are supported on MIPS R6 so emulate
them if needed.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/10737/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/mips/math-emu/cp1emu.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -1137,7 +1137,7 @@ emul:
 			break;
 
 		case mfhc_op:
-			if (!cpu_has_mips_r2)
+			if (!cpu_has_mips_r2_r6)
 				goto sigill;
 
 			/* copregister rd -> gpr[rt] */
@@ -1148,7 +1148,7 @@ emul:
 			break;
 
 		case mthc_op:
-			if (!cpu_has_mips_r2)
+			if (!cpu_has_mips_r2_r6)
 				goto sigill;
 
 			/* copregister rd <- gpr[rt] */



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

* [PATCH 4.2 020/134] MIPS: math-emu: Emulate missing BC1{EQ,NE}Z instructions
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (18 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 019/134] MIPS: math-emu: Allow m{f,t}hc emulation on MIPS R6 Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 021/134] mac80211: enable assoc check for mesh interfaces Greg Kroah-Hartman
                   ` (113 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Markos Chandras, linux-mips, Ralf Baechle

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

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

From: Markos Chandras <markos.chandras@imgtec.com>

commit c909ca718e8f50cf484ef06a8dd935e738e8e53d upstream.

Commit c8a34581ec09 ("MIPS: Emulate the BC1{EQ,NE}Z FPU instructions")
added support for emulating the new R6 BC1{EQ,NE}Z branches but it missed
the case where the instruction that caused the exception was not on a DS.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Fixes: c8a34581ec09 ("MIPS: Emulate the BC1{EQ,NE}Z FPU instructions")
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/10738/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/mips/math-emu/cp1emu.c |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -1181,6 +1181,24 @@ emul:
 			}
 			break;
 
+		case bc1eqz_op:
+		case bc1nez_op:
+			if (!cpu_has_mips_r6 || delay_slot(xcp))
+				return SIGILL;
+
+			cond = likely = 0;
+			switch (MIPSInst_RS(ir)) {
+			case bc1eqz_op:
+				if (get_fpr32(&current->thread.fpu.fpr[MIPSInst_RT(ir)], 0) & 0x1)
+				    cond = 1;
+				break;
+			case bc1nez_op:
+				if (!(get_fpr32(&current->thread.fpu.fpr[MIPSInst_RT(ir)], 0) & 0x1))
+				    cond = 1;
+				break;
+			}
+			goto branch_common;
+
 		case bc_op:
 			if (delay_slot(xcp))
 				return SIGILL;
@@ -1207,7 +1225,7 @@ emul:
 			case bct_op:
 				break;
 			}
-
+branch_common:
 			set_delay_slot(xcp);
 			if (cond) {
 				/*



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

* [PATCH 4.2 021/134] mac80211: enable assoc check for mesh interfaces
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (19 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 020/134] MIPS: math-emu: Emulate missing BC1{EQ,NE}Z instructions Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 022/134] cxl: Allow release of contexts which have been OPENED but not STARTED Greg Kroah-Hartman
                   ` (112 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Alexis Green, Jesse Jones,
	Bob Copeland, Johannes Berg

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

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

From: Bob Copeland <me@bobcopeland.com>

commit 3633ebebab2bbe88124388b7620442315c968e8f upstream.

We already set a station to be associated when peering completes, both
in user space and in the kernel.  Thus we should always have an
associated sta before sending data frames to that station.

Failure to check assoc state can cause crashes in the lower-level driver
due to transmitting unicast data frames before driver sta structures
(e.g. ampdu state in ath9k) are initialized.  This occurred when
forwarding in the presence of fixed mesh paths: frames were transmitted
to stations with whom we hadn't yet completed peering.

Reported-by: Alexis Green <agreen@cococorp.com>
Tested-by: Jesse Jones <jjones@cococorp.com>
Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/mac80211/tx.c |    3 ---
 1 file changed, 3 deletions(-)

--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -311,9 +311,6 @@ ieee80211_tx_h_check_assoc(struct ieee80
 	if (tx->sdata->vif.type == NL80211_IFTYPE_WDS)
 		return TX_CONTINUE;
 
-	if (tx->sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
-		return TX_CONTINUE;
-
 	if (tx->flags & IEEE80211_TX_PS_BUFFERED)
 		return TX_CONTINUE;
 



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

* [PATCH 4.2 022/134] cxl: Allow release of contexts which have been OPENED but not STARTED
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (20 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 021/134] mac80211: enable assoc check for mesh interfaces Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 023/134] cxl: Remove racy attempt to force EEH invocation in reset Greg Kroah-Hartman
                   ` (111 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Andrew Donnellan, Daniel Axtens,
	Ian Munsie, Michael Ellerman

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

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

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

commit 7c26b9cf5347c24272152438cdd9675183804425 upstream.

If we open a context but do not start it (either because we do not attempt
to start it, or because it fails to start for some reason), we are left
with a context in state OPENED. Previously, cxl_release_context() only
allowed releasing contexts in state CLOSED, so attempting to release an
OPENED context would fail.

In particular, this bug causes available contexts to run out after some EEH
failures, where drivers attempt to release contexts that have failed to
start.

Allow releasing contexts in any state with a value lower than STARTED, i.e.
OPENED or CLOSED (we can't release a STARTED context as it's currently
using the hardware, and we assume that contexts in any new states which may
be added in future with a value higher than STARTED are also unsafe to
release).

Fixes: 6f7f0b3df6d4 ("cxl: Add AFU virtual PHB and kernel API")
Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Daniel Axtens <dja@axtens.net>
Acked-by: Ian Munsie <imunsie@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/misc/cxl/api.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/misc/cxl/api.c
+++ b/drivers/misc/cxl/api.c
@@ -59,7 +59,7 @@ EXPORT_SYMBOL_GPL(cxl_get_phys_dev);
 
 int cxl_release_context(struct cxl_context *ctx)
 {
-	if (ctx->status != CLOSED)
+	if (ctx->status >= STARTED)
 		return -EBUSY;
 
 	put_device(&ctx->afu->dev);



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

* [PATCH 4.2 023/134] cxl: Remove racy attempt to force EEH invocation in reset
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (21 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 022/134] cxl: Allow release of contexts which have been OPENED but not STARTED Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 024/134] cxl: Fix unbalanced pci_dev_get in cxl_probe Greg Kroah-Hartman
                   ` (110 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Ryan Grimm, Daniel Axtens,
	Ian Munsie, Michael Ellerman

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

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

From: Daniel Axtens <dja@axtens.net>

commit 9d8e27673c45927fee9e7d8992ffb325a6b0b0e4 upstream.

cxl_reset currently PERSTs the slot, and then repeatedly tries to
read MMIO space in order to kick off EEH.

There are 2 problems with this: it's unnecessary, and it's racy.

It's unnecessary because the PERST will bring down the PHB link.
That will be picked up by the CAPP, which will send out an HMI.
Skiboot, noticing an HMI from the CAPP, will send an OPAL
notification to the kernel, which will trigger EEH recovery.

It's also racy: the EEH recovery triggered by the CAPP will
eventually cause the MMIO space to have its mapping invalidated
and the pointer NULLed out. This races with our attempt to read
the MMIO space. This is causing OOPSes in testing.

Simply drop all the attempts to force EEH detection, and trust
that Skiboot will send the notification and that we'll act on it.
The Skiboot code to send the EEH notification has been in Skiboot
for as long as CAPP recovery has been supported, so we don't need
to worry about breaking obscure setups with ancient firmware.

Cc: Ryan Grimm <grimm@linux.vnet.ibm.com>
Fixes: 62fa19d4b4fd ("cxl: Add ability to reset the card")
Signed-off-by: Daniel Axtens <dja@axtens.net>
Acked-by: Ian Munsie <imunsie@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/misc/cxl/pci.c |   16 ----------------
 1 file changed, 16 deletions(-)

--- a/drivers/misc/cxl/pci.c
+++ b/drivers/misc/cxl/pci.c
@@ -851,8 +851,6 @@ int cxl_reset(struct cxl *adapter)
 {
 	struct pci_dev *dev = to_pci_dev(adapter->dev.parent);
 	int rc;
-	int i;
-	u32 val;
 
 	dev_info(&dev->dev, "CXL reset\n");
 
@@ -869,20 +867,6 @@ int cxl_reset(struct cxl *adapter)
 		return rc;
 	}
 
-	/* the PERST done above fences the PHB.  So, reset depends on EEH
-	 * to unbind the driver, tell Sapphire to reinit the PHB, and rebind
-	 * the driver.  Do an mmio read explictly to ensure EEH notices the
-	 * fenced PHB.  Retry for a few seconds before giving up. */
-	i = 0;
-	while (((val = mmio_read32be(adapter->p1_mmio)) != 0xffffffff) &&
-		(i < 5)) {
-		msleep(500);
-		i++;
-	}
-
-	if (val != 0xffffffff)
-		dev_err(&dev->dev, "cxl: PERST failed to trigger EEH\n");
-
 	return rc;
 }
 



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

* [PATCH 4.2 024/134] cxl: Fix unbalanced pci_dev_get in cxl_probe
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (22 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 023/134] cxl: Remove racy attempt to force EEH invocation in reset Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 025/134] ext4: dont manipulate recovery flag when freezing no-journal fs Greg Kroah-Hartman
                   ` (109 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Daniel Axtens, Ian Munsie, Michael Ellerman

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

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

From: Daniel Axtens <dja@axtens.net>

commit 2925c2fdf1e0eb642482f5b30577e9435aaa8edb upstream.

Currently the first thing we do in cxl_probe is to grab a reference
on the pci device. Later on, we call device_register on our adapter.
In our remove path, we call device_unregister, but we never call
pci_dev_put. We therefore leak the device every time we do a
reflash.

device_register/unregister is sufficient to hold the reference.
Therefore, drop the call to pci_dev_get.

Here's why this is safe.
The proposed cxl_probe(pdev) calls cxl_adapter_init:
    a) init calls cxl_adapter_alloc, which creates a struct cxl,
       conventionally called adapter. This struct contains a
       device entry, adapter->dev.

    b) init calls cxl_configure_adapter, where we set
       adapter->dev.parent = &dev->dev (here dev is the pci dev)

So at this point, the cxl adapter's device's parent is the PCI
device that I want to be refcounted properly.

    c) init calls cxl_register_adapter
       *) cxl_register_adapter calls device_register(&adapter->dev)

So now we're in device_register, where dev is the adapter device, and
we want to know if the PCI device is safe after we return.

device_register(&adapter->dev) calls device_initialize() and then
device_add().

device_add() does a get_device(). device_add() also explicitly grabs
the device's parent, and calls get_device() on it:

         parent = get_device(dev->parent);

So therefore, device_register() takes a lock on the parent PCI dev,
which is what pci_dev_get() was guarding. pci_dev_get() can therefore
be safely removed.

Fixes: f204e0b8cedd ("cxl: Driver code for powernv PCIe based cards for userspace access")
Signed-off-by: Daniel Axtens <dja@axtens.net>
Acked-by: Ian Munsie <imunsie@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/misc/cxl/pci.c |    2 --
 1 file changed, 2 deletions(-)

--- a/drivers/misc/cxl/pci.c
+++ b/drivers/misc/cxl/pci.c
@@ -1124,8 +1124,6 @@ static int cxl_probe(struct pci_dev *dev
 	int slice;
 	int rc;
 
-	pci_dev_get(dev);
-
 	if (cxl_verbose)
 		dump_cxl_config_space(dev);
 



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

* [PATCH 4.2 025/134] ext4: dont manipulate recovery flag when freezing no-journal fs
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (23 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 024/134] cxl: Fix unbalanced pci_dev_get in cxl_probe Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 026/134] Revert "ext4: remove block_device_ejected" Greg Kroah-Hartman
                   ` (108 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Stu Mark, Jan Kara, Eric Sandeen,
	Theodore Tso

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

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

From: Eric Sandeen <sandeen@redhat.com>

commit c642dc9e1aaed953597e7092d7df329e6234096e upstream.

At some point along this sequence of changes:

f6e63f9 ext4: fold ext4_nojournal_sops into ext4_sops
bb04457 ext4: support freezing ext2 (nojournal) file systems
9ca9238 ext4: Use separate super_operations structure for no_journal filesystems

ext4 started setting needs_recovery on filesystems without journals
when they are unfrozen.  This makes no sense, and in fact confuses
blkid to the point where it doesn't recognize the filesystem at all.

(freeze ext2; unfreeze ext2; run blkid; see no output; run dumpe2fs,
see needs_recovery set on fs w/ no journal).

To fix this, don't manipulate the INCOMPAT_RECOVER feature on
filesystems without journals.

Reported-by: Stu Mark <smark@datto.com>
Reviewed-by: Jan Kara <jack@suse.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ext4/super.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4833,10 +4833,11 @@ static int ext4_freeze(struct super_bloc
 		error = jbd2_journal_flush(journal);
 		if (error < 0)
 			goto out;
+
+		/* Journal blocked and flushed, clear needs_recovery flag. */
+		EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
 	}
 
-	/* Journal blocked and flushed, clear needs_recovery flag. */
-	EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
 	error = ext4_commit_super(sb, 1);
 out:
 	if (journal)
@@ -4854,8 +4855,11 @@ static int ext4_unfreeze(struct super_bl
 	if (sb->s_flags & MS_RDONLY)
 		return 0;
 
-	/* Reset the needs_recovery flag before the fs is unlocked. */
-	EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
+	if (EXT4_SB(sb)->s_journal) {
+		/* Reset the needs_recovery flag before the fs is unlocked. */
+		EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
+	}
+
 	ext4_commit_super(sb, 1);
 	return 0;
 }



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

* [PATCH 4.2 026/134] Revert "ext4: remove block_device_ejected"
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (24 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 025/134] ext4: dont manipulate recovery flag when freezing no-journal fs Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 027/134] arm64: kconfig: Move LIST_POISON to a safe value Greg Kroah-Hartman
                   ` (107 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Theodore Tso

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

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

From: Theodore Ts'o <tytso@mit.edu>

commit bdfe0cbd746aa9b2509c2f6d6be17193cf7facd7 upstream.

This reverts commit 08439fec266c3cc5702953b4f54bdf5649357de0.

Unfortunately we still need to test for bdi->dev to avoid a crash when a
USB stick is yanked out while a file system is mounted:

   usb 2-2: USB disconnect, device number 2
   Buffer I/O error on dev sdb1, logical block 15237120, lost sync page write
   JBD2: Error -5 detected when updating journal superblock for sdb1-8.
   BUG: unable to handle kernel paging request at 34beb000
   IP: [<c136ce88>] __percpu_counter_add+0x18/0xc0
   *pdpt = 0000000023db9001 *pde = 0000000000000000
   Oops: 0000 [#1] SMP
   CPU: 0 PID: 4083 Comm: umount Tainted: G     U     OE   4.1.1-040101-generic #201507011435
   Hardware name: LENOVO 7675CTO/7675CTO, BIOS 7NETC2WW (2.22 ) 03/22/2011
   task: ebf06b50 ti: ebebc000 task.ti: ebebc000
   EIP: 0060:[<c136ce88>] EFLAGS: 00010082 CPU: 0
   EIP is at __percpu_counter_add+0x18/0xc0
   EAX: f21c8e88 EBX: f21c8e88 ECX: 00000000 EDX: 00000001
   ESI: 00000001 EDI: 00000000 EBP: ebebde60 ESP: ebebde40
    DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
   CR0: 8005003b CR2: 34beb000 CR3: 33354200 CR4: 000007f0
   Stack:
    c1abe100 edcb0098 edcb00ec ffffffff f21c8e68 ffffffff f21c8e68 f286d160
    ebebde84 c1160454 00000010 00000282 f72a77f8 00000984 f72a77f8 f286d160
    f286d170 ebebdea0 c11e613f 00000000 00000282 f72a77f8 edd7f4d0 00000000
   Call Trace:
    [<c1160454>] account_page_dirtied+0x74/0x110
    [<c11e613f>] __set_page_dirty+0x3f/0xb0
    [<c11e6203>] mark_buffer_dirty+0x53/0xc0
    [<c124a0cb>] ext4_commit_super+0x17b/0x250
    [<c124ac71>] ext4_put_super+0xc1/0x320
    [<c11f04ba>] ? fsnotify_unmount_inodes+0x1aa/0x1c0
    [<c11cfeda>] ? evict_inodes+0xca/0xe0
    [<c11b925a>] generic_shutdown_super+0x6a/0xe0
    [<c10a1df0>] ? prepare_to_wait_event+0xd0/0xd0
    [<c1165a50>] ? unregister_shrinker+0x40/0x50
    [<c11b92f6>] kill_block_super+0x26/0x70
    [<c11b94f5>] deactivate_locked_super+0x45/0x80
    [<c11ba007>] deactivate_super+0x47/0x60
    [<c11d2b39>] cleanup_mnt+0x39/0x80
    [<c11d2bc0>] __cleanup_mnt+0x10/0x20
    [<c1080b51>] task_work_run+0x91/0xd0
    [<c1011e3c>] do_notify_resume+0x7c/0x90
    [<c1720da5>] work_notify
   Code: 8b 55 e8 e9 f4 fe ff ff 90 90 90 90 90 90 90 90 90 90 90 55 89 e5 83 ec 20 89 5d f4 89 c3 89 75 f8 89 d6 89 7d fc 89 cf 8b 48 14 <64> 8b 01 89 45 ec 89 c2 8b 45 08 c1 fa 1f 01 75 ec 89 55 f0 89
   EIP: [<c136ce88>] __percpu_counter_add+0x18/0xc0 SS:ESP 0068:ebebde40
   CR2: 0000000034beb000
   ---[ end trace dd564a7bea834ecd ]---

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

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ext4/super.c |   18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -325,6 +325,22 @@ static void save_error_info(struct super
 	ext4_commit_super(sb, 1);
 }
 
+/*
+ * The del_gendisk() function uninitializes the disk-specific data
+ * structures, including the bdi structure, without telling anyone
+ * else.  Once this happens, any attempt to call mark_buffer_dirty()
+ * (for example, by ext4_commit_super), will cause a kernel OOPS.
+ * This is a kludge to prevent these oops until we can put in a proper
+ * hook in del_gendisk() to inform the VFS and file system layers.
+ */
+static int block_device_ejected(struct super_block *sb)
+{
+	struct inode *bd_inode = sb->s_bdev->bd_inode;
+	struct backing_dev_info *bdi = inode_to_bdi(bd_inode);
+
+	return bdi->dev == NULL;
+}
+
 static void ext4_journal_commit_callback(journal_t *journal, transaction_t *txn)
 {
 	struct super_block		*sb = journal->j_private;
@@ -4617,7 +4633,7 @@ static int ext4_commit_super(struct supe
 	struct buffer_head *sbh = EXT4_SB(sb)->s_sbh;
 	int error = 0;
 
-	if (!sbh)
+	if (!sbh || block_device_ejected(sb))
 		return error;
 	if (buffer_write_io_error(sbh)) {
 		/*



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

* [PATCH 4.2 027/134] arm64: kconfig: Move LIST_POISON to a safe value
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (25 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 026/134] Revert "ext4: remove block_device_ejected" Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 028/134] arm64: entry: always restore x0 from the stack on syscall return Greg Kroah-Hartman
                   ` (106 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Catalin Marinas, Thierry Strudel,
	Jeff Vander Stoep, Will Deacon

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

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

From: Jeff Vander Stoep <jeffv@google.com>

commit bf0c4e04732479f650ff59d1ee82de761c0071f0 upstream.

Move the poison pointer offset to 0xdead000000000000, a
recognized value that is not mappable by user-space exploits.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Thierry Strudel <tstrudel@google.com>
Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/Kconfig |    4 ++++
 1 file changed, 4 insertions(+)

--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -104,6 +104,10 @@ config NO_IOPORT_MAP
 config STACKTRACE_SUPPORT
 	def_bool y
 
+config ILLEGAL_POINTER_VALUE
+	hex
+	default 0xdead000000000000
+
 config LOCKDEP_SUPPORT
 	def_bool y
 



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

* [PATCH 4.2 028/134] arm64: entry: always restore x0 from the stack on syscall return
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (26 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 027/134] arm64: kconfig: Move LIST_POISON to a safe value Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 029/134] arm64: flush FP/SIMD state correctly after execve() Greg Kroah-Hartman
                   ` (105 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Larry Bassel, Kevin Hilman,
	Catalin Marinas, Hanjun Guo, Will Deacon

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

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

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

commit 412fcb6cebd758d080cacd5a41a0cbc656ea5fce upstream.

We have a micro-optimisation on the fast syscall return path where we
take care to keep x0 live with the return value from the syscall so that
we can avoid restoring it from the stack. The benefit of doing this is
fairly suspect, since we will be restoring x1 from the stack anyway
(which lives adjacent in the pt_regs structure) and the only additional
cost is saving x0 back to pt_regs after the syscall handler, which could
be seen as a poor man's prefetch.

More importantly, this causes issues with the context tracking code.

The ct_user_enter macro ends up branching into C code, which is free to
use x0 as a scratch register and consequently leads to us returning junk
back to userspace as the syscall return value. Rather than special case
the context-tracking code, this patch removes the questionable
optimisation entirely.

Cc: Larry Bassel <larry.bassel@linaro.org>
Cc: Kevin Hilman <khilman@linaro.org>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Reported-by: Hanjun Guo <hanjun.guo@linaro.org>
Tested-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/kernel/entry.S |   17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -116,7 +116,7 @@
 	*/
 	.endm
 
-	.macro	kernel_exit, el, ret = 0
+	.macro	kernel_exit, el
 	ldp	x21, x22, [sp, #S_PC]		// load ELR, SPSR
 	.if	\el == 0
 	ct_user_enter
@@ -146,11 +146,7 @@
 	.endif
 	msr	elr_el1, x21			// set up the return data
 	msr	spsr_el1, x22
-	.if	\ret
-	ldr	x1, [sp, #S_X1]			// preserve x0 (syscall return)
-	.else
 	ldp	x0, x1, [sp, #16 * 0]
-	.endif
 	ldp	x2, x3, [sp, #16 * 1]
 	ldp	x4, x5, [sp, #16 * 2]
 	ldp	x6, x7, [sp, #16 * 3]
@@ -613,22 +609,21 @@ ENDPROC(cpu_switch_to)
  */
 ret_fast_syscall:
 	disable_irq				// disable interrupts
+	str	x0, [sp, #S_X0]			// returned x0
 	ldr	x1, [tsk, #TI_FLAGS]		// re-check for syscall tracing
 	and	x2, x1, #_TIF_SYSCALL_WORK
 	cbnz	x2, ret_fast_syscall_trace
 	and	x2, x1, #_TIF_WORK_MASK
-	cbnz	x2, fast_work_pending
+	cbnz	x2, work_pending
 	enable_step_tsk x1, x2
-	kernel_exit 0, ret = 1
+	kernel_exit 0
 ret_fast_syscall_trace:
 	enable_irq				// enable interrupts
-	b	__sys_trace_return
+	b	__sys_trace_return_skipped	// we already saved x0
 
 /*
  * Ok, we need to do extra processing, enter the slow path.
  */
-fast_work_pending:
-	str	x0, [sp, #S_X0]			// returned x0
 work_pending:
 	tbnz	x1, #TIF_NEED_RESCHED, work_resched
 	/* TIF_SIGPENDING, TIF_NOTIFY_RESUME or TIF_FOREIGN_FPSTATE case */
@@ -652,7 +647,7 @@ ret_to_user:
 	cbnz	x2, work_pending
 	enable_step_tsk x1, x2
 no_work_pending:
-	kernel_exit 0, ret = 0
+	kernel_exit 0
 ENDPROC(ret_to_user)
 
 /*



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

* [PATCH 4.2 029/134] arm64: flush FP/SIMD state correctly after execve()
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (27 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 028/134] arm64: entry: always restore x0 from the stack on syscall return Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 030/134] of/fdt: make memblock maximum physical address arch configurable Greg Kroah-Hartman
                   ` (104 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Chunyan Zhang, Janet Liu,
	Ard Biesheuvel, Will Deacon

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

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

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

commit 674c242c9323d3c293fc4f9a3a3a619fe3063290 upstream.

When a task calls execve(), its FP/SIMD state is flushed so that
none of the original program state is observeable by the incoming
program.

However, since this flushing consists of setting the in-memory copy
of the FP/SIMD state to all zeroes, the CPU field is set to CPU 0 as
well, which indicates to the lazy FP/SIMD preserve/restore code that
the FP/SIMD state does not need to be reread from memory if the task
is scheduled again on CPU 0 without any other tasks having entered
userland (or used the FP/SIMD in kernel mode) on the same CPU in the
mean time. If this happens, the FP/SIMD state of the old program will
still be present in the registers when the new program starts.

So set the CPU field to the invalid value of NR_CPUS when performing
the flush, by calling fpsimd_flush_task_state().

Reported-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
Reported-by: Janet Liu <janet.liu@spreadtrum.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/kernel/fpsimd.c |    1 +
 1 file changed, 1 insertion(+)

--- a/arch/arm64/kernel/fpsimd.c
+++ b/arch/arm64/kernel/fpsimd.c
@@ -158,6 +158,7 @@ void fpsimd_thread_switch(struct task_st
 void fpsimd_flush_thread(void)
 {
 	memset(&current->thread.fpsimd_state, 0, sizeof(struct fpsimd_state));
+	fpsimd_flush_task_state(current);
 	set_thread_flag(TIF_FOREIGN_FPSTATE);
 }
 



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

* [PATCH 4.2 030/134] of/fdt: make memblock maximum physical address arch configurable
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (28 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 029/134] arm64: flush FP/SIMD state correctly after execve() Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 031/134] arm64: set MAX_MEMBLOCK_ADDR according to linear region size Greg Kroah-Hartman
                   ` (103 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Rob Herring, Catalin Marinas,
	Stuart Yoder, Ard Biesheuvel, Will Deacon

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

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

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

commit 8eafeb48022816513abc4f440bdad4c350fe81a3 upstream.

When parsing the memory nodes to populate the memblock memory
table, we check against high and low limits and clip any memory
that exceeds either one of them.

However, for arm64, the high limit of (phys_addr_t)~0 is not very
meaningful, since phys_addr_t is 64 bits (i.e., no limit) but there
may be other constraints that limit the memory ranges that we can
support.

So rename MAX_PHYS_ADDR to MAX_MEMBLOCK_ADDR (for clarity) and only
define it if the arch does not supply a definition of its own.

Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Stuart Yoder <stuart.yoder@freescale.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -967,7 +967,9 @@ int __init early_init_dt_scan_chosen(uns
 }
 
 #ifdef CONFIG_HAVE_MEMBLOCK
-#define MAX_PHYS_ADDR	((phys_addr_t)~0)
+#ifndef MAX_MEMBLOCK_ADDR
+#define MAX_MEMBLOCK_ADDR	((phys_addr_t)~0)
+#endif
 
 void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size)
 {
@@ -984,16 +986,16 @@ void __init __weak early_init_dt_add_mem
 	}
 	size &= PAGE_MASK;
 
-	if (base > MAX_PHYS_ADDR) {
+	if (base > MAX_MEMBLOCK_ADDR) {
 		pr_warning("Ignoring memory block 0x%llx - 0x%llx\n",
 				base, base + size);
 		return;
 	}
 
-	if (base + size - 1 > MAX_PHYS_ADDR) {
+	if (base + size - 1 > MAX_MEMBLOCK_ADDR) {
 		pr_warning("Ignoring memory range 0x%llx - 0x%llx\n",
-				((u64)MAX_PHYS_ADDR) + 1, base + size);
-		size = MAX_PHYS_ADDR - base + 1;
+				((u64)MAX_MEMBLOCK_ADDR) + 1, base + size);
+		size = MAX_MEMBLOCK_ADDR - base + 1;
 	}
 
 	if (base + size < phys_offset) {



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

* [PATCH 4.2 031/134] arm64: set MAX_MEMBLOCK_ADDR according to linear region size
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (29 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 030/134] of/fdt: make memblock maximum physical address arch configurable Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 032/134] arm64: compat: fix vfp save/restore across signal handlers in big-endian Greg Kroah-Hartman
                   ` (102 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Catalin Marinas, Stuart Yoder,
	Ard Biesheuvel, Will Deacon

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

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

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

commit 34ba2c4247e5c4b1542b1106e156af324660c4f0 upstream.

The linear region size of a 39-bit VA kernel is only 256 GB, which
may be insufficient to cover all of system RAM, even on platforms
that have much less than 256 GB of memory but which is laid out
very sparsely.

So make sure we clip the memory we will not be able to map before
installing it into the memblock memory table, by setting
MAX_MEMBLOCK_ADDR accordingly.

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Stuart Yoder <stuart.yoder@freescale.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/include/asm/memory.h |    8 ++++++++
 1 file changed, 8 insertions(+)

--- a/arch/arm64/include/asm/memory.h
+++ b/arch/arm64/include/asm/memory.h
@@ -114,6 +114,14 @@ extern phys_addr_t		memstart_addr;
 #define PHYS_OFFSET		({ memstart_addr; })
 
 /*
+ * The maximum physical address that the linear direct mapping
+ * of system RAM can cover. (PAGE_OFFSET can be interpreted as
+ * a 2's complement signed quantity and negated to derive the
+ * maximum size of the linear mapping.)
+ */
+#define MAX_MEMBLOCK_ADDR	({ memstart_addr - PAGE_OFFSET - 1; })
+
+/*
  * PFNs are used to describe any physical page; this means
  * PFN 0 == physical address 0.
  *



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

* [PATCH 4.2 032/134] arm64: compat: fix vfp save/restore across signal handlers in big-endian
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (30 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 031/134] arm64: set MAX_MEMBLOCK_ADDR according to linear region size Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 033/134] arm64: head.S: initialise mdcr_el2 in el2_setup Greg Kroah-Hartman
                   ` (101 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Catalin Marinas, Will Deacon

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

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

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

commit bdec97a855ef1e239f130f7a11584721c9a1bf04 upstream.

When saving/restoring the VFP registers from a compat (AArch32)
signal frame, we rely on the compat registers forming a prefix of the
native register file and therefore make use of copy_{to,from}_user to
transfer between the native fpsimd_state and the compat_vfp_sigframe.

Unfortunately, this doesn't work so well in a big-endian environment.
Our fpsimd save/restore code operates directly on 128-bit quantities
(Q registers) whereas the compat_vfp_sigframe represents the registers
as an array of 64-bit (D) registers. The architecture packs the compat D
registers into the Q registers, with the least significant bytes holding
the lower register. Consequently, we need to swap the 64-bit halves when
converting between these two representations on a big-endian machine.

This patch replaces the __copy_{to,from}_user invocations in our
compat VFP signal handling code with explicit __put_user loops that
operate on 64-bit values and swap them accordingly.

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/kernel/signal32.c |   47 ++++++++++++++++++++++++++++++++-----------
 1 file changed, 36 insertions(+), 11 deletions(-)

--- a/arch/arm64/kernel/signal32.c
+++ b/arch/arm64/kernel/signal32.c
@@ -212,14 +212,32 @@ int copy_siginfo_from_user32(siginfo_t *
 
 /*
  * VFP save/restore code.
+ *
+ * We have to be careful with endianness, since the fpsimd context-switch
+ * code operates on 128-bit (Q) register values whereas the compat ABI
+ * uses an array of 64-bit (D) registers. Consequently, we need to swap
+ * the two halves of each Q register when running on a big-endian CPU.
  */
+union __fpsimd_vreg {
+	__uint128_t	raw;
+	struct {
+#ifdef __AARCH64EB__
+		u64	hi;
+		u64	lo;
+#else
+		u64	lo;
+		u64	hi;
+#endif
+	};
+};
+
 static int compat_preserve_vfp_context(struct compat_vfp_sigframe __user *frame)
 {
 	struct fpsimd_state *fpsimd = &current->thread.fpsimd_state;
 	compat_ulong_t magic = VFP_MAGIC;
 	compat_ulong_t size = VFP_STORAGE_SIZE;
 	compat_ulong_t fpscr, fpexc;
-	int err = 0;
+	int i, err = 0;
 
 	/*
 	 * Save the hardware registers to the fpsimd_state structure.
@@ -235,10 +253,15 @@ static int compat_preserve_vfp_context(s
 	/*
 	 * Now copy the FP registers. Since the registers are packed,
 	 * we can copy the prefix we want (V0-V15) as it is.
-	 * FIXME: Won't work if big endian.
 	 */
-	err |= __copy_to_user(&frame->ufp.fpregs, fpsimd->vregs,
-			      sizeof(frame->ufp.fpregs));
+	for (i = 0; i < ARRAY_SIZE(frame->ufp.fpregs); i += 2) {
+		union __fpsimd_vreg vreg = {
+			.raw = fpsimd->vregs[i >> 1],
+		};
+
+		__put_user_error(vreg.lo, &frame->ufp.fpregs[i], err);
+		__put_user_error(vreg.hi, &frame->ufp.fpregs[i + 1], err);
+	}
 
 	/* Create an AArch32 fpscr from the fpsr and the fpcr. */
 	fpscr = (fpsimd->fpsr & VFP_FPSCR_STAT_MASK) |
@@ -263,7 +286,7 @@ static int compat_restore_vfp_context(st
 	compat_ulong_t magic = VFP_MAGIC;
 	compat_ulong_t size = VFP_STORAGE_SIZE;
 	compat_ulong_t fpscr;
-	int err = 0;
+	int i, err = 0;
 
 	__get_user_error(magic, &frame->magic, err);
 	__get_user_error(size, &frame->size, err);
@@ -273,12 +296,14 @@ static int compat_restore_vfp_context(st
 	if (magic != VFP_MAGIC || size != VFP_STORAGE_SIZE)
 		return -EINVAL;
 
-	/*
-	 * Copy the FP registers into the start of the fpsimd_state.
-	 * FIXME: Won't work if big endian.
-	 */
-	err |= __copy_from_user(fpsimd.vregs, frame->ufp.fpregs,
-				sizeof(frame->ufp.fpregs));
+	/* Copy the FP registers into the start of the fpsimd_state. */
+	for (i = 0; i < ARRAY_SIZE(frame->ufp.fpregs); i += 2) {
+		union __fpsimd_vreg vreg;
+
+		__get_user_error(vreg.lo, &frame->ufp.fpregs[i], err);
+		__get_user_error(vreg.hi, &frame->ufp.fpregs[i + 1], err);
+		fpsimd.vregs[i >> 1] = vreg.raw;
+	}
 
 	/* Extract the fpsr and the fpcr from the fpscr */
 	__get_user_error(fpscr, &frame->ufp.fpscr, err);



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

* [PATCH 4.2 033/134] arm64: head.S: initialise mdcr_el2 in el2_setup
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (31 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 032/134] arm64: compat: fix vfp save/restore across signal handlers in big-endian Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 034/134] arm64: errata: add module build workaround for erratum #843419 Greg Kroah-Hartman
                   ` (100 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Marc Zyngier, Will Deacon

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

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

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

commit d10bcd473301888f957ec4b6b12aa3621be78d59 upstream.

When entering the kernel at EL2, we fail to initialise the MDCR_EL2
register which controls debug access and PMU capabilities at EL1.

This patch ensures that the register is initialised so that all traps
are disabled and all the PMU counters are available to the host. When a
guest is scheduled, KVM takes care to configure trapping appropriately.

Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/kernel/head.S |    5 +++++
 1 file changed, 5 insertions(+)

--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -528,6 +528,11 @@ CPU_LE(	movk	x0, #0x30d0, lsl #16	)	// C
 	msr	hstr_el2, xzr			// Disable CP15 traps to EL2
 #endif
 
+	/* EL2 debug */
+	mrs	x0, pmcr_el0			// Disable debug access traps
+	ubfx	x0, x0, #11, #5			// to EL2 and allow access to
+	msr	mdcr_el2, x0			// all PMU counters from EL1
+
 	/* Stage-2 translation */
 	msr	vttbr_el2, xzr
 



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

* [PATCH 4.2 034/134] arm64: errata: add module build workaround for erratum #843419
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (32 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 033/134] arm64: head.S: initialise mdcr_el2 in el2_setup Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 035/134] arm/arm64: KVM: vgic: Check for !irqchip_in_kernel() when mapping resources Greg Kroah-Hartman
                   ` (99 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Catalin Marinas, Will Deacon

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

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

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

commit df057cc7b4fa59e9b55f07ffdb6c62bf02e99a00 upstream.

Cortex-A53 processors <= r0p4 are affected by erratum #843419 which can
lead to a memory access using an incorrect address in certain sequences
headed by an ADRP instruction.

There is a linker fix to generate veneers for ADRP instructions, but
this doesn't work for kernel modules which are built as unlinked ELF
objects.

This patch adds a new config option for the erratum which, when enabled,
builds kernel modules with the mcmodel=large flag. This uses absolute
addressing for all kernel symbols, thereby removing the use of ADRP as
a PC-relative form of addressing. The ADRP relocs are removed from the
module loader so that we fail to load any potentially affected modules.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/Kconfig         |   16 ++++++++++++++++
 arch/arm64/Makefile        |    4 ++++
 arch/arm64/kernel/module.c |    2 ++
 3 files changed, 22 insertions(+)

--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -421,6 +421,22 @@ config ARM64_ERRATUM_845719
 
 	  If unsure, say Y.
 
+config ARM64_ERRATUM_843419
+	bool "Cortex-A53: 843419: A load or store might access an incorrect address"
+	depends on MODULES
+	default y
+	help
+	  This option builds kernel modules using the large memory model in
+	  order to avoid the use of the ADRP instruction, which can cause
+	  a subsequent memory access to use an incorrect address on Cortex-A53
+	  parts up to r0p4.
+
+	  Note that the kernel itself must be linked with a version of ld
+	  which fixes potentially affected ADRP instructions through the
+	  use of veneers.
+
+	  If unsure, say Y.
+
 endmenu
 
 
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -30,6 +30,10 @@ endif
 
 CHECKFLAGS	+= -D__aarch64__
 
+ifeq ($(CONFIG_ARM64_ERRATUM_843419), y)
+CFLAGS_MODULE	+= -mcmodel=large
+endif
+
 # Default value
 head-y		:= arch/arm64/kernel/head.o
 
--- a/arch/arm64/kernel/module.c
+++ b/arch/arm64/kernel/module.c
@@ -332,12 +332,14 @@ int apply_relocate_add(Elf64_Shdr *sechd
 			ovf = reloc_insn_imm(RELOC_OP_PREL, loc, val, 0, 21,
 					     AARCH64_INSN_IMM_ADR);
 			break;
+#ifndef CONFIG_ARM64_ERRATUM_843419
 		case R_AARCH64_ADR_PREL_PG_HI21_NC:
 			overflow_check = false;
 		case R_AARCH64_ADR_PREL_PG_HI21:
 			ovf = reloc_insn_imm(RELOC_OP_PAGE, loc, val, 12, 21,
 					     AARCH64_INSN_IMM_ADR);
 			break;
+#endif
 		case R_AARCH64_ADD_ABS_LO12_NC:
 		case R_AARCH64_LDST8_ABS_LO12_NC:
 			overflow_check = false;



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

* [PATCH 4.2 035/134] arm/arm64: KVM: vgic: Check for !irqchip_in_kernel() when mapping resources
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (33 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 034/134] arm64: errata: add module build workaround for erratum #843419 Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 036/134] KVM: arm64: add workaround for Cortex-A57 erratum #852523 Greg Kroah-Hartman
                   ` (98 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Pavel Fedin, Marc Zyngier

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

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

From: Pavel Fedin <p.fedin@samsung.com>

commit c2f58514cfb374d5368c9da945f1765cd48eb0da upstream.

Until b26e5fdac43c ("arm/arm64: KVM: introduce per-VM ops"),
kvm_vgic_map_resources() used to include a check on irqchip_in_kernel(),
and vgic_v2_map_resources() still has it.

But now vm_ops are not initialized until we call kvm_vgic_create().
Therefore kvm_vgic_map_resources() can being called without a VGIC,
and we die because vm_ops.map_resources is NULL.

Fixing this restores QEMU's kernel-irqchip=off option to a working state,
allowing to use GIC emulation in userspace.

Fixes: b26e5fdac43c ("arm/arm64: KVM: introduce per-VM ops")
Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
[maz: reworked commit message]
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/kvm/arm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -449,7 +449,7 @@ static int kvm_vcpu_first_run_init(struc
 	 * Map the VGIC hardware resources before running a vcpu the first
 	 * time on this VM.
 	 */
-	if (unlikely(!vgic_ready(kvm))) {
+	if (unlikely(irqchip_in_kernel(kvm) && !vgic_ready(kvm))) {
 		ret = kvm_vgic_map_resources(kvm);
 		if (ret)
 			return ret;



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

* [PATCH 4.2 036/134] KVM: arm64: add workaround for Cortex-A57 erratum #852523
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (34 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 035/134] arm/arm64: KVM: vgic: Check for !irqchip_in_kernel() when mapping resources Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 037/134] arm64: KVM: Disable virtual timer even if the guest is not using it Greg Kroah-Hartman
                   ` (97 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Marc Zyngier, Will Deacon

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

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

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

commit 43297dda0a51e4ffed0888ce727c218cfb7474b6 upstream.

When restoring the system register state for an AArch32 guest at EL2,
writes to DACR32_EL2 may not be correctly synchronised by Cortex-A57,
which can lead to the guest effectively running with junk in the DACR
and running into unexpected domain faults.

This patch works around the issue by re-ordering our restoration of the
AArch32 register aliases so that they happen before the AArch64 system
registers. Ensuring that the registers are restored in this order
guarantees that they will be correctly synchronised by the core.

Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/kvm/hyp.S |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/arch/arm64/kvm/hyp.S
+++ b/arch/arm64/kvm/hyp.S
@@ -943,13 +943,15 @@ ENTRY(__kvm_vcpu_run)
 	// Guest context
 	add	x2, x0, #VCPU_CONTEXT
 
+	// We must restore the 32-bit state before the sysregs, thanks
+	// to Cortex-A57 erratum #852523.
+	restore_guest_32bit_state
 	bl __restore_sysregs
 	bl __restore_fpsimd
 
 	skip_debug_state x3, 1f
 	bl	__restore_debug
 1:
-	restore_guest_32bit_state
 	restore_guest_regs
 
 	// That's it, no more messing around.



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

* [PATCH 4.2 037/134] arm64: KVM: Disable virtual timer even if the guest is not using it
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (35 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 036/134] KVM: arm64: add workaround for Cortex-A57 erratum #852523 Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 038/134] Input: synaptics - fix handling of disabling gesture mode Greg Kroah-Hartman
                   ` (96 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Christoffer Dall, Marc Zyngier

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

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

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

commit c4cbba9fa078f55d9f6d081dbb4aec7cf969e7c7 upstream.

When running a guest with the architected timer disabled (with QEMU and
the kernel_irqchip=off option, for example), it is important to make
sure the timer gets turned off. Otherwise, the guest may try to
enable it anyway, leading to a screaming HW interrupt.

The fix is to unconditionally turn off the virtual timer on guest
exit.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/kvm/hyp.S |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/arch/arm64/kvm/hyp.S
+++ b/arch/arm64/kvm/hyp.S
@@ -840,8 +840,6 @@
 	mrs	x3, cntv_ctl_el0
 	and	x3, x3, #3
 	str	w3, [x0, #VCPU_TIMER_CNTV_CTL]
-	bic	x3, x3, #1		// Clear Enable
-	msr	cntv_ctl_el0, x3
 
 	isb
 
@@ -849,6 +847,9 @@
 	str	x3, [x0, #VCPU_TIMER_CNTV_CVAL]
 
 1:
+	// Disable the virtual timer
+	msr	cntv_ctl_el0, xzr
+
 	// Allow physical timer/counter access for the host
 	mrs	x2, cnthctl_el2
 	orr	x2, x2, #3



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

* [PATCH 4.2 038/134] Input: synaptics - fix handling of disabling gesture mode
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (36 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 037/134] arm64: KVM: Disable virtual timer even if the guest is not using it Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 039/134] Input: evdev - do not report errors form flush() Greg Kroah-Hartman
                   ` (95 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Nick Bowler, Gabor Balla, Dmitry Torokhov

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

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

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>

commit e51e38494a8ecc18650efb0c840600637891de2c upstream.

Bit 2 of the mode byte has dual meaning: it can disable reporting of
gestures when touchpad works in Relative mode or normal Absolute mode,
or it can enable so called Extended W-Mode when touchpad uses enhanced
Absolute mode (W-mode). The extended W-Mode confuses our driver and
causes missing button presses on some Thinkpads (x250, T450s), so let's
make sure we do not enable it.

Also, according to the spec W mode "... bit is defined only in Absolute
mode on pads whose capExtended capability bit is set. In Relative mode and
in TouchPads without this capability, the bit is reserved and should be
left at 0.", so let's make sure we respect this requirement as well.

Reported-by: Nick Bowler <nbowler@draconx.ca>
Suggested-by: Gabor Balla <gaborwho@gmail.com>
Tested-by: Gabor Balla <gaborwho@gmail.com>
Tested-by: Nick Bowler <nbowler@draconx.ca>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -519,14 +519,18 @@ static int synaptics_set_mode(struct psm
 	struct synaptics_data *priv = psmouse->private;
 
 	priv->mode = 0;
-	if (priv->absolute_mode)
+
+	if (priv->absolute_mode) {
 		priv->mode |= SYN_BIT_ABSOLUTE_MODE;
-	if (priv->disable_gesture)
+		if (SYN_CAP_EXTENDED(priv->capabilities))
+			priv->mode |= SYN_BIT_W_MODE;
+	}
+
+	if (!SYN_MODE_WMODE(priv->mode) && priv->disable_gesture)
 		priv->mode |= SYN_BIT_DISABLE_GESTURE;
+
 	if (psmouse->rate >= 80)
 		priv->mode |= SYN_BIT_HIGH_RATE;
-	if (SYN_CAP_EXTENDED(priv->capabilities))
-		priv->mode |= SYN_BIT_W_MODE;
 
 	if (synaptics_mode_cmd(psmouse, priv->mode))
 		return -1;



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

* [PATCH 4.2 039/134] Input: evdev - do not report errors form flush()
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (37 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 038/134] Input: synaptics - fix handling of disabling gesture mode Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 040/134] ALSA: usb-audio: correct the value cache check Greg Kroah-Hartman
                   ` (94 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Takashi Iwai, Dmitry Torokhov

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

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

From: Takashi Iwai <tiwai@suse.de>

commit eb38f3a4f6e86f8bb10a3217ebd85ecc5d763aae upstream.

We've got bug reports showing the old systemd-logind (at least
system-210) aborting unexpectedly, and this turned out to be because
of an invalid error code from close() call to evdev devices.  close()
is supposed to return only either EINTR or EBADFD, while the device
returned ENODEV.  logind was overreacting to it and decided to kill
itself when an unexpected error code was received.  What a tragedy.

The bad error code comes from flush fops, and actually evdev_flush()
returns ENODEV when device is disconnected or client's access to it is
revoked. But in these cases the fact that flush did not actually happen is
not an error, but rather normal behavior. For non-disconnected devices
result of flush is also not that interesting as there is no potential of
data loss and even if it fails application has no way of handling the
error. Because of that we are better off always returning success from
evdev_flush().

Also returning EINTR from flush()/close() is discouraged (as it is not
clear how application should handle this error), so let's stop taking
evdev->mutex interruptibly.

Bugzilla: http://bugzilla.suse.com/show_bug.cgi?id=939834
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/input/evdev.c |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -290,19 +290,14 @@ static int evdev_flush(struct file *file
 {
 	struct evdev_client *client = file->private_data;
 	struct evdev *evdev = client->evdev;
-	int retval;
 
-	retval = mutex_lock_interruptible(&evdev->mutex);
-	if (retval)
-		return retval;
+	mutex_lock(&evdev->mutex);
 
-	if (!evdev->exist || client->revoked)
-		retval = -ENODEV;
-	else
-		retval = input_flush_device(&evdev->handle, file);
+	if (evdev->exist && !client->revoked)
+		input_flush_device(&evdev->handle, file);
 
 	mutex_unlock(&evdev->mutex);
-	return retval;
+	return 0;
 }
 
 static void evdev_free(struct device *dev)



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

* [PATCH 4.2 040/134] ALSA: usb-audio: correct the value cache check.
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (38 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 039/134] Input: evdev - do not report errors form flush() Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 041/134] ALSA: hda - Fix missing inline for dummy snd_hdac_set_codec_wakeup() Greg Kroah-Hartman
                   ` (93 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Yao-Wen Mao, Takashi Iwai

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

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

From: Yao-Wen Mao <yaowen@google.com>

commit 6aa6925cad06159dc6e25857991bbc4960821242 upstream.

The check of cval->cached should be zero-based (including master channel).

Signed-off-by: Yao-Wen Mao <yaowen@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/usb/mixer.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -2522,7 +2522,7 @@ static int restore_mixer_value(struct us
 		for (c = 0; c < MAX_CHANNELS; c++) {
 			if (!(cval->cmask & (1 << c)))
 				continue;
-			if (cval->cached & (1 << c)) {
+			if (cval->cached & (1 << (c + 1))) {
 				err = snd_usb_set_cur_mix_value(cval, c + 1, idx,
 							cval->cache_val[idx]);
 				if (err < 0)



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

* [PATCH 4.2 041/134] ALSA: hda - Fix missing inline for dummy snd_hdac_set_codec_wakeup()
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (39 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 040/134] ALSA: usb-audio: correct the value cache check Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 042/134] ALSA: hda - Enable headphone jack detect on old Fujitsu laptops Greg Kroah-Hartman
                   ` (92 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Takashi Iwai

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

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

From: Takashi Iwai <tiwai@suse.de>

commit 6869de380e8c11c31b608bb2502dcacd634eda13 upstream.

This seems overlooked.

Fixes: 98d8fc6c5d36 ('ALSA: hda - Move hda_i915.c from sound/pci/hda to sound/hda')
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 include/sound/hda_i915.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/include/sound/hda_i915.h
+++ b/include/sound/hda_i915.h
@@ -11,7 +11,7 @@ int snd_hdac_get_display_clk(struct hdac
 int snd_hdac_i915_init(struct hdac_bus *bus);
 int snd_hdac_i915_exit(struct hdac_bus *bus);
 #else
-static int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable)
+static inline int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable)
 {
 	return 0;
 }



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

* [PATCH 4.2 042/134] ALSA: hda - Enable headphone jack detect on old Fujitsu laptops
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (40 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 041/134] ALSA: hda - Fix missing inline for dummy snd_hdac_set_codec_wakeup() Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 043/134] ALSA: hda - Use ALC880_FIXUP_FUJITSU for FSC Amilo M1437 Greg Kroah-Hartman
                   ` (91 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Takashi Iwai

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

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

From: Takashi Iwai <tiwai@suse.de>

commit bb148bdeb0ab16fc0ae8009799471e4d7180073b upstream.

According to the bug report, FSC Amilo laptops with ALC880 can detect
the headphone jack but currently the driver disables it.  It's partly
intentionally, as non-working jack detect was reported in the past.
Let's enable now.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=102501
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/pci/hda/patch_realtek.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1135,7 +1135,7 @@ static const struct hda_fixup alc880_fix
 		/* override all pins as BIOS on old Amilo is broken */
 		.type = HDA_FIXUP_PINS,
 		.v.pins = (const struct hda_pintbl[]) {
-			{ 0x14, 0x0121411f }, /* HP */
+			{ 0x14, 0x0121401f }, /* HP */
 			{ 0x15, 0x99030120 }, /* speaker */
 			{ 0x16, 0x99030130 }, /* bass speaker */
 			{ 0x17, 0x411111f0 }, /* N/A */
@@ -1155,7 +1155,7 @@ static const struct hda_fixup alc880_fix
 		/* almost compatible with FUJITSU, but no bass and SPDIF */
 		.type = HDA_FIXUP_PINS,
 		.v.pins = (const struct hda_pintbl[]) {
-			{ 0x14, 0x0121411f }, /* HP */
+			{ 0x14, 0x0121401f }, /* HP */
 			{ 0x15, 0x99030120 }, /* speaker */
 			{ 0x16, 0x411111f0 }, /* N/A */
 			{ 0x17, 0x411111f0 }, /* N/A */



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

* [PATCH 4.2 043/134] ALSA: hda - Use ALC880_FIXUP_FUJITSU for FSC Amilo M1437
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (41 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 042/134] ALSA: hda - Enable headphone jack detect on old Fujitsu laptops Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 044/134] ALSA: hda - Add some FIXUP quirks for white noise on Dell laptop Greg Kroah-Hartman
                   ` (90 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Takashi Iwai

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

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

From: Takashi Iwai <tiwai@suse.de>

commit a161574e200ae63a5042120e0d8c36830e81bde3 upstream.

It turned out that the machine has a bass speaker, so take a correct
fixup entry.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=102501
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/pci/hda/patch_realtek.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1364,7 +1364,7 @@ static const struct snd_pci_quirk alc880
 	SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
 	SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
 	SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
-	SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_FIXUP_F1734),
+	SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
 	SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
 	SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
 	SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),



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

* [PATCH 4.2 044/134] ALSA: hda - Add some FIXUP quirks for white noise on Dell laptop.
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (42 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 043/134] ALSA: hda - Use ALC880_FIXUP_FUJITSU for FSC Amilo M1437 Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 045/134] ALSA: hda - Fix white noise on Dell M3800 Greg Kroah-Hartman
                   ` (89 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Woodrow Shen, Takashi Iwai

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

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

From: Woodrow Shen <woodrow.shen@canonical.com>

commit 1adecc6755e1e4193b5618ddb2e107f6d6e88f4b upstream.

Dell laptop has a series model to use the same codec but different subsystem ID.
At the same time they happens the white noise by login screen and headphone;
for fixing them together, I only can add these IDs to FIXUP function ALC292_FIXUP_DISABLE_AAMIX,
then try to solve such the similar issues.

Codec: Realtek ALC3235
Vendor Id: 0x10ec0293
Subsystem Id: 0x102806dd
Subsystem Id: 0x102806df
Subsystem Id: 0x102806e0

BugLink: https://bugs.launchpad.net/bugs/1492132
Signed-off-by: Woodrow Shen <woodrow.shen@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/pci/hda/patch_realtek.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -5189,8 +5189,11 @@ static const struct snd_pci_quirk alc269
 	SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
 	SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
 	SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
-	SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC292_FIXUP_DISABLE_AAMIX),
 	SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC292_FIXUP_DISABLE_AAMIX),
+	SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC292_FIXUP_DISABLE_AAMIX),
+	SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC292_FIXUP_DISABLE_AAMIX),
+	SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC292_FIXUP_DISABLE_AAMIX),
+	SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC292_FIXUP_DISABLE_AAMIX),
 	SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
 	SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
 	SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),



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

* [PATCH 4.2 045/134] ALSA: hda - Fix white noise on Dell M3800
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (43 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 044/134] ALSA: hda - Add some FIXUP quirks for white noise on Dell laptop Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 046/134] pinctrl: mediatek: Fix multiple registration issue Greg Kroah-Hartman
                   ` (88 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Niranjan Sivakumar, Takashi Iwai

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

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

From: Niranjan Sivakumar <ns253@cornell.edu>

commit 467e1436ba85f78b8c4610c4549eb255a8211c42 upstream.

The M3800 is very minor workstation variant of the XPS 15 which has
already been patched for this issue.  I figured it's probably more
important for this version of the laptop to be patched than the
regular XPS as Dell sells is pre-configured with Ubuntu to be used as
a Linux workstation.  I have tested the patch on my the hardware on
Linux 4.2.0.

Signed-off-by: Niranjan Sivakumar <ns253@cornell.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/pci/hda/patch_realtek.c |    1 +
 1 file changed, 1 insertion(+)

--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -6582,6 +6582,7 @@ static const struct snd_pci_quirk alc662
 	SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
 	SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
 	SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
+	SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
 	SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
 	SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
 	SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),



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

* [PATCH 4.2 046/134] pinctrl: mediatek: Fix multiple registration issue.
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (44 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 045/134] ALSA: hda - Fix white noise on Dell M3800 Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:54 ` [PATCH 4.2 047/134] pinctrl: at91: fix null pointer dereference Greg Kroah-Hartman
                   ` (87 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Hongzhou Yang, Axel Lin, Linus Walleij

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

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

From: Hongzhou Yang <hongzhou.yang@mediatek.com>

commit d48c2c02645392483f2b88b050d21ce1db6997b3 upstream.

Since our common driver need support main chip and PMU
at the same time, that means it will register two
pinctrl device, and the pinctrl_desc structure should
be used two times.

But pinctrl_desc use global static definition, then
the latest registered pinctrl device will overwrite
the old one's, all members in pinctrl_desc will set to
the new one's, such as name, pins and pins numbers, etc.
This is a bug.

Move pinctrl_desc into mtk_pinctrl, assign new value for
each pinctrl device to fix it.

Signed-off-by: Hongzhou Yang <hongzhou.yang@mediatek.com>
Reviewed-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   21 ++++++++++-----------
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h |    1 +
 2 files changed, 11 insertions(+), 11 deletions(-)

--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -1202,12 +1202,6 @@ static int mtk_pctrl_build_state(struct
 	return 0;
 }
 
-static struct pinctrl_desc mtk_pctrl_desc = {
-	.confops	= &mtk_pconf_ops,
-	.pctlops	= &mtk_pctrl_ops,
-	.pmxops		= &mtk_pmx_ops,
-};
-
 int mtk_pctrl_init(struct platform_device *pdev,
 		const struct mtk_pinctrl_devdata *data,
 		struct regmap *regmap)
@@ -1265,12 +1259,17 @@ int mtk_pctrl_init(struct platform_devic
 
 	for (i = 0; i < pctl->devdata->npins; i++)
 		pins[i] = pctl->devdata->pins[i].pin;
-	mtk_pctrl_desc.name = dev_name(&pdev->dev);
-	mtk_pctrl_desc.owner = THIS_MODULE;
-	mtk_pctrl_desc.pins = pins;
-	mtk_pctrl_desc.npins = pctl->devdata->npins;
+
+	pctl->pctl_desc.name = dev_name(&pdev->dev);
+	pctl->pctl_desc.owner = THIS_MODULE;
+	pctl->pctl_desc.pins = pins;
+	pctl->pctl_desc.npins = pctl->devdata->npins;
+	pctl->pctl_desc.confops = &mtk_pconf_ops;
+	pctl->pctl_desc.pctlops = &mtk_pctrl_ops;
+	pctl->pctl_desc.pmxops = &mtk_pmx_ops;
 	pctl->dev = &pdev->dev;
-	pctl->pctl_dev = pinctrl_register(&mtk_pctrl_desc, &pdev->dev, pctl);
+
+	pctl->pctl_dev = pinctrl_register(&pctl->pctl_desc, &pdev->dev, pctl);
 	if (IS_ERR(pctl->pctl_dev)) {
 		dev_err(&pdev->dev, "couldn't register pinctrl driver\n");
 		return PTR_ERR(pctl->pctl_dev);
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
@@ -256,6 +256,7 @@ struct mtk_pinctrl_devdata {
 struct mtk_pinctrl {
 	struct regmap	*regmap1;
 	struct regmap	*regmap2;
+	struct pinctrl_desc pctl_desc;
 	struct device           *dev;
 	struct gpio_chip	*chip;
 	struct mtk_pinctrl_group	*groups;



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

* [PATCH 4.2 047/134] pinctrl: at91: fix null pointer dereference
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (45 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 046/134] pinctrl: mediatek: Fix multiple registration issue Greg Kroah-Hartman
@ 2015-09-26 20:54 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 048/134] powerpc/pseries: Fix corrupted pdn list Greg Kroah-Hartman
                   ` (86 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, David Dueck, Ludovic Desroches,
	Alexandre Belloni, Nicolas Ferre, Boris Brezillon,
	Jean-Christophe PLAGNIOL-VILLARD, linux-arm-kernel,
	Linus Walleij

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

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

From: David Dueck <davidcdueck@googlemail.com>

commit 1ab36387ea4face01aac3560b396b1e2ce07c4ff upstream.

Not all gpio banks are necessarily enabled, in the current code this can
lead to null pointer dereferences.

[   51.130000] Unable to handle kernel NULL pointer dereference at virtual address 00000058
[   51.130000] pgd = dee04000
[   51.130000] [00000058] *pgd=3f66d831, *pte=00000000, *ppte=00000000
[   51.140000] Internal error: Oops: 17 [#1] ARM
[   51.140000] Modules linked in:
[   51.140000] CPU: 0 PID: 1664 Comm: cat Not tainted 4.1.1+ #6
[   51.140000] Hardware name: Atmel SAMA5
[   51.140000] task: df6dd880 ti: dec60000 task.ti: dec60000
[   51.140000] PC is at at91_pinconf_get+0xb4/0x200
[   51.140000] LR is at at91_pinconf_get+0xb4/0x200
[   51.140000] pc : [<c01e71a0>]    lr : [<c01e71a0>]    psr: 600f0013
sp : dec61e48  ip : 600f0013  fp : df522538
[   51.140000] r10: df52250c  r9 : 00000058  r8 : 00000068
[   51.140000] r7 : 00000000  r6 : df53c910  r5 : 00000000  r4 : dec61e7c
[   51.140000] r3 : 00000000  r2 : c06746d4  r1 : 00000000  r0 : 00000003
[   51.140000] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[   51.140000] Control: 10c53c7d  Table: 3ee04059  DAC: 00000015
[   51.140000] Process cat (pid: 1664, stack limit = 0xdec60208)
[   51.140000] Stack: (0xdec61e48 to 0xdec62000)
[   51.140000] 1e40:                   00000358 00000000 df522500 ded15f80 c05a9d08 ded15f80
[   51.140000] 1e60: 0000048c 00000061 df522500 ded15f80 c05a9d08 c01e7304 ded15f80 00000000
[   51.140000] 1e80: c01e6008 00000060 0000048c c01e6034 c01e5f6c ded15f80 dec61ec0 00000000
[   51.140000] 1ea0: 00020000 ded6f280 dec61f80 00000001 00000001 c00ae0b8 b6e80000 ded15fb0
[   51.140000] 1ec0: 00000000 00000000 df4bc974 00000055 00000800 ded6f280 b6e80000 ded6f280
[   51.140000] 1ee0: ded6f280 00020000 b6e80000 00000000 00020000 c0090dec c0671e1c dec61fb0
[   51.140000] 1f00: b6f8b510 00000001 00004201 c000924c 00000000 00000003 00000003 00000000
[   51.140000] 1f20: df4bc940 00022000 00000022 c066e188 b6e7f000 c00836f4 000b6e7f ded6f280
[   51.140000] 1f40: ded6f280 b6e80000 dec61f80 ded6f280 00020000 c0091508 00000000 00000003
[   51.140000] 1f60: 00022000 00000000 00000000 ded6f280 ded6f280 00020000 b6e80000 c0091d9c
[   51.140000] 1f80: 00000000 00000000 ffffffff 00020000 00020000 b6e80000 00000003 c000f124
[   51.140000] 1fa0: dec60000 c000efa0 00020000 00020000 00000003 b6e80000 00020000 000271c4
[   51.140000] 1fc0: 00020000 00020000 b6e80000 00000003 7fffe000 00000000 00000000 00020000
[   51.140000] 1fe0: 00000000 bef50b64 00013835 b6f29c76 400f0030 00000003 00000000 00000000
[   51.140000] [<c01e71a0>] (at91_pinconf_get) from [<c01e7304>] (at91_pinconf_dbg_show+0x18/0x2c0)
[   51.140000] [<c01e7304>] (at91_pinconf_dbg_show) from [<c01e6034>] (pinconf_pins_show+0xc8/0xf8)
[   51.140000] [<c01e6034>] (pinconf_pins_show) from [<c00ae0b8>] (seq_read+0x1a0/0x464)
[   51.140000] [<c00ae0b8>] (seq_read) from [<c0090dec>] (__vfs_read+0x20/0xd0)
[   51.140000] [<c0090dec>] (__vfs_read) from [<c0091508>] (vfs_read+0x7c/0x108)
[   51.140000] [<c0091508>] (vfs_read) from [<c0091d9c>] (SyS_read+0x40/0x94)
[   51.140000] [<c0091d9c>] (SyS_read) from [<c000efa0>] (ret_fast_syscall+0x0/0x3c)
[   51.140000] Code: eb010ec2 e30a0d08 e34c005a eb0ae5a7 (e5993000)
[   51.150000] ---[ end trace fb3c370da3ea4794 ]---

Fixes: a0b957f306fa ("pinctrl: at91: allow to have disabled gpio bank")
Signed-off-by: David Dueck <davidcdueck@googlemail.com>
Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/pinctrl/pinctrl-at91.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -320,6 +320,9 @@ static const struct pinctrl_ops at91_pct
 static void __iomem *pin_to_controller(struct at91_pinctrl *info,
 				 unsigned int bank)
 {
+	if (!gpio_chips[bank])
+		return NULL;
+
 	return gpio_chips[bank]->regbase;
 }
 
@@ -729,6 +732,10 @@ static int at91_pmx_set(struct pinctrl_d
 		pin = &pins_conf[i];
 		at91_pin_dbg(info->dev, pin);
 		pio = pin_to_controller(info, pin->bank);
+
+		if (!pio)
+			continue;
+
 		mask = pin_to_mask(pin->pin);
 		at91_mux_disable_interrupt(pio, mask);
 		switch (pin->mux) {
@@ -848,6 +855,10 @@ static int at91_pinconf_get(struct pinct
 	*config = 0;
 	dev_dbg(info->dev, "%s:%d, pin_id=%d", __func__, __LINE__, pin_id);
 	pio = pin_to_controller(info, pin_to_bank(pin_id));
+
+	if (!pio)
+		return -EINVAL;
+
 	pin = pin_id % MAX_NB_GPIO_PER_BANK;
 
 	if (at91_mux_get_multidrive(pio, pin))
@@ -889,6 +900,10 @@ static int at91_pinconf_set(struct pinct
 			"%s:%d, pin_id=%d, config=0x%lx",
 			__func__, __LINE__, pin_id, config);
 		pio = pin_to_controller(info, pin_to_bank(pin_id));
+
+		if (!pio)
+			return -EINVAL;
+
 		pin = pin_id % MAX_NB_GPIO_PER_BANK;
 		mask = pin_to_mask(pin);
 



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

* [PATCH 4.2 048/134] powerpc/pseries: Fix corrupted pdn list
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (46 preceding siblings ...)
  2015-09-26 20:54 ` [PATCH 4.2 047/134] pinctrl: at91: fix null pointer dereference Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 049/134] powerpc/eeh: Probe after unbalanced kref check Greg Kroah-Hartman
                   ` (85 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Santwana Samantray, Gavin Shan,
	Michael Ellerman

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

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

From: Gavin Shan <gwshan@linux.vnet.ibm.com>

commit 590c7567a2895f939525ead57b0334c6d47986f0 upstream.

Commit cca87d30 ("powerpc/pci: Refactor pci_dn") introduced pdn
list for SRIOV VFs. It means the pdn is be put into the child list
of its parent pdn when the pdn is created. When doing PCI hot
unplugging on pSeries, the PCI device node as well as its pdn are
released through procfs entry "powerpc/ofdt". Some one else grabs
the memory chunk of the pdn and update it accordingly. At the same
time, the pdn is still tracked in the child list of parent pdn. It
leads to corrupted child list in the parent pdn.

This fixes above issue by removing the pdn from the child list of
its parent pdn when the device node is detached from the system.
Note the pdn is free'd when the device node is released if the
device node is dynamic one. Otherwise, the device node as well
as the pdn won't be released.

Fixes: cca87d30 ("powerpc/pci: Refactor pci_dn")
Reported-by: Santwana Samantray <santwana.samantray@in.ibm.com>
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/platforms/pseries/setup.c |    5 +++++
 1 file changed, 5 insertions(+)

--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -268,6 +268,11 @@ static int pci_dn_reconfig_notifier(stru
 			eeh_dev_init(PCI_DN(np), pci->phb);
 		}
 		break;
+	case OF_RECONFIG_DETACH_NODE:
+		pci = PCI_DN(np);
+		if (pci)
+			list_del(&pci->list);
+		break;
 	default:
 		err = NOTIFY_DONE;
 		break;



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

* [PATCH 4.2 049/134] powerpc/eeh: Probe after unbalanced kref check
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (47 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 048/134] powerpc/pseries: Fix corrupted pdn list Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 050/134] powerpc/eeh: Fix fenced PHB caused by eeh_slot_error_detail() Greg Kroah-Hartman
                   ` (84 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Gavin Shan, Daniel Axtens, Michael Ellerman

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

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

From: Daniel Axtens <dja@axtens.net>

commit e642d11bdbfe8eb10116ab3959a2b5d75efda832 upstream.

In the complete hotplug case, EEH PEs are supposed to be released
and set to NULL. Normally, this is done by eeh_remove_device(),
which is called from pcibios_release_device().

However, if something is holding a kref to the device, it will not
be released, and the PE will remain. eeh_add_device_late() has
a check for this which will explictly destroy the PE in this case.

This check in eeh_add_device_late() occurs after a call to
eeh_ops->probe(). On PowerNV, probe is a pointer to pnv_eeh_probe(),
which will exit without probing if there is an existing PE.

This means that on PowerNV, devices with outstanding krefs will not
be rediscovered by EEH correctly after a complete hotplug. This is
affecting CXL (CAPI) devices in the field.

Put the probe after the kref check so that the PE is destroyed
and affected devices are correctly rediscovered by EEH.

Fixes: d91dafc02f42 ("powerpc/eeh: Delay probing EEH device during hotplug")
Cc: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Daniel Axtens <dja@axtens.net>
Acked-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/kernel/eeh.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -1116,9 +1116,6 @@ void eeh_add_device_late(struct pci_dev
 		return;
 	}
 
-	if (eeh_has_flag(EEH_PROBE_MODE_DEV))
-		eeh_ops->probe(pdn, NULL);
-
 	/*
 	 * The EEH cache might not be removed correctly because of
 	 * unbalanced kref to the device during unplug time, which
@@ -1142,6 +1139,9 @@ void eeh_add_device_late(struct pci_dev
 		dev->dev.archdata.edev = NULL;
 	}
 
+	if (eeh_has_flag(EEH_PROBE_MODE_DEV))
+		eeh_ops->probe(pdn, NULL);
+
 	edev->pdev = dev;
 	dev->dev.archdata.edev = edev;
 



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

* [PATCH 4.2 050/134] powerpc/eeh: Fix fenced PHB caused by eeh_slot_error_detail()
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (48 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 049/134] powerpc/eeh: Probe after unbalanced kref check Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 051/134] powerpc/mm: Fix pte_pagesize_index() crash on 4K w/64K hash Greg Kroah-Hartman
                   ` (83 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Manvanthara B. Puttashankar,
	Gavin Shan, Michael Ellerman

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

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

From: Gavin Shan <gwshan@linux.vnet.ibm.com>

commit 259800135c654a098d9f0adfdd3d1f20eef1f231 upstream.

The config space of some PCI devices can't be accessed when their
PEs are in frozen state. Otherwise, fenced PHB might be seen.
Those PEs are identified with flag EEH_PE_CFG_RESTRICTED, meaing
EEH_PE_CFG_BLOCKED is set automatically when the PE is put to
frozen state (EEH_PE_ISOLATED). eeh_slot_error_detail() restores
PCI device BARs with eeh_pe_restore_bars(), which then calls
eeh_ops->restore_config() to reinitialize the PCI device in
(OPAL) firmware. eeh_ops->restore_config() produces PCI config
access that causes fenced PHB. The problem was reported on below
adapter:

   0001:01:00.0 0200: 14e4:168e (rev 10)
   0001:01:00.0 Ethernet controller: Broadcom Corporation \
                NetXtreme II BCM57810 10 Gigabit Ethernet (rev 10)

This fixes the issue by skipping eeh_pe_restore_bars() in
eeh_slot_error_detail() when EEH_PE_CFG_BLOCKED is set for the PE.

Fixes: b6541db1 ("powerpc/eeh: Block PCI config access upon frozen PE")
Reported-by: Manvanthara B. Puttashankar <mputtash@in.ibm.com>
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/kernel/eeh.c |   21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -308,11 +308,26 @@ void eeh_slot_error_detail(struct eeh_pe
 	if (!(pe->type & EEH_PE_PHB)) {
 		if (eeh_has_flag(EEH_ENABLE_IO_FOR_LOG))
 			eeh_pci_enable(pe, EEH_OPT_THAW_MMIO);
+
+		/*
+		 * The config space of some PCI devices can't be accessed
+		 * when their PEs are in frozen state. Otherwise, fenced
+		 * PHB might be seen. Those PEs are identified with flag
+		 * EEH_PE_CFG_RESTRICTED, indicating EEH_PE_CFG_BLOCKED
+		 * is set automatically when the PE is put to EEH_PE_ISOLATED.
+		 *
+		 * Restoring BARs possibly triggers PCI config access in
+		 * (OPAL) firmware and then causes fenced PHB. If the
+		 * PCI config is blocked with flag EEH_PE_CFG_BLOCKED, it's
+		 * pointless to restore BARs and dump config space.
+		 */
 		eeh_ops->configure_bridge(pe);
-		eeh_pe_restore_bars(pe);
+		if (!(pe->state & EEH_PE_CFG_BLOCKED)) {
+			eeh_pe_restore_bars(pe);
 
-		pci_regs_buf[0] = 0;
-		eeh_pe_traverse(pe, eeh_dump_pe_log, &loglen);
+			pci_regs_buf[0] = 0;
+			eeh_pe_traverse(pe, eeh_dump_pe_log, &loglen);
+		}
 	}
 
 	eeh_ops->get_log(pe, severity, pci_regs_buf, loglen);



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

* [PATCH 4.2 051/134] powerpc/mm: Fix pte_pagesize_index() crash on 4K w/64K hash
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (49 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 050/134] powerpc/eeh: Fix fenced PHB caused by eeh_slot_error_detail() Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 052/134] powerpc/rtas: Introduce rtas_get_sensor_fast() for IRQ handlers Greg Kroah-Hartman
                   ` (82 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Cyril Bur, Michael Ellerman,
	Aneesh Kumar K.V

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

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

From: Michael Ellerman <mpe@ellerman.id.au>

commit 74b5037baa2011a2799e2c43adde7d171b072f9e upstream.

The powerpc kernel can be built to have either a 4K PAGE_SIZE or a 64K
PAGE_SIZE.

However when built with a 4K PAGE_SIZE there is an additional config
option which can be enabled, PPC_HAS_HASH_64K, which means the kernel
also knows how to hash a 64K page even though the base PAGE_SIZE is 4K.

This is used in one obscure configuration, to support 64K pages for SPU
local store on the Cell processor when the rest of the kernel is using
4K pages.

In this configuration, pte_pagesize_index() is defined to just pass
through its arguments to get_slice_psize(). However pte_pagesize_index()
is called for both user and kernel addresses, whereas get_slice_psize()
only knows how to handle user addresses.

This has been broken forever, however until recently it happened to
work. That was because in get_slice_psize() the large kernel address
would cause the right shift of the slice mask to return zero.

However in commit 7aa0727f3302 ("powerpc/mm: Increase the slice range to
64TB"), the get_slice_psize() code was changed so that instead of a
right shift we do an array lookup based on the address. When passed a
kernel address this means we index way off the end of the slice array
and return random junk.

That is only fatal if we happen to hit something non-zero, but when we
do return a non-zero value we confuse the MMU code and eventually cause
a check stop.

This fix is ugly, but simple. When we're called for a kernel address we
return 4K, which is always correct in this configuration, otherwise we
use the slice mask.

Fixes: 7aa0727f3302 ("powerpc/mm: Increase the slice range to 64TB")
Reported-by: Cyril Bur <cyrilbur@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/include/asm/pgtable-ppc64.h |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

--- a/arch/powerpc/include/asm/pgtable-ppc64.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -135,7 +135,19 @@
 #define pte_iterate_hashed_end() } while(0)
 
 #ifdef CONFIG_PPC_HAS_HASH_64K
-#define pte_pagesize_index(mm, addr, pte)	get_slice_psize(mm, addr)
+/*
+ * We expect this to be called only for user addresses or kernel virtual
+ * addresses other than the linear mapping.
+ */
+#define pte_pagesize_index(mm, addr, pte)			\
+	({							\
+		unsigned int psize;				\
+		if (is_kernel_addr(addr))			\
+			psize = MMU_PAGE_4K;			\
+		else						\
+			psize = get_slice_psize(mm, addr);	\
+		psize;						\
+	})
 #else
 #define pte_pagesize_index(mm, addr, pte)	MMU_PAGE_4K
 #endif



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

* [PATCH 4.2 052/134] powerpc/rtas: Introduce rtas_get_sensor_fast() for IRQ handlers
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (50 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 051/134] powerpc/mm: Fix pte_pagesize_index() crash on 4K w/64K hash Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 053/134] powerpc: Uncomment and make enable_kernel_vsx() routine available Greg Kroah-Hartman
                   ` (81 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Thomas Huth, Nathan Fontenot,
	Michael Ellerman

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

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

From: Thomas Huth <thuth@redhat.com>

commit 1c2cb594441d02815d304cccec9742ff5c707495 upstream.

The EPOW interrupt handler uses rtas_get_sensor(), which in turn
uses rtas_busy_delay() to wait for RTAS becoming ready in case it
is necessary. But rtas_busy_delay() is annotated with might_sleep()
and thus may not be used by interrupts handlers like the EPOW handler!
This leads to the following BUG when CONFIG_DEBUG_ATOMIC_SLEEP is
enabled:

 BUG: sleeping function called from invalid context at arch/powerpc/kernel/rtas.c:496
 in_atomic(): 1, irqs_disabled(): 1, pid: 0, name: swapper/1
 CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.2.0-rc2-thuth #6
 Call Trace:
 [c00000007ffe7b90] [c000000000807670] dump_stack+0xa0/0xdc (unreliable)
 [c00000007ffe7bc0] [c0000000000e1f14] ___might_sleep+0x134/0x180
 [c00000007ffe7c20] [c00000000002aec0] rtas_busy_delay+0x30/0xd0
 [c00000007ffe7c50] [c00000000002bde4] rtas_get_sensor+0x74/0xe0
 [c00000007ffe7ce0] [c000000000083264] ras_epow_interrupt+0x44/0x450
 [c00000007ffe7d90] [c000000000120260] handle_irq_event_percpu+0xa0/0x300
 [c00000007ffe7e70] [c000000000120524] handle_irq_event+0x64/0xc0
 [c00000007ffe7eb0] [c000000000124dbc] handle_fasteoi_irq+0xec/0x260
 [c00000007ffe7ef0] [c00000000011f4f0] generic_handle_irq+0x50/0x80
 [c00000007ffe7f20] [c000000000010f3c] __do_irq+0x8c/0x200
 [c00000007ffe7f90] [c0000000000236cc] call_do_irq+0x14/0x24
 [c00000007e6f39e0] [c000000000011144] do_IRQ+0x94/0x110
 [c00000007e6f3a30] [c000000000002594] hardware_interrupt_common+0x114/0x180

Fix this issue by introducing a new rtas_get_sensor_fast() function
that does not use rtas_busy_delay() - and thus can only be used for
sensors that do not cause a BUSY condition - known as "fast" sensors.

The EPOW sensor is defined to be "fast" in sPAPR - mpe.

Fixes: 587f83e8dd50 ("powerpc/pseries: Use rtas_get_sensor in RAS code")
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/include/asm/rtas.h      |    1 +
 arch/powerpc/kernel/rtas.c           |   17 +++++++++++++++++
 arch/powerpc/platforms/pseries/ras.c |    3 ++-
 3 files changed, 20 insertions(+), 1 deletion(-)

--- a/arch/powerpc/include/asm/rtas.h
+++ b/arch/powerpc/include/asm/rtas.h
@@ -343,6 +343,7 @@ extern void rtas_power_off(void);
 extern void rtas_halt(void);
 extern void rtas_os_term(char *str);
 extern int rtas_get_sensor(int sensor, int index, int *state);
+extern int rtas_get_sensor_fast(int sensor, int index, int *state);
 extern int rtas_get_power_level(int powerdomain, int *level);
 extern int rtas_set_power_level(int powerdomain, int level, int *setlevel);
 extern bool rtas_indicator_present(int token, int *maxindex);
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -584,6 +584,23 @@ int rtas_get_sensor(int sensor, int inde
 }
 EXPORT_SYMBOL(rtas_get_sensor);
 
+int rtas_get_sensor_fast(int sensor, int index, int *state)
+{
+	int token = rtas_token("get-sensor-state");
+	int rc;
+
+	if (token == RTAS_UNKNOWN_SERVICE)
+		return -ENOENT;
+
+	rc = rtas_call(token, 2, 2, state, sensor, index);
+	WARN_ON(rc == RTAS_BUSY || (rc >= RTAS_EXTENDED_DELAY_MIN &&
+				    rc <= RTAS_EXTENDED_DELAY_MAX));
+
+	if (rc < 0)
+		return rtas_error_rc(rc);
+	return rc;
+}
+
 bool rtas_indicator_present(int token, int *maxindex)
 {
 	int proplen, count, i;
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -189,7 +189,8 @@ static irqreturn_t ras_epow_interrupt(in
 	int state;
 	int critical;
 
-	status = rtas_get_sensor(EPOW_SENSOR_TOKEN, EPOW_SENSOR_INDEX, &state);
+	status = rtas_get_sensor_fast(EPOW_SENSOR_TOKEN, EPOW_SENSOR_INDEX,
+				      &state);
 
 	if (state > 3)
 		critical = 1;		/* Time Critical */



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

* [PATCH 4.2 053/134] powerpc: Uncomment and make enable_kernel_vsx() routine available
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (51 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 052/134] powerpc/rtas: Introduce rtas_get_sensor_fast() for IRQ handlers Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 054/134] crypto: vmx - Adding enable_kernel_vsx() to access VSX instructions Greg Kroah-Hartman
                   ` (80 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Leonidas S. Barbosa, Herbert Xu,
	Michael Ellerman

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

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

From: Leonidas Da Silva Barbosa <leosilva@linux.vnet.ibm.com>

commit 72cd7b44bc99376b3f3c93cedcd052663fcdf705 upstream.

enable_kernel_vsx() function was commented since anything was using
it. However, vmx-crypto driver uses VSX instructions which are
only available if VSX is enable. Otherwise it rises an exception oops.

This patch uncomment enable_kernel_vsx() routine and makes it available.

Signed-off-by: Leonidas S. Barbosa <leosilva@linux.vnet.ibm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/include/asm/switch_to.h |    1 +
 arch/powerpc/kernel/process.c        |    3 ---
 2 files changed, 1 insertion(+), 3 deletions(-)

--- a/arch/powerpc/include/asm/switch_to.h
+++ b/arch/powerpc/include/asm/switch_to.h
@@ -29,6 +29,7 @@ static inline void save_early_sprs(struc
 
 extern void enable_kernel_fp(void);
 extern void enable_kernel_altivec(void);
+extern void enable_kernel_vsx(void);
 extern int emulate_altivec(struct pt_regs *);
 extern void __giveup_vsx(struct task_struct *);
 extern void giveup_vsx(struct task_struct *);
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -204,8 +204,6 @@ EXPORT_SYMBOL_GPL(flush_altivec_to_threa
 #endif /* CONFIG_ALTIVEC */
 
 #ifdef CONFIG_VSX
-#if 0
-/* not currently used, but some crazy RAID module might want to later */
 void enable_kernel_vsx(void)
 {
 	WARN_ON(preemptible());
@@ -220,7 +218,6 @@ void enable_kernel_vsx(void)
 #endif /* CONFIG_SMP */
 }
 EXPORT_SYMBOL(enable_kernel_vsx);
-#endif
 
 void giveup_vsx(struct task_struct *tsk)
 {



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

* [PATCH 4.2 054/134] crypto: vmx - Adding enable_kernel_vsx() to access VSX instructions
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (52 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 053/134] powerpc: Uncomment and make enable_kernel_vsx() routine available Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 055/134] powerpc/powernv/pci-ioda: fix 32-bit TCE table init in kdump kernel Greg Kroah-Hartman
                   ` (79 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Leonidas S. Barbosa, Herbert Xu,
	Michael Ellerman

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

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

From: Leonidas Da Silva Barbosa <leosilva@linux.vnet.ibm.com>

commit 2d6f0600b2cd755959527230ef5a6fba97bb762a upstream.

vmx-crypto driver make use of some VSX instructions which are
only available if VSX is enabled. Running in cases where VSX
are not enabled vmx-crypto fails in a VSX exception.

In order to fix this enable_kernel_vsx() was added to turn on
VSX instructions for vmx-crypto.

Signed-off-by: Leonidas S. Barbosa <leosilva@linux.vnet.ibm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/crypto/vmx/aes.c     |    3 +++
 drivers/crypto/vmx/aes_cbc.c |    3 +++
 drivers/crypto/vmx/aes_ctr.c |    3 +++
 drivers/crypto/vmx/ghash.c   |    4 ++++
 4 files changed, 13 insertions(+)

--- a/drivers/crypto/vmx/aes.c
+++ b/drivers/crypto/vmx/aes.c
@@ -84,6 +84,7 @@ static int p8_aes_setkey(struct crypto_t
 	preempt_disable();
 	pagefault_disable();
 	enable_kernel_altivec();
+	enable_kernel_vsx();
 	ret = aes_p8_set_encrypt_key(key, keylen * 8, &ctx->enc_key);
 	ret += aes_p8_set_decrypt_key(key, keylen * 8, &ctx->dec_key);
 	pagefault_enable();
@@ -103,6 +104,7 @@ static void p8_aes_encrypt(struct crypto
 		preempt_disable();
 		pagefault_disable();
 		enable_kernel_altivec();
+		enable_kernel_vsx();
 		aes_p8_encrypt(src, dst, &ctx->enc_key);
 		pagefault_enable();
 		preempt_enable();
@@ -119,6 +121,7 @@ static void p8_aes_decrypt(struct crypto
 		preempt_disable();
 		pagefault_disable();
 		enable_kernel_altivec();
+		enable_kernel_vsx();
 		aes_p8_decrypt(src, dst, &ctx->dec_key);
 		pagefault_enable();
 		preempt_enable();
--- a/drivers/crypto/vmx/aes_cbc.c
+++ b/drivers/crypto/vmx/aes_cbc.c
@@ -85,6 +85,7 @@ static int p8_aes_cbc_setkey(struct cryp
 	preempt_disable();
 	pagefault_disable();
 	enable_kernel_altivec();
+	enable_kernel_vsx();
 	ret = aes_p8_set_encrypt_key(key, keylen * 8, &ctx->enc_key);
 	ret += aes_p8_set_decrypt_key(key, keylen * 8, &ctx->dec_key);
 	pagefault_enable();
@@ -115,6 +116,7 @@ static int p8_aes_cbc_encrypt(struct blk
 		preempt_disable();
 		pagefault_disable();
 		enable_kernel_altivec();
+		enable_kernel_vsx();
 
 		blkcipher_walk_init(&walk, dst, src, nbytes);
 		ret = blkcipher_walk_virt(desc, &walk);
@@ -155,6 +157,7 @@ static int p8_aes_cbc_decrypt(struct blk
 		preempt_disable();
 		pagefault_disable();
 		enable_kernel_altivec();
+		enable_kernel_vsx();
 
 		blkcipher_walk_init(&walk, dst, src, nbytes);
 		ret = blkcipher_walk_virt(desc, &walk);
--- a/drivers/crypto/vmx/aes_ctr.c
+++ b/drivers/crypto/vmx/aes_ctr.c
@@ -82,6 +82,7 @@ static int p8_aes_ctr_setkey(struct cryp
 
 	pagefault_disable();
 	enable_kernel_altivec();
+	enable_kernel_vsx();
 	ret = aes_p8_set_encrypt_key(key, keylen * 8, &ctx->enc_key);
 	pagefault_enable();
 
@@ -100,6 +101,7 @@ static void p8_aes_ctr_final(struct p8_a
 
 	pagefault_disable();
 	enable_kernel_altivec();
+	enable_kernel_vsx();
 	aes_p8_encrypt(ctrblk, keystream, &ctx->enc_key);
 	pagefault_enable();
 
@@ -132,6 +134,7 @@ static int p8_aes_ctr_crypt(struct blkci
 		while ((nbytes = walk.nbytes) >= AES_BLOCK_SIZE) {
 			pagefault_disable();
 			enable_kernel_altivec();
+			enable_kernel_vsx();
 			aes_p8_ctr32_encrypt_blocks(walk.src.virt.addr,
 						    walk.dst.virt.addr,
 						    (nbytes &
--- a/drivers/crypto/vmx/ghash.c
+++ b/drivers/crypto/vmx/ghash.c
@@ -119,6 +119,7 @@ static int p8_ghash_setkey(struct crypto
 	preempt_disable();
 	pagefault_disable();
 	enable_kernel_altivec();
+	enable_kernel_vsx();
 	enable_kernel_fp();
 	gcm_init_p8(ctx->htable, (const u64 *) key);
 	pagefault_enable();
@@ -149,6 +150,7 @@ static int p8_ghash_update(struct shash_
 			preempt_disable();
 			pagefault_disable();
 			enable_kernel_altivec();
+			enable_kernel_vsx();
 			enable_kernel_fp();
 			gcm_ghash_p8(dctx->shash, ctx->htable,
 				     dctx->buffer, GHASH_DIGEST_SIZE);
@@ -163,6 +165,7 @@ static int p8_ghash_update(struct shash_
 			preempt_disable();
 			pagefault_disable();
 			enable_kernel_altivec();
+			enable_kernel_vsx();
 			enable_kernel_fp();
 			gcm_ghash_p8(dctx->shash, ctx->htable, src, len);
 			pagefault_enable();
@@ -193,6 +196,7 @@ static int p8_ghash_final(struct shash_d
 			preempt_disable();
 			pagefault_disable();
 			enable_kernel_altivec();
+			enable_kernel_vsx();
 			enable_kernel_fp();
 			gcm_ghash_p8(dctx->shash, ctx->htable,
 				     dctx->buffer, GHASH_DIGEST_SIZE);



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

* [PATCH 4.2 055/134] powerpc/powernv/pci-ioda: fix 32-bit TCE table init in kdump kernel
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (53 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 054/134] crypto: vmx - Adding enable_kernel_vsx() to access VSX instructions Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 056/134] powerpc/powernv/pci-ioda: fix kdump with non-power-of-2 crashkernel= Greg Kroah-Hartman
                   ` (78 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Nishanth Aravamudan,
	Alexey Kardashevskiy, Michael Ellerman

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

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

From: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>

commit bb0054552d080dd929907c5925d4bedc8bf6def7 upstream.

When attempting to kdump with the 4.2 kernel, we see for each PCI
device:

 pci 0003:01     : [PE# 000] Assign DMA32 space
 pci 0003:01     : [PE# 000] Setting up 32-bit TCE table at 0..80000000
 pci 0003:01     : [PE# 000] Failed to create 32-bit TCE table, err -22
 PCI: Domain 0004 has 8 available 32-bit DMA segments
 PCI: 4 PE# for a total weight of 70
 pci 0004:01     : [PE# 002] Assign DMA32 space
 pci 0004:01     : [PE# 002] Setting up 32-bit TCE table at 0..80000000
 pci 0004:01     : [PE# 002] Failed to create 32-bit TCE table, err -22
 pci 0004:0d     : [PE# 005] Assign DMA32 space
 pci 0004:0d     : [PE# 005] Setting up 32-bit TCE table at 0..80000000
 pci 0004:0d     : [PE# 005] Failed to create 32-bit TCE table, err -22
 pci 0004:0e     : [PE# 006] Assign DMA32 space
 pci 0004:0e     : [PE# 006] Setting up 32-bit TCE table at 0..80000000
 pci 0004:0e     : [PE# 006] Failed to create 32-bit TCE table, err -22
 pci 0004:10     : [PE# 008] Assign DMA32 space
 pci 0004:10     : [PE# 008] Setting up 32-bit TCE table at 0..80000000
 pci 0004:10     : [PE# 008] Failed to create 32-bit TCE table, err -22

and eventually the kdump kernel fails to boot as none of the PCI devices
(including the disk controller) are successfully initialized.

The EINVAL response is because the DMA window (the 2GB base window) is
larger than the kdump kernel's reserved memory (crashkernel=, in this
case specified to be 1024M). The check in question,

 if ((window_size > memory_hotplug_max()) || !is_power_of_2(window_size))

is a valid sanity check for pnv_pci_ioda2_table_alloc_pages(), so adjust
the caller to pass in a smaller window size if our maximum memory value
is smaller than the DMA window.

After this change, the PCI devices successfully set up the 32-bit TCE
table and kdump succeeds.

The problem was seen on a Firestone machine originally.

Fixes: aca6913f5551 ("powerpc/powernv/ioda2: Introduce helpers to allocate TCE pages")
Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
[mpe: Coding style pedantry, use u64, change the indentation]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/platforms/powernv/pci-ioda.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -2078,9 +2078,17 @@ static long pnv_pci_ioda2_setup_default_
 	struct iommu_table *tbl = NULL;
 	long rc;
 
+	/*
+	 * In memory constrained environments, e.g. kdump kernel, the
+	 * DMA window can be larger than available memory, which will
+	 * cause errors later.
+	 */
+	const u64 window_size = min((u64)pe->table_group.tce32_size,
+				     memory_hotplug_max());
+
 	rc = pnv_pci_ioda2_create_table(&pe->table_group, 0,
 			IOMMU_PAGE_SHIFT_4K,
-			pe->table_group.tce32_size,
+			window_size,
 			POWERNV_IOMMU_DEFAULT_LEVELS, &tbl);
 	if (rc) {
 		pe_err(pe, "Failed to create 32-bit TCE table, err %ld",



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

* [PATCH 4.2 056/134] powerpc/powernv/pci-ioda: fix kdump with non-power-of-2 crashkernel=
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (54 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 055/134] powerpc/powernv/pci-ioda: fix 32-bit TCE table init in kdump kernel Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 057/134] powerpc/pseries: Release DRC when configure_connector fails Greg Kroah-Hartman
                   ` (77 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Nishanth Aravamudan, Jan Stancek,
	Michael Ellerman

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

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

From: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>

commit fa14486979b3a47307bcdb10f8b5baa875a5cf68 upstream.

The 32-bit TCE table initialization relies on the DMA window having a
size equal to a power of 2 (and checks for it explicitly). But
crashkernel= has no constraint that requires a power-of-2 be specified.
This causes the kdump kernel to fail to boot as none of the PCI devices
(including the disk controller) are successfully initialized.

After this change, the PCI devices successfully set up the 32-bit TCE
table and kdump succeeds.

Fixes: aca6913f5551 ("powerpc/powernv/ioda2: Introduce helpers to allocate TCE pages")
Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Tested-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/platforms/powernv/pci-ioda.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -2079,12 +2079,18 @@ static long pnv_pci_ioda2_setup_default_
 	long rc;
 
 	/*
+	 * crashkernel= specifies the kdump kernel's maximum memory at
+	 * some offset and there is no guaranteed the result is a power
+	 * of 2, which will cause errors later.
+	 */
+	const u64 max_memory = __rounddown_pow_of_two(memory_hotplug_max());
+
+	/*
 	 * In memory constrained environments, e.g. kdump kernel, the
 	 * DMA window can be larger than available memory, which will
 	 * cause errors later.
 	 */
-	const u64 window_size = min((u64)pe->table_group.tce32_size,
-				     memory_hotplug_max());
+	const u64 window_size = min((u64)pe->table_group.tce32_size, max_memory);
 
 	rc = pnv_pci_ioda2_create_table(&pe->table_group, 0,
 			IOMMU_PAGE_SHIFT_4K,



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

* [PATCH 4.2 057/134] powerpc/pseries: Release DRC when configure_connector fails
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (55 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 056/134] powerpc/powernv/pci-ioda: fix kdump with non-power-of-2 crashkernel= Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 058/134] powerpc/boot: Specify ABI v2 when building an LE boot wrapper Greg Kroah-Hartman
                   ` (76 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Bharata B Rao, Nathan Fontenot,
	Michael Ellerman

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

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

From: Bharata B Rao <bharata@linux.vnet.ibm.com>

commit daebaabb5cfbe4a6f09ca0e0f8b7673efc704960 upstream.

Commit f32393c943e2 ("powerpc/pseries: Correct cpu affinity for
dlpar added cpus") moved dlpar_acquire_drc() call to before
dlpar_configure_connector() call in dlpar_cpu_probe(), but missed
to release the DRC if dlpar_configure_connector() failed.
During CPU hotplug, if configure-connector fails for any reason,
then this will result in subsequent CPU hotplug attempts to fail.

Release the acquired DRC if dlpar_configure_connector() call fails
so that the DRC is left in right isolation and allocation state
for the subsequent hotplug operation to succeed.

Fixes: f32393c943e2 ("powerpc/pseries: Correct cpu affinity for dlpar added cpus")
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Reviewed-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/platforms/pseries/dlpar.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -422,8 +422,10 @@ static ssize_t dlpar_cpu_probe(const cha
 
 	dn = dlpar_configure_connector(cpu_to_be32(drc_index), parent);
 	of_node_put(parent);
-	if (!dn)
+	if (!dn) {
+		dlpar_release_drc(drc_index);
 		return -EINVAL;
+	}
 
 	rc = dlpar_attach_node(dn);
 	if (rc) {



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

* [PATCH 4.2 058/134] powerpc/boot: Specify ABI v2 when building an LE boot wrapper
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (56 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 057/134] powerpc/pseries: Release DRC when configure_connector fails Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 059/134] powerpc/mm: Recompute hash value after a failed update Greg Kroah-Hartman
                   ` (75 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Benjamin Herrenschmidt, Michael Ellerman

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

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

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

commit 655471f54c2e395ba29ae4156ba0f49928177cc1 upstream.

The kernel does it, not the boot wrapper, which breaks with some
cross compilers that still default to ABI v1.

Fixes: 147c05168fc8 ("powerpc/boot: Add support for 64bit little endian wrapper")
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/boot/Makefile |    3 +++
 1 file changed, 3 insertions(+)

--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -28,6 +28,9 @@ BOOTCFLAGS	+= -m64
 endif
 ifdef CONFIG_CPU_BIG_ENDIAN
 BOOTCFLAGS	+= -mbig-endian
+else
+BOOTCFLAGS	+= -mlittle-endian
+BOOTCFLAGS	+= $(call cc-option,-mabi=elfv2)
 endif
 
 BOOTAFLAGS	:= -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc



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

* [PATCH 4.2 059/134] powerpc/mm: Recompute hash value after a failed update
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (57 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 058/134] powerpc/boot: Specify ABI v2 when building an LE boot wrapper Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 060/134] CIFS: fix type confusion in copy offload ioctl Greg Kroah-Hartman
                   ` (74 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Aneesh Kumar K.V, Paul Mackerras,
	Michael Ellerman

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

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

From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>

commit 36b35d5d807b7e57aff7d08e63de8b17731ee211 upstream.

If we had secondary hash flag set, we ended up modifying hash value in
the updatepp code path. Hence with a failed updatepp we will be using
a wrong hash value for the following hash insert. Fix this by
recomputing hash before insert.

Without this patch we can end up with using wrong slot number in linux
pte. That can result in us missing an hash pte update or invalidate
which can cause memory corruption or even machine check.

Fixes: 6d492ecc6489 ("powerpc/THP: Add code to handle HPTE faults for hugepages")
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Reviewed-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/mm/hugepage-hash64.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/arch/powerpc/mm/hugepage-hash64.c
+++ b/arch/powerpc/mm/hugepage-hash64.c
@@ -85,7 +85,6 @@ int __hash_page_thp(unsigned long ea, un
 	BUG_ON(index >= 4096);
 
 	vpn = hpt_vpn(ea, vsid, ssize);
-	hash = hpt_hash(vpn, shift, ssize);
 	hpte_slot_array = get_hpte_slot_array(pmdp);
 	if (psize == MMU_PAGE_4K) {
 		/*
@@ -101,6 +100,7 @@ int __hash_page_thp(unsigned long ea, un
 	valid = hpte_valid(hpte_slot_array, index);
 	if (valid) {
 		/* update the hpte bits */
+		hash = hpt_hash(vpn, shift, ssize);
 		hidx =  hpte_hash_index(hpte_slot_array, index);
 		if (hidx & _PTEIDX_SECONDARY)
 			hash = ~hash;
@@ -126,6 +126,7 @@ int __hash_page_thp(unsigned long ea, un
 	if (!valid) {
 		unsigned long hpte_group;
 
+		hash = hpt_hash(vpn, shift, ssize);
 		/* insert new entry */
 		pa = pmd_pfn(__pmd(old_pmd)) << PAGE_SHIFT;
 		new_pmd |= _PAGE_HASHPTE;



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

* [PATCH 4.2 060/134] CIFS: fix type confusion in copy offload ioctl
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (58 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 059/134] powerpc/mm: Recompute hash value after a failed update Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 061/134] Add radeon suspend/resume quirk for HP Compaq dc5750 Greg Kroah-Hartman
                   ` (73 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Jann Horn, Steve French

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

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

From: Jann Horn <jann@thejh.net>

commit 4c17a6d56bb0cad3066a714e94f7185a24b40f49 upstream.

This might lead to local privilege escalation (code execution as
kernel) for systems where the following conditions are met:

 - CONFIG_CIFS_SMB2 and CONFIG_CIFS_POSIX are enabled
 - a cifs filesystem is mounted where:
  - the mount option "vers" was used and set to a value >=2.0
  - the attacker has write access to at least one file on the filesystem

To attack this, an attacker would have to guess the target_tcon
pointer (but guessing wrong doesn't cause a crash, it just returns an
error code) and win a narrow race.

Signed-off-by: Jann Horn <jann@thejh.net>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

--- a/fs/cifs/ioctl.c
+++ b/fs/cifs/ioctl.c
@@ -70,6 +70,12 @@ static long cifs_ioctl_clone(unsigned in
 		goto out_drop_write;
 	}
 
+	if (src_file.file->f_op->unlocked_ioctl != cifs_ioctl) {
+		rc = -EBADF;
+		cifs_dbg(VFS, "src file seems to be from a different filesystem type\n");
+		goto out_fput;
+	}
+
 	if ((!src_file.file->private_data) || (!dst_file->private_data)) {
 		rc = -EBADF;
 		cifs_dbg(VFS, "missing cifsFileInfo on copy range src file\n");



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

* [PATCH 4.2 061/134] Add radeon suspend/resume quirk for HP Compaq dc5750.
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (59 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 060/134] CIFS: fix type confusion in copy offload ioctl Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 062/134] mm: check if section present during memory block registering Greg Kroah-Hartman
                   ` (72 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Jeffery Miller, Alex Deucher

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

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

From: Jeffery Miller <jmiller@neverware.com>

commit 09bfda10e6efd7b65bcc29237bee1765ed779657 upstream.

With the radeon driver loaded the HP Compaq dc5750
Small Form Factor machine fails to resume from suspend.
Adding a quirk similar to other devices avoids
the problem and the system resumes properly.

Signed-off-by: Jeffery Miller <jmiller@neverware.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/gpu/drm/radeon/radeon_combios.c |    8 ++++++++
 1 file changed, 8 insertions(+)

--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -3387,6 +3387,14 @@ void radeon_combios_asic_init(struct drm
 	    rdev->pdev->subsystem_device == 0x30ae)
 		return;
 
+	/* quirk for rs4xx HP Compaq dc5750 Small Form Factor to make it resume
+	 * - it hangs on resume inside the dynclk 1 table.
+	 */
+	if (rdev->family == CHIP_RS480 &&
+	    rdev->pdev->subsystem_vendor == 0x103c &&
+	    rdev->pdev->subsystem_device == 0x280a)
+		return;
+
 	/* DYN CLK 1 */
 	table = combios_get_table_offset(dev, COMBIOS_DYN_CLK_1_TABLE);
 	if (table)



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

* [PATCH 4.2 062/134] mm: check if section present during memory block registering
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (60 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 061/134] Add radeon suspend/resume quirk for HP Compaq dc5750 Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 063/134] x86/mm: Initialize pmd_idx in page_table_range_init_count() Greg Kroah-Hartman
                   ` (71 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Yinghai Lu, David Rientjes,
	Tony Luck, Greg KH, Ingo Molnar, Andrew Morton, Linus Torvalds

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

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

From: Yinghai Lu <yinghai@kernel.org>

commit 04697858d89e4bf2650364f8d6956e2554e8ef88 upstream.

Tony Luck found on his setup, if memory block size 512M will cause crash
during booting.

  BUG: unable to handle kernel paging request at ffffea0074000020
  IP: get_nid_for_pfn+0x17/0x40
  PGD 128ffcb067 PUD 128ffc9067 PMD 0
  Oops: 0000 [#1] SMP
  Modules linked in:
  CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.2.0-rc8 #1
  ...
  Call Trace:
     ? register_mem_sect_under_node+0x66/0xe0
     register_one_node+0x17b/0x240
     ? pci_iommu_alloc+0x6e/0x6e
     topology_init+0x3c/0x95
     do_one_initcall+0xcd/0x1f0

The system has non continuous RAM address:
 BIOS-e820: [mem 0x0000001300000000-0x0000001cffffffff] usable
 BIOS-e820: [mem 0x0000001d70000000-0x0000001ec7ffefff] usable
 BIOS-e820: [mem 0x0000001f00000000-0x0000002bffffffff] usable
 BIOS-e820: [mem 0x0000002c18000000-0x0000002d6fffefff] usable
 BIOS-e820: [mem 0x0000002e00000000-0x00000039ffffffff] usable

So there are start sections in memory block not present.  For example:

    memory block : [0x2c18000000, 0x2c20000000) 512M

first three sections are not present.

The current register_mem_sect_under_node() assume first section is
present, but memory block section number range [start_section_nr,
end_section_nr] would include not present section.

For arch that support vmemmap, we don't setup memmap for struct page
area within not present sections area.

So skip the pfn range that belong to absent section.

[akpm@linux-foundation.org: simplification]
[rientjes@google.com: more simplification]
Fixes: bdee237c0343 ("x86: mm: Use 2GB memory block size on large memory x86-64 systems")
Fixes: 982792c782ef ("x86, mm: probe memory block size for generic x86 64bit")
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: David Rientjes <rientjes@google.com>
Reported-by: Tony Luck <tony.luck@intel.com>
Tested-by: Tony Luck <tony.luck@intel.com>
Cc: Greg KH <greg@kroah.com>
Cc: Ingo Molnar <mingo@elte.hu>
Tested-by: David Rientjes <rientjes@google.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>

---
 drivers/base/node.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -392,6 +392,16 @@ int register_mem_sect_under_node(struct
 	for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) {
 		int page_nid;
 
+		/*
+		 * memory block could have several absent sections from start.
+		 * skip pfn range from absent section
+		 */
+		if (!pfn_present(pfn)) {
+			pfn = round_down(pfn + PAGES_PER_SECTION,
+					 PAGES_PER_SECTION) - 1;
+			continue;
+		}
+
 		page_nid = get_nid_for_pfn(pfn);
 		if (page_nid < 0)
 			continue;



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

* [PATCH 4.2 063/134] x86/mm: Initialize pmd_idx in page_table_range_init_count()
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (61 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 062/134] mm: check if section present during memory block registering Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 066/134] cxl: Dont remove AFUs/vPHBs in cxl_reset Greg Kroah-Hartman
                   ` (70 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Minfei Huang, tony.luck, wangnan0,
	david.vrabel, yinghai, Thomas Gleixner

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

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

From: Minfei Huang <mnfhuang@gmail.com>

commit 9962eea9e55f797f05f20ba6448929cab2a9f018 upstream.

The variable pmd_idx is not initialized for the first iteration of the
for loop.

Assign the proper value which indexes the start address.

Fixes: 719272c45b82 'x86, mm: only call early_ioremap_page_table_range_init() once'
Signed-off-by: Minfei Huang <mnfhuang@gmail.com>
Cc: tony.luck@intel.com
Cc: wangnan0@huawei.com
Cc: david.vrabel@citrix.com
Reviewed-by: yinghai@kernel.org
Link: http://lkml.kernel.org/r/1436703522-29552-1-git-send-email-mhuang@redhat.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/mm/init_32.c |    1 +
 1 file changed, 1 insertion(+)

--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -137,6 +137,7 @@ page_table_range_init_count(unsigned lon
 
 	vaddr = start;
 	pgd_idx = pgd_index(vaddr);
+	pmd_idx = pmd_index(vaddr);
 
 	for ( ; (pgd_idx < PTRS_PER_PGD) && (vaddr != end); pgd_idx++) {
 		for (; (pmd_idx < PTRS_PER_PMD) && (vaddr != end);



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

* [PATCH 4.2 066/134] cxl: Dont remove AFUs/vPHBs in cxl_reset
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (62 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 063/134] x86/mm: Initialize pmd_idx in page_table_range_init_count() Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 068/134] [media] v4l: omap3isp: Fix sub-device power management code Greg Kroah-Hartman
                   ` (69 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Cyril Bur, Daniel Axtens, Michael Ellerman

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

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

From: Daniel Axtens <dja@axtens.net>

commit 4e1efb403c1c016ae831bd9988a7d2e5e0af41a0 upstream.

If the driver doesn't participate in EEH, the AFUs will be removed
by cxl_remove, which will be invoked by EEH.

If the driver does particpate in EEH, the vPHB needs to stick around
so that the it can particpate.

In both cases, we shouldn't remove the AFU/vPHB.

Reviewed-by: Cyril Bur <cyrilbur@gmail.com>
Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/misc/cxl/pci.c |    5 -----
 1 file changed, 5 deletions(-)

--- a/drivers/misc/cxl/pci.c
+++ b/drivers/misc/cxl/pci.c
@@ -854,11 +854,6 @@ int cxl_reset(struct cxl *adapter)
 
 	dev_info(&dev->dev, "CXL reset\n");
 
-	for (i = 0; i < adapter->slices; i++) {
-		cxl_pci_vphb_remove(adapter->afu[i]);
-		cxl_remove_afu(adapter->afu[i]);
-	}
-
 	/* pcie_warm_reset requests a fundamental pci reset which includes a
 	 * PERST assert/deassert.  PERST triggers a loading of the image
 	 * if "user" or "factory" is selected in sysfs */



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

* [PATCH 4.2 068/134] [media] v4l: omap3isp: Fix sub-device power management code
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (63 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 066/134] cxl: Dont remove AFUs/vPHBs in cxl_reset Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 069/134] [media] media: am437x-vpfe: Requested frame size and fmt overwritten by current sensor setting Greg Kroah-Hartman
                   ` (68 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Sakari Ailus, Laurent Pinchart,
	Mauro Carvalho Chehab

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

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

From: Sakari Ailus <sakari.ailus@iki.fi>

commit 9d39f05490115bf145e5ea03c0b7ec9d3d015b01 upstream.

Commit 813f5c0ac5cc ("media: Change media device link_notify behaviour")
modified the media controller link setup notification API and updated the
OMAP3 ISP driver accordingly. As a side effect it introduced a bug by
turning power on after setting the link instead of before. This results in
sub-devices not being powered down in some cases when they should be. Fix
it.

Fixes: 813f5c0ac5cc [media] media: Change media device link_notify behaviour

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/media/platform/omap3isp/isp.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -829,14 +829,14 @@ static int isp_pipeline_link_notify(stru
 	int ret;
 
 	if (notification == MEDIA_DEV_NOTIFY_POST_LINK_CH &&
-	    !(link->flags & MEDIA_LNK_FL_ENABLED)) {
+	    !(flags & MEDIA_LNK_FL_ENABLED)) {
 		/* Powering off entities is assumed to never fail. */
 		isp_pipeline_pm_power(source, -sink_use);
 		isp_pipeline_pm_power(sink, -source_use);
 		return 0;
 	}
 
-	if (notification == MEDIA_DEV_NOTIFY_POST_LINK_CH &&
+	if (notification == MEDIA_DEV_NOTIFY_PRE_LINK_CH &&
 		(flags & MEDIA_LNK_FL_ENABLED)) {
 
 		ret = isp_pipeline_pm_power(source, sink_use);



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

* [PATCH 4.2 069/134] [media] media: am437x-vpfe: Requested frame size and fmt overwritten by current sensor setting
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (64 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 068/134] [media] v4l: omap3isp: Fix sub-device power management code Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 070/134] [media] media: am437x-vpfe: Fix a race condition during release Greg Kroah-Hartman
                   ` (67 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Benoit Parrot, Lad, Prabhakar,
	Hans Verkuil, Mauro Carvalho Chehab

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

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

From: Benoit Parrot <bparrot@ti.com>

commit f47c9045643f91e76d8a9030828b9fe1cf4a6bcf upstream.

Upon a S_FMT the input/requested frame size and pixel format is
overwritten by the current sub-device settings.
Fix this so application can actually set the frame size and format.

Fixes: 417d2e507edc ("[media] media: platform: add VPFE capture driver support for AM437X")

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/media/platform/am437x/am437x-vpfe.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/media/platform/am437x/am437x-vpfe.c
+++ b/drivers/media/platform/am437x/am437x-vpfe.c
@@ -1565,7 +1565,7 @@ static int vpfe_s_fmt(struct file *file,
 		return -EBUSY;
 	}
 
-	ret = vpfe_try_fmt(file, priv, fmt);
+	ret = vpfe_try_fmt(file, priv, &format);
 	if (ret)
 		return ret;
 



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

* [PATCH 4.2 070/134] [media] media: am437x-vpfe: Fix a race condition during release
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (65 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 069/134] [media] media: am437x-vpfe: Requested frame size and fmt overwritten by current sensor setting Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 071/134] [media] v4l: xilinx: missing error code Greg Kroah-Hartman
                   ` (66 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Benoit Parrot, Hans Verkuil,
	Mauro Carvalho Chehab

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

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

From: Benoit Parrot <bparrot@ti.com>

commit c99235fa3ef833c3c23926085f2bb68851c8460a upstream.

There was a race condition where during cleanup/release operation
on-going streaming would cause a kernel panic because the hardware
module was disabled prematurely with IRQ still pending.

Fixes: 417d2e507edc ("[media] media: platform: add VPFE capture driver support for AM437X")

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/media/platform/am437x/am437x-vpfe.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

--- a/drivers/media/platform/am437x/am437x-vpfe.c
+++ b/drivers/media/platform/am437x/am437x-vpfe.c
@@ -1186,14 +1186,24 @@ static int vpfe_initialize_device(struct
 static int vpfe_release(struct file *file)
 {
 	struct vpfe_device *vpfe = video_drvdata(file);
+	bool fh_singular;
 	int ret;
 
 	mutex_lock(&vpfe->lock);
 
-	if (v4l2_fh_is_singular_file(file))
-		vpfe_ccdc_close(&vpfe->ccdc, vpfe->pdev);
+	/* Save the singular status before we call the clean-up helper */
+	fh_singular = v4l2_fh_is_singular_file(file);
+
+	/* the release helper will cleanup any on-going streaming */
 	ret = _vb2_fop_release(file, NULL);
 
+	/*
+	 * If this was the last open file.
+	 * Then de-initialize hw module.
+	 */
+	if (fh_singular)
+		vpfe_ccdc_close(&vpfe->ccdc, vpfe->pdev);
+
 	mutex_unlock(&vpfe->lock);
 
 	return ret;



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

* [PATCH 4.2 071/134] [media] v4l: xilinx: missing error code
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (66 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 070/134] [media] media: am437x-vpfe: Fix a race condition during release Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 072/134] [media] v4l: omap3isp: Fix async notifier registration order Greg Kroah-Hartman
                   ` (65 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Hyun Kwon,
	Laurent Pinchart, Mauro Carvalho Chehab

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

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

From: Dan Carpenter <dan.carpenter@oracle.com>

commit e31f8f00bfc081ec1881d92a2dd192aeddf1d9d7 upstream.

We should set "ret" on this error path instead of returning success.

Fixes: df3305156f98 ('[media] v4l: xilinx: Add Xilinx Video IP core')

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/media/platform/xilinx/xilinx-dma.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/media/platform/xilinx/xilinx-dma.c
+++ b/drivers/media/platform/xilinx/xilinx-dma.c
@@ -699,8 +699,10 @@ int xvip_dma_init(struct xvip_composite_
 
 	/* ... and the buffers queue... */
 	dma->alloc_ctx = vb2_dma_contig_init_ctx(dma->xdev->dev);
-	if (IS_ERR(dma->alloc_ctx))
+	if (IS_ERR(dma->alloc_ctx)) {
+		ret = PTR_ERR(dma->alloc_ctx);
 		goto error;
+	}
 
 	/* Don't enable VB2_READ and VB2_WRITE, as using the read() and write()
 	 * V4L2 APIs would be inefficient. Testing on the command line with a



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

* [PATCH 4.2 072/134] [media] v4l: omap3isp: Fix async notifier registration order
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (67 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 071/134] [media] v4l: xilinx: missing error code Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 073/134] Btrfs: check if previous transaction aborted to avoid fs corruption Greg Kroah-Hartman
                   ` (64 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Sakari Ailus, Sebastian Reichel,
	Laurent Pinchart, Mauro Carvalho Chehab

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

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

From: Sakari Ailus <sakari.ailus@iki.fi>

commit 5d479386983c5f1bb1aff4f88a027b6143f88a39 upstream.

The async notifier was registered before the v4l2_device was registered and
before the notifier callbacks were set. This could lead to missing the
bound() and complete() callbacks and to attempting to spin_lock() and
uninitialised spin lock.

Also fix unregistering the async notifier in the case of an error --- the
function may not fail anymore after the notifier is registered.

Fixes: da7f3843d2c7 ("[media] omap3isp: Add support for the Device Tree")

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/media/platform/omap3isp/isp.c |   23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -2000,10 +2000,8 @@ static int isp_register_entities(struct
 	ret = v4l2_device_register_subdev_nodes(&isp->v4l2_dev);
 
 done:
-	if (ret < 0) {
+	if (ret < 0)
 		isp_unregister_entities(isp);
-		v4l2_async_notifier_unregister(&isp->notifier);
-	}
 
 	return ret;
 }
@@ -2423,10 +2421,6 @@ static int isp_probe(struct platform_dev
 		ret = isp_of_parse_nodes(&pdev->dev, &isp->notifier);
 		if (ret < 0)
 			return ret;
-		ret = v4l2_async_notifier_register(&isp->v4l2_dev,
-						   &isp->notifier);
-		if (ret)
-			return ret;
 	} else {
 		isp->pdata = pdev->dev.platform_data;
 		isp->syscon = syscon_regmap_lookup_by_pdevname("syscon.0");
@@ -2557,18 +2551,27 @@ static int isp_probe(struct platform_dev
 	if (ret < 0)
 		goto error_iommu;
 
-	isp->notifier.bound = isp_subdev_notifier_bound;
-	isp->notifier.complete = isp_subdev_notifier_complete;
-
 	ret = isp_register_entities(isp);
 	if (ret < 0)
 		goto error_modules;
 
+	if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) {
+		isp->notifier.bound = isp_subdev_notifier_bound;
+		isp->notifier.complete = isp_subdev_notifier_complete;
+
+		ret = v4l2_async_notifier_register(&isp->v4l2_dev,
+						   &isp->notifier);
+		if (ret)
+			goto error_register_entities;
+	}
+
 	isp_core_init(isp, 1);
 	omap3isp_put(isp);
 
 	return 0;
 
+error_register_entities:
+	isp_unregister_entities(isp);
 error_modules:
 	isp_cleanup_modules(isp);
 error_iommu:



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

* [PATCH 4.2 073/134] Btrfs: check if previous transaction aborted to avoid fs corruption
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (68 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 072/134] [media] v4l: omap3isp: Fix async notifier registration order Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 074/134] nfsd: Fix an FS_LAYOUT_TYPES/LAYOUT_TYPES encode bug Greg Kroah-Hartman
                   ` (63 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Filipe Manana, Josef Bacik, Liu Bo,
	Chris Mason

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

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

From: Filipe Manana <fdmanana@suse.com>

commit 1f9b8c8fbc9a4d029760b16f477b9d15500e3a34 upstream.

While we are committing a transaction, it's possible the previous one is
still finishing its commit and therefore we wait for it to finish first.
However we were not checking if that previous transaction ended up getting
aborted after we waited for it to commit, so we ended up committing the
current transaction which can lead to fs corruption because the new
superblock can point to trees that have had one or more nodes/leafs that
were never durably persisted.
The following sequence diagram exemplifies how this is possible:

          CPU 0                                                        CPU 1

  transaction N starts

  (...)

  btrfs_commit_transaction(N)

    cur_trans->state = TRANS_STATE_COMMIT_START;
    (...)
    cur_trans->state = TRANS_STATE_COMMIT_DOING;
    (...)

    cur_trans->state = TRANS_STATE_UNBLOCKED;
    root->fs_info->running_transaction = NULL;

                                                              btrfs_start_transaction()
                                                                 --> starts transaction N + 1

    btrfs_write_and_wait_transaction(trans, root);
      --> starts writing all new or COWed ebs created
          at transaction N

                                                              creates some new ebs, COWs some
                                                              existing ebs but doesn't COW or
                                                              deletes eb X

                                                              btrfs_commit_transaction(N + 1)
                                                                (...)
                                                                cur_trans->state = TRANS_STATE_COMMIT_START;
                                                                (...)
                                                                wait_for_commit(root, prev_trans);
                                                                  --> prev_trans == transaction N

    btrfs_write_and_wait_transaction() continues
    writing ebs
       --> fails writing eb X, we abort transaction N
           and set bit BTRFS_FS_STATE_ERROR on
           fs_info->fs_state, so no new transactions
           can start after setting that bit

       cleanup_transaction()
         btrfs_cleanup_one_transaction()
           wakes up task at CPU 1

                                                                continues, doesn't abort because
                                                                cur_trans->aborted (transaction N + 1)
                                                                is zero, and no checks for bit
                                                                BTRFS_FS_STATE_ERROR in fs_info->fs_state
                                                                are made

                                                                btrfs_write_and_wait_transaction(trans, root);
                                                                  --> succeeds, no errors during writeback

                                                                write_ctree_super(trans, root, 0);
                                                                  --> succeeds
                                                                  --> we have now a superblock that points us
                                                                      to some root that uses eb X, which was
                                                                      never written to disk

In this scenario future attempts to read eb X from disk results in an
error message like "parent transid verify failed on X wanted Y found Z".

So fix this by aborting the current transaction if after waiting for the
previous transaction we verify that it was aborted.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/btrfs/transaction.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1893,8 +1893,11 @@ int btrfs_commit_transaction(struct btrf
 			spin_unlock(&root->fs_info->trans_lock);
 
 			wait_for_commit(root, prev_trans);
+			ret = prev_trans->aborted;
 
 			btrfs_put_transaction(prev_trans);
+			if (ret)
+				goto cleanup_transaction;
 		} else {
 			spin_unlock(&root->fs_info->trans_lock);
 		}



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

* [PATCH 4.2 074/134] nfsd: Fix an FS_LAYOUT_TYPES/LAYOUT_TYPES encode bug
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (69 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 073/134] Btrfs: check if previous transaction aborted to avoid fs corruption Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 075/134] nfsd: ensure that the ol stateid hash reference is only put once Greg Kroah-Hartman
                   ` (62 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Kinglong Mee, Christoph Hellwig,
	J. Bruce Fields

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

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

From: Kinglong Mee <kinglongmee@gmail.com>

commit 6896f15aabde505b35888039af93d1d182a0108a upstream.

Currently we'll respond correctly to a request for either
FS_LAYOUT_TYPES or LAYOUT_TYPES, but not to a request for both
attributes simultaneously.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/nfsd/nfs4xdr.c |   45 +++++++++++++++++++++++++++++++--------------
 1 file changed, 31 insertions(+), 14 deletions(-)

--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -2140,6 +2140,27 @@ nfsd4_encode_aclname(struct xdr_stream *
 		return nfsd4_encode_user(xdr, rqstp, ace->who_uid);
 }
 
+static inline __be32
+nfsd4_encode_layout_type(struct xdr_stream *xdr, enum pnfs_layouttype layout_type)
+{
+	__be32 *p;
+
+	if (layout_type) {
+		p = xdr_reserve_space(xdr, 8);
+		if (!p)
+			return nfserr_resource;
+		*p++ = cpu_to_be32(1);
+		*p++ = cpu_to_be32(layout_type);
+	} else {
+		p = xdr_reserve_space(xdr, 4);
+		if (!p)
+			return nfserr_resource;
+		*p++ = cpu_to_be32(0);
+	}
+
+	return 0;
+}
+
 #define WORD0_ABSENT_FS_ATTRS (FATTR4_WORD0_FS_LOCATIONS | FATTR4_WORD0_FSID | \
 			      FATTR4_WORD0_RDATTR_ERROR)
 #define WORD1_ABSENT_FS_ATTRS FATTR4_WORD1_MOUNTED_ON_FILEID
@@ -2688,20 +2709,16 @@ out_acl:
 		p = xdr_encode_hyper(p, stat.ino);
 	}
 #ifdef CONFIG_NFSD_PNFS
-	if ((bmval1 & FATTR4_WORD1_FS_LAYOUT_TYPES) ||
-	    (bmval2 & FATTR4_WORD2_LAYOUT_TYPES)) {
-		if (exp->ex_layout_type) {
-			p = xdr_reserve_space(xdr, 8);
-			if (!p)
-				goto out_resource;
-			*p++ = cpu_to_be32(1);
-			*p++ = cpu_to_be32(exp->ex_layout_type);
-		} else {
-			p = xdr_reserve_space(xdr, 4);
-			if (!p)
-				goto out_resource;
-			*p++ = cpu_to_be32(0);
-		}
+	if (bmval1 & FATTR4_WORD1_FS_LAYOUT_TYPES) {
+		status = nfsd4_encode_layout_type(xdr, exp->ex_layout_type);
+		if (status)
+			goto out;
+	}
+
+	if (bmval2 & FATTR4_WORD2_LAYOUT_TYPES) {
+		status = nfsd4_encode_layout_type(xdr, exp->ex_layout_type);
+		if (status)
+			goto out;
 	}
 
 	if (bmval2 & FATTR4_WORD2_LAYOUT_BLKSIZE) {



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

* [PATCH 4.2 075/134] nfsd: ensure that the ol stateid hash reference is only put once
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (70 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 074/134] nfsd: Fix an FS_LAYOUT_TYPES/LAYOUT_TYPES encode bug Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 076/134] nfsd: ensure that delegation stateid hash references are " Greg Kroah-Hartman
                   ` (61 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Andrew W Elble, Anna Schumaker,
	Jeff Layton, J. Bruce Fields

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

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

From: Jeff Layton <jlayton@poochiereds.net>

commit e85687393f3ee0a77ccca016f903d1558bb69258 upstream.

When an open or lock stateid is hashed, we take an extra reference to
it. When we unhash it, we drop that reference. The code however does
not properly account for the case where we have two callers concurrently
trying to unhash the stateid. This can lead to list corruption and the
hash reference being put more than once.

Fix this by having unhash_ol_stateid use list_del_init on the st_perfile
list_head, and then testing to see if that list_head is empty before
releasing the hash reference. This means that some of the unhashing
wrappers now become bool return functions so we can test to see whether
the stateid was unhashed before we put the reference.

Reported-by: Andrew W Elble <aweits@rit.edu>
Tested-by: Andrew W Elble <aweits@rit.edu>
Reported-by: Anna Schumaker <Anna.Schumaker@netapp.com>
Tested-by: Anna Schumaker <Anna.Schumaker@netapp.com>
Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/nfsd/nfs4state.c |   58 ++++++++++++++++++++++++++++++++--------------------
 1 file changed, 36 insertions(+), 22 deletions(-)

--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1004,16 +1004,20 @@ static void nfs4_put_stateowner(struct n
 	sop->so_ops->so_free(sop);
 }
 
-static void unhash_ol_stateid(struct nfs4_ol_stateid *stp)
+static bool unhash_ol_stateid(struct nfs4_ol_stateid *stp)
 {
 	struct nfs4_file *fp = stp->st_stid.sc_file;
 
 	lockdep_assert_held(&stp->st_stateowner->so_client->cl_lock);
 
+	if (list_empty(&stp->st_perfile))
+		return false;
+
 	spin_lock(&fp->fi_lock);
-	list_del(&stp->st_perfile);
+	list_del_init(&stp->st_perfile);
 	spin_unlock(&fp->fi_lock);
 	list_del(&stp->st_perstateowner);
+	return true;
 }
 
 static void nfs4_free_ol_stateid(struct nfs4_stid *stid)
@@ -1063,25 +1067,27 @@ static void put_ol_stateid_locked(struct
 	list_add(&stp->st_locks, reaplist);
 }
 
-static void unhash_lock_stateid(struct nfs4_ol_stateid *stp)
+static bool unhash_lock_stateid(struct nfs4_ol_stateid *stp)
 {
 	struct nfs4_openowner *oo = openowner(stp->st_openstp->st_stateowner);
 
 	lockdep_assert_held(&oo->oo_owner.so_client->cl_lock);
 
 	list_del_init(&stp->st_locks);
-	unhash_ol_stateid(stp);
 	nfs4_unhash_stid(&stp->st_stid);
+	return unhash_ol_stateid(stp);
 }
 
 static void release_lock_stateid(struct nfs4_ol_stateid *stp)
 {
 	struct nfs4_openowner *oo = openowner(stp->st_openstp->st_stateowner);
+	bool unhashed;
 
 	spin_lock(&oo->oo_owner.so_client->cl_lock);
-	unhash_lock_stateid(stp);
+	unhashed = unhash_lock_stateid(stp);
 	spin_unlock(&oo->oo_owner.so_client->cl_lock);
-	nfs4_put_stid(&stp->st_stid);
+	if (unhashed)
+		nfs4_put_stid(&stp->st_stid);
 }
 
 static void unhash_lockowner_locked(struct nfs4_lockowner *lo)
@@ -1129,7 +1135,7 @@ static void release_lockowner(struct nfs
 	while (!list_empty(&lo->lo_owner.so_stateids)) {
 		stp = list_first_entry(&lo->lo_owner.so_stateids,
 				struct nfs4_ol_stateid, st_perstateowner);
-		unhash_lock_stateid(stp);
+		WARN_ON(!unhash_lock_stateid(stp));
 		put_ol_stateid_locked(stp, &reaplist);
 	}
 	spin_unlock(&clp->cl_lock);
@@ -1142,21 +1148,26 @@ static void release_open_stateid_locks(s
 {
 	struct nfs4_ol_stateid *stp;
 
+	lockdep_assert_held(&open_stp->st_stid.sc_client->cl_lock);
+
 	while (!list_empty(&open_stp->st_locks)) {
 		stp = list_entry(open_stp->st_locks.next,
 				struct nfs4_ol_stateid, st_locks);
-		unhash_lock_stateid(stp);
+		WARN_ON(!unhash_lock_stateid(stp));
 		put_ol_stateid_locked(stp, reaplist);
 	}
 }
 
-static void unhash_open_stateid(struct nfs4_ol_stateid *stp,
+static bool unhash_open_stateid(struct nfs4_ol_stateid *stp,
 				struct list_head *reaplist)
 {
+	bool unhashed;
+
 	lockdep_assert_held(&stp->st_stid.sc_client->cl_lock);
 
-	unhash_ol_stateid(stp);
+	unhashed = unhash_ol_stateid(stp);
 	release_open_stateid_locks(stp, reaplist);
+	return unhashed;
 }
 
 static void release_open_stateid(struct nfs4_ol_stateid *stp)
@@ -1164,8 +1175,8 @@ static void release_open_stateid(struct
 	LIST_HEAD(reaplist);
 
 	spin_lock(&stp->st_stid.sc_client->cl_lock);
-	unhash_open_stateid(stp, &reaplist);
-	put_ol_stateid_locked(stp, &reaplist);
+	if (unhash_open_stateid(stp, &reaplist))
+		put_ol_stateid_locked(stp, &reaplist);
 	spin_unlock(&stp->st_stid.sc_client->cl_lock);
 	free_ol_stateid_reaplist(&reaplist);
 }
@@ -1210,8 +1221,8 @@ static void release_openowner(struct nfs
 	while (!list_empty(&oo->oo_owner.so_stateids)) {
 		stp = list_first_entry(&oo->oo_owner.so_stateids,
 				struct nfs4_ol_stateid, st_perstateowner);
-		unhash_open_stateid(stp, &reaplist);
-		put_ol_stateid_locked(stp, &reaplist);
+		if (unhash_open_stateid(stp, &reaplist))
+			put_ol_stateid_locked(stp, &reaplist);
 	}
 	spin_unlock(&clp->cl_lock);
 	free_ol_stateid_reaplist(&reaplist);
@@ -4751,7 +4762,7 @@ nfsd4_free_stateid(struct svc_rqst *rqst
 		if (check_for_locks(stp->st_stid.sc_file,
 				    lockowner(stp->st_stateowner)))
 			break;
-		unhash_lock_stateid(stp);
+		WARN_ON(!unhash_lock_stateid(stp));
 		spin_unlock(&cl->cl_lock);
 		nfs4_put_stid(s);
 		ret = nfs_ok;
@@ -4967,20 +4978,23 @@ out:
 static void nfsd4_close_open_stateid(struct nfs4_ol_stateid *s)
 {
 	struct nfs4_client *clp = s->st_stid.sc_client;
+	bool unhashed;
 	LIST_HEAD(reaplist);
 
 	s->st_stid.sc_type = NFS4_CLOSED_STID;
 	spin_lock(&clp->cl_lock);
-	unhash_open_stateid(s, &reaplist);
+	unhashed = unhash_open_stateid(s, &reaplist);
 
 	if (clp->cl_minorversion) {
-		put_ol_stateid_locked(s, &reaplist);
+		if (unhashed)
+			put_ol_stateid_locked(s, &reaplist);
 		spin_unlock(&clp->cl_lock);
 		free_ol_stateid_reaplist(&reaplist);
 	} else {
 		spin_unlock(&clp->cl_lock);
 		free_ol_stateid_reaplist(&reaplist);
-		move_to_close_lru(s, clp->net);
+		if (unhashed)
+			move_to_close_lru(s, clp->net);
 	}
 }
 
@@ -6019,7 +6033,7 @@ nfsd_inject_add_lock_to_list(struct nfs4
 
 static u64 nfsd_foreach_client_lock(struct nfs4_client *clp, u64 max,
 				    struct list_head *collect,
-				    void (*func)(struct nfs4_ol_stateid *))
+				    bool (*func)(struct nfs4_ol_stateid *))
 {
 	struct nfs4_openowner *oop;
 	struct nfs4_ol_stateid *stp, *st_next;
@@ -6033,9 +6047,9 @@ static u64 nfsd_foreach_client_lock(stru
 			list_for_each_entry_safe(lst, lst_next,
 					&stp->st_locks, st_locks) {
 				if (func) {
-					func(lst);
-					nfsd_inject_add_lock_to_list(lst,
-								collect);
+					if (func(lst))
+						nfsd_inject_add_lock_to_list(lst,
+									collect);
 				}
 				++count;
 				/*



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

* [PATCH 4.2 076/134] nfsd: ensure that delegation stateid hash references are only put once
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (71 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 075/134] nfsd: ensure that the ol stateid hash reference is only put once Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 077/134] NFSv4.1/pnfs: Fix atomicity of commit list updates Greg Kroah-Hartman
                   ` (60 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Andrew W Elble, Anna Schumaker,
	Jeff Layton, J. Bruce Fields

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

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

From: Jeff Layton <jlayton@poochiereds.net>

commit 3fcbbd244ed1d20dc0eb7d48d729503992fa9b7d upstream.

It's possible that a DELEGRETURN could race with (e.g.) client expiry,
in which case we could end up putting the delegation hash reference more
than once.

Have unhash_delegation_locked return a bool that indicates whether it
was already unhashed. In the case of destroy_delegation we only
conditionally put the hash reference if that returns true.

The other callers of unhash_delegation_locked call it while walking
list_heads that shouldn't yet be detached. If we find that it doesn't
return true in those cases, then throw a WARN_ON as that indicates that
we have a partially hashed delegation, and that something is likely very
wrong.

Tested-by: Andrew W Elble <aweits@rit.edu>
Tested-by: Anna Schumaker <Anna.Schumaker@netapp.com>
Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -777,13 +777,16 @@ hash_delegation_locked(struct nfs4_deleg
 	list_add(&dp->dl_perclnt, &dp->dl_stid.sc_client->cl_delegations);
 }
 
-static void
+static bool
 unhash_delegation_locked(struct nfs4_delegation *dp)
 {
 	struct nfs4_file *fp = dp->dl_stid.sc_file;
 
 	lockdep_assert_held(&state_lock);
 
+	if (list_empty(&dp->dl_perfile))
+		return false;
+
 	dp->dl_stid.sc_type = NFS4_CLOSED_DELEG_STID;
 	/* Ensure that deleg break won't try to requeue it */
 	++dp->dl_time;
@@ -792,16 +795,21 @@ unhash_delegation_locked(struct nfs4_del
 	list_del_init(&dp->dl_recall_lru);
 	list_del_init(&dp->dl_perfile);
 	spin_unlock(&fp->fi_lock);
+	return true;
 }
 
 static void destroy_delegation(struct nfs4_delegation *dp)
 {
+	bool unhashed;
+
 	spin_lock(&state_lock);
-	unhash_delegation_locked(dp);
+	unhashed = unhash_delegation_locked(dp);
 	spin_unlock(&state_lock);
-	put_clnt_odstate(dp->dl_clnt_odstate);
-	nfs4_put_deleg_lease(dp->dl_stid.sc_file);
-	nfs4_put_stid(&dp->dl_stid);
+	if (unhashed) {
+		put_clnt_odstate(dp->dl_clnt_odstate);
+		nfs4_put_deleg_lease(dp->dl_stid.sc_file);
+		nfs4_put_stid(&dp->dl_stid);
+	}
 }
 
 static void revoke_delegation(struct nfs4_delegation *dp)
@@ -1725,7 +1733,7 @@ __destroy_client(struct nfs4_client *clp
 	spin_lock(&state_lock);
 	while (!list_empty(&clp->cl_delegations)) {
 		dp = list_entry(clp->cl_delegations.next, struct nfs4_delegation, dl_perclnt);
-		unhash_delegation_locked(dp);
+		WARN_ON(!unhash_delegation_locked(dp));
 		list_add(&dp->dl_recall_lru, &reaplist);
 	}
 	spin_unlock(&state_lock);
@@ -4356,7 +4364,7 @@ nfs4_laundromat(struct nfsd_net *nn)
 			new_timeo = min(new_timeo, t);
 			break;
 		}
-		unhash_delegation_locked(dp);
+		WARN_ON(!unhash_delegation_locked(dp));
 		list_add(&dp->dl_recall_lru, &reaplist);
 	}
 	spin_unlock(&state_lock);
@@ -6319,7 +6327,7 @@ static u64 nfsd_find_all_delegations(str
 				continue;
 
 			atomic_inc(&clp->cl_refcount);
-			unhash_delegation_locked(dp);
+			WARN_ON(!unhash_delegation_locked(dp));
 			list_add(&dp->dl_recall_lru, victims);
 		}
 		++count;
@@ -6649,7 +6657,7 @@ nfs4_state_shutdown_net(struct net *net)
 	spin_lock(&state_lock);
 	list_for_each_safe(pos, next, &nn->del_recall_lru) {
 		dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru);
-		unhash_delegation_locked(dp);
+		WARN_ON(!unhash_delegation_locked(dp));
 		list_add(&dp->dl_recall_lru, &reaplist);
 	}
 	spin_unlock(&state_lock);



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

* [PATCH 4.2 077/134] NFSv4.1/pnfs: Fix atomicity of commit list updates
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (72 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 076/134] nfsd: ensure that delegation stateid hash references are " Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 078/134] NFSv4: dont set SETATTR for O_RDONLY|O_EXCL Greg Kroah-Hartman
                   ` (59 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Trond Myklebust

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

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

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

commit 86d80f973434de24d8a807a92cd59d5ced7bd519 upstream.

pnfs_layout_mark_request_commit() needs to ensure that it adds the
request to the commit list atomically with all the other updates
in order to prevent corruption to buckets[ds_commit_idx].wlseg
due to races with pnfs_generic_clear_request_commit().

Fixes: 338d00cfef07d ("pnfs: Refactor the *_layout_mark_request_commit...")
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/nfs/internal.h |   15 ++++++++++-----
 fs/nfs/pnfs_nfs.c |    5 +++--
 fs/nfs/write.c    |   29 ++++++++++++++++++++++++-----
 3 files changed, 37 insertions(+), 12 deletions(-)

--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -490,6 +490,9 @@ void nfs_retry_commit(struct list_head *
 void nfs_commitdata_release(struct nfs_commit_data *data);
 void nfs_request_add_commit_list(struct nfs_page *req, struct list_head *dst,
 				 struct nfs_commit_info *cinfo);
+void nfs_request_add_commit_list_locked(struct nfs_page *req,
+		struct list_head *dst,
+		struct nfs_commit_info *cinfo);
 void nfs_request_remove_commit_list(struct nfs_page *req,
 				    struct nfs_commit_info *cinfo);
 void nfs_init_cinfo(struct nfs_commit_info *cinfo,
@@ -623,13 +626,15 @@ void nfs_super_set_maxbytes(struct super
  * Record the page as unstable and mark its inode as dirty.
  */
 static inline
-void nfs_mark_page_unstable(struct page *page)
+void nfs_mark_page_unstable(struct page *page, struct nfs_commit_info *cinfo)
 {
-	struct inode *inode = page_file_mapping(page)->host;
+	if (!cinfo->dreq) {
+		struct inode *inode = page_file_mapping(page)->host;
 
-	inc_zone_page_state(page, NR_UNSTABLE_NFS);
-	inc_wb_stat(&inode_to_bdi(inode)->wb, WB_RECLAIMABLE);
-	 __mark_inode_dirty(inode, I_DIRTY_DATASYNC);
+		inc_zone_page_state(page, NR_UNSTABLE_NFS);
+		inc_wb_stat(&inode_to_bdi(inode)->wb, WB_RECLAIMABLE);
+		__mark_inode_dirty(inode, I_DIRTY_DATASYNC);
+	}
 }
 
 /*
--- a/fs/nfs/pnfs_nfs.c
+++ b/fs/nfs/pnfs_nfs.c
@@ -863,9 +863,10 @@ pnfs_layout_mark_request_commit(struct n
 	}
 	set_bit(PG_COMMIT_TO_DS, &req->wb_flags);
 	cinfo->ds->nwritten++;
-	spin_unlock(cinfo->lock);
 
-	nfs_request_add_commit_list(req, list, cinfo);
+	nfs_request_add_commit_list_locked(req, list, cinfo);
+	spin_unlock(cinfo->lock);
+	nfs_mark_page_unstable(req->wb_page, cinfo);
 }
 EXPORT_SYMBOL_GPL(pnfs_layout_mark_request_commit);
 
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -768,6 +768,28 @@ nfs_page_search_commits_for_head_request
 }
 
 /**
+ * nfs_request_add_commit_list_locked - add request to a commit list
+ * @req: pointer to a struct nfs_page
+ * @dst: commit list head
+ * @cinfo: holds list lock and accounting info
+ *
+ * This sets the PG_CLEAN bit, updates the cinfo count of
+ * number of outstanding requests requiring a commit as well as
+ * the MM page stats.
+ *
+ * The caller must hold the cinfo->lock, and the nfs_page lock.
+ */
+void
+nfs_request_add_commit_list_locked(struct nfs_page *req, struct list_head *dst,
+			    struct nfs_commit_info *cinfo)
+{
+	set_bit(PG_CLEAN, &req->wb_flags);
+	nfs_list_add_request(req, dst);
+	cinfo->mds->ncommit++;
+}
+EXPORT_SYMBOL_GPL(nfs_request_add_commit_list_locked);
+
+/**
  * nfs_request_add_commit_list - add request to a commit list
  * @req: pointer to a struct nfs_page
  * @dst: commit list head
@@ -784,13 +806,10 @@ void
 nfs_request_add_commit_list(struct nfs_page *req, struct list_head *dst,
 			    struct nfs_commit_info *cinfo)
 {
-	set_bit(PG_CLEAN, &(req)->wb_flags);
 	spin_lock(cinfo->lock);
-	nfs_list_add_request(req, dst);
-	cinfo->mds->ncommit++;
+	nfs_request_add_commit_list_locked(req, dst, cinfo);
 	spin_unlock(cinfo->lock);
-	if (!cinfo->dreq)
-		nfs_mark_page_unstable(req->wb_page);
+	nfs_mark_page_unstable(req->wb_page, cinfo);
 }
 EXPORT_SYMBOL_GPL(nfs_request_add_commit_list);
 



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

* [PATCH 4.2 078/134] NFSv4: dont set SETATTR for O_RDONLY|O_EXCL
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (73 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 077/134] NFSv4.1/pnfs: Fix atomicity of commit list updates Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 079/134] NFS: Dont let the ctime override attribute barriers Greg Kroah-Hartman
                   ` (58 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, NeilBrown, Trond Myklebust

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

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

From: NeilBrown <neilb@suse.com>

commit efcbc04e16dfa95fef76309f89710dd1d99a5453 upstream.

It is unusual to combine the open flags O_RDONLY and O_EXCL, but
it appears that libre-office does just that.

[pid  3250] stat("/home/USER/.config", {st_mode=S_IFDIR|0700, st_size=8192, ...}) = 0
[pid  3250] open("/home/USER/.config/libreoffice/4-suse/user/extensions/buildid", O_RDONLY|O_EXCL <unfinished ...>

NFSv4 takes O_EXCL as a sign that a setattr command should be sent,
probably to reset the timestamps.

When it was an O_RDONLY open, the SETATTR command does not
identify any actual attributes to change.
If no delegation was provided to the open, the SETATTR uses the
all-zeros stateid and the request is accepted (at least by the
Linux NFS server - no harm, no foul).

If a read-delegation was provided, this is used in the SETATTR
request, and a Netapp filer will justifiably claim
NFS4ERR_BAD_STATEID, which the Linux client takes as a sign
to retry - indefinitely.

So only treat O_EXCL specially if O_CREAT was also given.

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

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

--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2425,7 +2425,7 @@ static int _nfs4_do_open(struct inode *d
 		goto err_free_label;
 	state = ctx->state;
 
-	if ((opendata->o_arg.open_flags & O_EXCL) &&
+	if ((opendata->o_arg.open_flags & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL) &&
 	    (opendata->o_arg.createmode != NFS4_CREATE_GUARDED)) {
 		nfs4_exclusive_attrset(opendata, sattr);
 



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

* [PATCH 4.2 079/134] NFS: Dont let the ctime override attribute barriers.
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (74 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 078/134] NFSv4: dont set SETATTR for O_RDONLY|O_EXCL Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 080/134] NFSv4.1/pNFS: Fix borken function _same_data_server_addrs_locked() Greg Kroah-Hartman
                   ` (57 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Chuck Lever, Trond Myklebust

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

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

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

commit 7c2dad99d60c86ec686b3bfdcb787c450a7ea89f upstream.

Chuck reports seeing cases where a GETATTR that happens to race
with an asynchronous WRITE is overriding the file size, despite
the attribute barrier being set by the writeback code.

The culprit turns out to be the check in nfs_ctime_need_update(),
which sees that the ctime is newer than the cached ctime, and
assumes that it is safe to override the attribute barrier.
This patch removes that override, and ensures that attribute
barriers are always respected.

Reported-by: Chuck Lever <chuck.lever@oracle.com>
Fixes: a08a8cd375db9 ("NFS: Add attribute update barriers to NFS writebacks")
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/nfs/inode.c |    8 --------
 1 file changed, 8 deletions(-)

--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1273,13 +1273,6 @@ static int nfs_check_inode_attributes(st
 	return 0;
 }
 
-static int nfs_ctime_need_update(const struct inode *inode, const struct nfs_fattr *fattr)
-{
-	if (!(fattr->valid & NFS_ATTR_FATTR_CTIME))
-		return 0;
-	return timespec_compare(&fattr->ctime, &inode->i_ctime) > 0;
-}
-
 static atomic_long_t nfs_attr_generation_counter;
 
 static unsigned long nfs_read_attr_generation_counter(void)
@@ -1428,7 +1421,6 @@ static int nfs_inode_attrs_need_update(c
 	const struct nfs_inode *nfsi = NFS_I(inode);
 
 	return ((long)fattr->gencount - (long)nfsi->attr_gencount) > 0 ||
-		nfs_ctime_need_update(inode, fattr) ||
 		((long)nfsi->attr_gencount - (long)nfs_read_attr_generation_counter() > 0);
 }
 



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

* [PATCH 4.2 080/134] NFSv4.1/pNFS: Fix borken function _same_data_server_addrs_locked()
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (75 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 079/134] NFS: Dont let the ctime override attribute barriers Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 081/134] NFS: Fix a NULL pointer dereference of migration recovery ops for v4.2 client Greg Kroah-Hartman
                   ` (56 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Trond Myklebust

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

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

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

commit 6f536936b79bd4b5cea8fb0e5b8b0bce8cd1ea4a upstream.

- Switch back to using list_for_each_entry(). Fixes an incorrect test
  for list NULL termination.
- Do not assume that lists are sorted.
- Finally, consider an existing entry to match if it consists of a subset
  of the addresses in the new entry.

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

---
 fs/nfs/pnfs_nfs.c |   31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

--- a/fs/nfs/pnfs_nfs.c
+++ b/fs/nfs/pnfs_nfs.c
@@ -359,26 +359,31 @@ same_sockaddr(struct sockaddr *addr1, st
 	return false;
 }
 
+/*
+ * Checks if 'dsaddrs1' contains a subset of 'dsaddrs2'. If it does,
+ * declare a match.
+ */
 static bool
 _same_data_server_addrs_locked(const struct list_head *dsaddrs1,
 			       const struct list_head *dsaddrs2)
 {
 	struct nfs4_pnfs_ds_addr *da1, *da2;
+	struct sockaddr *sa1, *sa2;
+	bool match = false;
 
-	/* step through both lists, comparing as we go */
-	for (da1 = list_first_entry(dsaddrs1, typeof(*da1), da_node),
-	     da2 = list_first_entry(dsaddrs2, typeof(*da2), da_node);
-	     da1 != NULL && da2 != NULL;
-	     da1 = list_entry(da1->da_node.next, typeof(*da1), da_node),
-	     da2 = list_entry(da2->da_node.next, typeof(*da2), da_node)) {
-		if (!same_sockaddr((struct sockaddr *)&da1->da_addr,
-				   (struct sockaddr *)&da2->da_addr))
-			return false;
+	list_for_each_entry(da1, dsaddrs1, da_node) {
+		sa1 = (struct sockaddr *)&da1->da_addr;
+		match = false;
+		list_for_each_entry(da2, dsaddrs2, da_node) {
+			sa2 = (struct sockaddr *)&da2->da_addr;
+			match = same_sockaddr(sa1, sa2);
+			if (match)
+				break;
+		}
+		if (!match)
+			break;
 	}
-	if (da1 == NULL && da2 == NULL)
-		return true;
-
-	return false;
+	return match;
 }
 
 /*



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

* [PATCH 4.2 081/134] NFS: Fix a NULL pointer dereference of migration recovery ops for v4.2 client
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (76 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 080/134] NFSv4.1/pNFS: Fix borken function _same_data_server_addrs_locked() Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 082/134] NFS: nfs_set_pgio_error sometimes misses errors Greg Kroah-Hartman
                   ` (55 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Kinglong Mee, Trond Myklebust

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

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

From: Kinglong Mee <kinglongmee@gmail.com>

commit 18e3b739fdc826481c6a1335ce0c5b19b3d415da upstream.

---Steps to Reproduce--
<nfs-server>
# cat /etc/exports
/nfs/referal  *(rw,insecure,no_subtree_check,no_root_squash,crossmnt)
/nfs/old      *(ro,insecure,subtree_check,root_squash,crossmnt)

<nfs-client>
# mount -t nfs nfs-server:/nfs/ /mnt/
# ll /mnt/*/

<nfs-server>
# cat /etc/exports
/nfs/referal   *(rw,insecure,no_subtree_check,no_root_squash,crossmnt,refer=/nfs/old/@nfs-server)
/nfs/old       *(ro,insecure,subtree_check,root_squash,crossmnt)
# service nfs restart

<nfs-client>
# ll /mnt/*/    --->>>>> oops here

[ 5123.102925] BUG: unable to handle kernel NULL pointer dereference at           (null)
[ 5123.103363] IP: [<ffffffffa03ed38b>] nfs4_proc_get_locations+0x9b/0x120 [nfsv4]
[ 5123.103752] PGD 587b9067 PUD 3cbf5067 PMD 0
[ 5123.104131] Oops: 0000 [#1]
[ 5123.104529] Modules linked in: nfsv4(OE) nfs(OE) fscache(E) nfsd(OE) xfs libcrc32c iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi coretemp crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel ppdev vmw_balloon parport_pc parport i2c_piix4 shpchp auth_rpcgss nfs_acl vmw_vmci lockd grace sunrpc vmwgfx drm_kms_helper ttm drm mptspi serio_raw scsi_transport_spi e1000 mptscsih mptbase ata_generic pata_acpi [last unloaded: nfsd]
[ 5123.105887] CPU: 0 PID: 15853 Comm: ::1-manager Tainted: G           OE   4.2.0-rc6+ #214
[ 5123.106358] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 05/20/2014
[ 5123.106860] task: ffff88007620f300 ti: ffff88005877c000 task.ti: ffff88005877c000
[ 5123.107363] RIP: 0010:[<ffffffffa03ed38b>]  [<ffffffffa03ed38b>] nfs4_proc_get_locations+0x9b/0x120 [nfsv4]
[ 5123.107909] RSP: 0018:ffff88005877fdb8  EFLAGS: 00010246
[ 5123.108435] RAX: ffff880053f3bc00 RBX: ffff88006ce6c908 RCX: ffff880053a0d240
[ 5123.108968] RDX: ffffea0000e6d940 RSI: ffff8800399a0000 RDI: ffff88006ce6c908
[ 5123.109503] RBP: ffff88005877fe28 R08: ffffffff81c708a0 R09: 0000000000000000
[ 5123.110045] R10: 00000000000001a2 R11: ffff88003ba7f5c8 R12: ffff880054c55800
[ 5123.110618] R13: 0000000000000000 R14: ffff880053a0d240 R15: ffff880053a0d240
[ 5123.111169] FS:  0000000000000000(0000) GS:ffffffff81c27000(0000) knlGS:0000000000000000
[ 5123.111726] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 5123.112286] CR2: 0000000000000000 CR3: 0000000054cac000 CR4: 00000000001406f0
[ 5123.112888] Stack:
[ 5123.113458]  ffffea0000e6d940 ffff8800399a0000 00000000000167d0 0000000000000000
[ 5123.114049]  0000000000000000 0000000000000000 0000000000000000 00000000a7ec82c6
[ 5123.114662]  ffff88005877fe18 ffffea0000e6d940 ffff8800399a0000 ffff880054c55800
[ 5123.115264] Call Trace:
[ 5123.115868]  [<ffffffffa03fb44b>] nfs4_try_migration+0xbb/0x220 [nfsv4]
[ 5123.116487]  [<ffffffffa03fcb3b>] nfs4_run_state_manager+0x4ab/0x7b0 [nfsv4]
[ 5123.117104]  [<ffffffffa03fc690>] ? nfs4_do_reclaim+0x510/0x510 [nfsv4]
[ 5123.117813]  [<ffffffff810a4527>] kthread+0xd7/0xf0
[ 5123.118456]  [<ffffffff810a4450>] ? kthread_worker_fn+0x160/0x160
[ 5123.119108]  [<ffffffff816d9cdf>] ret_from_fork+0x3f/0x70
[ 5123.119723]  [<ffffffff810a4450>] ? kthread_worker_fn+0x160/0x160
[ 5123.120329] Code: 4c 8b 6a 58 74 17 eb 52 48 8d 55 a8 89 c6 4c 89 e7 e8 4a b5 ff ff 8b 45 b0 85 c0 74 1c 4c 89 f9 48 8b 55 90 48 8b 75 98 48 89 df <41> ff 55 00 3d e8 d8 ff ff 41 89 c6 74 cf 48 8b 4d c8 65 48 33
[ 5123.121643] RIP  [<ffffffffa03ed38b>] nfs4_proc_get_locations+0x9b/0x120 [nfsv4]
[ 5123.122308]  RSP <ffff88005877fdb8>
[ 5123.122942] CR2: 0000000000000000

Fixes: ec011fe847 ("NFS: Introduce a vector of migration recovery ops")
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -8661,6 +8661,7 @@ static const struct nfs4_minor_version_o
 	.reboot_recovery_ops = &nfs41_reboot_recovery_ops,
 	.nograce_recovery_ops = &nfs41_nograce_recovery_ops,
 	.state_renewal_ops = &nfs41_state_renewal_ops,
+	.mig_recovery_ops = &nfs41_mig_recovery_ops,
 };
 #endif
 



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

* [PATCH 4.2 082/134] NFS: nfs_set_pgio_error sometimes misses errors
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (77 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 081/134] NFS: Fix a NULL pointer dereference of migration recovery ops for v4.2 client Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 083/134] NFS41/flexfiles: update inode after write finishes Greg Kroah-Hartman
                   ` (54 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Trond Myklebust

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

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

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

commit e9ae58aeee8842a50f7e199d602a5ccb2e41a95f upstream.

We should ensure that we always set the pgio_header's error field
if a READ or WRITE RPC call returns an error. The current code depends
on 'hdr->good_bytes' always being initialised to a large value, which
is not always done correctly by callers.
When this happens, applications may end up missing important errors.

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

---
 fs/nfs/pagelist.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -77,8 +77,8 @@ EXPORT_SYMBOL_GPL(nfs_pgheader_init);
 void nfs_set_pgio_error(struct nfs_pgio_header *hdr, int error, loff_t pos)
 {
 	spin_lock(&hdr->lock);
-	if (pos < hdr->io_start + hdr->good_bytes) {
-		set_bit(NFS_IOHDR_ERROR, &hdr->flags);
+	if (!test_and_set_bit(NFS_IOHDR_ERROR, &hdr->flags)
+	    || pos < hdr->io_start + hdr->good_bytes) {
 		clear_bit(NFS_IOHDR_EOF, &hdr->flags);
 		hdr->good_bytes = pos - hdr->io_start;
 		hdr->error = error;



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

* [PATCH 4.2 083/134] NFS41/flexfiles: update inode after write finishes
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (78 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 082/134] NFS: nfs_set_pgio_error sometimes misses errors Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 084/134] NFSv4: Force a post-op attribute update when holding a delegation Greg Kroah-Hartman
                   ` (53 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Anna Schumaker, Peng Tao, Trond Myklebust

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

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

From: Peng Tao <tao.peng@primarydata.com>

commit 69f230d907e8c1ca3f9bd528993eeb98f712b0dd upstream.

Otherwise we break fstest case tests/read_write/mctime.t

Does files layout need the same fix as well?

Cc: Anna Schumaker <anna.schumaker@netapp.com>
Signed-off-by: Peng Tao <tao.peng@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -1199,6 +1199,9 @@ static int ff_layout_write_done_cb(struc
 	    hdr->res.verf->committed == NFS_DATA_SYNC)
 		ff_layout_set_layoutcommit(hdr);
 
+	if (task->tk_status >= 0)
+		nfs_writeback_update_inode(hdr);
+
 	return 0;
 }
 



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

* [PATCH 4.2 084/134] NFSv4: Force a post-op attribute update when holding a delegation
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (79 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 083/134] NFS41/flexfiles: update inode after write finishes Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 085/134] NFS41/flexfiles: zero out DS write wcc Greg Kroah-Hartman
                   ` (52 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Trond Myklebust

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

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

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

commit aaae3f00d3f67f681a1f3cb7af999e976e8a24ce upstream.

If the ctime or mtime or change attribute have changed because
of an operation we initiated, we should make sure that we force
an attribute update. However we do not want to mark the page cache
for revalidation.

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

---
 fs/nfs/inode.c |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1483,6 +1483,13 @@ static int nfs_post_op_update_inode_lock
 {
 	unsigned long invalid = NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE;
 
+	/*
+	 * Don't revalidate the pagecache if we hold a delegation, but do
+	 * force an attribute update
+	 */
+	if (NFS_PROTO(inode)->have_delegation(inode, FMODE_READ))
+		invalid = NFS_INO_INVALID_ATTR|NFS_INO_REVAL_FORCED;
+
 	if (S_ISDIR(inode->i_mode))
 		invalid |= NFS_INO_INVALID_DATA;
 	nfs_set_cache_invalid(inode, invalid);



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

* [PATCH 4.2 085/134] NFS41/flexfiles: zero out DS write wcc
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (80 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 084/134] NFSv4: Force a post-op attribute update when holding a delegation Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 086/134] NFSv4.1/flexfiles: Fix a protocol error in layoutreturn Greg Kroah-Hartman
                   ` (51 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Peng Tao, Trond Myklebust

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

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

From: Peng Tao <tao.peng@primarydata.com>

commit 5420401079e152ff68a8024f6a375804b1c21505 upstream.

We do not want to update inode attributes with DS values.

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

---
 fs/nfs/flexfilelayout/flexfilelayout.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -1199,6 +1199,8 @@ static int ff_layout_write_done_cb(struc
 	    hdr->res.verf->committed == NFS_DATA_SYNC)
 		ff_layout_set_layoutcommit(hdr);
 
+	/* zero out fattr since we don't care DS attr at all */
+	hdr->fattr.valid = 0;
 	if (task->tk_status >= 0)
 		nfs_writeback_update_inode(hdr);
 



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

* [PATCH 4.2 086/134] NFSv4.1/flexfiles: Fix a protocol error in layoutreturn
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (81 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 085/134] NFS41/flexfiles: zero out DS write wcc Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 087/134] NFSv4.1: Fix a protocol issue with CLOSE stateids Greg Kroah-Hartman
                   ` (50 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Tom Haynes, Trond Myklebust

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

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

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

commit d13549074cf066d6d5bb29903d044beffea342d3 upstream.

According to the flexfiles protocol, the layoutreturn should specify an
array of errors in the following format:

struct ff_ioerr4 {
	offset4        ffie_offset;
	length4        ffie_length;
	stateid4       ffie_stateid;
	device_error4  ffie_errors<>;
};

This patch fixes up the code to ensure that our ffie_errors is indeed
encoded as an array (albeit with only a single entry).

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

---
 fs/nfs/flexfilelayout/flexfilelayoutdev.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c
+++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
@@ -500,16 +500,19 @@ int ff_layout_encode_ds_ioerr(struct nfs
 					   range->offset, range->length))
 			continue;
 		/* offset(8) + length(8) + stateid(NFS4_STATEID_SIZE)
-		 * + deviceid(NFS4_DEVICEID4_SIZE) + status(4) + opnum(4)
+		 * + array length + deviceid(NFS4_DEVICEID4_SIZE)
+		 * + status(4) + opnum(4)
 		 */
 		p = xdr_reserve_space(xdr,
-				24 + NFS4_STATEID_SIZE + NFS4_DEVICEID4_SIZE);
+				28 + NFS4_STATEID_SIZE + NFS4_DEVICEID4_SIZE);
 		if (unlikely(!p))
 			return -ENOBUFS;
 		p = xdr_encode_hyper(p, err->offset);
 		p = xdr_encode_hyper(p, err->length);
 		p = xdr_encode_opaque_fixed(p, &err->stateid,
 					    NFS4_STATEID_SIZE);
+		/* Encode 1 error */
+		*p++ = cpu_to_be32(1);
 		p = xdr_encode_opaque_fixed(p, &err->deviceid,
 					    NFS4_DEVICEID4_SIZE);
 		*p++ = cpu_to_be32(err->status);



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

* [PATCH 4.2 087/134] NFSv4.1: Fix a protocol issue with CLOSE stateids
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (82 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 086/134] NFSv4.1/flexfiles: Fix a protocol error in layoutreturn Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 088/134] nfs: Fix truncated client owner id without proto type Greg Kroah-Hartman
                   ` (49 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Trond Myklebust

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

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

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

commit 4a1e2feb9d246775dee0f78ed5b18826bae2b1c5 upstream.

According to RFC5661 Section 18.2.4, CLOSE is supposed to return
the zero stateid. This means that nfs_clear_open_stateid_locked()
cannot assume that the result stateid will always match the 'other'
field of the existing open stateid when trying to determine a race
with a parallel OPEN.

Instead, we look at the argument, and check for matches.

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

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

--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1220,6 +1220,7 @@ static void nfs_resync_open_stateid_lock
 }
 
 static void nfs_clear_open_stateid_locked(struct nfs4_state *state,
+		nfs4_stateid *arg_stateid,
 		nfs4_stateid *stateid, fmode_t fmode)
 {
 	clear_bit(NFS_O_RDWR_STATE, &state->flags);
@@ -1238,8 +1239,9 @@ static void nfs_clear_open_stateid_locke
 	if (stateid == NULL)
 		return;
 	/* Handle races with OPEN */
-	if (!nfs4_stateid_match_other(stateid, &state->open_stateid) ||
-	    !nfs4_stateid_is_newer(stateid, &state->open_stateid)) {
+	if (!nfs4_stateid_match_other(arg_stateid, &state->open_stateid) ||
+	    (nfs4_stateid_match_other(stateid, &state->open_stateid) &&
+	    !nfs4_stateid_is_newer(stateid, &state->open_stateid))) {
 		nfs_resync_open_stateid_locked(state);
 		return;
 	}
@@ -1248,10 +1250,12 @@ static void nfs_clear_open_stateid_locke
 	nfs4_stateid_copy(&state->open_stateid, stateid);
 }
 
-static void nfs_clear_open_stateid(struct nfs4_state *state, nfs4_stateid *stateid, fmode_t fmode)
+static void nfs_clear_open_stateid(struct nfs4_state *state,
+	nfs4_stateid *arg_stateid,
+	nfs4_stateid *stateid, fmode_t fmode)
 {
 	write_seqlock(&state->seqlock);
-	nfs_clear_open_stateid_locked(state, stateid, fmode);
+	nfs_clear_open_stateid_locked(state, arg_stateid, stateid, fmode);
 	write_sequnlock(&state->seqlock);
 	if (test_bit(NFS_STATE_RECLAIM_NOGRACE, &state->flags))
 		nfs4_schedule_state_manager(state->owner->so_server->nfs_client);
@@ -2684,7 +2688,8 @@ static void nfs4_close_done(struct rpc_t
 				goto out_release;
 			}
 	}
-	nfs_clear_open_stateid(state, res_stateid, calldata->arg.fmode);
+	nfs_clear_open_stateid(state, &calldata->arg.stateid,
+			res_stateid, calldata->arg.fmode);
 out_release:
 	nfs_release_seqid(calldata->arg.seqid);
 	nfs_refresh_inode(calldata->inode, calldata->res.fattr);



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

* [PATCH 4.2 088/134] nfs: Fix truncated client owner id without proto type
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (83 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 087/134] NFSv4.1: Fix a protocol issue with CLOSE stateids Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 089/134] Revert "NFSv4: Remove incorrect check in can_open_delegated()" Greg Kroah-Hartman
                   ` (48 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Kinglong Mee, Trond Myklebust

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

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

From: Kinglong Mee <kinglongmee@gmail.com>

commit 4a70316caef7d158445e672e146eb9f1b8c1aeee upstream.

The length of "Linux NFSv4.0 " is 14, not 10.

Without this patch, I get a truncated client owner id as,
"Linux NFSv4.0 ::1/::1"

With this patch,
"Linux NFSv4.0 ::1/::1 tcp"

Fixes: a319268891 ("nfs: make nfs4_init_nonuniform_client_string use a dynamically allocated buffer")
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -4989,7 +4989,7 @@ nfs4_init_nonuniform_client_string(struc
 		return 0;
 retry:
 	rcu_read_lock();
-	len = 10 + strlen(clp->cl_ipaddr) + 1 +
+	len = 14 + strlen(clp->cl_ipaddr) + 1 +
 		strlen(rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_ADDR)) +
 		1 +
 		strlen(rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_PROTO)) +



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

* [PATCH 4.2 089/134] Revert "NFSv4: Remove incorrect check in can_open_delegated()"
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (84 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 088/134] nfs: Fix truncated client owner id without proto type Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 090/134] svcrdma: Change maximum server payload back to RPCSVC_MAXPAYLOAD Greg Kroah-Hartman
                   ` (47 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Olga Kornievskaia, Trond Myklebust

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

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

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

commit 36319608e28701c07cad80ae3be8b0fdfb1ab40f upstream.

This reverts commit 4e379d36c050b0117b5d10048be63a44f5036115.

This commit opens up a race between the recovery code and the open code.

Reported-by: Olga Kornievskaia <aglo@umich.edu>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1156,6 +1156,8 @@ static int can_open_delegated(struct nfs
 		return 0;
 	if ((delegation->type & fmode) != fmode)
 		return 0;
+	if (test_bit(NFS_DELEGATION_NEED_RECLAIM, &delegation->flags))
+		return 0;
 	if (test_bit(NFS_DELEGATION_RETURNING, &delegation->flags))
 		return 0;
 	nfs_mark_delegation_referenced(delegation);



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

* [PATCH 4.2 090/134] svcrdma: Change maximum server payload back to RPCSVC_MAXPAYLOAD
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (85 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 089/134] Revert "NFSv4: Remove incorrect check in can_open_delegated()" Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 091/134] net: sunrpc: fix tracepoint Warning: unknown op -> Greg Kroah-Hartman
                   ` (46 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Chuck Lever, J. Bruce Fields

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

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

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

commit cc9a903d915c21626b6b2fbf8ed0ff16a7f82210 upstream.

Both commit 0380a3f375 ("svcrdma: Add a separate "max data segs"
macro for svcrdma") and commit 7e5be28827bf ("svcrdma: advertise
the correct max payload") are incorrect. This commit reverts both
changes, restoring the server's maximum payload size to 1MB.

Commit 7e5be28827bf based the server's maximum payload on the
_client's_ RPCRDMA_MAX_DATA_SEGS value. That was wrong.

Commit 0380a3f375 tried to fix this so that the client maximum
payload size could be raised without affecting the server, but
managed to confuse matters more on the server side.

More importantly, limiting the advertised maximum payload size was
meant to be a workaround, not the actual fix. We need to revisit

  https://bugzilla.linux-nfs.org/show_bug.cgi?id=270

A Linux client on a platform with 64KB pages can overrun and crash
an x86_64 NFS/RDMA server when the r/wsize is 1MB. An x86/64 Linux
client seems to work fine using 1MB reads and writes when the Linux
server's maximum payload size is restored to 1MB.

BugLink: https://bugzilla.linux-nfs.org/show_bug.cgi?id=270
Fixes: 0380a3f375 ("svcrdma: Add a separate "max data segs" macro")
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>

---
 include/linux/sunrpc/svc_rdma.h          |    9 ++-------
 net/sunrpc/xprtrdma/svc_rdma_transport.c |    2 +-
 net/sunrpc/xprtrdma/xprt_rdma.h          |    1 -
 3 files changed, 3 insertions(+), 9 deletions(-)

--- a/include/linux/sunrpc/svc_rdma.h
+++ b/include/linux/sunrpc/svc_rdma.h
@@ -172,13 +172,6 @@ struct svcxprt_rdma {
 #define RDMAXPRT_SQ_PENDING	2
 #define RDMAXPRT_CONN_PENDING	3
 
-#define RPCRDMA_MAX_SVC_SEGS	(64)	/* server max scatter/gather */
-#if RPCSVC_MAXPAYLOAD < (RPCRDMA_MAX_SVC_SEGS << PAGE_SHIFT)
-#define RPCRDMA_MAXPAYLOAD	RPCSVC_MAXPAYLOAD
-#else
-#define RPCRDMA_MAXPAYLOAD	(RPCRDMA_MAX_SVC_SEGS << PAGE_SHIFT)
-#endif
-
 #define RPCRDMA_LISTEN_BACKLOG  10
 /* The default ORD value is based on two outstanding full-size writes with a
  * page size of 4k, or 32k * 2 ops / 4k = 16 outstanding RDMA_READ.  */
@@ -187,6 +180,8 @@ struct svcxprt_rdma {
 #define RPCRDMA_MAX_REQUESTS    32
 #define RPCRDMA_MAX_REQ_SIZE    4096
 
+#define RPCSVC_MAXPAYLOAD_RDMA	RPCSVC_MAXPAYLOAD
+
 /* svc_rdma_marshal.c */
 extern int svc_rdma_xdr_decode_req(struct rpcrdma_msg **, struct svc_rqst *);
 extern int svc_rdma_xdr_encode_error(struct svcxprt_rdma *,
--- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
@@ -91,7 +91,7 @@ struct svc_xprt_class svc_rdma_class = {
 	.xcl_name = "rdma",
 	.xcl_owner = THIS_MODULE,
 	.xcl_ops = &svc_rdma_ops,
-	.xcl_max_payload = RPCRDMA_MAXPAYLOAD,
+	.xcl_max_payload = RPCSVC_MAXPAYLOAD_RDMA,
 	.xcl_ident = XPRT_TRANSPORT_RDMA,
 };
 
--- a/net/sunrpc/xprtrdma/xprt_rdma.h
+++ b/net/sunrpc/xprtrdma/xprt_rdma.h
@@ -51,7 +51,6 @@
 #include <linux/sunrpc/clnt.h> 		/* rpc_xprt */
 #include <linux/sunrpc/rpc_rdma.h> 	/* RPC/RDMA protocol */
 #include <linux/sunrpc/xprtrdma.h> 	/* xprt parameters */
-#include <linux/sunrpc/svc.h>		/* RPCSVC_MAXPAYLOAD */
 
 #define RDMA_RESOLVE_TIMEOUT	(5000)	/* 5 seconds */
 #define RDMA_CONNECT_RETRY_MAX	(2)	/* retries if no listener backlog */



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

* [PATCH 4.2 091/134] net: sunrpc: fix tracepoint Warning: unknown op ->
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (86 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 090/134] svcrdma: Change maximum server payload back to RPCSVC_MAXPAYLOAD Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 092/134] SUNRPC: Fix a thinko in xs_connect() Greg Kroah-Hartman
                   ` (45 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Pratyush Anand, Jeff Layton,
	Steven Rostedt, J. Bruce Fields

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

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

From: Pratyush Anand <panand@redhat.com>

commit 051ac3848a94f21cfdec899cc9c65ce7f9f116fa upstream.

`perf stat  -e sunrpc:svc_xprt_do_enqueue true` results in

Warning: unknown op '->'
Warning: [sunrpc:svc_xprt_do_enqueue] unknown op '->'

Similar warning for svc_handle_xprt as well.

Actually TP_printk() should never dereference an address saved in the ring
buffer that points somewhere in the kernel. There's no guarantee that that
object still exists (with the exception of static strings).

Therefore change all the arguments for TP_printk(), so that it references
values existing in the ring buffer only.

While doing that, also fix another possible bug when argument xprt could be
NULL and TP_fast_assign() tries to access it's elements.

Signed-off-by: Pratyush Anand <panand@redhat.com>
Reviewed-by: Jeff Layton <jeff.layton@primarydata.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Fixes: 83a712e0afef "sunrpc: add some tracepoints around ..."
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 include/trace/events/sunrpc.h |   21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

--- a/include/trace/events/sunrpc.h
+++ b/include/trace/events/sunrpc.h
@@ -529,18 +529,21 @@ TRACE_EVENT(svc_xprt_do_enqueue,
 
 	TP_STRUCT__entry(
 		__field(struct svc_xprt *, xprt)
-		__field(struct svc_rqst *, rqst)
+		__field_struct(struct sockaddr_storage, ss)
+		__field(int, pid)
+		__field(unsigned long, flags)
 	),
 
 	TP_fast_assign(
 		__entry->xprt = xprt;
-		__entry->rqst = rqst;
+		xprt ? memcpy(&__entry->ss, &xprt->xpt_remote, sizeof(__entry->ss)) : memset(&__entry->ss, 0, sizeof(__entry->ss));
+		__entry->pid = rqst? rqst->rq_task->pid : 0;
+		__entry->flags = xprt ? xprt->xpt_flags : 0;
 	),
 
 	TP_printk("xprt=0x%p addr=%pIScp pid=%d flags=%s", __entry->xprt,
-		(struct sockaddr *)&__entry->xprt->xpt_remote,
-		__entry->rqst ? __entry->rqst->rq_task->pid : 0,
-		show_svc_xprt_flags(__entry->xprt->xpt_flags))
+		(struct sockaddr *)&__entry->ss,
+		__entry->pid, show_svc_xprt_flags(__entry->flags))
 );
 
 TRACE_EVENT(svc_xprt_dequeue,
@@ -589,16 +592,20 @@ TRACE_EVENT(svc_handle_xprt,
 	TP_STRUCT__entry(
 		__field(struct svc_xprt *, xprt)
 		__field(int, len)
+		__field_struct(struct sockaddr_storage, ss)
+		__field(unsigned long, flags)
 	),
 
 	TP_fast_assign(
 		__entry->xprt = xprt;
+		xprt ? memcpy(&__entry->ss, &xprt->xpt_remote, sizeof(__entry->ss)) : memset(&__entry->ss, 0, sizeof(__entry->ss));
 		__entry->len = len;
+		__entry->flags = xprt ? xprt->xpt_flags : 0;
 	),
 
 	TP_printk("xprt=0x%p addr=%pIScp len=%d flags=%s", __entry->xprt,
-		(struct sockaddr *)&__entry->xprt->xpt_remote, __entry->len,
-		show_svc_xprt_flags(__entry->xprt->xpt_flags))
+		(struct sockaddr *)&__entry->ss,
+		__entry->len, show_svc_xprt_flags(__entry->flags))
 );
 #endif /* _TRACE_SUNRPC_H */
 



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

* [PATCH 4.2 092/134] SUNRPC: Fix a thinko in xs_connect()
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (87 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 091/134] net: sunrpc: fix tracepoint Warning: unknown op -> Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 093/134] SUNRPC: xs_reset_transport must mark the connection as disconnected Greg Kroah-Hartman
                   ` (44 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Trond Myklebust

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

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

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

commit 99b1a4c32ad22024ac6198a4337aaec5ea23168f upstream.

It is rather pointless to test the value of transport->inet after
calling xs_reset_transport(), since it will always be zero, and
so we will never see any exponential back off behaviour.
Also don't force early connections for SOFTCONN tasks. If the server
disconnects us, we should respect the exponential backoff.

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

---
 net/sunrpc/xprtsock.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -2279,13 +2279,14 @@ static void xs_connect(struct rpc_xprt *
 
 	WARN_ON_ONCE(!xprt_lock_connect(xprt, task, transport));
 
-	/* Start by resetting any existing state */
-	xs_reset_transport(transport);
-
-	if (transport->sock != NULL && !RPC_IS_SOFTCONN(task)) {
+	if (transport->sock != NULL) {
 		dprintk("RPC:       xs_connect delayed xprt %p for %lu "
 				"seconds\n",
 				xprt, xprt->reestablish_timeout / HZ);
+
+		/* Start by resetting any existing state */
+		xs_reset_transport(transport);
+
 		queue_delayed_work(rpciod_workqueue,
 				   &transport->connect_worker,
 				   xprt->reestablish_timeout);



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

* [PATCH 4.2 093/134] SUNRPC: xs_reset_transport must mark the connection as disconnected
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (88 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 092/134] SUNRPC: Fix a thinko in xs_connect() Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 094/134] SUNRPC: Ensure that we wait for connections to complete before retrying Greg Kroah-Hartman
                   ` (43 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Trond Myklebust

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

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

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

commit 0c78789e3a030615c6650fde89546cadf40ec2cc upstream.

In case the reconnection attempt fails.

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

---
 net/sunrpc/xprtsock.c |    1 +
 1 file changed, 1 insertion(+)

--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -829,6 +829,7 @@ static void xs_reset_transport(struct so
 	sk->sk_user_data = NULL;
 
 	xs_restore_old_callbacks(transport, sk);
+	xprt_clear_connected(xprt);
 	write_unlock_bh(&sk->sk_callback_lock);
 	xs_sock_reset_connection_flags(xprt);
 



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

* [PATCH 4.2 094/134] SUNRPC: Ensure that we wait for connections to complete before retrying
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (89 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 093/134] SUNRPC: xs_reset_transport must mark the connection as disconnected Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 095/134] SUNRPC: Lock the transport layer on shutdown Greg Kroah-Hartman
                   ` (42 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Russell King, Russell King,
	Benjamin Coddington, Trond Myklebust

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

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

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

commit 0fdea1e8a2853f79d39b8555cc9de16a7e0ab26f upstream.

Commit 718ba5b87343, moved the responsibility for unlocking the socket to
xs_tcp_setup_socket, meaning that the socket will be unlocked before we
know that it has finished trying to connect. The following patch is based on
an initial patch by Russell King to ensure that we delay clearing the
XPRT_CONNECTING flag until we either know that we failed to initiate
a connection attempt, or the connection attempt itself failed.

Fixes: 718ba5b87343 ("SUNRPC: Add helpers to prevent socket create from racing")
Reported-by: Russell King <linux@arm.linux.org.uk>
Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
Tested-by: Russell King <rmk+kernel@arm.linux.org.uk>
Tested-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 include/linux/sunrpc/xprtsock.h |    3 +++
 net/sunrpc/xprtsock.c           |   11 ++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

--- a/include/linux/sunrpc/xprtsock.h
+++ b/include/linux/sunrpc/xprtsock.h
@@ -42,6 +42,7 @@ struct sock_xprt {
 	/*
 	 * Connection of transports
 	 */
+	unsigned long		sock_state;
 	struct delayed_work	connect_worker;
 	struct sockaddr_storage	srcaddr;
 	unsigned short		srcport;
@@ -76,6 +77,8 @@ struct sock_xprt {
  */
 #define TCP_RPC_REPLY		(1UL << 6)
 
+#define XPRT_SOCK_CONNECTING	1U
+
 #endif /* __KERNEL__ */
 
 #endif /* _LINUX_SUNRPC_XPRTSOCK_H */
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1433,6 +1433,7 @@ out:
 static void xs_tcp_state_change(struct sock *sk)
 {
 	struct rpc_xprt *xprt;
+	struct sock_xprt *transport;
 
 	read_lock_bh(&sk->sk_callback_lock);
 	if (!(xprt = xprt_from_sock(sk)))
@@ -1444,13 +1445,12 @@ static void xs_tcp_state_change(struct s
 			sock_flag(sk, SOCK_ZAPPED),
 			sk->sk_shutdown);
 
+	transport = container_of(xprt, struct sock_xprt, xprt);
 	trace_rpc_socket_state_change(xprt, sk->sk_socket);
 	switch (sk->sk_state) {
 	case TCP_ESTABLISHED:
 		spin_lock(&xprt->transport_lock);
 		if (!xprt_test_and_set_connected(xprt)) {
-			struct sock_xprt *transport = container_of(xprt,
-					struct sock_xprt, xprt);
 
 			/* Reset TCP record info */
 			transport->tcp_offset = 0;
@@ -1459,6 +1459,8 @@ static void xs_tcp_state_change(struct s
 			transport->tcp_flags =
 				TCP_RCV_COPY_FRAGHDR | TCP_RCV_COPY_XID;
 			xprt->connect_cookie++;
+			clear_bit(XPRT_SOCK_CONNECTING, &transport->sock_state);
+			xprt_clear_connecting(xprt);
 
 			xprt_wake_pending_tasks(xprt, -EAGAIN);
 		}
@@ -1494,6 +1496,9 @@ static void xs_tcp_state_change(struct s
 		smp_mb__after_atomic();
 		break;
 	case TCP_CLOSE:
+		if (test_and_clear_bit(XPRT_SOCK_CONNECTING,
+					&transport->sock_state))
+			xprt_clear_connecting(xprt);
 		xs_sock_mark_closed(xprt);
 	}
  out:
@@ -2177,6 +2182,7 @@ static int xs_tcp_finish_connecting(stru
 	/* Tell the socket layer to start connecting... */
 	xprt->stat.connect_count++;
 	xprt->stat.connect_start = jiffies;
+	set_bit(XPRT_SOCK_CONNECTING, &transport->sock_state);
 	ret = kernel_connect(sock, xs_addr(xprt), xprt->addrlen, O_NONBLOCK);
 	switch (ret) {
 	case 0:
@@ -2238,7 +2244,6 @@ static void xs_tcp_setup_socket(struct w
 	case -EINPROGRESS:
 	case -EALREADY:
 		xprt_unlock_connect(xprt, transport);
-		xprt_clear_connecting(xprt);
 		return;
 	case -EINVAL:
 		/* Happens, for instance, if the user specified a link



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

* [PATCH 4.2 095/134] SUNRPC: Lock the transport layer on shutdown
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (90 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 094/134] SUNRPC: Ensure that we wait for connections to complete before retrying Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 096/134] rtc: s3c: fix disabled clocks for alarm Greg Kroah-Hartman
                   ` (41 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Suzuki K. Poulose, Jeff Layton,
	Trond Myklebust

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

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

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

commit 79234c3db6842a3de03817211d891e0c2878f756 upstream.

Avoid all races with the connect/disconnect handlers by taking the
transport lock.

Reported-by:"Suzuki K. Poulose" <suzuki.poulose@arm.com>
Acked-by: Jeff Layton <jlayton@poochiereds.net>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/sunrpc/xprt.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -614,6 +614,7 @@ static void xprt_autoclose(struct work_s
 	clear_bit(XPRT_CLOSE_WAIT, &xprt->state);
 	xprt->ops->close(xprt);
 	xprt_release_write(xprt, NULL);
+	wake_up_bit(&xprt->state, XPRT_LOCKED);
 }
 
 /**
@@ -723,6 +724,7 @@ void xprt_unlock_connect(struct rpc_xprt
 	xprt->ops->release_xprt(xprt, NULL);
 out:
 	spin_unlock_bh(&xprt->transport_lock);
+	wake_up_bit(&xprt->state, XPRT_LOCKED);
 }
 
 /**
@@ -1394,6 +1396,10 @@ out:
 static void xprt_destroy(struct rpc_xprt *xprt)
 {
 	dprintk("RPC:       destroying transport %p\n", xprt);
+
+	/* Exclude transport connect/disconnect handlers */
+	wait_on_bit_lock(&xprt->state, XPRT_LOCKED, TASK_UNINTERRUPTIBLE);
+
 	del_timer_sync(&xprt->timer);
 
 	rpc_xprt_debugfs_unregister(xprt);



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

* [PATCH 4.2 096/134] rtc: s3c: fix disabled clocks for alarm
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (91 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 095/134] SUNRPC: Lock the transport layer on shutdown Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 097/134] rtc: s5m: fix to update ctrl register Greg Kroah-Hartman
                   ` (40 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Joonyoung Shim, Krzysztof Kozlowski,
	Alexandre Belloni

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

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

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

commit 1fb1c35f56bb6ab4a65920c648154b0f78f634a5 upstream.

The clock enable/disable codes for alarm have been removed from
commit 24e1455493da ("drivers/rtc/rtc-s3c.c: delete duplicate clock
control") and the clocks are disabled even if alarm is set, so alarm
interrupt can't happen.

The s3c_rtc_setaie function can be called several times with 'enabled'
argument having same value, so it needs to check whether clocks are
enabled or not.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/rtc/rtc-s3c.c |   24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -39,6 +39,7 @@ struct s3c_rtc {
 	void __iomem *base;
 	struct clk *rtc_clk;
 	struct clk *rtc_src_clk;
+	bool clk_disabled;
 
 	struct s3c_rtc_data *data;
 
@@ -71,9 +72,12 @@ static void s3c_rtc_enable_clk(struct s3
 	unsigned long irq_flags;
 
 	spin_lock_irqsave(&info->alarm_clk_lock, irq_flags);
-	clk_enable(info->rtc_clk);
-	if (info->data->needs_src_clk)
-		clk_enable(info->rtc_src_clk);
+	if (info->clk_disabled) {
+		clk_enable(info->rtc_clk);
+		if (info->data->needs_src_clk)
+			clk_enable(info->rtc_src_clk);
+		info->clk_disabled = false;
+	}
 	spin_unlock_irqrestore(&info->alarm_clk_lock, irq_flags);
 }
 
@@ -82,9 +86,12 @@ static void s3c_rtc_disable_clk(struct s
 	unsigned long irq_flags;
 
 	spin_lock_irqsave(&info->alarm_clk_lock, irq_flags);
-	if (info->data->needs_src_clk)
-		clk_disable(info->rtc_src_clk);
-	clk_disable(info->rtc_clk);
+	if (!info->clk_disabled) {
+		if (info->data->needs_src_clk)
+			clk_disable(info->rtc_src_clk);
+		clk_disable(info->rtc_clk);
+		info->clk_disabled = true;
+	}
 	spin_unlock_irqrestore(&info->alarm_clk_lock, irq_flags);
 }
 
@@ -128,6 +135,11 @@ static int s3c_rtc_setaie(struct device
 
 	s3c_rtc_disable_clk(info);
 
+	if (enabled)
+		s3c_rtc_enable_clk(info);
+	else
+		s3c_rtc_disable_clk(info);
+
 	return 0;
 }
 



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

* [PATCH 4.2 097/134] rtc: s5m: fix to update ctrl register
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (92 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 096/134] rtc: s3c: fix disabled clocks for alarm Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 098/134] rtc: abx80x: fix RTC write bit Greg Kroah-Hartman
                   ` (39 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Joonyoung Shim, Krzysztof Kozlowski,
	Alexandre Belloni

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

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

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

commit ff02c0444b83201ff76cc49deccac8cf2bffc7bc upstream.

According to datasheet, the S2MPS13X and S2MPS14X should update write
buffer via setting WUDR bit to high after ctrl register is written.

If not, ALARM interrupt of rtc-s5m doesn't happen first time when i use
tools/testing/selftests/timers/rtctest.c test program and hour format is
used to 12 hour mode in Odroid-XU3 board.

One more issue is the RTC doesn't keep time on Odroid-XU3 board when i
turn on board after power off even if RTC battery is connected. It can
be solved as setting WUDR & RUDR bits to high at the same time after
RTC_CTRL register is written. It's same with condition of only writing
ALARM registers, so this is for only S2MPS14 and we should set WUDR &
A_UDR bits to high on S2MPS13.

I can't find any reasonable description about this like fix from
datasheet, but can find similar codes from rtc driver source of
hardkernel kernel and vendor kernel.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Tested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/rtc/rtc-s5m.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/drivers/rtc/rtc-s5m.c
+++ b/drivers/rtc/rtc-s5m.c
@@ -635,6 +635,16 @@ static int s5m8767_rtc_init_reg(struct s
 	case S2MPS13X:
 		data[0] = (0 << BCD_EN_SHIFT) | (1 << MODEL24_SHIFT);
 		ret = regmap_write(info->regmap, info->regs->ctrl, data[0]);
+		if (ret < 0)
+			break;
+
+		/*
+		 * Should set WUDR & (RUDR or AUDR) bits to high after writing
+		 * RTC_CTRL register like writing Alarm registers. We can't find
+		 * the description from datasheet but vendor code does that
+		 * really.
+		 */
+		ret = s5m8767_rtc_set_alarm_reg(info);
 		break;
 
 	default:



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

* [PATCH 4.2 098/134] rtc: abx80x: fix RTC write bit
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (93 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 097/134] rtc: s5m: fix to update ctrl register Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 099/134] PCI,parisc: Enable 64-bit bus addresses on PA-RISC Greg Kroah-Hartman
                   ` (38 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Mitja Spes, Alexandre Belloni

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

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

From: Mitja Spes <mitja@lxnav.com>

commit 5f1b2f77646fc0ef2f36fc554f5722a1381d0892 upstream.

Fix RTC write bit as per application manual

Signed-off-by: Mitja Spes <mitja@lxnav.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/rtc/rtc-abx80x.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/rtc/rtc-abx80x.c
+++ b/drivers/rtc/rtc-abx80x.c
@@ -28,7 +28,7 @@
 #define ABX8XX_REG_WD		0x07
 
 #define ABX8XX_REG_CTRL1	0x10
-#define ABX8XX_CTRL_WRITE	BIT(1)
+#define ABX8XX_CTRL_WRITE	BIT(0)
 #define ABX8XX_CTRL_12_24	BIT(6)
 
 #define ABX8XX_REG_CFG_KEY	0x1f



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

* [PATCH 4.2 099/134] PCI,parisc: Enable 64-bit bus addresses on PA-RISC
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (94 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 098/134] rtc: abx80x: fix RTC write bit Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 100/134] parisc: Use double word condition in 64bit CAS operation Greg Kroah-Hartman
                   ` (37 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel, linux-parisc
  Cc: Greg Kroah-Hartman, stable, linux-pci, Bjorn Helgaas,
	Meelis Roos, Helge Deller

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

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

From: Helge Deller <deller@gmx.de>

commit e02a653e15d8d32e9e768fd99a3271aafe5c5d77 upstream.

Commit 3a9ad0b ("PCI: Add pci_bus_addr_t") unconditionally introduced usage of
64-bit PCI bus addresses on all 64-bit platforms which broke PA-RISC.

It turned out that due to enabling the 64-bit addresses, the PCI logic decided
to use the GMMIO instead of the LMMIO region. This commit simply disables
registering the GMMIO and thus we fall back to use the LMMIO region as before.

Reverts commit 45ea2a5fed6dacb9bb0558d8b21eacc1c45d5bb4
("PCI: Don't use 64-bit bus addresses on PA-RISC")

To: linux-parisc@vger.kernel.org
Cc: linux-pci@vger.kernel.org
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Meelis Roos <mroos@linux.ee>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/parisc/lba_pci.c |    7 +++++--
 drivers/pci/Kconfig      |    2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

--- a/drivers/parisc/lba_pci.c
+++ b/drivers/parisc/lba_pci.c
@@ -1556,8 +1556,11 @@ lba_driver_probe(struct parisc_device *d
 	if (lba_dev->hba.lmmio_space.flags)
 		pci_add_resource_offset(&resources, &lba_dev->hba.lmmio_space,
 					lba_dev->hba.lmmio_space_offset);
-	if (lba_dev->hba.gmmio_space.flags)
-		pci_add_resource(&resources, &lba_dev->hba.gmmio_space);
+	if (lba_dev->hba.gmmio_space.flags) {
+		/* pci_add_resource(&resources, &lba_dev->hba.gmmio_space); */
+		pr_warn("LBA: Not registering GMMIO space %pR\n",
+			&lba_dev->hba.gmmio_space);
+	}
 
 	pci_add_resource(&resources, &lba_dev->hba.bus_num);
 
--- a/drivers/pci/Kconfig
+++ b/drivers/pci/Kconfig
@@ -2,7 +2,7 @@
 # PCI configuration
 #
 config PCI_BUS_ADDR_T_64BIT
-	def_bool y if (ARCH_DMA_ADDR_T_64BIT || (64BIT && !PARISC))
+	def_bool y if (ARCH_DMA_ADDR_T_64BIT || 64BIT)
 	depends on PCI
 
 config PCI_MSI



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

* [PATCH 4.2 100/134] parisc: Use double word condition in 64bit CAS operation
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (95 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 099/134] PCI,parisc: Enable 64-bit bus addresses on PA-RISC Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 101/134] parisc: Filter out spurious interrupts in PA-RISC irq handler Greg Kroah-Hartman
                   ` (36 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Helge Deller

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

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

From: John David Anglin <dave.anglin@bell.net>

commit 1b59ddfcf1678de38a1f8ca9fb8ea5eebeff1843 upstream.

The attached change fixes the condition used in the "sub" instruction.
A double word comparison is needed.  This fixes the 64-bit LWS CAS
operation on 64-bit kernels.

I can now enable 64-bit atomic support in GCC.

Signed-off-by: John David Anglin <dave.anglin>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/parisc/kernel/syscall.S |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/parisc/kernel/syscall.S
+++ b/arch/parisc/kernel/syscall.S
@@ -821,7 +821,7 @@ cas2_action:
 	/* 64bit CAS */
 #ifdef CONFIG_64BIT
 19:	ldd,ma	0(%sr3,%r26), %r29
-	sub,=	%r29, %r25, %r0
+	sub,*=	%r29, %r25, %r0
 	b,n	cas2_end
 20:	std,ma	%r24, 0(%sr3,%r26)
 	copy	%r0, %r28



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

* [PATCH 4.2 101/134] parisc: Filter out spurious interrupts in PA-RISC irq handler
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (96 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 100/134] parisc: Use double word condition in 64bit CAS operation Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 102/134] workqueue: Make flush_workqueue() available again to non GPL modules Greg Kroah-Hartman
                   ` (35 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Helge Deller

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

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

From: Helge Deller <deller@gmx.de>

commit b1b4e435e4ef7de77f07bf2a42c8380b960c2d44 upstream.

When detecting a serial port on newer PA-RISC machines (with iosapic) we have a
long way to go to find the right IRQ line, registering it, then registering the
serial port and the irq handler for the serial port. During this phase spurious
interrupts for the serial port may happen which then crashes the kernel because
the action handler might not have been set up yet.

So, basically it's a race condition between the serial port hardware and the
CPU which sets up the necessary fields in the irq sructs. The main reason for
this race is, that we unmask the serial port irqs too early without having set
up everything properly before (which isn't easily possible because we need the
IRQ number to register the serial ports).

This patch is a work-around for this problem. It adds checks to the CPU irq
handler to verify if the IRQ action field has been initialized already. If not,
we just skip this interrupt (which isn't critical for a serial port at bootup).
The real fix would probably involve rewriting all PA-RISC specific IRQ code
(for CPU, IOSAPIC, GSC and EISA) to use IRQ domains with proper parenting of
the irq chips and proper irq enabling along this line.

This bug has been in the PA-RISC port since the beginning, but the crashes
happened very rarely with currently used hardware.  But on the latest machine
which I bought (a C8000 workstation), which uses the fastest CPUs (4 x PA8900,
1GHz) and which has the largest possible L1 cache size (64MB each), the kernel
crashed at every boot because of this race. So, without this patch the machine
would currently be unuseable.

For the record, here is the flow logic:
1. serial_init_chip() in 8250_gsc.c calls iosapic_serial_irq().
2. iosapic_serial_irq() calls txn_alloc_irq() to find the irq.
3. iosapic_serial_irq() calls cpu_claim_irq() to register the CPU irq
4. cpu_claim_irq() unmasks the CPU irq (which it shouldn't!)
5. serial_init_chip() then registers the 8250 port.
Problems:
- In step 4 the CPU irq shouldn't have been registered yet, but after step 5
- If serial irq happens between 4 and 5 have finished, the kernel will crash

Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/parisc/kernel/irq.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/arch/parisc/kernel/irq.c
+++ b/arch/parisc/kernel/irq.c
@@ -507,8 +507,8 @@ void do_cpu_irq_mask(struct pt_regs *reg
 	struct pt_regs *old_regs;
 	unsigned long eirr_val;
 	int irq, cpu = smp_processor_id();
-#ifdef CONFIG_SMP
 	struct irq_desc *desc;
+#ifdef CONFIG_SMP
 	cpumask_t dest;
 #endif
 
@@ -521,8 +521,12 @@ void do_cpu_irq_mask(struct pt_regs *reg
 		goto set_out;
 	irq = eirr_to_irq(eirr_val);
 
-#ifdef CONFIG_SMP
+	/* Filter out spurious interrupts, mostly from serial port at bootup */
 	desc = irq_to_desc(irq);
+	if (unlikely(!desc->action))
+		goto set_out;
+
+#ifdef CONFIG_SMP
 	cpumask_copy(&dest, desc->irq_data.affinity);
 	if (irqd_is_per_cpu(&desc->irq_data) &&
 	    !cpumask_test_cpu(smp_processor_id(), &dest)) {



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

* [PATCH 4.2 102/134] workqueue: Make flush_workqueue() available again to non GPL modules
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (97 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 101/134] parisc: Filter out spurious interrupts in PA-RISC irq handler Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 103/134] vmscan: fix increasing nr_isolated incurred by putback unevictable pages Greg Kroah-Hartman
                   ` (34 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Tim Gardner, Tejun Heo

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

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

From: Tim Gardner <tim.gardner@canonical.com>

commit 1dadafa86a779884f14a6e7a3ddde1a57b0a0a65 upstream.

Commit 37b1ef31a568fc02e53587620226e5f3c66454c8 ("workqueue: move
flush_scheduled_work() to workqueue.h") moved the exported non GPL
flush_scheduled_work() from a function to an inline wrapper.
Unfortunately, it directly calls flush_workqueue() which is a GPL function.
This has the effect of changing the licensing requirement for this function
and makes it unavailable to non GPL modules.

See commit ad7b1f841f8a54c6d61ff181451f55b68175e15a ("workqueue: Make
schedule_work() available again to non GPL modules") for precedent.

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 kernel/workqueue.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -2614,7 +2614,7 @@ void flush_workqueue(struct workqueue_st
 out_unlock:
 	mutex_unlock(&wq->mutex);
 }
-EXPORT_SYMBOL_GPL(flush_workqueue);
+EXPORT_SYMBOL(flush_workqueue);
 
 /**
  * drain_workqueue - drain a workqueue



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

* [PATCH 4.2 103/134] vmscan: fix increasing nr_isolated incurred by putback unevictable pages
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (98 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 102/134] workqueue: Make flush_workqueue() available again to non GPL modules Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 104/134] fs: if a coredump already exists, unlink and recreate with O_EXCL Greg Kroah-Hartman
                   ` (33 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jaewon Kim, Minchan Kim, Mel Gorman,
	Vlastimil Babka, Andrew Morton, Linus Torvalds

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

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

From: Jaewon Kim <jaewon31.kim@samsung.com>

commit c54839a722a02818677bcabe57e957f0ce4f841d upstream.

reclaim_clean_pages_from_list() assumes that shrink_page_list() returns
number of pages removed from the candidate list.  But shrink_page_list()
puts back mlocked pages without passing it to caller and without
counting as nr_reclaimed.  This increases nr_isolated.

To fix this, this patch changes shrink_page_list() to pass unevictable
pages back to caller.  Caller will take care those pages.

Minchan said:

It fixes two issues.

1. With unevictable page, cma_alloc will be successful.

Exactly speaking, cma_alloc of current kernel will fail due to
unevictable pages.

2. fix leaking of NR_ISOLATED counter of vmstat

With it, too_many_isolated works.  Otherwise, it could make hang until
the process get SIGKILL.

Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: Mel Gorman <mgorman@techsingularity.net>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
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>

---
 mm/vmscan.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1190,7 +1190,7 @@ cull_mlocked:
 		if (PageSwapCache(page))
 			try_to_free_swap(page);
 		unlock_page(page);
-		putback_lru_page(page);
+		list_add(&page->lru, &ret_pages);
 		continue;
 
 activate_locked:



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

* [PATCH 4.2 104/134] fs: if a coredump already exists, unlink and recreate with O_EXCL
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (99 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 103/134] vmscan: fix increasing nr_isolated incurred by putback unevictable pages Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 105/134] fs: Dont dump core if the corefile would become world-readable Greg Kroah-Hartman
                   ` (32 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jann Horn, Kees Cook, Al Viro,
	Andrew Morton, Linus Torvalds

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

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

From: Jann Horn <jann@thejh.net>

commit fbb1816942c04429e85dbf4c1a080accc534299e upstream.

It was possible for an attacking user to trick root (or another user) into
writing his coredumps into an attacker-readable, pre-existing file using
rename() or link(), causing the disclosure of secret data from the victim
process' virtual memory.  Depending on the configuration, it was also
possible to trick root into overwriting system files with coredumps.  Fix
that issue by never writing coredumps into existing files.

Requirements for the attack:
 - The attack only applies if the victim's process has a nonzero
   RLIMIT_CORE and is dumpable.
 - The attacker can trick the victim into coredumping into an
   attacker-writable directory D, either because the core_pattern is
   relative and the victim's cwd is attacker-writable or because an
   absolute core_pattern pointing to a world-writable directory is used.
 - The attacker has one of these:
  A: on a system with protected_hardlinks=0:
     execute access to a folder containing a victim-owned,
     attacker-readable file on the same partition as D, and the
     victim-owned file will be deleted before the main part of the attack
     takes place. (In practice, there are lots of files that fulfill
     this condition, e.g. entries in Debian's /var/lib/dpkg/info/.)
     This does not apply to most Linux systems because most distros set
     protected_hardlinks=1.
  B: on a system with protected_hardlinks=1:
     execute access to a folder containing a victim-owned,
     attacker-readable and attacker-writable file on the same partition
     as D, and the victim-owned file will be deleted before the main part
     of the attack takes place.
     (This seems to be uncommon.)
  C: on any system, independent of protected_hardlinks:
     write access to a non-sticky folder containing a victim-owned,
     attacker-readable file on the same partition as D
     (This seems to be uncommon.)

The basic idea is that the attacker moves the victim-owned file to where
he expects the victim process to dump its core.  The victim process dumps
its core into the existing file, and the attacker reads the coredump from
it.

If the attacker can't move the file because he does not have write access
to the containing directory, he can instead link the file to a directory
he controls, then wait for the original link to the file to be deleted
(because the kernel checks that the link count of the corefile is 1).

A less reliable variant that requires D to be non-sticky works with link()
and does not require deletion of the original link: link() the file into
D, but then unlink() it directly before the kernel performs the link count
check.

On systems with protected_hardlinks=0, this variant allows an attacker to
not only gain information from coredumps, but also clobber existing,
victim-writable files with coredumps.  (This could theoretically lead to a
privilege escalation.)

Signed-off-by: Jann Horn <jann@thejh.net>
Cc: Kees Cook <keescook@chromium.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
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>

---
 fs/coredump.c |   38 ++++++++++++++++++++++++++++++++------
 1 file changed, 32 insertions(+), 6 deletions(-)

--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -513,10 +513,10 @@ void do_coredump(const siginfo_t *siginf
 	const struct cred *old_cred;
 	struct cred *cred;
 	int retval = 0;
-	int flag = 0;
 	int ispipe;
 	struct files_struct *displaced;
-	bool need_nonrelative = false;
+	/* require nonrelative corefile path and be extra careful */
+	bool need_suid_safe = false;
 	bool core_dumped = false;
 	static atomic_t core_dump_count = ATOMIC_INIT(0);
 	struct coredump_params cprm = {
@@ -550,9 +550,8 @@ void do_coredump(const siginfo_t *siginf
 	 */
 	if (__get_dumpable(cprm.mm_flags) == SUID_DUMP_ROOT) {
 		/* Setuid core dump mode */
-		flag = O_EXCL;		/* Stop rewrite attacks */
 		cred->fsuid = GLOBAL_ROOT_UID;	/* Dump root private */
-		need_nonrelative = true;
+		need_suid_safe = true;
 	}
 
 	retval = coredump_wait(siginfo->si_signo, &core_state);
@@ -633,7 +632,7 @@ void do_coredump(const siginfo_t *siginf
 		if (cprm.limit < binfmt->min_coredump)
 			goto fail_unlock;
 
-		if (need_nonrelative && cn.corename[0] != '/') {
+		if (need_suid_safe && cn.corename[0] != '/') {
 			printk(KERN_WARNING "Pid %d(%s) can only dump core "\
 				"to fully qualified path!\n",
 				task_tgid_vnr(current), current->comm);
@@ -641,8 +640,35 @@ void do_coredump(const siginfo_t *siginf
 			goto fail_unlock;
 		}
 
+		/*
+		 * Unlink the file if it exists unless this is a SUID
+		 * binary - in that case, we're running around with root
+		 * privs and don't want to unlink another user's coredump.
+		 */
+		if (!need_suid_safe) {
+			mm_segment_t old_fs;
+
+			old_fs = get_fs();
+			set_fs(KERNEL_DS);
+			/*
+			 * If it doesn't exist, that's fine. If there's some
+			 * other problem, we'll catch it at the filp_open().
+			 */
+			(void) sys_unlink((const char __user *)cn.corename);
+			set_fs(old_fs);
+		}
+
+		/*
+		 * There is a race between unlinking and creating the
+		 * file, but if that causes an EEXIST here, that's
+		 * fine - another process raced with us while creating
+		 * the corefile, and the other process won. To userspace,
+		 * what matters is that at least one of the two processes
+		 * writes its coredump successfully, not which one.
+		 */
 		cprm.file = filp_open(cn.corename,
-				 O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE | flag,
+				 O_CREAT | 2 | O_NOFOLLOW |
+				 O_LARGEFILE | O_EXCL,
 				 0600);
 		if (IS_ERR(cprm.file))
 			goto fail_unlock;



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

* [PATCH 4.2 105/134] fs: Dont dump core if the corefile would become world-readable.
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (100 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 104/134] fs: if a coredump already exists, unlink and recreate with O_EXCL Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 106/134] mmc: sdhci-pci: set the clear transfer mode register quirk for O2Micro Greg Kroah-Hartman
                   ` (31 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jann Horn, Kees Cook, Al Viro,
	Andrew Morton, Linus Torvalds

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

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

From: Jann Horn <jann@thejh.net>

commit 40f705a736eac10e7dca7ab5dd5ed675a6df031d upstream.

On a filesystem like vfat, all files are created with the same owner
and mode independent of who created the file. When a vfat filesystem
is mounted with root as owner of all files and read access for everyone,
root's processes left world-readable coredumps on it (but other
users' processes only left empty corefiles when given write access
because of the uid mismatch).

Given that the old behavior was inconsistent and insecure, I don't see
a problem with changing it. Now, all processes refuse to dump core unless
the resulting corefile will only be readable by their owner.

Signed-off-by: Jann Horn <jann@thejh.net>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
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>

---
 fs/coredump.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -685,11 +685,15 @@ void do_coredump(const siginfo_t *siginf
 		if (!S_ISREG(inode->i_mode))
 			goto close_fail;
 		/*
-		 * Dont allow local users get cute and trick others to coredump
-		 * into their pre-created files.
+		 * Don't dump core if the filesystem changed owner or mode
+		 * of the file during file creation. This is an issue when
+		 * a process dumps core while its cwd is e.g. on a vfat
+		 * filesystem.
 		 */
 		if (!uid_eq(inode->i_uid, current_fsuid()))
 			goto close_fail;
+		if ((inode->i_mode & 0677) != 0600)
+			goto close_fail;
 		if (!(cprm.file->f_mode & FMODE_CAN_WRITE))
 			goto close_fail;
 		if (do_truncate(cprm.file->f_path.dentry, 0, 0, cprm.file))



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

* [PATCH 4.2 106/134] mmc: sdhci-pci: set the clear transfer mode register quirk for O2Micro
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (101 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 105/134] fs: Dont dump core if the corefile would become world-readable Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:55 ` [PATCH 4.2 107/134] mmc: sdhci-of-esdhc: add workaround for pre divider initial value Greg Kroah-Hartman
                   ` (30 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Peter Guo, Adam Lee, Ulf Hansson

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

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

From: Adam Lee <adam.lee@canonical.com>

commit 143b648ddf1583905fa15d32be27a31442fc7933 upstream.

This patch fixes MMC not working issue on O2Micro/BayHub Host, which
requires transfer mode register to be cleared when sending no DMA
command.

Signed-off-by: Peter Guo <peter.guo@bayhubtech.com>
Signed-off-by: Adam Lee <adam.lee@canonical.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/mmc/host/sdhci-pci.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -618,6 +618,7 @@ static int jmicron_resume(struct sdhci_p
 static const struct sdhci_pci_fixes sdhci_o2 = {
 	.probe = sdhci_pci_o2_probe,
 	.quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
+	.quirks2 = SDHCI_QUIRK2_CLEAR_TRANSFERMODE_REG_BEFORE_CMD,
 	.probe_slot = sdhci_pci_o2_probe_slot,
 	.resume = sdhci_pci_o2_resume,
 };



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

* [PATCH 4.2 107/134] mmc: sdhci-of-esdhc: add workaround for pre divider initial value
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (102 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 106/134] mmc: sdhci-pci: set the clear transfer mode register quirk for O2Micro Greg Kroah-Hartman
@ 2015-09-26 20:55 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 108/134] mmc: sdhci: also get preset value and driver type for MMC_DDR52 Greg Kroah-Hartman
                   ` (29 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Yangbo Lu, Joakim Tjernlund, Ulf Hansson

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

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

From: Yangbo Lu <yangbo.lu@freescale.com>

commit 77bd2f6f6c65b4ad259394d416855ed561f21e8f upstream.

For eSDHC(version < 2.3), the pre divider only could divide base clock
by 2 at least. Add workaround for this to avoid unexpected issue.

Signed-off-by: Yangbo Lu <yangbo.lu@freescale.com>
Acked-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Fixes: bd455029d01c ("mmc: sdhci-of-esdhc: Pre divider starts at 1")
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/mmc/host/sdhci-of-esdhc.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -208,6 +208,12 @@ static void esdhc_of_set_clock(struct sd
 	if (clock == 0)
 		return;
 
+	/* Workaround to start pre_div at 2 for VNN < VENDOR_V_23 */
+	temp = esdhc_readw(host, SDHCI_HOST_VERSION);
+	temp = (temp & SDHCI_VENDOR_VER_MASK) >> SDHCI_VENDOR_VER_SHIFT;
+	if (temp < VENDOR_V_23)
+		pre_div = 2;
+
 	/* Workaround to reduce the clock frequency for p1010 esdhc */
 	if (of_find_compatible_node(NULL, NULL, "fsl,p1010-esdhc")) {
 		if (clock > 20000000)



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

* [PATCH 4.2 108/134] mmc: sdhci: also get preset value and driver type for MMC_DDR52
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (103 preceding siblings ...)
  2015-09-26 20:55 ` [PATCH 4.2 107/134] mmc: sdhci-of-esdhc: add workaround for pre divider initial value Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 109/134] mmc: sdhci: fix dma memory leak in sdhci_pre_req() Greg Kroah-Hartman
                   ` (28 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Jisheng Zhang, Ulf Hansson

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

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

From: Jisheng Zhang <jszhang@marvell.com>

commit 0dafa60eb2506617e6968b97cc5a44914a7fb1a6 upstream.

commit bb8175a8aa42 ("mmc: sdhci: clarify DDR timing mode between
SD-UHS and eMMC") added MMC_DDR52 as eMMC's DDR mode to be
distinguished from SD-UHS, but it missed setting driver type for
MMC_DDR52 timing mode.

So sometimes we get the following error on Marvell BG2Q DMP board:

[    1.559598] mmcblk0: error -84 transferring data, sector 0, nr 8, cmd
response 0x900, card status 0xb00
[    1.569314] mmcblk0: retrying using single block read
[    1.575676] mmcblk0: error -84 transferring data, sector 2, nr 6, cmd
response 0x900, card status 0x0
[    1.585202] blk_update_request: I/O error, dev mmcblk0, sector 2
[    1.591818] mmcblk0: error -84 transferring data, sector 3, nr 5, cmd
response 0x900, card status 0x0
[    1.601341] blk_update_request: I/O error, dev mmcblk0, sector 3

This patches fixes this by adding the missing driver type setting.

Fixes: bb8175a8aa42 ("mmc: sdhci: clarify DDR timing mode ...")
Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1132,6 +1132,7 @@ static u16 sdhci_get_preset_value(struct
 		preset = sdhci_readw(host, SDHCI_PRESET_FOR_SDR104);
 		break;
 	case MMC_TIMING_UHS_DDR50:
+	case MMC_TIMING_MMC_DDR52:
 		preset = sdhci_readw(host, SDHCI_PRESET_FOR_DDR50);
 		break;
 	case MMC_TIMING_MMC_HS400:
@@ -1559,7 +1560,8 @@ static void sdhci_do_set_ios(struct sdhc
 				 (ios->timing == MMC_TIMING_UHS_SDR25) ||
 				 (ios->timing == MMC_TIMING_UHS_SDR50) ||
 				 (ios->timing == MMC_TIMING_UHS_SDR104) ||
-				 (ios->timing == MMC_TIMING_UHS_DDR50))) {
+				 (ios->timing == MMC_TIMING_UHS_DDR50) ||
+				 (ios->timing == MMC_TIMING_MMC_DDR52))) {
 			u16 preset;
 
 			sdhci_enable_preset_value(host, true);



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

* [PATCH 4.2 109/134] mmc: sdhci: fix dma memory leak in sdhci_pre_req()
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (104 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 108/134] mmc: sdhci: also get preset value and driver type for MMC_DDR52 Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 110/134] mmc: core: fix race condition in mmc_wait_data_done Greg Kroah-Hartman
                   ` (27 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Haibo Chen, Ulf Hansson

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

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

From: Haibo Chen <haibo.chen@freescale.com>

commit d31911b9374a76560d2c8ea4aa6ce5781621e81d upstream.

Currently one mrq->data maybe execute dma_map_sg() twice
when mmc subsystem prepare over one new request, and the
following log show up:
	sdhci[sdhci_pre_dma_transfer] invalid cookie: 24, next-cookie 25

In this condition, mrq->date map a dma-memory(1) in sdhci_pre_req
for the first time, and map another dma-memory(2) in sdhci_prepare_data
for the second time. But driver only unmap the dma-memory(2), and
dma-memory(1) never unmapped, which cause the dma memory leak issue.

This patch use another method to map the dma memory for the mrq->data
which can fix this dma memory leak issue.

Fixes: 348487cb28e6 ("mmc: sdhci: use pipeline mmc requests to improve performance")
Reported-and-tested-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Haibo Chen <haibo.chen@freescale.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/mmc/host/sdhci.c |   67 +++++++++++++++++------------------------------
 drivers/mmc/host/sdhci.h |    8 ++---
 2 files changed, 29 insertions(+), 46 deletions(-)

--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -54,8 +54,7 @@ static void sdhci_finish_command(struct
 static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode);
 static void sdhci_enable_preset_value(struct sdhci_host *host, bool enable);
 static int sdhci_pre_dma_transfer(struct sdhci_host *host,
-					struct mmc_data *data,
-					struct sdhci_host_next *next);
+					struct mmc_data *data);
 static int sdhci_do_get_cd(struct sdhci_host *host);
 
 #ifdef CONFIG_PM
@@ -496,7 +495,7 @@ static int sdhci_adma_table_pre(struct s
 		goto fail;
 	BUG_ON(host->align_addr & host->align_mask);
 
-	host->sg_count = sdhci_pre_dma_transfer(host, data, NULL);
+	host->sg_count = sdhci_pre_dma_transfer(host, data);
 	if (host->sg_count < 0)
 		goto unmap_align;
 
@@ -635,9 +634,11 @@ static void sdhci_adma_table_post(struct
 		}
 	}
 
-	if (!data->host_cookie)
+	if (data->host_cookie == COOKIE_MAPPED) {
 		dma_unmap_sg(mmc_dev(host->mmc), data->sg,
 			data->sg_len, direction);
+		data->host_cookie = COOKIE_UNMAPPED;
+	}
 }
 
 static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd)
@@ -833,7 +834,7 @@ static void sdhci_prepare_data(struct sd
 		} else {
 			int sg_cnt;
 
-			sg_cnt = sdhci_pre_dma_transfer(host, data, NULL);
+			sg_cnt = sdhci_pre_dma_transfer(host, data);
 			if (sg_cnt <= 0) {
 				/*
 				 * This only happens when someone fed
@@ -949,11 +950,13 @@ static void sdhci_finish_data(struct sdh
 		if (host->flags & SDHCI_USE_ADMA)
 			sdhci_adma_table_post(host, data);
 		else {
-			if (!data->host_cookie)
+			if (data->host_cookie == COOKIE_MAPPED) {
 				dma_unmap_sg(mmc_dev(host->mmc),
 					data->sg, data->sg_len,
 					(data->flags & MMC_DATA_READ) ?
 					DMA_FROM_DEVICE : DMA_TO_DEVICE);
+				data->host_cookie = COOKIE_UNMAPPED;
+			}
 		}
 	}
 
@@ -2099,49 +2102,36 @@ static void sdhci_post_req(struct mmc_ho
 	struct mmc_data *data = mrq->data;
 
 	if (host->flags & SDHCI_REQ_USE_DMA) {
-		if (data->host_cookie)
+		if (data->host_cookie == COOKIE_GIVEN ||
+				data->host_cookie == COOKIE_MAPPED)
 			dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
 					 data->flags & MMC_DATA_WRITE ?
 					 DMA_TO_DEVICE : DMA_FROM_DEVICE);
-		mrq->data->host_cookie = 0;
+		data->host_cookie = COOKIE_UNMAPPED;
 	}
 }
 
 static int sdhci_pre_dma_transfer(struct sdhci_host *host,
-				       struct mmc_data *data,
-				       struct sdhci_host_next *next)
+				       struct mmc_data *data)
 {
 	int sg_count;
 
-	if (!next && data->host_cookie &&
-	    data->host_cookie != host->next_data.cookie) {
-		pr_debug(DRIVER_NAME "[%s] invalid cookie: %d, next-cookie %d\n",
-			__func__, data->host_cookie, host->next_data.cookie);
-		data->host_cookie = 0;
+	if (data->host_cookie == COOKIE_MAPPED) {
+		data->host_cookie = COOKIE_GIVEN;
+		return data->sg_count;
 	}
 
-	/* Check if next job is already prepared */
-	if (next ||
-	    (!next && data->host_cookie != host->next_data.cookie)) {
-		sg_count = dma_map_sg(mmc_dev(host->mmc), data->sg,
-				     data->sg_len,
-				     data->flags & MMC_DATA_WRITE ?
-				     DMA_TO_DEVICE : DMA_FROM_DEVICE);
-
-	} else {
-		sg_count = host->next_data.sg_count;
-		host->next_data.sg_count = 0;
-	}
+	WARN_ON(data->host_cookie == COOKIE_GIVEN);
 
+	sg_count = dma_map_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
+				data->flags & MMC_DATA_WRITE ?
+				DMA_TO_DEVICE : DMA_FROM_DEVICE);
 
 	if (sg_count == 0)
-		return -EINVAL;
+		return -ENOSPC;
 
-	if (next) {
-		next->sg_count = sg_count;
-		data->host_cookie = ++next->cookie < 0 ? 1 : next->cookie;
-	} else
-		host->sg_count = sg_count;
+	data->sg_count = sg_count;
+	data->host_cookie = COOKIE_MAPPED;
 
 	return sg_count;
 }
@@ -2151,16 +2141,10 @@ static void sdhci_pre_req(struct mmc_hos
 {
 	struct sdhci_host *host = mmc_priv(mmc);
 
-	if (mrq->data->host_cookie) {
-		mrq->data->host_cookie = 0;
-		return;
-	}
+	mrq->data->host_cookie = COOKIE_UNMAPPED;
 
 	if (host->flags & SDHCI_REQ_USE_DMA)
-		if (sdhci_pre_dma_transfer(host,
-					mrq->data,
-					&host->next_data) < 0)
-			mrq->data->host_cookie = 0;
+		sdhci_pre_dma_transfer(host, mrq->data);
 }
 
 static void sdhci_card_event(struct mmc_host *mmc)
@@ -3032,7 +3016,6 @@ int sdhci_add_host(struct sdhci_host *ho
 		host->max_clk = host->ops->get_max_clock(host);
 	}
 
-	host->next_data.cookie = 1;
 	/*
 	 * In case of Host Controller v3.00, find out whether clock
 	 * multiplier is supported.
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -309,9 +309,10 @@ struct sdhci_adma2_64_desc {
  */
 #define SDHCI_MAX_SEGS		128
 
-struct sdhci_host_next {
-	unsigned int	sg_count;
-	s32		cookie;
+enum sdhci_cookie {
+	COOKIE_UNMAPPED,
+	COOKIE_MAPPED,
+	COOKIE_GIVEN,
 };
 
 struct sdhci_host {
@@ -503,7 +504,6 @@ struct sdhci_host {
 	unsigned int		tuning_mode;	/* Re-tuning mode supported by host */
 #define SDHCI_TUNING_MODE_1	0
 
-	struct sdhci_host_next	next_data;
 	unsigned long private[0] ____cacheline_aligned;
 };
 



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

* [PATCH 4.2 110/134] mmc: core: fix race condition in mmc_wait_data_done
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (105 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 109/134] mmc: sdhci: fix dma memory leak in sdhci_pre_req() Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 111/134] iommu/fsl: Really fix init section(s) content Greg Kroah-Hartman
                   ` (26 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jialing Fu, Shawn Lin, Ulf Hansson

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

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

From: Jialing Fu <jlfu@marvell.com>

commit 71f8a4b81d040b3d094424197ca2f1bf811b1245 upstream.

The following panic is captured in ker3.14, but the issue still exists
in latest kernel.
---------------------------------------------------------------------
[   20.738217] c0 3136 (Compiler) Unable to handle kernel NULL pointer dereference
at virtual address 00000578
......
[   20.738499] c0 3136 (Compiler) PC is at _raw_spin_lock_irqsave+0x24/0x60
[   20.738527] c0 3136 (Compiler) LR is at _raw_spin_lock_irqsave+0x20/0x60
[   20.740134] c0 3136 (Compiler) Call trace:
[   20.740165] c0 3136 (Compiler) [<ffffffc0008ee900>] _raw_spin_lock_irqsave+0x24/0x60
[   20.740200] c0 3136 (Compiler) [<ffffffc0000dd024>] __wake_up+0x1c/0x54
[   20.740230] c0 3136 (Compiler) [<ffffffc000639414>] mmc_wait_data_done+0x28/0x34
[   20.740262] c0 3136 (Compiler) [<ffffffc0006391a0>] mmc_request_done+0xa4/0x220
[   20.740314] c0 3136 (Compiler) [<ffffffc000656894>] sdhci_tasklet_finish+0xac/0x264
[   20.740352] c0 3136 (Compiler) [<ffffffc0000a2b58>] tasklet_action+0xa0/0x158
[   20.740382] c0 3136 (Compiler) [<ffffffc0000a2078>] __do_softirq+0x10c/0x2e4
[   20.740411] c0 3136 (Compiler) [<ffffffc0000a24bc>] irq_exit+0x8c/0xc0
[   20.740439] c0 3136 (Compiler) [<ffffffc00008489c>] handle_IRQ+0x48/0xac
[   20.740469] c0 3136 (Compiler) [<ffffffc000081428>] gic_handle_irq+0x38/0x7c
----------------------------------------------------------------------
Because in SMP, "mrq" has race condition between below two paths:
path1: CPU0: <tasklet context>
  static void mmc_wait_data_done(struct mmc_request *mrq)
  {
     mrq->host->context_info.is_done_rcv = true;
     //
     // If CPU0 has just finished "is_done_rcv = true" in path1, and at
     // this moment, IRQ or ICache line missing happens in CPU0.
     // What happens in CPU1 (path2)?
     //
     // If the mmcqd thread in CPU1(path2) hasn't entered to sleep mode:
     // path2 would have chance to break from wait_event_interruptible
     // in mmc_wait_for_data_req_done and continue to run for next
     // mmc_request (mmc_blk_rw_rq_prep).
     //
     // Within mmc_blk_rq_prep, mrq is cleared to 0.
     // If below line still gets host from "mrq" as the result of
     // compiler, the panic happens as we traced.
     wake_up_interruptible(&mrq->host->context_info.wait);
  }

path2: CPU1: <The mmcqd thread runs mmc_queue_thread>
  static int mmc_wait_for_data_req_done(...
  {
     ...
     while (1) {
           wait_event_interruptible(context_info->wait,
                   (context_info->is_done_rcv ||
                    context_info->is_new_req));
     	   static void mmc_blk_rw_rq_prep(...
           {
           ...
           memset(brq, 0, sizeof(struct mmc_blk_request));

This issue happens very coincidentally; however adding mdelay(1) in
mmc_wait_data_done as below could duplicate it easily.

   static void mmc_wait_data_done(struct mmc_request *mrq)
   {
     mrq->host->context_info.is_done_rcv = true;
+    mdelay(1);
     wake_up_interruptible(&mrq->host->context_info.wait);
    }

At runtime, IRQ or ICache line missing may just happen at the same place
of the mdelay(1).

This patch gets the mmc_context_info at the beginning of function, it can
avoid this race condition.

Signed-off-by: Jialing Fu <jlfu@marvell.com>
Tested-by: Shawn Lin <shawn.lin@rock-chips.com>
Fixes: 2220eedfd7ae ("mmc: fix async request mechanism ....")
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -358,8 +358,10 @@ EXPORT_SYMBOL(mmc_start_bkops);
  */
 static void mmc_wait_data_done(struct mmc_request *mrq)
 {
-	mrq->host->context_info.is_done_rcv = true;
-	wake_up_interruptible(&mrq->host->context_info.wait);
+	struct mmc_context_info *context_info = &mrq->host->context_info;
+
+	context_info->is_done_rcv = true;
+	wake_up_interruptible(&context_info->wait);
 }
 
 static void mmc_wait_done(struct mmc_request *mrq)



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

* [PATCH 4.2 111/134] iommu/fsl: Really fix init section(s) content
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (106 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 110/134] mmc: core: fix race condition in mmc_wait_data_done Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 112/134] iommu/io-pgtable-arm: Unmap and free table when overwriting with block Greg Kroah-Hartman
                   ` (25 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Emil Medve, Varun Sethi,
	Madalin Bucur, Joerg Roedel

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

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

From: Emil Medve <Emilian.Medve@Freescale.com>

commit 57fb907da89977640ef183556a621336c1348fa0 upstream.

'0f1fb99 iommu/fsl: Fix section mismatch' was intended to address the modpost
warning and the potential crash. Crash which is actually easy to trigger with a
'unbind' followed by a 'bind' sequence. The fix is wrong as
fsl_of_pamu_driver.driver gets added by bus_add_driver() to a couple of
klist(s) which become invalid/corrupted as soon as the init sections are freed.
Depending on when/how the init sections storage is reused various/random errors
and crashes will happen

'cd70d46 iommu/fsl: Various cleanups' contains annotations that go further down
the wrong path laid by '0f1fb99 iommu/fsl: Fix section mismatch'

Now remove all the incorrect annotations from the above mentioned patches (not
exactly a revert) and those previously existing in the code, This fixes the
modpost warning(s), the unbind/bind sequence crashes and the random
errors/crashes

Fixes: 0f1fb99b62ce ("iommu/fsl: Fix section mismatch")
Fixes: cd70d4659ff3 ("iommu/fsl: Various cleanups")
Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
Acked-by: Varun Sethi <Varun.Sethi@freescale.com>
Tested-by: Madalin Bucur <Madalin.Bucur@freescale.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/iommu/fsl_pamu.c |   26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

--- a/drivers/iommu/fsl_pamu.c
+++ b/drivers/iommu/fsl_pamu.c
@@ -41,7 +41,6 @@ struct pamu_isr_data {
 
 static struct paace *ppaact;
 static struct paace *spaact;
-static struct ome *omt __initdata;
 
 /*
  * Table for matching compatible strings, for device tree
@@ -50,7 +49,7 @@ static struct ome *omt __initdata;
  * SOCs. For the older SOCs "fsl,qoriq-device-config-1.0"
  * string would be used.
  */
-static const struct of_device_id guts_device_ids[] __initconst = {
+static const struct of_device_id guts_device_ids[] = {
 	{ .compatible = "fsl,qoriq-device-config-1.0", },
 	{ .compatible = "fsl,qoriq-device-config-2.0", },
 	{}
@@ -599,7 +598,7 @@ found_cpu_node:
  * Memory accesses to QMAN and BMAN private memory need not be coherent, so
  * clear the PAACE entry coherency attribute for them.
  */
-static void __init setup_qbman_paace(struct paace *ppaace, int  paace_type)
+static void setup_qbman_paace(struct paace *ppaace, int  paace_type)
 {
 	switch (paace_type) {
 	case QMAN_PAACE:
@@ -629,7 +628,7 @@ static void __init setup_qbman_paace(str
  * this table to translate device transaction to appropriate corenet
  * transaction.
  */
-static void __init setup_omt(struct ome *omt)
+static void setup_omt(struct ome *omt)
 {
 	struct ome *ome;
 
@@ -666,7 +665,7 @@ static void __init setup_omt(struct ome
  * Get the maximum number of PAACT table entries
  * and subwindows supported by PAMU
  */
-static void __init get_pamu_cap_values(unsigned long pamu_reg_base)
+static void get_pamu_cap_values(unsigned long pamu_reg_base)
 {
 	u32 pc_val;
 
@@ -676,9 +675,9 @@ static void __init get_pamu_cap_values(u
 }
 
 /* Setup PAMU registers pointing to PAACT, SPAACT and OMT */
-static int __init setup_one_pamu(unsigned long pamu_reg_base, unsigned long pamu_reg_size,
-				 phys_addr_t ppaact_phys, phys_addr_t spaact_phys,
-				 phys_addr_t omt_phys)
+static int setup_one_pamu(unsigned long pamu_reg_base, unsigned long pamu_reg_size,
+			  phys_addr_t ppaact_phys, phys_addr_t spaact_phys,
+			  phys_addr_t omt_phys)
 {
 	u32 *pc;
 	struct pamu_mmap_regs *pamu_regs;
@@ -720,7 +719,7 @@ static int __init setup_one_pamu(unsigne
 }
 
 /* Enable all device LIODNS */
-static void __init setup_liodns(void)
+static void setup_liodns(void)
 {
 	int i, len;
 	struct paace *ppaace;
@@ -846,7 +845,7 @@ struct ccsr_law {
 /*
  * Create a coherence subdomain for a given memory block.
  */
-static int __init create_csd(phys_addr_t phys, size_t size, u32 csd_port_id)
+static int create_csd(phys_addr_t phys, size_t size, u32 csd_port_id)
 {
 	struct device_node *np;
 	const __be32 *iprop;
@@ -988,7 +987,7 @@ error:
 static const struct {
 	u32 svr;
 	u32 port_id;
-} port_id_map[] __initconst = {
+} port_id_map[] = {
 	{(SVR_P2040 << 8) | 0x10, 0xFF000000},	/* P2040 1.0 */
 	{(SVR_P2040 << 8) | 0x11, 0xFF000000},	/* P2040 1.1 */
 	{(SVR_P2041 << 8) | 0x10, 0xFF000000},	/* P2041 1.0 */
@@ -1006,7 +1005,7 @@ static const struct {
 
 #define SVR_SECURITY	0x80000	/* The Security (E) bit */
 
-static int __init fsl_pamu_probe(struct platform_device *pdev)
+static int fsl_pamu_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	void __iomem *pamu_regs = NULL;
@@ -1022,6 +1021,7 @@ static int __init fsl_pamu_probe(struct
 	int irq;
 	phys_addr_t ppaact_phys;
 	phys_addr_t spaact_phys;
+	struct ome *omt;
 	phys_addr_t omt_phys;
 	size_t mem_size = 0;
 	unsigned int order = 0;
@@ -1200,7 +1200,7 @@ error:
 	return ret;
 }
 
-static struct platform_driver fsl_of_pamu_driver __initdata = {
+static struct platform_driver fsl_of_pamu_driver = {
 	.driver = {
 		.name = "fsl-of-pamu",
 	},



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

* [PATCH 4.2 112/134] iommu/io-pgtable-arm: Unmap and free table when overwriting with block
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (107 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 111/134] iommu/fsl: Really fix init section(s) content Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 113/134] iommu/tegra-smmu: Parameterize number of TLB lines Greg Kroah-Hartman
                   ` (24 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Brian Starkey, Will Deacon, Joerg Roedel

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

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

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

commit cf27ec930be906e142c752f9161197d69ca534d7 upstream.

When installing a block mapping, we unconditionally overwrite a non-leaf
PTE if we find one. However, this can cause a problem if the following
sequence of events occur:

  (1) iommu_map called for a 4k (i.e. PAGE_SIZE) mapping at some address
      - We initialise the page table all the way down to a leaf entry
      - No TLB maintenance is required, because we're going from invalid
        to valid.

  (2) iommu_unmap is called on the mapping installed in (1)
      - We walk the page table to the final (leaf) entry and zero it
      - We only changed a valid leaf entry, so we invalidate leaf-only

  (3) iommu_map is called on the same address as (1), but this time for
      a 2MB (i.e. BLOCK_SIZE) mapping)
      - We walk the page table down to the penultimate level, where we
        find a table entry
      - We overwrite the table entry with a block mapping and return
        without any TLB maintenance and without freeing the memory used
        by the now-orphaned table.

This last step can lead to a walk-cache caching the overwritten table
entry, causing unexpected faults when the new mapping is accessed by a
device. One way to fix this would be to collapse the page table when
freeing the last page at a given level, but this would require expensive
iteration on every map call. Instead, this patch detects the case when
we are overwriting a table entry and explicitly unmaps the table first,
which takes care of both freeing and TLB invalidation.

Reported-by: Brian Starkey <brian.starkey@arm.com>
Tested-by: Brian Starkey <brian.starkey@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/iommu/io-pgtable-arm.c |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

--- a/drivers/iommu/io-pgtable-arm.c
+++ b/drivers/iommu/io-pgtable-arm.c
@@ -200,6 +200,10 @@ typedef u64 arm_lpae_iopte;
 
 static bool selftest_running = false;
 
+static int __arm_lpae_unmap(struct arm_lpae_io_pgtable *data,
+			    unsigned long iova, size_t size, int lvl,
+			    arm_lpae_iopte *ptep);
+
 static int arm_lpae_init_pte(struct arm_lpae_io_pgtable *data,
 			     unsigned long iova, phys_addr_t paddr,
 			     arm_lpae_iopte prot, int lvl,
@@ -207,10 +211,21 @@ static int arm_lpae_init_pte(struct arm_
 {
 	arm_lpae_iopte pte = prot;
 
-	/* We require an unmap first */
 	if (iopte_leaf(*ptep, lvl)) {
+		/* We require an unmap first */
 		WARN_ON(!selftest_running);
 		return -EEXIST;
+	} else if (iopte_type(*ptep, lvl) == ARM_LPAE_PTE_TYPE_TABLE) {
+		/*
+		 * We need to unmap and free the old table before
+		 * overwriting it with a block entry.
+		 */
+		arm_lpae_iopte *tblp;
+		size_t sz = ARM_LPAE_BLOCK_SIZE(lvl, data);
+
+		tblp = ptep - ARM_LPAE_LVL_IDX(iova, lvl, data);
+		if (WARN_ON(__arm_lpae_unmap(data, iova, sz, lvl, tblp) != sz))
+			return -EINVAL;
 	}
 
 	if (data->iop.cfg.quirks & IO_PGTABLE_QUIRK_ARM_NS)



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

* [PATCH 4.2 113/134] iommu/tegra-smmu: Parameterize number of TLB lines
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (108 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 112/134] iommu/io-pgtable-arm: Unmap and free table when overwriting with block Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 114/134] iommu/vt-d: Really use upper context table when necessary Greg Kroah-Hartman
                   ` (23 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Thierry Reding

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

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

From: Thierry Reding <treding@nvidia.com>

commit 11cec15bf3fb498206ef63b1fa26c27689e02d0e upstream.

The number of TLB lines was increased from 16 on Tegra30 to 32 on
Tegra114 and later. Parameterize the value so that the initial default
can be set accordingly.

On Tegra30, initializing the value to 32 would effectively disable the
TLB and hence cause massive latencies for memory accesses translated
through the SMMU. This is especially noticeable for isochronuous clients
such as display, whose FIFOs would continuously underrun.

Fixes: 891846516317 ("memory: Add NVIDIA Tegra memory controller support")
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/iommu/tegra-smmu.c      |    9 +++++++--
 drivers/memory/tegra/tegra114.c |    1 +
 drivers/memory/tegra/tegra124.c |    1 +
 drivers/memory/tegra/tegra30.c  |    1 +
 include/soc/tegra/mc.h          |    1 +
 5 files changed, 11 insertions(+), 2 deletions(-)

--- a/drivers/iommu/tegra-smmu.c
+++ b/drivers/iommu/tegra-smmu.c
@@ -27,6 +27,7 @@ struct tegra_smmu {
 	const struct tegra_smmu_soc *soc;
 
 	unsigned long pfn_mask;
+	unsigned long tlb_mask;
 
 	unsigned long *asids;
 	struct mutex lock;
@@ -68,7 +69,8 @@ static inline u32 smmu_readl(struct tegr
 #define SMMU_TLB_CONFIG 0x14
 #define  SMMU_TLB_CONFIG_HIT_UNDER_MISS (1 << 29)
 #define  SMMU_TLB_CONFIG_ROUND_ROBIN_ARBITRATION (1 << 28)
-#define  SMMU_TLB_CONFIG_ACTIVE_LINES(x) ((x) & 0x3f)
+#define  SMMU_TLB_CONFIG_ACTIVE_LINES(smmu) \
+	((smmu)->soc->num_tlb_lines & (smmu)->tlb_mask)
 
 #define SMMU_PTC_CONFIG 0x18
 #define  SMMU_PTC_CONFIG_ENABLE (1 << 29)
@@ -816,6 +818,9 @@ struct tegra_smmu *tegra_smmu_probe(stru
 	smmu->pfn_mask = BIT_MASK(mc->soc->num_address_bits - PAGE_SHIFT) - 1;
 	dev_dbg(dev, "address bits: %u, PFN mask: %#lx\n",
 		mc->soc->num_address_bits, smmu->pfn_mask);
+	smmu->tlb_mask = (smmu->soc->num_tlb_lines << 1) - 1;
+	dev_dbg(dev, "TLB lines: %u, mask: %#lx\n", smmu->soc->num_tlb_lines,
+		smmu->tlb_mask);
 
 	value = SMMU_PTC_CONFIG_ENABLE | SMMU_PTC_CONFIG_INDEX_MAP(0x3f);
 
@@ -825,7 +830,7 @@ struct tegra_smmu *tegra_smmu_probe(stru
 	smmu_writel(smmu, value, SMMU_PTC_CONFIG);
 
 	value = SMMU_TLB_CONFIG_HIT_UNDER_MISS |
-		SMMU_TLB_CONFIG_ACTIVE_LINES(0x20);
+		SMMU_TLB_CONFIG_ACTIVE_LINES(smmu);
 
 	if (soc->supports_round_robin_arbitration)
 		value |= SMMU_TLB_CONFIG_ROUND_ROBIN_ARBITRATION;
--- a/drivers/memory/tegra/tegra114.c
+++ b/drivers/memory/tegra/tegra114.c
@@ -935,6 +935,7 @@ static const struct tegra_smmu_soc tegra
 	.num_swgroups = ARRAY_SIZE(tegra114_swgroups),
 	.supports_round_robin_arbitration = false,
 	.supports_request_limit = false,
+	.num_tlb_lines = 32,
 	.num_asids = 4,
 	.ops = &tegra114_smmu_ops,
 };
--- a/drivers/memory/tegra/tegra124.c
+++ b/drivers/memory/tegra/tegra124.c
@@ -1023,6 +1023,7 @@ static const struct tegra_smmu_soc tegra
 	.num_swgroups = ARRAY_SIZE(tegra124_swgroups),
 	.supports_round_robin_arbitration = true,
 	.supports_request_limit = true,
+	.num_tlb_lines = 32,
 	.num_asids = 128,
 	.ops = &tegra124_smmu_ops,
 };
--- a/drivers/memory/tegra/tegra30.c
+++ b/drivers/memory/tegra/tegra30.c
@@ -957,6 +957,7 @@ static const struct tegra_smmu_soc tegra
 	.num_swgroups = ARRAY_SIZE(tegra30_swgroups),
 	.supports_round_robin_arbitration = false,
 	.supports_request_limit = false,
+	.num_tlb_lines = 16,
 	.num_asids = 4,
 	.ops = &tegra30_smmu_ops,
 };
--- a/include/soc/tegra/mc.h
+++ b/include/soc/tegra/mc.h
@@ -66,6 +66,7 @@ struct tegra_smmu_soc {
 	bool supports_round_robin_arbitration;
 	bool supports_request_limit;
 
+	unsigned int num_tlb_lines;
 	unsigned int num_asids;
 
 	const struct tegra_smmu_ops *ops;



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

* [PATCH 4.2 114/134] iommu/vt-d: Really use upper context table when necessary
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (109 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 113/134] iommu/tegra-smmu: Parameterize number of TLB lines Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 115/134] eCryptfs: Invalidate dcache entries when lower i_nlink is zero Greg Kroah-Hartman
                   ` (22 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Xiao, Nan, Joerg Roedel

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

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

From: Joerg Roedel <jroedel@suse.de>

commit 4df4eab168c1c4058603be55a3169d4a45779cc0 upstream.

There is a bug in iommu_context_addr() which will always use
the lower context table, even when the upper context table
needs to be used. Fix this issue.

Fixes: 03ecc32c5274 ("iommu/vt-d: support extended root and context entries")
Reported-by: Xiao, Nan <nan.xiao@hp.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/iommu/intel-iommu.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -755,6 +755,7 @@ static inline struct context_entry *iomm
 	struct context_entry *context;
 	u64 *entry;
 
+	entry = &root->lo;
 	if (ecs_enabled(iommu)) {
 		if (devfn >= 0x80) {
 			devfn -= 0x80;
@@ -762,7 +763,6 @@ static inline struct context_entry *iomm
 		}
 		devfn *= 2;
 	}
-	entry = &root->lo;
 	if (*entry & 1)
 		context = phys_to_virt(*entry & VTD_PAGE_MASK);
 	else {



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

* [PATCH 4.2 115/134] eCryptfs: Invalidate dcache entries when lower i_nlink is zero
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (110 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 114/134] iommu/vt-d: Really use upper context table when necessary Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 116/134] hfs: fix B-tree corruption after insertion at position 0 Greg Kroah-Hartman
                   ` (21 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Tyler Hicks, Richard Weinberger

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

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

From: Tyler Hicks <tyhicks@canonical.com>

commit 5556e7e6d30e8e9b5ee51b0e5edd526ee80e5e36 upstream.

Consider eCryptfs dcache entries to be stale when the corresponding
lower inode's i_nlink count is zero. This solves a problem caused by the
lower inode being directly modified, without going through the eCryptfs
mount, leaving stale eCryptfs dentries cached and the eCryptfs inode's
i_nlink count not being cleared.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Reported-by: Richard Weinberger <richard@nod.at>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ecryptfs/dentry.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

--- a/fs/ecryptfs/dentry.c
+++ b/fs/ecryptfs/dentry.c
@@ -45,20 +45,20 @@
 static int ecryptfs_d_revalidate(struct dentry *dentry, unsigned int flags)
 {
 	struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry);
-	int rc;
-
-	if (!(lower_dentry->d_flags & DCACHE_OP_REVALIDATE))
-		return 1;
+	int rc = 1;
 
 	if (flags & LOOKUP_RCU)
 		return -ECHILD;
 
-	rc = lower_dentry->d_op->d_revalidate(lower_dentry, flags);
+	if (lower_dentry->d_flags & DCACHE_OP_REVALIDATE)
+		rc = lower_dentry->d_op->d_revalidate(lower_dentry, flags);
+
 	if (d_really_is_positive(dentry)) {
-		struct inode *lower_inode =
-			ecryptfs_inode_to_lower(d_inode(dentry));
+		struct inode *inode = d_inode(dentry);
 
-		fsstack_copy_attr_all(d_inode(dentry), lower_inode);
+		fsstack_copy_attr_all(inode, ecryptfs_inode_to_lower(inode));
+		if (!inode->i_nlink)
+			return 0;
 	}
 	return rc;
 }



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

* [PATCH 4.2 116/134] hfs: fix B-tree corruption after insertion at position 0
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (111 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 115/134] eCryptfs: Invalidate dcache entries when lower i_nlink is zero Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 117/134] i2c: xgene-slimpro: dma_mapping_error() doesnt return an error code Greg Kroah-Hartman
                   ` (20 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Hin-Tak Leung, Sergei Antonov,
	Joe Perches, Vyacheslav Dubeyko, Anton Altaparmakov, Al Viro,
	Christoph Hellwig, Andrew Morton, Linus Torvalds

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

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

From: Hin-Tak Leung <htl10@users.sourceforge.net>

commit b4cc0efea4f0bfa2477c56af406cfcf3d3e58680 upstream.

Fix B-tree corruption when a new record is inserted at position 0 in the
node in hfs_brec_insert().

This is an identical change to the corresponding hfs b-tree code to Sergei
Antonov's "hfsplus: fix B-tree corruption after insertion at position 0",
to keep similar code paths in the hfs and hfsplus drivers in sync, where
appropriate.

Signed-off-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Cc: Sergei Antonov <saproj@gmail.com>
Cc: Joe Perches <joe@perches.com>
Reviewed-by: Vyacheslav Dubeyko <slava@dubeyko.com>
Cc: Anton Altaparmakov <anton@tuxera.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: <stable@vger.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>

---
 fs/hfs/brec.c |   20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

--- a/fs/hfs/brec.c
+++ b/fs/hfs/brec.c
@@ -131,13 +131,16 @@ skip:
 	hfs_bnode_write(node, entry, data_off + key_len, entry_len);
 	hfs_bnode_dump(node);
 
-	if (new_node) {
-		/* update parent key if we inserted a key
-		 * at the start of the first node
-		 */
-		if (!rec && new_node != node)
-			hfs_brec_update_parent(fd);
+	/*
+	 * update parent key if we inserted a key
+	 * at the start of the node and it is not the new node
+	 */
+	if (!rec && new_node != node) {
+		hfs_bnode_read_key(node, fd->search_key, data_off + size);
+		hfs_brec_update_parent(fd);
+	}
 
+	if (new_node) {
 		hfs_bnode_put(fd->bnode);
 		if (!new_node->parent) {
 			hfs_btree_inc_height(tree);
@@ -166,9 +169,6 @@ skip:
 		goto again;
 	}
 
-	if (!rec)
-		hfs_brec_update_parent(fd);
-
 	return 0;
 }
 
@@ -366,6 +366,8 @@ again:
 	if (IS_ERR(parent))
 		return PTR_ERR(parent);
 	__hfs_brec_find(parent, fd);
+	if (fd->record < 0)
+		return -ENOENT;
 	hfs_bnode_dump(parent);
 	rec = fd->record;
 



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

* [PATCH 4.2 117/134] i2c: xgene-slimpro: dma_mapping_error() doesnt return an error code
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (112 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 116/134] hfs: fix B-tree corruption after insertion at position 0 Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 118/134] ideapad-laptop: Add Lenovo Yoga 3 14 to no_hw_rfkill dmi list Greg Kroah-Hartman
                   ` (19 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Axel Lin, Wolfram Sang

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

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

From: Dan Carpenter <dan.carpenter@oracle.com>

commit a4a9a8cb3248b3b48a6049acaeaf23d4ad3712b9 upstream.

The dma_mapping_error() function returns true if there is an error, it
doesn't return an error code.  We should return -ENOMEM.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/i2c/busses/i2c-xgene-slimpro.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/drivers/i2c/busses/i2c-xgene-slimpro.c
+++ b/drivers/i2c/busses/i2c-xgene-slimpro.c
@@ -198,10 +198,10 @@ static int slimpro_i2c_blkrd(struct slim
 	int rc;
 
 	paddr = dma_map_single(ctx->dev, ctx->dma_buffer, readlen, DMA_FROM_DEVICE);
-	rc = dma_mapping_error(ctx->dev, paddr);
-	if (rc) {
+	if (dma_mapping_error(ctx->dev, paddr)) {
 		dev_err(&ctx->adapter.dev, "Error in mapping dma buffer %p\n",
 			ctx->dma_buffer);
+		rc = -ENOMEM;
 		goto err;
 	}
 
@@ -241,10 +241,10 @@ static int slimpro_i2c_blkwr(struct slim
 	memcpy(ctx->dma_buffer, data, writelen);
 	paddr = dma_map_single(ctx->dev, ctx->dma_buffer, writelen,
 			       DMA_TO_DEVICE);
-	rc = dma_mapping_error(ctx->dev, paddr);
-	if (rc) {
+	if (dma_mapping_error(ctx->dev, paddr)) {
 		dev_err(&ctx->adapter.dev, "Error in mapping dma buffer %p\n",
 			ctx->dma_buffer);
+		rc = -ENOMEM;
 		goto err;
 	}
 



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

* [PATCH 4.2 118/134] ideapad-laptop: Add Lenovo Yoga 3 14 to no_hw_rfkill dmi list
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (113 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 117/134] i2c: xgene-slimpro: dma_mapping_error() doesnt return an error code Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 119/134] IB/srp: Handle partial connection success correctly Greg Kroah-Hartman
                   ` (18 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Hans de Goede, Darren Hart

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

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

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

commit fa92a31b3335478c545cdc8e79e1e9b788184e6b upstream.

Like some of the other Yoga models the Lenovo Yoga 3 14 does not have a
hw rfkill switch, and trying to read the hw rfkill switch through the
ideapad module causes it to always reported blocking breaking wifi.

This commit adds the Lenovo Yoga 3 14 to the no_hw_rfkill dmi list, fixing
the wifi breakage.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1239050
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/platform/x86/ideapad-laptop.c |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -853,6 +853,13 @@ static const struct dmi_system_id no_hw_
 		},
 	},
 	{
+		.ident = "Lenovo Yoga 3 14",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+			DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Yoga 3 14"),
+		},
+	},
+	{
 		.ident = "Lenovo Yoga 3 Pro 1370",
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),



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

* [PATCH 4.2 119/134] IB/srp: Handle partial connection success correctly
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (114 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 118/134] ideapad-laptop: Add Lenovo Yoga 3 14 to no_hw_rfkill dmi list Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 120/134] IB/srp: Stop the scsi_eh_<n> and scsi_tmf_<n> threads if login fails Greg Kroah-Hartman
                   ` (17 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Bart Van Assche, Sagi Grimberg,
	Sebastian Parschauer, Christoph Hellwig, Doug Ledford

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

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

From: Bart Van Assche <bart.vanassche@sandisk.com>

commit c257ea6f9f9aed0b173e0c2932bb8dac5612cdc6 upstream.

Avoid that the following kernel warning is reported if the SRP
target system accepts fewer channels per connection than what
was requested by the initiator system:

WARNING: at drivers/infiniband/ulp/srp/ib_srp.c:617 srp_destroy_qp+0xb1/0x120 [ib_srp]()
Call Trace:
[<ffffffff8105d67f>] warn_slowpath_common+0x7f/0xc0
[<ffffffff8105d6da>] warn_slowpath_null+0x1a/0x20
[<ffffffffa05419e1>] srp_destroy_qp+0xb1/0x120 [ib_srp]
[<ffffffffa05445fb>] srp_create_ch_ib+0x19b/0x420 [ib_srp]
[<ffffffffa0545257>] srp_create_target+0x7d7/0xa94 [ib_srp]
[<ffffffff8138dac0>] dev_attr_store+0x20/0x30
[<ffffffff812079ef>] sysfs_write_file+0xef/0x170
[<ffffffff81191fc4>] vfs_write+0xb4/0x130
[<ffffffff8119276f>] sys_write+0x5f/0xa0
[<ffffffff815a0a59>] system_call_fastpath+0x16/0x1b

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Sagi Grimberg <sagig@mellanox.com>
Cc: Sebastian Parschauer <sebastian.riemer@profitbricks.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/ulp/srp/ib_srp.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -3262,7 +3262,7 @@ static ssize_t srp_create_target(struct
 					srp_free_ch_ib(target, ch);
 					srp_free_req_data(target, ch);
 					target->ch_count = ch - target->ch;
-					break;
+					goto connected;
 				}
 			}
 
@@ -3272,6 +3272,7 @@ static ssize_t srp_create_target(struct
 		node_idx++;
 	}
 
+connected:
 	target->scsi_host->nr_hw_queues = target->ch_count;
 
 	ret = srp_add_target(host, target);



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

* [PATCH 4.2 120/134] IB/srp: Stop the scsi_eh_<n> and scsi_tmf_<n> threads if login fails
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (115 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 119/134] IB/srp: Handle partial connection success correctly Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 121/134] IB/qib: Change lkey table allocation to support more MRs Greg Kroah-Hartman
                   ` (16 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Konstantin Krotov, Bart Van Assche,
	Sagi Grimberg, Sebastian Parschauer, Doug Ledford

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

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

From: Bart Van Assche <bart.vanassche@sandisk.com>

commit bc44bd1d864664f3658352c6aaaa02557d49165d upstream.

scsi_host_alloc() not only allocates memory for a SCSI host but also
creates the scsi_eh_<n> kernel thread and the scsi_tmf_<n> workqueue.
Stop these threads if login fails by calling scsi_host_put().

Reported-by: Konstantin Krotov <kkv@clodo.ru>
Fixes: fb49c8bbaae7 ("Remove an extraneous scsi_host_put() from an error path")
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Sagi Grimberg <sagig@mellanox.com>
Cc: Sebastian Parschauer <sebastian.riemer@profitbricks.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/ulp/srp/ib_srp.c |    9 +++++++++
 1 file changed, 9 insertions(+)

--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -2757,6 +2757,13 @@ static int srp_sdev_count(struct Scsi_Ho
 	return c;
 }
 
+/*
+ * Return values:
+ * < 0 upon failure. Caller is responsible for SRP target port cleanup.
+ * 0 and target->state == SRP_TARGET_REMOVED if asynchronous target port
+ *    removal has been scheduled.
+ * 0 and target->state != SRP_TARGET_REMOVED upon success.
+ */
 static int srp_add_target(struct srp_host *host, struct srp_target_port *target)
 {
 	struct srp_rport_identifiers ids;
@@ -3295,6 +3302,8 @@ out:
 	mutex_unlock(&host->add_target_mutex);
 
 	scsi_host_put(target->scsi_host);
+	if (ret < 0)
+		scsi_host_put(target->scsi_host);
 
 	return ret;
 



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

* [PATCH 4.2 121/134] IB/qib: Change lkey table allocation to support more MRs
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (116 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 120/134] IB/srp: Stop the scsi_eh_<n> and scsi_tmf_<n> threads if login fails Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 122/134] IB/uverbs: reject invalid or unknown opcodes Greg Kroah-Hartman
                   ` (15 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Vinit Agnihotri, Mike Marciniszyn,
	Doug Ledford

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

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

From: Mike Marciniszyn <mike.marciniszyn@intel.com>

commit d6f1c17e162b2a11e708f28fa93f2f79c164b442 upstream.

The lkey table is allocated with with a get_user_pages() with an
order based on a number of index bits from a module parameter.

The underlying kernel code cannot allocate that many contiguous pages.

There is no reason the underlying memory needs to be physically
contiguous.

This patch:
- switches the allocation/deallocation to vmalloc/vfree
- caps the number of bits to 23 to insure at least 1 generation bit
  o this matches the module parameter description

Reviewed-by: Vinit Agnihotri <vinit.abhay.agnihotri@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/hw/qib/qib_keys.c  |    4 ++++
 drivers/infiniband/hw/qib/qib_verbs.c |   14 ++++++++++----
 drivers/infiniband/hw/qib/qib_verbs.h |    2 ++
 3 files changed, 16 insertions(+), 4 deletions(-)

--- a/drivers/infiniband/hw/qib/qib_keys.c
+++ b/drivers/infiniband/hw/qib/qib_keys.c
@@ -86,6 +86,10 @@ int qib_alloc_lkey(struct qib_mregion *m
 	 * unrestricted LKEY.
 	 */
 	rkt->gen++;
+	/*
+	 * bits are capped in qib_verbs.c to insure enough bits
+	 * for generation number
+	 */
 	mr->lkey = (r << (32 - ib_qib_lkey_table_size)) |
 		((((1 << (24 - ib_qib_lkey_table_size)) - 1) & rkt->gen)
 		 << 8);
--- a/drivers/infiniband/hw/qib/qib_verbs.c
+++ b/drivers/infiniband/hw/qib/qib_verbs.c
@@ -40,6 +40,7 @@
 #include <linux/rculist.h>
 #include <linux/mm.h>
 #include <linux/random.h>
+#include <linux/vmalloc.h>
 
 #include "qib.h"
 #include "qib_common.h"
@@ -2109,10 +2110,16 @@ int qib_register_ib_device(struct qib_de
 	 * the LKEY).  The remaining bits act as a generation number or tag.
 	 */
 	spin_lock_init(&dev->lk_table.lock);
+	/* insure generation is at least 4 bits see keys.c */
+	if (ib_qib_lkey_table_size > MAX_LKEY_TABLE_BITS) {
+		qib_dev_warn(dd, "lkey bits %u too large, reduced to %u\n",
+			ib_qib_lkey_table_size, MAX_LKEY_TABLE_BITS);
+		ib_qib_lkey_table_size = MAX_LKEY_TABLE_BITS;
+	}
 	dev->lk_table.max = 1 << ib_qib_lkey_table_size;
 	lk_tab_size = dev->lk_table.max * sizeof(*dev->lk_table.table);
 	dev->lk_table.table = (struct qib_mregion __rcu **)
-		__get_free_pages(GFP_KERNEL, get_order(lk_tab_size));
+		vmalloc(lk_tab_size);
 	if (dev->lk_table.table == NULL) {
 		ret = -ENOMEM;
 		goto err_lk;
@@ -2286,7 +2293,7 @@ err_tx:
 					sizeof(struct qib_pio_header),
 				  dev->pio_hdrs, dev->pio_hdrs_phys);
 err_hdrs:
-	free_pages((unsigned long) dev->lk_table.table, get_order(lk_tab_size));
+	vfree(dev->lk_table.table);
 err_lk:
 	kfree(dev->qp_table);
 err_qpt:
@@ -2340,8 +2347,7 @@ void qib_unregister_ib_device(struct qib
 					sizeof(struct qib_pio_header),
 				  dev->pio_hdrs, dev->pio_hdrs_phys);
 	lk_tab_size = dev->lk_table.max * sizeof(*dev->lk_table.table);
-	free_pages((unsigned long) dev->lk_table.table,
-		   get_order(lk_tab_size));
+	vfree(dev->lk_table.table);
 	kfree(dev->qp_table);
 }
 
--- a/drivers/infiniband/hw/qib/qib_verbs.h
+++ b/drivers/infiniband/hw/qib/qib_verbs.h
@@ -647,6 +647,8 @@ struct qib_qpn_table {
 	struct qpn_map map[QPNMAP_ENTRIES];
 };
 
+#define MAX_LKEY_TABLE_BITS 23
+
 struct qib_lkey_table {
 	spinlock_t lock; /* protect changes in this struct */
 	u32 next;               /* next unused index (speeds search) */



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

* [PATCH 4.2 122/134] IB/uverbs: reject invalid or unknown opcodes
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (117 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 121/134] IB/qib: Change lkey table allocation to support more MRs Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 123/134] IB/uverbs: Fix race between ib_uverbs_open and remove_one Greg Kroah-Hartman
                   ` (14 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christoph Hellwig, Jason Gunthorpe,
	Sagi Grimberg, Doug Ledford

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

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

From: Christoph Hellwig <hch@lst.de>

commit b632ffa7cee439ba5dce3b3bc4a5cbe2b3e20133 upstream.

We have many WR opcodes that are only supported in kernel space
and/or require optional information to be copied into the WR
structure.  Reject all those not explicitly handled so that we
can't pass invalid information to drivers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/core/uverbs_cmd.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -2346,6 +2346,12 @@ ssize_t ib_uverbs_post_send(struct ib_uv
 		next->send_flags = user_wr->send_flags;
 
 		if (is_ud) {
+			if (next->opcode != IB_WR_SEND &&
+			    next->opcode != IB_WR_SEND_WITH_IMM) {
+				ret = -EINVAL;
+				goto out_put;
+			}
+
 			next->wr.ud.ah = idr_read_ah(user_wr->wr.ud.ah,
 						     file->ucontext);
 			if (!next->wr.ud.ah) {
@@ -2385,9 +2391,11 @@ ssize_t ib_uverbs_post_send(struct ib_uv
 					user_wr->wr.atomic.compare_add;
 				next->wr.atomic.swap = user_wr->wr.atomic.swap;
 				next->wr.atomic.rkey = user_wr->wr.atomic.rkey;
+			case IB_WR_SEND:
 				break;
 			default:
-				break;
+				ret = -EINVAL;
+				goto out_put;
 			}
 		}
 



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

* [PATCH 4.2 123/134] IB/uverbs: Fix race between ib_uverbs_open and remove_one
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (118 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 122/134] IB/uverbs: reject invalid or unknown opcodes Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 124/134] IB/iser: Fix missing return status check in iser_send_data_out Greg Kroah-Hartman
                   ` (13 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Yishai Hadas, Shachar Raindel,
	Jason Gunthorpe, Doug Ledford

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

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

From: Yishai Hadas <yishaih@mellanox.com>

commit 35d4a0b63dc0c6d1177d4f532a9deae958f0662c upstream.

Fixes: 2a72f212263701b927559f6850446421d5906c41 ("IB/uverbs: Remove dev_table")

Before this commit there was a device look-up table that was protected
by a spin_lock used by ib_uverbs_open and by ib_uverbs_remove_one. When
it was dropped and container_of was used instead, it enabled the race
with remove_one as dev might be freed just after:
dev = container_of(inode->i_cdev, struct ib_uverbs_device, cdev) but
before the kref_get.

In addition, this buggy patch added some dead code as
container_of(x,y,z) can never be NULL and so dev can never be NULL.
As a result the comment above ib_uverbs_open saying "the open method
will either immediately run -ENXIO" is wrong as it can never happen.

The solution follows Jason Gunthorpe suggestion from below URL:
https://www.mail-archive.com/linux-rdma@vger.kernel.org/msg25692.html

cdev will hold a kref on the parent (the containing structure,
ib_uverbs_device) and only when that kref is released it is
guaranteed that open will never be called again.

In addition, fixes the active count scheme to use an atomic
not a kref to prevent WARN_ON as pointed by above comment
from Jason.

Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Shachar Raindel <raindel@mellanox.com>
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/core/uverbs.h      |    3 +-
 drivers/infiniband/core/uverbs_main.c |   43 +++++++++++++++++++++++-----------
 2 files changed, 32 insertions(+), 14 deletions(-)

--- a/drivers/infiniband/core/uverbs.h
+++ b/drivers/infiniband/core/uverbs.h
@@ -85,7 +85,7 @@
  */
 
 struct ib_uverbs_device {
-	struct kref				ref;
+	atomic_t				refcount;
 	int					num_comp_vectors;
 	struct completion			comp;
 	struct device			       *dev;
@@ -94,6 +94,7 @@ struct ib_uverbs_device {
 	struct cdev			        cdev;
 	struct rb_root				xrcd_tree;
 	struct mutex				xrcd_tree_mutex;
+	struct kobject				kobj;
 };
 
 struct ib_uverbs_event_file {
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -130,14 +130,18 @@ static int (*uverbs_ex_cmd_table[])(stru
 static void ib_uverbs_add_one(struct ib_device *device);
 static void ib_uverbs_remove_one(struct ib_device *device);
 
-static void ib_uverbs_release_dev(struct kref *ref)
+static void ib_uverbs_release_dev(struct kobject *kobj)
 {
 	struct ib_uverbs_device *dev =
-		container_of(ref, struct ib_uverbs_device, ref);
+		container_of(kobj, struct ib_uverbs_device, kobj);
 
-	complete(&dev->comp);
+	kfree(dev);
 }
 
+static struct kobj_type ib_uverbs_dev_ktype = {
+	.release = ib_uverbs_release_dev,
+};
+
 static void ib_uverbs_release_event_file(struct kref *ref)
 {
 	struct ib_uverbs_event_file *file =
@@ -303,13 +307,19 @@ static int ib_uverbs_cleanup_ucontext(st
 	return context->device->dealloc_ucontext(context);
 }
 
+static void ib_uverbs_comp_dev(struct ib_uverbs_device *dev)
+{
+	complete(&dev->comp);
+}
+
 static void ib_uverbs_release_file(struct kref *ref)
 {
 	struct ib_uverbs_file *file =
 		container_of(ref, struct ib_uverbs_file, ref);
 
 	module_put(file->device->ib_dev->owner);
-	kref_put(&file->device->ref, ib_uverbs_release_dev);
+	if (atomic_dec_and_test(&file->device->refcount))
+		ib_uverbs_comp_dev(file->device);
 
 	kfree(file);
 }
@@ -743,9 +753,7 @@ static int ib_uverbs_open(struct inode *
 	int ret;
 
 	dev = container_of(inode->i_cdev, struct ib_uverbs_device, cdev);
-	if (dev)
-		kref_get(&dev->ref);
-	else
+	if (!atomic_inc_not_zero(&dev->refcount))
 		return -ENXIO;
 
 	if (!try_module_get(dev->ib_dev->owner)) {
@@ -766,6 +774,7 @@ static int ib_uverbs_open(struct inode *
 	mutex_init(&file->mutex);
 
 	filp->private_data = file;
+	kobject_get(&dev->kobj);
 
 	return nonseekable_open(inode, filp);
 
@@ -773,13 +782,16 @@ err_module:
 	module_put(dev->ib_dev->owner);
 
 err:
-	kref_put(&dev->ref, ib_uverbs_release_dev);
+	if (atomic_dec_and_test(&dev->refcount))
+		ib_uverbs_comp_dev(dev);
+
 	return ret;
 }
 
 static int ib_uverbs_close(struct inode *inode, struct file *filp)
 {
 	struct ib_uverbs_file *file = filp->private_data;
+	struct ib_uverbs_device *dev = file->device;
 
 	ib_uverbs_cleanup_ucontext(file, file->ucontext);
 
@@ -787,6 +799,7 @@ static int ib_uverbs_close(struct inode
 		kref_put(&file->async_file->ref, ib_uverbs_release_event_file);
 
 	kref_put(&file->ref, ib_uverbs_release_file);
+	kobject_put(&dev->kobj);
 
 	return 0;
 }
@@ -882,10 +895,11 @@ static void ib_uverbs_add_one(struct ib_
 	if (!uverbs_dev)
 		return;
 
-	kref_init(&uverbs_dev->ref);
+	atomic_set(&uverbs_dev->refcount, 1);
 	init_completion(&uverbs_dev->comp);
 	uverbs_dev->xrcd_tree = RB_ROOT;
 	mutex_init(&uverbs_dev->xrcd_tree_mutex);
+	kobject_init(&uverbs_dev->kobj, &ib_uverbs_dev_ktype);
 
 	spin_lock(&map_lock);
 	devnum = find_first_zero_bit(dev_map, IB_UVERBS_MAX_DEVICES);
@@ -912,6 +926,7 @@ static void ib_uverbs_add_one(struct ib_
 	cdev_init(&uverbs_dev->cdev, NULL);
 	uverbs_dev->cdev.owner = THIS_MODULE;
 	uverbs_dev->cdev.ops = device->mmap ? &uverbs_mmap_fops : &uverbs_fops;
+	uverbs_dev->cdev.kobj.parent = &uverbs_dev->kobj;
 	kobject_set_name(&uverbs_dev->cdev.kobj, "uverbs%d", uverbs_dev->devnum);
 	if (cdev_add(&uverbs_dev->cdev, base, 1))
 		goto err_cdev;
@@ -942,9 +957,10 @@ err_cdev:
 		clear_bit(devnum, overflow_map);
 
 err:
-	kref_put(&uverbs_dev->ref, ib_uverbs_release_dev);
+	if (atomic_dec_and_test(&uverbs_dev->refcount))
+		ib_uverbs_comp_dev(uverbs_dev);
 	wait_for_completion(&uverbs_dev->comp);
-	kfree(uverbs_dev);
+	kobject_put(&uverbs_dev->kobj);
 	return;
 }
 
@@ -964,9 +980,10 @@ static void ib_uverbs_remove_one(struct
 	else
 		clear_bit(uverbs_dev->devnum - IB_UVERBS_MAX_DEVICES, overflow_map);
 
-	kref_put(&uverbs_dev->ref, ib_uverbs_release_dev);
+	if (atomic_dec_and_test(&uverbs_dev->refcount))
+		ib_uverbs_comp_dev(uverbs_dev);
 	wait_for_completion(&uverbs_dev->comp);
-	kfree(uverbs_dev);
+	kobject_put(&uverbs_dev->kobj);
 }
 
 static char *uverbs_devnode(struct device *dev, umode_t *mode)



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

* [PATCH 4.2 124/134] IB/iser: Fix missing return status check in iser_send_data_out
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (119 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 123/134] IB/uverbs: Fix race between ib_uverbs_open and remove_one Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 125/134] IB/iser: Fix possible bogus DMA unmapping Greg Kroah-Hartman
                   ` (12 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Sagi Grimberg, Doug Ledford

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

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

From: Sagi Grimberg <sagig@mellanox.com>

commit d16739055bd1f562ae4d83e69f7f7f1cefcfbe16 upstream.

Since commit "IB/iser: Fix race between iser connection teardown..."
iser_initialize_task_headers() might fail, so we need to check that.

Fixes: 7414dde0a6c3a958e (IB/iser: Fix race between iser connection ...)
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/ulp/iser/iser_initiator.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

--- a/drivers/infiniband/ulp/iser/iser_initiator.c
+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
@@ -454,7 +454,7 @@ int iser_send_data_out(struct iscsi_conn
 	unsigned long buf_offset;
 	unsigned long data_seg_len;
 	uint32_t itt;
-	int err = 0;
+	int err;
 	struct ib_sge *tx_dsg;
 
 	itt = (__force uint32_t)hdr->itt;
@@ -475,7 +475,9 @@ int iser_send_data_out(struct iscsi_conn
 	memcpy(&tx_desc->iscsi_header, hdr, sizeof(struct iscsi_hdr));
 
 	/* build the tx desc */
-	iser_initialize_task_headers(task, tx_desc);
+	err = iser_initialize_task_headers(task, tx_desc);
+	if (err)
+		goto send_data_out_error;
 
 	mem_reg = &iser_task->rdma_reg[ISER_DIR_OUT];
 	tx_dsg = &tx_desc->tx_sg[1];
@@ -502,7 +504,7 @@ int iser_send_data_out(struct iscsi_conn
 
 send_data_out_error:
 	kmem_cache_free(ig.desc_cache, tx_desc);
-	iser_err("conn %p failed err %d\n",conn, err);
+	iser_err("conn %p failed err %d\n", conn, err);
 	return err;
 }
 



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

* [PATCH 4.2 125/134] IB/iser: Fix possible bogus DMA unmapping
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (120 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 124/134] IB/iser: Fix missing return status check in iser_send_data_out Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 126/134] IB/mlx5: avoid destroying a NULL mr in reg_user_mr error flow Greg Kroah-Hartman
                   ` (11 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Sagi Grimberg, Doug Ledford

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

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

From: Sagi Grimberg <sagig@mellanox.com>

commit 8d5944d80359e645feb2ebd069a6f4caf7825e40 upstream.

If iser_initialize_task_headers() routine failed before
dma mapping, we should not attempt to unmap in cleanup_task().

Fixes: 7414dde0a6c3a958e (IB/iser: Fix race between iser connection ...)
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/ulp/iser/iscsi_iser.c |   12 ++++++++----
 drivers/infiniband/ulp/iser/iscsi_iser.h |    2 ++
 2 files changed, 10 insertions(+), 4 deletions(-)

--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -201,6 +201,7 @@ iser_initialize_task_headers(struct iscs
 		goto out;
 	}
 
+	tx_desc->mapped = true;
 	tx_desc->dma_addr = dma_addr;
 	tx_desc->tx_sg[0].addr   = tx_desc->dma_addr;
 	tx_desc->tx_sg[0].length = ISER_HEADERS_LEN;
@@ -360,16 +361,19 @@ iscsi_iser_task_xmit(struct iscsi_task *
 static void iscsi_iser_cleanup_task(struct iscsi_task *task)
 {
 	struct iscsi_iser_task *iser_task = task->dd_data;
-	struct iser_tx_desc    *tx_desc   = &iser_task->desc;
-	struct iser_conn       *iser_conn	  = task->conn->dd_data;
+	struct iser_tx_desc *tx_desc = &iser_task->desc;
+	struct iser_conn *iser_conn = task->conn->dd_data;
 	struct iser_device *device = iser_conn->ib_conn.device;
 
 	/* DEVICE_REMOVAL event might have already released the device */
 	if (!device)
 		return;
 
-	ib_dma_unmap_single(device->ib_device,
-		tx_desc->dma_addr, ISER_HEADERS_LEN, DMA_TO_DEVICE);
+	if (likely(tx_desc->mapped)) {
+		ib_dma_unmap_single(device->ib_device, tx_desc->dma_addr,
+				    ISER_HEADERS_LEN, DMA_TO_DEVICE);
+		tx_desc->mapped = false;
+	}
 
 	/* mgmt tasks do not need special cleanup */
 	if (!task->sc)
--- a/drivers/infiniband/ulp/iser/iscsi_iser.h
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.h
@@ -270,6 +270,7 @@ enum iser_desc_type {
  *                 sg[1] optionally points to either of immediate data
  *                 unsolicited data-out or control
  * @num_sge:       number sges used on this TX task
+ * @mapped:        Is the task header mapped
  */
 struct iser_tx_desc {
 	struct iser_hdr              iser_header;
@@ -278,6 +279,7 @@ struct iser_tx_desc {
 	u64		             dma_addr;
 	struct ib_sge		     tx_sg[2];
 	int                          num_sge;
+	bool			     mapped;
 };
 
 #define ISER_RX_PAD_SIZE	(256 - (ISER_RX_PAYLOAD_SIZE + \



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

* [PATCH 4.2 126/134] IB/mlx5: avoid destroying a NULL mr in reg_user_mr error flow
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (121 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 125/134] IB/iser: Fix possible bogus DMA unmapping Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 127/134] IB/mlx4: Fix potential deadlock when sending mad to wire Greg Kroah-Hartman
                   ` (10 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Eli Cohen, Haggai Eran,
	Sagi Grimberg, Doug Ledford

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

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

From: Haggai Eran <haggaie@mellanox.com>

commit 11d748045c6dadb279d1acdb6d2ea8f3f2ede85b upstream.

The mlx5_ib_reg_user_mr() function will attempt to call clean_mr() in
its error flow even though there is never a case where the error flow
occurs with a valid MR pointer to destroy.

Remove the clean_mr() call and the incorrect comment above it.

Fixes: b4cfe447d47b ("IB/mlx5: Implement on demand paging by adding
support for MMU notifiers")
Cc: Eli Cohen <eli@mellanox.com>
Signed-off-by: Haggai Eran <haggaie@mellanox.com>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/hw/mlx5/mr.c |   12 ------------
 1 file changed, 12 deletions(-)

--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -1118,19 +1118,7 @@ struct ib_mr *mlx5_ib_reg_user_mr(struct
 	return &mr->ibmr;
 
 error:
-	/*
-	 * Destroy the umem *before* destroying the MR, to ensure we
-	 * will not have any in-flight notifiers when destroying the
-	 * MR.
-	 *
-	 * As the MR is completely invalid to begin with, and this
-	 * error path is only taken if we can't push the mr entry into
-	 * the pagefault tree, this is safe.
-	 */
-
 	ib_umem_release(umem);
-	/* Kill the MR, and return an error code. */
-	clean_mr(mr);
 	return ERR_PTR(err);
 }
 



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

* [PATCH 4.2 127/134] IB/mlx4: Fix potential deadlock when sending mad to wire
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (122 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 126/134] IB/mlx5: avoid destroying a NULL mr in reg_user_mr error flow Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 128/134] IB/mlx4: Forbid using sysfs to change RoCE pkeys Greg Kroah-Hartman
                   ` (9 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jack Morgenstein, Or Gerlitz, Doug Ledford

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

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

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

commit 90c1d8b6350cca9d8a234f03c77a317a7613bcee upstream.

send_mad_to_wire takes the same spinlock that is taken in
the interrupt context.  Therefore, it needs irqsave/restore.

Fixes: b9c5d6a64358 ('IB/mlx4: Add multicast group (MCG) paravirtualization for SR-IOV')
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/hw/mlx4/mcg.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/drivers/infiniband/hw/mlx4/mcg.c
+++ b/drivers/infiniband/hw/mlx4/mcg.c
@@ -206,15 +206,16 @@ static int send_mad_to_wire(struct mlx4_
 {
 	struct mlx4_ib_dev *dev = ctx->dev;
 	struct ib_ah_attr	ah_attr;
+	unsigned long flags;
 
-	spin_lock(&dev->sm_lock);
+	spin_lock_irqsave(&dev->sm_lock, flags);
 	if (!dev->sm_ah[ctx->port - 1]) {
 		/* port is not yet Active, sm_ah not ready */
-		spin_unlock(&dev->sm_lock);
+		spin_unlock_irqrestore(&dev->sm_lock, flags);
 		return -EAGAIN;
 	}
 	mlx4_ib_query_ah(dev->sm_ah[ctx->port - 1], &ah_attr);
-	spin_unlock(&dev->sm_lock);
+	spin_unlock_irqrestore(&dev->sm_lock, flags);
 	return mlx4_ib_send_to_wire(dev, mlx4_master_func_num(dev->dev),
 				    ctx->port, IB_QPT_GSI, 0, 1, IB_QP1_QKEY,
 				    &ah_attr, NULL, mad);



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

* [PATCH 4.2 128/134] IB/mlx4: Forbid using sysfs to change RoCE pkeys
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (123 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 127/134] IB/mlx4: Fix potential deadlock when sending mad to wire Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 129/134] IB/mlx4: Use correct SL on AH query under RoCE Greg Kroah-Hartman
                   ` (8 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jack Morgenstein, Or Gerlitz, Doug Ledford

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

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

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

commit 2b135db3e81301d0452e6aa107349abe67b097d6 upstream.

The pkey mapping for RoCE must remain the default mapping:
VFs:
  virtual index 0 = mapped to real index 0 (0xFFFF)
  All others indices: mapped to a real pkey index containing an
                      invalid pkey.
PF:
  virtual index i = real index i.

Don't allow users to change these mappings using files found in
sysfs.

Fixes: c1e7e466120b ('IB/mlx4: Add iov directory in sysfs under the ib device')
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/hw/mlx4/sysfs.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/infiniband/hw/mlx4/sysfs.c
+++ b/drivers/infiniband/hw/mlx4/sysfs.c
@@ -640,6 +640,8 @@ static int add_port(struct mlx4_ib_dev *
 	struct mlx4_port *p;
 	int i;
 	int ret;
+	int is_eth = rdma_port_get_link_layer(&dev->ib_dev, port_num) ==
+			IB_LINK_LAYER_ETHERNET;
 
 	p = kzalloc(sizeof *p, GFP_KERNEL);
 	if (!p)
@@ -657,7 +659,8 @@ static int add_port(struct mlx4_ib_dev *
 
 	p->pkey_group.name  = "pkey_idx";
 	p->pkey_group.attrs =
-		alloc_group_attrs(show_port_pkey, store_port_pkey,
+		alloc_group_attrs(show_port_pkey,
+				  is_eth ? NULL : store_port_pkey,
 				  dev->dev->caps.pkey_table_len[port_num]);
 	if (!p->pkey_group.attrs) {
 		ret = -ENOMEM;



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

* [PATCH 4.2 129/134] IB/mlx4: Use correct SL on AH query under RoCE
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (124 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 128/134] IB/mlx4: Forbid using sysfs to change RoCE pkeys Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 130/134] IB/mlx4: Fix incorrect cq flushing in error state Greg Kroah-Hartman
                   ` (7 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Shani Michaeli, Noa Osherovich,
	Or Gerlitz, Doug Ledford

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

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

From: Noa Osherovich <noaos@mellanox.com>

commit 5e99b139f1b68acd65e36515ca347b03856dfb5a upstream.

The mlx4 IB driver implementation for ib_query_ah used a wrong offset
(28 instead of 29) when link type is Ethernet. Fixed to use the correct one.

Fixes: fa417f7b520e ('IB/mlx4: Add support for IBoE')
Signed-off-by: Shani Michaeli <shanim@mellanox.com>
Signed-off-by: Noa Osherovich <noaos@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/hw/mlx4/ah.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/drivers/infiniband/hw/mlx4/ah.c
+++ b/drivers/infiniband/hw/mlx4/ah.c
@@ -148,9 +148,13 @@ int mlx4_ib_query_ah(struct ib_ah *ibah,
 	enum rdma_link_layer ll;
 
 	memset(ah_attr, 0, sizeof *ah_attr);
-	ah_attr->sl = be32_to_cpu(ah->av.ib.sl_tclass_flowlabel) >> 28;
 	ah_attr->port_num = be32_to_cpu(ah->av.ib.port_pd) >> 24;
 	ll = rdma_port_get_link_layer(ibah->device, ah_attr->port_num);
+	if (ll == IB_LINK_LAYER_ETHERNET)
+		ah_attr->sl = be32_to_cpu(ah->av.eth.sl_tclass_flowlabel) >> 29;
+	else
+		ah_attr->sl = be32_to_cpu(ah->av.ib.sl_tclass_flowlabel) >> 28;
+
 	ah_attr->dlid = ll == IB_LINK_LAYER_INFINIBAND ? be16_to_cpu(ah->av.ib.dlid) : 0;
 	if (ah->av.ib.stat_rate)
 		ah_attr->static_rate = ah->av.ib.stat_rate - MLX4_STAT_RATE_OFFSET;



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

* [PATCH 4.2 130/134] IB/mlx4: Fix incorrect cq flushing in error state
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (125 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 129/134] IB/mlx4: Use correct SL on AH query under RoCE Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 131/134] stmmac: fix check for phydev being open Greg Kroah-Hartman
                   ` (6 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Ariel Nahum, Sagi Grimberg,
	Yishai Hadas, Doug Ledford

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

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

From: Ariel Nahum <arieln@mellanox.com>

commit 799cdaf8a98f13d4fba3162e21e1e63f21045010 upstream.

When handling a device internal error, the driver is responsible to
drain the completion queue with flush errors.

In case a completion queue was assigned to multiple send queues, the
driver iterates over the send queues and generates flush errors of
inflight wqes. The driver must correctly pass the wc array with an
offset as a result of the previous send queue iteration. Not doing so
will overwrite previously set completions and return a wrong number
of polled completions which includes ones which were not correctly set.

Fixes: 35f05dabf95a (IB/mlx4: Reset flow support for IB kernel ULPs)
Signed-off-by: Ariel Nahum <arieln@mellanox.com>
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Cc: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

--- a/drivers/infiniband/hw/mlx4/cq.c
+++ b/drivers/infiniband/hw/mlx4/cq.c
@@ -638,7 +638,7 @@ static void mlx4_ib_poll_sw_comp(struct
 	 * simulated FLUSH_ERR completions
 	 */
 	list_for_each_entry(qp, &cq->send_qp_list, cq_send_list) {
-		mlx4_ib_qp_sw_comp(qp, num_entries, wc, npolled, 1);
+		mlx4_ib_qp_sw_comp(qp, num_entries, wc + *npolled, npolled, 1);
 		if (*npolled >= num_entries)
 			goto out;
 	}



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

* [PATCH 4.2 131/134] stmmac: fix check for phydev being open
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (126 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 130/134] IB/mlx4: Fix incorrect cq flushing in error state Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 132/134] hfs,hfsplus: cache pages correctly between bnode_create and bnode_free Greg Kroah-Hartman
                   ` (5 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Sergei Shtylyov, Giuseppe Cavallaro,
	David Miller, Alexey Brodkin

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

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

From: Alexey Brodkin <Alexey.Brodkin@synopsys.com>

commit dfc50fcaad574e5c8c85cbc83eca1426b2413fa4 upstream.

Current check of phydev with IS_ERR(phydev) may make not much sense
because of_phy_connect() returns NULL on failure instead of error value.

Still for checking result of phy_connect() IS_ERR() makes perfect sense.

So let's use combined check IS_ERR_OR_NULL() that covers both cases.

Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: linux-kernel@vger.kernel.org
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -837,8 +837,11 @@ static int stmmac_init_phy(struct net_de
 				     interface);
 	}
 
-	if (IS_ERR(phydev)) {
+	if (IS_ERR_OR_NULL(phydev)) {
 		pr_err("%s: Could not attach to PHY\n", dev->name);
+		if (!phydev)
+			return -ENODEV;
+
 		return PTR_ERR(phydev);
 	}
 



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

* [PATCH 4.2 132/134] hfs,hfsplus: cache pages correctly between bnode_create and bnode_free
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (127 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 131/134] stmmac: fix check for phydev being open Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 133/134] lib/decompressors: use real out buf size for gunzip with kernel Greg Kroah-Hartman
                   ` (4 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Hin-Tak Leung, Sergei Antonov,
	Anton Altaparmakov, Sasha Levin, Al Viro, Christoph Hellwig,
	Vyacheslav Dubeyko, Sougata Santra, Andrew Morton,
	Linus Torvalds

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

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

From: Hin-Tak Leung <htl10@users.sourceforge.net>

commit 7cb74be6fd827e314f81df3c5889b87e4c87c569 upstream.

Pages looked up by __hfs_bnode_create() (called by hfs_bnode_create() and
hfs_bnode_find() for finding or creating pages corresponding to an inode)
are immediately kmap()'ed and used (both read and write) and kunmap()'ed,
and should not be page_cache_release()'ed until hfs_bnode_free().

This patch fixes a problem I first saw in July 2012: merely running "du"
on a large hfsplus-mounted directory a few times on a reasonably loaded
system would get the hfsplus driver all confused and complaining about
B-tree inconsistencies, and generates a "BUG: Bad page state".  Most
recently, I can generate this problem on up-to-date Fedora 22 with shipped
kernel 4.0.5, by running "du /" (="/" + "/home" + "/mnt" + other smaller
mounts) and "du /mnt" simultaneously on two windows, where /mnt is a
lightly-used QEMU VM image of the full Mac OS X 10.9:

$ df -i / /home /mnt
Filesystem                  Inodes   IUsed      IFree IUse% Mounted on
/dev/mapper/fedora-root    3276800  551665    2725135   17% /
/dev/mapper/fedora-home   52879360  716221   52163139    2% /home
/dev/nbd0p2             4294967295 1387818 4293579477    1% /mnt

After applying the patch, I was able to run "du /" (60+ times) and "du
/mnt" (150+ times) continuously and simultaneously for 6+ hours.

There are many reports of the hfsplus driver getting confused under load
and generating "BUG: Bad page state" or other similar issues over the
years.  [1]

The unpatched code [2] has always been wrong since it entered the kernel
tree.  The only reason why it gets away with it is that the
kmap/memcpy/kunmap follow very quickly after the page_cache_release() so
the kernel has not had a chance to reuse the memory for something else,
most of the time.

The current RW driver appears to have followed the design and development
of the earlier read-only hfsplus driver [3], where-by version 0.1 (Dec
2001) had a B-tree node-centric approach to
read_cache_page()/page_cache_release() per bnode_get()/bnode_put(),
migrating towards version 0.2 (June 2002) of caching and releasing pages
per inode extents.  When the current RW code first entered the kernel [2]
in 2005, there was an REF_PAGES conditional (and "//" commented out code)
to switch between B-node centric paging to inode-centric paging.  There
was a mistake with the direction of one of the REF_PAGES conditionals in
__hfs_bnode_create().  In a subsequent "remove debug code" commit [4], the
read_cache_page()/page_cache_release() per bnode_get()/bnode_put() were
removed, but a page_cache_release() was mistakenly left in (propagating
the "REF_PAGES <-> !REF_PAGE" mistake), and the commented-out
page_cache_release() in bnode_release() (which should be spanned by
!REF_PAGES) was never enabled.

References:
[1]:
Michael Fox, Apr 2013
http://www.spinics.net/lists/linux-fsdevel/msg63807.html
("hfsplus volume suddenly inaccessable after 'hfs: recoff %d too large'")

Sasha Levin, Feb 2015
http://lkml.org/lkml/2015/2/20/85 ("use after free")

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/740814
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1027887
https://bugzilla.kernel.org/show_bug.cgi?id=42342
https://bugzilla.kernel.org/show_bug.cgi?id=63841
https://bugzilla.kernel.org/show_bug.cgi?id=78761

[2]:
http://git.kernel.org/cgit/linux/kernel/git/tglx/history.git/commit/\
fs/hfs/bnode.c?id=d1081202f1d0ee35ab0beb490da4b65d4bc763db
commit d1081202f1d0ee35ab0beb490da4b65d4bc763db
Author: Andrew Morton <akpm@osdl.org>
Date:   Wed Feb 25 16:17:36 2004 -0800

    [PATCH] HFS rewrite

http://git.kernel.org/cgit/linux/kernel/git/tglx/history.git/commit/\
fs/hfsplus/bnode.c?id=91556682e0bf004d98a529bf829d339abb98bbbd

commit 91556682e0bf004d98a529bf829d339abb98bbbd
Author: Andrew Morton <akpm@osdl.org>
Date:   Wed Feb 25 16:17:48 2004 -0800

    [PATCH] HFS+ support

[3]:
http://sourceforge.net/projects/linux-hfsplus/

http://sourceforge.net/projects/linux-hfsplus/files/Linux%202.4.x%20patch/hfsplus%200.1/
http://sourceforge.net/projects/linux-hfsplus/files/Linux%202.4.x%20patch/hfsplus%200.2/

http://linux-hfsplus.cvs.sourceforge.net/viewvc/linux-hfsplus/linux/\
fs/hfsplus/bnode.c?r1=1.4&r2=1.5

Date:   Thu Jun 6 09:45:14 2002 +0000
Use buffer cache instead of page cache in bnode.c. Cache inode extents.

[4]:
http://git.kernel.org/cgit/linux/kernel/git/\
stable/linux-stable.git/commit/?id=a5e3985fa014029eb6795664c704953720cc7f7d

commit a5e3985fa014029eb6795664c704953720cc7f7d
Author: Roman Zippel <zippel@linux-m68k.org>
Date:   Tue Sep 6 15:18:47 2005 -0700

[PATCH] hfs: remove debug code

Signed-off-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Signed-off-by: Sergei Antonov <saproj@gmail.com>
Reviewed-by: Anton Altaparmakov <anton@tuxera.com>
Reported-by: Sasha Levin <sasha.levin@oracle.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Vyacheslav Dubeyko <slava@dubeyko.com>
Cc: Sougata Santra <sougata@tuxera.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>

---
 fs/hfs/bnode.c     |    9 ++++-----
 fs/hfsplus/bnode.c |    3 ---
 2 files changed, 4 insertions(+), 8 deletions(-)

--- a/fs/hfs/bnode.c
+++ b/fs/hfs/bnode.c
@@ -288,7 +288,6 @@ static struct hfs_bnode *__hfs_bnode_cre
 			page_cache_release(page);
 			goto fail;
 		}
-		page_cache_release(page);
 		node->page[i] = page;
 	}
 
@@ -398,11 +397,11 @@ node_error:
 
 void hfs_bnode_free(struct hfs_bnode *node)
 {
-	//int i;
+	int i;
 
-	//for (i = 0; i < node->tree->pages_per_bnode; i++)
-	//	if (node->page[i])
-	//		page_cache_release(node->page[i]);
+	for (i = 0; i < node->tree->pages_per_bnode; i++)
+		if (node->page[i])
+			page_cache_release(node->page[i]);
 	kfree(node);
 }
 
--- a/fs/hfsplus/bnode.c
+++ b/fs/hfsplus/bnode.c
@@ -454,7 +454,6 @@ static struct hfs_bnode *__hfs_bnode_cre
 			page_cache_release(page);
 			goto fail;
 		}
-		page_cache_release(page);
 		node->page[i] = page;
 	}
 
@@ -566,13 +565,11 @@ node_error:
 
 void hfs_bnode_free(struct hfs_bnode *node)
 {
-#if 0
 	int i;
 
 	for (i = 0; i < node->tree->pages_per_bnode; i++)
 		if (node->page[i])
 			page_cache_release(node->page[i]);
-#endif
 	kfree(node);
 }
 



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

* [PATCH 4.2 133/134] lib/decompressors: use real out buf size for gunzip with kernel
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (128 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 132/134] hfs,hfsplus: cache pages correctly between bnode_create and bnode_free Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-26 20:56 ` [PATCH 4.2 134/134] jbd2: avoid infinite loop when destroying aborted journal Greg Kroah-Hartman
                   ` (3 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Yinghai Lu, Alexandre Courbot,
	Jon Medhurst, Stephen Warren, H. Peter Anvin, Thomas Gleixner,
	Ingo Molnar, Andrew Morton, Linus Torvalds

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

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

From: Yinghai Lu <yinghai@kernel.org>

commit 2d3862d26e67a59340ba1cf1748196c76c5787de upstream.

When loading x86 64bit kernel above 4GiB with patched grub2, got kernel
gunzip error.

| early console in decompress_kernel
| decompress_kernel:
|       input: [0x807f2143b4-0x807ff61aee]
|      output: [0x807cc00000-0x807f3ea29b] 0x027ea29c: output_len
| boot via startup_64
| KASLR using RDTSC...
|  new output: [0x46fe000000-0x470138cfff] 0x0338d000: output_run_size
|  decompress: [0x46fe000000-0x47007ea29b] <=== [0x807f2143b4-0x807ff61aee]
|
| Decompressing Linux... gz...
|
| uncompression error
|
| -- System halted

the new buffer is at 0x46fe000000ULL, decompressor_gzip is using
0xffffffb901ffffff as out_len.  gunzip in lib/zlib_inflate/inflate.c cap
that len to 0x01ffffff and decompress fails later.

We could hit this problem with crashkernel booting that uses kexec loading
kernel above 4GiB.

We have decompress_* support:
    1. inbuf[]/outbuf[] for kernel preboot.
    2. inbuf[]/flush() for initramfs
    3. fill()/flush() for initrd.
This bug only affect kernel preboot path that use outbuf[].

Add __decompress and take real out_buf_len for gunzip instead of guessing
wrong buf size.

Fixes: 1431574a1c4 (lib/decompressors: fix "no limit" output buffer length)
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Alexandre Courbot <acourbot@nvidia.com>
Cc: Jon Medhurst <tixy@linaro.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@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>

---
 arch/arm/boot/compressed/decompress.c  |    2 +-
 arch/h8300/boot/compressed/misc.c      |    2 +-
 arch/m32r/boot/compressed/misc.c       |    3 ++-
 arch/mips/boot/compressed/decompress.c |    4 ++--
 arch/s390/boot/compressed/misc.c       |    2 +-
 arch/sh/boot/compressed/misc.c         |    2 +-
 arch/unicore32/boot/compressed/misc.c  |    4 ++--
 arch/x86/boot/compressed/misc.c        |    3 ++-
 lib/decompress_bunzip2.c               |    6 +++---
 lib/decompress_inflate.c               |   31 ++++++++++++++++++++++++++-----
 lib/decompress_unlz4.c                 |    6 +++---
 lib/decompress_unlzma.c                |    7 +++----
 lib/decompress_unlzo.c                 |   13 ++++++++++++-
 lib/decompress_unxz.c                  |   12 +++++++++++-
 14 files changed, 70 insertions(+), 27 deletions(-)

--- a/arch/arm/boot/compressed/decompress.c
+++ b/arch/arm/boot/compressed/decompress.c
@@ -57,5 +57,5 @@ extern char * strstr(const char * s1, co
 
 int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x))
 {
-	return decompress(input, len, NULL, NULL, output, NULL, error);
+	return __decompress(input, len, NULL, NULL, output, 0, NULL, error);
 }
--- a/arch/h8300/boot/compressed/misc.c
+++ b/arch/h8300/boot/compressed/misc.c
@@ -70,5 +70,5 @@ void decompress_kernel(void)
 	free_mem_ptr = (unsigned long)&_end;
 	free_mem_end_ptr = free_mem_ptr + HEAP_SIZE;
 
-	decompress(input_data, input_len, NULL, NULL, output, NULL, error);
+	__decompress(input_data, input_len, NULL, NULL, output, 0, NULL, error);
 }
--- a/arch/m32r/boot/compressed/misc.c
+++ b/arch/m32r/boot/compressed/misc.c
@@ -86,6 +86,7 @@ decompress_kernel(int mmu_on, unsigned c
 	free_mem_end_ptr = free_mem_ptr + BOOT_HEAP_SIZE;
 
 	puts("\nDecompressing Linux... ");
-	decompress(input_data, input_len, NULL, NULL, output_data, NULL, error);
+	__decompress(input_data, input_len, NULL, NULL, output_data, 0,
+			NULL, error);
 	puts("done.\nBooting the kernel.\n");
 }
--- a/arch/mips/boot/compressed/decompress.c
+++ b/arch/mips/boot/compressed/decompress.c
@@ -111,8 +111,8 @@ void decompress_kernel(unsigned long boo
 	puts("\n");
 
 	/* Decompress the kernel with according algorithm */
-	decompress((char *)zimage_start, zimage_size, 0, 0,
-		   (void *)VMLINUX_LOAD_ADDRESS_ULL, 0, error);
+	__decompress((char *)zimage_start, zimage_size, 0, 0,
+		   (void *)VMLINUX_LOAD_ADDRESS_ULL, 0, 0, error);
 
 	/* FIXME: should we flush cache here? */
 	puts("Now, booting the kernel...\n");
--- a/arch/s390/boot/compressed/misc.c
+++ b/arch/s390/boot/compressed/misc.c
@@ -167,7 +167,7 @@ unsigned long decompress_kernel(void)
 #endif
 
 	puts("Uncompressing Linux... ");
-	decompress(input_data, input_len, NULL, NULL, output, NULL, error);
+	__decompress(input_data, input_len, NULL, NULL, output, 0, NULL, error);
 	puts("Ok, booting the kernel.\n");
 	return (unsigned long) output;
 }
--- a/arch/sh/boot/compressed/misc.c
+++ b/arch/sh/boot/compressed/misc.c
@@ -132,7 +132,7 @@ void decompress_kernel(void)
 
 	puts("Uncompressing Linux... ");
 	cache_control(CACHE_ENABLE);
-	decompress(input_data, input_len, NULL, NULL, output, NULL, error);
+	__decompress(input_data, input_len, NULL, NULL, output, 0, NULL, error);
 	cache_control(CACHE_DISABLE);
 	puts("Ok, booting the kernel.\n");
 }
--- a/arch/unicore32/boot/compressed/misc.c
+++ b/arch/unicore32/boot/compressed/misc.c
@@ -119,8 +119,8 @@ unsigned long decompress_kernel(unsigned
 	output_ptr = get_unaligned_le32(tmp);
 
 	arch_decomp_puts("Uncompressing Linux...");
-	decompress(input_data, input_data_end - input_data, NULL, NULL,
-			output_data, NULL, error);
+	__decompress(input_data, input_data_end - input_data, NULL, NULL,
+			output_data, 0, NULL, error);
 	arch_decomp_puts(" done, booting the kernel.\n");
 	return output_ptr;
 }
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -424,7 +424,8 @@ asmlinkage __visible void *decompress_ke
 #endif
 
 	debug_putstr("\nDecompressing Linux... ");
-	decompress(input_data, input_len, NULL, NULL, output, NULL, error);
+	__decompress(input_data, input_len, NULL, NULL, output, output_len,
+			NULL, error);
 	parse_elf(output);
 	/*
 	 * 32-bit always performs relocations. 64-bit relocations are only
--- a/lib/decompress_bunzip2.c
+++ b/lib/decompress_bunzip2.c
@@ -743,12 +743,12 @@ exit_0:
 }
 
 #ifdef PREBOOT
-STATIC int INIT decompress(unsigned char *buf, long len,
+STATIC int INIT __decompress(unsigned char *buf, long len,
 			long (*fill)(void*, unsigned long),
 			long (*flush)(void*, unsigned long),
-			unsigned char *outbuf,
+			unsigned char *outbuf, long olen,
 			long *pos,
-			void(*error)(char *x))
+			void (*error)(char *x))
 {
 	return bunzip2(buf, len - 4, fill, flush, outbuf, pos, error);
 }
--- a/lib/decompress_inflate.c
+++ b/lib/decompress_inflate.c
@@ -1,4 +1,5 @@
 #ifdef STATIC
+#define PREBOOT
 /* Pre-boot environment: included */
 
 /* prevent inclusion of _LINUX_KERNEL_H in pre-boot environment: lots
@@ -33,23 +34,23 @@ static long INIT nofill(void *buffer, un
 }
 
 /* Included from initramfs et al code */
-STATIC int INIT gunzip(unsigned char *buf, long len,
+STATIC int INIT __gunzip(unsigned char *buf, long len,
 		       long (*fill)(void*, unsigned long),
 		       long (*flush)(void*, unsigned long),
-		       unsigned char *out_buf,
+		       unsigned char *out_buf, long out_len,
 		       long *pos,
 		       void(*error)(char *x)) {
 	u8 *zbuf;
 	struct z_stream_s *strm;
 	int rc;
-	size_t out_len;
 
 	rc = -1;
 	if (flush) {
 		out_len = 0x8000; /* 32 K */
 		out_buf = malloc(out_len);
 	} else {
-		out_len = ((size_t)~0) - (size_t)out_buf; /* no limit */
+		if (!out_len)
+			out_len = ((size_t)~0) - (size_t)out_buf; /* no limit */
 	}
 	if (!out_buf) {
 		error("Out of memory while allocating output buffer");
@@ -181,4 +182,24 @@ gunzip_nomem1:
 	return rc; /* returns Z_OK (0) if successful */
 }
 
-#define decompress gunzip
+#ifndef PREBOOT
+STATIC int INIT gunzip(unsigned char *buf, long len,
+		       long (*fill)(void*, unsigned long),
+		       long (*flush)(void*, unsigned long),
+		       unsigned char *out_buf,
+		       long *pos,
+		       void (*error)(char *x))
+{
+	return __gunzip(buf, len, fill, flush, out_buf, 0, pos, error);
+}
+#else
+STATIC int INIT __decompress(unsigned char *buf, long len,
+			   long (*fill)(void*, unsigned long),
+			   long (*flush)(void*, unsigned long),
+			   unsigned char *out_buf, long out_len,
+			   long *pos,
+			   void (*error)(char *x))
+{
+	return __gunzip(buf, len, fill, flush, out_buf, out_len, pos, error);
+}
+#endif
--- a/lib/decompress_unlz4.c
+++ b/lib/decompress_unlz4.c
@@ -196,12 +196,12 @@ exit_0:
 }
 
 #ifdef PREBOOT
-STATIC int INIT decompress(unsigned char *buf, long in_len,
+STATIC int INIT __decompress(unsigned char *buf, long in_len,
 			      long (*fill)(void*, unsigned long),
 			      long (*flush)(void*, unsigned long),
-			      unsigned char *output,
+			      unsigned char *output, long out_len,
 			      long *posp,
-			      void(*error)(char *x)
+			      void (*error)(char *x)
 	)
 {
 	return unlz4(buf, in_len - 4, fill, flush, output, posp, error);
--- a/lib/decompress_unlzma.c
+++ b/lib/decompress_unlzma.c
@@ -667,13 +667,12 @@ exit_0:
 }
 
 #ifdef PREBOOT
-STATIC int INIT decompress(unsigned char *buf, long in_len,
+STATIC int INIT __decompress(unsigned char *buf, long in_len,
 			      long (*fill)(void*, unsigned long),
 			      long (*flush)(void*, unsigned long),
-			      unsigned char *output,
+			      unsigned char *output, long out_len,
 			      long *posp,
-			      void(*error)(char *x)
-	)
+			      void (*error)(char *x))
 {
 	return unlzma(buf, in_len - 4, fill, flush, output, posp, error);
 }
--- a/lib/decompress_unlzo.c
+++ b/lib/decompress_unlzo.c
@@ -31,6 +31,7 @@
  */
 
 #ifdef STATIC
+#define PREBOOT
 #include "lzo/lzo1x_decompress_safe.c"
 #else
 #include <linux/decompress/unlzo.h>
@@ -287,4 +288,14 @@ exit:
 	return ret;
 }
 
-#define decompress unlzo
+#ifdef PREBOOT
+STATIC int INIT __decompress(unsigned char *buf, long len,
+			   long (*fill)(void*, unsigned long),
+			   long (*flush)(void*, unsigned long),
+			   unsigned char *out_buf, long olen,
+			   long *pos,
+			   void (*error)(char *x))
+{
+	return unlzo(buf, len, fill, flush, out_buf, pos, error);
+}
+#endif
--- a/lib/decompress_unxz.c
+++ b/lib/decompress_unxz.c
@@ -394,4 +394,14 @@ error_alloc_state:
  * This macro is used by architecture-specific files to decompress
  * the kernel image.
  */
-#define decompress unxz
+#ifdef XZ_PREBOOT
+STATIC int INIT __decompress(unsigned char *buf, long len,
+			   long (*fill)(void*, unsigned long),
+			   long (*flush)(void*, unsigned long),
+			   unsigned char *out_buf, long olen,
+			   long *pos,
+			   void (*error)(char *x))
+{
+	return unxz(buf, len, fill, flush, out_buf, pos, error);
+}
+#endif



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

* [PATCH 4.2 134/134] jbd2: avoid infinite loop when destroying aborted journal
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (129 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 133/134] lib/decompressors: use real out buf size for gunzip with kernel Greg Kroah-Hartman
@ 2015-09-26 20:56 ` Greg Kroah-Hartman
  2015-09-27 18:16 ` [PATCH 4.2 000/134] 4.2.2-stable review Guenter Roeck
                   ` (2 subsequent siblings)
  133 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-26 20:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Eryu Guan, Jan Kara, Theodore Tso

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

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

From: Jan Kara <jack@suse.com>

commit 841df7df196237ea63233f0f9eaa41db53afd70f upstream.

Commit 6f6a6fda2945 "jbd2: fix ocfs2 corrupt when updating journal
superblock fails" changed jbd2_cleanup_journal_tail() to return EIO
when the journal is aborted. That makes logic in
jbd2_log_do_checkpoint() bail out which is fine, except that
jbd2_journal_destroy() expects jbd2_log_do_checkpoint() to always make
a progress in cleaning the journal. Without it jbd2_journal_destroy()
just loops in an infinite loop.

Fix jbd2_journal_destroy() to cleanup journal checkpoint lists of
jbd2_log_do_checkpoint() fails with error.

Reported-by: Eryu Guan <guaneryu@gmail.com>
Tested-by: Eryu Guan <guaneryu@gmail.com>
Fixes: 6f6a6fda294506dfe0e3e0a253bb2d2923f28f0a
Signed-off-by: Jan Kara <jack@suse.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/jbd2/checkpoint.c |   39 +++++++++++++++++++++++++++++++++------
 fs/jbd2/commit.c     |    2 +-
 fs/jbd2/journal.c    |   11 ++++++++++-
 include/linux/jbd2.h |    3 ++-
 4 files changed, 46 insertions(+), 9 deletions(-)

--- a/fs/jbd2/checkpoint.c
+++ b/fs/jbd2/checkpoint.c
@@ -417,12 +417,12 @@ int jbd2_cleanup_journal_tail(journal_t
  * journal_clean_one_cp_list
  *
  * Find all the written-back checkpoint buffers in the given list and
- * release them.
+ * release them. If 'destroy' is set, clean all buffers unconditionally.
  *
  * Called with j_list_lock held.
  * Returns 1 if we freed the transaction, 0 otherwise.
  */
-static int journal_clean_one_cp_list(struct journal_head *jh)
+static int journal_clean_one_cp_list(struct journal_head *jh, bool destroy)
 {
 	struct journal_head *last_jh;
 	struct journal_head *next_jh = jh;
@@ -436,7 +436,10 @@ static int journal_clean_one_cp_list(str
 	do {
 		jh = next_jh;
 		next_jh = jh->b_cpnext;
-		ret = __try_to_free_cp_buf(jh);
+		if (!destroy)
+			ret = __try_to_free_cp_buf(jh);
+		else
+			ret = __jbd2_journal_remove_checkpoint(jh) + 1;
 		if (!ret)
 			return freed;
 		if (ret == 2)
@@ -459,10 +462,11 @@ static int journal_clean_one_cp_list(str
  * journal_clean_checkpoint_list
  *
  * Find all the written-back checkpoint buffers in the journal and release them.
+ * If 'destroy' is set, release all buffers unconditionally.
  *
  * Called with j_list_lock held.
  */
-void __jbd2_journal_clean_checkpoint_list(journal_t *journal)
+void __jbd2_journal_clean_checkpoint_list(journal_t *journal, bool destroy)
 {
 	transaction_t *transaction, *last_transaction, *next_transaction;
 	int ret;
@@ -476,7 +480,8 @@ void __jbd2_journal_clean_checkpoint_lis
 	do {
 		transaction = next_transaction;
 		next_transaction = transaction->t_cpnext;
-		ret = journal_clean_one_cp_list(transaction->t_checkpoint_list);
+		ret = journal_clean_one_cp_list(transaction->t_checkpoint_list,
+						destroy);
 		/*
 		 * This function only frees up some memory if possible so we
 		 * dont have an obligation to finish processing. Bail out if
@@ -492,7 +497,7 @@ void __jbd2_journal_clean_checkpoint_lis
 		 * we can possibly see not yet submitted buffers on io_list
 		 */
 		ret = journal_clean_one_cp_list(transaction->
-				t_checkpoint_io_list);
+				t_checkpoint_io_list, destroy);
 		if (need_resched())
 			return;
 		/*
@@ -506,6 +511,28 @@ void __jbd2_journal_clean_checkpoint_lis
 }
 
 /*
+ * Remove buffers from all checkpoint lists as journal is aborted and we just
+ * need to free memory
+ */
+void jbd2_journal_destroy_checkpoint(journal_t *journal)
+{
+	/*
+	 * We loop because __jbd2_journal_clean_checkpoint_list() may abort
+	 * early due to a need of rescheduling.
+	 */
+	while (1) {
+		spin_lock(&journal->j_list_lock);
+		if (!journal->j_checkpoint_transactions) {
+			spin_unlock(&journal->j_list_lock);
+			break;
+		}
+		__jbd2_journal_clean_checkpoint_list(journal, true);
+		spin_unlock(&journal->j_list_lock);
+		cond_resched();
+	}
+}
+
+/*
  * journal_remove_checkpoint: called after a buffer has been committed
  * to disk (either by being write-back flushed to disk, or being
  * committed to the log).
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -510,7 +510,7 @@ void jbd2_journal_commit_transaction(jou
 	 * frees some memory
 	 */
 	spin_lock(&journal->j_list_lock);
-	__jbd2_journal_clean_checkpoint_list(journal);
+	__jbd2_journal_clean_checkpoint_list(journal, false);
 	spin_unlock(&journal->j_list_lock);
 
 	jbd_debug(3, "JBD2: commit phase 1\n");
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -1693,8 +1693,17 @@ int jbd2_journal_destroy(journal_t *jour
 	while (journal->j_checkpoint_transactions != NULL) {
 		spin_unlock(&journal->j_list_lock);
 		mutex_lock(&journal->j_checkpoint_mutex);
-		jbd2_log_do_checkpoint(journal);
+		err = jbd2_log_do_checkpoint(journal);
 		mutex_unlock(&journal->j_checkpoint_mutex);
+		/*
+		 * If checkpointing failed, just free the buffers to avoid
+		 * looping forever
+		 */
+		if (err) {
+			jbd2_journal_destroy_checkpoint(journal);
+			spin_lock(&journal->j_list_lock);
+			break;
+		}
 		spin_lock(&journal->j_list_lock);
 	}
 
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -1042,8 +1042,9 @@ void jbd2_update_log_tail(journal_t *jou
 extern void jbd2_journal_commit_transaction(journal_t *);
 
 /* Checkpoint list management */
-void __jbd2_journal_clean_checkpoint_list(journal_t *journal);
+void __jbd2_journal_clean_checkpoint_list(journal_t *journal, bool destroy);
 int __jbd2_journal_remove_checkpoint(struct journal_head *);
+void jbd2_journal_destroy_checkpoint(journal_t *journal);
 void __jbd2_journal_insert_checkpoint(struct journal_head *, transaction_t *);
 
 



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

* Re: [PATCH 4.2 000/134] 4.2.2-stable review
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (130 preceding siblings ...)
  2015-09-26 20:56 ` [PATCH 4.2 134/134] jbd2: avoid infinite loop when destroying aborted journal Greg Kroah-Hartman
@ 2015-09-27 18:16 ` Guenter Roeck
  2015-09-27 18:34   ` Greg Kroah-Hartman
  2015-09-28  5:49 ` Sudip Mukherjee
  2015-09-28 17:32 ` Shuah Khan
  133 siblings, 1 reply; 139+ messages in thread
From: Guenter Roeck @ 2015-09-27 18:16 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel; +Cc: torvalds, akpm, shuah.kh, stable

On 09/26/2015 01:54 PM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.2.2 release.
> There are 134 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 Mon Sep 28 20:51:27 UTC 2015.
> Anything received after that time might be too late.
>

Build results:
	total: 144 pass: 144 fail: 0
Qemu test results:
	total: 93 pass: 92 fail: 1
Failed tests:
	mips:fuloong2e_defconfig

Results are as expected. The fix for the qemu test failure is in -next,
but not yet available in mainline.

Details are available at http://server.roeck-us.net:8010/builders.

Guenter


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

* Re: [PATCH 4.2 000/134] 4.2.2-stable review
  2015-09-27 18:16 ` [PATCH 4.2 000/134] 4.2.2-stable review Guenter Roeck
@ 2015-09-27 18:34   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-27 18:34 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-kernel, torvalds, akpm, shuah.kh, stable

On Sun, Sep 27, 2015 at 11:16:49AM -0700, Guenter Roeck wrote:
> On 09/26/2015 01:54 PM, Greg Kroah-Hartman wrote:
> >This is the start of the stable review cycle for the 4.2.2 release.
> >There are 134 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 Mon Sep 28 20:51:27 UTC 2015.
> >Anything received after that time might be too late.
> >
> 
> Build results:
> 	total: 144 pass: 144 fail: 0
> Qemu test results:
> 	total: 93 pass: 92 fail: 1
> Failed tests:
> 	mips:fuloong2e_defconfig
> 
> Results are as expected. The fix for the qemu test failure is in -next,
> but not yet available in mainline.
> 
> Details are available at http://server.roeck-us.net:8010/builders.

Great, thanks for letting me know.

greg k-h

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

* Re: [PATCH 4.2 000/134] 4.2.2-stable review
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (131 preceding siblings ...)
  2015-09-27 18:16 ` [PATCH 4.2 000/134] 4.2.2-stable review Guenter Roeck
@ 2015-09-28  5:49 ` Sudip Mukherjee
  2015-09-28 14:01   ` Greg Kroah-Hartman
  2015-09-28 17:32 ` Shuah Khan
  133 siblings, 1 reply; 139+ messages in thread
From: Sudip Mukherjee @ 2015-09-28  5:49 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, torvalds, akpm, linux, shuah.kh, stable

On Sat, Sep 26, 2015 at 01:54:12PM -0700, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.2.2 release.
> There are 134 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 Mon Sep 28 20:51:27 UTC 2015.
> Anything received after that time might be too late.
Compiled and booted on x86_32. No errors in dmesg.

BTW, avr32 allmodconfig failed. Not new failure. 3 patches will be
needed to fix that. 2 are already in Linus tree. My doubt is if it is
accepted to fix known build failure in stable?

regards
sudip

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

* Re: [PATCH 4.2 000/134] 4.2.2-stable review
  2015-09-28  5:49 ` Sudip Mukherjee
@ 2015-09-28 14:01   ` Greg Kroah-Hartman
  2015-09-28 15:02     ` Sudip Mukherjee
  2015-09-28 15:09     ` Guenter Roeck
  0 siblings, 2 replies; 139+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-28 14:01 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: linux-kernel, torvalds, akpm, linux, shuah.kh, stable

On Mon, Sep 28, 2015 at 11:19:41AM +0530, Sudip Mukherjee wrote:
> On Sat, Sep 26, 2015 at 01:54:12PM -0700, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.2.2 release.
> > There are 134 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 Mon Sep 28 20:51:27 UTC 2015.
> > Anything received after that time might be too late.
> Compiled and booted on x86_32. No errors in dmesg.
> 
> BTW, avr32 allmodconfig failed. Not new failure. 3 patches will be
> needed to fix that. 2 are already in Linus tree. My doubt is if it is
> accepted to fix known build failure in stable?

Yes, that would be fine, what are the git commit ids and why aren't
others seeing this problem?

thanks,

greg k-h

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

* Re: [PATCH 4.2 000/134] 4.2.2-stable review
  2015-09-28 14:01   ` Greg Kroah-Hartman
@ 2015-09-28 15:02     ` Sudip Mukherjee
  2015-09-28 15:09     ` Guenter Roeck
  1 sibling, 0 replies; 139+ messages in thread
From: Sudip Mukherjee @ 2015-09-28 15:02 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, torvalds, akpm, linux, shuah.kh, stable

On Mon, Sep 28, 2015 at 07:01:12AM -0700, Greg Kroah-Hartman wrote:
> On Mon, Sep 28, 2015 at 11:19:41AM +0530, Sudip Mukherjee wrote:
> > On Sat, Sep 26, 2015 at 01:54:12PM -0700, Greg Kroah-Hartman wrote:
> > > This is the start of the stable review cycle for the 4.2.2 release.
> > > There are 134 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 Mon Sep 28 20:51:27 UTC 2015.
> > > Anything received after that time might be too late.
> > Compiled and booted on x86_32. No errors in dmesg.
> > 
> > BTW, avr32 allmodconfig failed. Not new failure. 3 patches will be
> > needed to fix that. 2 are already in Linus tree. My doubt is if it is
> > accepted to fix known build failure in stable?
> 
> Yes, that would be fine, what are the git commit ids and why aren't
> others seeing this problem?
Guenter doesnot test for allmodconfig on avr32.
As of now its still broken on 4.3-rc3.
commit ids needed are:
96be5f2806cd65a2ebced3bfcdf7df0116e6c4a6
and
21343ac21ec7d871e94e98e288f3398a4207d9c0
and the last one is still pending for
drivers/usb/gadget/udc/atmel_usba_udc.c

You can find the build log for 4.2.2-rc1 at:
https://travis-ci.org/sudipm-mukherjee/parport/builds/82379354

regards
sudip

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

* Re: [PATCH 4.2 000/134] 4.2.2-stable review
  2015-09-28 14:01   ` Greg Kroah-Hartman
  2015-09-28 15:02     ` Sudip Mukherjee
@ 2015-09-28 15:09     ` Guenter Roeck
  1 sibling, 0 replies; 139+ messages in thread
From: Guenter Roeck @ 2015-09-28 15:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Sudip Mukherjee
  Cc: linux-kernel, torvalds, akpm, shuah.kh, stable

On 09/28/2015 07:01 AM, Greg Kroah-Hartman wrote:
> On Mon, Sep 28, 2015 at 11:19:41AM +0530, Sudip Mukherjee wrote:
>> On Sat, Sep 26, 2015 at 01:54:12PM -0700, Greg Kroah-Hartman wrote:
>>> This is the start of the stable review cycle for the 4.2.2 release.
>>> There are 134 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 Mon Sep 28 20:51:27 UTC 2015.
>>> Anything received after that time might be too late.
>> Compiled and booted on x86_32. No errors in dmesg.
>>
>> BTW, avr32 allmodconfig failed. Not new failure. 3 patches will be
>> needed to fix that. 2 are already in Linus tree. My doubt is if it is
>> accepted to fix known build failure in stable?
>
> Yes, that would be fine, what are the git commit ids and why aren't
> others seeing this problem?
>

avr32:allmodconfig never built for me if I recall correctly, so I never
added it to my build tests.

There are actually several allmodconfig/allyesconfig builds which historically
never built. Some of them have been addressed over time, but it requires a
substantial effort to keep it that way. On top of that, related failures don't
always have a high priority with developers and/or architecture maintainers.

It is also a matter of resources - while I run several allmodconfig builds,
my test systems are just not powerful enough to do it for all architectures.

So, overall, my approach is to only run allmodconfig for an architecture
if I see an effort by the architecture maintainer(s) to keep it building.

Guenter


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

* Re: [PATCH 4.2 000/134] 4.2.2-stable review
  2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
                   ` (132 preceding siblings ...)
  2015-09-28  5:49 ` Sudip Mukherjee
@ 2015-09-28 17:32 ` Shuah Khan
  133 siblings, 0 replies; 139+ messages in thread
From: Shuah Khan @ 2015-09-28 17:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel; +Cc: torvalds, akpm, linux, shuah.kh, stable

On 09/26/2015 02:54 PM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.2.2 release.
> There are 134 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 Mon Sep 28 20:51:27 UTC 2015.
> 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.2.2-rc1.gz
> and the diffstat can be found below.
> 

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)
shuahkh@osg.samsung.com | (970) 217-8978

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

end of thread, other threads:[~2015-09-28 17:32 UTC | newest]

Thread overview: 139+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-26 20:54 [PATCH 4.2 000/134] 4.2.2-stable review Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 001/134] nfc: st-nci: Remove duplicate file platform_data/st_nci.h Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 002/134] nfc: st-nci: Fix typo when changing from st21nfcb to st-nci Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 003/134] nfc: st-nci: Fix non accurate comment for st_nci_i2c_read Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 004/134] NFC: st21nfca: fix use of uninitialized variables in error path Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 005/134] NFC: st-nci: " Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 006/134] nfc: st-nci: Remove data from ack_pending_q when receiving a SYNC_ACK Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 007/134] nfc: st-nci: Free data with irrelevant NDLC PCB_SYNC value Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 008/134] nfc: netlink: Add check on NFC_ATTR_VENDOR_DATA Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 009/134] nfc: netlink: Warning fix Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 010/134] nfc: nci: hci: Add check on skb nci_hci_send_cmd parameter Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 011/134] blk-mq: fix buffer overflow when reading sysfs file of pending Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 012/134] blk-mq: fix race between timeout and freeing request Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 013/134] unshare: Unsharing a thread does not require unsharing a vm Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 014/134] rtlwifi: rtl8192cu: Add new device ID Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 015/134] rtlwifi: rtl8821ae: Fix an expression that is always false Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 016/134] igb: Fix oops caused by missing queue pairing Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 017/134] tg3: Fix temperature reporting Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 018/134] MIPS: CPS: use 32b accesses to GCRs Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 019/134] MIPS: math-emu: Allow m{f,t}hc emulation on MIPS R6 Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 020/134] MIPS: math-emu: Emulate missing BC1{EQ,NE}Z instructions Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 021/134] mac80211: enable assoc check for mesh interfaces Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 022/134] cxl: Allow release of contexts which have been OPENED but not STARTED Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 023/134] cxl: Remove racy attempt to force EEH invocation in reset Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 024/134] cxl: Fix unbalanced pci_dev_get in cxl_probe Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 025/134] ext4: dont manipulate recovery flag when freezing no-journal fs Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 026/134] Revert "ext4: remove block_device_ejected" Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 027/134] arm64: kconfig: Move LIST_POISON to a safe value Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 028/134] arm64: entry: always restore x0 from the stack on syscall return Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 029/134] arm64: flush FP/SIMD state correctly after execve() Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 030/134] of/fdt: make memblock maximum physical address arch configurable Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 031/134] arm64: set MAX_MEMBLOCK_ADDR according to linear region size Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 032/134] arm64: compat: fix vfp save/restore across signal handlers in big-endian Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 033/134] arm64: head.S: initialise mdcr_el2 in el2_setup Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 034/134] arm64: errata: add module build workaround for erratum #843419 Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 035/134] arm/arm64: KVM: vgic: Check for !irqchip_in_kernel() when mapping resources Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 036/134] KVM: arm64: add workaround for Cortex-A57 erratum #852523 Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 037/134] arm64: KVM: Disable virtual timer even if the guest is not using it Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 038/134] Input: synaptics - fix handling of disabling gesture mode Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 039/134] Input: evdev - do not report errors form flush() Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 040/134] ALSA: usb-audio: correct the value cache check Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 041/134] ALSA: hda - Fix missing inline for dummy snd_hdac_set_codec_wakeup() Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 042/134] ALSA: hda - Enable headphone jack detect on old Fujitsu laptops Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 043/134] ALSA: hda - Use ALC880_FIXUP_FUJITSU for FSC Amilo M1437 Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 044/134] ALSA: hda - Add some FIXUP quirks for white noise on Dell laptop Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 045/134] ALSA: hda - Fix white noise on Dell M3800 Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 046/134] pinctrl: mediatek: Fix multiple registration issue Greg Kroah-Hartman
2015-09-26 20:54 ` [PATCH 4.2 047/134] pinctrl: at91: fix null pointer dereference Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 048/134] powerpc/pseries: Fix corrupted pdn list Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 049/134] powerpc/eeh: Probe after unbalanced kref check Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 050/134] powerpc/eeh: Fix fenced PHB caused by eeh_slot_error_detail() Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 051/134] powerpc/mm: Fix pte_pagesize_index() crash on 4K w/64K hash Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 052/134] powerpc/rtas: Introduce rtas_get_sensor_fast() for IRQ handlers Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 053/134] powerpc: Uncomment and make enable_kernel_vsx() routine available Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 054/134] crypto: vmx - Adding enable_kernel_vsx() to access VSX instructions Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 055/134] powerpc/powernv/pci-ioda: fix 32-bit TCE table init in kdump kernel Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 056/134] powerpc/powernv/pci-ioda: fix kdump with non-power-of-2 crashkernel= Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 057/134] powerpc/pseries: Release DRC when configure_connector fails Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 058/134] powerpc/boot: Specify ABI v2 when building an LE boot wrapper Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 059/134] powerpc/mm: Recompute hash value after a failed update Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 060/134] CIFS: fix type confusion in copy offload ioctl Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 061/134] Add radeon suspend/resume quirk for HP Compaq dc5750 Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 062/134] mm: check if section present during memory block registering Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 063/134] x86/mm: Initialize pmd_idx in page_table_range_init_count() Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 066/134] cxl: Dont remove AFUs/vPHBs in cxl_reset Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 068/134] [media] v4l: omap3isp: Fix sub-device power management code Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 069/134] [media] media: am437x-vpfe: Requested frame size and fmt overwritten by current sensor setting Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 070/134] [media] media: am437x-vpfe: Fix a race condition during release Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 071/134] [media] v4l: xilinx: missing error code Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 072/134] [media] v4l: omap3isp: Fix async notifier registration order Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 073/134] Btrfs: check if previous transaction aborted to avoid fs corruption Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 074/134] nfsd: Fix an FS_LAYOUT_TYPES/LAYOUT_TYPES encode bug Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 075/134] nfsd: ensure that the ol stateid hash reference is only put once Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 076/134] nfsd: ensure that delegation stateid hash references are " Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 077/134] NFSv4.1/pnfs: Fix atomicity of commit list updates Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 078/134] NFSv4: dont set SETATTR for O_RDONLY|O_EXCL Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 079/134] NFS: Dont let the ctime override attribute barriers Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 080/134] NFSv4.1/pNFS: Fix borken function _same_data_server_addrs_locked() Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 081/134] NFS: Fix a NULL pointer dereference of migration recovery ops for v4.2 client Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 082/134] NFS: nfs_set_pgio_error sometimes misses errors Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 083/134] NFS41/flexfiles: update inode after write finishes Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 084/134] NFSv4: Force a post-op attribute update when holding a delegation Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 085/134] NFS41/flexfiles: zero out DS write wcc Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 086/134] NFSv4.1/flexfiles: Fix a protocol error in layoutreturn Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 087/134] NFSv4.1: Fix a protocol issue with CLOSE stateids Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 088/134] nfs: Fix truncated client owner id without proto type Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 089/134] Revert "NFSv4: Remove incorrect check in can_open_delegated()" Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 090/134] svcrdma: Change maximum server payload back to RPCSVC_MAXPAYLOAD Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 091/134] net: sunrpc: fix tracepoint Warning: unknown op -> Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 092/134] SUNRPC: Fix a thinko in xs_connect() Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 093/134] SUNRPC: xs_reset_transport must mark the connection as disconnected Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 094/134] SUNRPC: Ensure that we wait for connections to complete before retrying Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 095/134] SUNRPC: Lock the transport layer on shutdown Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 096/134] rtc: s3c: fix disabled clocks for alarm Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 097/134] rtc: s5m: fix to update ctrl register Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 098/134] rtc: abx80x: fix RTC write bit Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 099/134] PCI,parisc: Enable 64-bit bus addresses on PA-RISC Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 100/134] parisc: Use double word condition in 64bit CAS operation Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 101/134] parisc: Filter out spurious interrupts in PA-RISC irq handler Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 102/134] workqueue: Make flush_workqueue() available again to non GPL modules Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 103/134] vmscan: fix increasing nr_isolated incurred by putback unevictable pages Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 104/134] fs: if a coredump already exists, unlink and recreate with O_EXCL Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 105/134] fs: Dont dump core if the corefile would become world-readable Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 106/134] mmc: sdhci-pci: set the clear transfer mode register quirk for O2Micro Greg Kroah-Hartman
2015-09-26 20:55 ` [PATCH 4.2 107/134] mmc: sdhci-of-esdhc: add workaround for pre divider initial value Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 108/134] mmc: sdhci: also get preset value and driver type for MMC_DDR52 Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 109/134] mmc: sdhci: fix dma memory leak in sdhci_pre_req() Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 110/134] mmc: core: fix race condition in mmc_wait_data_done Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 111/134] iommu/fsl: Really fix init section(s) content Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 112/134] iommu/io-pgtable-arm: Unmap and free table when overwriting with block Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 113/134] iommu/tegra-smmu: Parameterize number of TLB lines Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 114/134] iommu/vt-d: Really use upper context table when necessary Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 115/134] eCryptfs: Invalidate dcache entries when lower i_nlink is zero Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 116/134] hfs: fix B-tree corruption after insertion at position 0 Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 117/134] i2c: xgene-slimpro: dma_mapping_error() doesnt return an error code Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 118/134] ideapad-laptop: Add Lenovo Yoga 3 14 to no_hw_rfkill dmi list Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 119/134] IB/srp: Handle partial connection success correctly Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 120/134] IB/srp: Stop the scsi_eh_<n> and scsi_tmf_<n> threads if login fails Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 121/134] IB/qib: Change lkey table allocation to support more MRs Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 122/134] IB/uverbs: reject invalid or unknown opcodes Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 123/134] IB/uverbs: Fix race between ib_uverbs_open and remove_one Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 124/134] IB/iser: Fix missing return status check in iser_send_data_out Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 125/134] IB/iser: Fix possible bogus DMA unmapping Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 126/134] IB/mlx5: avoid destroying a NULL mr in reg_user_mr error flow Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 127/134] IB/mlx4: Fix potential deadlock when sending mad to wire Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 128/134] IB/mlx4: Forbid using sysfs to change RoCE pkeys Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 129/134] IB/mlx4: Use correct SL on AH query under RoCE Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 130/134] IB/mlx4: Fix incorrect cq flushing in error state Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 131/134] stmmac: fix check for phydev being open Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 132/134] hfs,hfsplus: cache pages correctly between bnode_create and bnode_free Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 133/134] lib/decompressors: use real out buf size for gunzip with kernel Greg Kroah-Hartman
2015-09-26 20:56 ` [PATCH 4.2 134/134] jbd2: avoid infinite loop when destroying aborted journal Greg Kroah-Hartman
2015-09-27 18:16 ` [PATCH 4.2 000/134] 4.2.2-stable review Guenter Roeck
2015-09-27 18:34   ` Greg Kroah-Hartman
2015-09-28  5:49 ` Sudip Mukherjee
2015-09-28 14:01   ` Greg Kroah-Hartman
2015-09-28 15:02     ` Sudip Mukherjee
2015-09-28 15:09     ` Guenter Roeck
2015-09-28 17:32 ` Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).