Skip to contentSkip to conversation

4.1.6-stable review

PATCH In review Greg Kroah-Hartman 7 participants 86 messages Sep 11, 2015 – Sep 12, 2015

Subsystems (7)
lore
Share & tools
lore

Greg Kroah-Hartman

author maintainer
#0 lore raw

cover 4.1.6-stable review

This is the start of the stable review cycle for the 4.1.6 release. There are 78 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 Sun Sep 13 22:45:29 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.1.6-rc1.gz

and the diffstat can be found below.

thanks,

greg k-h

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

Greg Kroah-Hartman <[email protected]>

    Linux 4.1.6-rc1

Jisheng Zhang <[email protected]>
x86/idle: Restore trace_cpu_idle to mwait_idle() calls

Thomas Gleixner <[email protected]>
x86/apic: Fix fallout from x2apic cleanup

David Vrabel <[email protected]>
x86/xen: make CONFIG_XEN depend on CONFIG_X86_LOCAL_APIC

Shannon Zhao <[email protected]>

    arm64: perf: fix unassigned cpu_pmu->plat_device when probing PMU PPIs

Marc Zyngier <[email protected]>
arm64: KVM: Fix host crash when injecting a fault into a 32bit guest

Hiral Shah <[email protected]>
fnic: Use the local variable instead of I/O flag to acquire io_req_lock in fnic_queuecommand() to avoid deadloack

Guillermo A. Amaral <[email protected]>
Add factory recertified Crucial M500s to blacklist

Marc Kleine-Budde <[email protected]>
can: pcan_usb: don't provide CAN FD bittimings by non-FD adapters

Alan Stern <[email protected]>
SCSI: Fix NULL pointer dereference in runtime PM

Grygorii Strashko <[email protected]>
genirq: Introduce irq_chip_set_type_parent() helper

Grygorii Strashko <[email protected]>
genirq: Don't return ENOSYS in irq_chip_retrigger_hierarchy

Grygorii Strashko <[email protected]>
ARM: OMAP: wakeupgen: Restore the irq_set_type() mechanism

Grygorii Strashko <[email protected]>
irqchip/crossbar: Restore set_wake functionality

Grygorii Strashko <[email protected]>
irqchip/crossbar: Restore the mask on suspend behaviour

Grygorii Strashko <[email protected]>
irqchip/crossbar: Restore the irq_set_type() mechanism

Vincent Bernat <[email protected]>
9p: ensure err is initialized to 0 in p9_client_read/write

Thulasimani,Sivakumar <[email protected]>
drm/i915: Avoid TP3 on CHV

Thulasimani,Sivakumar <[email protected]>
drm/i915: remove HBR2 from chv supported list

Chris Wilson <[email protected]>
drm/i915: Flag the execlists context object as dirty after every use

Thierry Reding <[email protected]>
drm/atmel-hlcdc: Compile suspend/resume for PM_SLEEP only

Vincent Pelletier <[email protected]>
Input: gpio_keys_polled - request GPIO pin as input.

Bjorn Helgaas <[email protected]>
PCI: Don't use 64-bit bus addresses on PA-RISC

Alexei Potashnik <[email protected]>
target/iscsi: Fix double free of a TUR followed by a solicited NOPOUT

Adrien Schildknecht <[email protected]>
mac80211: fix invalid read in minstrel_sort_best_tp_rates()

Markus Osterhoff <[email protected]>
ALSA: hda: fix possible NULL dereference

Takashi Iwai <[email protected]>
ALSA: hda - Fix path power activation

Takashi Iwai <[email protected]>
ALSA: hda - Check all inputs for is_active_nid_for_any()

David Henningsson <[email protected]>
ALSA: hda - Shutdown CX20722 on reboot/free to avoid spurious noises

Jurgen Kramer <[email protected]>
ALSA: usb: Add native DSD support for Gustard DAC-X20U

Woodrow Shen <[email protected]>
ALSA: hda - Fix the white noise on Dell laptop

Takashi Iwai <[email protected]>
ALSA: usb-audio: Fix runtime PM unbalance

Alban Crequy <[email protected]>

    cpuset: use trialcs->mems_allowed as a temp variable

Tejun Heo <[email protected]>
Revert "libata: Implement NCQ autosense"

Tejun Heo <[email protected]>
Revert "libata: Implement support for sense data reporting"

Tejun Heo <[email protected]>
Revert "libata-eh: Set 'information' field for autosense"

Horia Geant? <[email protected]>
crypto: caam - fix memory corruption in ahash_final_ctx

Jan Stancek <[email protected]>
crypto: nx - respect sg limit bounds when building sg lists for SHA

Martin K. Petersen <[email protected]>
sd: Fix maximum I/O size for BLOCK_PC requests

John Soni Jose <[email protected]>
libiscsi: Fix host busy blocking during connection teardown

Markos Chandras <[email protected]>
MIPS: Fix seccomp syscall argument for MIPS64

Guenter Roeck <[email protected]>
regmap: regcache-rbtree: Clean new present bits on present bitmap resize

Linus Torvalds <[email protected]>
Revert x86 sigcontext cleanups

Charles Keepax <[email protected]>
mfd: arizona: Fix initialisation of the PM runtime

Russell King <[email protected]>
ARM: invalidate L1 before enabling coherency

Russell King <[email protected]>
ARM: v7 setup function should invalidate L1 cache

Nathan Lynch <[email protected]>
ARM: 8384/1: VDSO: force use of BFD linker

Nathan Lynch <[email protected]>
ARM: 8385/1: VDSO: group link options

Kishon Vijay Abraham I <[email protected]>
ARM: dts: OMAP5: Fix broken pbias device creation

Kishon Vijay Abraham I <[email protected]>
ARM: dts: OMAP4: Fix broken pbias device creation

Kishon Vijay Abraham I <[email protected]>
ARM: dts: dra7: Fix broken pbias device creation

Kishon Vijay Abraham I <[email protected]>
ARM: dts: omap243x: Fix broken pbias device creation

Lucas Stach <[email protected]>
ARM: imx6: correct i.MX6 PCIe interrupt routing

Bart Van Assche <[email protected]>
libfc: Fix fc_fcp_cleanup_each_cmd()

Bart Van Assche <[email protected]>
libfc: Fix fc_exch_recv_req() error path

Thomas Hellstrom <[email protected]>
drm/vmwgfx: Fix execbuf locking issues

Alex Deucher <[email protected]>
drm/radeon: add new OLAND pci id

Dan Carpenter <[email protected]>
HID: uclogic: fix limit in uclogic_tablet_enable()

Krzysztof Kozlowski <[email protected]>
HID: hid-input: Fix accessing freed memory during device disconnect

Michael Walle <[email protected]>

    EDAC, ppc4xx: Access mci->csrows array elements properly

Richard Weinberger <[email protected]>
localmodconfig: Use Kbuild files too

Joe Thornber <[email protected]>
dm thin metadata: delete btrees when releasing metadata snapshot

Julien Grall <[email protected]>
xen/xenbus: Don't leak memory when unmapping the ring on HVM backend

Jason A. Donenfeld <[email protected]>
x86/xen: build "Xen PV" APIC driver for domU as well

Luis Felipe Dominguez Vega <[email protected]>
rtlwifi: Fix NULL dereference when PCI driver used as an AP

Larry Finger <[email protected]>
rtlwifi: rtl8723be: Add module parameter for MSI interrupts

Emmanuel Grumbach <[email protected]>
iwlwifi: pcie: fix prepare card flow

Peter Zijlstra <[email protected]>
perf: Fix PERF_EVENT_IOC_PERIOD migration race

Ben Hutchings <[email protected]>
perf: Fix double-free of the AUX buffer

Peter Zijlstra <[email protected]>
perf: Fix running time accounting

Peter Zijlstra <[email protected]>
perf: Fix fasync handling on inherited events

Mike Looijmans <[email protected]>
rsi: Fix failure to load firmware after memory leak fix and fix the leak

Bob Liu <[email protected]>
xen-blkback: replace work_pending with work_busy in purge_persistent_gnt()

Bob Liu <[email protected]>
xen-blkfront: don't add indirect pages to list when !feature_persistent

Robert Jarzmik <[email protected]>
clk: pxa: pxa3xx: fix CKEN register access

Wanpeng Li <[email protected]>
mm/hwpoison: fix fail isolate hugetlbfs page w/ refcount held

Wanpeng Li <[email protected]>
mm/hwpoison: fix page refcount of unknown non LRU page

Manfred Spraul <[email protected]>
ipc/sem.c: update/correct memory barriers

Herton R. Krzesinski <[email protected]>
ipc,sem: fix use after free on IPC_RMID after a task using same semaphore set exits

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

Diffstat:

 Makefile                                     |   2 +-
 arch/arm/boot/dts/dra7.dtsi                  |   2 +-
 arch/arm/boot/dts/imx6qdl.dtsi               |   8 +-
 arch/arm/boot/dts/omap2430.dtsi              |   3 +-
 arch/arm/boot/dts/omap4.dtsi                 |   3 +-
 arch/arm/boot/dts/omap5.dtsi                 |   3 +-
 arch/arm/mach-bcm/Makefile                   |   2 +-
 arch/arm/mach-bcm/brcmstb.h                  |  19 -----
 arch/arm/mach-bcm/headsmp-brcmstb.S          |  33 ---------
 arch/arm/mach-bcm/platsmp-brcmstb.c          |   4 +-
 arch/arm/mach-berlin/headsmp.S               |   6 --
 arch/arm/mach-berlin/platsmp.c               |   3 +-
 arch/arm/mach-hisi/Makefile                  |   2 +-
 arch/arm/mach-hisi/core.h                    |   1 -
 arch/arm/mach-hisi/headsmp.S                 |  16 ----
 arch/arm/mach-hisi/platsmp.c                 |   4 +-
 arch/arm/mach-imx/headsmp.S                  |   1 -
 arch/arm/mach-mvebu/headsmp-a9.S             |   1 -
 arch/arm/mach-omap2/omap-wakeupgen.c         |   1 +
 arch/arm/mach-prima2/headsmp.S               |   1 -
 arch/arm/mach-rockchip/core.h                |   1 -
 arch/arm/mach-rockchip/headsmp.S             |   8 --
 arch/arm/mach-rockchip/platsmp.c             |   5 +-
 arch/arm/mach-shmobile/common.h              |   1 -
 arch/arm/mach-shmobile/headsmp-scu.S         |   4 +-
 arch/arm/mach-shmobile/headsmp.S             |   7 --
 arch/arm/mach-shmobile/platsmp-apmu.c        |   2 +-
 arch/arm/mach-socfpga/core.h                 |   1 -
 arch/arm/mach-socfpga/headsmp.S              |   5 --
 arch/arm/mach-socfpga/platsmp.c              |   2 +-
 arch/arm/mach-tegra/Makefile                 |   2 +-
 arch/arm/mach-tegra/headsmp.S                |  12 ---
 arch/arm/mach-tegra/reset.c                  |   2 +-
 arch/arm/mach-tegra/reset.h                  |   1 -
 arch/arm/mach-zynq/common.h                  |   2 -
 arch/arm/mach-zynq/headsmp.S                 |   5 --
 arch/arm/mach-zynq/platsmp.c                 |   5 +-
 arch/arm/mm/proc-v7.S                        |  16 ++--
 arch/arm/vdso/Makefile                       |  18 +++--
 arch/arm64/kernel/perf_event.c               |   3 +-
 arch/arm64/kvm/inject_fault.c                |  12 +--
 arch/mips/kernel/scall64-64.S                |   2 +-
 arch/mips/kernel/scall64-n32.S               |   2 +-
 arch/x86/include/asm/sigcontext.h            |   6 +-
 arch/x86/include/uapi/asm/sigcontext.h       |  21 +-----
 arch/x86/kernel/apic/apic.c                  |  14 ++--
 arch/x86/kernel/process.c                    |   2 +
 arch/x86/kernel/signal.c                     |  26 +++----
 arch/x86/xen/Kconfig                         |   4 +-
 arch/x86/xen/Makefile                        |   4 +-
 arch/x86/xen/xen-ops.h                       |   6 +-
 block/blk-settings.c                         |   4 +-
 drivers/ata/libata-core.c                    |  26 ++-----
 drivers/ata/libata-eh.c                      | 105 +--------------------------
 drivers/ata/libata-scsi.c                    |  21 +-----
 drivers/ata/libata.h                         |   6 +-
 drivers/base/regmap/regcache-rbtree.c        |  19 +++--
 drivers/block/xen-blkback/blkback.c          |   4 +-
 drivers/block/xen-blkfront.c                 |   6 +-
 drivers/clk/pxa/clk-pxa3xx.c                 |   2 +-
 drivers/crypto/caam/caamhash.c               |   7 +-
 drivers/crypto/nx/nx-sha256.c                |  27 ++++---
 drivers/crypto/nx/nx-sha512.c                |  28 ++++---
 drivers/edac/ppc4xx_edac.c                   |   2 +-
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c |   2 +-
 drivers/gpu/drm/i915/intel_dp.c              |  29 ++++++--
 drivers/gpu/drm/i915/intel_lrc.c             |   2 +
 drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c      |   4 +-
 drivers/hid/hid-input.c                      |   7 +-
 drivers/hid/hid-uclogic.c                    |   2 +-
 drivers/input/keyboard/gpio_keys_polled.c    |   2 +-
 drivers/irqchip/irq-crossbar.c               |   4 +-
 drivers/md/dm-thin-metadata.c                |   4 +-
 drivers/mfd/arizona-core.c                   |  14 ++--
 drivers/net/can/usb/peak_usb/pcan_usb.c      |  24 +++---
 drivers/net/can/usb/peak_usb/pcan_usb_core.c |   4 +-
 drivers/net/can/usb/peak_usb/pcan_usb_core.h |   4 +-
 drivers/net/can/usb/peak_usb/pcan_usb_fd.c   |  96 +++++++++++++-----------
 drivers/net/can/usb/peak_usb/pcan_usb_pro.c  |  24 +++---
 drivers/net/wireless/iwlwifi/pcie/trans.c    |  22 +++++-
 drivers/net/wireless/rsi/rsi_91x_sdio_ops.c  |   8 +-
 drivers/net/wireless/rsi/rsi_91x_usb_ops.c   |   4 +
 drivers/net/wireless/rtlwifi/core.c          |   7 +-
 drivers/net/wireless/rtlwifi/rtl8723be/sw.c  |   1 +
 drivers/pci/Kconfig                          |   2 +-
 drivers/scsi/fnic/fnic.h                     |   2 +-
 drivers/scsi/fnic/fnic_scsi.c                |   4 +-
 drivers/scsi/libfc/fc_exch.c                 |   8 +-
 drivers/scsi/libfc/fc_fcp.c                  |  19 ++++-
 drivers/scsi/libiscsi.c                      |  25 +------
 drivers/scsi/scsi_error.c                    |  31 --------
 drivers/scsi/scsi_pm.c                       |  22 +++---
 drivers/scsi/sd.c                            |   6 +-
 drivers/target/iscsi/iscsi_target.c          |   4 +-
 drivers/xen/xenbus/xenbus_client.c           |   4 +-
 include/drm/drm_pciids.h                     |   1 +
 include/linux/ata.h                          |  18 -----
 include/linux/irq.h                          |   1 +
 include/scsi/scsi_eh.h                       |   1 -
 ipc/sem.c                                    |  41 ++++++++---
 kernel/cpuset.c                              |   2 +-
 kernel/events/core.c                         |  91 +++++++++++++++++------
 kernel/events/ring_buffer.c                  |  10 ++-
 kernel/irq/chip.c                            |  19 ++++-
 mm/memory-failure.c                          |  15 ++--
 net/9p/client.c                              |   2 +
 net/mac80211/rc80211_minstrel.c              |  11 +--
 scripts/kconfig/streamline_config.pl         |   2 +-
 sound/pci/hda/hda_codec.c                    |   2 +-
 sound/pci/hda/hda_generic.c                  |  11 +--
 sound/pci/hda/patch_conexant.c               |  23 +++++-
 sound/pci/hda/patch_realtek.c                |   1 +
 sound/usb/card.c                             |   2 +-
 sound/usb/quirks.c                           |   1 +
 114 files changed, 544 insertions(+), 674 deletions(-)
author maintainer
#1 lore raw

PATCH 1/78 ipc,sem: fix use after free on IPC_RMID after a task using same semaphore set exits

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

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

From: "Herton R. Krzesinski" <[email protected]>

commit 602b8593d2b4138c10e922eeaafe306f6b51817b upstream.

The current semaphore code allows a potential use after free: in exit_sem we may free the task's sem_undo_list while there is still another task looping through the same semaphore set and cleaning the sem_undo list at freeary function (the task called IPC_RMID for the same semaphore set).

For example, with a test program [1] running which keeps forking a lot of processes (which then do a semop call with SEM_UNDO flag), and with the parent right after removing the semaphore set with IPC_RMID, and a kernel built with CONFIG_SLAB, CONFIG_SLAB_DEBUG and CONFIG_DEBUG_SPINLOCK, you can easily see something like the following in the kernel log:

Slab corruption (Not tainted): kmalloc-64 start=ffff88003b45c1c0, len=64 000: 6b 6b 6b 6b 6b 6b 6b 6b 00 6b 6b 6b 6b 6b 6b 6b kkkkkkkk.kkkkkkk 010: ff ff ff ff 6b 6b 6b 6b ff ff ff ff ff ff ff ff ....kkkk........ Prev obj: start=ffff88003b45c180, len=64
000: 00 00 00 00 ad 4e ad de ff ff ff ff 5a 5a 5a 5a .....N......ZZZZ 010: ff ff ff ff ff ff ff ff c0 fb 01 37 00 88 ff ff ...........7.... Next obj: start=ffff88003b45c200, len=64
000: 00 00 00 00 ad 4e ad de ff ff ff ff 5a 5a 5a 5a .....N......ZZZZ 010: ff ff ff ff ff ff ff ff 68 29 a7 3c 00 88 ff ff ........h).<....

   BUG: spinlock wrong CPU on CPU#2, test/18028
   general protection fault: 0000 [#1] SMP
   Modules linked in: 8021q mrp garp stp llc nf_conntrack_ipv4 nf_defrag_ipv4 ip6t_REJECT nf_reject_ipv6 nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables binfmt_misc ppdev input_leds joydev parport_pc parport floppy serio_raw virtio_balloon virtio_rng virtio_console virtio_net iosf_mbi crct10dif_pclmul crc32_pclmul ghash_clmulni_intel pcspkr qxl ttm drm_kms_helper drm snd_hda_codec_generic i2c_piix4 snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer snd soundcore crc32c_intel virtio_pci virtio_ring virtio pata_acpi ata_generic [last unloaded: speedstep_lib]
   CPU: 2 PID: 18028 Comm: test Not tainted 4.2.0-rc5+ #1
   Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.8.1-20150318_183358- 04/01/2014
   RIP: spin_dump+0x53/0xc0
   Call Trace:
     spin_bug+0x30/0x40
     do_raw_spin_unlock+0x71/0xa0
     _raw_spin_unlock+0xe/0x10
     freeary+0x82/0x2a0
     ? _raw_spin_lock+0xe/0x10
     semctl_down.clone.0+0xce/0x160
     ? __do_page_fault+0x19a/0x430
     ? __audit_syscall_entry+0xa8/0x100
     SyS_semctl+0x236/0x2c0
     ? syscall_trace_leave+0xde/0x130
     entry_SYSCALL_64_fastpath+0x12/0x71
   Code: 8b 80 88 03 00 00 48 8d 88 60 05 00 00 48 c7 c7 a0 2c a4 81 31 c0 65 8b 15 eb 40 f3 7e e8 08 31 68 00 4d 85 e4 44 8b 4b 08 74 5e <45> 8b 84 24 88 03 00 00 49 8d 8c 24 60 05 00 00 8b 53 04 48 89
   RIP  [<ffffffff810d6053>] spin_dump+0x53/0xc0
    RSP <ffff88003750fd68>
   ---[ end trace 783ebb76612867a0 ]---
   NMI watchdog: BUG: soft lockup - CPU#3 stuck for 22s! [test:18053]
   Modules linked in: 8021q mrp garp stp llc nf_conntrack_ipv4 nf_defrag_ipv4 ip6t_REJECT nf_reject_ipv6 nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables binfmt_misc ppdev input_leds joydev parport_pc parport floppy serio_raw virtio_balloon virtio_rng virtio_console virtio_net iosf_mbi crct10dif_pclmul crc32_pclmul ghash_clmulni_intel pcspkr qxl ttm drm_kms_helper drm snd_hda_codec_generic i2c_piix4 snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer snd soundcore crc32c_intel virtio_pci virtio_ring virtio pata_acpi ata_generic [last unloaded: speedstep_lib]
   CPU: 3 PID: 18053 Comm: test Tainted: G      D         4.2.0-rc5+ #1
   Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.8.1-20150318_183358- 04/01/2014
   RIP: native_read_tsc+0x0/0x20
   Call Trace:
     ? delay_tsc+0x40/0x70
     __delay+0xf/0x20
     do_raw_spin_lock+0x96/0x140
     _raw_spin_lock+0xe/0x10
     sem_lock_and_putref+0x11/0x70
     SYSC_semtimedop+0x7bf/0x960
     ? handle_mm_fault+0xbf6/0x1880
     ? dequeue_task_fair+0x79/0x4a0
     ? __do_page_fault+0x19a/0x430
     ? kfree_debugcheck+0x16/0x40
     ? __do_page_fault+0x19a/0x430
     ? __audit_syscall_entry+0xa8/0x100
     ? do_audit_syscall_entry+0x66/0x70
     ? syscall_trace_enter_phase1+0x139/0x160
     SyS_semtimedop+0xe/0x10
     SyS_semop+0x10/0x20
     entry_SYSCALL_64_fastpath+0x12/0x71
   Code: 47 10 83 e8 01 85 c0 89 47 10 75 08 65 48 89 3d 1f 74 ff 7e c9 c3 0f 1f 44 00 00 55 48 89 e5 e8 87 17 04 00 66 90 c9 c3 0f 1f 00 <55> 48 89 e5 0f 31 89 c1 48 89 d0 48 c1 e0 20 89 c9 48 09 c8 c9
   Kernel panic - not syncing: softlockup: hung tasks

I wasn't able to trigger any badness on a recent kernel without the proper config debugs enabled, however I have softlockup reports on some kernel versions, in the semaphore code, which are similar as above (the scenario is seen on some servers running IBM DB2 which uses semaphore syscalls).

The patch here fixes the race against freeary, by acquiring or waiting on the sem_undo_list lock as necessary (exit_sem can race with freeary, while freeary sets un->semid to -1 and removes the same sem_undo from list_proc or when it removes the last sem_undo).

After the patch I'm unable to reproduce the problem using the test case [1].

[1] Test case used below:

    #include <stdio.h>
    #include <sys/types.h>
    #include <sys/ipc.h>
    #include <sys/sem.h>
    #include <sys/wait.h>
    #include <stdlib.h>
    #include <time.h>
    #include <unistd.h>
    #include <errno.h>

    #define NSEM 1
    #define NSET 5

    int sid[NSET];

    void thread()
    {
            struct sembuf op;
            int s;
            uid_t pid = getuid();

            s = rand() % NSET;
            op.sem_num = pid % NSEM;
            op.sem_op = 1;
            op.sem_flg = SEM_UNDO;

            semop(sid[s], &op, 1);
            exit(EXIT_SUCCESS);
    }

    void create_set()
    {
            int i, j;
            pid_t p;
            union {
                    int val;
                    struct semid_ds *buf;
                    unsigned short int *array;
                    struct seminfo *__buf;
            } un;

            /* Create and initialize semaphore set */
            for (i = 0; i < NSET; i++) {
                    sid[i] = semget(IPC_PRIVATE , NSEM, 0644 | IPC_CREAT);
                    if (sid[i] < 0) {
                            perror("semget");
                            exit(EXIT_FAILURE);
                    }
            }
            un.val = 0;
            for (i = 0; i < NSET; i++) {
                    for (j = 0; j < NSEM; j++) {
                            if (semctl(sid[i], j, SETVAL, un) < 0)
                                    perror("semctl");
                    }
            }

            /* Launch threads that operate on semaphore set */
            for (i = 0; i < NSEM * NSET * NSET; i++) {
                    p = fork();
                    if (p < 0)
                            perror("fork");
                    if (p == 0)
                            thread();
            }

            /* Free semaphore set */
            for (i = 0; i < NSET; i++) {
                    if (semctl(sid[i], NSEM, IPC_RMID))
                            perror("IPC_RMID");
            }

            /* Wait for forked processes to exit */
            while (wait(NULL)) {
                    if (errno == ECHILD)
                            break;
            };
    }

    int main(int argc, char **argv)
    {
            pid_t p;

            srand(time(NULL));

            while (1) {
                    p = fork();
                    if (p < 0) {
                            perror("fork");
                            exit(EXIT_FAILURE);
                    }
                    if (p == 0) {
                            create_set();
                            goto end;
                    }

                    /* Wait for forked processes to exit */
                    while (wait(NULL)) {
                            if (errno == ECHILD)
                                    break;
                    };
            }
    end:
            return 0;
    }
[[email protected]: use normal comment layout]
Cc Davidlohr Bueso <[email protected]>
Cc Rafael Aquini <[email protected]>
CC Aristeu Rozanski <[email protected]>
Cc David Jeffery <[email protected]>
---
 ipc/sem.c |   23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)
ipc/sem.c +17 -6
@@ -2074,17 +2074,28 @@ void exit_sem(struct task_struct *tsk)
 		rcu_read_lock();
 		un = list_entry_rcu(ulp->list_proc.next,
 				    struct sem_undo, list_proc);
-		if (&un->list_proc == &ulp->list_proc)
-			semid = -1;
-		 else
-			semid = un->semid;
+		if (&un->list_proc == &ulp->list_proc) {
+			/*
+			 * We must wait for freeary() before freeing this ulp,
+			 * in case we raced with last sem_undo. There is a small
+			 * possibility where we exit while freeary() didn't
+			 * finish unlocking sem_undo_list.
+			 */
+			spin_unlock_wait(&ulp->lock);
+			rcu_read_unlock();
+			break;
+		}
+		spin_lock(&ulp->lock);
+		semid = un->semid;
+		spin_unlock(&ulp->lock);
 
+		/* exit_sem raced with IPC_RMID, nothing to do */
 		if (semid == -1) {
 			rcu_read_unlock();
-			break;
+			continue;
 		}
 
-		sma = sem_obtain_object_check(tsk->nsproxy->ipc_ns, un->semid);
+		sma = sem_obtain_object_check(tsk->nsproxy->ipc_ns, semid);
 		/* exit_sem raced with IPC_RMID, nothing to do */
 		if (IS_ERR(sma)) {
 			rcu_read_unlock();
author maintainer
#2 lore raw

PATCH 2/78 ipc/sem.c: update/correct memory barriers

In reply to Greg Kroah-Hartman

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

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

From: Manfred Spraul <[email protected]>

commit 3ed1f8a99d70ea1cd1508910eb107d0edcae5009 upstream.

sem_lock() did not properly pair memory barriers:

!spin_is_locked() and spin_unlock_wait() are both only control barriers. The code needs an acquire barrier, otherwise the cpu might perform read operations before the lock test.

As no primitive exists inside <include/spinlock.h> and since it seems noone wants another primitive, the code creates a local primitive within ipc/sem.c.

With regards to -stable:

The change of sem_wait_array() is a bugfix, the change to sem_lock() is a nop (just a preprocessor redefinition to improve the readability). The bugfix is necessary for all kernels that use sem_wait_array() (i.e.:
starting from 3.10).

---
 ipc/sem.c |   18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
ipc/sem.c +14 -4
@@ -253,6 +253,16 @@ static void sem_rcu_free(struct rcu_head
 }
 
 /*
+ * spin_unlock_wait() and !spin_is_locked() are not memory barriers, they
+ * are only control barriers.
+ * The code must pair with spin_unlock(&sem->lock) or
+ * spin_unlock(&sem_perm.lock), thus just the control barrier is insufficient.
+ *
+ * smp_rmb() is sufficient, as writes cannot pass the control barrier.
+ */
+#define ipc_smp_acquire__after_spin_is_unlocked()	smp_rmb()
+
+/*
  * Wait until all currently ongoing simple ops have completed.
  * Caller must own sem_perm.lock.
  * New simple ops cannot start, because simple ops first check
@@ -275,6 +285,7 @@ static void sem_wait_array(struct sem_ar
 		sem = sma->sem_base + i;
 		spin_unlock_wait(&sem->lock);
 	}
+	ipc_smp_acquire__after_spin_is_unlocked();
 }
 
 /*
@@ -327,13 +338,12 @@ static inline int sem_lock(struct sem_ar
 		/* Then check that the global lock is free */
 		if (!spin_is_locked(&sma->sem_perm.lock)) {
 			/*
-			 * The ipc object lock check must be visible on all
-			 * cores before rechecking the complex count.  Otherwise
-			 * we can race with  another thread that does:
+			 * We need a memory barrier with acquire semantics,
+			 * otherwise we can race with another thread that does:
 			 *	complex_count++;
 			 *	spin_unlock(sem_perm.lock);
 			 */
-			smp_rmb();
+			ipc_smp_acquire__after_spin_is_unlocked();
 
 			/*
 			 * Now repeat the test of complex_count:
author maintainer
#3 lore raw

PATCH 3/78 mm/hwpoison: fix page refcount of unknown non LRU page

In reply to Greg Kroah-Hartman

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

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

From: Wanpeng Li <[email protected]>

commit 4f32be677b124a49459e2603321c7a5605ceb9f8 upstream.

After trying to drain pages from pagevec/pageset, we try to get reference count of the page again, however, the reference count of the page is not reduced if the page is still not on LRU list.

Fix it by adding the put_page() to drop the page reference which is from __get_any_page().

---
 mm/memory-failure.c |    2 ++
 1 file changed, 2 insertions(+)
mm/memory-failure.c +2 -0
@@ -1558,6 +1558,8 @@ static int get_any_page(struct page *pag
 		 */
 		ret = __get_any_page(page, pfn, 0);
 		if (!PageLRU(page)) {
+			/* Drop page reference which is from __get_any_page() */
+			put_page(page);
 			pr_info("soft_offline: %#lx: unknown non LRU page type %lx\n",
 				pfn, page->flags);
 			return -EIO;
author maintainer
#4 lore raw

PATCH 4/78 mm/hwpoison: fix fail isolate hugetlbfs page w/ refcount held

In reply to Greg Kroah-Hartman

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

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

From: Wanpeng Li <[email protected]>

commit 036138080a4376e5f3e5d0cca8ac99084c5cf06e upstream.

Hugetlbfs pages will get a refcount in get_any_page() or madvise_hwpoison() if soft offlining through madvise. The refcount which is held by the soft offline path should be released if we fail to isolate hugetlbfs pages.

Fix it by reducing the refcount for both isolation success and failure.

---
 mm/memory-failure.c |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
mm/memory-failure.c +6 -7
@@ -1589,13 +1589,12 @@ static int soft_offline_huge_page(struct
 	unlock_page(hpage);
 
 	ret = isolate_huge_page(hpage, &pagelist);
-	if (ret) {
-		/*
-		 * get_any_page() and isolate_huge_page() takes a refcount each,
-		 * so need to drop one here.
-		 */
-		put_page(hpage);
-	} else {
+	/*
+	 * get_any_page() and isolate_huge_page() takes a refcount each,
+	 * so need to drop one here.
+	 */
+	put_page(hpage);
+	if (!ret) {
 		pr_info("soft offline: %#lx hugepage failed to isolate\n", pfn);
 		return -EBUSY;
 	}
author maintainer
#5 lore raw

PATCH 5/78 clk: pxa: pxa3xx: fix CKEN register access

In reply to Greg Kroah-Hartman

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

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

From: Robert Jarzmik <[email protected]>

commit b93028c9af807b9474789e6aba34a6135b6cb708 upstream.

Clocks 0 to 31 are on CKENA, and not CKENB. The clock register names were inadequately inverted. As a consequence, all clock operations were happening on CKENB, because almost all but 2 clocks are on CKENA.

As the clocks were activated by the bootloader in the former tests, it escaped the testing that the wrong clock gate was manipulated. The error was revealed by changing the pxa3xx-nand driver to a module, where upon unloading, the wrong clock was disabled in CKENB.

Fixes 9bbb8a338fb2 ("clk: pxa: add pxa3xx clock driver")
---
 drivers/clk/pxa/clk-pxa3xx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/pxa/clk-pxa3xx.c +1 -1
@@ -126,7 +126,7 @@ PARENTS(pxa3xx_ac97_bus) = { "ring_osc_6
 PARENTS(pxa3xx_sbus) = { "ring_osc_60mhz", "system_bus" };
 PARENTS(pxa3xx_smemcbus) = { "ring_osc_60mhz", "smemc" };
 
-#define CKEN_AB(bit) ((CKEN_ ## bit > 31) ? &CKENA : &CKENB)
+#define CKEN_AB(bit) ((CKEN_ ## bit > 31) ? &CKENB : &CKENA)
 #define PXA3XX_CKEN(dev_id, con_id, parents, mult_lp, div_lp, mult_hp,	\
 		    div_hp, bit, is_lp, flags)				\
 	PXA_CKEN(dev_id, con_id, bit, parents, mult_lp, div_lp,		\
author maintainer
#6 lore raw

PATCH 8/78 rsi: Fix failure to load firmware after memory leak fix and fix the leak

In reply to Greg Kroah-Hartman

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

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

From: Mike Looijmans <[email protected]>

commit 5d5cd85ff441534a52f23f821d0a7c644d3b6cce upstream.

Fixes commit eae79b4f3e82 ("rsi: fix memory leak in rsi_load_ta_instructions()") which stopped the driver from functioning.

Firmware data has been allocated using vmalloc(), resulting in memory that cannot be used for DMA. Hence the firmware was first copied to a buffer allocated with kmalloc() in the original code. This patch reverts the commit and only calls "kfree()" to release the buffer after sending the data. This fixes the memory leak without breaking the driver.

Add a comment to the kmemdup() calls to explain why this is done, and abort if memory allocation fails.

Tested on a Topic Miami-Florida board which contains the rsi SDIO chip.

Also added the same kfree() call to the USB glue driver. This was not tested on actual hardware though, as I only have the SDIO version.

Fixes eae79b4f3e82 ("rsi: fix memory leak in rsi_load_ta_instructions()")
---
 drivers/net/wireless/rsi/rsi_91x_sdio_ops.c |    8 +++++++-
 drivers/net/wireless/rsi/rsi_91x_usb_ops.c  |    4 ++++
 2 files changed, 11 insertions(+), 1 deletion(-)
drivers/net/wireless/rsi/rsi_91x_sdio_ops.c +7 -1
@@ -172,6 +172,7 @@ static int rsi_load_ta_instructions(stru
 		(struct rsi_91x_sdiodev *)adapter->rsi_dev;
 	u32 len;
 	u32 num_blocks;
+	const u8 *fw;
 	const struct firmware *fw_entry = NULL;
 	u32 block_size = dev->tx_blk_size;
 	int status = 0;
@@ -200,6 +201,10 @@ static int rsi_load_ta_instructions(stru
 		return status;
 	}
 
+	/* Copy firmware into DMA-accessible memory */
+	fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL);
+	if (!fw)
+		return -ENOMEM;
 	len = fw_entry->size;
 
 	if (len % 4)
@@ -210,7 +215,8 @@ static int rsi_load_ta_instructions(stru
 	rsi_dbg(INIT_ZONE, "%s: Instruction size:%d\n", __func__, len);
 	rsi_dbg(INIT_ZONE, "%s: num blocks: %d\n", __func__, num_blocks);
 
-	status = rsi_copy_to_card(common, fw_entry->data, len, num_blocks);
+	status = rsi_copy_to_card(common, fw, len, num_blocks);
+	kfree(fw);
 	release_firmware(fw_entry);
 	return status;
 }
drivers/net/wireless/rsi/rsi_91x_usb_ops.c +4 -0
@@ -146,7 +146,10 @@ static int rsi_load_ta_instructions(stru
 		return status;
 	}
 
+	/* Copy firmware into DMA-accessible memory */
 	fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL);
+	if (!fw)
+		return -ENOMEM;
 	len = fw_entry->size;
 
 	if (len % 4)
@@ -158,6 +161,7 @@ static int rsi_load_ta_instructions(stru
 	rsi_dbg(INIT_ZONE, "%s: num blocks: %d\n", __func__, num_blocks);
 
 	status = rsi_copy_to_card(common, fw, len, num_blocks);
+	kfree(fw);
 	release_firmware(fw_entry);
 	return status;
 }
author maintainer
#7 lore raw

PATCH 9/78 perf: Fix fasync handling on inherited events

In reply to Greg Kroah-Hartman

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

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

From: Peter Zijlstra <[email protected]>

commit fed66e2cdd4f127a43fd11b8d92a99bdd429528c upstream.

Vince reported that the fasync signal stuff doesn't work proper for inherited events. So fix that.

Installing fasync allocates memory and sets filp->f_flags |= FASYNC, which upon the demise of the file descriptor ensures the allocation is freed and state is updated.

Now for perf, we can have the events stick around for a while after the original FD is dead because of references from child events. So we cannot copy the fasync pointer around. We can however consistently use the parent's fasync, as that will be updated.

---
 kernel/events/core.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
kernel/events/core.c +10 -2
@@ -4766,12 +4766,20 @@ static const struct file_operations perf
  * to user-space before waking everybody up.
  */
 
+static inline struct fasync_struct **perf_event_fasync(struct perf_event *event)
+{
+	/* only the parent has fasync state */
+	if (event->parent)
+		event = event->parent;
+	return &event->fasync;
+}
+
 void perf_event_wakeup(struct perf_event *event)
 {
 	ring_buffer_wakeup(event);
 
 	if (event->pending_kill) {
-		kill_fasync(&event->fasync, SIGIO, event->pending_kill);
+		kill_fasync(perf_event_fasync(event), SIGIO, event->pending_kill);
 		event->pending_kill = 0;
 	}
 }
@@ -6117,7 +6125,7 @@ static int __perf_event_overflow(struct
 	else
 		perf_event_output(event, data, regs);
 
-	if (event->fasync && event->pending_kill) {
+	if (*perf_event_fasync(event) && event->pending_kill) {
 		event->pending_wakeup = 1;
 		irq_work_queue(&event->pending);
 	}
author maintainer
#8 lore raw

PATCH 10/78 perf: Fix running time accounting

In reply to Greg Kroah-Hartman

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

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

From: Peter Zijlstra <[email protected]>

commit 00a2916f7f82c348a2a94dbb572874173bc308a3 upstream.

A recent fix to the shadow timestamp inadvertly broke the running time accounting.

We must not update the running timestamp if we fail to schedule the event, the event will not have ran. This can (and did) result in negative total runtime because the stopped timestamp was before the running timestamp (we 'started' but never stopped the event -- because it never really started we didn't have to stop it either).

Reported-and-Tested-by Vince Weaver <[email protected]>
Fixes 72f669c0086f ("perf: Update shadow timestamp before add event")
Cc Shaohua Li <[email protected]>
---
 kernel/events/core.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/events/core.c +2 -2
@@ -1886,8 +1886,6 @@ event_sched_in(struct perf_event *event,
 
 	perf_pmu_disable(event->pmu);
 
-	event->tstamp_running += tstamp - event->tstamp_stopped;
-
 	perf_set_shadow_time(event, ctx, tstamp);
 
 	perf_log_itrace_start(event);
@@ -1899,6 +1897,8 @@ event_sched_in(struct perf_event *event,
 		goto out;
 	}
 
+	event->tstamp_running += tstamp - event->tstamp_stopped;
+
 	if (!is_software_event(event))
 		cpuctx->active_oncpu++;
 	if (!ctx->nr_active++)
author maintainer
#9 lore raw

PATCH 11/78 perf: Fix double-free of the AUX buffer

In reply to Greg Kroah-Hartman

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

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

From: Ben Hutchings <[email protected]>

commit ee9397a6fb9bc4e52677f5e33eed4abee0f515e6 upstream.

If rb->aux_refcount is decremented to zero before rb->refcount, __rb_free_aux() may be called twice resulting in a double free of rb->aux_pages. Fix this by adding a check to __rb_free_aux().

Cc Alexander Shishkin <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Fixes 57ffc5ca679f ("perf: Fix AUX buffer refcounting")
---
 kernel/events/ring_buffer.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
kernel/events/ring_buffer.c +6 -4
@@ -547,11 +547,13 @@ static void __rb_free_aux(struct ring_bu
 		rb->aux_priv = NULL;
 	}
 
-	for (pg = 0; pg < rb->aux_nr_pages; pg++)
-		rb_free_aux_page(rb, pg);
+	if (rb->aux_nr_pages) {
+		for (pg = 0; pg < rb->aux_nr_pages; pg++)
+			rb_free_aux_page(rb, pg);
 
-	kfree(rb->aux_pages);
-	rb->aux_nr_pages = 0;
+		kfree(rb->aux_pages);
+		rb->aux_nr_pages = 0;
+	}
 }
 
 void rb_free_aux(struct ring_buffer *rb)
author maintainer
#10 lore raw

PATCH 12/78 perf: Fix PERF_EVENT_IOC_PERIOD migration race

In reply to Greg Kroah-Hartman

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

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

From: Peter Zijlstra <[email protected]>

commit c7999c6f3fed9e383d3131474588f282ae6d56b9 upstream.

I ran the perf fuzzer, which triggered some WARN()s which are due to trying to stop/restart an event on the wrong CPU.

Use the normal IPI pattern to ensure we run the code on the correct CPU.

Cc Vince Weaver <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Fixes bad7192b842c ("perf: Fix PERF_EVENT_IOC_PERIOD to force-reset the period")
---
 kernel/events/core.c |   75 +++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 55 insertions(+), 20 deletions(-)
kernel/events/core.c +55 -20
@@ -3976,28 +3976,21 @@ static void perf_event_for_each(struct p
 		perf_event_for_each_child(sibling, func);
 }
 
-static int perf_event_period(struct perf_event *event, u64 __user *arg)
-{
-	struct perf_event_context *ctx = event->ctx;
-	int ret = 0, active;
+struct period_event {
+	struct perf_event *event;
 	u64 value;
+};
 
-	if (!is_sampling_event(event))
-		return -EINVAL;
-
-	if (copy_from_user(&value, arg, sizeof(value)))
-		return -EFAULT;
-
-	if (!value)
-		return -EINVAL;
+static int __perf_event_period(void *info)
+{
+	struct period_event *pe = info;
+	struct perf_event *event = pe->event;
+	struct perf_event_context *ctx = event->ctx;
+	u64 value = pe->value;
+	bool active;
 
-	raw_spin_lock_irq(&ctx->lock);
+	raw_spin_lock(&ctx->lock);
 	if (event->attr.freq) {
-		if (value > sysctl_perf_event_sample_rate) {
-			ret = -EINVAL;
-			goto unlock;
-		}
-
 		event->attr.sample_freq = value;
 	} else {
 		event->attr.sample_period = value;
@@ -4016,11 +4009,53 @@ static int perf_event_period(struct perf
 		event->pmu->start(event, PERF_EF_RELOAD);
 		perf_pmu_enable(ctx->pmu);
 	}
+	raw_spin_unlock(&ctx->lock);
+
+	return 0;
+}
+
+static int perf_event_period(struct perf_event *event, u64 __user *arg)
+{
+	struct period_event pe = { .event = event, };
+	struct perf_event_context *ctx = event->ctx;
+	struct task_struct *task;
+	u64 value;
+
+	if (!is_sampling_event(event))
+		return -EINVAL;
+
+	if (copy_from_user(&value, arg, sizeof(value)))
+		return -EFAULT;
+
+	if (!value)
+		return -EINVAL;
+
+	if (event->attr.freq && value > sysctl_perf_event_sample_rate)
+		return -EINVAL;
+
+	task = ctx->task;
+	pe.value = value;
+
+	if (!task) {
+		cpu_function_call(event->cpu, __perf_event_period, &pe);
+		return 0;
+	}
+
+retry:
+	if (!task_function_call(task, __perf_event_period, &pe))
+		return 0;
+
+	raw_spin_lock_irq(&ctx->lock);
+	if (ctx->is_active) {
+		raw_spin_unlock_irq(&ctx->lock);
+		task = ctx->task;
+		goto retry;
+	}
 
-unlock:
+	__perf_event_period(&pe);
 	raw_spin_unlock_irq(&ctx->lock);
 
-	return ret;
+	return 0;
 }
 
 static const struct file_operations perf_fops;
author maintainer
#11 lore raw

PATCH 13/78 iwlwifi: pcie: fix prepare card flow

In reply to Greg Kroah-Hartman

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

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

From: Emmanuel Grumbach <[email protected]>

commit c9fdec9f3970eeaa1b176422f46167f5f5158804 upstream.

When the card is not owned by the PCIe bus, we need to acquire ownership first. This flow is implemented in iwl_pcie_prepare_card_hw. Because of a hardware bug, we need to disable link power management before we can request ownership otherwise the other user of the device won't get notified that we are requesting the device which will prevent us from acquire ownership.

Same holds for the down flow where we need to make sure that any other potential user is notified that the driver is going down.

---
 drivers/net/wireless/iwlwifi/pcie/trans.c |   22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
drivers/net/wireless/iwlwifi/pcie/trans.c +19 -3
@@ -457,10 +457,16 @@ static void iwl_pcie_apm_stop(struct iwl
 		if (trans->cfg->device_family == IWL_DEVICE_FAMILY_7000)
 			iwl_set_bits_prph(trans, APMG_PCIDEV_STT_REG,
 					  APMG_PCIDEV_STT_VAL_WAKE_ME);
-		else if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000)
+		else if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000) {
+			iwl_set_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG,
+				    CSR_RESET_LINK_PWR_MGMT_DISABLED);
 			iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG,
 				    CSR_HW_IF_CONFIG_REG_PREPARE |
 				    CSR_HW_IF_CONFIG_REG_ENABLE_PME);
+			mdelay(1);
+			iwl_clear_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG,
+				      CSR_RESET_LINK_PWR_MGMT_DISABLED);
+		}
 		mdelay(5);
 	}
 
@@ -555,6 +561,10 @@ static int iwl_pcie_prepare_card_hw(stru
 	if (ret >= 0)
 		return 0;
 
+	iwl_set_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG,
+		    CSR_RESET_LINK_PWR_MGMT_DISABLED);
+	msleep(1);
+
 	for (iter = 0; iter < 10; iter++) {
 		/* If HW is not ready, prepare the conditions to check again */
 		iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG,
@@ -562,8 +572,10 @@ static int iwl_pcie_prepare_card_hw(stru
 
 		do {
 			ret = iwl_pcie_set_hw_ready(trans);
-			if (ret >= 0)
-				return 0;
+			if (ret >= 0) {
+				ret = 0;
+				goto out;
+			}
 
 			usleep_range(200, 1000);
 			t += 200;
@@ -573,6 +585,10 @@ static int iwl_pcie_prepare_card_hw(stru
 
 	IWL_ERR(trans, "Couldn't prepare the card\n");
 
+out:
+	iwl_clear_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG,
+		      CSR_RESET_LINK_PWR_MGMT_DISABLED);
+
 	return ret;
 }
 
author maintainer
#12 lore raw

PATCH 14/78 rtlwifi: rtl8723be: Add module parameter for MSI interrupts

In reply to Greg Kroah-Hartman

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

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

From: Larry Finger <[email protected]>

commit 741e3b9902d11585e18bfc7f8d47e913616bb070 upstream.

The driver code allows for the disabling of MSI interrupts; however the module_parm line was missed and the option fails to show with modinfo.

---
 drivers/net/wireless/rtlwifi/rtl8723be/sw.c |    1 +
 1 file changed, 1 insertion(+)
drivers/net/wireless/rtlwifi/rtl8723be/sw.c +1 -0
@@ -385,6 +385,7 @@ module_param_named(debug, rtl8723be_mod_
 module_param_named(ips, rtl8723be_mod_params.inactiveps, bool, 0444);
 module_param_named(swlps, rtl8723be_mod_params.swctrl_lps, bool, 0444);
 module_param_named(fwlps, rtl8723be_mod_params.fwctrl_lps, bool, 0444);
+module_param_named(msi, rtl8723be_mod_params.msi_support, bool, 0444);
 module_param_named(disable_watchdog, rtl8723be_mod_params.disable_watchdog,
 		   bool, 0444);
 MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n");
author maintainer
#13 lore raw

PATCH 15/78 rtlwifi: Fix NULL dereference when PCI driver used as an AP

In reply to Greg Kroah-Hartman

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

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

From: Luis Felipe Dominguez Vega <[email protected]>

commit 7c62940165e9ae4004ce4e6b5117330bab94df68 upstream.

In commit 33511b157bbcebaef853cc1811992b664a2e5862 ("rtlwifi: add support to send beacon frame"), the mechanism for sending beacons was established. That patch works correctly for rtl8192cu, but there is a possibility of getting the following warnings in the PCI drivers:

WARNING: CPU: 1 PID: 2439 at net/mac80211/driver-ops.h:12
ieee80211_bss_info_change_notify+0x179/0x1d0 [mac80211]()

wlp5s0: Failed check-sdata-in-driver check, flags: 0x0

The warning is followed by a NULL pointer dereference as follows:

BUG: unable to handle kernel NULL pointer dereference at 0000000000000006
IP: [<ffffffffc073998e>] rtl_get_tcb_desc+0x5e/0x760 [rtlwifi]

This problem was reported at http://thread.gmane.org/gmane.linux.kernel.wireless.general/138645,
but no solution was found at that time.

The problem was also reported at https://bugzilla.kernel.org/show_bug.cgi?id=9744
and this solution was developed and tested there.

The USB driver works with a NULL final argument in the adapter_tx() callback; however, the PCI drivers need a struct rtl_tcb_desc in that position.

Fixes 33511b157bbc ("rtlwifi: add support to send beacon frame.")
---
 drivers/net/wireless/rtlwifi/core.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/rtlwifi/core.c +5 -2
@@ -1015,9 +1015,12 @@ static void send_beacon_frame(struct iee
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct sk_buff *skb = ieee80211_beacon_get(hw, vif);
+	struct rtl_tcb_desc tcb_desc;
 
-	if (skb)
-		rtlpriv->intf_ops->adapter_tx(hw, NULL, skb, NULL);
+	if (skb) {
+		memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc));
+		rtlpriv->intf_ops->adapter_tx(hw, NULL, skb, &tcb_desc);
+	}
 }
 
 static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
author maintainer
#14 lore raw

PATCH 16/78 x86/xen: build "Xen PV" APIC driver for domU as well

In reply to Greg Kroah-Hartman

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

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

From: "Jason A. Donenfeld" <[email protected]>

commit fc5fee86bdd3d720e2d1d324e4fae0c35845fa63 upstream.

It turns out that a PV domU also requires the "Xen PV" APIC driver. Otherwise, the flat driver is used and we get stuck in busy loops that never exit, such as in this stack trace:

(gdb) target remote localhost:9999
Remote debugging using localhost:9999
__xapic_wait_icr_idle () at ./arch/x86/include/asm/ipi.h:56
56 while (native_apic_mem_read(APIC_ICR) & APIC_ICR_BUSY)
(gdb) bt
#0 __xapic_wait_icr_idle () at ./arch/x86/include/asm/ipi.h:56 #1 __default_send_IPI_shortcut (shortcut=<optimized out>,
dest=<optimized out>, vector=<optimized out>) at ./arch/x86/include/asm/ipi.h:75
#2 apic_send_IPI_self (vector=246) at arch/x86/kernel/apic/probe_64.c:54 #3 0xffffffff81011336 in arch_irq_work_raise () at
arch/x86/kernel/irq_work.c:47
#4 0xffffffff8114990c in irq_work_queue (work=0xffff88000fc0e400) at
kernel/irq_work.c:100
#5 0xffffffff8110c29d in wake_up_klogd () at kernel/printk/printk.c:2633 #6 0xffffffff8110ca60 in vprintk_emit (facility=0, level=<optimized
out>, dict=0x0 <irq_stack_union>, dictlen=<optimized out>, fmt=<optimized out>, args=<optimized out>)

    at kernel/printk/printk.c:1778
 #7  0xffffffff816010c8 in printk (fmt=<optimized out>) at

kernel/printk/printk.c:1868
#8 0xffffffffc00013ea in ?? ()
#9 0x0000000000000000 in ?? ()

Mailing-list-thread: https://lkml.org/lkml/2015/8/4/755

---
 arch/x86/xen/Makefile  |    4 ++--
 arch/x86/xen/xen-ops.h |    6 ++----
 2 files changed, 4 insertions(+), 6 deletions(-)
arch/x86/xen/Makefile +2 -2
@@ -13,13 +13,13 @@ CFLAGS_mmu.o			:= $(nostackp)
 obj-y		:= enlighten.o setup.o multicalls.o mmu.o irq.o \
 			time.o xen-asm.o xen-asm_$(BITS).o \
 			grant-table.o suspend.o platform-pci-unplug.o \
-			p2m.o
+			p2m.o apic.o
 
 obj-$(CONFIG_EVENT_TRACING) += trace.o
 
 obj-$(CONFIG_SMP)		+= smp.o
 obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o
 obj-$(CONFIG_XEN_DEBUG_FS)	+= debugfs.o
-obj-$(CONFIG_XEN_DOM0)		+= apic.o vga.o
+obj-$(CONFIG_XEN_DOM0)		+= vga.o
 obj-$(CONFIG_SWIOTLB_XEN)	+= pci-swiotlb-xen.o
 obj-$(CONFIG_XEN_EFI)		+= efi.o
arch/x86/xen/xen-ops.h +2 -4
@@ -101,17 +101,15 @@ struct dom0_vga_console_info;
 
 #ifdef CONFIG_XEN_DOM0
 void __init xen_init_vga(const struct dom0_vga_console_info *, size_t size);
-void __init xen_init_apic(void);
 #else
 static inline void __init xen_init_vga(const struct dom0_vga_console_info *info,
 				       size_t size)
 {
 }
-static inline void __init xen_init_apic(void)
-{
-}
 #endif
 
+void __init xen_init_apic(void);
+
 #ifdef CONFIG_XEN_EFI
 extern void xen_efi_init(void);
 #else
author maintainer
#15 lore raw

PATCH 17/78 xen/xenbus: Dont leak memory when unmapping the ring on HVM backend

In reply to Greg Kroah-Hartman

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

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

From: Julien Grall <[email protected]>

commit c22fe519e7e2b94ad173e0ea3b89c1a7d8be8d00 upstream.

The commit ccc9d90a9a8b5c4ad7e9708ec41f75ff9e98d61d "xenbus_client:
Extend interface to support multi-page ring" removes the call to free_xenballooned_pages() in xenbus_unmap_ring_vfree_hvm(), leaking a page for every shared ring.

Only with backends running in HVM domains were affected.

---
 drivers/xen/xenbus/xenbus_client.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/xen/xenbus/xenbus_client.c +3 -1
@@ -814,8 +814,10 @@ static int xenbus_unmap_ring_vfree_hvm(s
 
 	rv = xenbus_unmap_ring(dev, node->handles, node->nr_handles,
 			       addrs);
-	if (!rv)
+	if (!rv) {
 		vunmap(vaddr);
+		free_xenballooned_pages(node->nr_handles, node->hvm.pages);
+	}
 	else
 		WARN(1, "Leaking %p, size %u page(s)\n", vaddr,
 		     node->nr_handles);
author maintainer
#16 lore raw

PATCH 18/78 dm thin metadata: delete btrees when releasing metadata snapshot

In reply to Greg Kroah-Hartman

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

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

From: Joe Thornber <[email protected]>

commit 7f518ad0a212e2a6fd68630e176af1de395070a7 upstream.

The device details and mapping trees were just being decremented before. Now btree_del() is called to do a deep delete.

---
 drivers/md/dm-thin-metadata.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/md/dm-thin-metadata.c +2 -2
@@ -1295,8 +1295,8 @@ static int __release_metadata_snap(struc
 		return r;
 
 	disk_super = dm_block_data(copy);
-	dm_sm_dec_block(pmd->metadata_sm, le64_to_cpu(disk_super->data_mapping_root));
-	dm_sm_dec_block(pmd->metadata_sm, le64_to_cpu(disk_super->device_details_root));
+	dm_btree_del(&pmd->info, le64_to_cpu(disk_super->data_mapping_root));
+	dm_btree_del(&pmd->details_info, le64_to_cpu(disk_super->device_details_root));
 	dm_sm_dec_block(pmd->metadata_sm, held_root);
 
 	return dm_tm_unlock(pmd->tm, copy);
author maintainer
#17 lore raw

PATCH 19/78 localmodconfig: Use Kbuild files too

In reply to Greg Kroah-Hartman

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

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

From: Richard Weinberger <[email protected]>

commit c0ddc8c745b7f89c50385fd7aa03c78dc543fa7a upstream.

In kbuild it is allowed to define objects in files named "Makefile" and "Kbuild".
Currently localmodconfig reads objects only from "Makefile"s and misses modules like nouveau.

---
 scripts/kconfig/streamline_config.pl |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/streamline_config.pl +1 -1
@@ -137,7 +137,7 @@ my $ksource = ($ARGV[0] ? $ARGV[0] : '.'
 my $kconfig = $ARGV[1];
 my $lsmod_file = $ENV{'LSMOD'};
 
-my @makefiles = `find $ksource -name Makefile 2>/dev/null`;
+my @makefiles = `find $ksource -name Makefile -or -name Kbuild 2>/dev/null`;
 chomp @makefiles;
 
 my %depends;
author maintainer
#18 lore raw

PATCH 20/78 EDAC, ppc4xx: Access mci->csrows array elements properly

In reply to Greg Kroah-Hartman

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

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

From: Michael Walle <[email protected]>

commit 5c16179b550b9fd8114637a56b153c9768ea06a5 upstream.

The commit

de3910eb79ac ("edac: change the mem allocation scheme to
make Documentation/kobject.txt happy")

changed the memory allocation for the csrows member. But ppc4xx_edac was forgotten in the patch. Fix it.

---
 drivers/edac/ppc4xx_edac.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/edac/ppc4xx_edac.c +1 -1
@@ -920,7 +920,7 @@ static int ppc4xx_edac_init_csrows(struc
 	 */
 
 	for (row = 0; row < mci->nr_csrows; row++) {
-		struct csrow_info *csi = &mci->csrows[row];
+		struct csrow_info *csi = mci->csrows[row];
 
 		/*
 		 * Get the configuration settings for this
author maintainer
#19 lore raw

PATCH 21/78 HID: hid-input: Fix accessing freed memory during device disconnect

In reply to Greg Kroah-Hartman

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

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

From: Krzysztof Kozlowski <[email protected]>

commit 0621809e37936e7c2b3eac9165cf2aad7f9189eb upstream.

During unbinding the driver was dereferencing a pointer to memory already freed by power_supply_unregister().

Driver was freeing its internal description of battery through pointers stored in power_supply structure. However, because the core owns the power supply instance, after calling power_supply_unregister() this memory is freed and the driver cannot access these members.

Fix this by storing the pointer to internal description of battery in a local variable before calling power_supply_unregister(), so the pointer remains valid.

Fixes 297d716f6260 ("power_supply: Change ownership from driver to core")
---
 drivers/hid/hid-input.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/hid/hid-input.c +5 -2
@@ -462,12 +462,15 @@ out:
 
 static void hidinput_cleanup_battery(struct hid_device *dev)
 {
+	const struct power_supply_desc *psy_desc;
+
 	if (!dev->battery)
 		return;
 
+	psy_desc = dev->battery->desc;
 	power_supply_unregister(dev->battery);
-	kfree(dev->battery->desc->name);
-	kfree(dev->battery->desc);
+	kfree(psy_desc->name);
+	kfree(psy_desc);
 	dev->battery = NULL;
 }
 #else  /* !CONFIG_HID_BATTERY_STRENGTH */
author maintainer
#20 lore raw

PATCH 22/78 HID: uclogic: fix limit in uclogic_tablet_enable()

In reply to Greg Kroah-Hartman

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

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

From: Dan Carpenter <[email protected]>

commit 4a8e70f5d0d80675fc17b9ba1e62db8ca6b91775 upstream.

The limit should be ARRAY_SIZE(params) (5 elements) here instead of sizeof(params) (20 bytes).

Fixes 08177f40bd00 ('HID: uclogic: merge hid-huion driver in hid-uclogic')
---
 drivers/hid/hid-uclogic.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-uclogic.c +1 -1
@@ -858,7 +858,7 @@ static int uclogic_tablet_enable(struct
 	for (p = drvdata->rdesc;
 	     p <= drvdata->rdesc + drvdata->rsize - 4;) {
 		if (p[0] == 0xFE && p[1] == 0xED && p[2] == 0x1D &&
-		    p[3] < sizeof(params)) {
+		    p[3] < ARRAY_SIZE(params)) {
 			v = params[p[3]];
 			put_unaligned(cpu_to_le32(v), (s32 *)p);
 			p += 4;
author maintainer
#21 lore raw

PATCH 23/78 drm/radeon: add new OLAND pci id

In reply to Greg Kroah-Hartman

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

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

From: Alex Deucher <[email protected]>

commit e037239e5e7b61007763984aa35a8329596d8c88 upstream.

---
 include/drm/drm_pciids.h |    1 +
 1 file changed, 1 insertion(+)
include/drm/drm_pciids.h +1 -0
@@ -172,6 +172,7 @@
 	{0x1002, 0x6610, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6611, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6613, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x6617, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6620, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6621, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6623, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
author maintainer
#22 lore raw

PATCH 24/78 drm/vmwgfx: Fix execbuf locking issues

In reply to Greg Kroah-Hartman

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

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

From: Thomas Hellstrom <[email protected]>

commit 3e04e2fe6d87807d27521ad6ebb9e7919d628f25 upstream.

This addresses two issues that cause problems with viewperf maya-03 in situation with memory pressure.

The first issue causes attempts to unreserve buffers if batched reservation fails due to, for example, a signal pending. While previously the ttm_eu api was resistant against this type of error, it is no longer and the lockdep code will complain about attempting to unreserve buffers that are not reserved. The issue is resolved by avoid calling ttm_eu_backoff_reservation in the buffer reserve error path.

The second issue is that the binding_mutex may be held when user-space fence objects are created and hence during memory reclaims. This may cause recursive attempts to grab the binding mutex. The issue is resolved by not holding the binding mutex across fence creation and submission.

---
 drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +2 -2
@@ -2492,7 +2492,7 @@ int vmw_execbuf_process(struct drm_file
 	ret = ttm_eu_reserve_buffers(&ticket, &sw_context->validate_nodes,
 				     true, NULL);
 	if (unlikely(ret != 0))
-		goto out_err;
+		goto out_err_nores;
 
 	ret = vmw_validate_buffers(dev_priv, sw_context);
 	if (unlikely(ret != 0))
@@ -2536,6 +2536,7 @@ int vmw_execbuf_process(struct drm_file
 	vmw_resource_relocations_free(&sw_context->res_relocations);
 
 	vmw_fifo_commit(dev_priv, command_size);
+	mutex_unlock(&dev_priv->binding_mutex);
 
 	vmw_query_bo_switch_commit(dev_priv, sw_context);
 	ret = vmw_execbuf_fence_commands(file_priv, dev_priv,
@@ -2551,7 +2552,6 @@ int vmw_execbuf_process(struct drm_file
 		DRM_ERROR("Fence submission error. Syncing.\n");
 
 	vmw_resource_list_unreserve(&sw_context->resource_list, false);
-	mutex_unlock(&dev_priv->binding_mutex);
 
 	ttm_eu_fence_buffer_objects(&ticket, &sw_context->validate_nodes,
 				    (void *) fence);
author maintainer
#23 lore raw

PATCH 25/78 libfc: Fix fc_exch_recv_req() error path

In reply to Greg Kroah-Hartman

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

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

From: Bart Van Assche <[email protected]>

commit f6979adeaab578f8ca14fdd32b06ddee0d9d3314 upstream.

Due to patch "libfc: Do not invoke the response handler after fc_exch_done()" (commit ID 7030fd62) the lport_recv() call in fc_exch_recv_req() is passed a dangling pointer. Avoid this by moving the fc_frame_free() call from fc_invoke_resp() to its callers. This patch fixes the following crash:

general protection fault: 0000 [#3] PREEMPT SMP
RIP: fc_lport_recv_req+0x72/0x280 [libfc]
Call Trace:
 fc_exch_recv+0x642/0xde0 [libfc]
 fcoe_percpu_receive_thread+0x46a/0x5ed [fcoe]
 kthread+0x10a/0x120
 ret_from_fork+0x42/0x70
---
 drivers/scsi/libfc/fc_exch.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/libfc/fc_exch.c +4 -4
@@ -733,8 +733,6 @@ static bool fc_invoke_resp(struct fc_exc
 	if (resp) {
 		resp(sp, fp, arg);
 		res = true;
-	} else if (!IS_ERR(fp)) {
-		fc_frame_free(fp);
 	}
 
 	spin_lock_bh(&ep->ex_lock);
@@ -1596,7 +1594,8 @@ static void fc_exch_recv_seq_resp(struct
 	 * If new exch resp handler is valid then call that
 	 * first.
 	 */
-	fc_invoke_resp(ep, sp, fp);
+	if (!fc_invoke_resp(ep, sp, fp))
+		fc_frame_free(fp);
 
 	fc_exch_release(ep);
 	return;
@@ -1695,7 +1694,8 @@ static void fc_exch_abts_resp(struct fc_
 	fc_exch_hold(ep);
 	if (!rc)
 		fc_exch_delete(ep);
-	fc_invoke_resp(ep, sp, fp);
+	if (!fc_invoke_resp(ep, sp, fp))
+		fc_frame_free(fp);
 	if (has_rec)
 		fc_exch_timer_set(ep, ep->r_a_tov);
 	fc_exch_release(ep);
author maintainer
#24 lore raw

PATCH 26/78 libfc: Fix fc_fcp_cleanup_each_cmd()

In reply to Greg Kroah-Hartman

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

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

From: Bart Van Assche <[email protected]>

commit 8f2777f53e3d5ad8ef2a176a4463a5c8e1a16431 upstream.

Since fc_fcp_cleanup_cmd() can sleep this function must not be called while holding a spinlock. This patch avoids that fc_fcp_cleanup_each_cmd() triggers the following bug:

BUG: scheduling while atomic: sg_reset/1512/0x00000202
1 lock held by sg_reset/1512:
 #0:  (&(&fsp->scsi_pkt_lock)->rlock){+.-...}, at: [<ffffffffc0225cd5>] fc_fcp_cleanup_each_cmd.isra.21+0xa5/0x150 [libfc]
Preemption disabled at:[<ffffffffc0225cd5>] fc_fcp_cleanup_each_cmd.isra.21+0xa5/0x150 [libfc]
Call Trace:
 [<ffffffff816c612c>] dump_stack+0x4f/0x7b
 [<ffffffff810828bc>] __schedule_bug+0x6c/0xd0
 [<ffffffff816c87aa>] __schedule+0x71a/0xa10
 [<ffffffff816c8ad2>] schedule+0x32/0x80
 [<ffffffffc0217eac>] fc_seq_set_resp+0xac/0x100 [libfc]
 [<ffffffffc0218b11>] fc_exch_done+0x41/0x60 [libfc]
 [<ffffffffc0225cff>] fc_fcp_cleanup_each_cmd.isra.21+0xcf/0x150 [libfc]
 [<ffffffffc0225f43>] fc_eh_device_reset+0x1c3/0x270 [libfc]
 [<ffffffff814a2cc9>] scsi_try_bus_device_reset+0x29/0x60
 [<ffffffff814a3908>] scsi_ioctl_reset+0x258/0x2d0
 [<ffffffff814a2650>] scsi_ioctl+0x150/0x440
 [<ffffffff814b3a9d>] sd_ioctl+0xad/0x120
 [<ffffffff8132f266>] blkdev_ioctl+0x1b6/0x810
 [<ffffffff811da608>] block_ioctl+0x38/0x40
 [<ffffffff811b4e08>] do_vfs_ioctl+0x2f8/0x530
 [<ffffffff811b50c1>] SyS_ioctl+0x81/0xa0
 [<ffffffff816cf8b2>] system_call_fastpath+0x16/0x7a
---
 drivers/scsi/libfc/fc_fcp.c |   19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/scsi/libfc/fc_fcp.c +17 -2
@@ -1039,11 +1039,26 @@ restart:
 		fc_fcp_pkt_hold(fsp);
 		spin_unlock_irqrestore(&si->scsi_queue_lock, flags);
 
-		if (!fc_fcp_lock_pkt(fsp)) {
+		spin_lock_bh(&fsp->scsi_pkt_lock);
+		if (!(fsp->state & FC_SRB_COMPL)) {
+			fsp->state |= FC_SRB_COMPL;
+			/*
+			 * TODO: dropping scsi_pkt_lock and then reacquiring
+			 * again around fc_fcp_cleanup_cmd() is required,
+			 * since fc_fcp_cleanup_cmd() calls into
+			 * fc_seq_set_resp() and that func preempts cpu using
+			 * schedule. May be schedule and related code should be
+			 * removed instead of unlocking here to avoid scheduling
+			 * while atomic bug.
+			 */
+			spin_unlock_bh(&fsp->scsi_pkt_lock);
+
 			fc_fcp_cleanup_cmd(fsp, error);
+
+			spin_lock_bh(&fsp->scsi_pkt_lock);
 			fc_io_compl(fsp);
-			fc_fcp_unlock_pkt(fsp);
 		}
+		spin_unlock_bh(&fsp->scsi_pkt_lock);
 
 		fc_fcp_pkt_release(fsp);
 		spin_lock_irqsave(&si->scsi_queue_lock, flags);
author maintainer
#25 lore raw

PATCH 27/78 ARM: imx6: correct i.MX6 PCIe interrupt routing

In reply to Greg Kroah-Hartman

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

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

From: Lucas Stach <[email protected]>

commit 1a9fa190956f45c1e58c4d8bfa5ac051691ea590 upstream.

The PCIe interrupts are also routed through the GPC. This has been missed from the conversion to stacked IRQ domains as the PCIe controller uses an explicit interrupt map and thus doesn't inherit the SoC global interrupt parent.

---
 arch/arm/boot/dts/imx6qdl.dtsi |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/boot/dts/imx6qdl.dtsi +4 -4
@@ -153,10 +153,10 @@
 			interrupt-names = "msi";
 			#interrupt-cells = <1>;
 			interrupt-map-mask = <0 0 0 0x7>;
-			interrupt-map = <0 0 0 1 &intc GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>,
-			                <0 0 0 2 &intc GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>,
-			                <0 0 0 3 &intc GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>,
-			                <0 0 0 4 &intc GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-map = <0 0 0 1 &gpc GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>,
+			                <0 0 0 2 &gpc GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>,
+			                <0 0 0 3 &gpc GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>,
+			                <0 0 0 4 &gpc GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&clks IMX6QDL_CLK_PCIE_AXI>,
 				 <&clks IMX6QDL_CLK_LVDS1_GATE>,
 				 <&clks IMX6QDL_CLK_PCIE_REF_125M>;
author maintainer
#26 lore raw

PATCH 28/78 ARM: dts: omap243x: Fix broken pbias device creation

In reply to Greg Kroah-Hartman

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

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

From: Kishon Vijay Abraham I <[email protected]>

commit 4317c8c9121e4685561422ac267b292df8e80806 upstream.

commit <72b10ac00eb1> ("ARM: dts: omap24xx: add minimal l4 bus layout with control module support") moved pbias_regulator dt node from being a child node of ocp to be the child node of scm_conf. After this device for pbias_regulator is
not created.

Fix it by adding "simple-bus" compatible property to scm_conf dt node.

Fixes 72b10ac00eb1 ("ARM: dts: omap24xx: add minimal l4 bus

layout with control module support")

---
 arch/arm/boot/dts/omap2430.dtsi |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/boot/dts/omap2430.dtsi +2 -1
@@ -51,7 +51,8 @@
 				};
 
 				scm_conf: scm_conf@270 {
-					compatible = "syscon";
+					compatible = "syscon",
+						     "simple-bus";
 					reg = <0x270 0x240>;
 					#address-cells = <1>;
 					#size-cells = <1>;
author maintainer
#27 lore raw

PATCH 29/78 ARM: dts: dra7: Fix broken pbias device creation

In reply to Greg Kroah-Hartman

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

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

From: Kishon Vijay Abraham I <[email protected]>

commit cd4556733b30cc363adc7b1cea3bffa7e2dd0c7c upstream.

commit <d919501feffa> ("ARM: dts: dra7: add minimal l4 bus layout with control module support") moved pbias_regulator dt node from being a child node of ocp to be the child node of scm_conf. After this device for pbias_regulator is
not created.

Fix it by adding "simple-bus" compatible property to scm_conf dt node.

Fixes d919501feffa ("ARM: dts: dra7: add minimal l4 bus

layout with control module support")

---
 arch/arm/boot/dts/dra7.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/dra7.dtsi +1 -1
@@ -116,7 +116,7 @@
 				ranges = <0 0x2000 0x2000>;
 
 				scm_conf: scm_conf@0 {
-					compatible = "syscon";
+					compatible = "syscon", "simple-bus";
 					reg = <0x0 0x1400>;
 					#address-cells = <1>;
 					#size-cells = <1>;
author maintainer
#28 lore raw

PATCH 30/78 ARM: dts: OMAP4: Fix broken pbias device creation

In reply to Greg Kroah-Hartman

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

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

From: Kishon Vijay Abraham I <[email protected]>

commit 89a898df87e114952191ab0e061aa18e3c617880 upstream.

commit <7415b0b4c645> ("ARM: dts: omap4: add minimal l4 bus layout with control module support") moved pbias_regulator dt node from being a child node of ocp to be the child node of omap4_padconf_global. After this device for pbias_regulator is not created.

Fix it by adding "simple-bus" compatible property to omap4_padconf_global dt node.

Fixes 7415b0b4c645 ("ARM: dts: omap4: add minimal l4 bus layout

with control module support")

---
 arch/arm/boot/dts/omap4.dtsi |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/boot/dts/omap4.dtsi +2 -1
@@ -191,7 +191,8 @@
 				};
 
 				omap4_padconf_global: omap4_padconf_global@5a0 {
-					compatible = "syscon";
+					compatible = "syscon",
+						     "simple-bus";
 					reg = <0x5a0 0x170>;
 					#address-cells = <1>;
 					#size-cells = <1>;
author maintainer
#29 lore raw

PATCH 31/78 ARM: dts: OMAP5: Fix broken pbias device creation

In reply to Greg Kroah-Hartman

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

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

From: Kishon Vijay Abraham I <[email protected]>

commit 70caac3f25291cf715cf8f2d8c7db46f6cbefe7c upstream.

commit <ed8509edddeb> ("ARM: dts: omap5: add minimal l4 bus layout with control module support") moved pbias_regulator dt node from being a child node of ocp to be the child node of omap5_padconf_global. After this device for pbias_regulator is not created.

Fix it by adding "simple-bus" compatible property to omap5_padconf_global dt node.

Fixes ed8509edddeb ("ARM: dts: omap5: add minimal l4 bus

layout with control module support")

---
 arch/arm/boot/dts/omap5.dtsi |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/boot/dts/omap5.dtsi +2 -1
@@ -180,7 +180,8 @@
 				};
 
 				omap5_padconf_global: omap5_padconf_global@5a0 {
-					compatible = "syscon";
+					compatible = "syscon",
+						     "simple-bus";
 					reg = <0x5a0 0xec>;
 					#address-cells = <1>;
 					#size-cells = <1>;
author maintainer
#30 lore raw

PATCH 32/78 ARM: 8385/1: VDSO: group link options

In reply to Greg Kroah-Hartman

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

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

From: Nathan Lynch <[email protected]>

commit d33ce23b2160d26b27a47092da5d556b5b11a12a upstream.

Currently the VDSO's link options are kind of a mess spread between

ccflags-y and cmd_vdsold. Collect linker directives into one variable, VDSO_LDFLAGS, and use that in cmd_vdsold.

---
 arch/arm/vdso/Makefile |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
arch/arm/vdso/Makefile +10 -7
@@ -6,9 +6,14 @@ obj-vdso := vgettimeofday.o datapage.o
 targets := $(obj-vdso) vdso.so vdso.so.dbg vdso.so.raw vdso.lds
 obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
 
-ccflags-y := -shared -fPIC -fno-common -fno-builtin -fno-stack-protector
-ccflags-y += -nostdlib -Wl,-soname=linux-vdso.so.1 -DDISABLE_BRANCH_PROFILING
-ccflags-y += -Wl,--no-undefined $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
+ccflags-y := -fPIC -fno-common -fno-builtin -fno-stack-protector
+ccflags-y += -DDISABLE_BRANCH_PROFILING
+
+VDSO_LDFLAGS := -Wl,-Bsymbolic -Wl,--no-undefined -Wl,-soname=linux-vdso.so.1
+VDSO_LDFLAGS += -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096
+VDSO_LDFLAGS += -nostdlib -shared
+VDSO_LDFLAGS += $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
+VDSO_LDFLAGS += $(call cc-ldoption, -Wl$(comma)--build-id)
 
 obj-$(CONFIG_VDSO) += vdso.o
 extra-$(CONFIG_VDSO) += vdso.lds
@@ -40,10 +45,8 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE
 
 # Actual build commands
 quiet_cmd_vdsold = VDSO    $@
-      cmd_vdsold = $(CC) $(c_flags) -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) \
-                   $(call cc-ldoption, -Wl$(comma)--build-id) \
-                   -Wl,-Bsymbolic -Wl,-z,max-page-size=4096 \
-                   -Wl,-z,common-page-size=4096 -o $@
+      cmd_vdsold = $(CC) $(c_flags) $(VDSO_LDFLAGS) \
+                   -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) -o $@
 
 quiet_cmd_vdsomunge = MUNGE   $@
       cmd_vdsomunge = $(objtree)/$(obj)/vdsomunge $< $@
author maintainer
#31 lore raw

PATCH 33/78 ARM: 8384/1: VDSO: force use of BFD linker

In reply to Greg Kroah-Hartman

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

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

From: Nathan Lynch <[email protected]>

commit d2b30cd4b7223a96e606dfc8120626f66d81e091 upstream.

When using a toolchain with gold as the default linker, the VDSO build fails:

  VDSO    arch/arm/vdso/vdso.so.raw
  HOSTCC  arch/arm/vdso/vdsomunge
  MUNGE   arch/arm/vdso/vdso.so.dbg

OBJCOPY arch/arm/vdso/vdso.so
BFD: arch/arm/vdso/vdso.so: Not enough room for program headers, try linking with -N

For whatever reason, ld.gold is omitting an exidx program header that ld.bfd emits, and even when I work around that, I don't get a working VDSO.

For now, instead of supporting gold (which will fail to link the kernel anyway since it does not implement --pic-veneer), direct the compiler to use the traditional bfd linker. This is accomplished by using -fuse-ld, which is implemented in GCC 4.8 and later.

Note: one limitation of this is that if the toolchain is configured to use gold by default, and the bfd linker is not in $PATH, the VDSO build will fail:

VDSO arch/arm/vdso/vdso.so.raw
collect2: fatal error: cannot find 'ld'

This will happen if CROSS_COMPILE begins with a path such as /opt/bin/arm-linux-gnu- but /opt/bin is not in $PATH. This is considered an acceptable corner-case limitation and is easily worked around.

Additonal note: we use cc-option instead of cc-ldoption so that -fuse-ld=bfd is placed in the command line if the compiler recognizes the option. Using cc-ldoption results in an attempt to link, which fails in the situation just described, causing -fuse-ld=bfd to be omitted and gold to be used for the VDSO link, which is what we're trying to prevent.

---
 arch/arm/vdso/Makefile |    1 +
 1 file changed, 1 insertion(+)
arch/arm/vdso/Makefile +1 -0
@@ -14,6 +14,7 @@ VDSO_LDFLAGS += -Wl,-z,max-page-size=409
 VDSO_LDFLAGS += -nostdlib -shared
 VDSO_LDFLAGS += $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
 VDSO_LDFLAGS += $(call cc-ldoption, -Wl$(comma)--build-id)
+VDSO_LDFLAGS += $(call cc-option, -fuse-ld=bfd)
 
 obj-$(CONFIG_VDSO) += vdso.o
 extra-$(CONFIG_VDSO) += vdso.lds
author maintainer
#32 lore raw

PATCH 34/78 ARM: v7 setup function should invalidate L1 cache

In reply to Greg Kroah-Hartman

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

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

From: Russell King <[email protected]>

commit 02b4e2756e01c623cc4dbceae4b07be75252db5b upstream.

All ARMv5 and older CPUs invalidate their caches in the early assembly setup function, prior to enabling the MMU. This is because the L1 cache should not contain any data relevant to the execution of the kernel at this point; all data should have been flushed out to memory.

This requirement should also be true for ARMv6 and ARMv7 CPUs - indeed, these typically do not search their caches when caching is disabled (as it needs to be when the MMU is disabled) so this change should be safe.

ARMv7 allows there to be CPUs which search their caches while caching is disabled, and it's permitted that the cache is uninitialised at boot; for these, the architecture reference manual requires that an implementation specific code sequence is used immediately after reset to ensure that the cache is placed into a sane state. Such functionality is definitely outside the remit of the Linux kernel, and must be done by the SoC's firmware before _any_ CPU gets to the Linux kernel.

Changing the data cache clean+invalidate to a mere invalidate allows us to get rid of a lot of platform specific hacks around this issue for their secondary CPU bringup paths - some of which were buggy.

---
 arch/arm/mach-bcm/Makefile            |    2 +-
 arch/arm/mach-bcm/brcmstb.h           |   19 -------------------
 arch/arm/mach-bcm/headsmp-brcmstb.S   |   33 ---------------------------------
 arch/arm/mach-bcm/platsmp-brcmstb.c   |    4 +---
 arch/arm/mach-berlin/headsmp.S        |    6 ------
 arch/arm/mach-berlin/platsmp.c        |    3 +--
 arch/arm/mach-hisi/Makefile           |    2 +-
 arch/arm/mach-hisi/core.h             |    1 -
 arch/arm/mach-hisi/headsmp.S          |   16 ----------------
 arch/arm/mach-hisi/platsmp.c          |    4 ++--
 arch/arm/mach-imx/headsmp.S           |    1 -
 arch/arm/mach-mvebu/headsmp-a9.S      |    1 -
 arch/arm/mach-prima2/headsmp.S        |    1 -
 arch/arm/mach-rockchip/core.h         |    1 -
 arch/arm/mach-rockchip/headsmp.S      |    8 --------
 arch/arm/mach-rockchip/platsmp.c      |    5 ++---
 arch/arm/mach-shmobile/common.h       |    1 -
 arch/arm/mach-shmobile/headsmp-scu.S  |    4 ++--
 arch/arm/mach-shmobile/headsmp.S      |    7 -------
 arch/arm/mach-shmobile/platsmp-apmu.c |    2 +-
 arch/arm/mach-socfpga/core.h          |    1 -
 arch/arm/mach-socfpga/headsmp.S       |    5 -----
 arch/arm/mach-socfpga/platsmp.c       |    2 +-
 arch/arm/mach-tegra/Makefile          |    2 +-
 arch/arm/mach-tegra/headsmp.S         |   12 ------------
 arch/arm/mach-tegra/reset.c           |    2 +-
 arch/arm/mach-tegra/reset.h           |    1 -
 arch/arm/mach-zynq/common.h           |    2 --
 arch/arm/mach-zynq/headsmp.S          |    5 -----
 arch/arm/mach-zynq/platsmp.c          |    5 ++---
 arch/arm/mm/proc-v7.S                 |    2 +-
 31 files changed, 17 insertions(+), 143 deletions(-)
arch/arm/mach-bcm/Makefile +1 -1
@@ -43,5 +43,5 @@ obj-$(CONFIG_ARCH_BCM_63XX)	:= bcm63xx.o
 ifeq ($(CONFIG_ARCH_BRCMSTB),y)
 CFLAGS_platsmp-brcmstb.o	+= -march=armv7-a
 obj-y				+= brcmstb.o
-obj-$(CONFIG_SMP)		+= headsmp-brcmstb.o platsmp-brcmstb.o
+obj-$(CONFIG_SMP)		+= platsmp-brcmstb.o
 endif
arch/arm/mach-bcm/brcmstb.h deleted +0 -19
@@ -1,19 +0,0 @@
-/*
- * Copyright (C) 2013-2014 Broadcom Corporation
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation version 2.
- *
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- * kind, whether express or implied; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef __BRCMSTB_H__
-#define __BRCMSTB_H__
-
-void brcmstb_secondary_startup(void);
-
-#endif /* __BRCMSTB_H__ */
arch/arm/mach-bcm/headsmp-brcmstb.S deleted +0 -33
@@ -1,33 +0,0 @@
-/*
- * SMP boot code for secondary CPUs
- * Based on arch/arm/mach-tegra/headsmp.S
- *
- * Copyright (C) 2010 NVIDIA, Inc.
- * Copyright (C) 2013-2014 Broadcom Corporation
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation version 2.
- *
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- * kind, whether express or implied; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <asm/assembler.h>
-#include <linux/linkage.h>
-#include <linux/init.h>
-
-        .section ".text.head", "ax"
-
-ENTRY(brcmstb_secondary_startup)
-        /*
-         * Ensure CPU is in a sane state by disabling all IRQs and switching
-         * into SVC mode.
-         */
-        setmode	PSR_I_BIT | PSR_F_BIT | SVC_MODE, r0
-
-        bl      v7_invalidate_l1
-        b       secondary_startup
-ENDPROC(brcmstb_secondary_startup)
arch/arm/mach-bcm/platsmp-brcmstb.c +1 -3
@@ -30,8 +30,6 @@
 #include <asm/mach-types.h>
 #include <asm/smp_plat.h>
 
-#include "brcmstb.h"
-
 enum {
 	ZONE_MAN_CLKEN_MASK		= BIT(0),
 	ZONE_MAN_RESET_CNTL_MASK	= BIT(1),
@@ -153,7 +151,7 @@ static void brcmstb_cpu_boot(u32 cpu)
 	 * Set the reset vector to point to the secondary_startup
 	 * routine
 	 */
-	cpu_set_boot_addr(cpu, virt_to_phys(brcmstb_secondary_startup));
+	cpu_set_boot_addr(cpu, virt_to_phys(secondary_startup));
 
 	/* Unhalt the cpu */
 	cpu_rst_cfg_set(cpu, 0);
arch/arm/mach-berlin/headsmp.S +0 -6
@@ -12,12 +12,6 @@
 #include <linux/init.h>
 #include <asm/assembler.h>
 
-ENTRY(berlin_secondary_startup)
- ARM_BE8(setend be)
-	bl	v7_invalidate_l1
-	b       secondary_startup
-ENDPROC(berlin_secondary_startup)
-
 /*
  * If the following instruction is set in the reset exception vector, CPUs
  * will fetch the value of the software reset address vector when being
arch/arm/mach-berlin/platsmp.c +1 -2
@@ -22,7 +22,6 @@
 #define RESET_VECT		0x00
 #define SW_RESET_ADDR		0x94
 
-extern void berlin_secondary_startup(void);
 extern u32 boot_inst;
 
 static void __iomem *cpu_ctrl;
@@ -85,7 +84,7 @@ static void __init berlin_smp_prepare_cp
 	 * Write the secondary startup address into the SW reset address
 	 * vector. This is used by boot_inst.
 	 */
-	writel(virt_to_phys(berlin_secondary_startup), vectors_base + SW_RESET_ADDR);
+	writel(virt_to_phys(secondary_startup), vectors_base + SW_RESET_ADDR);
 
 	iounmap(vectors_base);
 unmap_scu:
arch/arm/mach-hisi/Makefile +1 -1
@@ -6,4 +6,4 @@ CFLAGS_platmcpm.o	:= -march=armv7-a
 
 obj-y	+= hisilicon.o
 obj-$(CONFIG_MCPM)		+= platmcpm.o
-obj-$(CONFIG_SMP)		+= platsmp.o hotplug.o headsmp.o
+obj-$(CONFIG_SMP)		+= platsmp.o hotplug.o
arch/arm/mach-hisi/core.h +0 -1
@@ -12,7 +12,6 @@ extern void hi3xxx_cpu_die(unsigned int
 extern int hi3xxx_cpu_kill(unsigned int cpu);
 extern void hi3xxx_set_cpu(int cpu, bool enable);
 
-extern void hisi_secondary_startup(void);
 extern struct smp_operations hix5hd2_smp_ops;
 extern void hix5hd2_set_cpu(int cpu, bool enable);
 extern void hix5hd2_cpu_die(unsigned int cpu);
arch/arm/mach-hisi/headsmp.S deleted +0 -16
@@ -1,16 +0,0 @@
-/*
- *  Copyright (c) 2014 Hisilicon Limited.
- *  Copyright (c) 2014 Linaro Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-#include <linux/init.h>
-
-	__CPUINIT
-
-ENTRY(hisi_secondary_startup)
-	bl	v7_invalidate_l1
-	b	secondary_startup
arch/arm/mach-hisi/platsmp.c +2 -2
@@ -118,7 +118,7 @@ static int hix5hd2_boot_secondary(unsign
 {
 	phys_addr_t jumpaddr;
 
-	jumpaddr = virt_to_phys(hisi_secondary_startup);
+	jumpaddr = virt_to_phys(secondary_startup);
 	hix5hd2_set_scu_boot_addr(HIX5HD2_BOOT_ADDRESS, jumpaddr);
 	hix5hd2_set_cpu(cpu, true);
 	arch_send_wakeup_ipi_mask(cpumask_of(cpu));
@@ -156,7 +156,7 @@ static int hip01_boot_secondary(unsigned
 	struct device_node *node;
 
 
-	jumpaddr = virt_to_phys(hisi_secondary_startup);
+	jumpaddr = virt_to_phys(secondary_startup);
 	hip01_set_boot_addr(HIP01_BOOT_ADDRESS, jumpaddr);
 
 	node = of_find_compatible_node(NULL, NULL, "hisilicon,hip01-sysctrl");
arch/arm/mach-imx/headsmp.S +0 -1
@@ -25,7 +25,6 @@ diag_reg_offset:
 	.endm
 
 ENTRY(v7_secondary_startup)
-	bl	v7_invalidate_l1
 	set_diag_reg
 	b	secondary_startup
 ENDPROC(v7_secondary_startup)
arch/arm/mach-mvebu/headsmp-a9.S +0 -1
@@ -21,7 +21,6 @@
 
 ENTRY(mvebu_cortex_a9_secondary_startup)
 ARM_BE8(setend	be)
-	bl      v7_invalidate_l1
 	bl	armada_38x_scu_power_up
 	b	secondary_startup
 ENDPROC(mvebu_cortex_a9_secondary_startup)
arch/arm/mach-prima2/headsmp.S +0 -1
@@ -15,7 +15,6 @@
  * ready for them to initialise.
  */
 ENTRY(sirfsoc_secondary_startup)
-	bl v7_invalidate_l1
         mrc     p15, 0, r0, c0, c0, 5
         and     r0, r0, #15
         adr     r4, 1f
arch/arm/mach-rockchip/core.h +0 -1
@@ -17,4 +17,3 @@ extern char rockchip_secondary_trampolin
 extern char rockchip_secondary_trampoline_end;
 
 extern unsigned long rockchip_boot_fn;
-extern void rockchip_secondary_startup(void);
arch/arm/mach-rockchip/headsmp.S +0 -8
@@ -15,14 +15,6 @@
 #include <linux/linkage.h>
 #include <linux/init.h>
 
-ENTRY(rockchip_secondary_startup)
-	mrc	p15, 0, r0, c0, c0, 0	@ read main ID register
-	ldr	r1, =0x00000c09		@ Cortex-A9 primary part number
-	teq	r0, r1
-	beq	v7_invalidate_l1
-	b	secondary_startup
-ENDPROC(rockchip_secondary_startup)
-
 ENTRY(rockchip_secondary_trampoline)
 	ldr	pc, 1f
 ENDPROC(rockchip_secondary_trampoline)
arch/arm/mach-rockchip/platsmp.c +2 -3
@@ -149,8 +149,7 @@ static int __cpuinit rockchip_boot_secon
 		 * sram_base_addr + 8: start address for pc
 		 * */
 		udelay(10);
-		writel(virt_to_phys(rockchip_secondary_startup),
-			sram_base_addr + 8);
+		writel(virt_to_phys(secondary_startup), sram_base_addr + 8);
 		writel(0xDEADBEAF, sram_base_addr + 4);
 		dsb_sev();
 	}
@@ -189,7 +188,7 @@ static int __init rockchip_smp_prepare_s
 	}
 
 	/* set the boot function for the sram code */
-	rockchip_boot_fn = virt_to_phys(rockchip_secondary_startup);
+	rockchip_boot_fn = virt_to_phys(secondary_startup);
 
 	/* copy the trampoline to sram, that runs during startup of the core */
 	memcpy(sram_base_addr, &rockchip_secondary_trampoline, trampoline_sz);
arch/arm/mach-shmobile/common.h +0 -1
@@ -14,7 +14,6 @@ extern void shmobile_smp_sleep(void);
 extern void shmobile_smp_hook(unsigned int cpu, unsigned long fn,
 			      unsigned long arg);
 extern int shmobile_smp_cpu_disable(unsigned int cpu);
-extern void shmobile_invalidate_start(void);
 extern void shmobile_boot_scu(void);
 extern void shmobile_smp_scu_prepare_cpus(unsigned int max_cpus);
 extern void shmobile_smp_scu_cpu_die(unsigned int cpu);
arch/arm/mach-shmobile/headsmp-scu.S +2 -2
@@ -22,7 +22,7 @@
  * Boot code for secondary CPUs.
  *
  * First we turn on L1 cache coherency for our CPU. Then we jump to
- * shmobile_invalidate_start that invalidates the cache and hands over control
+ * secondary_startup that invalidates the cache and hands over control
  * to the common ARM startup code.
  */
 ENTRY(shmobile_boot_scu)
@@ -36,7 +36,7 @@ ENTRY(shmobile_boot_scu)
 	bic	r2, r2, r3		@ Clear bits of our CPU (Run Mode)
 	str	r2, [r0, #8]		@ write back
 
-	b	shmobile_invalidate_start
+	b	secondary_startup
 ENDPROC(shmobile_boot_scu)
 
 	.text
arch/arm/mach-shmobile/headsmp.S +0 -7
@@ -16,13 +16,6 @@
 #include <asm/assembler.h>
 #include <asm/memory.h>
 
-#ifdef CONFIG_SMP
-ENTRY(shmobile_invalidate_start)
-	bl	v7_invalidate_l1
-	b	secondary_startup
-ENDPROC(shmobile_invalidate_start)
-#endif
-
 /*
  * Reset vector for secondary CPUs.
  * This will be mapped at address 0 by SBAR register.
arch/arm/mach-shmobile/platsmp-apmu.c +1 -1
@@ -133,7 +133,7 @@ void __init shmobile_smp_apmu_prepare_cp
 int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle)
 {
 	/* For this particular CPU register boot vector */
-	shmobile_smp_hook(cpu, virt_to_phys(shmobile_invalidate_start), 0);
+	shmobile_smp_hook(cpu, virt_to_phys(secondary_startup), 0);
 
 	return apmu_wrap(cpu, apmu_power_on);
 }
arch/arm/mach-socfpga/core.h +0 -1
@@ -31,7 +31,6 @@
 
 #define RSTMGR_MPUMODRST_CPU1		0x2     /* CPU1 Reset */
 
-extern void socfpga_secondary_startup(void);
 extern void __iomem *socfpga_scu_base_addr;
 
 extern void socfpga_init_clocks(void);
arch/arm/mach-socfpga/headsmp.S +0 -5
@@ -30,8 +30,3 @@ ENTRY(secondary_trampoline)
 1:	.long	.
 	.long	socfpga_cpu1start_addr
 ENTRY(secondary_trampoline_end)
-
-ENTRY(socfpga_secondary_startup)
-       bl      v7_invalidate_l1
-       b       secondary_startup
-ENDPROC(socfpga_secondary_startup)
arch/arm/mach-socfpga/platsmp.c +1 -1
@@ -40,7 +40,7 @@ static int socfpga_boot_secondary(unsign
 
 		memcpy(phys_to_virt(0), &secondary_trampoline, trampoline_size);
 
-		writel(virt_to_phys(socfpga_secondary_startup),
+		writel(virt_to_phys(secondary_startup),
 		       sys_manager_base_addr + (socfpga_cpu1start_addr & 0x000000ff));
 
 		flush_cache_all();
arch/arm/mach-tegra/Makefile +1 -1
@@ -19,7 +19,7 @@ obj-$(CONFIG_ARCH_TEGRA_3x_SOC)		+= pm-t
 ifeq ($(CONFIG_CPU_IDLE),y)
 obj-$(CONFIG_ARCH_TEGRA_3x_SOC)		+= cpuidle-tegra30.o
 endif
-obj-$(CONFIG_SMP)			+= platsmp.o headsmp.o
+obj-$(CONFIG_SMP)			+= platsmp.o
 obj-$(CONFIG_HOTPLUG_CPU)               += hotplug.o
 
 obj-$(CONFIG_ARCH_TEGRA_114_SOC)	+= sleep-tegra30.o
arch/arm/mach-tegra/headsmp.S deleted +0 -12
@@ -1,12 +0,0 @@
-#include <linux/linkage.h>
-#include <linux/init.h>
-
-#include "sleep.h"
-
-        .section ".text.head", "ax"
-
-ENTRY(tegra_secondary_startup)
-        check_cpu_part_num 0xc09, r8, r9
-        bleq    v7_invalidate_l1
-        b       secondary_startup
-ENDPROC(tegra_secondary_startup)
arch/arm/mach-tegra/reset.c +1 -1
@@ -94,7 +94,7 @@ void __init tegra_cpu_reset_handler_init
 	__tegra_cpu_reset_handler_data[TEGRA_RESET_MASK_PRESENT] =
 		*((u32 *)cpu_possible_mask);
 	__tegra_cpu_reset_handler_data[TEGRA_RESET_STARTUP_SECONDARY] =
-		virt_to_phys((void *)tegra_secondary_startup);
+		virt_to_phys((void *)secondary_startup);
 #endif
 
 #ifdef CONFIG_PM_SLEEP
arch/arm/mach-tegra/reset.h +0 -1
@@ -37,7 +37,6 @@ void __tegra_cpu_reset_handler_start(voi
 void __tegra_cpu_reset_handler(void);
 void __tegra20_cpu1_resettable_status_offset(void);
 void __tegra_cpu_reset_handler_end(void);
-void tegra_secondary_startup(void);
 
 #ifdef CONFIG_PM_SLEEP
 #define tegra_cpu_lp1_mask \
arch/arm/mach-zynq/common.h +0 -2
@@ -17,8 +17,6 @@
 #ifndef __MACH_ZYNQ_COMMON_H__
 #define __MACH_ZYNQ_COMMON_H__
 
-void zynq_secondary_startup(void);
-
 extern int zynq_slcr_init(void);
 extern int zynq_early_slcr_init(void);
 extern void zynq_slcr_system_reset(void);
arch/arm/mach-zynq/headsmp.S +0 -5
@@ -22,8 +22,3 @@ zynq_secondary_trampoline_jump:
 .globl zynq_secondary_trampoline_end
 zynq_secondary_trampoline_end:
 ENDPROC(zynq_secondary_trampoline)
-
-ENTRY(zynq_secondary_startup)
-	bl	v7_invalidate_l1
-	b	secondary_startup
-ENDPROC(zynq_secondary_startup)
arch/arm/mach-zynq/platsmp.c +2 -3
@@ -87,10 +87,9 @@ int zynq_cpun_start(u32 address, int cpu
 }
 EXPORT_SYMBOL(zynq_cpun_start);
 
-static int zynq_boot_secondary(unsigned int cpu,
-						struct task_struct *idle)
+static int zynq_boot_secondary(unsigned int cpu, struct task_struct *idle)
 {
-	return zynq_cpun_start(virt_to_phys(zynq_secondary_startup), cpu);
+	return zynq_cpun_start(virt_to_phys(secondary_startup), cpu);
 }
 
 /*
arch/arm/mm/proc-v7.S +1 -1
@@ -336,7 +336,7 @@ __v7_pj4b_setup:
 __v7_setup:
 	adr	r12, __v7_setup_stack		@ the local stack
 	stmia	r12, {r0-r5, r7, r9, r11, lr}
-	bl      v7_flush_dcache_louis
+	bl      v7_invalidate_l1
 	ldmia	r12, {r0-r5, r7, r9, r11, lr}
 
 	mrc	p15, 0, r0, c0, c0, 0		@ read main ID register
author maintainer
#33 lore raw

PATCH 35/78 ARM: invalidate L1 before enabling coherency

In reply to Greg Kroah-Hartman

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

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

From: Russell King <[email protected]>

commit bac51ad9d14f6baed3730ef53bedc1eb2238563a upstream.

We must invalidate the L1 cache before enabling coherency, otherwise secondary CPUs can inject invalid cache lines into the coherent CPU cluster, which could then be migrated to other CPUs. This fixes a recent regression with SoCFPGA randomly failing to boot.

Fixes 02b4e2756e01 ("ARM: v7 setup function should invalidate L1 cache")
Cc Alexander Kochetkov <[email protected]>
---
 arch/arm/mm/proc-v7.S |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
arch/arm/mm/proc-v7.S +9 -5
@@ -268,7 +268,10 @@ __v7_ca15mp_setup:
 __v7_b15mp_setup:
 __v7_ca17mp_setup:
 	mov	r10, #0
-1:
+1:	adr	r12, __v7_setup_stack		@ the local stack
+	stmia	r12, {r0-r5, lr}		@ v7_invalidate_l1 touches r0-r6
+	bl      v7_invalidate_l1
+	ldmia	r12, {r0-r5, lr}
 #ifdef CONFIG_SMP
 	ALT_SMP(mrc	p15, 0, r0, c1, c0, 1)
 	ALT_UP(mov	r0, #(1 << 6))		@ fake it for UP
@@ -277,7 +280,7 @@ __v7_ca17mp_setup:
 	orreq	r0, r0, r10			@ Enable CPU-specific SMP bits
 	mcreq	p15, 0, r0, c1, c0, 1
 #endif
-	b	__v7_setup
+	b	__v7_setup_cont
 
 __v7_pj4b_setup:
 #ifdef CONFIG_CPU_PJ4B
@@ -335,10 +338,11 @@ __v7_pj4b_setup:
 
 __v7_setup:
 	adr	r12, __v7_setup_stack		@ the local stack
-	stmia	r12, {r0-r5, r7, r9, r11, lr}
+	stmia	r12, {r0-r5, lr}		@ v7_invalidate_l1 touches r0-r6
 	bl      v7_invalidate_l1
-	ldmia	r12, {r0-r5, r7, r9, r11, lr}
+	ldmia	r12, {r0-r5, lr}
 
+__v7_setup_cont:
 	mrc	p15, 0, r0, c0, c0, 0		@ read main ID register
 	and	r10, r0, #0xff000000		@ ARM?
 	teq	r10, #0x41000000
@@ -460,7 +464,7 @@ ENDPROC(__v7_setup)
 
 	.align	2
 __v7_setup_stack:
-	.space	4 * 11				@ 11 registers
+	.space	4 * 7				@ 12 registers
 
 	__INITDATA
 
author maintainer
#34 lore raw

PATCH 36/78 mfd: arizona: Fix initialisation of the PM runtime

In reply to Greg Kroah-Hartman

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

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

From: Charles Keepax <[email protected]>

commit 72e43164fd472f6c2659c8313b87da962322dbcf upstream.

The PM runtime core by default assumes a chip is suspended when runtime PM is enabled. Currently the arizona driver enables runtime PM when the chip is fully active and then disables the DCVDD regulator at the end of arizona_dev_init. This however has several problems, firstly the if we reach the end of arizona_dev_init, we did not properly follow all the proceedures for shutting down the chip, and most notably we never marked the chip as cache only so any writes occurring between then and the next PM runtime resume will be lost. Secondly, if we are already resumed when we reach the end of dev_init, then at best we get unbalanced regulator enable/disables at work we lose DCVDD whilst we need it.

Additionally, since the commit 4f0216409f7c ("mfd: arizona: Add better support for system suspend"), the PM runtime operations may disable/enable the IRQ, so the IRQs must now be enabled before we call any PM operations.

This patch adds a call to pm_runtime_set_active to inform the PM core that the device is starting up active and moves the PM enabling to around the IRQ initialisation to avoid any PM callbacks happening until the IRQs are initialised.

---
 drivers/mfd/arizona-core.c |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/mfd/arizona-core.c +6 -8
@@ -912,10 +912,6 @@ int arizona_dev_init(struct arizona *ari
 			     arizona->pdata.gpio_defaults[i]);
 	}
 
-	pm_runtime_set_autosuspend_delay(arizona->dev, 100);
-	pm_runtime_use_autosuspend(arizona->dev);
-	pm_runtime_enable(arizona->dev);
-
 	/* Chip default */
 	if (!arizona->pdata.clk32k_src)
 		arizona->pdata.clk32k_src = ARIZONA_32KZ_MCLK2;
@@ -1012,11 +1008,17 @@ int arizona_dev_init(struct arizona *ari
 					   arizona->pdata.spk_fmt[i]);
 	}
 
+	pm_runtime_set_active(arizona->dev);
+	pm_runtime_enable(arizona->dev);
+
 	/* Set up for interrupts */
 	ret = arizona_irq_init(arizona);
 	if (ret != 0)
 		goto err_reset;
 
+	pm_runtime_set_autosuspend_delay(arizona->dev, 100);
+	pm_runtime_use_autosuspend(arizona->dev);
+
 	arizona_request_irq(arizona, ARIZONA_IRQ_CLKGEN_ERR, "CLKGEN error",
 			    arizona_clkgen_err, arizona);
 	arizona_request_irq(arizona, ARIZONA_IRQ_OVERCLOCKED, "Overclocked",
@@ -1045,10 +1047,6 @@ int arizona_dev_init(struct arizona *ari
 		goto err_irq;
 	}
 
-#ifdef CONFIG_PM
-	regulator_disable(arizona->dcvdd);
-#endif
-
 	return 0;
 
 err_irq:
author maintainer
#35 lore raw

PATCH 37/78 Revert x86 sigcontext cleanups

In reply to Greg Kroah-Hartman

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

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

From: Linus Torvalds <[email protected]>

commit ed596cde9425509ec6ce88e19f03e9b13b6f518b upstream.

This reverts commits 9a036b93a344 ("x86/signal/64: Remove 'fs' and 'gs' from sigcontext") and c6f2062935c8 ("x86/signal/64: Fix SS handling for signals delivered to 64-bit programs").

They were cleanups, but they break dosemu by changing the signal return behavior (and removing 'fs' and 'gs' from the sigcontext struct - while not actually changing any behavior - causes build problems).

---
 arch/x86/include/asm/sigcontext.h      |    6 +++---
 arch/x86/include/uapi/asm/sigcontext.h |   21 +++------------------
 arch/x86/kernel/signal.c               |   26 +++++++++++---------------
 3 files changed, 17 insertions(+), 36 deletions(-)
arch/x86/include/asm/sigcontext.h +3 -3
@@ -57,9 +57,9 @@ struct sigcontext {
 	unsigned long ip;
 	unsigned long flags;
 	unsigned short cs;
-	unsigned short __pad2;	/* Was called gs, but was always zero. */
-	unsigned short __pad1;	/* Was called fs, but was always zero. */
-	unsigned short ss;
+	unsigned short gs;
+	unsigned short fs;
+	unsigned short __pad0;
 	unsigned long err;
 	unsigned long trapno;
 	unsigned long oldmask;
arch/x86/include/uapi/asm/sigcontext.h +3 -18
@@ -177,24 +177,9 @@ struct sigcontext {
 	__u64 rip;
 	__u64 eflags;		/* RFLAGS */
 	__u16 cs;
-
-	/*
-	 * Prior to 2.5.64 ("[PATCH] x86-64 updates for 2.5.64-bk3"),
-	 * Linux saved and restored fs and gs in these slots.  This
-	 * was counterproductive, as fsbase and gsbase were never
-	 * saved, so arch_prctl was presumably unreliable.
-	 *
-	 * If these slots are ever needed for any other purpose, there
-	 * is some risk that very old 64-bit binaries could get
-	 * confused.  I doubt that many such binaries still work,
-	 * though, since the same patch in 2.5.64 also removed the
-	 * 64-bit set_thread_area syscall, so it appears that there is
-	 * no TLS API that works in both pre- and post-2.5.64 kernels.
-	 */
-	__u16 __pad2;		/* Was gs. */
-	__u16 __pad1;		/* Was fs. */
-
-	__u16 ss;
+	__u16 gs;
+	__u16 fs;
+	__u16 __pad0;
 	__u64 err;
 	__u64 trapno;
 	__u64 oldmask;
arch/x86/kernel/signal.c +11 -15
@@ -93,8 +93,15 @@ int restore_sigcontext(struct pt_regs *r
 		COPY(r15);
 #endif /* CONFIG_X86_64 */
 
+#ifdef CONFIG_X86_32
 		COPY_SEG_CPL3(cs);
 		COPY_SEG_CPL3(ss);
+#else /* !CONFIG_X86_32 */
+		/* Kernel saves and restores only the CS segment register on signals,
+		 * which is the bare minimum needed to allow mixed 32/64-bit code.
+		 * App's signal handler can save/restore other segments if needed. */
+		COPY_SEG_CPL3(cs);
+#endif /* CONFIG_X86_32 */
 
 		get_user_ex(tmpflags, &sc->flags);
 		regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS);
@@ -154,9 +161,8 @@ int setup_sigcontext(struct sigcontext _
 #else /* !CONFIG_X86_32 */
 		put_user_ex(regs->flags, &sc->flags);
 		put_user_ex(regs->cs, &sc->cs);
-		put_user_ex(0, &sc->__pad2);
-		put_user_ex(0, &sc->__pad1);
-		put_user_ex(regs->ss, &sc->ss);
+		put_user_ex(0, &sc->gs);
+		put_user_ex(0, &sc->fs);
 #endif /* CONFIG_X86_32 */
 
 		put_user_ex(fpstate, &sc->fpstate);
@@ -450,19 +456,9 @@ static int __setup_rt_frame(int sig, str
 
 	regs->sp = (unsigned long)frame;
 
-	/*
-	 * Set up the CS and SS registers to run signal handlers in
-	 * 64-bit mode, even if the handler happens to be interrupting
-	 * 32-bit or 16-bit code.
-	 *
-	 * SS is subtle.  In 64-bit mode, we don't need any particular
-	 * SS descriptor, but we do need SS to be valid.  It's possible
-	 * that the old SS is entirely bogus -- this can happen if the
-	 * signal we're trying to deliver is #GP or #SS caused by a bad
-	 * SS value.
-	 */
+	/* Set up the CS register to run signal handlers in 64-bit mode,
+	   even if the handler happens to be interrupting 32-bit code. */
 	regs->cs = __USER_CS;
-	regs->ss = __USER_DS;
 
 	return 0;
 }
author maintainer
#36 lore raw

PATCH 38/78 regmap: regcache-rbtree: Clean new present bits on present bitmap resize

In reply to Greg Kroah-Hartman

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

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

From: Guenter Roeck <[email protected]>

commit 8ef9724bf9718af81cfc5132253372f79c71b7e2 upstream.

When inserting a new register into a block, the present bit map size is increased using krealloc. krealloc does not clear the additionally allocated memory, leaving it filled with random values. Result is that some registers are considered cached even though this is not the case.

Fix the problem by clearing the additionally allocated memory. Also, if the bitmap size does not increase, do not reallocate the bitmap at all to reduce overhead.

Fixes 3f4ff561bc88 ("regmap: rbtree: Make cache_present bitmap per node")
---
 drivers/base/regmap/regcache-rbtree.c |   19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/base/regmap/regcache-rbtree.c +14 -5
@@ -296,11 +296,20 @@ static int regcache_rbtree_insert_to_blo
 	if (!blk)
 		return -ENOMEM;
 
-	present = krealloc(rbnode->cache_present,
-		    BITS_TO_LONGS(blklen) * sizeof(*present), GFP_KERNEL);
-	if (!present) {
-		kfree(blk);
-		return -ENOMEM;
+	if (BITS_TO_LONGS(blklen) > BITS_TO_LONGS(rbnode->blklen)) {
+		present = krealloc(rbnode->cache_present,
+				   BITS_TO_LONGS(blklen) * sizeof(*present),
+				   GFP_KERNEL);
+		if (!present) {
+			kfree(blk);
+			return -ENOMEM;
+		}
+
+		memset(present + BITS_TO_LONGS(rbnode->blklen), 0,
+		       (BITS_TO_LONGS(blklen) - BITS_TO_LONGS(rbnode->blklen))
+		       * sizeof(*present));
+	} else {
+		present = rbnode->cache_present;
 	}
 
 	/* insert the register value in the correct place in the rbnode block */
author maintainer
#37 lore raw

PATCH 39/78 MIPS: Fix seccomp syscall argument for MIPS64

In reply to Greg Kroah-Hartman

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

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

From: Markos Chandras <[email protected]>

commit 9f161439e4104b641a7bfb9b89581d801159fec8 upstream.

Commit 4c21b8fd8f14 ("MIPS: seccomp: Handle indirect system calls (o32)") fixed indirect system calls on O32 but it also introduced a bug for MIPS64 where it erroneously modified the v0 (syscall) register with the assumption that the sycall offset hasn't been taken into consideration. This breaks seccomp on MIPS64 n64 and n32 ABIs. We fix this by replacing the addition with a move instruction.

Fixes 4c21b8fd8f14 ("MIPS: seccomp: Handle indirect system calls (o32)")

Patchwork: https://patchwork.linux-mips.org/patch/10951/

---
 arch/mips/kernel/scall64-64.S  |    2 +-
 arch/mips/kernel/scall64-n32.S |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/mips/kernel/scall64-64.S +1 -1
@@ -80,7 +80,7 @@ syscall_trace_entry:
 	SAVE_STATIC
 	move	s0, t2
 	move	a0, sp
-	daddiu	a1, v0, __NR_64_Linux
+	move	a1, v0
 	jal	syscall_trace_enter
 
 	bltz	v0, 2f			# seccomp failed? Skip syscall
arch/mips/kernel/scall64-n32.S +1 -1
@@ -72,7 +72,7 @@ n32_syscall_trace_entry:
 	SAVE_STATIC
 	move	s0, t2
 	move	a0, sp
-	daddiu	a1, v0, __NR_N32_Linux
+	move	a1, v0
 	jal	syscall_trace_enter
 
 	bltz	v0, 2f			# seccomp failed? Skip syscall
author maintainer
#38 lore raw

PATCH 40/78 libiscsi: Fix host busy blocking during connection teardown

In reply to Greg Kroah-Hartman

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

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

From: John Soni Jose <[email protected]>

commit 660d0831d1494a6837b2f810d08b5be092c1f31d upstream.

In case of hw iscsi offload, an host can have N-number of active connections. There can be IO's running on some connections which make host->host_busy always TRUE. Now if logout from a connection is tried then the code gets into an infinite loop as host->host_busy is always TRUE.

iscsi_conn_teardown(....)
{
.........

    /*
     * Block until all in-progress commands for this connection
     * time out or fail.
     */
     for (;;) {
      spin_lock_irqsave(session->host->host_lock, flags);
      if (!atomic_read(&session->host->host_busy)) { /* OK for ERL == 0 */
	      spin_unlock_irqrestore(session->host->host_lock, flags);
              break;
      }
     spin_unlock_irqrestore(session->host->host_lock, flags);
     msleep_interruptible(500);
     iscsi_conn_printk(KERN_INFO, conn, "iscsi conn_destroy(): "
                 "host_busy %d host_failed %d\n",
	          atomic_read(&session->host->host_busy),
	          session->host->host_failed);

	................
	...............
     }

}

This is not an issue with software-iscsi/iser as each cxn is a separate host.

Fix:
Acquiring eh_mutex in iscsi_conn_teardown() before setting session->state = ISCSI_STATE_TERMINATE.

---
 drivers/scsi/libiscsi.c |   25 ++-----------------------
 1 file changed, 2 insertions(+), 23 deletions(-)
drivers/scsi/libiscsi.c +2 -23
@@ -2941,10 +2941,10 @@ void iscsi_conn_teardown(struct iscsi_cl
 {
 	struct iscsi_conn *conn = cls_conn->dd_data;
 	struct iscsi_session *session = conn->session;
-	unsigned long flags;
 
 	del_timer_sync(&conn->transport_timer);
 
+	mutex_lock(&session->eh_mutex);
 	spin_lock_bh(&session->frwd_lock);
 	conn->c_stage = ISCSI_CONN_CLEANUP_WAIT;
 	if (session->leadconn == conn) {
@@ -2956,28 +2956,6 @@ void iscsi_conn_teardown(struct iscsi_cl
 	}
 	spin_unlock_bh(&session->frwd_lock);
 
-	/*
-	 * Block until all in-progress commands for this connection
-	 * time out or fail.
-	 */
-	for (;;) {
-		spin_lock_irqsave(session->host->host_lock, flags);
-		if (!atomic_read(&session->host->host_busy)) { /* OK for ERL == 0 */
-			spin_unlock_irqrestore(session->host->host_lock, flags);
-			break;
-		}
-		spin_unlock_irqrestore(session->host->host_lock, flags);
-		msleep_interruptible(500);
-		iscsi_conn_printk(KERN_INFO, conn, "iscsi conn_destroy(): "
-				  "host_busy %d host_failed %d\n",
-				  atomic_read(&session->host->host_busy),
-				  session->host->host_failed);
-		/*
-		 * force eh_abort() to unblock
-		 */
-		wake_up(&conn->ehwait);
-	}
-
 	/* flush queued up work because we free the connection below */
 	iscsi_suspend_tx(conn);
 
@@ -2994,6 +2972,7 @@ void iscsi_conn_teardown(struct iscsi_cl
 	if (session->leadconn == conn)
 		session->leadconn = NULL;
 	spin_unlock_bh(&session->frwd_lock);
+	mutex_unlock(&session->eh_mutex);
 
 	iscsi_destroy_conn(cls_conn);
 }
author maintainer
#39 lore raw

PATCH 41/78 sd: Fix maximum I/O size for BLOCK_PC requests

In reply to Greg Kroah-Hartman

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

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

From: "Martin K. Petersen" <[email protected]>

commit 4f258a46346c03fa0bbb6199ffaf4e1f9f599660 upstream.

Commit bcdb247c6b6a ("sd: Limit transfer length") clamped the maximum size of an I/O request to the MAXIMUM TRANSFER LENGTH field in the BLOCK LIMITS VPD. This had the unfortunate effect of also limiting the maximum size of non-filesystem requests sent to the device through sg/bsg.

Avoid using blk_queue_max_hw_sectors() and set the max_sectors queue limit directly.

Also update the comment in blk_limits_max_hw_sectors() to clarify that max_hw_sectors defines the limit for the I/O controller only.

---
 block/blk-settings.c |    4 ++--
 drivers/scsi/sd.c    |    6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
block/blk-settings.c +2 -2
@@ -241,8 +241,8 @@ EXPORT_SYMBOL(blk_queue_bounce_limit);
  * Description:
  *    Enables a low level driver to set a hard upper limit,
  *    max_hw_sectors, on the size of requests.  max_hw_sectors is set by
- *    the device driver based upon the combined capabilities of I/O
- *    controller and storage device.
+ *    the device driver based upon the capabilities of the I/O
+ *    controller.
  *
  *    max_sectors is a soft limit imposed by the block layer for
  *    filesystem type requests.  This value can be overridden on a
drivers/scsi/sd.c +3 -3
@@ -2770,9 +2770,9 @@ static int sd_revalidate_disk(struct gen
 	max_xfer = sdkp->max_xfer_blocks;
 	max_xfer <<= ilog2(sdp->sector_size) - 9;
 
-	max_xfer = min_not_zero(queue_max_hw_sectors(sdkp->disk->queue),
-				max_xfer);
-	blk_queue_max_hw_sectors(sdkp->disk->queue, max_xfer);
+	sdkp->disk->queue->limits.max_sectors =
+		min_not_zero(queue_max_hw_sectors(sdkp->disk->queue), max_xfer);
+
 	set_capacity(disk, sdkp->capacity);
 	sd_config_write_same(sdkp);
 	kfree(buffer);
author maintainer
#40 lore raw

PATCH 42/78 crypto: nx - respect sg limit bounds when building sg lists for SHA

In reply to Greg Kroah-Hartman

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

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

From: Jan Stancek <[email protected]>

commit d3392f41f6d3cd0a034bd0aca47fabea2b47218e upstream.

Commit 000851119e80 changed sha256/512 update functions to pass more data to nx_build_sg_list(), which ends with sg list overflows and usually with update functions failing for data larger than max_sg_len * NX_PAGE_SIZE.

This happens because:
- both "total" and "to_process" are updated, which leads to "to_process" getting overflowed for some data lengths For example:
In first iteration "total" is 50, and let's assume "to_process" is 30 due to sg limits. At the end of first iteration "total" is set to 20. At start of 2nd iteration "to_process" overflows on:
to_process = total - to_process;
- "in_sg" is not reset to nx_ctx->in_sg after each iteration
- nx_build_sg_list() is hitting overflow because the amount of data passed to it would require more than sgmax elements
- as consequence of previous item, data stored in overflowed sg list may no longer be aligned to SHA*_BLOCK_SIZE

This patch changes sha256/512 update functions so that "to_process" respects sg limits and never tries to pass more data to nx_build_sg_list() to avoid overflows. "to_process" is calculated as minimum of "total" and sg limits at start of every iteration.

Fixes 000851119e80 ("crypto: nx - Fix SHA concurrence issue and sg

limit bounds")

Cc Leonidas Da Silva Barbosa <[email protected]>
Cc Marcelo Henrique Cerri <[email protected]>
Cc Fionnuala Gunter <[email protected]>
Cc "David S. Miller" <[email protected]>
---
 drivers/crypto/nx/nx-sha256.c |   27 ++++++++++++++++-----------
 drivers/crypto/nx/nx-sha512.c |   28 ++++++++++++++++------------
 2 files changed, 32 insertions(+), 23 deletions(-)
drivers/crypto/nx/nx-sha256.c +16 -11
@@ -71,7 +71,6 @@ static int nx_sha256_update(struct shash
 	struct sha256_state *sctx = shash_desc_ctx(desc);
 	struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base);
 	struct nx_csbcpb *csbcpb = (struct nx_csbcpb *)nx_ctx->csbcpb;
-	struct nx_sg *in_sg;
 	struct nx_sg *out_sg;
 	u64 to_process = 0, leftover, total;
 	unsigned long irq_flags;
@@ -97,7 +96,6 @@ static int nx_sha256_update(struct shash
 	NX_CPB_FDM(csbcpb) |= NX_FDM_INTERMEDIATE;
 	NX_CPB_FDM(csbcpb) |= NX_FDM_CONTINUATION;
 
-	in_sg = nx_ctx->in_sg;
 	max_sg_len = min_t(u64, nx_ctx->ap->sglen,
 			nx_driver.of.max_sg_len/sizeof(struct nx_sg));
 	max_sg_len = min_t(u64, max_sg_len,
@@ -114,17 +112,12 @@ static int nx_sha256_update(struct shash
 	}
 
 	do {
-		/*
-		 * to_process: the SHA256_BLOCK_SIZE data chunk to process in
-		 * this update. This value is also restricted by the sg list
-		 * limits.
-		 */
-		to_process = total - to_process;
-		to_process = to_process & ~(SHA256_BLOCK_SIZE - 1);
+		int used_sgs = 0;
+		struct nx_sg *in_sg = nx_ctx->in_sg;
 
 		if (buf_len) {
 			data_len = buf_len;
-			in_sg = nx_build_sg_list(nx_ctx->in_sg,
+			in_sg = nx_build_sg_list(in_sg,
 						 (u8 *) sctx->buf,
 						 &data_len,
 						 max_sg_len);
@@ -133,15 +126,27 @@ static int nx_sha256_update(struct shash
 				rc = -EINVAL;
 				goto out;
 			}
+			used_sgs = in_sg - nx_ctx->in_sg;
 		}
 
+		/* to_process: SHA256_BLOCK_SIZE aligned chunk to be
+		 * processed in this iteration. This value is restricted
+		 * by sg list limits and number of sgs we already used
+		 * for leftover data. (see above)
+		 * In ideal case, we could allow NX_PAGE_SIZE * max_sg_len,
+		 * but because data may not be aligned, we need to account
+		 * for that too. */
+		to_process = min_t(u64, total,
+			(max_sg_len - 1 - used_sgs) * NX_PAGE_SIZE);
+		to_process = to_process & ~(SHA256_BLOCK_SIZE - 1);
+
 		data_len = to_process - buf_len;
 		in_sg = nx_build_sg_list(in_sg, (u8 *) data,
 					 &data_len, max_sg_len);
 
 		nx_ctx->op.inlen = (nx_ctx->in_sg - in_sg) * sizeof(struct nx_sg);
 
-		to_process = (data_len + buf_len);
+		to_process = data_len + buf_len;
 		leftover = total - to_process;
 
 		/*
drivers/crypto/nx/nx-sha512.c +16 -12
@@ -71,7 +71,6 @@ static int nx_sha512_update(struct shash
 	struct sha512_state *sctx = shash_desc_ctx(desc);
 	struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base);
 	struct nx_csbcpb *csbcpb = (struct nx_csbcpb *)nx_ctx->csbcpb;
-	struct nx_sg *in_sg;
 	struct nx_sg *out_sg;
 	u64 to_process, leftover = 0, total;
 	unsigned long irq_flags;
@@ -97,7 +96,6 @@ static int nx_sha512_update(struct shash
 	NX_CPB_FDM(csbcpb) |= NX_FDM_INTERMEDIATE;
 	NX_CPB_FDM(csbcpb) |= NX_FDM_CONTINUATION;
 
-	in_sg = nx_ctx->in_sg;
 	max_sg_len = min_t(u64, nx_ctx->ap->sglen,
 			nx_driver.of.max_sg_len/sizeof(struct nx_sg));
 	max_sg_len = min_t(u64, max_sg_len,
@@ -114,18 +112,12 @@ static int nx_sha512_update(struct shash
 	}
 
 	do {
-		/*
-		 * to_process: the SHA512_BLOCK_SIZE data chunk to process in
-		 * this update. This value is also restricted by the sg list
-		 * limits.
-		 */
-		to_process = total - leftover;
-		to_process = to_process & ~(SHA512_BLOCK_SIZE - 1);
-		leftover = total - to_process;
+		int used_sgs = 0;
+		struct nx_sg *in_sg = nx_ctx->in_sg;
 
 		if (buf_len) {
 			data_len = buf_len;
-			in_sg = nx_build_sg_list(nx_ctx->in_sg,
+			in_sg = nx_build_sg_list(in_sg,
 						 (u8 *) sctx->buf,
 						 &data_len, max_sg_len);
 
@@ -133,8 +125,20 @@ static int nx_sha512_update(struct shash
 				rc = -EINVAL;
 				goto out;
 			}
+			used_sgs = in_sg - nx_ctx->in_sg;
 		}
 
+		/* to_process: SHA512_BLOCK_SIZE aligned chunk to be
+		 * processed in this iteration. This value is restricted
+		 * by sg list limits and number of sgs we already used
+		 * for leftover data. (see above)
+		 * In ideal case, we could allow NX_PAGE_SIZE * max_sg_len,
+		 * but because data may not be aligned, we need to account
+		 * for that too. */
+		to_process = min_t(u64, total,
+			(max_sg_len - 1 - used_sgs) * NX_PAGE_SIZE);
+		to_process = to_process & ~(SHA512_BLOCK_SIZE - 1);
+
 		data_len = to_process - buf_len;
 		in_sg = nx_build_sg_list(in_sg, (u8 *) data,
 					 &data_len, max_sg_len);
@@ -146,7 +150,7 @@ static int nx_sha512_update(struct shash
 			goto out;
 		}
 
-		to_process = (data_len + buf_len);
+		to_process = data_len + buf_len;
 		leftover = total - to_process;
 
 		/*
author maintainer
#41 lore raw

PATCH 43/78 crypto: caam - fix memory corruption in ahash_final_ctx

In reply to Greg Kroah-Hartman

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

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

From: Horia Geant? <[email protected]>

commit b310c178e6d897f82abb9da3af1cd7c02b09f592 upstream.

When doing pointer operation for accessing the HW S/G table, a value representing number of entries (and not number of bytes) must be used.

Fixes 045e36780f115 ("crypto: caam - ahash hmac support")
---
 drivers/crypto/caam/caamhash.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/crypto/caam/caamhash.c +4 -3
@@ -909,13 +909,14 @@ static int ahash_final_ctx(struct ahash_
 			  state->buflen_1;
 	u32 *sh_desc = ctx->sh_desc_fin, *desc;
 	dma_addr_t ptr = ctx->sh_desc_fin_dma;
-	int sec4_sg_bytes;
+	int sec4_sg_bytes, sec4_sg_src_index;
 	int digestsize = crypto_ahash_digestsize(ahash);
 	struct ahash_edesc *edesc;
 	int ret = 0;
 	int sh_len;
 
-	sec4_sg_bytes = (1 + (buflen ? 1 : 0)) * sizeof(struct sec4_sg_entry);
+	sec4_sg_src_index = 1 + (buflen ? 1 : 0);
+	sec4_sg_bytes = sec4_sg_src_index * sizeof(struct sec4_sg_entry);
 
 	/* allocate space for base edesc and hw desc commands, link tables */
 	edesc = kmalloc(sizeof(struct ahash_edesc) + DESC_JOB_IO_LEN +
@@ -942,7 +943,7 @@ static int ahash_final_ctx(struct ahash_
 	state->buf_dma = try_buf_map_to_sec4_sg(jrdev, edesc->sec4_sg + 1,
 						buf, state->buf_dma, buflen,
 						last_buflen);
-	(edesc->sec4_sg + sec4_sg_bytes - 1)->len |= SEC4_SG_LEN_FIN;
+	(edesc->sec4_sg + sec4_sg_src_index - 1)->len |= SEC4_SG_LEN_FIN;
 
 	edesc->sec4_sg_dma = dma_map_single(jrdev, edesc->sec4_sg,
 					    sec4_sg_bytes, DMA_TO_DEVICE);
author maintainer
#42 lore raw

PATCH 44/78 Revert "libata-eh: Set information field for autosense"

In reply to Greg Kroah-Hartman

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

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

From: Tejun Heo <[email protected]>

commit fe16d4f202c59a560533a223bc6375739ee30944 upstream.

This reverts commit a1524f226a02aa6edebd90ae0752e97cfd78b159.

As implemented, ACS-4 sense reporting for ATA devices bypasses error diagnosis and handling in libata degrading EH behavior significantly. Revert the related changes for now.

---
 drivers/ata/libata-core.c |    4 ++--
 drivers/ata/libata-eh.c   |    3 ---
 drivers/ata/libata-scsi.c |   12 ------------
 drivers/ata/libata.h      |    5 +----
 drivers/scsi/scsi_error.c |   31 -------------------------------
 include/scsi/scsi_eh.h    |    1 -
 6 files changed, 3 insertions(+), 53 deletions(-)
drivers/ata/libata-core.c +2 -2
@@ -694,11 +694,11 @@ static int ata_rwcmd_protocol(struct ata
  *	RETURNS:
  *	Block address read from @tf.
  */
-u64 ata_tf_read_block(const struct ata_taskfile *tf, struct ata_device *dev)
+u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev)
 {
 	u64 block = 0;
 
-	if (!dev || tf->flags & ATA_TFLAG_LBA) {
+	if (tf->flags & ATA_TFLAG_LBA) {
 		if (tf->flags & ATA_TFLAG_LBA48) {
 			block |= (u64)tf->hob_lbah << 40;
 			block |= (u64)tf->hob_lbam << 32;
drivers/ata/libata-eh.c +0 -3
@@ -1864,7 +1864,6 @@ void ata_eh_analyze_ncq_error(struct ata
 		ata_dev_dbg(dev, "NCQ Autosense %02x/%02x/%02x\n",
 			    sense_key, asc, ascq);
 		ata_scsi_set_sense(qc->scsicmd, sense_key, asc, ascq);
-		ata_scsi_set_sense_information(qc->scsicmd, &qc->result_tf);
 		qc->flags |= ATA_QCFLAG_SENSE_VALID;
 	}
 
@@ -1907,8 +1906,6 @@ static unsigned int ata_eh_analyze_tf(st
 			tmp = ata_eh_request_sense(qc, qc->scsicmd);
 			if (tmp)
 				qc->err_mask |= tmp;
-			else
-				ata_scsi_set_sense_information(qc->scsicmd, tf);
 		} else {
 			ata_dev_warn(qc->dev, "sense data available but port frozen\n");
 		}
drivers/ata/libata-scsi.c +0 -12
@@ -280,18 +280,6 @@ void ata_scsi_set_sense(struct scsi_cmnd
 	scsi_build_sense_buffer(0, cmd->sense_buffer, sk, asc, ascq);
 }
 
-void ata_scsi_set_sense_information(struct scsi_cmnd *cmd,
-				    const struct ata_taskfile *tf)
-{
-	u64 information;
-
-	if (!cmd)
-		return;
-
-	information = ata_tf_read_block(tf, NULL);
-	scsi_set_sense_information(cmd->sense_buffer, information);
-}
-
 static ssize_t
 ata_scsi_em_message_store(struct device *dev, struct device_attribute *attr,
 			  const char *buf, size_t count)
drivers/ata/libata.h +1 -4
@@ -67,8 +67,7 @@ extern struct ata_queued_cmd *ata_qc_new
 extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev,
 			   u64 block, u32 n_block, unsigned int tf_flags,
 			   unsigned int tag);
-extern u64 ata_tf_read_block(const struct ata_taskfile *tf,
-			     struct ata_device *dev);
+extern u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev);
 extern unsigned ata_exec_internal(struct ata_device *dev,
 				  struct ata_taskfile *tf, const u8 *cdb,
 				  int dma_dir, void *buf, unsigned int buflen,
@@ -139,8 +138,6 @@ extern int ata_scsi_add_hosts(struct ata
 extern void ata_scsi_scan_host(struct ata_port *ap, int sync);
 extern int ata_scsi_offline_dev(struct ata_device *dev);
 extern void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq);
-extern void ata_scsi_set_sense_information(struct scsi_cmnd *cmd,
-					   const struct ata_taskfile *tf);
 extern void ata_scsi_media_change_notify(struct ata_device *dev);
 extern void ata_scsi_hotplug(struct work_struct *work);
 extern void ata_schedule_scsi_eh(struct Scsi_Host *shost);
drivers/scsi/scsi_error.c +0 -31
@@ -26,7 +26,6 @@
 #include <linux/blkdev.h>
 #include <linux/delay.h>
 #include <linux/jiffies.h>
-#include <asm/unaligned.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_cmnd.h>
@@ -2587,33 +2586,3 @@ void scsi_build_sense_buffer(int desc, u
 	}
 }
 EXPORT_SYMBOL(scsi_build_sense_buffer);
-
-/**
- * scsi_set_sense_information - set the information field in a
- *		formatted sense data buffer
- * @buf:	Where to build sense data
- * @info:	64-bit information value to be set
- *
- **/
-void scsi_set_sense_information(u8 *buf, u64 info)
-{
-	if ((buf[0] & 0x7f) == 0x72) {
-		u8 *ucp, len;
-
-		len = buf[7];
-		ucp = (char *)scsi_sense_desc_find(buf, len + 8, 0);
-		if (!ucp) {
-			buf[7] = len + 0xa;
-			ucp = buf + 8 + len;
-		}
-		ucp[0] = 0;
-		ucp[1] = 0xa;
-		ucp[2] = 0x80; /* Valid bit */
-		ucp[3] = 0;
-		put_unaligned_be64(info, &ucp[4]);
-	} else if ((buf[0] & 0x7f) == 0x70) {
-		buf[0] |= 0x80;
-		put_unaligned_be64(info, &buf[3]);
-	}
-}
-EXPORT_SYMBOL(scsi_set_sense_information);
include/scsi/scsi_eh.h +0 -1
@@ -59,7 +59,6 @@ extern int scsi_get_sense_info_fld(const
 				   u64 * info_out);
 
 extern void scsi_build_sense_buffer(int desc, u8 *buf, u8 key, u8 asc, u8 ascq);
-extern void scsi_set_sense_information(u8 *buf, u64 info);
 
 extern int scsi_ioctl_reset(struct scsi_device *, int __user *);
 
author maintainer
#43 lore raw

PATCH 45/78 Revert "libata: Implement support for sense data reporting"

In reply to Greg Kroah-Hartman

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

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

From: Tejun Heo <[email protected]>

commit 84ded2f8e7dda336fc2fb3570726ceb3b3b3590f upstream.

This reverts commit fe7173c206de63fc28475ee6ae42ff95c05692de.

As implemented, ACS-4 sense reporting for ATA devices bypasses error diagnosis and handling in libata degrading EH behavior significantly. Revert the related changes for now.

ATA_ID_COMMAND_SET_3/4 constants are not reverted as they're used by later changes.

---
 drivers/ata/libata-core.c |   20 ----------
 drivers/ata/libata-eh.c   |   86 +---------------------------------------------
 include/linux/ata.h       |   16 --------
 3 files changed, 4 insertions(+), 118 deletions(-)
drivers/ata/libata-core.c +1 -19
@@ -2147,24 +2147,6 @@ static int ata_dev_config_ncq(struct ata
 	return 0;
 }
 
-static void ata_dev_config_sense_reporting(struct ata_device *dev)
-{
-	unsigned int err_mask;
-
-	if (!ata_id_has_sense_reporting(dev->id))
-		return;
-
-	if (ata_id_sense_reporting_enabled(dev->id))
-		return;
-
-	err_mask = ata_dev_set_feature(dev, SETFEATURE_SENSE_DATA, 0x1);
-	if (err_mask) {
-		ata_dev_dbg(dev,
-			    "failed to enable Sense Data Reporting, Emask 0x%x\n",
-			    err_mask);
-	}
-}
-
 /**
  *	ata_dev_configure - Configure the specified ATA/ATAPI device
  *	@dev: Target device to configure
@@ -2387,7 +2369,7 @@ int ata_dev_configure(struct ata_device
 					dev->devslp_timing[i] = sata_setting[j];
 				}
 		}
-		ata_dev_config_sense_reporting(dev);
+
 		dev->cdb_len = 16;
 	}
 
drivers/ata/libata-eh.c +3 -83

110 lines not on this page · raw message

include/linux/ata.h +0 -16
@@ -385,8 +385,6 @@ enum {
 	SATA_SSP		= 0x06,	/* Software Settings Preservation */
 	SATA_DEVSLP		= 0x09,	/* Device Sleep */
 
-	SETFEATURE_SENSE_DATA = 0xC3, /* Sense Data Reporting feature */
-
 	/* feature values for SET_MAX */
 	ATA_SET_MAX_ADDR	= 0x00,
 	ATA_SET_MAX_PASSWD	= 0x01,
@@ -710,20 +708,6 @@ static inline bool ata_id_has_read_log_d
 	return id[ATA_ID_COMMAND_SET_3] & (1 << 3);
 }
 
-static inline bool ata_id_has_sense_reporting(const u16 *id)
-{
-	if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15)))
-		return false;
-	return id[ATA_ID_COMMAND_SET_3] & (1 << 6);
-}
-
-static inline bool ata_id_sense_reporting_enabled(const u16 *id)
-{
-	if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15)))
-		return false;
-	return id[ATA_ID_COMMAND_SET_4] & (1 << 6);
-}
-
 /**
  *	ata_id_major_version	-	get ATA level of drive
  *	@id: Identify data
author maintainer
#44 lore raw

PATCH 46/78 Revert "libata: Implement NCQ autosense"

In reply to Greg Kroah-Hartman

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

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

From: Tejun Heo <[email protected]>

commit 74a80d67b8316eb3fbeb73dafc060a5a0a708587 upstream.

This reverts commit 42b966fbf35da9c87f08d98f9b8978edf9e717cf.

As implemented, ACS-4 sense reporting for ATA devices bypasses error diagnosis and handling in libata degrading EH behavior significantly. Revert the related changes for now.

---
 drivers/ata/libata-eh.c   |   18 ------------------
 drivers/ata/libata-scsi.c |    9 ++-------
 drivers/ata/libata.h      |    1 -
 include/linux/ata.h       |    2 --
 4 files changed, 2 insertions(+), 28 deletions(-)
drivers/ata/libata-eh.c +0 -18
@@ -1592,8 +1592,6 @@ static int ata_eh_read_log_10h(struct at
 	tf->hob_lbah = buf[10];
 	tf->nsect = buf[12];
 	tf->hob_nsect = buf[13];
-	if (ata_id_has_ncq_autosense(dev->id))
-		tf->auxiliary = buf[14] << 16 | buf[15] << 8 | buf[16];
 
 	return 0;
 }
@@ -1791,18 +1789,6 @@ void ata_eh_analyze_ncq_error(struct ata
 	memcpy(&qc->result_tf, &tf, sizeof(tf));
 	qc->result_tf.flags = ATA_TFLAG_ISADDR | ATA_TFLAG_LBA | ATA_TFLAG_LBA48;
 	qc->err_mask |= AC_ERR_DEV | AC_ERR_NCQ;
-	if (qc->result_tf.auxiliary) {
-		char sense_key, asc, ascq;
-
-		sense_key = (qc->result_tf.auxiliary >> 16) & 0xff;
-		asc = (qc->result_tf.auxiliary >> 8) & 0xff;
-		ascq = qc->result_tf.auxiliary & 0xff;
-		ata_dev_dbg(dev, "NCQ Autosense %02x/%02x/%02x\n",
-			    sense_key, asc, ascq);
-		ata_scsi_set_sense(qc->scsicmd, sense_key, asc, ascq);
-		qc->flags |= ATA_QCFLAG_SENSE_VALID;
-	}
-
 	ehc->i.err_mask &= ~AC_ERR_DEV;
 }
 
@@ -1832,10 +1818,6 @@ static unsigned int ata_eh_analyze_tf(st
 		return ATA_EH_RESET;
 	}
 
-	/* Set by NCQ autosense */
-	if (qc->flags & ATA_QCFLAG_SENSE_VALID)
-		return 0;
-
 	if (stat & (ATA_ERR | ATA_DF))
 		qc->err_mask |= AC_ERR_DEV;
 	else
drivers/ata/libata-scsi.c +2 -7
@@ -270,11 +270,8 @@ DEVICE_ATTR(unload_heads, S_IRUGO | S_IW
 	    ata_scsi_park_show, ata_scsi_park_store);
 EXPORT_SYMBOL_GPL(dev_attr_unload_heads);
 
-void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq)
+static void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq)
 {
-	if (!cmd)
-		return;
-
 	cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
 
 	scsi_build_sense_buffer(0, cmd->sense_buffer, sk, asc, ascq);
@@ -1780,9 +1777,7 @@ static void ata_scsi_qc_complete(struct
 	    ((cdb[2] & 0x20) || need_sense)) {
 		ata_gen_passthru_sense(qc);
 	} else {
-		if (qc->flags & ATA_QCFLAG_SENSE_VALID) {
-			cmd->result = SAM_STAT_CHECK_CONDITION;
-		} else if (!need_sense) {
+		if (!need_sense) {
 			cmd->result = SAM_STAT_GOOD;
 		} else {
 			/* TODO: decide which descriptor format to use
drivers/ata/libata.h +0 -1
@@ -137,7 +137,6 @@ extern int ata_scsi_add_hosts(struct ata
 			      struct scsi_host_template *sht);
 extern void ata_scsi_scan_host(struct ata_port *ap, int sync);
 extern int ata_scsi_offline_dev(struct ata_device *dev);
-extern void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq);
 extern void ata_scsi_media_change_notify(struct ata_device *dev);
 extern void ata_scsi_hotplug(struct work_struct *work);
 extern void ata_schedule_scsi_eh(struct Scsi_Host *shost);
include/linux/ata.h +0 -2
@@ -528,8 +528,6 @@ struct ata_bmdma_prd {
 #define ata_id_cdb_intr(id)	(((id)[ATA_ID_CONFIG] & 0x60) == 0x20)
 #define ata_id_has_da(id)	((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4))
 #define ata_id_has_devslp(id)	((id)[ATA_ID_FEATURE_SUPP] & (1 << 8))
-#define ata_id_has_ncq_autosense(id) \
-				((id)[ATA_ID_FEATURE_SUPP] & (1 << 7))
 
 static inline bool ata_id_has_hipm(const u16 *id)
 {
author maintainer
#45 lore raw

PATCH 48/78 ALSA: usb-audio: Fix runtime PM unbalance

In reply to Greg Kroah-Hartman

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

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

From: Takashi Iwai <[email protected]>

commit 9003ebb13f61e8c78a641e0dda7775183ada0625 upstream.

The fix for deadlock in PM in commit [1ee23fe07ee8: ALSA: usb-audio:
Fix deadlocks at resuming] introduced a new check of in_pm flag. However, the brainless patch author evaluated it in a wrong way (logical AND instead of logical OR), thus usb_autopm_get_interface() is wrongly called at probing, leading to unbalance of runtime PM refcount.

This patch fixes it by correcting the logic.

Fixes 1ee23fe07ee8 ('ALSA: usb-audio: Fix deadlocks at resuming')
---
 sound/usb/card.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/card.c +1 -1
@@ -638,7 +638,7 @@ int snd_usb_autoresume(struct snd_usb_au
 	int err = -ENODEV;
 
 	down_read(&chip->shutdown_rwsem);
-	if (chip->probing && chip->in_pm)
+	if (chip->probing || chip->in_pm)
 		err = 0;
 	else if (!chip->shutdown)
 		err = usb_autopm_get_interface(chip->pm_intf);
author maintainer
#46 lore raw

PATCH 49/78 ALSA: hda - Fix the white noise on Dell laptop

In reply to Greg Kroah-Hartman

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

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

From: Woodrow Shen <[email protected]>

commit 7ccb0a9917a511de1d5f92980f26885484d9a914 upstream.

Dell laptop causes the white noise by login screen and headphone, and the fixup function ALC292_FIXUP_DISABLE_AAMIX can eliminate this noise.

Codec: Realtek ALC3235
Vendor Id: 0x10ec0293
Subsystem Id: 0x102806db

---
 sound/pci/hda/patch_realtek.c |    1 +
 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -5119,6 +5119,7 @@ static const struct snd_pci_quirk alc269
 	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, 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),
author maintainer
#47 lore raw

PATCH 50/78 ALSA: usb: Add native DSD support for Gustard DAC-X20U

In reply to Greg Kroah-Hartman

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

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

From: Jurgen Kramer <[email protected]>

commit 9544f8b6e2ee9ed02d2322ff018837b185f51d45 upstream.

This patch adds native DSD support for the Gustard DAC-X20U.

---
 sound/usb/quirks.c |    1 +
 1 file changed, 1 insertion(+)
sound/usb/quirks.c +1 -0
@@ -1268,6 +1268,7 @@ u64 snd_usb_interface_dsd_format_quirks(
 			return SNDRV_PCM_FMTBIT_DSD_U32_BE;
 		break;
 
+	case USB_ID(0x20b1, 0x000a): /* Gustard DAC-X20U */
 	case USB_ID(0x20b1, 0x2009): /* DIYINHK DSD DXD 384kHz USB to I2S/DSD */
 	case USB_ID(0x20b1, 0x2023): /* JLsounds I2SoverUSB */
 		if (fp->altsetting == 3)
author maintainer
#48 lore raw

PATCH 51/78 ALSA: hda - Shutdown CX20722 on reboot/free to avoid spurious noises

In reply to Greg Kroah-Hartman

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

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

From: David Henningsson <[email protected]>

commit f6b28e4ded45bb91bc4cd115d55e35badedfce5f upstream.

On shutdown/reboot of CX20722, first shut down all EAPDs, then shut down the afg node to D3.

Failure to do so can lead to spurious noises from the internal speaker directly after reboot (and before the codec is reinitialized again, i e in BIOS setup or GRUB menus).

---
 sound/pci/hda/patch_conexant.c |   23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
sound/pci/hda/patch_conexant.c +22 -1
@@ -200,12 +200,33 @@ static int cx_auto_init(struct hda_codec
 	return 0;
 }
 
-#define cx_auto_free	snd_hda_gen_free
+static void cx_auto_reboot_notify(struct hda_codec *codec)
+{
+	struct conexant_spec *spec = codec->spec;
+
+	if (codec->core.vendor_id != 0x14f150f2)
+		return;
+
+	/* Turn the CX20722 codec into D3 to avoid spurious noises
+	   from the internal speaker during (and after) reboot */
+	cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false);
+
+	snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3);
+	snd_hda_codec_write(codec, codec->core.afg, 0,
+			    AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
+}
+
+static void cx_auto_free(struct hda_codec *codec)
+{
+	cx_auto_reboot_notify(codec);
+	snd_hda_gen_free(codec);
+}
 
 static const struct hda_codec_ops cx_auto_patch_ops = {
 	.build_controls = cx_auto_build_controls,
 	.build_pcms = snd_hda_gen_build_pcms,
 	.init = cx_auto_init,
+	.reboot_notify = cx_auto_reboot_notify,
 	.free = cx_auto_free,
 	.unsol_event = snd_hda_jack_unsol_event,
 #ifdef CONFIG_PM
author maintainer
#49 lore raw

PATCH 52/78 ALSA: hda - Check all inputs for is_active_nid_for_any()

In reply to Greg Kroah-Hartman

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

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

From: Takashi Iwai <[email protected]>

commit 9d2b48f7304aafaefbf0794a556ab4e307929d24 upstream.

The is_active_nid_for_any() function in the generic parser is supposed to check all connections from/to the given widget, but the current code checks only the first input connection (index = 0).

This patch corrects the code to check all inputs by passing -1 to index argument.

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

---
 sound/pci/hda/hda_generic.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
sound/pci/hda/hda_generic.c +3 -2
@@ -671,7 +671,8 @@ static bool is_active_nid(struct hda_cod
 		}
 		for (i = 0; i < path->depth; i++) {
 			if (path->path[i] == nid) {
-				if (dir == HDA_OUTPUT || path->idx[i] == idx)
+				if (dir == HDA_OUTPUT || idx == -1 ||
+				    path->idx[i] == idx)
 					return true;
 				break;
 			}
@@ -682,7 +683,7 @@ static bool is_active_nid(struct hda_cod
 
 /* check whether the NID is referred by any active paths */
 #define is_active_nid_for_any(codec, nid) \
-	is_active_nid(codec, nid, HDA_OUTPUT, 0)
+	is_active_nid(codec, nid, HDA_OUTPUT, -1)
 
 /* get the default amp value for the target state */
 static int get_amp_val_to_activate(struct hda_codec *codec, hda_nid_t nid,
author maintainer
#50 lore raw

PATCH 53/78 ALSA: hda - Fix path power activation

In reply to Greg Kroah-Hartman

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

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

From: Takashi Iwai <[email protected]>

commit c7cd0ef66aade29e37ee08821a0e195ee776c6e6 upstream.

The widget power-saving code tries to turn up/down the power of each widget in the I/O paths that are modified at each jack plug/unplug. The recent report revealed that the power activation leaves some widgets unpowered after plugging. This is because snd_hda_activate_path() turns on path->active flag at the end of the function while the path power management is done before that. Then it's regarded as if nothing is active, and the driver turns off the power.

The fix is simply to set the flag at the beginning of the function, before trying to power up.

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

---
 sound/pci/hda/hda_generic.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
sound/pci/hda/hda_generic.c +1 -5
@@ -884,8 +884,7 @@ void snd_hda_activate_path(struct hda_co
 	struct hda_gen_spec *spec = codec->spec;
 	int i;
 
-	if (!enable)
-		path->active = false;
+	path->active = enable;
 
 	/* make sure the widget is powered up */
 	if (enable && (spec->power_down_unused || codec->power_save_node))
@@ -903,9 +902,6 @@ void snd_hda_activate_path(struct hda_co
 		if (has_amp_out(codec, path, i))
 			activate_amp_out(codec, path, i, enable);
 	}
-
-	if (enable)
-		path->active = true;
 }
 EXPORT_SYMBOL_GPL(snd_hda_activate_path);
 
author maintainer
#51 lore raw

PATCH 54/78 ALSA: hda: fix possible NULL dereference

In reply to Greg Kroah-Hartman

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

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

From: Markus Osterhoff <[email protected]>

commit c7e69ae6b4ff49edf50180c0a32f3dd9d7967e31 upstream.

After a for-loop was replaced by list_for_each_entry, see Commit bbbc7e8502c9 ("ALSA: hda - Allocate hda_pcm objects dynamically"), Commit 751e2216899c ("ALSA: hda: fix possible null dereference"), a possible NULL pointer dereference has been introduced; this patch adds the NULL check on pcm->pcm, while leaving a potentially superfluous check on pcm itself untouched.

---
 sound/pci/hda/hda_codec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/hda_codec.c +1 -1
@@ -3259,7 +3259,7 @@ static int add_std_chmaps(struct hda_cod
 			struct snd_pcm_chmap *chmap;
 			const struct snd_pcm_chmap_elem *elem;
 
-			if (!pcm || pcm->own_chmap ||
+			if (!pcm || !pcm->pcm || pcm->own_chmap ||
 			    !hinfo->substreams)
 				continue;
 			elem = hinfo->chmap ? hinfo->chmap : snd_pcm_std_chmaps;
author maintainer
#52 lore raw

PATCH 55/78 mac80211: fix invalid read in minstrel_sort_best_tp_rates()

In reply to Greg Kroah-Hartman

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

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

From: Adrien Schildknecht <[email protected]>

commit f5eeb5fa191fd7b634cbc4883ac58f3b2184dbc5 upstream.

At the last iteration of the loop, j may equal zero and thus tp_list[j - 1] causes an invalid read.
Change the logic of the loop so that j - 1 is always >= 0.

---
 net/mac80211/rc80211_minstrel.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
net/mac80211/rc80211_minstrel.c +6 -5
@@ -92,14 +92,15 @@ int minstrel_get_tp_avg(struct minstrel_
 static inline void
 minstrel_sort_best_tp_rates(struct minstrel_sta_info *mi, int i, u8 *tp_list)
 {
-	int j = MAX_THR_RATES;
-	struct minstrel_rate_stats *tmp_mrs = &mi->r[j - 1].stats;
+	int j;
+	struct minstrel_rate_stats *tmp_mrs;
 	struct minstrel_rate_stats *cur_mrs = &mi->r[i].stats;
 
-	while (j > 0 && (minstrel_get_tp_avg(&mi->r[i], cur_mrs->prob_ewma) >
-	       minstrel_get_tp_avg(&mi->r[tp_list[j - 1]], tmp_mrs->prob_ewma))) {
-		j--;
+	for (j = MAX_THR_RATES; j > 0; --j) {
 		tmp_mrs = &mi->r[tp_list[j - 1]].stats;
+		if (minstrel_get_tp_avg(&mi->r[i], cur_mrs->prob_ewma) <=
+		    minstrel_get_tp_avg(&mi->r[tp_list[j - 1]], tmp_mrs->prob_ewma))
+			break;
 	}
 
 	if (j < MAX_THR_RATES - 1)
author maintainer
#53 lore raw

PATCH 56/78 target/iscsi: Fix double free of a TUR followed by a solicited NOPOUT

In reply to Greg Kroah-Hartman

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

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

From: Alexei Potashnik <[email protected]>

commit 9547308bda296b6f69876c840a0291fcfbeddbb8 upstream.

Make sure all non-READ SCSI commands get targ_xfer_tag initialized to 0xffffffff, not just WRITEs.

Double-free of a TUR cmd object occurs under the following scenario:

1. TUR received (targ_xfer_tag is uninitialized and left at 0)
2. TUR status sent
3. First unsolicited NOPIN is sent to initiator (gets targ_xfer_tag of 0)
4. NOPOUT for NOPIN (with TTT=0) arrives
- its ExpStatSN acks TUR status, TUR is queued for removal
- LIO tries to find NOPIN with TTT=0, but finds the same TUR instead, TUR is queued for removal for the 2nd time

(Drop unbalanced conditional bracket usage - nab)

---
 drivers/target/iscsi/iscsi_target.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/target/iscsi/iscsi_target.c +2 -2
@@ -968,9 +968,9 @@ int iscsit_setup_scsi_cmd(struct iscsi_c
 		cmd->cmd_flags |= ICF_NON_IMMEDIATE_UNSOLICITED_DATA;
 
 	conn->sess->init_task_tag = cmd->init_task_tag = hdr->itt;
-	if (hdr->flags & ISCSI_FLAG_CMD_READ) {
+	if (hdr->flags & ISCSI_FLAG_CMD_READ)
 		cmd->targ_xfer_tag = session_get_next_ttt(conn->sess);
-	} else if (hdr->flags & ISCSI_FLAG_CMD_WRITE)
+	else
 		cmd->targ_xfer_tag = 0xFFFFFFFF;
 	cmd->cmd_sn		= be32_to_cpu(hdr->cmdsn);
 	cmd->exp_stat_sn	= be32_to_cpu(hdr->exp_statsn);
author maintainer
#54 lore raw

PATCH 57/78 PCI: Dont use 64-bit bus addresses on PA-RISC

In reply to Greg Kroah-Hartman

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

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

From: Bjorn Helgaas <[email protected]>

commit 45ea2a5fed6dacb9bb0558d8b21eacc1c45d5bb4 upstream.

Meelis and Helge reported that 3a9ad0b4fdcd ("PCI: Add pci_bus_addr_t") caused HPMCs on A500 and hangs on rp5470.

PA-RISC does not set ARCH_DMA_ADDR_T_64BIT, even for 64-bit kernels, so prior to 3a9ad0b4fdcd, we always used 32-bit PCI addresses. After 3a9ad0b4fdcd, we do use 64-bit PCI addresses in 64-bit kernels, and apparently there's some PA-RISC problem related to them.

---
 drivers/pci/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/Kconfig +1 -1
@@ -2,7 +2,7 @@
 # PCI configuration
 #
 config PCI_BUS_ADDR_T_64BIT
-	def_bool y if (ARCH_DMA_ADDR_T_64BIT || 64BIT)
+	def_bool y if (ARCH_DMA_ADDR_T_64BIT || (64BIT && !PARISC))
 	depends on PCI
 
 config PCI_MSI
author maintainer
#55 lore raw

PATCH 58/78 Input: gpio_keys_polled - request GPIO pin as input.

In reply to Greg Kroah-Hartman

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

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

From: Vincent Pelletier <[email protected]>

commit 1ae5ddb6f8837558928a1a694c7b8af7f09fdd21 upstream.

GPIOF_IN flag was lost in:
Commit 633a21d80b4a("input: gpio_keys_polled: Add support for GPIO descriptors").

Without this flag, legacy code path (for non-descriptor GPIO declarations) would configure GPIO as output (0 meaning GPIOF_DIR_OUT | GPIOF_INIT_LOW).

---
 drivers/input/keyboard/gpio_keys_polled.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/keyboard/gpio_keys_polled.c +1 -1
@@ -246,7 +246,7 @@ static int gpio_keys_polled_probe(struct
 		 * convert it to descriptor.
 		 */
 		if (!button->gpiod && gpio_is_valid(button->gpio)) {
-			unsigned flags = 0;
+			unsigned flags = GPIOF_IN;
 
 			if (button->active_low)
 				flags |= GPIOF_ACTIVE_LOW;
author maintainer
#56 lore raw

PATCH 59/78 drm/atmel-hlcdc: Compile suspend/resume for PM_SLEEP only

In reply to Greg Kroah-Hartman

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

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

From: Thierry Reding <[email protected]>

commit dbb3df2d58754e4df58620e60370d166c2cb6744 upstream.

If PM is enabled but PM_SLEEP is disabled, the suspend/resume functions are still unused and produce a compiler warning.

---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +1 -1
@@ -559,7 +559,7 @@ static int atmel_hlcdc_dc_drm_remove(str
 	return 0;
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int atmel_hlcdc_dc_drm_suspend(struct device *dev)
 {
 	struct drm_device *drm_dev = dev_get_drvdata(dev);
author maintainer
#57 lore raw

PATCH 60/78 drm/i915: Flag the execlists context object as dirty after every use

In reply to Greg Kroah-Hartman

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

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

From: Chris Wilson <[email protected]>

commit 903ecd0bb970438c3a60c2c33ec9032d6443bf67 upstream.

Everytime we use the logical context with execlists it becomes dirty (as the hardware will write the new register values afterwards, as well as the GPU state that will be used). We need to then flag the context as dirty everytime since after a swap-out/swap-in cycle the dirty flag will be cleared, and a further swap-out cycle will then loose the most recent GPU state.

---
 drivers/gpu/drm/i915/intel_lrc.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/intel_lrc.c +2 -0
@@ -848,6 +848,8 @@ static int intel_lr_context_pin(struct i
 		ret = intel_pin_and_map_ringbuffer_obj(ring->dev, ringbuf);
 		if (ret)
 			goto unpin_ctx_obj;
+
+		ctx_obj->dirty = true;
 	}
 
 	return ret;
author maintainer
#58 lore raw

PATCH 63/78 9p: ensure err is initialized to 0 in p9_client_read/write

In reply to Greg Kroah-Hartman

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

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

From: Vincent Bernat <[email protected]>

commit 999b8b88c6060adf7a9b7907740ae86ace65291e upstream.

Some use of those functions were providing unitialized values to those functions. Notably, when reading 0 bytes from an empty file on a 9P filesystem, the return code of read() was not 0.

Tested with this simple program:

    #include <assert.h>
    #include <sys/types.h>
    #include <sys/stat.h>
    #include <fcntl.h>
    #include <unistd.h>

    int main(int argc, const char **argv)
    {
        assert(argc == 2);
        char buffer[256];
        int fd = open(argv[1], O_RDONLY|O_NOCTTY);
        assert(fd >= 0);
        assert(read(fd, buffer, 0) == 0);
        return 0;
    }
---
 net/9p/client.c |    2 ++
 1 file changed, 2 insertions(+)
net/9p/client.c +2 -0
@@ -1541,6 +1541,7 @@ p9_client_read(struct p9_fid *fid, u64 o
 	struct p9_client *clnt = fid->clnt;
 	struct p9_req_t *req;
 	int total = 0;
+	*err = 0;
 
 	p9_debug(P9_DEBUG_9P, ">>> TREAD fid %d offset %llu %d\n",
 		   fid->fid, (unsigned long long) offset, (int)iov_iter_count(to));
@@ -1616,6 +1617,7 @@ p9_client_write(struct p9_fid *fid, u64
 	struct p9_client *clnt = fid->clnt;
 	struct p9_req_t *req;
 	int total = 0;
+	*err = 0;
 
 	p9_debug(P9_DEBUG_9P, ">>> TWRITE fid %d offset %llu count %zd\n",
 				fid->fid, (unsigned long long) offset,
author maintainer
#59 lore raw

PATCH 64/78 irqchip/crossbar: Restore the irq_set_type() mechanism

In reply to Greg Kroah-Hartman

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

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

From: Grygorii Strashko <[email protected]>

commit e269ec42328783e51be08c191aa935dba56141fc upstream.

The conversion of the crossbar irqchip to hierarchical irq domains failed to provide a mechanism to properly set the trigger type of an interrupt.

The crossbar irq chip itself has no mechanism and therefor no irq_set_type() callback. The code before the conversion relayed the trigger configuration directly to the underlying GIC.

Restore the correct behaviour by setting the crossbar irq_set_type callback to irq_chip_set_type_parent(). This propagates the set_trigger() call to the underlying GIC irqchip.

[ tglx: Massaged changelog ]

---
 drivers/irqchip/irq-crossbar.c |    1 +
 1 file changed, 1 insertion(+)
drivers/irqchip/irq-crossbar.c +1 -0
@@ -69,6 +69,7 @@ static struct irq_chip crossbar_chip = {
 	.irq_unmask		= irq_chip_unmask_parent,
 	.irq_retrigger		= irq_chip_retrigger_hierarchy,
 	.irq_set_wake		= irq_chip_set_wake_parent,
+	.irq_set_type		= irq_chip_set_type_parent,
 #ifdef CONFIG_SMP
 	.irq_set_affinity	= irq_chip_set_affinity_parent,
 #endif
author maintainer
#60 lore raw

PATCH 65/78 irqchip/crossbar: Restore the mask on suspend behaviour

In reply to Greg Kroah-Hartman

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

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

From: Grygorii Strashko <[email protected]>

commit 4fd8f47e7e5b64a74b60f23c2e08ba8234d659d1 upstream.

The ARM GIC requires that all interrupts which are not used as a wakeup source have to be masked during suspend.

The conversion of the crossbar irqchip to hierarchical irq domains failed to mark the crossbar irqchip with the IRQCHIP_MASK_ON_SUSPEND flag and therefor broke the suspend requirement of the GIC.

Before the conversion the flags were visible because the GIC was the top level irqchip. After the conversion the crossbar irqchip is the top level irq chip whose flags are evaluated in suspend_device_irq(). As the flag is not set the masking of the non-wakeup irqs is not invoked which breaks suspend.

Add the IRQCHIP_MASK_ON_SUSPEND flag to the crossbar irqchip, so the GIC interrupts get masked properly.

[ tglx: Massaged changelog ]

---
 drivers/irqchip/irq-crossbar.c |    1 +
 1 file changed, 1 insertion(+)
drivers/irqchip/irq-crossbar.c +1 -0
@@ -70,6 +70,7 @@ static struct irq_chip crossbar_chip = {
 	.irq_retrigger		= irq_chip_retrigger_hierarchy,
 	.irq_set_wake		= irq_chip_set_wake_parent,
 	.irq_set_type		= irq_chip_set_type_parent,
+	.flags			= IRQCHIP_MASK_ON_SUSPEND,
 #ifdef CONFIG_SMP
 	.irq_set_affinity	= irq_chip_set_affinity_parent,
 #endif
author maintainer
#61 lore raw

PATCH 66/78 irqchip/crossbar: Restore set_wake functionality

In reply to Greg Kroah-Hartman

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

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

From: Grygorii Strashko <[email protected]>

commit 8200fe4347870d4ad6475048bcdf3e7c106c5268 upstream.

The TI crossbar irqchip doesn't provides any facility to configure the wakeup sources, but the conversion to hierarchical irqdomains set the irq_set_wake callback to irq_chip_set_wake_parent. The parent chip (OMAP wakeupgen) has no irq_set_wake function either so the call will fail with -ENOSYS. As a result the irq_set_wake() call in the resume path will trigger an 'Unbalanced wake disable' warning.

Before the conversion the GIC irqchip was the top level irqchip and correctly flagged with IRQCHIP_SKIP_SET_WAKE.

Restore the correct behaviour by removing the irq_set_type callback from the crossbar irqchip and set the IRQCHIP_SKIP_SET_WAKE flag which lets the irq_set_irq_wake() call from the driver succeed.

[ tglx: Massaged changelog ]

---
 drivers/irqchip/irq-crossbar.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/irqchip/irq-crossbar.c +2 -2
@@ -68,9 +68,9 @@ static struct irq_chip crossbar_chip = {
 	.irq_mask		= irq_chip_mask_parent,
 	.irq_unmask		= irq_chip_unmask_parent,
 	.irq_retrigger		= irq_chip_retrigger_hierarchy,
-	.irq_set_wake		= irq_chip_set_wake_parent,
 	.irq_set_type		= irq_chip_set_type_parent,
-	.flags			= IRQCHIP_MASK_ON_SUSPEND,
+	.flags			= IRQCHIP_MASK_ON_SUSPEND |
+				  IRQCHIP_SKIP_SET_WAKE,
 #ifdef CONFIG_SMP
 	.irq_set_affinity	= irq_chip_set_affinity_parent,
 #endif
author maintainer
#62 lore raw

PATCH 67/78 ARM: OMAP: wakeupgen: Restore the irq_set_type() mechanism

In reply to Greg Kroah-Hartman

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

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

From: Grygorii Strashko <[email protected]>

commit 63059a272398ef5dc1bd7065a036e8b6e82d1af7 upstream.

The conversion of the wakeupgen irqchip to hierarchical irq domains failed to provide a mechanism to properly set the trigger type of an interrupt.

The wakeupgen irq chip itself has no mechanism and therefor no irq_set_type() callback. The code before the conversion relayed the trigger configuration directly to the underlying GIC.

Restore the correct behaviour by setting the wakeupgen irq_set_type callback to irq_chip_set_type_parent(). This propagates the set_trigger() call to the underlying GIC irqchip.

[ tglx: Massaged changelog ]

---
 arch/arm/mach-omap2/omap-wakeupgen.c |    1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-omap2/omap-wakeupgen.c +1 -0
@@ -392,6 +392,7 @@ static struct irq_chip wakeupgen_chip =
 	.irq_mask		= wakeupgen_mask,
 	.irq_unmask		= wakeupgen_unmask,
 	.irq_retrigger		= irq_chip_retrigger_hierarchy,
+	.irq_set_type		= irq_chip_set_type_parent,
 	.flags			= IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND,
 #ifdef CONFIG_SMP
 	.irq_set_affinity	= irq_chip_set_affinity_parent,
author maintainer
#63 lore raw

PATCH 68/78 genirq: Dont return ENOSYS in irq_chip_retrigger_hierarchy

In reply to Greg Kroah-Hartman

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

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

From: Grygorii Strashko <[email protected]>

commit 6d4affea7d5aa5ca5ff4c3e5fbf3ee16801cc527 upstream.

irq_chip_retrigger_hierarchy() returns -ENOSYS if it was not able to find at least one .irq_retrigger() callback implemented in the IRQ domain hierarchy.

That's wrong, because check_irq_resend() expects a 0 return value from the callback in case that the hardware assisted resend was not possible. If the return value is non zero the core code assumes hardware resend success and the software resend is not invoked.

This results in lost interrupts on platforms where none of the parent irq chips in the hierarchy implements the retrigger callback.

This is observable on TI OMAP, where the hierarchy is:

ARM GIC <- OMAP wakeupgen <- TI Crossbar

Return 0 instead so the software resend mechanism gets invoked.

[ tglx: Massaged changelog ]

---
 kernel/irq/chip.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/irq/chip.c +1 -1
@@ -946,7 +946,7 @@ int irq_chip_retrigger_hierarchy(struct
 		if (data->chip && data->chip->irq_retrigger)
 			return data->chip->irq_retrigger(data);
 
-	return -ENOSYS;
+	return 0;
 }
 
 /**
author maintainer
#64 lore raw

PATCH 69/78 genirq: Introduce irq_chip_set_type_parent() helper

In reply to Greg Kroah-Hartman

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

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

From: Grygorii Strashko <[email protected]>

commit b7560de198222994374c1340a389f12d5efb244a upstream.

This helper is required for irq chips which do not implement a irq_set_type callback and need to call down the irq domain hierarchy for the actual trigger type change.

This helper is required to fix further wreckage caused by the conversion of TI OMAP to hierarchical irq domains and therefor tagged for stable.

[ tglx: Massaged changelog ]

---
 include/linux/irq.h |    1 +
 kernel/irq/chip.c   |   17 +++++++++++++++++
 2 files changed, 18 insertions(+)
include/linux/irq.h +1 -0
@@ -467,6 +467,7 @@ extern int irq_chip_set_affinity_parent(
 					const struct cpumask *dest,
 					bool force);
 extern int irq_chip_set_wake_parent(struct irq_data *data, unsigned int on);
+extern int irq_chip_set_type_parent(struct irq_data *data, unsigned int type);
 #endif
 
 /* Handling of unhandled and spurious interrupts: */
kernel/irq/chip.c +17 -0
@@ -934,6 +934,23 @@ int irq_chip_set_affinity_parent(struct
 }
 
 /**
+ * irq_chip_set_type_parent - Set IRQ type on the parent interrupt
+ * @data:	Pointer to interrupt specific data
+ * @type:	IRQ_TYPE_{LEVEL,EDGE}_* value - see include/linux/irq.h
+ *
+ * Conditional, as the underlying parent chip might not implement it.
+ */
+int irq_chip_set_type_parent(struct irq_data *data, unsigned int type)
+{
+	data = data->parent_data;
+
+	if (data->chip->irq_set_type)
+		return data->chip->irq_set_type(data, type);
+
+	return -ENOSYS;
+}
+
+/**
  * irq_chip_retrigger_hierarchy - Retrigger an interrupt in hardware
  * @data:	Pointer to interrupt specific data
  *
author maintainer
#65 lore raw

PATCH 71/78 can: pcan_usb: dont provide CAN FD bittimings by non-FD adapters

In reply to Greg Kroah-Hartman

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

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

From: Marc Kleine-Budde <[email protected]>

commit 06b23f7fbbf26a025fd68395c7586949db586b47 upstream.

The CAN FD data bittiming constants are provided via netlink only when there are valid CAN FD constants available in priv->data_bittiming_const.

Due to the indirection of pointer assignments in the peak_usb driver the priv->data_bittiming_const never becomes NULL - not even for non-FD adapters.

The data_bittiming_const points to zero'ed data which leads to this result when running 'ip -details link show can0':

35: can0: <NOARP,ECHO> mtu 16 qdisc noop state DOWN mode DEFAULT group default qlen 10

    link/can  promiscuity 0
    can state STOPPED restart-ms 0
	  pcan_usb: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..64 brp-inc 1
	  : dtseg1 0..0 dtseg2 0..0 dsjw 1..0 dbrp 0..0 dbrp-inc 0  <== BROKEN!
	  clock 8000000

This patch changes the struct peak_usb_adapter::bittiming_const and struct peak_usb_adapter::data_bittiming_const to pointers to fix the assignemnt problems.

---
 drivers/net/can/usb/peak_usb/pcan_usb.c      |   24 +++---
 drivers/net/can/usb/peak_usb/pcan_usb_core.c |    4 -
 drivers/net/can/usb/peak_usb/pcan_usb_core.h |    4 -
 drivers/net/can/usb/peak_usb/pcan_usb_fd.c   |   96 ++++++++++++++-------------
 drivers/net/can/usb/peak_usb/pcan_usb_pro.c  |   24 +++---
 5 files changed, 82 insertions(+), 70 deletions(-)
drivers/net/can/usb/peak_usb/pcan_usb.c +13 -11
@@ -855,6 +855,18 @@ static int pcan_usb_probe(struct usb_int
 /*
  * describe the PCAN-USB adapter
  */
+static const struct can_bittiming_const pcan_usb_const = {
+	.name = "pcan_usb",
+	.tseg1_min = 1,
+	.tseg1_max = 16,
+	.tseg2_min = 1,
+	.tseg2_max = 8,
+	.sjw_max = 4,
+	.brp_min = 1,
+	.brp_max = 64,
+	.brp_inc = 1,
+};
+
 const struct peak_usb_adapter pcan_usb = {
 	.name = "PCAN-USB",
 	.device_id = PCAN_USB_PRODUCT_ID,
@@ -863,17 +875,7 @@ const struct peak_usb_adapter pcan_usb =
 	.clock = {
 		.freq = PCAN_USB_CRYSTAL_HZ / 2 ,
 	},
-	.bittiming_const = {
-		.name = "pcan_usb",
-		.tseg1_min = 1,
-		.tseg1_max = 16,
-		.tseg2_min = 1,
-		.tseg2_max = 8,
-		.sjw_max = 4,
-		.brp_min = 1,
-		.brp_max = 64,
-		.brp_inc = 1,
-	},
+	.bittiming_const = &pcan_usb_const,
 
 	/* size of device private data */
 	.sizeof_dev_private = sizeof(struct pcan_usb),
drivers/net/can/usb/peak_usb/pcan_usb_core.c +2 -2
@@ -792,9 +792,9 @@ static int peak_usb_create_dev(const str
 	dev->ep_msg_out = peak_usb_adapter->ep_msg_out[ctrl_idx];
 
 	dev->can.clock = peak_usb_adapter->clock;
-	dev->can.bittiming_const = &peak_usb_adapter->bittiming_const;
+	dev->can.bittiming_const = peak_usb_adapter->bittiming_const;
 	dev->can.do_set_bittiming = peak_usb_set_bittiming;
-	dev->can.data_bittiming_const = &peak_usb_adapter->data_bittiming_const;
+	dev->can.data_bittiming_const = peak_usb_adapter->data_bittiming_const;
 	dev->can.do_set_data_bittiming = peak_usb_set_data_bittiming;
 	dev->can.do_set_mode = peak_usb_set_mode;
 	dev->can.do_get_berr_counter = peak_usb_adapter->do_get_berr_counter;
drivers/net/can/usb/peak_usb/pcan_usb_core.h +2 -2
@@ -48,8 +48,8 @@ struct peak_usb_adapter {
 	u32 device_id;
 	u32 ctrlmode_supported;
 	struct can_clock clock;
-	const struct can_bittiming_const bittiming_const;
-	const struct can_bittiming_const data_bittiming_const;
+	const struct can_bittiming_const * const bittiming_const;
+	const struct can_bittiming_const * const data_bittiming_const;
 	unsigned int ctrl_count;
 
 	int (*intf_probe)(struct usb_interface *intf);
drivers/net/can/usb/peak_usb/pcan_usb_fd.c +52 -44

120 lines not on this page · raw message

drivers/net/can/usb/peak_usb/pcan_usb_pro.c +13 -11
@@ -1004,6 +1004,18 @@ int pcan_usb_pro_probe(struct usb_interf
 /*
  * describe the PCAN-USB Pro adapter
  */
+static const struct can_bittiming_const pcan_usb_pro_const = {
+	.name = "pcan_usb_pro",
+	.tseg1_min = 1,
+	.tseg1_max = 16,
+	.tseg2_min = 1,
+	.tseg2_max = 8,
+	.sjw_max = 4,
+	.brp_min = 1,
+	.brp_max = 1024,
+	.brp_inc = 1,
+};
+
 const struct peak_usb_adapter pcan_usb_pro = {
 	.name = "PCAN-USB Pro",
 	.device_id = PCAN_USBPRO_PRODUCT_ID,
@@ -1012,17 +1024,7 @@ const struct peak_usb_adapter pcan_usb_p
 	.clock = {
 		.freq = PCAN_USBPRO_CRYSTAL_HZ,
 	},
-	.bittiming_const = {
-		.name = "pcan_usb_pro",
-		.tseg1_min = 1,
-		.tseg1_max = 16,
-		.tseg2_min = 1,
-		.tseg2_max = 8,
-		.sjw_max = 4,
-		.brp_min = 1,
-		.brp_max = 1024,
-		.brp_inc = 1,
-	},
+	.bittiming_const = &pcan_usb_pro_const,
 
 	/* size of device private data */
 	.sizeof_dev_private = sizeof(struct pcan_usb_pro_device),
author maintainer
#66 lore raw

PATCH 72/78 Add factory recertified Crucial M500s to blacklist

In reply to Greg Kroah-Hartman

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

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

From: "Guillermo A. Amaral" <[email protected]>

commit 7a7184b01aa9deb86df661c6f7cbcf69a95b728c upstream.

The Crucial M500 is known to have issues with queued TRIM commands, the factory recertified SSDs use a different model number naming convention which causes them to get ignored by the blacklist.

The new naming convention boils down to: s/Crucial_/FC/

---
 drivers/ata/libata-core.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/ata/libata-core.c +2 -0
@@ -4230,6 +4230,8 @@ static const struct ata_blacklist_entry
 						ATA_HORKAGE_ZERO_AFTER_TRIM, },
 	{ "Samsung SSD 8*",		NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
 						ATA_HORKAGE_ZERO_AFTER_TRIM, },
+	{ "FCCT*M500*",			NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
+						ATA_HORKAGE_ZERO_AFTER_TRIM, },
 
 	/* devices that don't properly handle TRIM commands */
 	{ "SuperSSpeed S238*",		NULL,	ATA_HORKAGE_NOTRIM, },
author maintainer
#67 lore raw

PATCH 73/78 fnic: Use the local variable instead of I/O flag to acquire io_req_lock in fnic_queuecommand() to avoid deadloack

In reply to Greg Kroah-Hartman

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

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

From: Hiral Shah <[email protected]>

commit db196935d9562abec4510f48d887bc1f1e054fcf upstream.

We added changes in fnic driver patch 1.6.0.16 to acquire io_req_lock in fnic_queuecommand() before issuing I/O so that io completion is serialized. But when releasing the lock we check for the I/O flag and this could be modified if IO abort occurs before I/O completion. In this case we wont release the lock and causes deadlock in some scenerios. Using the local variable to check the IO lock status will resolve the problem.

---
 drivers/scsi/fnic/fnic.h      |    2 +-
 drivers/scsi/fnic/fnic_scsi.c |    4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/fnic/fnic.h +1 -1
@@ -39,7 +39,7 @@
 
 #define DRV_NAME		"fnic"
 #define DRV_DESCRIPTION		"Cisco FCoE HBA Driver"
-#define DRV_VERSION		"1.6.0.17"
+#define DRV_VERSION		"1.6.0.17a"
 #define PFX			DRV_NAME ": "
 #define DFX                     DRV_NAME "%d: "
 
drivers/scsi/fnic/fnic_scsi.c +3 -1
@@ -425,6 +425,7 @@ static int fnic_queuecommand_lck(struct
 	unsigned long ptr;
 	struct fc_rport_priv *rdata;
 	spinlock_t *io_lock = NULL;
+	int io_lock_acquired = 0;
 
 	if (unlikely(fnic_chk_state_flags_locked(fnic, FNIC_FLAGS_IO_BLOCKED)))
 		return SCSI_MLQUEUE_HOST_BUSY;
@@ -518,6 +519,7 @@ static int fnic_queuecommand_lck(struct
 	spin_lock_irqsave(io_lock, flags);
 
 	/* initialize rest of io_req */
+	io_lock_acquired = 1;
 	io_req->port_id = rport->port_id;
 	io_req->start_time = jiffies;
 	CMD_STATE(sc) = FNIC_IOREQ_CMD_PENDING;
@@ -571,7 +573,7 @@ out:
 		  (((u64)CMD_FLAGS(sc) >> 32) | CMD_STATE(sc)));
 
 	/* if only we issued IO, will we have the io lock */
-	if (CMD_FLAGS(sc) & FNIC_IO_INITIALIZED)
+	if (io_lock_acquired)
 		spin_unlock_irqrestore(io_lock, flags);
 
 	atomic_dec(&fnic->in_flight);
author maintainer
#68 lore raw

PATCH 74/78 arm64: KVM: Fix host crash when injecting a fault into a 32bit guest

In reply to Greg Kroah-Hartman

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

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

From: Marc Zyngier <[email protected]>

commit 126c69a0bd0e441bf6766a5d9bf20de011be9f68 upstream.

When injecting a fault into a misbehaving 32bit guest, it seems rather idiotic to also inject a 64bit fault that is only going to corrupt the guest state. This leads to a situation where we perform an illegal exception return at EL2 causing the host to crash instead of killing the guest.

Just fix the stupid bug that has been there from day 1.

---
 arch/arm64/kvm/inject_fault.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm64/kvm/inject_fault.c +6 -6
@@ -168,8 +168,8 @@ void kvm_inject_dabt(struct kvm_vcpu *vc
 {
 	if (!(vcpu->arch.hcr_el2 & HCR_RW))
 		inject_abt32(vcpu, false, addr);
-
-	inject_abt64(vcpu, false, addr);
+	else
+		inject_abt64(vcpu, false, addr);
 }
 
 /**
@@ -184,8 +184,8 @@ void kvm_inject_pabt(struct kvm_vcpu *vc
 {
 	if (!(vcpu->arch.hcr_el2 & HCR_RW))
 		inject_abt32(vcpu, true, addr);
-
-	inject_abt64(vcpu, true, addr);
+	else
+		inject_abt64(vcpu, true, addr);
 }
 
 /**
@@ -198,6 +198,6 @@ void kvm_inject_undefined(struct kvm_vcp
 {
 	if (!(vcpu->arch.hcr_el2 & HCR_RW))
 		inject_undef32(vcpu);
-
-	inject_undef64(vcpu);
+	else
+		inject_undef64(vcpu);
 }
author maintainer
#69 lore raw

PATCH 75/78 arm64: perf: fix unassigned cpu_pmu->plat_device when probing PMU PPIs

In reply to Greg Kroah-Hartman

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

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

From: Shannon Zhao <[email protected]>

commit b265da5a45ce60bd3d7505cc0eaa6cfba50946a1 upstream.

Commit d795ef9aa831 ("arm64: perf: don't warn about missing interrupt-affinity property for PPIs") added a check for PPIs so that we avoid parsing the interrupt-affinity property for these naturally affine interrupts.

Unfortunately, this check can trigger an early (successful) return and we will not assign the value of cpu_pmu->plat_device. This patch fixes the issue.

---
 arch/arm64/kernel/perf_event.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/kernel/perf_event.c +2 -1
@@ -1318,7 +1318,7 @@ static int armpmu_device_probe(struct pl
 	/* Don't bother with PPIs; they're already affine */
 	irq = platform_get_irq(pdev, 0);
 	if (irq >= 0 && irq_is_percpu(irq))
-		return 0;
+		goto out;
 
 	irqs = kcalloc(pdev->num_resources, sizeof(*irqs), GFP_KERNEL);
 	if (!irqs)
@@ -1355,6 +1355,7 @@ static int armpmu_device_probe(struct pl
 	else
 		kfree(irqs);
 
+out:
 	cpu_pmu->plat_device = pdev;
 	return 0;
 }
author maintainer
#70 lore raw

PATCH 76/78 x86/xen: make CONFIG_XEN depend on CONFIG_X86_LOCAL_APIC

In reply to Greg Kroah-Hartman

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

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

From: David Vrabel <[email protected]>

commit 87ffd2b9bb74061c120f450e4d0f3409bb603ae0 upstream.

Since commit feb44f1f7a4ac299d1ab1c3606860e70b9b89d69 (x86/xen:
Provide a "Xen PV" APIC driver to support >255 VCPUs) Xen guests need a full APIC driver and thus should depend on X86_LOCAL_APIC.

This fixes an i386 build failure with !SMP && !CONFIG_X86_UP_APIC by disabling Xen support in this configuration.

Users needing Xen support in a non-SMP i386 kernel will need to enable CONFIG_X86_UP_APIC.

---
 arch/x86/xen/Kconfig |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/xen/Kconfig +2 -2
@@ -8,7 +8,7 @@ config XEN
 	select PARAVIRT_CLOCK
 	select XEN_HAVE_PVMMU
 	depends on X86_64 || (X86_32 && X86_PAE)
-	depends on X86_TSC
+	depends on X86_LOCAL_APIC && X86_TSC
 	help
 	  This is the Linux Xen port.  Enabling this will allow the
 	  kernel to boot in a paravirtualized environment under the
@@ -17,7 +17,7 @@ config XEN
 config XEN_DOM0
 	def_bool y
 	depends on XEN && PCI_XEN && SWIOTLB_XEN
-	depends on X86_LOCAL_APIC && X86_IO_APIC && ACPI && PCI
+	depends on X86_IO_APIC && ACPI && PCI
 
 config XEN_PVHVM
 	def_bool y
author maintainer
#71 lore raw

PATCH 77/78 x86/apic: Fix fallout from x2apic cleanup

In reply to Greg Kroah-Hartman

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

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

From: Thomas Gleixner <[email protected]>

commit a57e456a7b28431b55e407e5ab78ebd5b378d19e upstream.

In the recent x2apic cleanup I got two things really wrong:
1) The safety check in __disable_x2apic which allows the function to be called unconditionally is backwards. The check is there to prevent access to the apic MSR in case that the machine has no apic. Though right now it returns if the machine has an apic and therefor the disabling of x2apic is never invoked.

2) x2apic_disable() sets x2apic_mode to 0 after registering the local apic. That's wrong, because register_lapic_address() checks x2apic mode and therefor takes the wrong code path.

This results in boot failures on machines with x2apic preenabled by BIOS and can also lead to an fatal MSR access on machines without apic.

The solutions are simple:
1) Correct the sanity check for apic availability
2) Clear x2apic_mode _before_ calling register_lapic_address()

Fixes 659006bf3ae3 'x86/x2apic: Split enable and setup function'
Cc Laura Abbott <[email protected]>
Cc Jiang Liu <[email protected]>
Cc Joerg Roedel <[email protected]>
Cc Tony Luck <[email protected]>
Cc Borislav Petkov <[email protected]>
---
 arch/x86/kernel/apic/apic.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
arch/x86/kernel/apic/apic.c +7 -7
@@ -1424,7 +1424,7 @@ static inline void __x2apic_disable(void
 {
 	u64 msr;
 
-	if (cpu_has_apic)
+	if (!cpu_has_apic)
 		return;
 
 	rdmsrl(MSR_IA32_APICBASE, msr);
@@ -1483,10 +1483,13 @@ void x2apic_setup(void)
 
 static __init void x2apic_disable(void)
 {
-	u32 x2apic_id;
+	u32 x2apic_id, state = x2apic_state;
 
-	if (x2apic_state != X2APIC_ON)
-		goto out;
+	x2apic_mode = 0;
+	x2apic_state = X2APIC_DISABLED;
+
+	if (state != X2APIC_ON)
+		return;
 
 	x2apic_id = read_apic_id();
 	if (x2apic_id >= 255)
@@ -1494,9 +1497,6 @@ static __init void x2apic_disable(void)
 
 	__x2apic_disable();
 	register_lapic_address(mp_lapic_addr);
-out:
-	x2apic_state = X2APIC_DISABLED;
-	x2apic_mode = 0;
 }
 
 static __init void x2apic_enable(void)
author maintainer
#72 lore raw

PATCH 78/78 x86/idle: Restore trace_cpu_idle to mwait_idle() calls

In reply to Greg Kroah-Hartman

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

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

From: Jisheng Zhang <[email protected]>

commit e43d0189ac02415fe4487f79fc35e8f147e9ea0d upstream.

Commit b253149b843f ("sched/idle/x86: Restore mwait_idle() to fix boot hangs, to improve power savings and to improve performance") restores mwait_idle(), but the trace_cpu_idle related calls are missing. This causes powertop on my old desktop powered by Intel Core2 E6550 to report zero wakeups and zero events.

Add them back to restore the proper behaviour.

---
 arch/x86/kernel/process.c |    2 ++
 1 file changed, 2 insertions(+)
arch/x86/kernel/process.c +2 -0
@@ -453,6 +453,7 @@ static int prefer_mwait_c1_over_halt(con
 static void mwait_idle(void)
 {
 	if (!current_set_polling_and_test()) {
+		trace_cpu_idle_rcuidle(1, smp_processor_id());
 		if (this_cpu_has(X86_BUG_CLFLUSH_MONITOR)) {
 			smp_mb(); /* quirk */
 			clflush((void *)&current_thread_info()->flags);
@@ -464,6 +465,7 @@ static void mwait_idle(void)
 			__sti_mwait(0, 0);
 		else
 			local_irq_enable();
+		trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
 	} else {
 		local_irq_enable();
 	}
#74 lore raw
Quoted 5 lines · Holger Hoffst�tte
Quoted 1 line · Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.1.6 release.

You've been away for too long, this should be 4.1.7. ;)

Ugh, you are right, now fixed...

#76 lore raw
Quoted 5 lines · Christoph Biedl

Greg Kroah-Hartman wrote...

Quoted 1 line

This is the start of the stable review cycle for the 4.1.6 release.

Errm, we're already at 4.1.6 - so this should rather be 4.1.7-rc1?

Yes it is, thanks...

#77 lore raw
In reply to Greg Kroah-Hartman
Quoted 14 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.1.6 release. There are 78 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 Sun Sep 13 22:45:29 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.1.6-rc1.gz

and the diffstat can be found below.

thanks,

Quoted 8 lines

greg k-h

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

Greg Kroah-Hartman <[email protected]>

    Linux 4.1.6-rc1

Greg,

Release is tagged wrong? Should this be 4.17-rc1?
kernel.org shows:

commit 4ff62ca06c0c0b084f585f7a2cfcf832b21d94fc

Author: Greg Kroah-Hartman <[email protected]>
Date:   Sun Aug 16 20:52:51 2015 -0700
    Linux 4.1.6

thanks,
-- Shuah

Signature · 5 lines
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978
author maintainer
#78 lore raw
Quoted 26 lines · Shuah Khan
Quoted 14 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.1.6 release. There are 78 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 Sun Sep 13 22:45:29 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.1.6-rc1.gz

and the diffstat can be found below.

thanks,

Quoted 8 lines

greg k-h

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

Greg Kroah-Hartman <[email protected]>

    Linux 4.1.6-rc1

Greg,

Quoted 8 lines

Release is tagged wrong? Should this be 4.17-rc1?
kernel.org shows:

commit 4ff62ca06c0c0b084f585f7a2cfcf832b21d94fc

Author: Greg Kroah-Hartman <[email protected]>
Date:   Sun Aug 16 20:52:51 2015 -0700
    Linux 4.1.6

Yeah, I messed up, generated the Makefile patch wrong somehow, never done that one before...

greg "messing up in new ways every day" k-h

author maintainer
#79 lore raw

cover 4.1.7-stable review

In reply to Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.1.7 release. There are 78 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 14 00:57:37 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.1.7-rc1.gz

and the diffstat can be found below.

thanks,

greg k-h

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

Greg Kroah-Hartman <[email protected]>

    Linux 4.1.7-rc1

Jisheng Zhang <[email protected]>
x86/idle: Restore trace_cpu_idle to mwait_idle() calls

Thomas Gleixner <[email protected]>
x86/apic: Fix fallout from x2apic cleanup

David Vrabel <[email protected]>
x86/xen: make CONFIG_XEN depend on CONFIG_X86_LOCAL_APIC

Shannon Zhao <[email protected]>

    arm64: perf: fix unassigned cpu_pmu->plat_device when probing PMU PPIs

Marc Zyngier <[email protected]>
arm64: KVM: Fix host crash when injecting a fault into a 32bit guest

Hiral Shah <[email protected]>
fnic: Use the local variable instead of I/O flag to acquire io_req_lock in fnic_queuecommand() to avoid deadloack

Guillermo A. Amaral <[email protected]>
Add factory recertified Crucial M500s to blacklist

Marc Kleine-Budde <[email protected]>
can: pcan_usb: don't provide CAN FD bittimings by non-FD adapters

Alan Stern <[email protected]>
SCSI: Fix NULL pointer dereference in runtime PM

Grygorii Strashko <[email protected]>
genirq: Introduce irq_chip_set_type_parent() helper

Grygorii Strashko <[email protected]>
genirq: Don't return ENOSYS in irq_chip_retrigger_hierarchy

Grygorii Strashko <[email protected]>
ARM: OMAP: wakeupgen: Restore the irq_set_type() mechanism

Grygorii Strashko <[email protected]>
irqchip/crossbar: Restore set_wake functionality

Grygorii Strashko <[email protected]>
irqchip/crossbar: Restore the mask on suspend behaviour

Grygorii Strashko <[email protected]>
irqchip/crossbar: Restore the irq_set_type() mechanism

Vincent Bernat <[email protected]>
9p: ensure err is initialized to 0 in p9_client_read/write

Thulasimani,Sivakumar <[email protected]>
drm/i915: Avoid TP3 on CHV

Thulasimani,Sivakumar <[email protected]>
drm/i915: remove HBR2 from chv supported list

Chris Wilson <[email protected]>
drm/i915: Flag the execlists context object as dirty after every use

Thierry Reding <[email protected]>
drm/atmel-hlcdc: Compile suspend/resume for PM_SLEEP only

Vincent Pelletier <[email protected]>
Input: gpio_keys_polled - request GPIO pin as input.

Bjorn Helgaas <[email protected]>
PCI: Don't use 64-bit bus addresses on PA-RISC

Alexei Potashnik <[email protected]>
target/iscsi: Fix double free of a TUR followed by a solicited NOPOUT

Adrien Schildknecht <[email protected]>
mac80211: fix invalid read in minstrel_sort_best_tp_rates()

Markus Osterhoff <[email protected]>
ALSA: hda: fix possible NULL dereference

Takashi Iwai <[email protected]>
ALSA: hda - Fix path power activation

Takashi Iwai <[email protected]>
ALSA: hda - Check all inputs for is_active_nid_for_any()

David Henningsson <[email protected]>
ALSA: hda - Shutdown CX20722 on reboot/free to avoid spurious noises

Jurgen Kramer <[email protected]>
ALSA: usb: Add native DSD support for Gustard DAC-X20U

Woodrow Shen <[email protected]>
ALSA: hda - Fix the white noise on Dell laptop

Takashi Iwai <[email protected]>
ALSA: usb-audio: Fix runtime PM unbalance

Alban Crequy <[email protected]>

    cpuset: use trialcs->mems_allowed as a temp variable

Tejun Heo <[email protected]>
Revert "libata: Implement NCQ autosense"

Tejun Heo <[email protected]>
Revert "libata: Implement support for sense data reporting"

Tejun Heo <[email protected]>
Revert "libata-eh: Set 'information' field for autosense"

Horia Geant? <[email protected]>
crypto: caam - fix memory corruption in ahash_final_ctx

Jan Stancek <[email protected]>
crypto: nx - respect sg limit bounds when building sg lists for SHA

Martin K. Petersen <[email protected]>
sd: Fix maximum I/O size for BLOCK_PC requests

John Soni Jose <[email protected]>
libiscsi: Fix host busy blocking during connection teardown

Markos Chandras <[email protected]>
MIPS: Fix seccomp syscall argument for MIPS64

Guenter Roeck <[email protected]>
regmap: regcache-rbtree: Clean new present bits on present bitmap resize

Linus Torvalds <[email protected]>
Revert x86 sigcontext cleanups

Charles Keepax <[email protected]>
mfd: arizona: Fix initialisation of the PM runtime

Russell King <[email protected]>
ARM: invalidate L1 before enabling coherency

Russell King <[email protected]>
ARM: v7 setup function should invalidate L1 cache

Nathan Lynch <[email protected]>
ARM: 8384/1: VDSO: force use of BFD linker

Nathan Lynch <[email protected]>
ARM: 8385/1: VDSO: group link options

Kishon Vijay Abraham I <[email protected]>
ARM: dts: OMAP5: Fix broken pbias device creation

Kishon Vijay Abraham I <[email protected]>
ARM: dts: OMAP4: Fix broken pbias device creation

Kishon Vijay Abraham I <[email protected]>
ARM: dts: dra7: Fix broken pbias device creation

Kishon Vijay Abraham I <[email protected]>
ARM: dts: omap243x: Fix broken pbias device creation

Lucas Stach <[email protected]>
ARM: imx6: correct i.MX6 PCIe interrupt routing

Bart Van Assche <[email protected]>
libfc: Fix fc_fcp_cleanup_each_cmd()

Bart Van Assche <[email protected]>
libfc: Fix fc_exch_recv_req() error path

Thomas Hellstrom <[email protected]>
drm/vmwgfx: Fix execbuf locking issues

Alex Deucher <[email protected]>
drm/radeon: add new OLAND pci id

Dan Carpenter <[email protected]>
HID: uclogic: fix limit in uclogic_tablet_enable()

Krzysztof Kozlowski <[email protected]>
HID: hid-input: Fix accessing freed memory during device disconnect

Michael Walle <[email protected]>

    EDAC, ppc4xx: Access mci->csrows array elements properly

Richard Weinberger <[email protected]>
localmodconfig: Use Kbuild files too

Joe Thornber <[email protected]>
dm thin metadata: delete btrees when releasing metadata snapshot

Julien Grall <[email protected]>
xen/xenbus: Don't leak memory when unmapping the ring on HVM backend

Jason A. Donenfeld <[email protected]>
x86/xen: build "Xen PV" APIC driver for domU as well

Luis Felipe Dominguez Vega <[email protected]>
rtlwifi: Fix NULL dereference when PCI driver used as an AP

Larry Finger <[email protected]>
rtlwifi: rtl8723be: Add module parameter for MSI interrupts

Emmanuel Grumbach <[email protected]>
iwlwifi: pcie: fix prepare card flow

Peter Zijlstra <[email protected]>
perf: Fix PERF_EVENT_IOC_PERIOD migration race

Ben Hutchings <[email protected]>
perf: Fix double-free of the AUX buffer

Peter Zijlstra <[email protected]>
perf: Fix running time accounting

Peter Zijlstra <[email protected]>
perf: Fix fasync handling on inherited events

Mike Looijmans <[email protected]>
rsi: Fix failure to load firmware after memory leak fix and fix the leak

Bob Liu <[email protected]>
xen-blkback: replace work_pending with work_busy in purge_persistent_gnt()

Bob Liu <[email protected]>
xen-blkfront: don't add indirect pages to list when !feature_persistent

Robert Jarzmik <[email protected]>
clk: pxa: pxa3xx: fix CKEN register access

Wanpeng Li <[email protected]>
mm/hwpoison: fix fail isolate hugetlbfs page w/ refcount held

Wanpeng Li <[email protected]>
mm/hwpoison: fix page refcount of unknown non LRU page

Manfred Spraul <[email protected]>
ipc/sem.c: update/correct memory barriers

Herton R. Krzesinski <[email protected]>
ipc,sem: fix use after free on IPC_RMID after a task using same semaphore set exits

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

Diffstat:

 Makefile                                     |   4 +-
 arch/arm/boot/dts/dra7.dtsi                  |   2 +-
 arch/arm/boot/dts/imx6qdl.dtsi               |   8 +-
 arch/arm/boot/dts/omap2430.dtsi              |   3 +-
 arch/arm/boot/dts/omap4.dtsi                 |   3 +-
 arch/arm/boot/dts/omap5.dtsi                 |   3 +-
 arch/arm/mach-bcm/Makefile                   |   2 +-
 arch/arm/mach-bcm/brcmstb.h                  |  19 -----
 arch/arm/mach-bcm/headsmp-brcmstb.S          |  33 ---------
 arch/arm/mach-bcm/platsmp-brcmstb.c          |   4 +-
 arch/arm/mach-berlin/headsmp.S               |   6 --
 arch/arm/mach-berlin/platsmp.c               |   3 +-
 arch/arm/mach-hisi/Makefile                  |   2 +-
 arch/arm/mach-hisi/core.h                    |   1 -
 arch/arm/mach-hisi/headsmp.S                 |  16 ----
 arch/arm/mach-hisi/platsmp.c                 |   4 +-
 arch/arm/mach-imx/headsmp.S                  |   1 -
 arch/arm/mach-mvebu/headsmp-a9.S             |   1 -
 arch/arm/mach-omap2/omap-wakeupgen.c         |   1 +
 arch/arm/mach-prima2/headsmp.S               |   1 -
 arch/arm/mach-rockchip/core.h                |   1 -
 arch/arm/mach-rockchip/headsmp.S             |   8 --
 arch/arm/mach-rockchip/platsmp.c             |   5 +-
 arch/arm/mach-shmobile/common.h              |   1 -
 arch/arm/mach-shmobile/headsmp-scu.S         |   4 +-
 arch/arm/mach-shmobile/headsmp.S             |   7 --
 arch/arm/mach-shmobile/platsmp-apmu.c        |   2 +-
 arch/arm/mach-socfpga/core.h                 |   1 -
 arch/arm/mach-socfpga/headsmp.S              |   5 --
 arch/arm/mach-socfpga/platsmp.c              |   2 +-
 arch/arm/mach-tegra/Makefile                 |   2 +-
 arch/arm/mach-tegra/headsmp.S                |  12 ---
 arch/arm/mach-tegra/reset.c                  |   2 +-
 arch/arm/mach-tegra/reset.h                  |   1 -
 arch/arm/mach-zynq/common.h                  |   2 -
 arch/arm/mach-zynq/headsmp.S                 |   5 --
 arch/arm/mach-zynq/platsmp.c                 |   5 +-
 arch/arm/mm/proc-v7.S                        |  16 ++--
 arch/arm/vdso/Makefile                       |  18 +++--
 arch/arm64/kernel/perf_event.c               |   3 +-
 arch/arm64/kvm/inject_fault.c                |  12 +--
 arch/mips/kernel/scall64-64.S                |   2 +-
 arch/mips/kernel/scall64-n32.S               |   2 +-
 arch/x86/include/asm/sigcontext.h            |   6 +-
 arch/x86/include/uapi/asm/sigcontext.h       |  21 +-----
 arch/x86/kernel/apic/apic.c                  |  14 ++--
 arch/x86/kernel/process.c                    |   2 +
 arch/x86/kernel/signal.c                     |  26 +++----
 arch/x86/xen/Kconfig                         |   4 +-
 arch/x86/xen/Makefile                        |   4 +-
 arch/x86/xen/xen-ops.h                       |   6 +-
 block/blk-settings.c                         |   4 +-
 drivers/ata/libata-core.c                    |  26 ++-----
 drivers/ata/libata-eh.c                      | 105 +--------------------------
 drivers/ata/libata-scsi.c                    |  21 +-----
 drivers/ata/libata.h                         |   6 +-
 drivers/base/regmap/regcache-rbtree.c        |  19 +++--
 drivers/block/xen-blkback/blkback.c          |   4 +-
 drivers/block/xen-blkfront.c                 |   6 +-
 drivers/clk/pxa/clk-pxa3xx.c                 |   2 +-
 drivers/crypto/caam/caamhash.c               |   7 +-
 drivers/crypto/nx/nx-sha256.c                |  27 ++++---
 drivers/crypto/nx/nx-sha512.c                |  28 ++++---
 drivers/edac/ppc4xx_edac.c                   |   2 +-
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c |   2 +-
 drivers/gpu/drm/i915/intel_dp.c              |  29 ++++++--
 drivers/gpu/drm/i915/intel_lrc.c             |   2 +
 drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c      |   4 +-
 drivers/hid/hid-input.c                      |   7 +-
 drivers/hid/hid-uclogic.c                    |   2 +-
 drivers/input/keyboard/gpio_keys_polled.c    |   2 +-
 drivers/irqchip/irq-crossbar.c               |   4 +-
 drivers/md/dm-thin-metadata.c                |   4 +-
 drivers/mfd/arizona-core.c                   |  14 ++--
 drivers/net/can/usb/peak_usb/pcan_usb.c      |  24 +++---
 drivers/net/can/usb/peak_usb/pcan_usb_core.c |   4 +-
 drivers/net/can/usb/peak_usb/pcan_usb_core.h |   4 +-
 drivers/net/can/usb/peak_usb/pcan_usb_fd.c   |  96 +++++++++++++-----------
 drivers/net/can/usb/peak_usb/pcan_usb_pro.c  |  24 +++---
 drivers/net/wireless/iwlwifi/pcie/trans.c    |  22 +++++-
 drivers/net/wireless/rsi/rsi_91x_sdio_ops.c  |   8 +-
 drivers/net/wireless/rsi/rsi_91x_usb_ops.c   |   4 +
 drivers/net/wireless/rtlwifi/core.c          |   7 +-
 drivers/net/wireless/rtlwifi/rtl8723be/sw.c  |   1 +
 drivers/pci/Kconfig                          |   2 +-
 drivers/scsi/fnic/fnic.h                     |   2 +-
 drivers/scsi/fnic/fnic_scsi.c                |   4 +-
 drivers/scsi/libfc/fc_exch.c                 |   8 +-
 drivers/scsi/libfc/fc_fcp.c                  |  19 ++++-
 drivers/scsi/libiscsi.c                      |  25 +------
 drivers/scsi/scsi_error.c                    |  31 --------
 drivers/scsi/scsi_pm.c                       |  22 +++---
 drivers/scsi/sd.c                            |   6 +-
 drivers/target/iscsi/iscsi_target.c          |   4 +-
 drivers/xen/xenbus/xenbus_client.c           |   4 +-
 include/drm/drm_pciids.h                     |   1 +
 include/linux/ata.h                          |  18 -----
 include/linux/irq.h                          |   1 +
 include/scsi/scsi_eh.h                       |   1 -
 ipc/sem.c                                    |  41 ++++++++---
 kernel/cpuset.c                              |   2 +-
 kernel/events/core.c                         |  91 +++++++++++++++++------
 kernel/events/ring_buffer.c                  |  10 ++-
 kernel/irq/chip.c                            |  19 ++++-
 mm/memory-failure.c                          |  15 ++--
 net/9p/client.c                              |   2 +
 net/mac80211/rc80211_minstrel.c              |  11 +--
 scripts/kconfig/streamline_config.pl         |   2 +-
 sound/pci/hda/hda_codec.c                    |   2 +-
 sound/pci/hda/hda_generic.c                  |  11 +--
 sound/pci/hda/patch_conexant.c               |  23 +++++-
 sound/pci/hda/patch_realtek.c                |   1 +
 sound/usb/card.c                             |   2 +-
 sound/usb/quirks.c                           |   1 +
 114 files changed, 545 insertions(+), 675 deletions(-)
#80 lore raw

Re: [PATCH 4.1 00/78] 4.1.7-stable review

Quoted 5 lines · Greg Kroah-Hartman

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

Quoted 7 lines

Responses should be made by Mon Sep 14 00:57:37 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.1.7-rc1.gz

and the diffstat can be found below.

Compiled and booted on my test system. No dmesg regressions.

thanks,
-- Shuah

Signature · 5 lines
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978
author maintainer
#81 lore raw

Re: [PATCH 4.1 00/78] 4.1.7-stable review

Quoted 9 lines · Shuah Khan
Quoted 8 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.1.7 release. There are 78 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 14 00:57:37 UTC 2015. Anything received after that time might be too late.

Quoted 6 lines
Quoted 4 lines

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

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

and the diffstat can be found below.

Compiled and booted on my test system. No dmesg regressions.

Thanks for testing all of these and letting me know.

greg k-h

#82 lore raw

Re: [PATCH 4.1 00/78] 4.1.7-stable review

In reply to Greg Kroah-Hartman
Quoted 8 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.1.7 release. There are 78 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 14 00:57:37 UTC 2015. Anything received after that time might be too late.

Build results:

	total: 138 pass: 138 fail: 0
Qemu test results:
	total: 93 pass: 92 fail: 1

Failed tests:
mips:fuloong2e_defconfig

Results are as expected; the failing qemu test is still waiting for the fix in the upstream kernel.

Details are available at http://server.roeck-us.net:8010/builders.

Guenter

author maintainer
#83 lore raw

Re: [PATCH 4.1 00/78] 4.1.7-stable review

Quoted 14 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.1.7 release. There are 78 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 14 00:57:37 UTC 2015. Anything received after that time might be too late.

Build results:

	total: 138 pass: 138 fail: 0
Qemu test results:
	total: 93 pass: 92 fail: 1
Quoted 8 lines

Failed tests:
mips:fuloong2e_defconfig

Results are as expected; the failing qemu test is still waiting for the fix in the upstream kernel.

Details are available at http://server.roeck-us.net:8010/builders.

Great, thanks for testing all of these,

greg k-h

#84 lore raw

Re: [PATCH 4.1 00/78] 4.1.7-stable review

In reply to Greg Kroah-Hartman
Quoted 7 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.1.7 release. There are 78 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 14 00:57:37 UTC 2015. Anything received after that time might be too late.

Compiled and booted on x86_32. No errors in dmesg.

cross_compiled with allmodconfig:

i386 - pass
x86_64 - pass
alphacheck - pass
arm - pass
cris - pass
m68k - pass
mips - pass
powerpc - pass
s390 - pass
sparc - pass
sparc64 - pass
tile - pass
tilegx - pass
xtensa - pass

build report at:
https://travis-ci.org/sudipm-mukherjee/parport/builds/79960188

regards
sudip

author maintainer
#85 lore raw

Re: [PATCH 4.1 00/78] 4.1.7-stable review

Quoted 28 lines · Sudip Mukherjee
Quoted 7 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.1.7 release. There are 78 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 14 00:57:37 UTC 2015. Anything received after that time might be too late.

Compiled and booted on x86_32. No errors in dmesg.

cross_compiled with allmodconfig:

i386 - pass
x86_64 - pass
alphacheck - pass
arm - pass
cris - pass
m68k - pass
mips - pass
powerpc - pass
s390 - pass
sparc - pass
sparc64 - pass
tile - pass
tilegx - pass
xtensa - pass

Quoted 2 lines

build report at:
https://travis-ci.org/sudipm-mukherjee/parport/builds/79960188

Thanks for testing and letting me know.

greg k-h