3.18.3-stable review
Greg Kroah-Hartman
maintainercover 3.18.3-stable review
This is the start of the stable review cycle for the 3.18.3 release. There are 150 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 Fri Jan 16 07:20:24 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/v3.0/stable-review/patch-3.18.3-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.18.3-rc1
Linus Torvalds <[email protected]>
mm: Don't count the stack guard page towards RLIMIT_STACK
Linus Torvalds <[email protected]>
mm: propagate error from stack expansion even for guard page
Vlastimil Babka <[email protected]>
mm, vmscan: prevent kswapd livelock due to pfmemalloc-throttled process being killed
Johannes Weiner <[email protected]>
mm: protect set_page_dirty() from ongoing truncation
Oleg Nesterov <[email protected]>
exit: fix race between wait_consider_task() and wait_task_zombie()
Krzysztof Kozlowski <[email protected]>
mmc: sdhci: Fix sleep in atomic after inserting SD card
Krzysztof Kozlowski <[email protected]>
regulator: s2mps11: Fix dw_mmc failure on Gear 2
Dave Airlie <[email protected]>
nouveau: bring back legacy mmap handler
Bruno Prémont <[email protected]>
drm/nouveau/nouveau: Do not BUG_ON(!spin_is_locked()) on UP
Hisashi Nakamura <[email protected]>
spi: sh-msiof: Add runtime PM lock in initializing
Jiri Olsa <[email protected]>
perf session: Do not fail on processing out of order event
Andi Kleen <[email protected]>
perf/x86/uncore/hsw-ep: Handle systems with only two SBOXes
Jiri Olsa <[email protected]>
perf: Fix events installation during moving group
Jiri Olsa <[email protected]>
perf/x86/intel/uncore: Make sure only uncore events are collected
Johannes Berg <[email protected]>
Revert "mac80211: Fix accounting of the tailroom-needed counter"
Chris Mason <[email protected]>
Btrfs: don't delay inode ref updates during log replay
Mathias Krause <[email protected]>
crypto: aesni - fix "by8" variant for 128 bit keys
Vinson Lee <[email protected]>
crypto: sha-mb - Add avx2_supported check.
Ard Biesheuvel <[email protected]>
arm64/efi: add missing call to early_ioremap_reset()
Lorenzo Pieralisi <[email protected]>
arm64: kernel: fix __cpu_suspend mm switch on warm-boot
Laura Abbott <[email protected]>
arm64: Move cpu_resume into the text section
Hans de Goede <[email protected]>
Input: alps - v7: fix finger counting for > 2 fingers on clickpads
Hans de Goede <[email protected]>
Input: alps - v7: sometimes a single touch is reported in mt[1]
Hans de Goede <[email protected]>
Input: alps - v7: ignore new packets
Linus Torvalds <[email protected]>
Revert "Input: atmel_mxt_ts - use deep sleep mode when stopped"
Rafael J. Wysocki <[email protected]>
ACPI / PM: Fix PM initialization for devices that are not present
Aaron Lu <[email protected]>
ACPI / video: Add some Samsung models to disable_native_backlight list
J. Bruce Fields <[email protected]>
rpc: fix xdr_truncate_encode to handle buffer ending on page boundary
Pavel Machek <[email protected]>
Revert "ARM: 7830/1: delay: don't bother reporting bogomips in /proc/cpuinfo"
Nishanth Menon <[email protected]>
ARM: OMAP4: PM: Only do static dependency configuration in omap4_init_static_deps
Tomasz Figa <[email protected]>
ARM: dts: Enable PWM node by default for s3c64xx
Lokesh Vutla <[email protected]>
ARM: dts: DRA7: wdt: Fix compatible property for watchdog node
Viresh Kumar <[email protected]>
ARM: defconfigs: use CONFIG_CPUFREQ_DT
Tomi Valkeinen <[email protected]>
ARM: dts: am437x-sk-evm.dts: fix LCD timings
Felipe Balbi <[email protected]>
ARM: dts: am437x-sk: fix lcd enable pin mux data
Andy Lutomirski <[email protected]>
sched: Add missing rcu protection to wake_up_all_idle_cpus
Luca Abeni <[email protected]>
sched/deadline: Avoid double-accounting in case of missed deadlines
Luca Abeni <[email protected]>
sched/deadline: Fix migration of SCHED_DEADLINE tasks
Johannes Berg <[email protected]>
scripts/kernel-doc: don't eat struct members with __aligned
Ryusuke Konishi <[email protected]>
nilfs2: fix the nilfs_iget() vs. nilfs_new_inode() races
Roger Quadros <[email protected]>
mtd: nand: omap: Fix NAND enumeration on 3430 LDP
Alison Chaiken <[email protected]>
MTD: m25p80: fix inconsistency in m25p_ids compared to spi_nor_ids
Brian Norris <[email protected]>
mtd: tests: abort torturetest on erase errors
Dan Carpenter <[email protected]>
ceph: do_sync is never initialized
Aaron Lu <[email protected]>
ACPI / video: update the skip case for acpi_video_device_in_dod()
Jeff Layton <[email protected]>
nfsd: fix fi_delegees leak when fi_had_conflict returns true
Benjamin Coddington <[email protected]>
nfsd4: fix xdr4 count of server in fs_location4
Benjamin Coddington <[email protected]>
nfsd4: fix xdr4 inclusion of escaped char
Rasmus Villemoes <[email protected]>
fs: nfsd: Fix signedness bug in compare_blob
Vitaly Kuznetsov <[email protected]>
Drivers: hv: util: make struct hv_do_fcopy match Hyper-V host messages
Vitaly Kuznetsov <[email protected]>
Drivers: hv: vmbus: Fix a race condition when unregistering a device
Christian Riesch <[email protected]>
n_tty: Fix read_buf race condition, increment read_head after pushing data
Jiri Slaby <[email protected]>
reiserfs: destroy allocated commit workqueue
Max Filippov <[email protected]>
xtensa: fix kmap_prot definition
Robert Baldyga <[email protected]>
serial: samsung: wait for transfer completion before clock disable
Axel Lin <[email protected]>
tty: serial: men_z135_uart: Add terminating entry for men_z135_ids
Steven Rostedt (Red Hat) <[email protected]>
tracing/sched: Check preempt_count() for current when reading task->state
Tejun Heo <[email protected]>
writeback: fix a subtle race condition in I_DIRTY clearing
Philipp Reisner <[email protected]>
drbd: Fix state change in case of connection timeout
Lars Ellenberg <[email protected]>
drbd: merge_bvec_fn: properly remap bvm->bi_bdev
Oliver Neukum <[email protected]>
cdc-acm: memory leak in error case
Jens Axboe <[email protected]>
genhd: check for int overflow in disk_expand_part_tbl()
Steev Klimaszewski <[email protected]>
Add USB_EHCI_EXYNOS to multi_v7_defconfig
Martin Hauke <[email protected]>
USB: qcserial: Add support for HP lt4112 LTE/HSPA+ Gobi 4G Modem
Ronald Wahl <[email protected]>
usb: gadget: at91_udc: move prepare clk into process context
Kazuya Mizuguchi <[email protected]>
usb: renesas_usbhs: gadget: fix NULL pointer dereference in ep_disable()
Greg Kroah-Hartman <[email protected]>
USB: cdc-acm: check for valid interfaces
NeilBrown <[email protected]>
md/raid5: fetch_block must fetch all the blocks handle_stripe_dirtying wants.
Aaron Plattner <[email protected]>
ALSA: hda - Add new GPU codec ID 0x10de0072 to snd-hda
Takashi Iwai <[email protected]>
ALSA: hda - Fix wrong gpio_dir & gpio_mask hint setups for IDT/STAC codecs
Daniel Mack <[email protected]>
ALSA: snd-usb-caiaq: fix stream count check
Takashi Sakamoto <[email protected]>
ALSA: fireworks: fix an endianness bug for transaction length
Dan Carpenter <[email protected]>
ALSA: hda - using uninitialized data
Kailang Yang <[email protected]>
ALSA: hda/realtek - Add new Dell desktop for ALC3234 headset mode
Kailang Yang <[email protected]>
ALSA: hda/realtek - New codec support for ALC256
Kailang Yang <[email protected]>
ALSA: hda/realtek - New codec support for ALC298
Jiri Jaburek <[email protected]>
ALSA: usb-audio: extend KEF X300A FU 10 tweak to Arcam rPAC
Doug Anderson <[email protected]>
i2c: designware: Fix falling time bindings doc
Pali Rohár <[email protected]>
i8k: Add support for Dell Latitude E6440
Ian Abbott <[email protected]>
misc: genwqe: check for error from get_user_pages_fast()
Alex Williamson <[email protected]>
driver core: Fix unbalanced device reference in drivers_probe
Andy Lutomirski <[email protected]>
x86, vdso: Use asm volatile in __getcpu
Andy Lutomirski <[email protected]>
x86_64, vdso: Fix the vdso address randomization algorithm
Paolo Bonzini <[email protected]>
kvm: x86: drop severity of "generation wraparound" message
Christian Borntraeger <[email protected]>
KVM: s390: Fix ipte locking
Christian Borntraeger <[email protected]>
KVM: s390: flush CPU on load control
Thomas Huth <[email protected]>
KVM: s390: Fix size of monitor-class number field
Paolo Bonzini <[email protected]>
kvm: x86: mask out XSAVES
Nadav Amit <[email protected]>
KVM: x86: em_ret_far overrides cpl
Paolo Bonzini <[email protected]>
KVM: x86: support XSAVES usage in the host
Paolo Bonzini <[email protected]>
x86: export get_xsave_addr
Giedrius Statkevičius <[email protected]>
HID: Add a new id 0x501a for Genius MousePen i608X
Karl Relton <[email protected]>
HID: add battery quirk for USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO keyboard
Mika Westerberg <[email protected]>
HID: i2c-hid: Do not free buffers in i2c_hid_stop()
Dan Carpenter <[email protected]>
HID: roccat: potential out of bounds in pyra_sysfs_write_settings()
Gwendal Grignou <[email protected]>
HID: i2c-hid: prevent buffer overflow in early IRQ
Jean-Baptiste Maneyrol <[email protected]>
HID: i2c-hid: fix race condition reading reports
Benjamin Tissoires <[email protected]>
HID: wacom: fix freeze on open when autosuspend is on
Benjamin Tissoires <[email protected]>
HID: wacom: re-add accidentally dropped Lenovo PID
Oliver Neukum <[email protected]>
HID: yet another buggy ELAN touchscreen
Takashi Iwai <[email protected]>
blk-mq: Fix uninitialized kobject at CPU hotplugging
Bart Van Assche <[email protected]>
blk-mq: Fix a race between bt_clear_tag() and bt_get()
Bart Van Assche <[email protected]>
blk-mq: Avoid that __bt_get_word() wraps multiple times
Bart Van Assche <[email protected]>
blk-mq: Fix a use-after-free
Jens Axboe <[email protected]>
blk-mq: use 'nr_cpu_ids' as highest CPU ID count for hwq <-> cpu map
Joerg Roedel <[email protected]>
iommu/vt-d: Fix dmar_domain leak in iommu_attach_device
Jiang Liu <[email protected]>
iommu/vt-d: Fix an off-by-one bug in __domain_mapping()
Richard Weinberger <[email protected]>
UBI: Fix double free after do_sync_erase()
Richard Weinberger <[email protected]>
UBI: Fix invalid vfree()
Tony Lindgren <[email protected]>
pstore-ram: Allow optional mapping with pgprot_noncached
Rob Herring <[email protected]>
pstore-ram: Fix hangs by using write-combine mappings
Hante Meuleman <[email protected]>
brcmfmac: Fix ifidx for rx data by msgbuf.
Myron Stowe <[email protected]>
PCI: Restore detection of read-only BARs
Johan Hedberg <[email protected]>
Bluetooth: Fix accepting connections when not using mgmt
Marcel Holtmann <[email protected]>
Bluetooth: Fix controller configuration with HCI_QUIRK_INVALID_BDADDR
Marcel Holtmann <[email protected]>
Bluetooth: Clear LE white list when resetting controller
Johan Hedberg <[email protected]>
Bluetooth: Fix check for direct advertising
Johan Hedberg <[email protected]>
Bluetooth: Fix LE connection timeout deadlock
Alexander Aring <[email protected]>
Bluetooth: 6lowpan: fix skb_unshare behaviour
Dmitry Tunin <[email protected]>
Bluetooth: ath3k: Add support of MCI 13d3:3408 bt device
Richard Guy Briggs <[email protected]>
powerpc: add little endian flag to syscall_get_arch()
[email protected] <[email protected]>
powerpc/perf/hv-24x7: Use per-cpu page buffer
Paul Mackerras <[email protected]>
powerpc/powernv: Switch off MMU before entering nap/sleep/rvwinkle mode
Mahesh Salgaonkar <[email protected]>
powerpc/book3s: Fix partial invalidation of TLBs in MCE code.
Anton Blanchard <[email protected]>
powerpc: Fix bad NULL pointer check in udbg_uart_getc_poll()
Steven Rostedt (Red Hat) <[email protected]>
ktest: Fix make_min_config to handle new assign_configs call
Andrew Jackson <[email protected]>
ASoC: dwc: Ensure FIFOs are flushed to prevent channel swap
Peter Rosin <[email protected]>
ASoC: pcm512x: Trigger auto-increment of register addresses on i2c
Jyri Sarha <[email protected]>
ASoC: tlv320aic31xx: Fix off by one error in the loop stucture.
Jarkko Nikula <[email protected]>
ASoC: max98090: Fix ill-defined sidetone route
Lars-Peter Clausen <[email protected]>
ASoC: sigmadsp: Refuse to load firmware files with a non-supported version
Takashi Iwai <[email protected]>
ASoC: eukrea-tlv320: Fix of_node_put() call with uninitialized object
Felix Fietkau <[email protected]>
ath5k: fix hardware queue index assignment
Emmanuel Grumbach <[email protected]>
iwlwifi: add new device IDs for 3165
Emmanuel Grumbach <[email protected]>
iwlwifi: mvm: update values for Smart Fifo
Emmanuel Grumbach <[email protected]>
iwlwifi: dvm: fix flush support for old firmware
Stefano Stabellini <[email protected]>
swiotlb-xen: pass dev_addr to swiotlb_tbl_unmap_single
Stefano Stabellini <[email protected]>
swiotlb-xen: call xen_dma_sync_single_for_device when appropriate
Stefano Stabellini <[email protected]>
swiotlb-xen: remove BUG_ON in xen_bus_to_phys
Stefano Stabellini <[email protected]>
swiotlb-xen: pass dev_addr to xen_dma_unmap_page and xen_dma_sync_single_for_cpu
Stephane Grosjean <[email protected]>
can: peak_usb: fix memset() usage
Stephane Grosjean <[email protected]>
can: peak_usb: fix cleanup sequence order in case of error during init
Felix Fietkau <[email protected]>
ath9k: fix BE/BK queue order
Felix Fietkau <[email protected]>
ath9k_hw: fix hardware queue allocation
Xue jiufei <[email protected]>
ocfs2: fix the wrong directory passed to ocfs2_lookup_ino_from_name() when link file
Junxiao Bi <[email protected]>
ocfs2: fix journal commit deadlock
Arnaud Ebalard <[email protected]>
drivers/rtc/rtc-isl12057.c: fix masking of register values
Johan Hovold <[email protected]>
rtc: omap: fix missing wakealarm attribute
Johan Hovold <[email protected]>
rtc: omap: fix clock-source configuration
Guo Zeng <[email protected]>
drivers/rtc/rtc-sirfsoc.c: move hardware initilization earlier in probe
-------------
Diffstat:
.../devicetree/bindings/i2c/i2c-designware.txt | 4 +- Documentation/ramoops.txt | 13 ++- Makefile | 4 +- arch/arm/boot/dts/am437x-sk-evm.dts | 15 ++-- arch/arm/boot/dts/dra7.dtsi | 2 +- arch/arm/boot/dts/s3c6410-mini6410.dts | 4 - arch/arm/boot/dts/s3c64xx.dtsi | 1 - arch/arm/configs/multi_v7_defconfig | 3 +- arch/arm/configs/shmobile_defconfig | 2 +- arch/arm/kernel/setup.c | 9 ++ arch/arm/kernel/smp.c | 13 ++- arch/arm/mach-omap2/pm44xx.c | 29 ++----- arch/arm64/kernel/efi.c | 2 +- arch/arm64/kernel/setup.c | 1 + arch/arm64/kernel/sleep.S | 36 ++------ arch/arm64/kernel/suspend.c | 18 +++- arch/powerpc/include/asm/reg.h | 2 + arch/powerpc/include/asm/syscall.h | 6 +- arch/powerpc/kernel/idle_power7.S | 18 +++- arch/powerpc/kernel/mce_power.c | 4 +- arch/powerpc/kernel/udbg_16550.c | 6 +- arch/powerpc/perf/hv-24x7.c | 21 ++--- arch/s390/kvm/gaccess.c | 20 +++-- arch/s390/kvm/interrupt.c | 2 +- arch/s390/kvm/priv.c | 4 +- arch/x86/crypto/Makefile | 2 +- arch/x86/crypto/aes_ctrby8_avx-x86_64.S | 46 +++++++--- arch/x86/include/asm/vsyscall.h | 2 +- arch/x86/kernel/cpu/perf_event_intel_uncore.c | 22 ++++- arch/x86/kernel/cpu/perf_event_intel_uncore.h | 2 +- .../x86/kernel/cpu/perf_event_intel_uncore_snbep.c | 17 ++++ arch/x86/kernel/xsave.c | 1 + arch/x86/kvm/cpuid.c | 11 ++- arch/x86/kvm/emulate.c | 2 +- arch/x86/kvm/mmu.c | 2 +- arch/x86/kvm/x86.c | 90 ++++++++++++++++++-- arch/x86/vdso/vma.c | 45 ++++++---- arch/xtensa/include/asm/highmem.h | 2 +- block/blk-core.c | 3 + block/blk-mq-cpumap.c | 2 +- block/blk-mq-sysfs.c | 9 +- block/blk-mq-tag.c | 17 ++-- block/blk-sysfs.c | 12 +-- block/genhd.c | 11 ++- drivers/acpi/device_pm.c | 2 +- drivers/acpi/scan.c | 13 +-- drivers/acpi/video.c | 27 +++++- drivers/base/bus.c | 8 +- drivers/block/drbd/drbd_req.c | 3 +- drivers/bluetooth/ath3k.c | 2 + drivers/bluetooth/btusb.c | 1 + drivers/char/i8k.c | 8 ++ drivers/gpu/drm/nouveau/core/core/event.c | 4 +- drivers/gpu/drm/nouveau/core/core/notify.c | 2 +- drivers/gpu/drm/nouveau/nouveau_ttm.c | 3 +- drivers/hid/hid-core.c | 1 + drivers/hid/hid-ids.h | 2 + drivers/hid/hid-input.c | 3 + drivers/hid/hid-kye.c | 4 + drivers/hid/hid-roccat-pyra.c | 8 +- drivers/hid/i2c-hid/i2c-hid.c | 19 ++--- drivers/hid/usbhid/hid-quirks.c | 2 + drivers/hid/wacom_sys.c | 9 +- drivers/hid/wacom_wac.c | 1 + drivers/hv/channel_mgmt.c | 11 ++- drivers/input/mouse/alps.c | 56 +++++++++--- drivers/input/touchscreen/atmel_mxt_ts.c | 99 ++++++---------------- drivers/iommu/intel-iommu.c | 12 +-- drivers/md/raid5.c | 7 +- drivers/misc/genwqe/card_utils.c | 2 + drivers/mmc/host/sdhci.c | 8 +- drivers/mtd/devices/m25p80.c | 6 +- drivers/mtd/nand/omap2.c | 7 -- drivers/mtd/tests/torturetest.c | 4 +- drivers/mtd/ubi/upd.c | 10 ++- drivers/mtd/ubi/wl.c | 10 +-- drivers/net/can/usb/peak_usb/pcan_usb_core.c | 17 ++-- drivers/net/can/usb/peak_usb/pcan_usb_pro.c | 3 +- drivers/net/wireless/ath/ath5k/qcu.c | 8 +- drivers/net/wireless/ath/ath9k/hw.h | 4 +- drivers/net/wireless/ath/ath9k/mac.c | 9 +- drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c | 9 ++ drivers/net/wireless/iwlwifi/dvm/commands.h | 31 ++++--- drivers/net/wireless/iwlwifi/dvm/lib.c | 47 +++++----- drivers/net/wireless/iwlwifi/mvm/fw-api.h | 2 +- drivers/net/wireless/iwlwifi/pcie/drv.c | 4 + drivers/pci/probe.c | 3 + drivers/regulator/s2mps11.c | 19 +++-- drivers/rtc/rtc-isl12057.c | 4 +- drivers/rtc/rtc-omap.c | 11 ++- drivers/rtc/rtc-sirfsoc.c | 16 ++-- drivers/spi/spi-sh-msiof.c | 5 ++ drivers/tty/n_tty.c | 3 +- drivers/tty/serial/men_z135_uart.c | 1 + drivers/tty/serial/samsung.c | 4 + drivers/usb/class/cdc-acm.c | 10 ++- drivers/usb/core/quirks.c | 3 + drivers/usb/gadget/udc/at91_udc.c | 44 +++++++--- drivers/usb/renesas_usbhs/mod_gadget.c | 3 + drivers/usb/serial/qcserial.c | 33 ++++++++ drivers/xen/swiotlb-xen.c | 10 +-- fs/btrfs/delayed-inode.c | 8 ++ fs/ceph/addr.c | 2 +- fs/fs-writeback.c | 29 +++++-- fs/nfsd/nfs4state.c | 17 ++-- fs/nfsd/nfs4xdr.c | 5 +- fs/nilfs2/inode.c | 32 +++++-- fs/nilfs2/namei.c | 15 +++- fs/ocfs2/aops.c | 16 +++- fs/ocfs2/namei.c | 43 ++++++++-- fs/pstore/ram.c | 13 ++- fs/pstore/ram_core.c | 31 +++++-- fs/reiserfs/super.c | 3 + include/linux/mm.h | 2 +- include/linux/pstore_ram.h | 4 +- include/linux/writeback.h | 1 - include/net/mac80211.h | 7 +- include/trace/events/sched.h | 2 +- include/uapi/linux/audit.h | 2 + include/uapi/linux/hyperv.h | 1 + kernel/events/core.c | 4 +- kernel/exit.c | 12 ++- kernel/sched/core.c | 9 +- kernel/sched/deadline.c | 25 +----- mm/memory.c | 31 ++++--- mm/mmap.c | 7 +- mm/page-writeback.c | 43 +++------- mm/vmscan.c | 24 +++--- net/bluetooth/6lowpan.c | 8 +- net/bluetooth/hci_conn.c | 4 +- net/bluetooth/hci_event.c | 18 +++- net/mac80211/key.c | 12 ++- net/sunrpc/xdr.c | 6 +- scripts/kernel-doc | 2 +- sound/firewire/fireworks/fireworks_transaction.c | 2 +- sound/pci/hda/hda_codec.c | 4 +- sound/pci/hda/patch_hdmi.c | 2 + sound/pci/hda/patch_realtek.c | 15 ++++ sound/pci/hda/patch_sigmatel.c | 4 +- sound/soc/codecs/max98090.c | 4 +- sound/soc/codecs/pcm512x-i2c.c | 7 +- sound/soc/codecs/sigmadsp.c | 7 ++ sound/soc/codecs/tlv320aic31xx.c | 13 +-- sound/soc/dwc/designware_i2s.c | 14 +++ sound/soc/fsl/eukrea-tlv320.c | 2 +- sound/usb/caiaq/audio.c | 2 +- sound/usb/mixer_maps.c | 15 +++- tools/perf/util/event.h | 1 + tools/perf/util/session.c | 11 ++- tools/testing/ktest/ktest.pl | 4 +- 150 files changed, 1121 insertions(+), 618 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/150 drivers/rtc/rtc-sirfsoc.c: move hardware initilization earlier in probe
3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guo Zeng <[email protected]>
commit 0e95325525c4383565cea4f402f15a3113162d05 upstream.
Move rtc register to be later than hardware initialization. The reason is that devm_rtc_device_register() will do read_time() which is a callback accessing hardware. This sometimes causes a hang in the hardware related callback.
--- drivers/rtc/rtc-sirfsoc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/rtc/rtc-sirfsoc.c +8 -8
@@ -286,14 +286,6 @@ static int sirfsoc_rtc_probe(struct plat rtc_div = ((32768 /RTC_HZ ) /2 ) -1 ;sirfsoc_rtc_iobrg_writel (rtc_div, rtcdrv->rtc_base +RTC_DIV ); - rtcdrv->rtc =devm_rtc_device_register (&pdev->dev, pdev->name, - &sirfsoc_rtc_ops,THIS_MODULE ); -if (IS_ERR (rtcdrv->rtc)) { - err =PTR_ERR (rtcdrv->rtc); -dev_err (&pdev->dev,"can't register RTC device\n" ); -return err; - } -/* 0x3 -> RTC_CLK */ sirfsoc_rtc_iobrg_writel (SIRFSOC_RTC_CLK , rtcdrv->rtc_base +RTC_CLOCK_SWITCH );
@@ -308,6 +300,14 @@ static int sirfsoc_rtc_probe(struct plat rtcdrv->overflow_rtc =sirfsoc_rtc_iobrg_readl (rtcdrv->rtc_base +RTC_SW_VALUE ); + rtcdrv->rtc =devm_rtc_device_register (&pdev->dev, pdev->name, + &sirfsoc_rtc_ops,THIS_MODULE ); +if (IS_ERR (rtcdrv->rtc)) { + err =PTR_ERR (rtcdrv->rtc); +dev_err (&pdev->dev,"can't register RTC device\n" ); +return err; + } + rtcdrv->irq =platform_get_irq (pdev,0 ); err = devm_request_irq( &pdev->dev,
Greg Kroah-Hartman
maintainerPATCH 2/150 rtc: omap: fix clock-source configuration
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 44c63a570aaec3c5d5569d63b7c4a31ddd88cae0 upstream.
This series fixes a few issues with the omap rtc-driver, cleans up a bit, adds device abstraction, and finally adds support for the PMIC control feature found in some revisions of this RTC IP block.
Ultimately, this allows for powering off the Beaglebone and waking it up again on RTC alarms.
This patch (of 20):
Make sure not to reset the clock-source configuration when enabling the 32kHz clock mux.
Until the clock source can be configured through device tree we must not overwrite settings made by the bootloader (e.g. clock-source selection).
--- drivers/rtc/rtc-omap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/rtc/rtc-omap.c +4 -2
@@ -431,8 +431,10 @@ static int __init omap_rtc_probe(structrtc_write (0 ,OMAP_RTC_INTERRUPTS_REG );/* enable RTC functional clock */ -if (id_entry->driver_data &OMAP_RTC_HAS_32KCLK_EN ) -rtc_writel (OMAP_RTC_OSC_32KCLK_EN ,OMAP_RTC_OSC_REG ); +if (id_entry->driver_data &OMAP_RTC_HAS_32KCLK_EN ) { + reg =rtc_read (OMAP_RTC_OSC_REG ); +rtc_writel (reg |OMAP_RTC_OSC_32KCLK_EN ,OMAP_RTC_OSC_REG ); + }/* clear old status */ reg =rtc_read (OMAP_RTC_STATUS_REG );
Greg Kroah-Hartman
maintainerPATCH 3/150 rtc: omap: fix missing wakealarm attribute
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 7ecd9a3f062147400e605713724dd67dbb7e5053 upstream.
The platform device must be registered as wakeup capable before registering the class device, or the wakealarm attribute will not be created.
Also make sure to unregister the wakeup source on probe errors.
--- drivers/rtc/rtc-omap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/rtc/rtc-omap.c +3 -2
@@ -416,6 +416,8 @@ static int __init omap_rtc_probe(structrtc_writel (KICK1_VALUE ,OMAP_RTC_KICK1_REG ); } +device_init_wakeup (&pdev->dev, true); + rtc =devm_rtc_device_register (&pdev->dev, pdev->name, &omap_rtc_ops,THIS_MODULE );if (IS_ERR (rtc)) {
@@ -484,8 +486,6 @@ static int __init omap_rtc_probe(struct* is write-only, and always reads as zero...) */ -device_init_wakeup (&pdev->dev, true); -if (new_ctrl & (u8 )OMAP_RTC_CTRL_SPLIT )pr_info ("%s: split power mode\n" , pdev->name);
@@ -495,6 +495,7 @@ static int __init omap_rtc_probe(structreturn 0 ; fail0: +device_init_wakeup (&pdev->dev, false);if (id_entry->driver_data &OMAP_RTC_HAS_KICKER )rtc_writel (0 ,OMAP_RTC_KICK0_REG );pm_runtime_put_sync (&pdev->dev);
Greg Kroah-Hartman
maintainerPATCH 5/150 ocfs2: fix journal commit deadlock
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junxiao Bi <[email protected]>
commit 136f49b9171074872f2a14ad0ab10486d1ba13ca upstream.
For buffer write, page lock will be got in write_begin and released in write_end, in ocfs2_write_end_nolock(), before it unlock the page in ocfs2_free_write_ctxt(), it calls ocfs2_run_deallocs(), this will ask for the read lock of journal->j_trans_barrier. Holding page lock and ask for journal->j_trans_barrier breaks the locking order.
This will cause a deadlock with journal commit threads, ocfs2cmt will get write lock of journal->j_trans_barrier first, then it wakes up kjournald2 to do the commit work, at last it waits until done. To commit journal, kjournald2 needs flushing data first, it needs get the cache page lock.
Since some ocfs2 cluster locks are holding by write process, this deadlock may hung the whole cluster.
unlock pages before ocfs2_run_deallocs() can fix the locking order, also put unlock before ocfs2_commit_trans() to make page lock is unlocked before j_trans_barrier to preserve unlocking order.
--- fs/ocfs2/aops.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
fs/ocfs2/aops.c +14 -2
@@ -894,7 +894,7 @@ void ocfs2_unlock_and_free_pages(struct } } -static void ocfs2_free_write_ctxt (struct ocfs2_write_ctxt *wc) +static void ocfs2_unlock_pages (struct ocfs2_write_ctxt *wc) {int i;
@@ -915,7 +915,11 @@ static void ocfs2_free_write_ctxt(structpage_cache_release (wc->w_target_page); }ocfs2_unlock_and_free_pages (wc->w_pages, wc->w_num_pages); +} +static void ocfs2_free_write_ctxt (struct ocfs2_write_ctxt *wc) +{ +ocfs2_unlock_pages (wc);brelse (wc->w_di_bh);kfree (wc); }
@@ -2042,11 +2046,19 @@ out_write_size:ocfs2_update_inode_fsync_trans (handle, inode,1 );ocfs2_journal_dirty (handle, wc->w_di_bh); +/* unlock pages before dealloc since it needs acquiring j_trans_barrier +* lock, or it will cause a deadlock since journal commit threads holds +* this lock and will ask for the page lock when flushing the data. +* put it here to preserve the unlock order. +*/ +ocfs2_unlock_pages (wc); +ocfs2_commit_trans (osb, handle);ocfs2_run_deallocs (osb, &wc->w_dealloc); -ocfs2_free_write_ctxt (wc); +brelse (wc->w_di_bh); +kfree (wc);return copied; }
Greg Kroah-Hartman
maintainerPATCH 6/150 ocfs2: fix the wrong directory passed to ocfs2_lookup_ino_from_name() when link file
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xue jiufei <[email protected]>
commit 53dc20b9a3d928b0744dad5aee65b610de1cc85d upstream.
In ocfs2_link(), the parent directory inode passed to function ocfs2_lookup_ino_from_name() is wrong. Parameter dir is the parent of new_dentry not old_dentry. We should get old_dir from old_dentry and lookup old_dentry in old_dir in case another node remove the old dentry.
With this change, hard linking works again, when paths are relative with at least one subdirectory. This is how the problem was reproducable:
# mkdir a # mkdir b # touch a/test # ln a/test b/test ln: failed to create hard link `b/test' => `a/test': No such file or directory
However when creating links in the same dir, it worked well.
Now the link gets created.
--- fs/ocfs2/namei.c | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-)
fs/ocfs2/namei.c +35 -8
@@ -94,6 +94,14 @@ static int ocfs2_create_symlink_data(strstruct inode *inode, const char *symname); +static int ocfs2_double_lock (struct ocfs2_super *osb, +struct buffer_head **bh1, +struct inode *inode1, +struct buffer_head **bh2, +struct inode *inode2, +int rename); + +static void ocfs2_double_unlock (struct inode *inode1,struct inode *inode2);/* An orphan dir name is an 8 byte value, printed as a hex string */ #define OCFS2_ORPHAN_NAMELEN ((int)(2 * sizeof(u64)))
@@ -678,8 +686,10 @@ static int ocfs2_link(struct dentry *old {handle_t *handle;struct inode *inode = old_dentry->d_inode; +struct inode *old_dir = old_dentry->d_parent->d_inode;int err;struct buffer_head *fe_bh =NULL ; +struct buffer_head *old_dir_bh =NULL ;struct buffer_head *parent_fe_bh =NULL ;struct ocfs2_dinode *fe =NULL ;struct ocfs2_super *osb =OCFS2_SB (dir->i_sb);
@@ -696,19 +706,33 @@ static int ocfs2_link(struct dentry *olddquot_initialize (dir); - err =ocfs2_inode_lock_nested (dir, &parent_fe_bh,1 ,OI_LS_PARENT ); + err =ocfs2_double_lock (osb, &old_dir_bh, old_dir, + &parent_fe_bh, dir,0 );if (err <0 ) {if (err != -ENOENT )mlog_errno (err);return err; } +/* make sure both dirs have bhs +* get an extra ref on old_dir_bh if old==new */ +if (!parent_fe_bh) { +if (old_dir_bh) { + parent_fe_bh = old_dir_bh; +get_bh (parent_fe_bh); + }else { +mlog (ML_ERROR ,"%s: no old_dir_bh!\n" , osb->uuid_str); + err = -EIO ; + goto out; + } + } +if (!dir->i_nlink) { err = -ENOENT ; goto out; } - err =ocfs2_lookup_ino_from_name (dir, old_dentry->d_name.name, + err =ocfs2_lookup_ino_from_name (old_dir, old_dentry->d_name.name, old_dentry->d_name.len, &old_de_ino);if (err) { err = -ENOENT ;
@@ -801,10 +825,11 @@ out_unlock_inode:ocfs2_inode_unlock (inode,1 ); out: -ocfs2_inode_unlock (dir,1 ); +ocfs2_double_unlock (old_dir, dir);brelse (fe_bh);brelse (parent_fe_bh); +brelse (old_dir_bh);ocfs2_free_dir_lookup_result (&lookup);
@@ -1072,14 +1097,15 @@ static int ocfs2_check_if_ancestor(struc }/* -* The only place this should be used is rename! +* The only place this should be used is rename and link! * if they have the same id, then the 1st one is the only one locked. */ static int ocfs2_double_lock (struct ocfs2_super *osb,struct buffer_head **bh1,struct inode *inode1,struct buffer_head **bh2, -struct inode *inode2) +struct inode *inode2, +int rename) {int status;int inode1_is_ancestor, inode2_is_ancestor;
@@ -1127,7 +1153,7 @@ static int ocfs2_double_lock(struct ocfs }/* lock id2 */ status =ocfs2_inode_lock_nested (inode2, bh2,1 , -OI_LS_RENAME1 ); + rename ==1 ?OI_LS_RENAME1 :OI_LS_PARENT );if (status <0 ) {if (status != -ENOENT )mlog_errno (status);
@@ -1136,7 +1162,8 @@ static int ocfs2_double_lock(struct ocfs }/* lock id1 */ - status =ocfs2_inode_lock_nested (inode1, bh1,1 ,OI_LS_RENAME2 ); + status =ocfs2_inode_lock_nested (inode1, bh1,1 , + rename ==1 ?OI_LS_RENAME2 :OI_LS_PARENT );if (status <0 ) {/* * An error return must mean that no cluster locks
@@ -1252,7 +1279,7 @@ static int ocfs2_rename(struct inode *ol/* if old and new are the same, this'll just do one lock. */ status =ocfs2_double_lock (osb, &old_dir_bh, old_dir, - &new_dir_bh, new_dir); + &new_dir_bh, new_dir,1 );if (status <0 ) {mlog_errno (status); goto bail;
Greg Kroah-Hartman
maintainerPATCH 7/150 ath9k_hw: fix hardware queue allocation
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
commit ad8fdccf9c197a89e2d2fa78c453283dcc2c343f upstream.
The driver passes the desired hardware queue index for a WMM data queue in qinfo->tqi_subtype. This was ignored in ath9k_hw_setuptxqueue, which instead relied on the order in which the function is called.
--- drivers/net/wireless/ath/ath9k/mac.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/net/wireless/ath/ath9k/mac.c +1 -8
@@ -311,14 +311,7 @@ int ath9k_hw_setuptxqueue(struct ath_hw q =ATH9K_NUM_TX_QUEUES -3 ;break ;case ATH9K_TX_QUEUE_DATA : -for (q =0 ; q <ATH9K_NUM_TX_QUEUES ; q++) -if (ah->txq[q].tqi_type == -ATH9K_TX_QUEUE_INACTIVE ) -break ; -if (q ==ATH9K_NUM_TX_QUEUES ) { -ath_err (common,"No available TX queue\n" ); -return -1 ; - } + q = qinfo->tqi_subtype;break ;default :ath_err (common,"Invalid TX queue type: %u\n" , type);
Greg Kroah-Hartman
maintainerPATCH 8/150 ath9k: fix BE/BK queue order
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
commit 78063d81d353e10cbdd279c490593113b8fdae1c upstream.
Hardware queues are ordered by priority. Use queue index 0 for BK, which has lower priority than BE.
--- drivers/net/wireless/ath/ath9k/hw.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/hw.h +2 -2
@@ -217,8 +217,8 @@#define AH_WOW_BEACON_MISS BIT(3)enum ath_hw_txq_subtype { -ATH_TXQ_AC_BE =0 , -ATH_TXQ_AC_BK =1 , +ATH_TXQ_AC_BK =0 , +ATH_TXQ_AC_BE =1 ,ATH_TXQ_AC_VI =2 ,ATH_TXQ_AC_VO =3 , };
Greg Kroah-Hartman
maintainerPATCH 9/150 can: peak_usb: fix cleanup sequence order in case of error during init
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephane Grosjean <[email protected]>
commit af35d0f1cce7a990286e2b94c260a2c2d2a0e4b0 upstream.
This patch sets the correct reverse sequence order to the instructions set to run, when any failure occurs during the initialization steps. It also adds the missing unregistration call of the can device if the failure appears after having been registered.
--- drivers/net/can/usb/peak_usb/pcan_usb_core.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/net/can/usb/peak_usb/pcan_usb_core.c +10 -7
@@ -735,7 +735,7 @@ static int peak_usb_create_dev(struct pe dev->cmd_buf =kmalloc (PCAN_USB_MAX_CMD_LEN ,GFP_KERNEL );if (!dev->cmd_buf) { err = -ENOMEM ; - goto lbl_set_intf_data; + goto lbl_free_candev; } dev->udev = usb_dev;
@@ -775,7 +775,7 @@ static int peak_usb_create_dev(struct pe err =register_candev (netdev);if (err) {dev_err (&intf->dev,"couldn't register CAN device: %d\n" , err); - goto lbl_free_cmd_buf; + goto lbl_restore_intf_data; }if (dev->prev_siblings)
@@ -788,14 +788,14 @@ static int peak_usb_create_dev(struct peif (dev->adapter->dev_init) { err = dev->adapter->dev_init (dev);if (err) - goto lbl_free_cmd_buf; + goto lbl_unregister_candev; }/* set bus off */ if (dev->adapter->dev_set_bus) { err = dev->adapter->dev_set_bus (dev,0 );if (err) - goto lbl_free_cmd_buf; + goto lbl_unregister_candev; }/* get device number early */
@@ -807,11 +807,14 @@ static int peak_usb_create_dev(struct pereturn 0 ; -lbl_free_cmd_buf: -kfree (dev->cmd_buf); +lbl_unregister_candev: +unregister_candev (netdev); -lbl_set_intf_data: +lbl_restore_intf_data:usb_set_intfdata (intf, dev->prev_siblings); +kfree (dev->cmd_buf); + +lbl_free_candev:free_candev (netdev);return err;
Greg Kroah-Hartman
maintainerPATCH 10/150 can: peak_usb: fix memset() usage
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephane Grosjean <[email protected]>
commit dc50ddcd4c58a5a0226038307d6ef884bec9f8c2 upstream.
This patchs fixes a misplaced call to memset() that fills the request buffer with 0. The problem was with sending PCAN_USBPRO_REQ_FCT requests, the content set by the caller was thus lost.
With this patch, the memory area is zeroed only when requesting info from the device.
--- drivers/net/can/usb/peak_usb/pcan_usb_pro.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/can/usb/peak_usb/pcan_usb_pro.c +1 -2
@@ -333,8 +333,6 @@ static int pcan_usb_pro_send_req(structif (!(dev->state &PCAN_USB_STATE_CONNECTED ))return 0 ; -memset (req_addr,'\0' , req_size); - req_type =USB_TYPE_VENDOR |USB_RECIP_OTHER ;switch (req_id) {
@@ -345,6 +343,7 @@ static int pcan_usb_pro_send_req(structdefault : p =usb_rcvctrlpipe (dev->udev,0 ); req_type |=USB_DIR_IN ; +memset (req_addr,'\0' , req_size);break ; }
Greg Kroah-Hartman
maintainerPATCH 11/150 swiotlb-xen: pass dev_addr to xen_dma_unmap_page and xen_dma_sync_single_for_cpu
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefano Stabellini <[email protected]>
commit d6883e6f32e07ef2cc974753ba00927de099e6d7 upstream.
xen_dma_unmap_page and xen_dma_sync_single_for_cpu take a dma_addr_t handle as argument, not a physical address.
--- drivers/xen/swiotlb-xen.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/xen/swiotlb-xen.c +3 -3
@@ -447,7 +447,7 @@ static void xen_unmap_single(struct deviBUG_ON (dir ==DMA_NONE ); -xen_dma_unmap_page (hwdev, paddr, size, dir, attrs); +xen_dma_unmap_page (hwdev, dev_addr, size, dir, attrs);/* NOTE: We use dev_addr here, not paddr! */ if (is_xen_swiotlb_buffer (dev_addr)) {
@@ -495,14 +495,14 @@ xen_swiotlb_sync_single(struct device *hBUG_ON (dir ==DMA_NONE );if (target ==SYNC_FOR_CPU ) -xen_dma_sync_single_for_cpu (hwdev, paddr, size, dir); +xen_dma_sync_single_for_cpu (hwdev, dev_addr, size, dir);/* NOTE: We use dev_addr here, not paddr! */ if (is_xen_swiotlb_buffer (dev_addr))swiotlb_tbl_sync_single (hwdev, paddr, size, dir, target);if (target ==SYNC_FOR_DEVICE ) -xen_dma_sync_single_for_cpu (hwdev, paddr, size, dir); +xen_dma_sync_single_for_cpu (hwdev, dev_addr, size, dir);if (dir !=DMA_FROM_DEVICE )return ;
Greg Kroah-Hartman
maintainerPATCH 12/150 swiotlb-xen: remove BUG_ON in xen_bus_to_phys
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefano Stabellini <[email protected]>
commit c884227eaae9936f8ecbde6e1387bccdab5f4e90 upstream.
On x86 truncation cannot occur because config XEN depends on X86_64 || (X86_32 && X86_PAE).
On ARM truncation can occur without CONFIG_ARM_LPAE, when the dma operation involves foreign grants. However in that case the physical address returned by xen_bus_to_phys is actually invalid (there is no mfn to pfn tracking for foreign grants on ARM) and it is not used.
--- drivers/xen/swiotlb-xen.c | 2 -- 1 file changed, 2 deletions(-)
drivers/xen/swiotlb-xen.c +0 -2
@@ -96,8 +96,6 @@ static inline phys_addr_t xen_bus_to_phydma_addr_t dma = (dma_addr_t )pfn <<PAGE_SHIFT ;phys_addr_t paddr = dma; -BUG_ON (paddr != dma);/* truncation has occurred, should never happen */ - paddr |= baddr & ~PAGE_MASK ;return paddr;
Greg Kroah-Hartman
maintainerPATCH 13/150 swiotlb-xen: call xen_dma_sync_single_for_device when appropriate
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefano Stabellini <[email protected]>
commit 9490c6c67e2f41760de8ece4e4f56f75f84ceb9e upstream.
In xen_swiotlb_sync_single we always call xen_dma_sync_single_for_cpu, even when we should call xen_dma_sync_single_for_device. Fix that.
--- drivers/xen/swiotlb-xen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/swiotlb-xen.c +1 -1
@@ -500,7 +500,7 @@ xen_swiotlb_sync_single(struct device *hswiotlb_tbl_sync_single (hwdev, paddr, size, dir, target);if (target ==SYNC_FOR_DEVICE ) -xen_dma_sync_single_for_cpu (hwdev, dev_addr, size, dir); +xen_dma_sync_single_for_device (hwdev, dev_addr, size, dir);if (dir !=DMA_FROM_DEVICE )return ;
Greg Kroah-Hartman
maintainerPATCH 14/150 swiotlb-xen: pass dev_addr to swiotlb_tbl_unmap_single
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefano Stabellini <[email protected]>
commit 2c3fc8d26dd09b9d7069687eead849ee81c78e46 upstream.
Need to pass the pointer within the swiotlb internal buffer to the swiotlb library, that in the case of xen_unmap_single is dev_addr, not paddr.
--- drivers/xen/swiotlb-xen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/swiotlb-xen.c +1 -1
@@ -449,7 +449,7 @@ static void xen_unmap_single(struct devi/* NOTE: We use dev_addr here, not paddr! */ if (is_xen_swiotlb_buffer (dev_addr)) { -swiotlb_tbl_unmap_single (hwdev, paddr, size, dir); +swiotlb_tbl_unmap_single (hwdev, dev_addr, size, dir);return ; }
Greg Kroah-Hartman
maintainerPATCH 15/150 iwlwifi: dvm: fix flush support for old firmware
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
commit 5a12a07e4495d1e4d79382e05c9d6e8b4d9fa4ec upstream.
Since the commit below, iwldvm sends the FLUSH command to the firmware. All the devices that use iwldvm have a firmware that expects the _v3 version of this command, besides 5150.
5150's latest available firmware still expects a _v2 version of the FLUSH command.
This means that since the commit below, we had a mismatch for this specific device only.
This mismatch led to the NMI below:
Loaded firmware version: 8.24.2.2
Start IWL Error Log Dump:
Status: 0x0000004C, count: 5
0x00000004 | NMI_INTERRUPT_WDG 0x000006F4 | uPc 0x000005BA | branchlink1 0x000006F8 | branchlink2 0x000008C2 | interruptlink1 0x00005B02 | interruptlink2 0x00000002 | data1 0x07030000 | data2 0x00000068 | line 0x3E80510C | beacon time 0x728A0EF4 | tsf low 0x0000002A | tsf hi 0x00000000 | time gp1 0x01BDC977 | time gp2 0x00000000 | time gp3 0x00010818 | uCode version 0x00000000 | hw version 0x00484704 | board version 0x00000002 | hcmd 0x2FF23080 | isr0 0x0103E000 | isr1 0x0000001A | isr2 0x1443FCC3 | isr3 0x11800112 | isr4 0x00000068 | isr_pref 0x000000D4 | wait_event 0x00000000 | l2p_control 0x00000007 | l2p_duration 0x00103040 | l2p_mhvalid 0x00000007 | l2p_addr_match 0x00000000 | lmpm_pmg_sel 0x00000000 | timestamp 0x00000200 | flow_handler
This was reported here:
https://bugzilla.kernel.org/show_bug.cgi?id=88961
--- drivers/net/wireless/iwlwifi/dvm/commands.h | 31 +++++++++++-------- drivers/net/wireless/iwlwifi/dvm/lib.c | 45 ++++++++++++++-------------- 2 files changed, 41 insertions(+), 35 deletions(-)
drivers/net/wireless/iwlwifi/dvm/commands.h +18 -13
@@ -966,21 +966,21 @@ struct iwl_rem_sta_cmd {/* WiFi queues mask */ -#define IWL_SCD_BK_MSK cpu_to_le32(BIT(0)) -#define IWL_SCD_BE_MSK cpu_to_le32(BIT(1)) -#define IWL_SCD_VI_MSK cpu_to_le32(BIT(2)) -#define IWL_SCD_VO_MSK cpu_to_le32(BIT(3)) -#define IWL_SCD_MGMT_MSK cpu_to_le32(BIT(3)) +#define IWL_SCD_BK_MSK BIT(0) +#define IWL_SCD_BE_MSK BIT(1) +#define IWL_SCD_VI_MSK BIT(2) +#define IWL_SCD_VO_MSK BIT(3) +#define IWL_SCD_MGMT_MSK BIT(3)/* PAN queues mask */ -#define IWL_PAN_SCD_BK_MSK cpu_to_le32(BIT(4)) -#define IWL_PAN_SCD_BE_MSK cpu_to_le32(BIT(5)) -#define IWL_PAN_SCD_VI_MSK cpu_to_le32(BIT(6)) -#define IWL_PAN_SCD_VO_MSK cpu_to_le32(BIT(7)) -#define IWL_PAN_SCD_MGMT_MSK cpu_to_le32(BIT(7)) -#define IWL_PAN_SCD_MULTICAST_MSK cpu_to_le32(BIT(8)) +#define IWL_PAN_SCD_BK_MSK BIT(4) +#define IWL_PAN_SCD_BE_MSK BIT(5) +#define IWL_PAN_SCD_VI_MSK BIT(6) +#define IWL_PAN_SCD_VO_MSK BIT(7) +#define IWL_PAN_SCD_MGMT_MSK BIT(7) +#define IWL_PAN_SCD_MULTICAST_MSK BIT(8) -#define IWL_AGG_TX_QUEUE_MSK cpu_to_le32(0xffc00) +#define IWL_AGG_TX_QUEUE_MSK 0xffc00#define IWL_DROP_ALL BIT(1)
@@ -1005,12 +1005,17 @@ struct iwl_rem_sta_cmd {* 1: Dump multiple MSDU according to PS, INVALID STA, TTL, TID disable. * 2: Dump all FIFO */ -struct iwl_txfifo_flush_cmd { +struct iwl_txfifo_flush_cmd_v3 {__le32 queue_control;__le16 flush_control;__le16 reserved; } __packed; +struct iwl_txfifo_flush_cmd_v2 { +__le16 queue_control; +__le16 flush_control; +} __packed; +/* * REPLY_WEP_KEY = 0x20 */
drivers/net/wireless/iwlwifi/dvm/lib.c +23 -22
60 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 16/150 iwlwifi: mvm: update values for Smart Fifo
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
commit b4c82adcba8cb4b23068a6b800ca98da3bee6888 upstream.
Interoperability issues were identified and root caused to the Smart Fifo watermarks. These issues arose with NetGear R7000. Fix this.
--- drivers/net/wireless/iwlwifi/mvm/fw-api.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/iwlwifi/mvm/fw-api.h +1 -1
@@ -1589,7 +1589,7 @@ enum iwl_sf_scenario {#define SF_NUM_TIMEOUT_TYPES 2/* Aging timer and Idle timer */ /* smart FIFO default values */ -#define SF_W_MARK_SISO 4096 +#define SF_W_MARK_SISO 6144#define SF_W_MARK_MIMO2 8192#define SF_W_MARK_MIMO3 6144#define SF_W_MARK_LEGACY 4096
Greg Kroah-Hartman
maintainerPATCH 17/150 iwlwifi: add new device IDs for 3165
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
commit 55fd1ce820f461b77919a1997ba8285652219024 upstream.
A few device IDs were added, reflect this change in the driver.
--- drivers/net/wireless/iwlwifi/pcie/drv.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/iwlwifi/pcie/drv.c +4 -0
@@ -367,7 +367,11 @@ static const struct pci_device_id iwl_hw/* 3165 Series */ {IWL_PCI_DEVICE(0x3165, 0x4010, iwl3165_2ac_cfg)}, + {IWL_PCI_DEVICE(0x3165, 0x4012, iwl3165_2ac_cfg)}, + {IWL_PCI_DEVICE(0x3165, 0x4110, iwl3165_2ac_cfg)}, {IWL_PCI_DEVICE(0x3165, 0x4210, iwl3165_2ac_cfg)}, + {IWL_PCI_DEVICE(0x3165, 0x4410, iwl3165_2ac_cfg)}, + {IWL_PCI_DEVICE(0x3165, 0x4510, iwl3165_2ac_cfg)},/* 7265 Series */ {IWL_PCI_DEVICE(0x095A, 0x5010, iwl7265_2ac_cfg)},
Greg Kroah-Hartman
maintainerPATCH 18/150 ath5k: fix hardware queue index assignment
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
commit 9e4982f6a51a2442f1bb588fee42521b44b4531c upstream.
Like with ath9k, ath5k queues also need to be ordered by priority. queue_info->tqi_subtype already contains the correct index, so use it instead of relying on the order of ath5k_hw_setup_tx_queue calls.
--- drivers/net/wireless/ath/ath5k/qcu.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/net/wireless/ath/ath5k/qcu.c +1 -7
@@ -225,13 +225,7 @@ ath5k_hw_setup_tx_queue(struct ath5k_hw }else {switch (queue_type) {case AR5K_TX_QUEUE_DATA : -for (queue =AR5K_TX_QUEUE_ID_DATA_MIN ; - ah->ah_txq[queue].tqi_type != -AR5K_TX_QUEUE_INACTIVE ; queue++) { - -if (queue >AR5K_TX_QUEUE_ID_DATA_MAX ) -return -EINVAL ; - } + queue = queue_info->tqi_subtype;break ;case AR5K_TX_QUEUE_UAPSD : queue =AR5K_TX_QUEUE_ID_UAPSD ;
Greg Kroah-Hartman
maintainerPATCH 19/150 ASoC: eukrea-tlv320: Fix of_node_put() call with uninitialized object
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 077661b6ed24e530dabc9db3ab3ae48fbaf19679 upstream.
The of_node_put() call in eukrea_tlv320_probe() may take an
uninitialized pointer, as compiler spotted out:
sound/soc/fsl/eukrea-tlv320.c:221:14: warning: 'ssi_np' may be used uninitialized in this function [-Wuninitialized]
This patch adds the proper NULL initializations as a fix. (codec_np is also NULL initialized just for consistency.)
--- sound/soc/fsl/eukrea-tlv320.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/fsl/eukrea-tlv320.c +1 -1
@@ -105,7 +105,7 @@ static int eukrea_tlv320_probe(struct plint ret;int int_port =0 , ext_port;struct device_node *np = pdev->dev.of_node; -struct device_node *ssi_np, *codec_np; +struct device_node *ssi_np =NULL , *codec_np =NULL ; eukrea_tlv320.dev = &pdev->dev;if (np) {
Greg Kroah-Hartman
maintainerPATCH 20/150 ASoC: sigmadsp: Refuse to load firmware files with a non-supported version
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lars-Peter Clausen <[email protected]>
commit 50c0f21b42dd4cd02b51f82274f66912d9a7fa32 upstream.
Make sure to check the version field of the firmware header to make sure to not accidentally try to parse a firmware file with a different layout. Trying to do so can result in loading invalid firmware code to the device.
--- sound/soc/codecs/sigmadsp.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/codecs/sigmadsp.c +7 -0
@@ -159,6 +159,13 @@ int _process_sigma_firmware(struct devic goto done; } +if (ssfw_head->version !=1 ) { +dev_err (dev, +"Failed to load firmware: Invalid version %d. Supported firmware versions: 1\n" , + ssfw_head->version); + goto done; + } + crc =crc32 (0 , fw->data +sizeof (*ssfw_head), fw->size -sizeof (*ssfw_head));pr_debug ("%s: crc=%x\n" , __func__, crc);
Greg Kroah-Hartman
maintainerPATCH 21/150 ASoC: max98090: Fix ill-defined sidetone route
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jarkko Nikula <[email protected]>
commit 48826ee590da03e9882922edf96d8d27bdfe9552 upstream.
Commit 5fe5b767dc6f ("ASoC: dapm: Do not pretend to support controls for non mixer/mux widgets") revealed ill-defined control in a route between "STENL Mux" and DACs in max98090.c:
max98090 i2c-193C9890:00: Control not supported for path STENL Mux -> [NULL] -> DACL max98090 i2c-193C9890:00: ASoC: no dapm match for STENL Mux --> NULL --> DACL max98090 i2c-193C9890:00: ASoC: Failed to add route STENL Mux -> NULL -> DACL max98090 i2c-193C9890:00: Control not supported for path STENL Mux -> [NULL] -> DACR max98090 i2c-193C9890:00: ASoC: no dapm match for STENL Mux --> NULL --> DACR max98090 i2c-193C9890:00: ASoC: Failed to add route STENL Mux -> NULL -> DACR
Since there is no control between "STENL Mux" and DACs the control name must be NULL not "NULL".
--- sound/soc/codecs/max98090.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/max98090.c +2 -2
@@ -1395,8 +1395,8 @@ static const struct snd_soc_dapm_route m {"STENL Mux", "Sidetone Left", "DMICL"}, {"STENR Mux", "Sidetone Right", "ADCR"}, {"STENR Mux", "Sidetone Right", "DMICR"}, - {"DACL", "NULL", "STENL Mux"}, - {"DACR", "NULL", "STENL Mux"}, + {"DACL", NULL, "STENL Mux"}, + {"DACR", NULL, "STENL Mux"}, {"AIFINL", NULL, "SHDN"}, {"AIFINR", NULL, "SHDN"},
Greg Kroah-Hartman
maintainerPATCH 22/150 ASoC: tlv320aic31xx: Fix off by one error in the loop stucture.
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jyri Sarha <[email protected]>
commit bbc686b34650b0f54affe9d9a637ccbe02b03760 upstream.
Fix off by one read beyond the end of a table.
--- sound/soc/codecs/tlv320aic31xx.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
sound/soc/codecs/tlv320aic31xx.c +7 -6
@@ -911,12 +911,13 @@ static int aic31xx_set_dai_sysclk(struct } aic31xx->p_div = i; -for (i =0 ; aic31xx_divs[i].mclk_p != freq/aic31xx->p_div; i++) { -if (i ==ARRAY_SIZE (aic31xx_divs)) { -dev_err (aic31xx->dev,"%s: Unsupported frequency %d\n" , - __func__, freq); -return -EINVAL ; - } +for (i =0 ; i <ARRAY_SIZE (aic31xx_divs) && + aic31xx_divs[i].mclk_p != freq/aic31xx->p_div; i++) + ; +if (i ==ARRAY_SIZE (aic31xx_divs)) { +dev_err (aic31xx->dev,"%s: Unsupported frequency %d\n" , + __func__, freq); +return -EINVAL ; }/* set clock on MCLK, BCLK, or GPIO1 as PLL input */
Greg Kroah-Hartman
maintainerPATCH 23/150 ASoC: pcm512x: Trigger auto-increment of register addresses on i2c
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Rosin <[email protected]>
commit 681a19560378213a193c424881b2180a783b81ae upstream.
When the codec is connected using i2c, it will only auto-increment register addresses if msb (0x80) of the register address byte is set.
[Fixes cache sync if multiple adjacent registers are updated -- broonie]
--- sound/soc/codecs/pcm512x-i2c.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
sound/soc/codecs/pcm512x-i2c.c +6 -1
@@ -24,8 +24,13 @@ static int pcm512x_i2c_probe(struct i2c_ const struct i2c_device_id *id) {struct regmap *regmap; +struct regmap_config config = pcm512x_regmap; - regmap =devm_regmap_init_i2c (i2c, &pcm512x_regmap); +/* msb needs to be set to enable auto-increment of addresses */ + config.read_flag_mask =0x80 ; + config.write_flag_mask =0x80 ; + + regmap =devm_regmap_init_i2c (i2c, &config);if (IS_ERR (regmap))return PTR_ERR (regmap);
Greg Kroah-Hartman
maintainerPATCH 24/150 ASoC: dwc: Ensure FIFOs are flushed to prevent channel swap
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Jackson <[email protected]>
commit 3475c3d034d7f276a474c8bd53f44b48c8bf669d upstream.
Flush the FIFOs when the stream is prepared for use. This avoids an inadvertent swapping of the left/right channels if the FIFOs are not empty at startup.
--- sound/soc/dwc/designware_i2s.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
sound/soc/dwc/designware_i2s.c +14 -0
@@ -263,6 +263,19 @@ static void dw_i2s_shutdown(struct snd_psnd_soc_dai_set_dma_data (dai, substream,NULL ); } +static int dw_i2s_prepare (struct snd_pcm_substream *substream, +struct snd_soc_dai *dai) +{ +struct dw_i2s_dev *dev =snd_soc_dai_get_drvdata (dai); + +if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) +i2s_write_reg (dev->i2s_base,TXFFR ,1 ); +else +i2s_write_reg (dev->i2s_base,RXFFR ,1 ); + +return 0 ; +} +static int dw_i2s_trigger (struct snd_pcm_substream *substream,int cmd,struct snd_soc_dai *dai) {
@@ -294,6 +307,7 @@ static struct snd_soc_dai_ops dw_i2s_dai .startup = dw_i2s_startup, .shutdown = dw_i2s_shutdown, .hw_params = dw_i2s_hw_params, + .prepare = dw_i2s_prepare, .trigger = dw_i2s_trigger, };
Greg Kroah-Hartman
maintainerPATCH 25/150 ktest: Fix make_min_config to handle new assign_configs call
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (Red Hat)" <[email protected]>
commit 9972fc0b859e7aaeb6d2d33bdb591959d9a436c0 upstream.
Commit 6071c22e1755 "ktest: Rewrite the config-bisect to actually work" fixed the config-bisect to work nicely but in doing so it broke make_min_config by changing the way assign_configs works.
The assign_configs function now adds the config to the hash even if it is disabled, but changes the hash value to be that of the line "# CONFIG_FOO is not set". Unfortunately, the make_min_config test only checks to see if the config is removed. It now needs to check if the config is in the hash and not set to be disabled.
--- tools/testing/ktest/ktest.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/ktest/ktest.pl +3 -1
@@ -3571,7 +3571,9 @@ sub test_this_config { undef %configs; assign_configs \%configs, $output_config; - return $config if (!defined($configs{$config})); + if (!defined($configs{$config}) || $configs{$config} =~ /^#/) { + return $config; + } doprint "disabling config $config did not change .config\n";
Greg Kroah-Hartman
maintainerPATCH 26/150 powerpc: Fix bad NULL pointer check in udbg_uart_getc_poll()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anton Blanchard <[email protected]>
commit cd32e2dcc9de6c27ecbbfc0e2079fb64b42bad5f upstream.
We have some code in udbg_uart_getc_poll() that tries to protect against a NULL udbg_uart_in, but gets it all wrong.
Found with the LLVM static analyzer (scan-build).
--- arch/powerpc/kernel/udbg_16550.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/powerpc/kernel/udbg_16550.c +5 -1
@@ -69,8 +69,12 @@ static void udbg_uart_putc(char c)static int udbg_uart_getc_poll (void ) { -if (!udbg_uart_in || !(udbg_uart_in (UART_LSR ) &LSR_DR )) +if (!udbg_uart_in) +return -1 ; + +if (!(udbg_uart_in (UART_LSR ) &LSR_DR ))return udbg_uart_in (UART_RBR ); +return -1 ; }
Greg Kroah-Hartman
maintainerPATCH 27/150 powerpc/book3s: Fix partial invalidation of TLBs in MCE code.
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mahesh Salgaonkar <[email protected]>
commit 682e77c861c4c60f79ffbeae5e1938ffed24a575 upstream.
The existing MCE code calls flush_tlb hook with IS=0 (single page) resulting in partial invalidation of TLBs which is not right. This patch fixes that by passing IS=0xc00 to invalidate whole TLB for successful recovery from TLB and ERAT errors.
--- arch/powerpc/kernel/mce_power.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/mce_power.c +2 -2
@@ -79,7 +79,7 @@ static long mce_handle_derror(uint64_t d }if (dsisr &P7_DSISR_MC_TLB_MULTIHIT_MFTLB ) {if (cur_cpu_spec && cur_cpu_spec->flush_tlb) - cur_cpu_spec->flush_tlb (TLBIEL_INVAL_PAGE ); + cur_cpu_spec->flush_tlb (TLBIEL_INVAL_SET );/* reset error bits */ dsisr &= ~P7_DSISR_MC_TLB_MULTIHIT_MFTLB ; }
@@ -110,7 +110,7 @@ static long mce_handle_common_ierror(uinbreak ;case P7_SRR1_MC_IFETCH_TLB_MULTIHIT :if (cur_cpu_spec && cur_cpu_spec->flush_tlb) { - cur_cpu_spec->flush_tlb (TLBIEL_INVAL_PAGE ); + cur_cpu_spec->flush_tlb (TLBIEL_INVAL_SET ); handled =1 ; }break ;
Greg Kroah-Hartman
maintainerPATCH 28/150 powerpc/powernv: Switch off MMU before entering nap/sleep/rvwinkle mode
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Mackerras <[email protected]>
commit 8117ac6a6c2fa0f847ff6a21a1f32c8d2c8501d0 upstream.
Currently, when going idle, we set the flag indicating that we are in nap mode (paca->kvm_hstate.hwthread_state) and then execute the nap (or sleep or rvwinkle) instruction, all with the MMU on. This is bad for two reasons: (a) the architecture specifies that those instructions must be executed with the MMU off, and in fact with only the SF, HV, ME and possibly RI bits set, and (b) this introduces a race, because as soon as we set the flag, another thread can switch the MMU to a guest context. If the race is lost, this thread will typically start looping on relocation-on ISIs at 0xc...4400.
This fixes it by setting the MSR as required by the architecture before setting the flag or executing the nap/sleep/rvwinkle instruction.
--- arch/powerpc/include/asm/reg.h | 2 ++ arch/powerpc/kernel/idle_power7.S | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/reg.h +2 -0
@@ -118,8 +118,10 @@#define __MSR (MSR_ME | MSR_RI | MSR_IR | MSR_DR | MSR_ISF |MSR_HV)#ifdef __BIG_ENDIAN__#define MSR_ __MSR +#define MSR_IDLE (MSR_ME | MSR_SF | MSR_HV)#else #define MSR_ (__MSR | MSR_LE) +#define MSR_IDLE (MSR_ME | MSR_SF | MSR_HV | MSR_LE)#endif #define MSR_KERNEL (MSR_ | MSR_64BIT)#define MSR_USER32 (MSR_ | MSR_PR | MSR_EE)
arch/powerpc/kernel/idle_power7.S +17 -1
@@ -101,7 +101,23 @@ _GLOBAL(power7_powersave_common) std r9,_MSR(r1) std r1,PACAR1(r13) -_GLOBAL(power7_enter_nap_mode) + /* + * Go to real mode to do the nap, as required by the architecture. + * Also, we need to be in real mode before setting hwthread_state, + * because as soon as we do that, another thread can switch + * the MMU context to the guest. + */ + LOAD_REG_IMMEDIATE(r5, MSR_IDLE) + li r6, MSR_RI + andc r6, r9, r6 + LOAD_REG_ADDR(r7, power7_enter_nap_mode) + mtmsrd r6, 1 /* clear RI before setting SRR0/1 */ + mtspr SPRN_SRR0, r7 + mtspr SPRN_SRR1, r5 + rfid + + .globl power7_enter_nap_mode +power7_enter_nap_mode: #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE /* Tell KVM we're napping */ li r4,KVM_HWTHREAD_IN_NAP
Greg Kroah-Hartman
maintainerPATCH 29/150 powerpc/perf/hv-24x7: Use per-cpu page buffer
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: "[email protected]" <[email protected]>
commit f34b6c72c3ebaa286d3311a825ef79eccbcca82f upstream.
The 24x7 counters are continuously running and not updated on an interrupt. So we record the event counts when stopping the event or deleting it.
But to "read" a single counter in 24x7, we allocate a page and pass it into the hypervisor (The HV returns the page full of counters from which we extract the specific counter for this event).
We allocate a page using GFP_USER and when deleting the event, we end up with the following warning because we are blocking in interrupt context.
[ 698.641709] BUG: scheduling while atomic: swapper/0/0/0x10010000
We could use GFP_ATOMIC but that could result in failures. Pre-allocate a buffer so we don't have to allocate in interrupt context. Further as Michael Ellerman suggested, use Per-CPU buffer so we only need to allocate once per CPU.
--- arch/powerpc/perf/hv-24x7.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-)
arch/powerpc/perf/hv-24x7.c +9 -12
@@ -217,11 +217,14 @@ static bool is_physical_domain(int domai domain ==HV_24X7_PERF_DOMAIN_PHYSICAL_CORE ; } +DEFINE_PER_CPU (char, hv_24x7_reqb[4096 ])__aligned(4096) ; +DEFINE_PER_CPU (char, hv_24x7_resb[4096 ])__aligned(4096) ; +static unsigned long single_24x7_request (u8 domain,u32 offset,u16 ix,u16 lpar,u64 *res,bool success_expected) { -unsigned long ret = -ENOMEM ; +unsigned long ret;/* * request_buffer and result_buffer are not required to be 4k aligned,
@@ -243,13 +246,11 @@ static unsigned long single_24x7_requestBUILD_BUG_ON (sizeof (*request_buffer) >4096 );BUILD_BUG_ON (sizeof (*result_buffer) >4096 ); - request_buffer =kmem_cache_zalloc (hv_page_cache,GFP_USER ); -if (!request_buffer) - goto out; + request_buffer = (void *)get_cpu_var (hv_24x7_reqb); + result_buffer = (void *)get_cpu_var (hv_24x7_resb); - result_buffer =kmem_cache_zalloc (hv_page_cache,GFP_USER ); -if (!result_buffer) - goto out_free_request_buffer; +memset (request_buffer,0 ,4096 ); +memset (result_buffer,0 ,4096 ); *request_buffer = (struct reqb ) { .buf = {
@@ -278,15 +279,11 @@ static unsigned long single_24x7_request domain, offset, ix, lpar, ret, ret, result_buffer->buf.detailed_rc, result_buffer->buf.failing_request_ix); - goto out_free_result_buffer; + goto out; } *res =be64_to_cpu (result_buffer->result); -out_free_result_buffer: -kfree (result_buffer); -out_free_request_buffer: -kfree (request_buffer); out:return ret; }
Greg Kroah-Hartman
maintainerPATCH 30/150 powerpc: add little endian flag to syscall_get_arch()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Guy Briggs <[email protected]>
commit 63f13448d81c910a284b096149411a719cbed501 upstream.
Since both ppc and ppc64 have LE variants which are now reported by uname, add that flag (__AUDIT_ARCH_LE) to syscall_get_arch() and add AUDIT_ARCH_PPC64LE variant.
Without this, perf trace and auditctl fail.
Mainline kernel reports ppc64le (per a058801) but there is no matching AUDIT_ARCH_PPC64LE.
Since 32-bit PPC LE is not supported by audit, don't advertise it in AUDIT_ARCH_PPC* variants.
See:
https://www.redhat.com/archives/linux-audit/2014-August/msg00082.html https://www.redhat.com/archives/linux-audit/2014-December/msg00004.html
--- arch/powerpc/include/asm/syscall.h | 6 +++++- include/uapi/linux/audit.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/syscall.h +5 -1
@@ -90,6 +90,10 @@ static inline void syscall_set_argumentsstatic inline int syscall_get_arch (void ) { -return is_32bit_task () ?AUDIT_ARCH_PPC :AUDIT_ARCH_PPC64 ; +int arch =is_32bit_task () ?AUDIT_ARCH_PPC :AUDIT_ARCH_PPC64 ; +#ifdef __LITTLE_ENDIAN__ + arch |= __AUDIT_ARCH_LE; +#endif +return arch; }#endif /* _ASM_SYSCALL_H */
include/uapi/linux/audit.h +2 -0
@@ -365,7 +365,9 @@ enum {#define AUDIT_ARCH_PARISC (EM_PARISC)#define AUDIT_ARCH_PARISC64 (EM_PARISC|__AUDIT_ARCH_64BIT)#define AUDIT_ARCH_PPC (EM_PPC) +/* do not define AUDIT_ARCH_PPCLE since it is not supported by audit */ #define AUDIT_ARCH_PPC64 (EM_PPC64|__AUDIT_ARCH_64BIT) +#define AUDIT_ARCH_PPC64LE (EM_PPC64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)#define AUDIT_ARCH_S390 (EM_S390)#define AUDIT_ARCH_S390X (EM_S390|__AUDIT_ARCH_64BIT)#define AUDIT_ARCH_SH (EM_SH)
Greg Kroah-Hartman
maintainerPATCH 31/150 Bluetooth: ath3k: Add support of MCI 13d3:3408 bt device
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Tunin <[email protected]>
commit 3bb30a7cdf9242aca90d49aa41baebf9458f96f0 upstream.
Add support for Bluetooth MCI WB335 (AR9565) Wi-Fi+bt module. This Bluetooth module requires loading patch and sysconfig by ath3k driver.
T: Bus=01 Lev=02 Prnt=03 Port=00 Cnt=01 Dev#= 20 Spd=12 MxCh= 0 D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=13d3 ProdID=3408 Rev= 0.02 C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA A: FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=01 I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms
--- drivers/bluetooth/ath3k.c | 2 ++ drivers/bluetooth/btusb.c | 1 + 2 files changed, 3 insertions(+)
drivers/bluetooth/ath3k.c +2 -0
@@ -105,6 +105,7 @@ static const struct usb_device_id ath3k_ { USB_DEVICE(0x13d3, 0x3375) }, { USB_DEVICE(0x13d3, 0x3393) }, { USB_DEVICE(0x13d3, 0x3402) }, + { USB_DEVICE(0x13d3, 0x3408) }, { USB_DEVICE(0x13d3, 0x3432) },/* Atheros AR5BBU12 with sflash firmware */
@@ -156,6 +157,7 @@ static const struct usb_device_id ath3k_ { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x13d3, 0x3408), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3432), .driver_info = BTUSB_ATH3012 },/* Atheros AR5BBU22 with sflash firmware */
drivers/bluetooth/btusb.c +1 -0
@@ -182,6 +182,7 @@ static const struct usb_device_id blackl { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x13d3, 0x3408), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3432), .driver_info = BTUSB_ATH3012 },/* Atheros AR5BBU12 with sflash firmware */
Greg Kroah-Hartman
maintainerPATCH 32/150 Bluetooth: 6lowpan: fix skb_unshare behaviour
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Aring <[email protected]>
commit b0c42cd7b210efc74aa4bfc3e39a2814dfaa9b89 upstream.
This patch reverts commit:
a7807d73 ("Bluetooth: 6lowpan: Avoid memory leak if memory allocation fails")
which was wrong suggested by Alexander Aring. The function skb_unshare run also kfree_skb on failure.
--- net/bluetooth/6lowpan.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
net/bluetooth/6lowpan.c +2 -6
@@ -591,17 +591,13 @@ static netdev_tx_t bt_xmit(struct sk_bufint err =0 ;bdaddr_t addr;u8 addr_type; -struct sk_buff *tmpskb;/* We must take a copy of the skb before we modify/replace the ipv6 * header as the header could be used elsewhere */ - tmpskb =skb_unshare (skb,GFP_ATOMIC ); -if (!tmpskb) { -kfree_skb (skb); + skb =skb_unshare (skb,GFP_ATOMIC ); +if (!skb)return NET_XMIT_DROP ; - } - skb = tmpskb;/* Return values from setup_header() * <0 - error, packet is dropped
Greg Kroah-Hartman
maintainerPATCH 33/150 Bluetooth: Fix LE connection timeout deadlock
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hedberg <[email protected]>
commit 980ffc0a2cec2c37589cc97993e1ad17252f4f47 upstream.
The le_conn_timeout() may call hci_le_conn_failed() which in turn may call hci_conn_del(). Trying to use the _sync variant for cancelling the conn timeout from hci_conn_del() could therefore result in a deadlock. This patch converts hci_conn_del() to use the non-sync variant so the deadlock is not possible.
--- net/bluetooth/hci_conn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/hci_conn.c +1 -1
@@ -517,7 +517,7 @@ int hci_conn_del(struct hci_conn *conn)/* Unacked frames */ hdev->acl_cnt += conn->sent; }else if (conn->type ==LE_LINK ) { -cancel_delayed_work_sync (&conn->le_conn_timeout); +cancel_delayed_work (&conn->le_conn_timeout);if (hdev->le_pkts) hdev->le_cnt += conn->sent;
Greg Kroah-Hartman
maintainerPATCH 34/150 Bluetooth: Fix check for direct advertising
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hedberg <[email protected]>
commit 0b1db38ca26b322296cbd141f3080eccfe1cc3e1 upstream.
These days we allow simultaneous LE scanning and advertising. Checking for whether advertising is enabled or not is therefore not a reliable way to determine whether directed advertising was used to trigger the connection creation. The appropriate place to check (instead of the hdev context) is the connection role that's stored in the hci_conn. This patch fixes such a check in le_conn_timeout() which could otherwise lead to incorrect HCI commands being sent.
--- net/bluetooth/hci_conn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/hci_conn.c +1 -1
@@ -415,7 +415,7 @@ static void le_conn_timeout(struct work_* happen with broken hardware or if low duty cycle was used * (which doesn't have a timeout of its own). */ -if (test_bit (HCI_ADVERTISING , &hdev->dev_flags)) { +if (conn->role ==HCI_ROLE_SLAVE ) {u8 enable =0x00 ;hci_send_cmd (hdev,HCI_OP_LE_SET_ADV_ENABLE ,sizeof (enable), &enable);
Greg Kroah-Hartman
maintainerPATCH 35/150 Bluetooth: Clear LE white list when resetting controller
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcel Holtmann <[email protected]>
commit a4d5504d5c39cc84f1f828e19967595597a8136e upstream.
The internal representation of the LE white list needs to be cleared when receiving a successful HCI_Reset command. A reset of the controller is expected to start with an empty LE white list.
When the LE white list is not cleared on controller reset, the passive background scanning might skip programming the remote devices. Only changes to the LE white list are programmed when passive background is started.
--- net/bluetooth/hci_event.c | 2 ++ 1 file changed, 2 insertions(+)
net/bluetooth/hci_event.c +2 -0
@@ -205,6 +205,8 @@ static void hci_cc_reset(struct hci_dev hdev->le_scan_type =LE_SCAN_PASSIVE ; hdev->ssp_debug_mode =0 ; + +hci_bdaddr_list_clear (&hdev->le_white_list); }static void hci_cc_write_local_name (struct hci_dev *hdev,struct sk_buff *skb)
Greg Kroah-Hartman
maintainerPATCH 36/150 Bluetooth: Fix controller configuration with HCI_QUIRK_INVALID_BDADDR
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcel Holtmann <[email protected]>
commit 8bfe8442ff20fdc2d965c197103d935a99bd3296 upstream.
When controllers set the HCI_QUIRK_INVALID_BDADDR flag, it is required by userspace to program a valid public Bluetooth device address into the controller before it can be used.
After successful address configuration, the internal state changes and the controller runs the complete initialization procedure. However one small difference is that this is no longer the HCI_SETUP stage. The HCI_SETUP stage is only valid during initial controller setup. In this case the stack runs the initialization as part of the HCI_CONFIG stage.
The controller version information, default name and supported commands are only stored during HCI_SETUP. While these information are static, they are not read initially when HCI_QUIRK_INVALID_BDADDR is set. So when running in HCI_CONFIG state, these information need to be updated as well.
This especially impacts Bluetooth 4.1 and later controllers using extended feature pages and second event mask page.
--- net/bluetooth/hci_event.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/bluetooth/hci_event.c +6 -3
@@ -239,7 +239,8 @@ static void hci_cc_read_local_name(strucif (rp->status)return ; -if (test_bit (HCI_SETUP , &hdev->dev_flags)) +if (test_bit (HCI_SETUP , &hdev->dev_flags) || +test_bit (HCI_CONFIG , &hdev->dev_flags))memcpy (hdev->dev_name, rp->name,HCI_MAX_NAME_LENGTH ); }
@@ -494,7 +495,8 @@ static void hci_cc_read_local_version(stif (rp->status)return ; -if (test_bit (HCI_SETUP , &hdev->dev_flags)) { +if (test_bit (HCI_SETUP , &hdev->dev_flags) || +test_bit (HCI_CONFIG , &hdev->dev_flags)) { hdev->hci_ver = rp->hci_ver; hdev->hci_rev =__le16_to_cpu (rp->hci_rev); hdev->lmp_ver = rp->lmp_ver;
@@ -513,7 +515,8 @@ static void hci_cc_read_local_commands(sif (rp->status)return ; -if (test_bit (HCI_SETUP , &hdev->dev_flags)) +if (test_bit (HCI_SETUP , &hdev->dev_flags) || +test_bit (HCI_CONFIG , &hdev->dev_flags))memcpy (hdev->commands, rp->commands,sizeof (hdev->commands)); }
Greg Kroah-Hartman
maintainerPATCH 38/150 PCI: Restore detection of read-only BARs
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myron Stowe <[email protected]>
commit 36e8164882ca6d3c41cb91e6f09a3ed236841f80 upstream.
Commit 6ac665c63dca ("PCI: rewrite PCI BAR reading code") masked off low-order bits from 'l', but not from 'sz'. Both are passed to pci_size(), which compares 'base == maxbase' to check for read-only BARs. The masking of 'l' means that comparison will never be 'true', so the check for read-only BARs no longer works.
Resolve this by also masking off the low-order bits of 'sz' before passing it into pci_size() as 'maxbase'. With this change, pci_size() will once again catch the problems that have been encountered to date:
- AGP aperture BAR of AMD-7xx host bridges: if the AGP window is
disabled, this BAR is read-only and read as 0x00000008 [1]
- BARs 0-4 of ALi IDE controllers can be non-zero and read-only [1]
- Intel Sandy Bridge - Thermal Management Controller [8086:0103];
BAR 0 returning 0xfed98004 [2]
- Intel Xeon E5 v3/Core i7 Power Control Unit [8086:2fc0];
Bar 0 returning 0x00001a [3]--- drivers/pci/probe.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/pci/probe.c +3 -0
@@ -216,14 +216,17 @@ int __pci_read_base(struct pci_dev *dev, res->flags |=IORESOURCE_SIZEALIGN ;if (res->flags &IORESOURCE_IO ) { l &=PCI_BASE_ADDRESS_IO_MASK ; + sz &=PCI_BASE_ADDRESS_IO_MASK ; mask =PCI_BASE_ADDRESS_IO_MASK & (u32 )IO_SPACE_LIMIT ; }else { l &=PCI_BASE_ADDRESS_MEM_MASK ; + sz &=PCI_BASE_ADDRESS_MEM_MASK ; mask = (u32 )PCI_BASE_ADDRESS_MEM_MASK ; } }else { res->flags |= (l &IORESOURCE_ROM_ENABLE ); l &=PCI_ROM_ADDRESS_MASK ; + sz &=PCI_ROM_ADDRESS_MASK ; mask = (u32 )PCI_ROM_ADDRESS_MASK ; }
Greg Kroah-Hartman
maintainerPATCH 39/150 brcmfmac: Fix ifidx for rx data by msgbuf.
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hante Meuleman <[email protected]>
commit 94a612086f5e78272e831c04b673778f8546ea73 upstream.
The ifidx provided by FW needs to be offsetted when receiving data packets.
--- drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c +9 -0
@@ -1081,8 +1081,17 @@ brcmf_msgbuf_rx_skb(struct brcmf_msgbuf {struct brcmf_if *ifp; +/* The ifidx is the idx to map to matching netdev/ifp. When receiving +* events this is easy because it contains the bssidx which maps +* 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd. +* bssidx 1 is used for p2p0 and no data can be received or +* transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0 +*/ +if (ifidx) + (ifidx)++; ifp = msgbuf->drvr->iflist[ifidx];if (!ifp || !ifp->ndev) { +brcmf_err ("Received pkt for invalid ifidx %d\n" , ifidx);brcmu_pkt_buf_free_skb (skb);return ; }
Greg Kroah-Hartman
maintainerPATCH 40/150 pstore-ram: Fix hangs by using write-combine mappings
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Herring <[email protected]>
commit 7ae9cb81933515dc7db1aa3c47ef7653717e3090 upstream.
Currently trying to use pstore on at least ARMs can hang as we're mapping the peristent RAM with pgprot_noncached().
On ARMs, pgprot_noncached() will actually make the memory strongly ordered, and as the atomic operations pstore uses are implementation defined for strongly ordered memory, they may not work. So basically atomic operations have undefined behavior on ARM for device or strongly ordered memory types.
Let's fix the issue by using write-combine variants for mappings. This corresponds to normal, non-cacheable memory on ARM. For many other architectures, this change does not change the mapping type as by default we have:
#define pgprot_writecombine pgprot_noncached
The reason why pgprot_noncached() was originaly used for pstore is because Colin Cross <[email protected]> had observed lost debug prints right before a device hanging write operation on some systems. For the platforms supporting pgprot_noncached(), we can add a an optional configuration option to support that. But let's get pstore working first before adding new features.
--- fs/pstore/ram_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/pstore/ram_core.c +2 -2
@@ -392,7 +392,7 @@ static void *persistent_ram_vmap(phys_ad page_start = start -offset_in_page (start); page_count =DIV_ROUND_UP (size +offset_in_page (start),PAGE_SIZE ); - prot =pgprot_noncached (PAGE_KERNEL ); + prot =pgprot_writecombine (PAGE_KERNEL ); pages =kmalloc_array (page_count,sizeof (struct page *),GFP_KERNEL );if (!pages) {
@@ -422,7 +422,7 @@ static void *persistent_ram_iomap(phys_a buffer_start_add = buffer_start_add_locked; buffer_size_add = buffer_size_add_locked; -return ioremap (start, size); +return ioremap_wc (start, size); } static int persistent_ram_buffer_map(phys_addr_t start, phys_addr_t size,
Greg Kroah-Hartman
maintainerPATCH 41/150 pstore-ram: Allow optional mapping with pgprot_noncached
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tony Lindgren <[email protected]>
commit 027bc8b08242c59e19356b4b2c189f2d849ab660 upstream.
On some ARMs the memory can be mapped pgprot_noncached() and still be working for atomic operations. As pointed out by Colin Cross <[email protected]>, in some cases you do want to use pgprot_noncached() if the SoC supports it to see a debug printk just before a write hanging the system.
On ARMs, the atomic operations on strongly ordered memory are implementation defined. So let's provide an optional kernel parameter for configuring pgprot_noncached(), and use pgprot_writecombine() by default.
--- Documentation/ramoops.txt | 13 +++++++++++-- fs/pstore/ram.c | 13 +++++++++++-- fs/pstore/ram_core.c | 31 ++++++++++++++++++++++--------- include/linux/pstore_ram.h | 4 +++- 4 files changed, 47 insertions(+), 14 deletions(-)
Documentation/ramoops.txt +11 -2
@@ -14,11 +14,19 @@ survive after a restart. 1. Ramoops concepts -Ramoops uses a predefined memory area to store the dump. The start and size of -the memory area are set using two variables: +Ramoops uses a predefined memory area to store the dump. The start and size +and type of the memory area are set using three variables: * "mem_address" for the start * "mem_size" for the size. The memory size will be rounded down to a power of two. + * "mem_type" to specifiy if the memory type (default is pgprot_writecombine). + +Typically the default value of mem_type=0 should be used as that sets the pstore +mapping to pgprot_writecombine. Setting mem_type=1 attempts to use +pgprot_noncached, which only works on some platforms. This is because pstore +depends on atomic operations. At least on ARM, pgprot_noncached causes the +memory to be mapped strongly ordered, and atomic operations on strongly ordered +memory are implementation defined, and won't work on many ARMs such as omaps. The memory area is divided into "record_size" chunks (also rounded down to power of two) and each oops/panic writes a "record_size" chunk of
@@ -55,6 +63,7 @@ Setting the ramoops parameters can be do static struct ramoops_platform_data ramoops_data = { .mem_size = <...>, .mem_address = <...>, + .mem_type = <...>, .record_size = <...>, .dump_oops = <...>, .ecc = <...>,
fs/pstore/ram.c +11 -2
@@ -61,6 +61,11 @@ module_param(mem_size, ulong, 0400);MODULE_PARM_DESC (mem_size,"size of reserved RAM used to store oops/panic logs" ); +static unsigned int mem_type; +module_param (mem_type, uint,0600 ); +MODULE_PARM_DESC (mem_type, +"set to 1 to try to use unbuffered memory (default 0)" ); +static int dump_oops =1 ;module_param (dump_oops, int,0600 ); MODULE_PARM_DESC(dump_oops,
@@ -79,6 +84,7 @@ struct ramoops_context {struct persistent_ram_zone *fprz;phys_addr_t phys_addr;unsigned long size; +unsigned int memtype;size_t record_size;size_t console_size;size_t ftrace_size;
@@ -358,7 +364,8 @@ static int ramoops_init_przs(struct devisize_t sz = cxt->record_size; cxt->przs[i] =persistent_ram_new (*paddr, sz,0 , - &cxt->ecc_info); + &cxt->ecc_info, + cxt->memtype);if (IS_ERR (cxt->przs[i])) { err =PTR_ERR (cxt->przs[i]); dev_err(dev, "failed to request mem region (0x%zx@0x%llx): %d\n",
@@ -388,7 +395,7 @@ static int ramoops_init_prz(struct devicreturn -ENOMEM ; } - *prz =persistent_ram_new (*paddr, sz, sig, &cxt->ecc_info); + *prz =persistent_ram_new (*paddr, sz, sig, &cxt->ecc_info, cxt->memtype);if (IS_ERR (*prz)) {int err =PTR_ERR (*prz);
@@ -435,6 +442,7 @@ static int ramoops_probe(struct platform cxt->size = pdata->mem_size; cxt->phys_addr = pdata->mem_address; + cxt->memtype = pdata->mem_type; cxt->record_size = pdata->record_size; cxt->console_size = pdata->console_size; cxt->ftrace_size = pdata->ftrace_size;
@@ -564,6 +572,7 @@ static void ramoops_register_dummy(void) dummy_data->mem_size = mem_size; dummy_data->mem_address = mem_address; + dummy_data->mem_type =0 ; dummy_data->record_size = record_size; dummy_data->console_size = ramoops_console_size; dummy_data->ftrace_size = ramoops_ftrace_size;
fs/pstore/ram_core.c +22 -9
@@ -380,7 +380,8 @@ void persistent_ram_zap(struct persistenpersistent_ram_update_header_ecc (prz); } -static void *persistent_ram_vmap (phys_addr_t start,size_t size) +static void *persistent_ram_vmap (phys_addr_t start,size_t size, +unsigned int memtype) {struct page **pages;phys_addr_t page_start;
@@ -392,7 +393,10 @@ static void *persistent_ram_vmap(phys_ad page_start = start -offset_in_page (start); page_count =DIV_ROUND_UP (size +offset_in_page (start),PAGE_SIZE ); - prot =pgprot_writecombine (PAGE_KERNEL ); +if (memtype) + prot =pgprot_noncached (PAGE_KERNEL ); +else + prot =pgprot_writecombine (PAGE_KERNEL ); pages =kmalloc_array (page_count,sizeof (struct page *),GFP_KERNEL );if (!pages) {
@@ -411,8 +415,11 @@ static void *persistent_ram_vmap(phys_adreturn vaddr; } -static void *persistent_ram_iomap (phys_addr_t start,size_t size) +static void *persistent_ram_iomap (phys_addr_t start,size_t size, +unsigned int memtype) { +void *va; +if (!request_mem_region (start, size,"persistent_ram" )) {pr_err ("request mem region (0x%llx@0x%llx) failed\n" , (unsigned long long )size, (unsigned long long )start);
@@ -422,19 +429,24 @@ static void *persistent_ram_iomap(phys_a buffer_start_add = buffer_start_add_locked; buffer_size_add = buffer_size_add_locked; -return ioremap_wc (start, size); +if (memtype) + va =ioremap (start, size); +else + va =ioremap_wc (start, size); + +return va; }static int persistent_ram_buffer_map (phys_addr_t start,phys_addr_t size, -struct persistent_ram_zone *prz) +struct persistent_ram_zone *prz,int memtype) { prz->paddr = start; prz->size = size;if (pfn_valid (start >>PAGE_SHIFT )) - prz->vaddr =persistent_ram_vmap (start, size); + prz->vaddr =persistent_ram_vmap (start, size, memtype);else - prz->vaddr =persistent_ram_iomap (start, size); + prz->vaddr =persistent_ram_iomap (start, size, memtype);if (!prz->vaddr) { pr_err("%s: Failed to map 0x%llx pages at 0x%llx\n", __func__,
@@ -500,7 +512,8 @@ void persistent_ram_free(struct persiste }struct persistent_ram_zone *persistent_ram_new (phys_addr_t start,size_t size, -u32 sig,struct persistent_ram_ecc_info *ecc_info) +u32 sig,struct persistent_ram_ecc_info *ecc_info, +unsigned int memtype) {struct persistent_ram_zone *prz;int ret = -ENOMEM ;
@@ -511,7 +524,7 @@ struct persistent_ram_zone *persistent_r goto err; } - ret =persistent_ram_buffer_map (start, size, prz); + ret =persistent_ram_buffer_map (start, size, prz, memtype);if (ret) goto err;
include/linux/pstore_ram.h +3 -1
@@ -53,7 +53,8 @@ struct persistent_ram_zone { };struct persistent_ram_zone *persistent_ram_new (phys_addr_t start,size_t size, -u32 sig,struct persistent_ram_ecc_info *ecc_info); +u32 sig,struct persistent_ram_ecc_info *ecc_info, +unsigned int memtype);void persistent_ram_free (struct persistent_ram_zone *prz);void persistent_ram_zap (struct persistent_ram_zone *prz);
@@ -76,6 +77,7 @@ ssize_t persistent_ram_ecc_string(structstruct ramoops_platform_data {unsigned long mem_size;unsigned long mem_address; +unsigned int mem_type;unsigned long record_size;unsigned long console_size;unsigned long ftrace_size;
Greg Kroah-Hartman
maintainerPATCH 42/150 UBI: Fix invalid vfree()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit f38aed975c0c3645bbdfc5ebe35726e64caaf588 upstream.
The logic of vfree()'ing vol->upd_buf is tied to vol->updating. In ubi_start_update() vol->updating is set long before vmalloc()'ing vol->upd_buf. If we encounter a write failure in ubi_start_update() before vmalloc() the UBI device release function will try to vfree() vol->upd_buf because vol->updating is set.
Fix this by allocating vol->upd_buf directly after setting vol->updating.
Fixes:
[ 31.559338] UBI warning: vol_cdev_release: update of volume 2 not finished, volume is damaged [ 31.559340] ------------[ cut here ]------------ [ 31.559343] WARNING: CPU: 1 PID: 2747 at mm/vmalloc.c:1446 __vunmap+0xe3/0x110() [ 31.559344] Trying to vfree() nonexistent vm area (ffffc90001f2b000) [ 31.559345] Modules linked in: [ 31.565620] 0000000000000bba ffff88002a0cbdb0 ffffffff818f0497 ffff88003b9ba148 [ 31.566347] ffff88002a0cbde0 ffffffff8156f515 ffff88003b9ba148 0000000000000bba [ 31.567073] 0000000000000000 0000000000000000 ffff88002a0cbe88 ffffffff8156c10a [ 31.567793] Call Trace: [ 31.568034] [<ffffffff818f0497>] dump_stack+0x4e/0x7a [ 31.568510] [<ffffffff8156f515>] ubi_io_write_vid_hdr+0x155/0x160 [ 31.569084] [<ffffffff8156c10a>] ubi_eba_write_leb+0x23a/0x870 [ 31.569628] [<ffffffff81569b36>] vol_cdev_write+0x226/0x380 [ 31.570155] [<ffffffff81179265>] vfs_write+0xb5/0x1f0 [ 31.570627] [<ffffffff81179f8a>] SyS_pwrite64+0x6a/0xa0 [ 31.571123] [<ffffffff818fde12>] system_call_fastpath+0x16/0x1b
--- drivers/mtd/ubi/upd.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/mtd/ubi/upd.c +6 -4
@@ -133,6 +133,10 @@ int ubi_start_update(struct ubi_device *ubi_assert (!vol->updating && !vol->changing_leb); vol->updating =1 ; + vol->upd_buf =vmalloc (ubi->leb_size); +if (!vol->upd_buf) +return -ENOMEM ; + err =set_update_marker (ubi, vol);if (err)return err;
@@ -152,14 +156,12 @@ int ubi_start_update(struct ubi_device * err =clear_update_marker (ubi, vol,0 );if (err)return err; + +vfree (vol->upd_buf); vol->updating =0 ;return 0 ; } - vol->upd_buf =vmalloc (ubi->leb_size); -if (!vol->upd_buf) -return -ENOMEM ; - vol->upd_ebs =div_u64 (bytes + vol->usable_leb_size -1 , vol->usable_leb_size); vol->upd_bytes = bytes;
Greg Kroah-Hartman
maintainerPATCH 43/150 UBI: Fix double free after do_sync_erase()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit aa5ad3b6eb8feb2399a5d26c8fb0060561bb9534 upstream.
If the erase worker is unable to erase a PEB it will free the ubi_wl_entry itself.
The failing ubi_wl_entry must not free()'d again after do_sync_erase() returns.
--- drivers/mtd/ubi/wl.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/mtd/ubi/wl.c +3 -7
@@ -1212,7 +1212,6 @@ static int wear_leveling_worker(struct u err =do_sync_erase (ubi, e1, vol_id, lnum,0 );if (err) { -kmem_cache_free (ubi_wl_entry_slab, e1);if (e2)kmem_cache_free (ubi_wl_entry_slab, e2); goto out_ro;
@@ -1226,10 +1225,8 @@ static int wear_leveling_worker(struct udbg_wl ("PEB %d (LEB %d:%d) was put meanwhile, erase" , e2->pnum, vol_id, lnum); err =do_sync_erase (ubi, e2, vol_id, lnum,0 ); -if (err) { -kmem_cache_free (ubi_wl_entry_slab, e2); +if (err) goto out_ro; - } }dbg_wl ("done" );
@@ -1265,10 +1262,9 @@ out_not_moved:ubi_free_vid_hdr (ubi, vid_hdr); err =do_sync_erase (ubi, e2, vol_id, lnum, torture); -if (err) { -kmem_cache_free (ubi_wl_entry_slab, e2); +if (err) goto out_ro; - } +mutex_unlock (&ubi->move_mutex);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 44/150 iommu/vt-d: Fix an off-by-one bug in __domain_mapping()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiang Liu <[email protected]>
commit cc4f14aa170d895c9a43bdb56f62070c8a6da908 upstream.
There's an off-by-one bug in function __domain_mapping(), which may trigger the BUG_ON(nr_pages < lvl_pages) when
(nr_pages + 1) & superpage_mask == 0
The issue was introduced by commit 9051aa0268dc "intel-iommu: Combine domain_pfn_mapping() and domain_sg_mapping()", which sets sg_res to "nr_pages + 1" to avoid some of the 'sg_res==0' code paths.
It's safe to remove extra "+1" because sg_res is only used to calculate page size now.
--- drivers/iommu/intel-iommu.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/iommu/intel-iommu.c +3 -5
@@ -1983,7 +1983,7 @@ static int __domain_mapping(struct dmar_ {struct dma_pte *first_pte =NULL , *pte =NULL ;phys_addr_t uninitialized_var (pteval ); -unsigned long sg_res; +unsigned long sg_res =0 ;unsigned int largepage_lvl =0 ;unsigned long lvl_pages =0 ;
@@ -1994,10 +1994,8 @@ static int __domain_mapping(struct dmar_ prot &=DMA_PTE_READ |DMA_PTE_WRITE |DMA_PTE_SNP ; -if (sg) - sg_res =0 ; -else { - sg_res = nr_pages +1 ; +if (!sg) { + sg_res = nr_pages; pteval = ((phys_addr_t )phys_pfn <<VTD_PAGE_SHIFT ) | prot; }
Greg Kroah-Hartman
maintainerPATCH 45/150 iommu/vt-d: Fix dmar_domain leak in iommu_attach_device
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joerg Roedel <[email protected]>
commit 62c22167dd70b730f61c2b88f950e98154a87980 upstream.
Since commit 1196c2f a domain is only destroyed in the notifier path if it is hot-unplugged. This caused a domain leakage in iommu_attach_device when a driver was unbound from the device and bound to VFIO. In this case the device is attached to a new domain and unlinked from the old domain. At this point nothing points to the old domain anymore and its memory is leaked.
Fix this by explicitly freeing the old domain in iommu_attach_domain.
--- drivers/iommu/intel-iommu.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/iommu/intel-iommu.c +4 -0
@@ -4265,6 +4265,10 @@ static int intel_iommu_attach_device(strdomain_remove_one_dev_info (old_domain, dev); elsedomain_remove_dev_info (old_domain ); + +if (!domain_type_is_vm_or_si (old_domain) && +list_empty (&old_domain->devices)) +domain_exit (old_domain); } }
Greg Kroah-Hartman
maintainerPATCH 46/150 blk-mq: use nr_cpu_ids as highest CPU ID count for hwq <-> cpu map
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
commit a33c1ba2913802b6fb23e974bb2f6a4e73c8b7ce upstream.
We currently use num_possible_cpus(), but that breaks on sparc64 where the CPU ID space is discontig. Use nr_cpu_ids as the highest CPU ID instead, so we don't end up reading from invalid memory.
--- block/blk-mq-cpumap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-mq-cpumap.c +1 -1
@@ -90,7 +90,7 @@ unsigned int *blk_mq_make_queue_map(struunsigned int *map;/* If cpus are offline, map them to first hctx */ - map =kzalloc_node (sizeof (*map) *num_possible_cpus (),GFP_KERNEL , + map =kzalloc_node (sizeof (*map) * nr_cpu_ids,GFP_KERNEL , set->numa_node);if (!map)return NULL ;
Greg Kroah-Hartman
maintainerPATCH 47/150 blk-mq: Fix a use-after-free
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 45a9c9d909b24c6ad0e28a7946e7486e73010319 upstream.
blk-mq users are allowed to free the memory request_queue.tag_set points at after blk_cleanup_queue() has finished but before blk_release_queue() has started. This can happen e.g. in the SCSI core. The SCSI core namely embeds the tag_set structure in a SCSI host structure. The SCSI host structure is freed by scsi_host_dev_release(). This function is called after blk_cleanup_queue() finished but can be called before blk_release_queue().
This means that it is not safe to access request_queue.tag_set from inside blk_release_queue(). Hence remove the blk_sync_queue() call from blk_release_queue(). This call is not necessary - outstanding requests must have finished before blk_release_queue() is called. Additionally, move the blk_mq_free_queue() call from blk_release_queue() to blk_cleanup_queue() to avoid that struct request_queue.tag_set gets accessed after it has been freed.
This patch avoids that the following kernel oops can be triggered when deleting a SCSI host for which scsi-mq was enabled:
Call Trace: [<ffffffff8109a7c4>] lock_acquire+0xc4/0x270 [<ffffffff814ce111>] mutex_lock_nested+0x61/0x380 [<ffffffff812575f0>] blk_mq_free_queue+0x30/0x180 [<ffffffff8124d654>] blk_release_queue+0x84/0xd0 [<ffffffff8126c29b>] kobject_cleanup+0x7b/0x1a0 [<ffffffff8126c140>] kobject_put+0x30/0x70 [<ffffffff81245895>] blk_put_queue+0x15/0x20 [<ffffffff8125c409>] disk_release+0x99/0xd0 [<ffffffff8133d056>] device_release+0x36/0xb0 [<ffffffff8126c29b>] kobject_cleanup+0x7b/0x1a0 [<ffffffff8126c140>] kobject_put+0x30/0x70 [<ffffffff8125a78a>] put_disk+0x1a/0x20 [<ffffffff811d4cb5>] __blkdev_put+0x135/0x1b0 [<ffffffff811d56a0>] blkdev_put+0x50/0x160 [<ffffffff81199eb4>] kill_block_super+0x44/0x70 [<ffffffff8119a2a4>] deactivate_locked_super+0x44/0x60 [<ffffffff8119a87e>] deactivate_super+0x4e/0x70 [<ffffffff811b9833>] cleanup_mnt+0x43/0x90 [<ffffffff811b98d2>] __cleanup_mnt+0x12/0x20 [<ffffffff8107252c>] task_work_run+0xac/0xe0 [<ffffffff81002c01>] do_notify_resume+0x61/0xa0 [<ffffffff814d2c58>] int_signal+0x12/0x17
--- block/blk-core.c | 3 +++ block/blk-sysfs.c | 12 ++++-------- 2 files changed, 7 insertions(+), 8 deletions(-)
block/blk-core.c +3 -0
@@ -525,6 +525,9 @@ void blk_cleanup_queue(struct request_qudel_timer_sync (&q->backing_dev_info.laptop_mode_wb_timer);blk_sync_queue (q); +if (q->mq_ops) +blk_mq_free_queue (q); +spin_lock_irq (lock);if (q->queue_lock != &q->__queue_lock) q->queue_lock = &q->__queue_lock;
block/blk-sysfs.c +4 -8
@@ -492,17 +492,15 @@ static void blk_free_queue_rcu(struct rc* Currently, its primary task it to free all the &struct request * structures that were allocated to the queue and the queue itself. * -* Caveat: -* Hopefully the low level driver will have finished any -* outstanding requests first... +* Note: +* The low level driver must have finished any outstanding requests first +* via blk_cleanup_queue(). **/ static void blk_release_queue (struct kobject *kobj) {struct request_queue *q = container_of(kobj, struct request_queue, kobj); -blk_sync_queue (q); -blkcg_exit_queue (q);if (q->elevator) {
@@ -517,9 +515,7 @@ static void blk_release_queue(struct kobif (q->queue_tags)__blk_queue_free_tags (q); -if (q->mq_ops) -blk_mq_free_queue (q); -else +if (!q->mq_ops)blk_free_flush_queue (q->fq);blk_trace_shutdown (q);
Greg Kroah-Hartman
maintainerPATCH 48/150 blk-mq: Avoid that __bt_get_word() wraps multiple times
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 9e98e9d7cf6e9d2ec1cce45e8d5ccaf3f9b386f3 upstream.
If __bt_get_word() is called with last_tag != 0, if the first find_next_zero_bit() fails, if after wrap-around the test_and_set_bit() call fails and find_next_zero_bit() succeeds, if the next test_and_set_bit() call fails and subsequently find_next_zero_bit() does not find a zero bit, then another wrap-around will occur. Avoid this by introducing an additional local variable.
--- block/blk-mq-tag.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
block/blk-mq-tag.c +4 -2
@@ -137,6 +137,7 @@ static inline bool hctx_may_queue(structstatic int __bt_get_word (struct blk_align_bitmap *bm,unsigned int last_tag) {int tag, org_last_tag, end; +bool wrap = last_tag !=0 ; org_last_tag = last_tag; end = bm->depth;
@@ -148,8 +149,9 @@ restart:* We started with an offset, start from 0 to * exhaust the map. */ -if (org_last_tag && last_tag) { - end = last_tag; +if (wrap) { + wrap = false; + end = org_last_tag; last_tag =0 ; goto restart; }
Greg Kroah-Hartman
maintainerPATCH 49/150 blk-mq: Fix a race between bt_clear_tag() and bt_get()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit c38d185d4af12e8be63ca4b6745d99449c450f12 upstream.
What we need is the following two guarantees:
* Any thread that observes the effect of the test_and_set_bit() by __bt_get_word() also observes the preceding addition of 'current' to the appropriate wait list. This is guaranteed by the semantics of the spin_unlock() operation performed by prepare_and_wait(). Hence the conversion of test_and_set_bit_lock() into test_and_set_bit().
* The wait lists are examined by bt_clear() after the tag bit has been cleared. clear_bit_unlock() guarantees that any thread that observes that the bit has been cleared also observes the store operations preceding clear_bit_unlock(). However, clear_bit_unlock() does not prevent that the wait lists are examined before that the tag bit is cleared. Hence the addition of a memory barrier between clear_bit() and the wait list examination.
--- block/blk-mq-tag.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
block/blk-mq-tag.c +5 -6
@@ -158,7 +158,7 @@ restart:return -1 ; } last_tag = tag +1 ; - }while (test_and_set_bit_lock (tag, &bm->word)); + }while (test_and_set_bit (tag, &bm->word));return tag; }
@@ -342,11 +342,10 @@ static void bt_clear_tag(struct blk_mq_bstruct bt_wait_state *bs;int wait_cnt; -/* -* The unlock memory barrier need to order access to req in free -* path and clearing tag bit -*/ -clear_bit_unlock (TAG_TO_BIT (bt, tag), &bt->map[index].word); +clear_bit (TAG_TO_BIT (bt, tag), &bt->map[index].word); + +/* Ensure that the wait list checks occur after clear_bit(). */ +smp_mb (); bs =bt_wake_ptr (bt);if (!bs)
Greg Kroah-Hartman
maintainerPATCH 50/150 blk-mq: Fix uninitialized kobject at CPU hotplugging
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 06a41a99d13d8e919e9a00a4849e6b85ae492592 upstream.
When a CPU is hotplugged, the current blk-mq spews a warning like:
kobject '(null)' (ffffe8ffffc8b5d8): tried to add an uninitialized object, something is seriously wrong.
CPU: 1 PID: 1386 Comm: systemd-udevd Not tainted 3.18.0-rc7-2.g088d59b-default #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_171129-lamiak 04/01/2014 0000000000000000 0000000000000002 ffffffff81605f07 ffffe8ffffc8b5d8 ffffffff8132c7a0 ffff88023341d370 0000000000000020 ffff8800bb05bd58 ffff8800bb05bd08 000000000000a0a0 000000003f441940 0000000000000007 Call Trace: [<ffffffff81005306>] dump_trace+0x86/0x330 [<ffffffff81005644>] show_stack_log_lvl+0x94/0x170 [<ffffffff81006d21>] show_stack+0x21/0x50 [<ffffffff81605f07>] dump_stack+0x41/0x51 [<ffffffff8132c7a0>] kobject_add+0xa0/0xb0 [<ffffffff8130aee1>] blk_mq_register_hctx+0x91/0xb0 [<ffffffff8130b82e>] blk_mq_sysfs_register+0x3e/0x60 [<ffffffff81309298>] blk_mq_queue_reinit_notify+0xf8/0x190 [<ffffffff8107cfdc>] notifier_call_chain+0x4c/0x70 [<ffffffff8105fd23>] cpu_notify+0x23/0x50 [<ffffffff81060037>] _cpu_up+0x157/0x170 [<ffffffff810600d9>] cpu_up+0x89/0xb0 [<ffffffff815fa5b5>] cpu_subsys_online+0x35/0x80 [<ffffffff814323cd>] device_online+0x5d/0xa0 [<ffffffff81432485>] online_store+0x75/0x80 [<ffffffff81236a5a>] kernfs_fop_write+0xda/0x150 [<ffffffff811c5532>] vfs_write+0xb2/0x1f0 [<ffffffff811c5f42>] SyS_write+0x42/0xb0 [<ffffffff8160c4ed>] system_call_fastpath+0x16/0x1b [<00007f0132fb24e0>] 0x7f0132fb24e0
This is indeed because of an uninitialized kobject for blk_mq_ctx. The blk_mq_ctx kobjects are initialized in blk_mq_sysfs_init(), but it goes loop over hctx_for_each_ctx(), i.e. it initializes only for online CPUs. Thus, when a CPU is hotplugged, the ctx for the newly onlined CPU is registered without initialization.
This patch fixes the issue by initializing the all ctx kobjects belonging to each queue.
Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=908794
--- block/blk-mq-sysfs.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
block/blk-mq-sysfs.c +4 -5
@@ -390,16 +390,15 @@ static void blk_mq_sysfs_init(struct req {struct blk_mq_hw_ctx *hctx;struct blk_mq_ctx *ctx; -int i, j; +int i;kobject_init (&q->mq_kobj, &blk_mq_ktype); -queue_for_each_hw_ctx (q, hctx, i) { +queue_for_each_hw_ctx (q, hctx, i)kobject_init (&hctx->kobj, &blk_mq_hw_ktype); -hctx_for_each_ctx (hctx, ctx, j) -kobject_init (&ctx->kobj, &blk_mq_ctx_ktype); - } +queue_for_each_ctx (q, ctx, i) +kobject_init (&ctx->kobj, &blk_mq_ctx_ktype); }/* see blk_register_queue() */
Greg Kroah-Hartman
maintainerPATCH 51/150 HID: yet another buggy ELAN touchscreen
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit a32c99e7ab8410bae7c276a7e94ca84d108de034 upstream.
The touchscreen needs the same quirk as the other models.
--- drivers/hid/hid-ids.h | 1 + drivers/hid/usbhid/hid-quirks.c | 1 + drivers/usb/core/quirks.c | 3 +++ 3 files changed, 5 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -300,6 +300,7 @@#define USB_DEVICE_ID_ELAN_TOUCHSCREEN 0x0089#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B 0x009b#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103 0x0103 +#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_010c 0x010c#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F 0x016f#define USB_VENDOR_ID_ELECOM 0x056e
drivers/hid/usbhid/hid-quirks.c +1 -0
@@ -73,6 +73,7 @@ static const struct hid_blacklist { { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN, HID_QUIRK_ALWAYS_POLL }, { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B, HID_QUIRK_ALWAYS_POLL }, { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103, HID_QUIRK_ALWAYS_POLL }, + { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_010c, HID_QUIRK_ALWAYS_POLL }, { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F, HID_QUIRK_ALWAYS_POLL }, { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS },
drivers/usb/core/quirks.c +3 -0
@@ -103,6 +103,9 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x04f3, 0x009b), .driver_info = USB_QUIRK_DEVICE_QUALIFIER }, + { USB_DEVICE(0x04f3, 0x010c), .driver_info = + USB_QUIRK_DEVICE_QUALIFIER }, + { USB_DEVICE(0x04f3, 0x016f), .driver_info = USB_QUIRK_DEVICE_QUALIFIER },
Greg Kroah-Hartman
maintainerPATCH 52/150 HID: wacom: re-add accidentally dropped Lenovo PID
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Tissoires <[email protected]>
commit 00d6f227a5905be47006abcc1f417d069ecc3711 upstream.
Dropped in the following commit:
commit a3e6f6543d19 ("Input: wacom - keep wacom_ids ordered")
--- drivers/hid/wacom_wac.c | 1 + 1 file changed, 1 insertion(+)
drivers/hid/wacom_wac.c +1 -0
@@ -3026,6 +3026,7 @@ const struct hid_device_id wacom_ids[] = { USB_DEVICE_WACOM(0x4004) }, { USB_DEVICE_WACOM(0x5000) }, { USB_DEVICE_WACOM(0x5002) }, + { USB_DEVICE_LENOVO(0x6004) }, { USB_DEVICE_WACOM(HID_ANY_ID) }, { }
Greg Kroah-Hartman
maintainerPATCH 53/150 HID: wacom: fix freeze on open when autosuspend is on
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Tissoires <[email protected]>
commit dff674168878fe7b6d8b9ad60d62295ec517de79 upstream.
Since the conversion from USB to HID (in v3.17), some people reported a freeze on boot with the wacom driver. Hans managed to get a stacktrace:
[ 240.272331] Call Trace: [ 240.272338] [<ffffffff813de7b9>] ? usb_hcd_submit_urb+0xa9/0xb10 [ 240.272347] [<ffffffff81555579>] schedule+0x29/0x70 [ 240.272355] [<ffffffff815559e6>] schedule_preempt_disabled+0x16/0x20 [ 240.272363] [<ffffffff81557365>] __mutex_lock_slowpath+0xe5/0x230 [ 240.272372] [<ffffffff815574c7>] mutex_lock+0x17/0x30 [ 240.272380] [<ffffffffa063c1d2>] wacom_resume+0x22/0x50 [wacom] [ 240.272396] [<ffffffffa01aea8a>] hid_resume_common+0xba/0x110 [usbhid] [ 240.272404] [<ffffffff813e5890>] ? usb_runtime_suspend+0x80/0x80 [ 240.272417] [<ffffffffa01aeb1d>] hid_resume+0x3d/0x70 [usbhid] [ 240.272425] [<ffffffff813e44a6>] usb_resume_interface.isra.6+0xb6/0x120 [ 240.272432] [<ffffffff813e4774>] usb_resume_both+0x74/0x140 [ 240.272439] [<ffffffff813e58aa>] usb_runtime_resume+0x1a/0x20 [ 240.272446] [<ffffffff813b1912>] __rpm_callback+0x32/0x70 [ 240.272453] [<ffffffff813b1976>] rpm_callback+0x26/0xa0 [ 240.272460] [<ffffffff813b2d71>] rpm_resume+0x4b1/0x690 [ 240.272468] [<ffffffff812ab992>] ? radix_tree_lookup_slot+0x22/0x50 [ 240.272475] [<ffffffff813b2c1a>] rpm_resume+0x35a/0x690 [ 240.272482] [<ffffffff8116e9c9>] ? zone_statistics+0x89/0xa0 [ 240.272489] [<ffffffff813b2f90>] __pm_runtime_resume+0x40/0x60 [ 240.272497] [<ffffffff813e4272>] usb_autopm_get_interface+0x22/0x60 [ 240.272509] [<ffffffffa01ae8d9>] usbhid_open+0x59/0xe0 [usbhid] [ 240.272517] [<ffffffffa063ac85>] wacom_open+0x35/0x50 [wacom] [ 240.272525] [<ffffffff813f37b9>] input_open_device+0x79/0xa0 [ 240.272534] [<ffffffffa048d1c1>] evdev_open+0x1b1/0x200 [evdev] [ 240.272543] [<ffffffff811c899e>] chrdev_open+0xae/0x1f0 [ 240.272549] [<ffffffff811c88f0>] ? cdev_put+0x30/0x30 [ 240.272556] [<ffffffff811c17e2>] do_dentry_open+0x1d2/0x320 [ 240.272562] [<ffffffff811c1cd1>] finish_open+0x31/0x50 [ 240.272571] [<ffffffff811d2202>] do_last.isra.36+0x652/0xe50 [ 240.272579] [<ffffffff811d2ac7>] path_openat+0xc7/0x6f0 [ 240.272586] [<ffffffff811cf012>] ? final_putname+0x22/0x50 [ 240.272594] [<ffffffff811d42d2>] ? user_path_at_empty+0x72/0xd0 [ 240.272602] [<ffffffff811d43fd>] do_filp_open+0x4d/0xc0
[...]
So here, wacom_open is called, and then wacom_resume is called by the PM system. However, wacom_open already took the lock when wacom_resume tries to get it. Freeze.
A little bit of history shows that this already happened in the past
- commit f6cd378372bf ("Input: wacom - fix runtime PM related deadlock"), and the solution was to call first the PM function before taking the lock.
The lock was introduced in commit commit e722409445fb ("Input: wacom - implement suspend and autosuspend") when the autosuspend feature has been added. Given that usbhid already takes care of this very same locking between suspend/resume, I think we can simply kill the lock in open/close.
The lock is now used also with LEDs, so we can not remove it completely.
--- drivers/hid/wacom_sys.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/hid/wacom_sys.c +1 -8
@@ -70,22 +70,15 @@ static int wacom_raw_event(struct hid_destatic int wacom_open (struct input_dev *dev) {struct wacom *wacom =input_get_drvdata (dev); -int retval; -mutex_lock (&wacom->lock); - retval =hid_hw_open (wacom->hdev); -mutex_unlock (&wacom->lock); - -return retval; +return hid_hw_open (wacom->hdev); }static void wacom_close (struct input_dev *dev) {struct wacom *wacom =input_get_drvdata (dev); -mutex_lock (&wacom->lock);hid_hw_close (wacom->hdev); -mutex_unlock (&wacom->lock); }/*
Greg Kroah-Hartman
maintainerPATCH 54/150 HID: i2c-hid: fix race condition reading reports
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean-Baptiste Maneyrol <[email protected]>
commit 6296f4a8eb86f9abcc370fb7a1a116b8441c17fd upstream.
Current driver uses a common buffer for reading reports either synchronously in i2c_hid_get_raw_report() and asynchronously in the interrupt handler.
There is race condition if an interrupt arrives immediately after the report is received in i2c_hid_get_raw_report(); the common buffer is modified by the interrupt handler with the new report and then i2c_hid_get_raw_report() proceed using wrong data.
Fix it by using a separate buffers for synchronous reports.
--- drivers/hid/i2c-hid/i2c-hid.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/hid/i2c-hid/i2c-hid.c +8 -4
@@ -137,6 +137,7 @@ struct i2c_hid {* descriptor. */ unsigned int bufsize;/* i2c buffer size */ char *inbuf;/* Input buffer */ +char *rawbuf;/* Raw Input buffer */ char *cmdbuf;/* Command buffer */ char *argsbuf;/* Command arguments buffer */
@@ -504,9 +505,11 @@ static void i2c_hid_find_max_report(strustatic void i2c_hid_free_buffers (struct i2c_hid *ihid) {kfree (ihid->inbuf); +kfree (ihid->rawbuf);kfree (ihid->argsbuf);kfree (ihid->cmdbuf); ihid->inbuf =NULL ; + ihid->rawbuf =NULL ; ihid->cmdbuf =NULL ; ihid->argsbuf =NULL ; ihid->bufsize =0 ;
@@ -522,10 +525,11 @@ static int i2c_hid_alloc_buffers(struct report_size;/* report */ ihid->inbuf =kzalloc (report_size,GFP_KERNEL ); + ihid->rawbuf =kzalloc (report_size,GFP_KERNEL ); ihid->argsbuf =kzalloc (args_len,GFP_KERNEL ); ihid->cmdbuf =kzalloc (sizeof (union command ) + args_len,GFP_KERNEL ); -if (!ihid->inbuf || !ihid->argsbuf || !ihid->cmdbuf) { +if (!ihid->inbuf || !ihid->rawbuf || !ihid->argsbuf || !ihid->cmdbuf) {i2c_hid_free_buffers (ihid);return -ENOMEM ; }
@@ -552,12 +556,12 @@ static int i2c_hid_get_raw_report(struct ret =i2c_hid_get_report (client, report_type ==HID_FEATURE_REPORT ?0x03 :0x01 , - report_number, ihid->inbuf, ask_count); + report_number, ihid->rawbuf, ask_count);if (ret <0 )return ret; - ret_count = ihid->inbuf[0 ] | (ihid->inbuf[1 ] <<8 ); + ret_count = ihid->rawbuf[0 ] | (ihid->rawbuf[1 ] <<8 );if (ret_count <=2 )return 0 ;
@@ -566,7 +570,7 @@ static int i2c_hid_get_raw_report(struct/* The query buffer contains the size, dropping it in the reply */ count =min (count, ret_count -2 ); -memcpy (buf, ihid->inbuf +2 , count); +memcpy (buf, ihid->rawbuf +2 , count);return count; }
Greg Kroah-Hartman
maintainerPATCH 55/150 HID: i2c-hid: prevent buffer overflow in early IRQ
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gwendal Grignou <[email protected]>
commit d1c7e29e8d276c669e8790bb8be9f505ddc48888 upstream.
Before ->start() is called, bufsize size is set to HID_MIN_BUFFER_SIZE, 64 bytes. While processing the IRQ, we were asking to receive up to wMaxInputLength bytes, which can be bigger than 64 bytes.
Later, when ->start is run, a proper bufsize will be calculated.
Given wMaxInputLength is said to be unreliable in other part of the code, set to receive only what we can even if it results in truncated reports.
--- drivers/hid/i2c-hid/i2c-hid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/i2c-hid/i2c-hid.c +1 -1
@@ -370,7 +370,7 @@ static int i2c_hid_hwreset(struct i2c_clstatic void i2c_hid_get_input (struct i2c_hid *ihid) {int ret, ret_size; -int size =le16_to_cpu (ihid->hdesc.wMaxInputLength); +int size = ihid->bufsize; ret =i2c_master_recv (ihid->client, ihid->inbuf, size);if (ret != size) {
Greg Kroah-Hartman
maintainerPATCH 56/150 HID: roccat: potential out of bounds in pyra_sysfs_write_settings()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 606185b20caf4c57d7e41e5a5ea4aff460aef2ab upstream.
This is a static checker fix. We write some binary settings to the sysfs file. One of the settings is the "->startup_profile". There isn't any checking to make sure it fits into the pyra->profile_settings[] array in the profile_activated() function.
I added a check to pyra_sysfs_write_settings() in both places because I wasn't positive that the other callers were correct.
--- drivers/hid/hid-roccat-pyra.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/hid/hid-roccat-pyra.c +6 -2
@@ -35,6 +35,8 @@ static struct class *pyra_class;static void profile_activated (struct pyra_device *pyra,unsigned int new_profile) { +if (new_profile >=ARRAY_SIZE (pyra->profile_settings)) +return ; pyra->actual_profile = new_profile; pyra->actual_cpi = pyra->profile_settings[pyra->actual_profile].y_cpi; }
@@ -257,9 +259,11 @@ static ssize_t pyra_sysfs_write_settingsif (off !=0 || count !=PYRA_SIZE_SETTINGS )return -EINVAL ; -mutex_lock (&pyra->pyra_lock); - settings = (struct pyra_settings const *)buf; +if (settings->startup_profile >=ARRAY_SIZE (pyra->profile_settings)) +return -EINVAL ; + +mutex_lock (&pyra->pyra_lock); retval =pyra_set_settings (usb_dev, settings);if (retval) {
Greg Kroah-Hartman
maintainerPATCH 57/150 HID: i2c-hid: Do not free buffers in i2c_hid_stop()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mika Westerberg <[email protected]>
commit 5b44c53aeb791757072be4a267255cedfff594fd upstream.
When a hid driver that uses i2c-hid as transport is unloaded, the hid core will call i2c_hid_stop() which releases all the buffers associated with the device. This includes also the command buffer.
Now, when the i2c-hid driver itself is unloaded it tries to power down the device by sending it PWR_SLEEP command. Since the command buffer is already released we get following crash:
[ 79.691459] BUG: unable to handle kernel NULL pointer dereference at (null) [ 79.691532] IP: [<ffffffffa05bc049>] __i2c_hid_command+0x49/0x310 [i2c_hid] ... [ 79.693467] Call Trace: [ 79.693494] [<ffffffff810424e1>] ? __unmask_ioapic+0x21/0x30 [ 79.693537] [<ffffffff81042855>] ? unmask_ioapic+0x25/0x40 [ 79.693581] [<ffffffffa05bc35b>] ? i2c_hid_set_power+0x4b/0xa0 [i2c_hid] [ 79.693632] [<ffffffffa05bc3cf>] ? i2c_hid_runtime_resume+0x1f/0x30 [i2c_hid] [ 79.693689] [<ffffffff814c08fb>] ? __rpm_callback+0x2b/0x70 [ 79.693733] [<ffffffff814c0961>] ? rpm_callback+0x21/0x90 [ 79.693776] [<ffffffff814c0dec>] ? rpm_resume+0x41c/0x600 [ 79.693820] [<ffffffff814c1e1c>] ? __pm_runtime_resume+0x4c/0x80 [ 79.693868] [<ffffffff814b8588>] ? __device_release_driver+0x28/0x100 [ 79.693917] [<ffffffff814b8d90>] ? driver_detach+0xa0/0xb0 [ 79.693959] [<ffffffff814b82cc>] ? bus_remove_driver+0x4c/0xb0 [ 79.694006] [<ffffffff810d1cfd>] ? SyS_delete_module+0x11d/0x1d0 [ 79.694054] [<ffffffff8165f107>] ? int_signal+0x12/0x17 [ 79.694095] [<ffffffff8165ee69>] ? system_call_fastpath+0x12/0x17
Fix this so that we only free buffers when the i2c-hid driver itself is removed.
--- drivers/hid/i2c-hid/i2c-hid.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/hid/i2c-hid/i2c-hid.c +0 -5
@@ -706,12 +706,7 @@ static int i2c_hid_start(struct hid_devistatic void i2c_hid_stop (struct hid_device *hid) { -struct i2c_client *client = hid->driver_data; -struct i2c_hid *ihid =i2c_get_clientdata (client); - hid->claimed =0 ; - -i2c_hid_free_buffers (ihid); }static int i2c_hid_open (struct hid_device *hid)
Greg Kroah-Hartman
maintainerPATCH 58/150 HID: add battery quirk for USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO keyboard
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Relton <[email protected]>
commit da940db41dcf8c04166f711646df2f35376010aa upstream.
Apple bluetooth wireless keyboard (sold in UK) has always reported zero for battery strength no matter what condition the batteries are actually in. With this patch applied (applying same quirk as other Apple keyboards), the battery strength is now correctly reported.
--- drivers/hid/hid-input.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/hid/hid-input.c +3 -0
@@ -312,6 +312,9 @@ static const struct hid_device_id hid_ba USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI), HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, +USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO ), + HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI ), HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, {}
Greg Kroah-Hartman
maintainerPATCH 60/150 x86: export get_xsave_addr
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Bonzini <[email protected]>
commit ba7b39203a3a18018173b87e73f27169bd8e5147 upstream.
get_xsave_addr is the API to access XSAVE states, and KVM would like to use it. Export it.
--- arch/x86/kernel/xsave.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kernel/xsave.c +1 -0
@@ -738,3 +738,4 @@ void *get_xsave_addr(struct xsave_structreturn (void *)xsave + xstate_comp_offsets[feature]; } +EXPORT_SYMBOL_GPL (get_xsave_addr);
Greg Kroah-Hartman
maintainerPATCH 62/150 KVM: x86: em_ret_far overrides cpl
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nadav Amit <[email protected]>
commit ab646f54f4fd1a8b9671b8707f0739fdd28ce2b1 upstream.
commit d50eaa18039b ("KVM: x86: Perform limit checks when assigning EIP") mistakenly used zero as cpl on em_ret_far. Use the actual one.
--- arch/x86/kvm/emulate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/emulate.c +1 -1
@@ -2128,7 +2128,7 @@ static int em_ret_far(struct x86_emulate/* Outer-privilege level return is not implemented */ if (ctxt->mode >=X86EMUL_MODE_PROT16 && (cs &3 ) > cpl)return X86EMUL_UNHANDLEABLE ; - rc =__load_segment_descriptor (ctxt, (u16 )cs,VCPU_SREG_CS ,0 , false, + rc =__load_segment_descriptor (ctxt, (u16 )cs,VCPU_SREG_CS , cpl, false, &new_desc);if (rc !=X86EMUL_CONTINUE )return rc;
Greg Kroah-Hartman
maintainerPATCH 63/150 kvm: x86: mask out XSAVES
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Bonzini <[email protected]>
commit b65d6e17fe2239c9b2051727903955d922083fbf upstream.
This feature is not supported inside KVM guests yet, because we do not emulate MSR_IA32_XSS. Mask it out.
--- arch/x86/kvm/cpuid.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
arch/x86/kvm/cpuid.c +10 -1
@@ -319,6 +319,10 @@ static inline int __do_cpuid_ent(structF (BMI2 ) |F (ERMS ) | f_invpcid |F (RTM ) | f_mpx |F (RDSEED ) |F (ADX ) |F (SMAP ); +/* cpuid 0xD.1.eax */ +const u32 kvm_supported_word10_x86_features = +F (XSAVEOPT ) |F (XSAVEC ) |F (XGETBV1 ); +/* all calls to cpuid_count() should be made on the same cpu */ get_cpu ();
@@ -455,13 +459,18 @@ static inline int __do_cpuid_ent(struct entry->eax &= supported; entry->edx &= supported >>32 ; entry->flags |=KVM_CPUID_FLAG_SIGNIFCANT_INDEX ; +if (!supported) +break ; +for (idx =1 , i =1 ; idx <64 ; ++idx) {u64 mask = ((u64 )1 << idx);if (*nent >= maxnent) goto out;do_cpuid_1_ent (&entry[i], function, idx); -if (entry[i].eax ==0 || !(supported & mask)) +if (idx ==1 ) + entry[i].eax &= kvm_supported_word10_x86_features; +else if (entry[i].eax ==0 || !(supported & mask))continue ; entry[i].flags |=KVM_CPUID_FLAG_SIGNIFCANT_INDEX ;
Greg Kroah-Hartman
maintainerPATCH 64/150 KVM: s390: Fix size of monitor-class number field
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Huth <[email protected]>
commit a36c5393266222129ce6f622e3bc3fb5463f290c upstream.
The monitor-class number field is only 16 bits, so we have to use a u16 pointer to access it.
--- arch/s390/kvm/interrupt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/kvm/interrupt.c +1 -1
@@ -270,7 +270,7 @@ static int __must_check __deliver_prog_ibreak ;case PGM_MONITOR : rc =put_guest_lc (vcpu, pgm_info->mon_class_nr, - (u64 *)__LC_MON_CLASS_NR); + (u16 *)__LC_MON_CLASS_NR); rc |=put_guest_lc (vcpu, pgm_info->mon_code, (u64 *)__LC_MON_CODE);break ;
Greg Kroah-Hartman
maintainerPATCH 65/150 KVM: s390: flush CPU on load control
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Borntraeger <[email protected]>
commit 2dca485f8740208604543c3960be31a5dd3ea603 upstream.
some control register changes will flush some aspects of the CPU, e.g. POP explicitely mentions that for CR9-CR11 "TLBs may be cleared". Instead of trying to be clever and only flush on specific CRs, let play safe and flush on all lctl(g) as future machines might define new bits in CRs. Load control intercept should not happen that often.
--- arch/s390/kvm/priv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/s390/kvm/priv.c +2 -2
@@ -791,7 +791,7 @@ int kvm_s390_handle_lctl(struct kvm_vcpubreak ; reg = (reg +1 ) %16 ; }while (1 ); - +kvm_make_request (KVM_REQ_TLB_FLUSH , vcpu);return 0 ; }
@@ -863,7 +863,7 @@ static int handle_lctlg(struct kvm_vcpubreak ; reg = (reg +1 ) %16 ; }while (1 ); - +kvm_make_request (KVM_REQ_TLB_FLUSH , vcpu);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 66/150 KVM: s390: Fix ipte locking
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Borntraeger <[email protected]>
commit 1365039d0cb32c0cf96eb9f750f4277c9a90f87d upstream.
ipte_unlock_siif uses cmpxchg to replace the in-memory data of the ipte lock together with ACCESS_ONCE for the intial read.
union ipte_control {
unsigned long val;
struct {
unsigned long k : 1;
unsigned long kh : 31;
unsigned long kg : 32;
};
};
[...]
static void ipte_unlock_siif(struct kvm_vcpu *vcpu)
{
union ipte_control old, new, *ic;
ic = &vcpu->kvm->arch.sca->ipte_control;
do {
new = old = ACCESS_ONCE(*ic);
new.kh--;
if (!new.kh)
new.k = 0;
} while (cmpxchg(&ic->val, old.val, new.val) != old.val);
if (!new.kh)
wake_up(&vcpu->kvm->arch.ipte_wq);
}The new value, is loaded twice from memory with gcc 4.7.2 of fedora 18, despite the ACCESS_ONCE:
--->
l %r4,0(%r3) <--- load first 32 bit of lock (k and kh) in r4 alfi %r4,2147483647 <--- add -1 to r4 llgtr %r4,%r4 <--- zero out the sign bit of r4 lg %r1,0(%r3) <--- load all 64 bit of lock into new lgr %r2,%r1 <--- load the same into old risbg %r1,%r4,1,31,32 <--- shift and insert r4 into the bits 1-31 of new llihf %r4,2147483647 ngrk %r4,%r1,%r4 jne aa0 <ipte_unlock+0xf8> nihh %r1,32767 lgr %r4,%r2 csg %r4,%r1,0(%r3) cgr %r2,%r4 jne a70 <ipte_unlock+0xc8>
If the memory value changes between the first load (l) and the second load (lg) we are broken. If that happens VCPU threads will hang (unkillable) in handle_ipte_interlock.
Andreas Krebbel analyzed this and tracked it down to a compiler bug in that version:
"while it is not that obvious the C99 standard basically forbids duplicating the memory access also in that case. For an argumentation of a similiar case please see:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=22278#c43
For the implementation-defined cases regarding volatile there are some GCC-specific clarifications which can be found here:
https://gcc.gnu.org/onlinedocs/gcc/Volatiles.html#Volatiles
I've tracked down the problem with a reduced testcase. The problem was that during a tree level optimization (SRA - scalar replacement of aggregates) the volatile marker is lost. And an RTL level optimizer (CSE
- common subexpression elimination) then propagated the memory read into its second use introducing another access to the memory location. So
indeed Christian's suspicion that the union access has something to do with it is correct (since it triggered the SRA optimization).
This issue has been reported and fixed in the GCC 4.8 development cycle:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145"
This patch replaces the ACCESS_ONCE scheme with a barrier() based scheme that should work for all supported compilers.
--- arch/s390/kvm/gaccess.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
arch/s390/kvm/gaccess.c +14 -6
@@ -229,10 +229,12 @@ static void ipte_lock_simple(struct kvm_ goto out; ic = &vcpu->kvm->arch.sca->ipte_control; do { - old = ACCESS_ONCE(*ic); + old = *ic; + barrier(); while (old.k) { cond_resched(); - old = ACCESS_ONCE(*ic); + old = *ic; + barrier(); } new = old; new.k = 1;
@@ -251,7 +253,9 @@ static void ipte_unlock_simple(struct kv goto out; ic = &vcpu->kvm->arch.sca->ipte_control;do { - new = old =ACCESS_ONCE (*ic); + old = *ic; +barrier (); + new = old; new.k =0 ; }while (cmpxchg (&ic->val, old.val, new.val) != old.val);wake_up (&vcpu->kvm->arch.ipte_wq);
@@ -265,10 +269,12 @@ static void ipte_lock_siif(struct kvm_vc ic = &vcpu->kvm->arch.sca->ipte_control; do { - old = ACCESS_ONCE(*ic); + old = *ic; + barrier(); while (old.kg) { cond_resched(); - old = ACCESS_ONCE(*ic); + old = *ic; + barrier(); } new = old; new.k = 1;
@@ -282,7 +288,9 @@ static void ipte_unlock_siif(struct kvm_ ic = &vcpu->kvm->arch.sca->ipte_control; do { - new = old = ACCESS_ONCE(*ic); + old = *ic; + barrier(); + new = old; new.kh--; if (!new.kh) new.k = 0;
Greg Kroah-Hartman
maintainerPATCH 67/150 kvm: x86: drop severity of "generation wraparound" message
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Bonzini <[email protected]>
commit a629df7eadffb03e6ce4a8616e62ea29fdf69b6b upstream.
Since most virtual machines raise this message once, it is a bit annoying. Make it KERN_DEBUG severity.
--- arch/x86/kvm/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/mmu.c +1 -1
@@ -4449,7 +4449,7 @@ void kvm_mmu_invalidate_mmio_sptes(struc* zap all shadow pages. */ if (unlikely (kvm_current_mmio_generation (kvm) ==0 )) { -printk_ratelimited (KERN_INFO "kvm: zapping shadow pages for mmio generation wraparound\n" ); +printk_ratelimited (KERN_DEBUG "kvm: zapping shadow pages for mmio generation wraparound\n" );kvm_mmu_invalidate_zap_all_pages (kvm); } }
Greg Kroah-Hartman
maintainerPATCH 68/150 x86_64, vdso: Fix the vdso address randomization algorithm
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 394f56fe480140877304d342dec46d50dc823d46 upstream.
The theory behind vdso randomization is that it's mapped at a random offset above the top of the stack. To avoid wasting a page of memory for an extra page table, the vdso isn't supposed to extend past the lowest PMD into which it can fit. Other than that, the address should be a uniformly distributed address that meets all of the alignment requirements.
The current algorithm is buggy: the vdso has about a 50% probability of being at the very end of a PMD. The current algorithm also has a decent chance of failing outright due to incorrect handling of the case where the top of the stack is near the top of its PMD.
This fixes the implementation. The paxtest estimate of vdso "randomisation" improves from 11 bits to 18 bits. (Disclaimer: I don't know what the paxtest code is actually calculating.)
It's worth noting that this algorithm is inherently biased: the vdso is more likely to end up near the end of its PMD than near the beginning. Ideally we would either nix the PMD sharing requirement or jointly randomize the vdso and the stack to reduce the bias.
In the mean time, this is a considerable improvement with basically no risk of compatibility issues, since the allowed outputs of the algorithm are unchanged.
As an easy test, doing this:
for i in seq 10000
do grep -P vdso /proc/self/maps |cut -d- -f1
done |sort |uniq -d
used to produce lots of output (1445 lines on my most recent run). A tiny subset looks like this:
7fffdfffe0007fffe01fe0007fffe05fe0007fffe07fe0007fffe09fe0007fffe0bfe0007fffe0dfe000
Note the suspicious fe000 endings. With the fix, I get a much more palatable 76 repeated addresses.
--- arch/x86/vdso/vma.c | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-)
arch/x86/vdso/vma.c +29 -16
@@ -54,12 +54,17 @@ subsys_initcall(init_vdso);struct linux_binprm ; -/* Put the vdso above the (randomized) stack with another randomized offset. -This way there is no hole in the middle of address space. -To save memory make sure it is still in the same PTE as the stack top. -This doesn't give that many random bits. - -Only used for the 64-bit and x32 vdsos. */ +/* +* Put the vdso above the (randomized) stack with another randomized +* offset. This way there is no hole in the middle of address space. +* To save memory make sure it is still in the same PTE as the stack +* top. This doesn't give that many random bits. +* +* Note that this algorithm is imperfect: the distribution of the vdso +* start address within a PMD is biased toward the end. +* +* Only used for the 64-bit and x32 vdsos. +*/ static unsigned long vdso_addr (unsigned long start,unsigned len) {#ifdef CONFIG_X86_32
@@ -67,22 +72,30 @@ static unsigned long vdso_addr(unsigned#else unsigned long addr, end;unsigned offset; - end = (start +PMD_SIZE -1 ) &PMD_MASK ; + +/* +* Round up the start address. It can start out unaligned as a result +* of stack start randomization. +*/ + start =PAGE_ALIGN (start); + +/* Round the lowest possible end address up to a PMD boundary. */ + end = (start + len +PMD_SIZE -1 ) &PMD_MASK ;if (end >=TASK_SIZE_MAX ) end =TASK_SIZE_MAX ; end -= len; -/* This loses some more bits than a modulo, but is cheaper */ - offset =get_random_int () & (PTRS_PER_PTE -1 ); - addr = start + (offset <<PAGE_SHIFT ); -if (addr >= end) - addr = end; + +if (end > start) { + offset =get_random_int () % (((end - start) >>PAGE_SHIFT ) +1 ); + addr = start + (offset <<PAGE_SHIFT ); + }else { + addr = start; + }/* -* page-align it here so that get_unmapped_area doesn't -* align it wrongfully again to the next page. addr can come in 4K -* unaligned here as a result of stack start randomization. +* Forcibly align the final address in case we have a hardware +* issue that requires alignment for performance reasons. */ - addr =PAGE_ALIGN (addr); addr =align_vdso_addr (addr);return addr;
Greg Kroah-Hartman
maintainerPATCH 69/150 x86, vdso: Use asm volatile in __getcpu
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 1ddf0b1b11aa8a90cef6706e935fc31c75c406ba upstream.
In Linux 3.18 and below, GCC hoists the lsl instructions in the pvclock code all the way to the beginning of __vdso_clock_gettime, slowing the non-paravirt case significantly. For unknown reasons, presumably related to the removal of a branch, the performance issue is gone as of
e76b027e6408 x86,vdso: Use LSL unconditionally for vgetcpu
but I don't trust GCC enough to expect the problem to stay fixed.
There should be no correctness issue, because the __getcpu calls in __vdso_vlock_gettime were never necessary in the first place.
Note to stable maintainers: In 3.18 and below, depending on configuration, gcc 4.9.2 generates code like this:
9c3: 44 0f 03 e8 lsl %ax,%r13d
9c7: 45 89 eb mov %r13d,%r11d
9ca: 0f 03 d8 lsl %ax,%ebxThis patch won't apply as is to any released kernel, but I'll send a trivial backported version if needed.
[
Backported by Andy Lutomirski. Should apply to all affected versions. This fixes a functionality bug as well as a performance
bug: buggy kernels can infinite loop in __vdso_clock_gettime on affected compilers. See, for exammple:
https://bugzilla.redhat.com/show_bug.cgi?id=1178975
]
--- arch/x86/include/asm/vsyscall.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/vsyscall.h +1 -1
@@ -34,7 +34,7 @@ static inline unsigned int __getcpu(voidnative_read_tscp (&p); }else {/* Load per CPU data from GDT */ - asm("lsl %1,%0" :"=r" (p) :"r" (__PER_CPU_SEG)); + asmvolatile ("lsl %1,%0" :"=r" (p) :"r" (__PER_CPU_SEG)); }return p;
Greg Kroah-Hartman
maintainerPATCH 70/150 driver core: Fix unbalanced device reference in drivers_probe
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Williamson <[email protected]>
commit bb34cb6bbd287b57e955bc5cfd42fcde6aaca279 upstream.
bus_find_device_by_name() acquires a device reference which is never released. This results in an object leak, which on older kernels results in failure to release all resources of PCI devices. libvirt uses drivers_probe to re-attach devices to the host after assignment and is therefore a common trigger for this leak.
Example:
# cd /sys/bus/pci/ # dmesg -C # echo 1 > devices/0000\:01\:00.0/sriov_numvfs # echo 0 > devices/0000\:01\:00.0/sriov_numvfs # dmesg | grep 01:10 pci 0000:01:10.0: [8086:10ca] type 00 class 0x020000 kobject: '0000:01:10.0' (ffff8801d79cd0a8): kobject_add_internal: parent: '0000:00:01.0', set: 'devices' kobject: '0000:01:10.0' (ffff8801d79cd0a8): kobject_uevent_env kobject: '0000:01:10.0' (ffff8801d79cd0a8): fill_kobj_path: path = '/devices/pci0000:00/0000:00:01.0/0000:01:10.0' kobject: '0000:01:10.0' (ffff8801d79cd0a8): kobject_uevent_env kobject: '0000:01:10.0' (ffff8801d79cd0a8): fill_kobj_path: path = '/devices/pci0000:00/0000:00:01.0/0000:01:10.0' kobject: '0000:01:10.0' (ffff8801d79cd0a8): kobject_uevent_env kobject: '0000:01:10.0' (ffff8801d79cd0a8): fill_kobj_path: path = '/devices/pci0000:00/0000:00:01.0/0000:01:10.0' kobject: '0000:01:10.0' (ffff8801d79cd0a8): kobject_cleanup, parent (null) kobject: '0000:01:10.0' (ffff8801d79cd0a8): calling ktype release kobject: '0000:01:10.0': free name
[kobject freed as expected]
# dmesg -C # echo 1 > devices/0000\:01\:00.0/sriov_numvfs # echo 0000:01:10.0 > drivers_probe # echo 0 > devices/0000\:01\:00.0/sriov_numvfs # dmesg | grep 01:10 pci 0000:01:10.0: [8086:10ca] type 00 class 0x020000 kobject: '0000:01:10.0' (ffff8801d79ce0a8): kobject_add_internal: parent: '0000:00:01.0', set: 'devices' kobject: '0000:01:10.0' (ffff8801d79ce0a8): kobject_uevent_env kobject: '0000:01:10.0' (ffff8801d79ce0a8): fill_kobj_path: path = '/devices/pci0000:00/0000:00:01.0/0000:01:10.0' kobject: '0000:01:10.0' (ffff8801d79ce0a8): kobject_uevent_env kobject: '0000:01:10.0' (ffff8801d79ce0a8): fill_kobj_path: path = '/devices/pci0000:00/0000:00:01.0/0000:01:10.0' kobject: '0000:01:10.0' (ffff8801d79ce0a8): kobject_uevent_env kobject: '0000:01:10.0' (ffff8801d79ce0a8): fill_kobj_path: path = '/devices/pci0000:00/0000:00:01.0/0000:01:10.0'
[no free]
--- drivers/base/bus.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/base/bus.c +5 -3
@@ -254,13 +254,15 @@ static ssize_t store_drivers_probe(struc const char *buf, size_t count) { struct device *dev; +int err = -EINVAL ; dev =bus_find_device_by_name (bus,NULL , buf);if (!dev)return -ENODEV ; -if (bus_rescan_devices_helper (dev,NULL ) !=0 ) -return -EINVAL ; -return count; +if (bus_rescan_devices_helper (dev,NULL ) ==0 ) + err = count; +put_device (dev); +return err; }static struct device *next_device (struct klist_iter *i)
Greg Kroah-Hartman
maintainerPATCH 71/150 misc: genwqe: check for error from get_user_pages_fast()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit cf35d6e0475982667b0d2d318fb27be4b8849827 upstream.
genwqe_user_vmap() calls get_user_pages_fast() and if the return value is less than the number of pages requested, it frees the pages and returns an error (-EFAULT). However, it fails to consider a negative error return value from get_user_pages_fast(). In that case, the test if (rc < m->nr_pages) will be false (due to promotion of rc to a large unsigned int) and the code will continue on to call genwqe_map_pages() with an invalid list of page pointers. Fix it by bailing out if get_user_pages_fast() returns a negative error value.
--- drivers/misc/genwqe/card_utils.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/misc/genwqe/card_utils.c +2 -0
@@ -590,6 +590,8 @@ int genwqe_user_vmap(struct genwqe_dev * m->nr_pages,1 ,/* write by caller */ m->page_list); /* ptrs to pages */ +if (rc <0 ) + goto fail_get_user_pages;/* assumption: get_user_pages can be killed by signals. */ if (rc < m->nr_pages) {
Greg Kroah-Hartman
maintainerPATCH 73/150 i2c: designware: Fix falling time bindings doc
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Doug Anderson <[email protected]>
commit 8e2596e81a9dd8f9efcf78476f3990f211e25edb upstream.
In (6468276 i2c: designware: make SCL and SDA falling time configurable) new device tree properties were added for setting the falling time of SDA and SCL. The device tree bindings doc had a typo in it: it forgot the "-ns" suffix for both properies in the prose of the bindings.
I assume this is a typo because:
* The source code includes the "-ns"
* The example in the bindings includes the "-ns".
Fix the typo.
--- Documentation/devicetree/bindings/i2c/i2c-designware.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/i2c/i2c-designware.txt +2 -2
@@ -14,10 +14,10 @@ Optional properties : - i2c-sda-hold-time-ns : should contain the SDA hold time in nanoseconds. This option is only supported in hardware blocks version 1.11a or newer. - - i2c-scl-falling-time : should contain the SCL falling time in nanoseconds. + - i2c-scl-falling-time-ns : should contain the SCL falling time in nanoseconds. This value which is by default 300ns is used to compute the tLOW period. - - i2c-sda-falling-time : should contain the SDA falling time in nanoseconds. + - i2c-sda-falling-time-ns : should contain the SDA falling time in nanoseconds. This value which is by default 300ns is used to compute the tHIGH period. Example :
Greg Kroah-Hartman
maintainerPATCH 74/150 ALSA: usb-audio: extend KEF X300A FU 10 tweak to Arcam rPAC
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Jaburek <[email protected]>
commit d70a1b9893f820fdbcdffac408c909c50f2e6b43 upstream.
The Arcam rPAC seems to have the same problem - whenever anything (alsamixer, udevd, 3.9+ kernel from 60af3d037eb8c, ..) attempts to access mixer / control interface of the card, the firmware "locks up" the entire device, resulting in
SNDRV_PCM_IOCTL_HW_PARAMS failed (-5): Input/output error
from alsa-lib.
Other operating systems can somehow read the mixer (there seems to be playback volume/mute), but any manipulation is ignored by the device (which has hardware volume controls).
--- sound/usb/mixer_maps.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
sound/usb/mixer_maps.c +12 -3
@@ -328,8 +328,11 @@ static struct usbmix_name_map gamecom780 {} }; -static const struct usbmix_name_map kef_x300a_map[] = { - {10 ,NULL },/* firmware locks up (?) when we try to access this FU */ +/* some (all?) SCMS USB3318 devices are affected by a firmware lock up +* when anything attempts to access FU 10 (control) +*/ +static const struct usbmix_name_map scms_usb3318_map[] = { + {10 ,NULL }, {0 } };
@@ -425,8 +428,14 @@ static struct usbmix_ctl_map usbmix_ctl_ .map = ebox44_map, }, { +/* KEF X300A */ .id = USB_ID(0x27ac, 0x1000), - .map = kef_x300a_map, + .map = scms_usb3318_map, + }, + { +/* Arcam rPAC */ + .id = USB_ID(0x25c4, 0x0003), + .map = scms_usb3318_map, }, { 0 } /* terminator */ };
Greg Kroah-Hartman
maintainerPATCH 75/150 ALSA: hda/realtek - New codec support for ALC298
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kailang Yang <[email protected]>
commit 506b62c33a7444b91a93bf2da772f4c7e6656410 upstream.
Add new support for ALC298 codec.
--- sound/pci/hda/patch_realtek.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/pci/hda/patch_realtek.c +7 -0
@@ -323,6 +323,7 @@ static void alc_fill_eapd_coef(struct hdcase 0x10ec0283 :case 0x10ec0286 :case 0x10ec0288 : +case 0x10ec0298 :alc_update_coef_idx (codec,0x10 ,1 <<9 ,0 );break ;case 0x10ec0285 :
@@ -2657,6 +2658,7 @@ enum {ALC269_TYPE_ALC284 ,ALC269_TYPE_ALC285 ,ALC269_TYPE_ALC286 , +ALC269_TYPE_ALC298 , ALC269_TYPE_ALC255, };
@@ -2684,6 +2686,7 @@ static int alc269_parse_auto_config(strucase ALC269_TYPE_ALC282 :case ALC269_TYPE_ALC283 :case ALC269_TYPE_ALC286 : +case ALC269_TYPE_ALC298 :case ALC269_TYPE_ALC255 : ssids = alc269_ssids;break ;
@@ -5377,6 +5380,9 @@ static int patch_alc269(struct hda_codec spec->codec_variant =ALC269_TYPE_ALC286 ; spec->shutup = alc286_shutup;break ; +case 0x10ec0298 : + spec->codec_variant =ALC269_TYPE_ALC298 ; +break ;case 0x10ec0255 : spec->codec_variant =ALC269_TYPE_ALC255 ;break ;
@@ -6334,6 +6340,7 @@ static const struct hda_codec_preset snd { .id = 0x10ec0290, .name = "ALC290", .patch = patch_alc269 }, { .id = 0x10ec0292, .name = "ALC292", .patch = patch_alc269 }, { .id = 0x10ec0293, .name = "ALC293", .patch = patch_alc269 }, + { .id = 0x10ec0298, .name = "ALC298", .patch = patch_alc269 }, { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", .patch = patch_alc861 }, { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
Greg Kroah-Hartman
maintainerPATCH 76/150 ALSA: hda/realtek - New codec support for ALC256
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kailang Yang <[email protected]>
commit 4344aec84bd84b58a01347f0db7693f73fb6473d upstream.
Add new support for ALC256 codec.
--- sound/pci/hda/patch_realtek.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/pci/hda/patch_realtek.c +7 -0
@@ -319,6 +319,7 @@ static void alc_fill_eapd_coef(struct hdbreak ;case 0x10ec0233 :case 0x10ec0255 : +case 0x10ec0256 :case 0x10ec0282 :case 0x10ec0283 :case 0x10ec0286 :
@@ -2660,6 +2661,7 @@ enum {ALC269_TYPE_ALC286 ,ALC269_TYPE_ALC298 ,ALC269_TYPE_ALC255 , + ALC269_TYPE_ALC256, };/*
@@ -2688,6 +2690,7 @@ static int alc269_parse_auto_config(strucase ALC269_TYPE_ALC286 :case ALC269_TYPE_ALC298 :case ALC269_TYPE_ALC255 : +case ALC269_TYPE_ALC256 : ssids = alc269_ssids;break ;default :
@@ -5386,6 +5389,9 @@ static int patch_alc269(struct hda_codeccase 0x10ec0255 : spec->codec_variant =ALC269_TYPE_ALC255 ;break ; +case 0x10ec0256 : + spec->codec_variant =ALC269_TYPE_ALC256 ; +break ; }if (snd_hda_codec_read (codec,0x51 ,0 ,AC_VERB_PARAMETERS ,0 ) ==0x10ec5505 ) {
@@ -6321,6 +6327,7 @@ static const struct hda_codec_preset snd { .id = 0x10ec0233, .name = "ALC233", .patch = patch_alc269 }, { .id = 0x10ec0235, .name = "ALC233", .patch = patch_alc269 }, { .id = 0x10ec0255, .name = "ALC255", .patch = patch_alc269 }, + { .id = 0x10ec0256, .name = "ALC256", .patch = patch_alc269 }, { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
Greg Kroah-Hartman
maintainerPATCH 77/150 ALSA: hda/realtek - Add new Dell desktop for ALC3234 headset mode
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kailang Yang <[email protected]>
commit 8b72415d8aa8bb1904c61926bd0701447ce44bee upstream.
New Dell desktop needs to support headset mode for ALC3234.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -4796,6 +4796,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x1028 ,0x0638 ,"Dell Inspiron 5439" ,ALC290_FIXUP_MONO_SPEAKERS_HSJACK ),SND_PCI_QUIRK (0x1028 ,0x064a ,"Dell" ,ALC293_FIXUP_DELL1_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x064b ,"Dell" ,ALC293_FIXUP_DELL1_MIC_NO_PRESENCE ), +SND_PCI_QUIRK (0x1028 ,0x06c7 ,"Dell" ,ALC255_FIXUP_DELL1_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x06d9 ,"Dell" ,ALC293_FIXUP_DELL1_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x06da ,"Dell" ,ALC293_FIXUP_DELL1_MIC_NO_PRESENCE ), SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Greg Kroah-Hartman
maintainerPATCH 78/150 ALSA: hda - using uninitialized data
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 69eba10e606a80665f8573221fec589430d9d1cb upstream.
In olden times the snd_hda_param_read() function always set "*start_id" but in 2007 we introduced a new return and it causes uninitialized data bugs in a couple of the callers: print_codec_info() and hdmi_parse_codec().
--- sound/pci/hda/hda_codec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/pci/hda/hda_codec.c +3 -1
@@ -338,8 +338,10 @@ int snd_hda_get_sub_nodes(struct hda_codunsigned int parm; parm =snd_hda_param_read (codec, nid,AC_PAR_NODE_COUNT ); -if (parm ==-1 ) +if (parm ==-1 ) { + *start_id =0 ;return 0 ; + } *start_id = (parm >>16 ) &0x7fff ;return (int )(parm &0x7fff ); }
Greg Kroah-Hartman
maintainerPATCH 79/150 ALSA: fireworks: fix an endianness bug for transaction length
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Sakamoto <[email protected]>
commit 92cb46584e104e2f4b14a44959109ffe13524a26 upstream.
Although the 't->length' is a big-endian value, it's used without any conversion. This means that the driver always uses 'length' parameter.
--- sound/firewire/fireworks/fireworks_transaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/firewire/fireworks/fireworks_transaction.c +1 -1
@@ -124,7 +124,7 @@ copy_resp_to_buf(struct snd_efw *efw, vospin_lock_irq (&efw->lock); t = (struct snd_efw_transaction *)data; - length =min_t (size_t, t->length *sizeof (t->length), length); + length =min_t (size_t,be32_to_cpu (t->length) *sizeof (u32), length);if (efw->push_ptr < efw->pull_ptr) capacity = (unsigned int )(efw->pull_ptr - efw->push_ptr);
Greg Kroah-Hartman
maintainerPATCH 80/150 ALSA: snd-usb-caiaq: fix stream count check
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Mack <[email protected]>
commit 49cdd5b641933fda6324fc901eaf856924ba6a27 upstream.
Commit 897c329bc ("ALSA: usb: caiaq: check for cdev->n_streams > 1") introduced a safety check to protect against bogus data provided by devices. However, the n_streams variable is already divided by CHANNELS_PER_STREAM, so the correct check is 'n_streams > 0'.
Fix this to un-break support for stereo devices.
--- sound/usb/caiaq/audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/caiaq/audio.c +1 -1
@@ -816,7 +816,7 @@ int snd_usb_caiaq_audio_init(struct snd_return -EINVAL ; } -if (cdev->n_streams <2 ) { +if (cdev->n_streams <1 ) {dev_err (dev,"bogus number of streams: %d\n" , cdev->n_streams);return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 81/150 ALSA: hda - Fix wrong gpio_dir & gpio_mask hint setups for IDT/STAC codecs
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit c507de88f6a336bd7296c9ec0073b2d4af8b4f5e upstream.
stac_store_hints() does utterly wrong for masking the values for gpio_dir and gpio_data, likely due to copy&paste errors. Fortunately, this feature is used very rarely, so the impact must be really small.
--- sound/pci/hda/patch_sigmatel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/hda/patch_sigmatel.c +2 -2
@@ -568,9 +568,9 @@ static void stac_store_hints(struct hda_ spec->gpio_mask; }if (get_int_hint (codec,"gpio_dir" , &spec->gpio_dir)) - spec->gpio_mask &= spec->gpio_mask; -if (get_int_hint (codec,"gpio_data" , &spec->gpio_data)) spec->gpio_dir &= spec->gpio_mask; +if (get_int_hint (codec,"gpio_data" , &spec->gpio_data)) + spec->gpio_data &= spec->gpio_mask;if (get_int_hint (codec,"eapd_mask" , &spec->eapd_mask)) spec->eapd_mask &= spec->gpio_mask;if (get_int_hint (codec,"gpio_mute" , &spec->gpio_mute))
Greg Kroah-Hartman
maintainerPATCH 82/150 ALSA: hda - Add new GPU codec ID 0x10de0072 to snd-hda
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Plattner <[email protected]>
commit 60834b73a9c2bbc2f514122ddc626f3350fb40cd upstream.
Vendor ID 0x10de0072 is used by a yet-to-be-named GPU chip.
--- sound/pci/hda/patch_hdmi.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/patch_hdmi.c +2 -0
@@ -3351,6 +3351,7 @@ static const struct hda_codec_preset snd { .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi_2ch }, { .id = 0x10de0070, .name = "GPU 70 HDMI/DP", .patch = patch_nvhdmi }, { .id = 0x10de0071, .name = "GPU 71 HDMI/DP", .patch = patch_nvhdmi }, +{ .id = 0x10de0072, .name = "GPU 72 HDMI/DP", .patch = patch_nvhdmi }, { .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi_2ch }, { .id = 0x11069f80, .name = "VX900 HDMI/DP", .patch = patch_via_hdmi }, { .id = 0x11069f81, .name = "VX900 HDMI/DP", .patch = patch_via_hdmi },
@@ -3410,6 +3411,7 @@ MODULE_ALIAS("snd-hda-codec-id:10de0060"MODULE_ALIAS ("snd-hda-codec-id:10de0067" );MODULE_ALIAS ("snd-hda-codec-id:10de0070" );MODULE_ALIAS ("snd-hda-codec-id:10de0071" ); +MODULE_ALIAS ("snd-hda-codec-id:10de0072" );MODULE_ALIAS ("snd-hda-codec-id:10de8001" );MODULE_ALIAS ("snd-hda-codec-id:11069f80" );MODULE_ALIAS ("snd-hda-codec-id:11069f81" );
Greg Kroah-Hartman
maintainerPATCH 83/150 md/raid5: fetch_block must fetch all the blocks handle_stripe_dirtying wants.
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit 108cef3aa41669610e1836fe638812dd067d72de upstream.
It is critical that fetch_block() and handle_stripe_dirtying() are consistent in their analysis of what needs to be loaded. Otherwise raid5 can wait forever for a block that won't be loaded.
Currently when writing to a RAID5 that is resyncing, to a location beyond the resync offset, handle_stripe_dirtying chooses a reconstruct-write cycle, but fetch_block() assumes a read-modify-write, and a lockup can happen.
So treat that case just like RAID6, just as we do in handle_stripe_dirtying. RAID6 always does reconstruct-write.
This bug was introduced when the behaviour of handle_stripe_dirtying was changed in 3.7, so the patch is suitable for any kernel since, though it will need careful merging for some versions.
--- drivers/md/raid5.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/md/raid5.c +5 -2
@@ -2917,8 +2917,11 @@ static int fetch_block(struct stripe_hea (sh->raid_conf->level <=5 && s->failed && fdev[0 ]->towrite && (!test_bit (R5_Insync, &dev->flags) ||test_bit (STRIPE_PREREAD_ACTIVE , &sh->state)) && !test_bit (R5_OVERWRITE , &fdev[0 ]->flags)) || - (sh->raid_conf->level ==6 && s->failed && s->to_write && - s->to_write - s->non_overwrite < sh->raid_conf->raid_disks -2 && + ((sh->raid_conf->level ==6 || + sh->sector >= sh->raid_conf->mddev->recovery_cp) + && s->failed && s->to_write && + (s->to_write - s->non_overwrite < + sh->raid_conf->raid_disks - sh->raid_conf->max_degraded) && (!test_bit(R5_Insync, &dev->flags) || test_bit(STRIPE_PREREAD_ACTIVE, &sh->state))))) {/* we would like to get this block, possibly by computing it, * otherwise read it if the backing disk is insync
Greg Kroah-Hartman
maintainerPATCH 84/150 USB: cdc-acm: check for valid interfaces
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 403dff4e2c94f275e24fd85f40b2732ffec268a1 upstream.
We need to check that we have both a valid data and control inteface for both types of headers (union and not union.)
References: https://bugzilla.kernel.org/show_bug.cgi?id=83551
--- drivers/usb/class/cdc-acm.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/usb/class/cdc-acm.c +5 -4
@@ -1197,10 +1197,11 @@ next_desc: }else { control_interface =usb_ifnum_to_if (usb_dev, union_header->bMasterInterface0); data_interface =usb_ifnum_to_if (usb_dev, (data_interface_num = union_header->bSlaveInterface0)); -if (!control_interface || !data_interface) { -dev_dbg (&intf->dev,"no interfaces\n" ); -return -ENODEV ; - } + } + +if (!control_interface || !data_interface) { +dev_dbg (&intf->dev,"no interfaces\n" ); +return -ENODEV ; }if (data_interface_num != call_interface_num)
Greg Kroah-Hartman
maintainerPATCH 85/150 usb: renesas_usbhs: gadget: fix NULL pointer dereference in ep_disable()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kazuya Mizuguchi <[email protected]>
commit 11432050f070810ba139d0226344eef120c3a559 upstream.
This patch fixes an issue that the NULL pointer dereference happens when we uses g_audio driver. Since the g_audio driver will call usb_ep_disable() in afunc_set_alt() before it calls usb_ep_enable(), the uep->pipe of renesas usbhs driver will be NULL. So, this patch adds a condition to avoid the oops.
--- drivers/usb/renesas_usbhs/mod_gadget.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/renesas_usbhs/mod_gadget.c +3 -0
@@ -602,6 +602,9 @@ static int usbhsg_ep_disable(struct usb_struct usbhsg_uep *uep =usbhsg_ep_to_uep (ep);struct usbhs_pipe *pipe =usbhsg_uep_to_pipe (uep); +if (!pipe) +return -EINVAL ; +usbhsg_pipe_disable (uep);usbhs_pipe_free (pipe);
Greg Kroah-Hartman
maintainerPATCH 86/150 usb: gadget: at91_udc: move prepare clk into process context
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ronald Wahl <[email protected]>
commit b2ba27a5c56ff7204d8a8684893d64d4afe2cee5 upstream.
Commit 7628083227b6bc4a7e33d7c381d7a4e558424b6b (usb: gadget: at91_udc:
prepare clk before calling enable) added clock preparation in interrupt context. This is not allowed as it might sleep. Also setting the clock rate is unsafe to call from there for the same reason. Move clock preparation and setting clock rate into process context (at91udc_probe).
--- drivers/usb/gadget/udc/at91_udc.c | 44 +++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 12 deletions(-)
drivers/usb/gadget/udc/at91_udc.c +32 -12
@@ -870,12 +870,10 @@ static void clk_on(struct at91_udc *udc)return ; udc->clocked =1 ; -if (IS_ENABLED (CONFIG_COMMON_CLK )) { -clk_set_rate (udc->uclk,48000000 ); -clk_prepare_enable (udc->uclk); - } -clk_prepare_enable (udc->iclk); -clk_prepare_enable (udc->fclk); +if (IS_ENABLED (CONFIG_COMMON_CLK )) +clk_enable (udc->uclk); +clk_enable (udc->iclk); +clk_enable (udc->fclk); }static void clk_off (struct at91_udc *udc)
@@ -884,10 +882,10 @@ static void clk_off(struct at91_udc *udcreturn ; udc->clocked =0 ; udc->gadget.speed =USB_SPEED_UNKNOWN ; -clk_disable_unprepare (udc->fclk); -clk_disable_unprepare (udc->iclk); +clk_disable (udc->fclk); +clk_disable (udc->iclk);if (IS_ENABLED (CONFIG_COMMON_CLK )) -clk_disable_unprepare (udc->uclk); +clk_disable (udc->uclk); }/*
@@ -1780,14 +1778,24 @@ static int at91udc_probe(struct platform }/* don't do anything until we have both gadget driver and VBUS */ +if (IS_ENABLED (CONFIG_COMMON_CLK )) { +clk_set_rate (udc->uclk,48000000 ); + retval =clk_prepare (udc->uclk); +if (retval) + goto fail1; + } + retval =clk_prepare (udc->fclk); +if (retval) + goto fail1a; + retval =clk_prepare_enable (udc->iclk);if (retval) - goto fail1; + goto fail1b;at91_udp_write (udc,AT91_UDP_TXVC ,AT91_UDP_TXVC_TXVDIS );at91_udp_write (udc,AT91_UDP_IDR ,0xffffffff );/* Clear all pending interrupts - UDP may be used by bootloader. */ at91_udp_write (udc,AT91_UDP_ICR ,0xffffffff ); -clk_disable_unprepare (udc->iclk); +clk_disable (udc->iclk);/* request UDC and maybe VBUS irqs */ udc->udp_irq =platform_get_irq (pdev,0 );
@@ -1795,7 +1803,7 @@ static int at91udc_probe(struct platform 0, driver_name, udc);if (retval <0 ) {DBG ("request irq %d failed\n" , udc->udp_irq); - goto fail1; + goto fail1c; }if (gpio_is_valid (udc->board.vbus_pin)) { retval =gpio_request (udc->board.vbus_pin,"udc_vbus" );
@@ -1848,6 +1856,13 @@ fail3:gpio_free (udc->board.vbus_pin); fail2:free_irq (udc->udp_irq, udc); +fail1c: +clk_unprepare (udc->iclk); +fail1b: +clk_unprepare (udc->fclk); +fail1a: +if (IS_ENABLED (CONFIG_COMMON_CLK )) +clk_unprepare (udc->uclk); fail1:if (IS_ENABLED (CONFIG_COMMON_CLK ) && !IS_ERR (udc->uclk))clk_put (udc->uclk);
@@ -1896,6 +1911,11 @@ static int __exit at91udc_remove(struct res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );release_mem_region (res->start,resource_size (res)); +if (IS_ENABLED (CONFIG_COMMON_CLK )) +clk_unprepare (udc->uclk); +clk_unprepare (udc->fclk); +clk_unprepare (udc->iclk); +clk_put (udc->iclk);clk_put (udc->fclk);if (IS_ENABLED (CONFIG_COMMON_CLK ))
Greg Kroah-Hartman
maintainerPATCH 87/150 USB: qcserial: Add support for HP lt4112 LTE/HSPA+ Gobi 4G Modem
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Hauke <[email protected]>
commit e7181d005e84b15fe3121a8d22840adc3395d496 upstream.
Added new device layout "DEVICE_HWI" and also added the USB VID/PID for the HP lt4112 LTE/HSPA+ Gobi 4G Modem (Huawei me906e)
--- drivers/usb/serial/qcserial.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
drivers/usb/serial/qcserial.c +33 -0
@@ -27,12 +27,15 @@ enum qcserial_layouts {QCSERIAL_G2K =0 ,/* Gobi 2000 */ QCSERIAL_G1K =1 ,/* Gobi 1000 */ QCSERIAL_SWI =2 ,/* Sierra Wireless */ + QCSERIAL_HWI = 3, /* Huawei */ };#define DEVICE_G1K (v, p) \ USB_DEVICE(v, p), .driver_info = QCSERIAL_G1K#define DEVICE_SWI (v, p) \ USB_DEVICE(v, p), .driver_info = QCSERIAL_SWI +#define DEVICE_HWI (v, p) \ + USB_DEVICE(v, p), .driver_info = QCSERIAL_HWIstatic const struct usb_device_id id_table[] = { /* Gobi 1000 devices */
@@ -157,6 +160,9 @@ static const struct usb_device_id id_tab {DEVICE_SWI(0x413c, 0x81a8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */ {DEVICE_SWI(0x413c, 0x81a9)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ +/* Huawei devices */ + {DEVICE_HWI(0x03f0, 0x581d)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Modem (Huawei me906e) */ + { } /* Terminating entry */ };MODULE_DEVICE_TABLE (usb, id_table);
@@ -283,6 +289,33 @@ static int qcprobe(struct usb_serial *sebreak ;default :/* don't claim any unsupported interface */ + altsetting =-1 ; +break ; + } +break ; +case QCSERIAL_HWI : +/* +* Huawei layout: +* 0: AT-capable modem port +* 1: DM/DIAG +* 2: AT-capable modem port +* 3: CCID-compatible PCSC interface +* 4: QMI/net +* 5: NMEA +*/ +switch (ifnum) { +case 0 : +case 2 : +dev_dbg (dev,"Modem port found\n" ); +break ; +case 1 : +dev_dbg (dev,"DM/DIAG interface found\n" ); +break ; +case 5 : +dev_dbg (dev,"NMEA GPS interface found\n" ); +break ; +default : +/* don't claim any unsupported interface */ altsetting =-1 ;break ; }
Greg Kroah-Hartman
maintainerPATCH 88/150 Add USB_EHCI_EXYNOS to multi_v7_defconfig
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steev Klimaszewski <[email protected]>
commit 007487f1fd43d84f26cda926081ca219a24ecbc4 upstream.
Currently we enable Exynos devices in the multi v7 defconfig, however, when testing on my ODROID-U3, I noticed that USB was not working. Enabling this option causes USB to work, which enables networking support as well since the ODROID-U3 has networking on the USB bus.
[arnd] Support for odroid-u3 was added in 3.10, so it would be nice to backport this fix at least that far.
--- arch/arm/configs/multi_v7_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/configs/multi_v7_defconfig +1 -0
@@ -320,6 +320,7 @@ CONFIG_USB=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_MVEBU=y CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_EXYNOS=y CONFIG_USB_EHCI_TEGRA=y CONFIG_USB_EHCI_HCD_PLATFORM=y CONFIG_USB_ISP1760_HCD=y
Greg Kroah-Hartman
maintainerPATCH 89/150 genhd: check for int overflow in disk_expand_part_tbl()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
commit 5fabcb4c33fe11c7e3afdf805fde26c1a54d0953 upstream.
We can get here from blkdev_ioctl() -> blkpg_ioctl() -> add_partition() with a user passed in partno value. If we pass in 0x7fffffff, the new target in disk_expand_part_tbl() overflows the 'int' and we access beyond the end of ptbl->part[] and even write to it when we do the rcu_assign_pointer() to assign the new partition.
--- block/genhd.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
block/genhd.c +9 -2
@@ -1070,9 +1070,16 @@ int disk_expand_part_tbl(struct gendiskstruct disk_part_tbl *old_ptbl = disk->part_tbl;struct disk_part_tbl *new_ptbl;int len = old_ptbl ? old_ptbl->len :0 ; -int target = partno +1 ; +int i, target;size_t size; -int i; + +/* +* check for int overflow, since we can get here from blkpg_ioctl() +* with a user passed 'partno'. +*/ + target = partno +1 ; +if (target <0 ) +return -EINVAL ;/* disk_max_parts() is zero during initialization, ignore if so */ if (disk_max_parts (disk) && target >disk_max_parts (disk))
Greg Kroah-Hartman
maintainerPATCH 90/150 cdc-acm: memory leak in error case
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit d908f8478a8d18e66c80a12adb27764920c1f1ca upstream.
If probe() fails not only the attributes need to be removed but also the memory freed.
--- drivers/usb/class/cdc-acm.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/class/cdc-acm.c +1 -0
@@ -1476,6 +1476,7 @@ alloc_fail8: &dev_attr_wCountryCodes);device_remove_file (&acm->control->dev, &dev_attr_iCountryCodeRelDate); +kfree (acm->country_codes); }device_remove_file (&acm->control->dev, &dev_attr_bmCapabilities); alloc_fail7:
Greg Kroah-Hartman
maintainerPATCH 91/150 drbd: merge_bvec_fn: properly remap bvm->bi_bdev
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lars Ellenberg <[email protected]>
commit 3b9d35d744bb5139f9fed57f38c019bb8c7d351c upstream.
This was not noticed for many years. Affects operation if md raid is used a backing device for DRBD.
--- drivers/block/drbd/drbd_req.c | 1 + 1 file changed, 1 insertion(+)
drivers/block/drbd/drbd_req.c +1 -0
@@ -1545,6 +1545,7 @@ int drbd_merge_bvec(struct request_queuestruct request_queue *const b = device->ldev->backing_bdev->bd_disk->queue;if (b->merge_bvec_fn) { + bvm->bi_bdev = device->ldev->backing_bdev; backing_limit = b->merge_bvec_fn (b, bvm, bvec); limit =min (limit, backing_limit); }
Greg Kroah-Hartman
maintainerPATCH 92/150 drbd: Fix state change in case of connection timeout
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Philipp Reisner <[email protected]>
commit 9581f97a687724ea41cf2e145dda4751161198c1 upstream.
A connection timeout affects all volumes of a resource! Under the following conditions:
A resource with multiple volumes
AND
ko-count >=1
AND
a write request triggers the timeout (ko-count * timeout)
DRBD's internal state gets confused. That in turn may lead to very miss leading follow up failures. E.g. "BUG: scheduling while atomic"
--- drivers/block/drbd/drbd_req.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/drbd/drbd_req.c +1 -1
@@ -1629,7 +1629,7 @@ void request_timer_fn(unsigned long data time_after(now, req_peer->pre_send_jif + ent) && !time_in_range(now, connection->last_reconnect_jif, connection->last_reconnect_jif + ent)) {drbd_warn (device,"Remote failed to finish a request within ko-count * timeout\n" ); -_drbd_set_state (_NS (device, conn,C_TIMEOUT ),CS_VERBOSE |CS_HARD ,NULL ); +_conn_request_state (connection,NS (conn,C_TIMEOUT ),CS_VERBOSE |CS_HARD ); } if (dt && oldest_submit_jif != now && time_after(now, oldest_submit_jif + dt) &&
Greg Kroah-Hartman
maintainerPATCH 93/150 writeback: fix a subtle race condition in I_DIRTY clearing
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit 9c6ac78eb3521c5937b2dd8a7d1b300f41092f45 upstream.
After invoking ->dirty_inode(), __mark_inode_dirty() does smp_mb() and tests inode->i_state locklessly to see whether it already has all the necessary I_DIRTY bits set. The comment above the barrier doesn't contain any useful information - memory barriers can't ensure "changes are seen by all cpus" by itself.
And it sure enough was broken. Please consider the following scenario.
CPU 0 CPU 1
-------------------------------------------------------------------------------
enters __writeback_single_inode() grabs inode->i_lock tests PAGECACHE_TAG_DIRTY which is clear
enters __set_page_dirty()
grabs mapping->tree_lock
sets PAGECACHE_TAG_DIRTY
releases mapping->tree_lock
leaves __set_page_dirty()
enters __mark_inode_dirty()
smp_mb()
sees I_DIRTY_PAGES set
leaves __mark_inode_dirty()
clears I_DIRTY_PAGES releases inode->i_lock
Now @inode has dirty pages w/ I_DIRTY_PAGES clear. This doesn't seem to lead to an immediately critical problem because requeue_inode() later checks PAGECACHE_TAG_DIRTY instead of I_DIRTY_PAGES when deciding whether the inode needs to be requeued for IO and there are enough unintentional memory barriers inbetween, so while the inode ends up with inconsistent I_DIRTY_PAGES flag, it doesn't fall off the IO list.
The lack of explicit barrier may also theoretically affect the other I_DIRTY bits which deal with metadata dirtiness. There is no guarantee that a strong enough barrier exists between I_DIRTY_[DATA]SYNC clearing and write_inode() writing out the dirtied inode. Filesystem inode writeout path likely has enough stuff which can behave as full barrier but it's theoretically possible that the writeout may not see all the updates from ->dirty_inode().
Fix it by adding an explicit smp_mb() after I_DIRTY clearing. Note that I_DIRTY_PAGES needs a special treatment as it always needs to be cleared to be interlocked with the lockless test on __mark_inode_dirty() side. It's cleared unconditionally and reinstated after smp_mb() if the mapping still has dirty pages.
Also add comments explaining how and why the barriers are paired.
Lightly tested.
--- fs/fs-writeback.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-)
fs/fs-writeback.c +22 -7
@@ -479,12 +479,28 @@ __writeback_single_inode(struct inode *i* write_inode() */ spin_lock (&inode->i_lock); -/* Clear I_DIRTY_PAGES if we've written out all dirty pages */ -if (!mapping_tagged (mapping,PAGECACHE_TAG_DIRTY )) - inode->i_state &= ~I_DIRTY_PAGES ; + dirty = inode->i_state &I_DIRTY ; - inode->i_state &= ~(I_DIRTY_SYNC |I_DIRTY_DATASYNC ); + inode->i_state &= ~I_DIRTY ; + +/* +* Paired with smp_mb() in __mark_inode_dirty(). This allows +* __mark_inode_dirty() to test i_state without grabbing i_lock - +* either they see the I_DIRTY bits cleared or we see the dirtied +* inode. +* +* I_DIRTY_PAGES is always cleared together above even if @mapping +* still has dirty pages. The flag is reinstated after smp_mb() if +* necessary. This guarantees that either __mark_inode_dirty() +* sees clear I_DIRTY_PAGES or we see PAGECACHE_TAG_DIRTY. +*/ +smp_mb (); + +if (mapping_tagged (mapping,PAGECACHE_TAG_DIRTY )) + inode->i_state |=I_DIRTY_PAGES ; +spin_unlock (&inode->i_lock); +/* Don't write the inode if only I_DIRTY_PAGES was set */ if (dirty & (I_DIRTY_SYNC |I_DIRTY_DATASYNC )) {int err =write_inode (inode, wbc);
@@ -1148,12 +1164,11 @@ void __mark_inode_dirty(struct inode *in }/* -* make sure that changes are seen by all cpus before we test i_state -* -- mikulas +* Paired with smp_mb() in __writeback_single_inode() for the +* following lockless i_state test. See there for details. */ smp_mb (); -/* avoid the locking if we can */ if ((inode->i_state & flags) == flags)return ;
Greg Kroah-Hartman
maintainerPATCH 94/150 tracing/sched: Check preempt_count() for current when reading task->state
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (Red Hat)" <[email protected]>
commit aee4e5f3d3abb7a2239dd02f6d8fb173413fd02f upstream.
When recording the state of a task for the sched_switch tracepoint a check of task_preempt_count() is performed to see if PREEMPT_ACTIVE is set. This is because, technically, a task being preempted is really in the TASK_RUNNING state, and that is what should be recorded when tracing a sched_switch, even if the task put itself into another state (it hasn't scheduled out in that state yet).
But with the change to use per_cpu preempt counts, the task_thread_info(p)->preempt_count is no longer used, and instead task_preempt_count(p) is used.
The problem is that this does not use the current preempt count but a stale one from a previous sched_switch. The task_preempt_count(p) uses saved_preempt_count and not preempt_count(). But for tracing sched_switch, if p is current, we really want preempt_count().
I hit this bug when I was tracing sleep and the call from do_nanosleep() scheduled out in the "RUNNING" state.
sleep-4290 [000] 537272.259992: sched_switch: sleep:4290 [120] R ==> swapper/0:0 [120]
sleep-4290 [000] 537272.260015: kernel_stack: <stack trace>=> __schedule (ffffffff8150864a)
=> schedule (ffffffff815089f8)
=> do_nanosleep (ffffffff8150b76c)
=> hrtimer_nanosleep (ffffffff8108d66b)
=> SyS_nanosleep (ffffffff8108d750)
=> return_to_handler (ffffffff8150e8e5)
=> tracesys_phase2 (ffffffff8150c844)
After a bit of hair pulling, I found that the state was really TASK_INTERRUPTIBLE, but the saved_preempt_count had an old PREEMPT_ACTIVE set and caused the sched_switch tracepoint to show it as RUNNING.
--- include/trace/events/sched.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/trace/events/sched.h +1 -1
@@ -100,7 +100,7 @@ static inline long __trace_sched_switch_/* * For all intents and purposes a preempted task is a running task. */ -if (task_preempt_count (p) &PREEMPT_ACTIVE ) +if (preempt_count () &PREEMPT_ACTIVE ) state =TASK_RUNNING |TASK_STATE_MAX ;#endif
Greg Kroah-Hartman
maintainerPATCH 95/150 tty: serial: men_z135_uart: Add terminating entry for men_z135_ids
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Axel Lin <[email protected]>
commit 6b1f40cf4840820051d69646af0b6503878cb1bc upstream.
The mcb_device_id table is supposed to be zero-terminated.
--- drivers/tty/serial/men_z135_uart.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/serial/men_z135_uart.c +1 -0
@@ -809,6 +809,7 @@ static void men_z135_remove(struct mcb_dstatic const struct mcb_device_id men_z135_ids[] = { { .device =0x87 }, + { } };MODULE_DEVICE_TABLE (mcb, men_z135_ids);
Greg Kroah-Hartman
maintainerPATCH 96/150 serial: samsung: wait for transfer completion before clock disable
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robert Baldyga <[email protected]>
commit 1ff383a4c3eda8893ec61b02831826e1b1f46b41 upstream.
This patch adds waiting until transmit buffer and shifter will be empty before clock disabling.
Without this fix it's possible to have clock disabled while data was not transmited yet, which causes unproper state of TX line and problems in following data transfers.
--- drivers/tty/serial/samsung.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/tty/serial/samsung.c +4 -0
@@ -559,11 +559,15 @@ static void s3c24xx_serial_pm(struct uar unsigned int old) {struct s3c24xx_uart_port *ourport =to_ourport (port); +int timeout =10000 ; ourport->pm_level = level;switch (level) {case 3 : +while (--timeout && !s3c24xx_serial_txempty_nofifo (port)) +udelay (100 ); +if (!IS_ERR (ourport->baudclk))clk_disable_unprepare (ourport->baudclk);
Greg Kroah-Hartman
maintainerPATCH 97/150 xtensa: fix kmap_prot definition
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Max Filippov <[email protected]>
commit ff009ab6d4d4581b62fa055ab6233133aca25ab8 upstream.
Replace PAGE_KERNEL with PAGE_KERNEL_EXEC to allow copy_to_user_page invalidate icache for pages mapped with kmap.
--- arch/xtensa/include/asm/highmem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/xtensa/include/asm/highmem.h +1 -1
@@ -25,7 +25,7 @@#define PKMAP_NR (virt) (((virt) - PKMAP_BASE) >> PAGE_SHIFT)#define PKMAP_ADDR (nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) -#define kmap_prot PAGE_KERNEL +#define kmap_prot PAGE_KERNEL_EXEC#if DCACHE_WAY_SIZE >PAGE_SIZE #define get_pkmap_color get_pkmap_color
Greg Kroah-Hartman
maintainerPATCH 99/150 n_tty: Fix read_buf race condition, increment read_head after pushing data
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Riesch <[email protected]>
commit 8bfbe2de769afda051c56aba5450391670e769fc upstream.
Commit 19e2ad6a09f0c06dbca19c98e5f4584269d913dd ("n_tty: Remove overflow tests from receive_buf() path") moved the increment of read_head into the arguments list of read_buf_addr(). Function calls represent a sequence point in C. Therefore read_head is incremented before the character c is placed in the buffer. Since the circular read buffer is a lock-less design since commit 6d76bd2618535c581f1673047b8341fd291abc67 ("n_tty: Make N_TTY ldisc receive path lockless"), this creates a race condition that leads to communication errors.
This patch modifies the code to increment read_head _after_ the data is placed in the buffer and thus fixes the race for non-SMP machines. To fix the problem for SMP machines, memory barriers must be added in a separate patch.
--- drivers/tty/n_tty.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/tty/n_tty.c +2 -1
@@ -321,7 +321,8 @@ static void n_tty_check_unthrottle(strucstatic inline void put_tty_queue (unsigned char c,struct n_tty_data *ldata) { - *read_buf_addr (ldata, ldata->read_head++) = c; + *read_buf_addr (ldata, ldata->read_head) = c; + ldata->read_head++; }/**
Greg Kroah-Hartman
maintainerPATCH 100/150 Drivers: hv: vmbus: Fix a race condition when unregistering a device
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vitaly Kuznetsov <[email protected]>
commit 04a258c162a85c0f4ae56be67634dc43c9a4fa9b upstream.
When build with Debug the following crash is sometimes observed:
Call Trace: [<ffffffff812b9600>] string+0x40/0x100 [<ffffffff812bb038>] vsnprintf+0x218/0x5e0 [<ffffffff810baf7d>] ? trace_hardirqs_off+0xd/0x10 [<ffffffff812bb4c1>] vscnprintf+0x11/0x30 [<ffffffff8107a2f0>] vprintk+0xd0/0x5c0 [<ffffffffa0051ea0>] ? vmbus_process_rescind_offer+0x0/0x110 [hv_vmbus] [<ffffffff8155c71c>] printk+0x41/0x45 [<ffffffffa004ebac>] vmbus_device_unregister+0x2c/0x40 [hv_vmbus] [<ffffffffa0051ecb>] vmbus_process_rescind_offer+0x2b/0x110 [hv_vmbus]
...
This happens due to the following race: between 'if (channel->device_obj)' check in vmbus_process_rescind_offer() and pr_debug() in vmbus_device_unregister() the device can disappear. Fix the issue by taking an additional reference to the device before proceeding to vmbus_device_unregister().
--- drivers/hv/channel_mgmt.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/hv/channel_mgmt.c +9 -2
@@ -216,9 +216,16 @@ static void vmbus_process_rescind_offer(unsigned long flags;struct vmbus_channel *primary_channel;struct vmbus_channel_relid_released msg; +struct device *dev; + +if (channel->device_obj) { + dev =get_device (&channel->device_obj->device); +if (dev) { +vmbus_device_unregister (channel->device_obj); +put_device (dev); + } + } -if (channel->device_obj) -vmbus_device_unregister (channel->device_obj);memset (&msg,0 ,sizeof (struct vmbus_channel_relid_released )); msg.child_relid = channel->offermsg.child_relid; msg.header.msgtype =CHANNELMSG_RELID_RELEASED ;
Greg Kroah-Hartman
maintainerPATCH 101/150 Drivers: hv: util: make struct hv_do_fcopy match Hyper-V host messages
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vitaly Kuznetsov <[email protected]>
commit 31d4ea1a093fcf668d5f95af44b8d41488bdb7ec upstream.
An attempt to fix fcopy on i586 (bc5a5b0 Drivers: hv: util: Properly pack the data for file copy functionality) led to a regression on x86_64 (and actually didn't fix i586 breakage). Fcopy messages from Hyper-V host come in the following format:
struct do_fcopy_hdr | 36 bytes 0000 | 4 bytes offset | 8 bytes size | 4 bytes data | 6144 bytes
On x86_64 struct hv_do_fcopy matched this format without ' __attribute__((packed))' and on i586 adding ' __attribute__((packed))' to it doesn't change anything. Keep the structure packed and add padding to match re reality. Tested both i586 and x86_64 on Hyper-V Server 2012 R2.
--- include/uapi/linux/hyperv.h | 1 + 1 file changed, 1 insertion(+)
include/uapi/linux/hyperv.h +1 -0
@@ -134,6 +134,7 @@ struct hv_start_fcopy {struct hv_do_fcopy {struct hv_fcopy_hdr hdr; +__u32 pad;__u64 offset;__u32 size;__u8 data[DATA_FRAGMENT ];
Greg Kroah-Hartman
maintainerPATCH 102/150 fs: nfsd: Fix signedness bug in compare_blob
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rasmus Villemoes <[email protected]>
commit ef17af2a817db97d42dd2ec0a425231748e23dbc upstream.
Bugs similar to the one in acbbe6fbb240 (kcmp: fix standard comparison bug) are in rich supply.
In this variant, the problem is that struct xdr_netobj::len has type unsigned int, so the expression o1->len - o2->len _also_ has type unsigned int; it has completely well-defined semantics, and the result is some non-negative integer, which is always representable in a long long. But this means that if the conditional triggers, we are guaranteed to return a positive value from compare_blob.
In this case it could be fixed by
- res = o1->len - o2->len;
+ res = (long long)o1->len - (long long)o2->len;
but I'd rather eliminate the usually broken 'return a - b;' idiom.
--- fs/nfsd/nfs4state.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
fs/nfsd/nfs4state.c +7 -8
@@ -1711,15 +1711,14 @@ static int copy_cred(struct svc_cred *tareturn 0 ; } -static long long +static int compare_blob (const struct xdr_netobj *o1,const struct xdr_netobj *o2) { -long long res; - - res = o1->len - o2->len; -if (res) -return res; -return (long long )memcmp (o1->data, o2->data, o1->len); +if (o1->len < o2->len) +return -1 ; +if (o1->len > o2->len) +return 1 ; +return memcmp (o1->data, o2->data, o1->len); }static int same_name (const char *n1,const char *n2)
@@ -1907,7 +1906,7 @@ add_clp_to_name_tree(struct nfs4_clientstatic struct nfs4_client *find_clp_in_name_tree (struct xdr_netobj *name,struct rb_root *root) { -long long cmp; +int cmp;struct rb_node *node = root->rb_node;struct nfs4_client *clp;
Greg Kroah-Hartman
maintainerPATCH 103/150 nfsd4: fix xdr4 inclusion of escaped char
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Coddington <[email protected]>
commit 5a64e56976f1ba98743e1678c0029a98e9034c81 upstream.
Fix a bug where nfsd4_encode_components_esc() includes the esc_end char as an additional string encoding.
--- fs/nfsd/nfs4xdr.c | 3 +++ 1 file changed, 3 insertions(+)
fs/nfsd/nfs4xdr.c +3 -0
@@ -1795,6 +1795,9 @@ static __be32 nfsd4_encode_components_es }else end++; +if (found_esc) + end = next; + str = end; } pathlen =htonl (xdr->buf->len - pathlen_offset);
Greg Kroah-Hartman
maintainerPATCH 104/150 nfsd4: fix xdr4 count of server in fs_location4
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Coddington <[email protected]>
commit bf7491f1be5e125eece2ec67e0f79d513caa6c7e upstream.
Fix a bug where nfsd4_encode_components_esc() incorrectly calculates the length of server array in fs_location4--note that it is a count of the number of array elements, not a length in bytes.
--- fs/nfsd/nfs4xdr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfs4xdr.c +1 -1
@@ -1800,7 +1800,7 @@ static __be32 nfsd4_encode_components_es str = end; } - pathlen =htonl (xdr->buf->len - pathlen_offset); + pathlen =htonl (count);write_bytes_to_xdr_buf (xdr->buf, pathlen_offset, &pathlen,4 );return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 105/150 nfsd: fix fi_delegees leak when fi_had_conflict returns true
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit 94ae1db226a5bcbb48372d81161f084c9e283fd8 upstream.
Currently, nfs4_set_delegation takes a reference to an existing delegation and then checks to see if there is a conflict. If there is one, then it doesn't release that reference.
Change the code to take the reference after the check and only if there is no conflict.
--- fs/nfsd/nfs4state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfs4state.c +1 -1
@@ -3890,11 +3890,11 @@ nfs4_set_delegation(struct nfs4_client * status =nfs4_setlease (dp); goto out; } -atomic_inc (&fp->fi_delegees);if (fp->fi_had_conflict) { status = -EAGAIN ; goto out_unlock; } +atomic_inc (&fp->fi_delegees);hash_delegation_locked (dp, fp); status =0 ; out_unlock:
Greg Kroah-Hartman
maintainerPATCH 106/150 ACPI / video: update the skip case for acpi_video_device_in_dod()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Lu <[email protected]>
commit b4df463678fb9c6dae9548dbb7545993779fd416 upstream.
If the firmware has declared more than 8 video output devices, and the one that control the internal panel's backlight is listed after the first 8 output devices, the _DOD will not include it due to the current i915 operation region implementation. As a result, we will not create a backlight device for it while we should. Solve this problem by special case the firmware that has 8+ output devices in that if we see such a firmware, we do not test if the device is in _DOD list. The creation of the backlight device will also enable the firmware to emit events on backlight hotkey press when the acpi_osi= cmdline option is specified on those affected ASUS laptops.
--- drivers/acpi/video.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/acpi/video.c +8 -2
@@ -155,6 +155,7 @@ struct acpi_video_bus {u8 dos_setting;struct acpi_video_enumerated_device *attached_array;u8 attached_count; +u8 child_count;struct acpi_video_bus_cap cap;struct acpi_video_bus_flags flags;struct list_head video_device_list;
@@ -1159,8 +1160,12 @@ static bool acpi_video_device_in_dod(strstruct acpi_video_bus *video = device->video;int i; -/* If we have a broken _DOD, no need to test */ -if (!video->attached_count) +/* +* If we have a broken _DOD or we have more than 8 output devices +* under the graphics controller node that we can't proper deal with +* in the operation region code currently, no need to test. +*/ +if (!video->attached_count || video->child_count >8 )return true;for (i =0 ; i < video->attached_count; i++) {
@@ -1413,6 +1418,7 @@ acpi_video_bus_get_devices(struct acpi_vdev_err (&dev->dev,"Can't attach device\n" );break ; } + video->child_count++; }return status; }
Greg Kroah-Hartman
maintainerPATCH 107/150 ceph: do_sync is never initialized
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 021b77bee210843bed1ea91b5cad58235ff9c8e5 upstream.
Probably this code was syncing a lot more often then intended because the do_sync variable wasn't set to zero.
--- fs/ceph/addr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/addr.c +1 -1
@@ -673,7 +673,7 @@ static int ceph_writepages_start(structint rc =0 ;unsigned wsize =1 << inode->i_blkbits;struct ceph_osd_request *req =NULL ; -int do_sync; +int do_sync =0 ;u64 truncate_size, snap_size;u32 truncate_seq;
Greg Kroah-Hartman
maintainerPATCH 108/150 mtd: tests: abort torturetest on erase errors
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Norris <[email protected]>
commit 68f29815034e9dc9ed53cad85946c32b07adc8cc upstream.
The torture test should quit once it actually induces an error in the flash. This step was accidentally removed during refactoring.
Without this fix, the torturetest just continues infinitely, or until the maximum cycle count is reached. e.g.:
...
[ 7619.218171] mtd_test: error -5 while erasing EB 100 [ 7619.297981] mtd_test: error -5 while erasing EB 100 [ 7619.377953] mtd_test: error -5 while erasing EB 100 [ 7619.457998] mtd_test: error -5 while erasing EB 100 [ 7619.537990] mtd_test: error -5 while erasing EB 100 ...
--- drivers/mtd/tests/torturetest.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mtd/tests/torturetest.c +3 -1
@@ -264,7 +264,9 @@ static int __init tort_init(void)int i;void *patt; -mtdtest_erase_good_eraseblocks (mtd, bad_ebs, eb, ebcnt); + err =mtdtest_erase_good_eraseblocks (mtd, bad_ebs, eb, ebcnt); +if (err) + goto out;/* Check if the eraseblocks contain only 0xFF bytes */ if (check) {
Greg Kroah-Hartman
maintainerPATCH 109/150 MTD: m25p80: fix inconsistency in m25p_ids compared to spi_nor_ids
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alison Chaiken <[email protected]>
commit 834b686552d9018e2d17bd56ac5361b78bcc75b8 upstream.
As stated in a5b7616c5, "mtd: m25p80,spi-nor: Fix module aliases for m25p80", m25p_ids[] in m25p80.c needs to be kept in sync with spi_nor_ids[] in spi-nor.c. The change here corrects a misalignment.
(We were missing m25px80 and we had a duplicate w25q128.)
--- drivers/mtd/devices/m25p80.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mtd/devices/m25p80.c +3 -3
@@ -300,11 +300,11 @@ static const struct spi_device_id m25p_i {"m45pe10"}, {"m45pe80"}, {"m45pe16"}, {"m25pe20"}, {"m25pe80"}, {"m25pe16"}, {"m25px16"}, {"m25px32"}, {"m25px32-s0"}, {"m25px32-s1"}, - {"m25px64"}, + {"m25px64"}, {"m25px80"}, {"w25x10"}, {"w25x20"}, {"w25x40"}, {"w25x80"}, {"w25x16"}, {"w25x32"}, {"w25q32"}, {"w25q32dw"}, - {"w25x64"}, {"w25q64"}, {"w25q128"}, {"w25q80"}, - {"w25q80bl"}, {"w25q128"}, {"w25q256"}, {"cat25c11"}, + {"w25x64"}, {"w25q64"}, {"w25q80"}, {"w25q80bl"}, + {"w25q128"}, {"w25q256"}, {"cat25c11"}, {"cat25c03"}, {"cat25c09"}, {"cat25c17"}, {"cat25128"}, { }, };
Greg Kroah-Hartman
maintainerPATCH 110/150 mtd: nand: omap: Fix NAND enumeration on 3430 LDP
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roger Quadros <[email protected]>
commit 775a9134f4398ca98a10af8cc3cf9b664017267f upstream.
3430LDP has NAND flash with 32 bytes OOB size which is sufficient to hold BCH8 codes but the small page check introduced in
commit b491da7233d5 ("mtd: nand: omap: clean-up ecc layout for BCH ecc schemes") considers anything below 64 bytes unsuitable for BCH4/8/16. There is another bug in that code where it doesn't skip the check for OMAP_ECC_HAM1_CODE_SW.
Get rid of that small page check code as it is insufficient and redundant because we are checking for OOB available bytes vs ecc layout before calling nand_scan_tail().
--- drivers/mtd/nand/omap2.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/mtd/nand/omap2.c +0 -7
@@ -1741,13 +1741,6 @@ static int omap_nand_probe(struct platfo goto return_error; } -/* check for small page devices */ -if ((mtd->oobsize <64 ) && (pdata->ecc_opt !=OMAP_ECC_HAM1_CODE_HW )) { -dev_err (&info->pdev->dev,"small page devices are not supported\n" ); - err = -EINVAL ; - goto return_error; - } -/* re-populate low-level callbacks based on xfer modes */ switch (pdata->xfer_type) {case NAND_OMAP_PREFETCH_POLLED :
Greg Kroah-Hartman
maintainerPATCH 111/150 nilfs2: fix the nilfs_iget() vs. nilfs_new_inode() races
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit 705304a863cc41585508c0f476f6d3ec28cf7e00 upstream.
Same story as in commit 41080b5a2401 ("nfsd race fixes: ext2") (similar ext2 fix) except that nilfs2 needs to use insert_inode_locked4() instead of insert_inode_locked() and a bug of a check for dead inodes needs to be fixed.
If nilfs_iget() is called from nfsd after nilfs_new_inode() calls insert_inode_locked4(), nilfs_iget() will wait for unlock_new_inode() at the end of nilfs_mkdir()/nilfs_create()/etc to unlock the inode.
If nilfs_iget() is called before nilfs_new_inode() calls insert_inode_locked4(), it will create an in-core inode and read its data from the on-disk inode. But, nilfs_iget() will find i_nlink equals zero and fail at nilfs_read_inode_common(), which will lead it to call iget_failed() and cleanly fail.
However, this sanity check doesn't work as expected for reused on-disk inodes because they leave a non-zero value in i_mode field and it hinders the test of i_nlink. This patch also fixes the issue by removing the test on i_mode that nilfs2 doesn't need.
--- fs/nilfs2/inode.c | 32 ++++++++++++++++++++++++-------- fs/nilfs2/namei.c | 15 ++++++++++++--- 2 files changed, 36 insertions(+), 11 deletions(-)
fs/nilfs2/inode.c +24 -8
@@ -49,6 +49,8 @@ struct nilfs_iget_args {int for_gc; }; +static int nilfs_iget_test (struct inode *inode,void *opaque); +void nilfs_inode_add_blocks (struct inode *inode,int n) {struct nilfs_root *root =NILFS_I (inode)->i_root;
@@ -348,6 +350,17 @@ const struct address_space_operations ni .is_partially_uptodate = block_is_partially_uptodate, }; +static int nilfs_insert_inode_locked (struct inode *inode, +struct nilfs_root *root, +unsigned long ino) +{ +struct nilfs_iget_args args = { + .ino = ino, .root = root, .cno =0 , .for_gc =0 + }; + +return insert_inode_locked4 (inode, ino, nilfs_iget_test, &args); +} +struct inode *nilfs_new_inode (struct inode *dir,umode_t mode) {struct super_block *sb = dir->i_sb;
@@ -383,7 +396,7 @@ struct inode *nilfs_new_inode(struct inoif (S_ISREG (mode) ||S_ISDIR (mode) ||S_ISLNK (mode)) { err =nilfs_bmap_read (ii->i_bmap,NULL );if (err <0 ) - goto failed_bmap; + goto failed_after_creation;set_bit (NILFS_I_BMAP , &ii->i_state);/* No lock is needed; iget() ensures it. */
@@ -399,21 +412,24 @@ struct inode *nilfs_new_inode(struct inospin_lock (&nilfs->ns_next_gen_lock); inode->i_generation = nilfs->ns_next_generation++;spin_unlock (&nilfs->ns_next_gen_lock); -insert_inode_hash (inode); +if (nilfs_insert_inode_locked (inode, root, ino) <0 ) { + err = -EIO ; + goto failed_after_creation; + } err =nilfs_init_acl (inode, dir);if (unlikely (err)) - goto failed_acl;/* never occur. When supporting + goto failed_after_creation;/* never occur. When supporting nilfs_init_acl(), proper cancellation of above jobs should be considered */ return inode; - failed_acl: - failed_bmap: + failed_after_creation:clear_nlink (inode); +unlock_new_inode (inode);iput (inode);/* raw_inode will be deleted through -generic_delete_inode() */ +nilfs_evict_inode() */ goto failed; failed_ifile_create_inode:
@@ -461,8 +477,8 @@ int nilfs_read_inode_common(struct inode inode->i_atime.tv_nsec =le32_to_cpu (raw_inode->i_mtime_nsec); inode->i_ctime.tv_nsec =le32_to_cpu (raw_inode->i_ctime_nsec); inode->i_mtime.tv_nsec =le32_to_cpu (raw_inode->i_mtime_nsec); -if (inode->i_nlink ==0 && inode->i_mode ==0 ) -return -EINVAL ;/* this inode is deleted */ +if (inode->i_nlink ==0 ) +return -ESTALE ;/* this inode is deleted */ inode->i_blocks =le64_to_cpu (raw_inode->i_blocks); ii->i_flags =le32_to_cpu (raw_inode->i_flags);
fs/nilfs2/namei.c +12 -3
@@ -51,9 +51,11 @@ static inline int nilfs_add_nondir(strucint err =nilfs_add_link (dentry, inode);if (!err) {d_instantiate (dentry, inode); +unlock_new_inode (inode);return 0 ; }inode_dec_link_count (inode); +unlock_new_inode (inode);iput (inode);return err; }
@@ -182,6 +184,7 @@ out: out_fail:drop_nlink (inode);nilfs_mark_inode_dirty (inode); +unlock_new_inode (inode);iput (inode); goto out; }
@@ -201,11 +204,15 @@ static int nilfs_link(struct dentry *oldinode_inc_link_count (inode);ihold (inode); - err =nilfs_add_nondir (dentry, inode); -if (!err) + err =nilfs_add_link (dentry, inode); +if (!err) { +d_instantiate (dentry, inode); err =nilfs_transaction_commit (dir->i_sb); -else + }else { +inode_dec_link_count (inode); +iput (inode);nilfs_transaction_abort (dir->i_sb); + }return err; }
@@ -243,6 +250,7 @@ static int nilfs_mkdir(struct inode *dirnilfs_mark_inode_dirty (inode);d_instantiate (dentry, inode); +unlock_new_inode (inode); out:if (!err) err =nilfs_transaction_commit (dir->i_sb);
@@ -255,6 +263,7 @@ out_fail:drop_nlink (inode);drop_nlink (inode);nilfs_mark_inode_dirty (inode); +unlock_new_inode (inode);iput (inode); out_dir:drop_nlink (dir);
Greg Kroah-Hartman
maintainerPATCH 112/150 scripts/kernel-doc: dont eat struct members with __aligned
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit 7b990789a4c3420fa57596b368733158e432d444 upstream.
The change from \d+ to .+ inside __aligned() means that the following structure:
struct test {
u8 a __aligned(2);
u8 b __aligned(2);
};essentially gets modified to
struct test {
u8 a;
};for purposes of kernel-doc, thus dropping a struct member, which in turns causes warnings and invalid kernel-doc generation.
Fix this by replacing the catch-all (".") with anything that's not a semicolon ("[^;]").
--- scripts/kernel-doc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kernel-doc +1 -1
@@ -1753,7 +1753,7 @@ sub dump_struct($$) { # strip kmemcheck_bitfield_{begin,end}.*; $members =~ s/kmemcheck_bitfield_.*?;//gos; # strip attributes - $members =~ s/__aligned\s*\(.+\)//gos; + $members =~ s/__aligned\s*\([^;]*\)//gos; create_parameterlist($members, ';', $file); check_sections($file, $declaration_name, "struct", $sectcheck, $struct_actual, $nested);
Greg Kroah-Hartman
maintainerPATCH 113/150 sched/deadline: Fix migration of SCHED_DEADLINE tasks
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Abeni <[email protected]>
commit 6a503c3be937d275113b702e0421e5b0720abe8a upstream.
According to global EDF, tasks should be migrated between runqueues without checking if their scheduling deadlines and runtimes are valid. However, SCHED_DEADLINE currently performs such a check:
a migration happens doing:
deactivate_task(rq, next_task, 0); set_task_cpu(next_task, later_rq->cpu); activate_task(later_rq, next_task, 0);
which ends up calling dequeue_task_dl(), setting the new CPU, and then calling enqueue_task_dl().
enqueue_task_dl() then calls enqueue_dl_entity(), which calls update_dl_entity(), which can modify scheduling deadline and runtime, breaking global EDF scheduling.
As a result, some of the properties of global EDF are not respected:
for example, a taskset {(30, 80), (40, 80), (120, 170)} scheduled on two cores can have unbounded response times for the third task even if 30/80+40/80+120/170 = 1.5809 < 2
This can be fixed by invoking update_dl_entity() only in case of wakeup, or if this is a new SCHED_DEADLINE task.
--- kernel/sched/deadline.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/sched/deadline.c +3 -3
@@ -831,10 +831,10 @@ enqueue_dl_entity(struct sched_dl_entity* parameters of the task might need updating. Otherwise, * we want a replenishment of its runtime. */ -if (!dl_se->dl_new && flags &ENQUEUE_REPLENISH ) -replenish_dl_entity (dl_se, pi_se); -else +if (dl_se->dl_new || flags &ENQUEUE_WAKEUP )update_dl_entity (dl_se, pi_se); +else if (flags &ENQUEUE_REPLENISH ) +replenish_dl_entity (dl_se, pi_se);__enqueue_dl_entity (dl_se); }
Greg Kroah-Hartman
maintainerPATCH 114/150 sched/deadline: Avoid double-accounting in case of missed deadlines
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Abeni <[email protected]>
commit 269ad8015a6b2bb1cf9e684da4921eb6fa0a0c88 upstream.
The dl_runtime_exceeded() function is supposed to ckeck if a SCHED_DEADLINE task must be throttled, by checking if its current runtime is <= 0. However, it also checks if the scheduling deadline has been missed (the current time is larger than the current scheduling deadline), further decreasing the runtime if this happens.
This "double accounting" is wrong:
- In case of partitioned scheduling (or single CPU), this happens if task_tick_dl() has been called later than expected (due to small HZ values). In this case, the current runtime is also negative, and replenish_dl_entity() can take care of the deadline miss by recharging the current runtime to a value smaller than dl_runtime
- In case of global scheduling on multiple CPUs, scheduling deadlines can be missed even if the task did not consume more runtime than expected, hence penalizing the task is wrong
This patch fix this problem by throttling a SCHED_DEADLINE task only when its runtime becomes negative, and not modifying the runtime
--- kernel/sched/deadline.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-)
kernel/sched/deadline.c +1 -18
@@ -575,24 +575,7 @@ void init_dl_task_timer(struct sched_dl_static int dl_runtime_exceeded (struct rq *rq,struct sched_dl_entity *dl_se) { -int dmiss =dl_time_before (dl_se->deadline,rq_clock (rq)); -int rorun = dl_se->runtime <=0 ; - -if (!rorun && !dmiss) -return 0 ; - -/* -* If we are beyond our current deadline and we are still -* executing, then we have already used some of the runtime of -* the next instance. Thus, if we do not account that, we are -* stealing bandwidth from the system at each deadline miss! -*/ -if (dmiss) { - dl_se->runtime = rorun ? dl_se->runtime :0 ; - dl_se->runtime -=rq_clock (rq) - dl_se->deadline; - } - -return 1 ; +return (dl_se->runtime <=0 ); }extern bool sched_rt_bandwidth_account (struct rt_rq *rt_rq);
Greg Kroah-Hartman
maintainerPATCH 115/150 sched: Add missing rcu protection to wake_up_all_idle_cpus
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit fd7de1e8d5b2b2b35e71332fafb899f584597150 upstream.
Locklessly doing is_idle_task(rq->curr) is only okay because of RCU protection. The older variant of the broken code checked rq->curr == rq->idle instead and therefore didn't need RCU.
--- kernel/sched/core.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
kernel/sched/core.c +7 -2
@@ -1623,8 +1623,10 @@ void wake_up_if_idle(int cpu)struct rq *rq =cpu_rq (cpu);unsigned long flags; -if (!is_idle_task (rq->curr)) -return ; +rcu_read_lock (); + +if (!is_idle_task (rcu_dereference (rq->curr))) + goto out;if (set_nr_if_polling (rq->idle)) {trace_sched_wake_idle_without_ipi (cpu);
@@ -1635,6 +1637,9 @@ void wake_up_if_idle(int cpu)/* Else cpu is not in idle, do nothing here */ raw_spin_unlock_irqrestore (&rq->lock, flags); } + +out: +rcu_read_unlock (); }bool cpus_share_cache (int this_cpu,int that_cpu)
Greg Kroah-Hartman
maintainerPATCH 116/150 ARM: dts: am437x-sk: fix lcd enable pin mux data
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felipe Balbi <[email protected]>
commit 58230c2c443bc9801293f6535144d04ceaf731e0 upstream.
Caused by a copy & paste error. Note that even with this bug AM437x SK display still works because GPIO mux mode is always enabled. It's still wrong to mux somebody else's pin.
Luckily ball D25 (offset 0x238 - gpio5_8) on AM437x isn't used for anything.
While at that, also replace a pullup with a pulldown as that gpio should be normally low, not high.
--- arch/arm/boot/dts/am437x-sk-evm.dts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm/boot/dts/am437x-sk-evm.dts +1 -2
@@ -320,8 +320,7 @@ lcd_pins: lcd_pins { pinctrl-single,pins = < - /* GPIO 5_8 to select LCD / HDMI */ - 0x238 (PIN_OUTPUT_PULLUP | MUX_MODE7) + 0x1c (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpcm_ad7.gpio1_7 */ >; }; };
Greg Kroah-Hartman
maintainerPATCH 117/150 ARM: dts: am437x-sk-evm.dts: fix LCD timings
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomi Valkeinen <[email protected]>
commit d73f825e6efa723e81d9ffcc4949fe9f03f1df29 upstream.
The lcd0 node for am437x-sk-evm.dts contains bad LCD timings, and while they seem to work with a quick test, doing for example blank/unblank will give you a black display.
This patch updates the timings to the 'typical' values from the LCD spec sheet.
Also, the compatible string is completely bogus, as "osddisplays,osd057T0559-34ts" is _not_ a 480x272 panel. The panel on the board is a newhaven one. Update the compatible string to reflect this. Note that this hasn't caused any issues, as the "panel-dpi" matches the driver.
--- arch/arm/boot/dts/am437x-sk-evm.dts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm/boot/dts/am437x-sk-evm.dts +6 -6
@@ -100,7 +100,7 @@ }; lcd0: display { - compatible = "osddisplays,osd057T0559-34ts", "panel-dpi"; + compatible = "newhaven,nhd-4.3-480272ef-atxl", "panel-dpi"; label = "lcd"; pinctrl-names = "default";
@@ -112,11 +112,11 @@ clock-frequency = <9000000>; hactive = <480>; vactive = <272>; - hfront-porch = <8>; - hback-porch = <43>; - hsync-len = <4>; - vback-porch = <12>; - vfront-porch = <4>; + hfront-porch = <2>; + hback-porch = <2>; + hsync-len = <41>; + vfront-porch = <2>; + vback-porch = <2>; vsync-len = <10>; hsync-active = <0>; vsync-active = <0>;
Greg Kroah-Hartman
maintainerPATCH 118/150 ARM: defconfigs: use CONFIG_CPUFREQ_DT
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viresh Kumar <[email protected]>
commit 9d312cd12e89ce08add99fe66e8f6baeaca16d7d upstream.
CONFIG_GENERIC_CPUFREQ_CPU0 disappeared with commit bbcf071969b20f ("cpufreq: cpu0: rename driver and internals to 'cpufreq_dt'") and some defconfigs are still using it instead of the new one.
Use the renamed CONFIG_CPUFREQ_DT generic driver.
--- arch/arm/configs/multi_v7_defconfig | 2 +- arch/arm/configs/shmobile_defconfig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/configs/multi_v7_defconfig +1 -1
@@ -446,4 +446,4 @@ CONFIG_DEBUG_FS=y CONFIG_MAGIC_SYSRQ=y CONFIG_LOCKUP_DETECTOR=y CONFIG_CRYPTO_DEV_TEGRA_AES=y -CONFIG_GENERIC_CPUFREQ_CPU0=y +CONFIG_CPUFREQ_DT=y
arch/arm/configs/shmobile_defconfig +1 -1
@@ -176,5 +176,5 @@ CONFIG_CPU_FREQ_GOV_USERSPACE=y CONFIG_CPU_FREQ_GOV_ONDEMAND=y CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y CONFIG_CPU_THERMAL=y -CONFIG_GENERIC_CPUFREQ_CPU0=y +CONFIG_CPUFREQ_DT=y CONFIG_REGULATOR_DA9210=y
Greg Kroah-Hartman
maintainerPATCH 119/150 ARM: dts: DRA7: wdt: Fix compatible property for watchdog node
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lokesh Vutla <[email protected]>
commit be6688350a4470e417aaeca54d162652aab40ac5 upstream.
OMAP wdt driver supports only ti,omap3-wdt compatible. In DRA7 dt wdt compatible property is defined as ti,omap4-wdt by mistake instead of ti,omap3-wdt. Correcting the typo.
--- arch/arm/boot/dts/dra7.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/dra7.dtsi +1 -1
@@ -653,7 +653,7 @@ }; wdt2: wdt@4ae14000 { - compatible = "ti,omap4-wdt"; + compatible = "ti,omap3-wdt"; reg = <0x4ae14000 0x80>; interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>; ti,hwmods = "wd_timer2";
Greg Kroah-Hartman
maintainerPATCH 120/150 ARM: dts: Enable PWM node by default for s3c64xx
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Figa <[email protected]>
commit 5e794de514f56de1e78e979ca09c56a91aa2e9f1 upstream.
The PWM block is required for system clock source so it must be always enabled. This patch fixes boot issues on SMDK6410 which did not have the node enabled explicitly for other purposes.
--- arch/arm/boot/dts/s3c6410-mini6410.dts | 4 ---- arch/arm/boot/dts/s3c64xx.dtsi | 1 - 2 files changed, 5 deletions(-)
arch/arm/boot/dts/s3c6410-mini6410.dts +0 -4
@@ -198,10 +198,6 @@ status = "okay"; }; -&pwm { - status = "okay"; -}; - &pinctrl0 { gpio_leds: gpio-leds { samsung,pins = "gpk-4", "gpk-5", "gpk-6", "gpk-7";
arch/arm/boot/dts/s3c64xx.dtsi +0 -1
@@ -172,7 +172,6 @@ clocks = <&clocks PCLK_PWM>; samsung,pwm-outputs = <0>, <1>; #pwm-cells = <3>; - status = "disabled"; }; pinctrl0: pinctrl@7f008000 {
Greg Kroah-Hartman
maintainerPATCH 121/150 ARM: OMAP4: PM: Only do static dependency configuration in omap4_init_static_deps
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nishanth Menon <[email protected]>
commit 9008d83fe9dc2e0f19b8ba17a423b3759d8e0fd7 upstream.
Commit 705814b5ea6f ("ARM: OMAP4+: PM: Consolidate OMAP4 PM code to re-use it for OMAP5")
Moved logic generic for OMAP5+ as part of the init routine by introducing omap4_pm_init. However, the patch left the powerdomain initial setup, an unused omap4430 es1.0 check and a spurious log "Power Management for TI OMAP4." in the original code.
Remove the duplicate code which is already present in omap4_pm_init from omap4_init_static_deps.
As part of this change, also move the u-boot version print out of the static dependency function to the omap4_pm_init function.
--- arch/arm/mach-omap2/pm44xx.c | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-)
arch/arm/mach-omap2/pm44xx.c +9 -20
@@ -160,26 +160,6 @@ static inline int omap4_init_static_depsstruct clockdomain *ducati_clkdm, *l3_2_clkdm;int ret =0 ; -if (omap_rev () ==OMAP4430_REV_ES1_0 ) { -WARN (1 ,"Power Management not supported on OMAP4430 ES1.0\n" ); -return -ENODEV ; - } - -pr_err ("Power Management for TI OMAP4.\n" ); -/* -* OMAP4 chip PM currently works only with certain (newer) -* versions of bootloaders. This is due to missing code in the -* kernel to properly reset and initialize some devices. -* http://www.spinics.net/lists/arm-kernel/msg218641.html -*/ -pr_warn ("OMAP4 PM: u-boot >= v2012.07 is required for full PM support\n" ); - - ret =pwrdm_for_each (pwrdms_setup,NULL ); -if (ret) { -pr_err ("Failed to setup powerdomains\n" ); -return ret; - } -/* * The dynamic dependency between MPUSS -> MEMIF and * MPUSS -> L4_PER/L3_* and DUCATI -> L3_* doesn't work as
@@ -272,6 +252,15 @@ int __init omap4_pm_init(void)pr_info ("Power Management for TI OMAP4+ devices.\n" ); +/* +* OMAP4 chip PM currently works only with certain (newer) +* versions of bootloaders. This is due to missing code in the +* kernel to properly reset and initialize some devices. +* http://www.spinics.net/lists/arm-kernel/msg218641.html +*/ +if (cpu_is_omap44xx ()) +pr_warn ("OMAP4 PM: u-boot >= v2012.07 is required for full PM support\n" ); + ret =pwrdm_for_each (pwrdms_setup,NULL );if (ret) {pr_err ("Failed to setup powerdomains.\n" );
Greg Kroah-Hartman
maintainerPATCH 122/150 Revert "ARM: 7830/1: delay: dont bother reporting bogomips in /proc/cpuinfo"
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Machek <[email protected]>
commit 4bf9636c39ac70da091d5a2e28d3448eaa7f115c upstream.
Commit 9fc2105aeaaf ("ARM: 7830/1: delay: don't bother reporting bogomips in /proc/cpuinfo") breaks audio in python, and probably elsewhere, with message
FATAL: cannot locate cpu MHz in /proc/cpuinfo
I'm not the first one to hit it, see for example
https://theredblacktree.wordpress.com/2014/08/10/fatal-cannot-locate-cpu-mhz-in-proccpuinfo/
https://devtalk.nvidia.com/default/topic/765800/workaround-for-fatal-cannot-locate-cpu-mhz-in-proc-cpuinf/?offset=1
Reading original changelog, I have to say "Stop breaking working setups. You know who you are!".
--- arch/arm/kernel/setup.c | 9 +++++++++ arch/arm/kernel/smp.c | 13 +++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-)
arch/arm/kernel/setup.c +9 -0
@@ -1043,6 +1043,15 @@ static int c_show(struct seq_file *m, voseq_printf (m,"model name\t: %s rev %d (%s)\n" , cpu_name, cpuid &15 , elf_platform); +#if defined(CONFIG_SMP ) +seq_printf (m,"BogoMIPS\t: %lu.%02lu\n" , +per_cpu (cpu_data, i).loops_per_jiffy / (500000UL /HZ ), + (per_cpu (cpu_data, i).loops_per_jiffy / (5000UL /HZ )) %100 ); +#else +seq_printf (m,"BogoMIPS\t: %lu.%02lu\n" , + loops_per_jiffy / (500000 /HZ ), + (loops_per_jiffy / (5000 /HZ )) %100 ); +#endif /* dump out the processor features */ seq_puts (m,"Features\t: " );
arch/arm/kernel/smp.c +11 -2
@@ -387,8 +387,17 @@ asmlinkage void secondary_start_kernel(vvoid __init smp_cpus_done (unsigned int max_cpus) { -printk (KERN_INFO "SMP: Total of %d processors activated.\n" , -num_online_cpus ()); +int cpu; +unsigned long bogosum =0 ; + +for_each_online_cpu (cpu) + bogosum +=per_cpu (cpu_data, cpu).loops_per_jiffy; + +printk (KERN_INFO "SMP: Total of %d processors activated " +"(%lu.%02lu BogoMIPS).\n" , +num_online_cpus (), + bogosum / (500000 /HZ ), + (bogosum / (5000 /HZ )) %100 );hyp_mode_check (); }
Greg Kroah-Hartman
maintainerPATCH 124/150 ACPI / video: Add some Samsung models to disable_native_backlight list
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Lu <[email protected]>
commit 7d0b93499f4879ddbc75d594f4ea216ba964f78e upstream.
Several Samsung laptop models (SAMSUNG 870Z5E/880Z5E/680Z5E and SAMSUNG 370R4E/370R4V/370R5E/3570RE/370R5V) do not have a working native backlight control interface so restore their acpi_videoX interface.
For SAMSUNG 870Z5E/880Z5E/680Z5E:
For SAMSUNG 370R4E/370R4V/370R5E/3570RE/370R5V:
--- drivers/acpi/video.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/acpi/video.c +17 -0
@@ -505,6 +505,23 @@ static struct dmi_system_id video_dmi_ta DMI_MATCH(DMI_PRODUCT_NAME, "HP ENVY 15 Notebook PC"), }, }, + + { + .callback = video_disable_native_backlight, + .ident = "SAMSUNG 870Z5E/880Z5E/680Z5E", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), + DMI_MATCH(DMI_PRODUCT_NAME, "870Z5E/880Z5E/680Z5E"), + }, + }, + { + .callback = video_disable_native_backlight, + .ident = "SAMSUNG 370R4E/370R4V/370R5E/3570RE/370R5V", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), + DMI_MATCH(DMI_PRODUCT_NAME, "370R4E/370R4V/370R5E/3570RE/370R5V"), + }, + }, {} };
Greg Kroah-Hartman
maintainerPATCH 125/150 ACPI / PM: Fix PM initialization for devices that are not present
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Rafael J. Wysocki" <[email protected]>
commit 1b1f3e1699a9886f1070f94171097ab4ccdbfc95 upstream.
If an ACPI device object whose _STA returns 0 (not present and not functional) has _PR0 or _PS0, its power_manageable flag will be set and acpi_bus_init_power() will return 0 for it. Consequently, if such a device object is passed to the ACPI device PM functions, they will attempt to carry out the requested operation on the device, although they should not do that for devices that are not present.
To fix that problem make acpi_bus_init_power() return an error code for devices that are not present which will cause power_manageable to be cleared for them as appropriate in acpi_bus_get_power_flags(). However, the lists of power resources should not be freed for the device in that case, so modify acpi_bus_get_power_flags() to keep those lists even if acpi_bus_init_power() returns an error. Accordingly, when deciding whether or not the lists of power resources need to be freed, acpi_free_power_resources_lists() should check the power.flags.power_resources flag instead of flags.power_manageable, so make that change too.
Furthermore, if acpi_bus_attach() sees that flags.initialized is unset for the given device, it should reset the power management settings of the device and re-initialize them from scratch instead of relying on the previous settings (the device may have appeared after being not present previously, for example), so make it use the 'valid' flag of the D0 power state as the initial value of flags.power_manageable for it and call acpi_bus_init_power() to discover its current power state.
--- drivers/acpi/device_pm.c | 2 +- drivers/acpi/scan.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-)
drivers/acpi/device_pm.c +1 -1
@@ -257,7 +257,7 @@ int acpi_bus_init_power(struct acpi_devi device->power.state =ACPI_STATE_UNKNOWN ;if (!acpi_device_is_present (device)) -return 0 ; +return -ENXIO ; result =acpi_device_get_power (device, &state);if (result)
drivers/acpi/scan.c +8 -5
@@ -909,7 +909,7 @@ static void acpi_free_power_resources_liif (device->wakeup.flags.valid)acpi_power_resources_list_free (&device->wakeup.resources); -if (!device->flags.power_manageable) +if (!device->power.flags.power_resources)return ;for (i =ACPI_STATE_D0 ; i <=ACPI_STATE_D3_HOT ; i++) {
@@ -1631,10 +1631,8 @@ static void acpi_bus_get_power_flags(str device->power.flags.power_resources) device->power.states[ACPI_STATE_D3_COLD ].flags.os_accessible =1 ; -if (acpi_bus_init_power (device)) { -acpi_free_power_resources_lists (device); +if (acpi_bus_init_power (device)) device->flags.power_manageable =0 ; - } }static void acpi_bus_get_flags (struct acpi_device *device)
@@ -2202,13 +2200,18 @@ static void acpi_bus_attach(struct acpi_/* Skip devices that are not present. */ if (!acpi_device_is_present (device)) { device->flags.visited = false; + device->flags.power_manageable =0 ;return ; }if (device->handler) goto ok;if (!device->flags.initialized) { -acpi_bus_update_power (device,NULL ); + device->flags.power_manageable = + device->power.states[ACPI_STATE_D0 ].flags.valid; +if (acpi_bus_init_power (device)) + device->flags.power_manageable =0 ; + device->flags.initialized = true; } device->flags.visited = false;
Greg Kroah-Hartman
maintainerPATCH 126/150 Revert "Input: atmel_mxt_ts - use deep sleep mode when stopped"
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit 7f4054836d811c650c51f9c93088f8ebd61b0020 upstream.
This reverts commit 9d469d033d135d80742a4e39e6bbb4519dd5eee1.
It breaks the Chromebook Pixel touchpad (and touchscreen).
--- drivers/input/touchscreen/atmel_mxt_ts.c | 99 ++++++++----------------------- 1 file changed, 26 insertions(+), 73 deletions(-)
drivers/input/touchscreen/atmel_mxt_ts.c +26 -73
@@ -99,13 +99,9 @@#define MXT_T6_STATUS_COMSERR (1 << 2)/* MXT_GEN_POWER_T7 field */ -struct t7_config { -u8 idle; -u8 active; -} __packed; - -#define MXT_POWER_CFG_RUN 0 -#define MXT_POWER_CFG_DEEPSLEEP 1 +#define MXT_POWER_IDLEACQINT 0 +#define MXT_POWER_ACTVACQINT 1 +#define MXT_POWER_ACTV2IDLETO 2/* MXT_GEN_ACQUIRE_T8 field */ #define MXT_ACQUIRE_CHRGTIME 0
@@ -117,6 +113,7 @@ struct t7_config {#define MXT_ACQUIRE_ATCHCALSTHR 7/* MXT_TOUCH_MULTI_T9 field */ +#define MXT_TOUCH_CTRL 0#define MXT_T9_ORIENT 9#define MXT_T9_RANGE 18
@@ -256,7 +253,6 @@ struct mxt_data {bool update_input;u8 last_message_count;u8 num_touchids; -struct t7_config t7_cfg;/* Cached parameters from object table */ u16 T5_address;
@@ -672,6 +668,20 @@ static void mxt_proc_t6_messages(struct data->t6_status = status; } +static int mxt_write_object (struct mxt_data *data, +u8 type,u8 offset,u8 val) +{ +struct mxt_object *object; +u16 reg; + + object =mxt_get_object (data, type); +if (!object || offset >=mxt_obj_size (object)) +return -EINVAL ; + + reg = object->start_address; +return mxt_write_reg (data->client, reg + offset, val); +} +static void mxt_input_button (struct mxt_data *data,u8 *message) {struct input_dev *input = data->input_dev;
@@ -1742,60 +1752,6 @@ err_free_object_table:return error; } -static int mxt_set_t7_power_cfg (struct mxt_data *data,u8 sleep) -{ -struct device *dev = &data->client->dev; -int error; -struct t7_config *new_config; -struct t7_config deepsleep = { .active =0 , .idle =0 }; - -if (sleep ==MXT_POWER_CFG_DEEPSLEEP ) - new_config = &deepsleep; -else - new_config = &data->t7_cfg; - - error =__mxt_write_reg (data->client, data->T7_address, -sizeof (data->t7_cfg), new_config); -if (error) -return error; - -dev_dbg (dev,"Set T7 ACTV:%d IDLE:%d\n" , - new_config->active, new_config->idle); - -return 0 ; -} - -static int mxt_init_t7_power_cfg (struct mxt_data *data) -{ -struct device *dev = &data->client->dev; -int error; -bool retry = false; - -recheck: - error =__mxt_read_reg (data->client, data->T7_address, -sizeof (data->t7_cfg), &data->t7_cfg); -if (error) -return error; - -if (data->t7_cfg.active ==0 || data->t7_cfg.idle ==0 ) { -if (!retry) { -dev_dbg (dev,"T7 cfg zero, resetting\n" ); -mxt_soft_reset (data); - retry = true; - goto recheck; - }else { -dev_dbg (dev,"T7 cfg zero after reset, overriding\n" ); - data->t7_cfg.active =20 ; - data->t7_cfg.idle =100 ; -return mxt_set_t7_power_cfg (data,MXT_POWER_CFG_RUN ); - } - } - -dev_dbg (dev,"Initialized power cfg: ACTV %d, IDLE %d\n" , - data->t7_cfg.active, data->t7_cfg.idle); -return 0 ; -} -static int mxt_configure_objects (struct mxt_data *data,const struct firmware *cfg) {
@@ -1809,12 +1765,6 @@ static int mxt_configure_objects(structdev_warn (dev,"Error %d updating config\n" , error); } - error =mxt_init_t7_power_cfg (data); -if (error) { -dev_err (dev,"Failed to initialize power cfg\n" ); -return error; - } - error =mxt_initialize_t9_input_device (data);if (error)return error;
@@ -2093,15 +2043,16 @@ static const struct attribute_group mxt_static void mxt_start (struct mxt_data *data) { -mxt_set_t7_power_cfg (data,MXT_POWER_CFG_RUN ); - -/* Recalibrate since chip has been in deep sleep */ -mxt_t6_command (data,MXT_COMMAND_CALIBRATE ,1 , false); +/* Touch enable */ +mxt_write_object (data, +MXT_TOUCH_MULTI_T9 ,MXT_TOUCH_CTRL ,0x83 ); }static void mxt_stop (struct mxt_data *data) { -mxt_set_t7_power_cfg (data,MXT_POWER_CFG_DEEPSLEEP ); +/* Touch disable */ +mxt_write_object (data, +MXT_TOUCH_MULTI_T9 ,MXT_TOUCH_CTRL ,0 ); }static int mxt_input_open (struct input_dev *dev)
@@ -2267,6 +2218,8 @@ static int mxt_resume(struct device *devstruct mxt_data *data =i2c_get_clientdata (client);struct input_dev *input_dev = data->input_dev; +mxt_soft_reset (data); +mutex_lock (&input_dev->mutex);if (input_dev->users)
Greg Kroah-Hartman
maintainerPATCH 127/150 Input: alps - v7: ignore new packets
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 8b23811535d2e1dd6abbe4ce6ea1edfd50ce72de upstream.
NEW packets are send to indicate a discontinuity in the finger coordinate reporting. Specifically a finger may have moved from slot 0 to 1 or vice versa. INPUT_MT_TRACK takes care of this for us.
NEW packets have 3 problems:
1) They do not contain middle / right button info (on non clickpads) this can be worked around by preserving the old button state
2) They do not contain an accurate fingercount, and they are typically send when the number of fingers changes. We cannot use the old finger count as that may mismatch with the amount of touch coordinates we've available in the NEW packet
3) Their x data for the second touch is inaccurate leading to a possible jump of the x coordinate by 16 units when the first non NEW packet comes in
Since problems 2 & 3 cannot be worked around, just ignore them.
--- drivers/input/mouse/alps.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-)
drivers/input/mouse/alps.c +24 -6
@@ -938,18 +938,36 @@ static int alps_decode_packet_v7(structreturn 0 ;if (pkt_id ==V7_PACKET_ID_UNKNOWN )return -1 ; +/* +* NEW packets are send to indicate a discontinuity in the finger +* coordinate reporting. Specifically a finger may have moved from +* slot 0 to 1 or vice versa. INPUT_MT_TRACK takes care of this for +* us. +* +* NEW packets have 3 problems: +* 1) They do not contain middle / right button info (on non clickpads) +* this can be worked around by preserving the old button state +* 2) They do not contain an accurate fingercount, and they are +* typically send when the number of fingers changes. We cannot use +* the old finger count as that may mismatch with the amount of +* touch coordinates we've available in the NEW packet +* 3) Their x data for the second touch is inaccurate leading to +* a possible jump of the x coordinate by 16 units when the first +* non NEW packet comes in +* Since problems 2 & 3 cannot be worked around, just ignore them. +*/ +if (pkt_id ==V7_PACKET_ID_NEW ) +return 1 ;alps_get_finger_coordinate_v7 (f->mt, p, pkt_id); -if (pkt_id ==V7_PACKET_ID_TWO || pkt_id ==V7_PACKET_ID_MULTI ) { - f->left = (p[0 ] &0x80 ) >>7 ; - f->right = (p[0 ] &0x20 ) >>5 ; - f->middle = (p[0 ] &0x10 ) >>4 ; - } + f->left = (p[0 ] &0x80 ) >>7 ; + f->right = (p[0 ] &0x20 ) >>5 ; + f->middle = (p[0 ] &0x10 ) >>4 ;if (pkt_id ==V7_PACKET_ID_TWO ) f->fingers =alps_get_mt_count (f->mt); -else if (pkt_id ==V7_PACKET_ID_MULTI ) +else /* pkt_id == V7_PACKET_ID_MULTI */ f->fingers =3 + (p[5 ] &0x03 );return 0 ;
Greg Kroah-Hartman
maintainerPATCH 128/150 Input: alps - v7: sometimes a single touch is reported in mt[1]
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 7091c443dda8c6c6d8e70e33452252f9ad3e7814 upstream.
The v7 proto differentiates between a primary touch (with high precision) and a secondary touch (with lower precision). Normally when 2 fingers are down and one is lifted the still present touch becomes the primary touch, but some traces have shown that this does not happen always.
This commit deals with this by making alps_get_mt_count() not stop at the first empty mt slot, and if a touch is present in mt[1] and not mt[0] moving the data to mt[0] (for input_mt_assign_slots).
--- drivers/input/mouse/alps.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/input/mouse/alps.c +14 -4
@@ -919,12 +919,14 @@ static void alps_get_finger_coordinate_vstatic int alps_get_mt_count (struct input_mt_pos *mt) { -int i; +int i, fingers =0 ; -for (i =0 ; i <MAX_TOUCHES && mt[i].x !=0 && mt[i].y !=0 ; i++) -/* empty */ ; +for (i =0 ; i <MAX_TOUCHES ; i++) { +if (mt[i].x !=0 || mt[i].y !=0 ) + fingers++; + } -return i; +return fingers; } static int alps_decode_packet_v7(struct alps_fields *f,
@@ -970,6 +972,14 @@ static int alps_decode_packet_v7(structelse /* pkt_id == V7_PACKET_ID_MULTI */ f->fingers =3 + (p[5 ] &0x03 ); +/* Sometimes a single touch is reported in mt[1] rather then mt[0] */ +if (f->fingers ==1 && f->mt[0 ].x ==0 && f->mt[0 ].y ==0 ) { + f->mt[0 ].x = f->mt[1 ].x; + f->mt[0 ].y = f->mt[1 ].y; + f->mt[1 ].x =0 ; + f->mt[1 ].y =0 ; + } +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 129/150 Input: alps - v7: fix finger counting for > 2 fingers on clickpads
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit d27eb7931c98a1ebfc9b2fcc48939846bcbfc804 upstream.
Protocol v7 uses the middle / right button bits on clickpads to communicate "location" information of a 3th touch (and possible 4th) touch on clickpads.
Specifically when 3 touches are down, if one of the 3 touches is in the left / right button area, this will get reported in the middle / right button bits and the touchpad will still send a TWO type packet rather then a MULTI type packet, so when this happens we must add the finger reported in the button area to the finger count.
Likewise we must also add fingers reported this way to the finger count when we get MULTI packets.
--- drivers/input/mouse/alps.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/input/mouse/alps.c +12 -4
@@ -933,6 +933,7 @@ static int alps_decode_packet_v7(structunsigned char *p, struct psmouse *psmouse) { + struct alps_data *priv = psmouse->private;unsigned char pkt_id; pkt_id =alps_get_packet_id_v7 (p);
@@ -963,15 +964,22 @@ static int alps_decode_packet_v7(structalps_get_finger_coordinate_v7 (f->mt, p, pkt_id); - f->left = (p[0 ] &0x80 ) >>7 ; - f->right = (p[0 ] &0x20 ) >>5 ; - f->middle = (p[0 ] &0x10 ) >>4 ; -if (pkt_id ==V7_PACKET_ID_TWO ) f->fingers =alps_get_mt_count (f->mt);else /* pkt_id == V7_PACKET_ID_MULTI */ f->fingers =3 + (p[5 ] &0x03 ); + f->left = (p[0 ] &0x80 ) >>7 ; +if (priv->flags &ALPS_BUTTONPAD ) { +if (p[0 ] &0x20 ) + f->fingers++; +if (p[0 ] &0x10 ) + f->fingers++; + }else { + f->right = (p[0 ] &0x20 ) >>5 ; + f->middle = (p[0 ] &0x10 ) >>4 ; + } +/* Sometimes a single touch is reported in mt[1] rather then mt[0] */ if (f->fingers ==1 && f->mt[0 ].x ==0 && f->mt[0 ].y ==0 ) { f->mt[0 ].x = f->mt[1 ].x;
Greg Kroah-Hartman
maintainerPATCH 130/150 arm64: Move cpu_resume into the text section
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laura Abbott <[email protected]>
commit c3684fbb446501b48dec6677a6a9f61c215053de upstream.
The function cpu_resume currently lives in the .data section. There's no reason for it to be there since we can use relative instructions without a problem. Move a few cpu_resume data structures out of the assembly file so the .data annotation can be dropped completely and cpu_resume ends up in the read only text section.
--- arch/arm64/kernel/sleep.S | 36 ++++++------------------------------ arch/arm64/kernel/suspend.c | 4 ++-- 2 files changed, 8 insertions(+), 32 deletions(-)
arch/arm64/kernel/sleep.S +6 -30
@@ -147,14 +147,12 @@ cpu_resume_after_mmu: ret ENDPROC(cpu_resume_after_mmu) - .data ENTRY(cpu_resume) bl el2_setup // if in EL2 drop to EL1 cleanly #ifdef CONFIG_SMP mrs x1, mpidr_el1 - adr x4, mpidr_hash_ptr - ldr x5, [x4] - add x8, x4, x5 // x8 = struct mpidr_hash phys address + adrp x8, mpidr_hash + add x8, x8, #:lo12:mpidr_hash // x8 = struct mpidr_hash phys address /* retrieve mpidr_hash members to compute the hash */ ldr x2, [x8, #MPIDR_HASH_MASK] ldp w3, w4, [x8, #MPIDR_HASH_SHIFTS]
@@ -164,14 +162,15 @@ ENTRY(cpu_resume) #else mov x7, xzr #endif - adr x0, sleep_save_sp + adrp x0, sleep_save_sp + add x0, x0, #:lo12:sleep_save_sp ldr x0, [x0, #SLEEP_SAVE_SP_PHYS] ldr x0, [x0, x7, lsl #3] /* load sp from context */ ldr x2, [x0, #CPU_CTX_SP] - adr x1, sleep_idmap_phys + adrp x1, sleep_idmap_phys /* load physical address of identity map page table in x1 */ - ldr x1, [x1] + ldr x1, [x1, #:lo12:sleep_idmap_phys] mov sp, x2 /* * cpu_do_resume expects x0 to contain context physical address
@@ -180,26 +179,3 @@ ENTRY(cpu_resume) bl cpu_do_resume // PC relative jump, MMU off b cpu_resume_mmu // Resume MMU, never returns ENDPROC(cpu_resume) - - .align 3 -mpidr_hash_ptr: - /* - * offset of mpidr_hash symbol from current location - * used to obtain run-time mpidr_hash address with MMU off - */ - .quad mpidr_hash - . -/* - * physical address of identity mapped page tables - */ - .type sleep_idmap_phys, #object -ENTRY(sleep_idmap_phys) - .quad 0 -/* - * struct sleep_save_sp { - * phys_addr_t *save_ptr_stash; - * phys_addr_t save_ptr_stash_phys; - * }; - */ - .type sleep_save_sp, #object -ENTRY(sleep_save_sp) - .space SLEEP_SAVE_SP_SZ // struct sleep_save_sp
arch/arm64/kernel/suspend.c +2 -2
@@ -126,8 +126,8 @@ int __cpu_suspend(unsigned long arg, intreturn ret; } -extern struct sleep_save_sp sleep_save_sp; -extern phys_addr_t sleep_idmap_phys; +struct sleep_save_sp sleep_save_sp; +phys_addr_t sleep_idmap_phys;static int __init cpu_suspend_init (void ) {
Greg Kroah-Hartman
maintainerPATCH 131/150 arm64: kernel: fix __cpu_suspend mm switch on warm-boot
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Pieralisi <[email protected]>
commit f43c27188a49111b58e9611afa2f0365b0b55625 upstream.
On arm64 the TTBR0_EL1 register is set to either the reserved TTBR0 page tables on boot or to the active_mm mappings belonging to user space processes, it must never be set to swapper_pg_dir page tables mappings.
When a CPU is booted its active_mm is set to init_mm even though its TTBR0_EL1 points at the reserved TTBR0 page mappings. This implies that when __cpu_suspend is triggered the active_mm can point at init_mm even if the current TTBR0_EL1 register contains the reserved TTBR0_EL1 mappings.
Therefore, the mm save and restore executed in __cpu_suspend might turn out to be erroneous in that, if the current->active_mm corresponds to init_mm, on resume from low power it ends up restoring in the TTBR0_EL1 the init_mm mappings that are global and can cause speculation of TLB entries which end up being propagated to user space.
This patch fixes the issue by checking the active_mm pointer before restoring the TTBR0 mappings. If the current active_mm == &init_mm, the code sets the TTBR0_EL1 to the reserved TTBR0 mapping instead of switching back to the active_mm, which is the expected behaviour corresponding to the TTBR0_EL1 settings when __cpu_suspend was entered.
--- arch/arm64/kernel/suspend.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
arch/arm64/kernel/suspend.c +13 -1
@@ -5,6 +5,7 @@#include <asm/debug-monitors.h> #include <asm/pgtable.h> #include <asm/memory.h> +#include <asm/mmu_context.h> #include <asm/smp_plat.h> #include <asm/suspend.h> #include <asm/tlbflush.h>
@@ -98,7 +99,18 @@ int __cpu_suspend(unsigned long arg, int*/ ret =__cpu_suspend_enter (arg, fn);if (ret ==0 ) { -cpu_switch_mm (mm->pgd, mm); +/* +* We are resuming from reset with TTBR0_EL1 set to the +* idmap to enable the MMU; restore the active_mm mappings in +* TTBR0_EL1 unless the active_mm == &init_mm, in which case +* the thread entered __cpu_suspend with TTBR0_EL1 set to +* reserved TTBR0 page tables and should be restored as such. +*/ +if (mm == &init_mm) +cpu_set_reserved_ttbr0 (); +else +cpu_switch_mm (mm->pgd, mm); +flush_tlb_all ();/*
Greg Kroah-Hartman
maintainerPATCH 132/150 arm64/efi: add missing call to early_ioremap_reset()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ard Biesheuvel <[email protected]>
commit 0e63ea48b4d8035dd0e91a3fa6fb79458b47adfb upstream.
The early ioremap support introduced by patch bf4b558eba92 ("arm64: add early_ioremap support") failed to add a call to early_ioremap_reset() at an appropriate time. Without this call, invocations of early_ioremap etc. that are done too late will go unnoticed and may cause corruption.
This is exactly what happened when the first user of this feature was added in patch f84d02755f5a ("arm64: add EFI runtime services"). The early mapping of the EFI memory map is unmapped during an early initcall, at which time the early ioremap support is long gone.
Fix by adding the missing call to early_ioremap_reset() to setup_arch(), and move the offending early_memunmap() to right after the point where the early mapping of the EFI memory map is last used.
--- arch/arm64/kernel/efi.c | 2 +- arch/arm64/kernel/setup.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
arch/arm64/kernel/efi.c +1 -1
@@ -327,6 +327,7 @@ void __init efi_idmap_init(void)/* boot time idmap_pg_dir is incomplete, so fill in missing parts */ efi_setup_idmap (); +early_memunmap (memmap.map, memmap.map_end - memmap.map); }static int __init remap_region (efi_memory_desc_t *md,void **new)
@@ -381,7 +382,6 @@ static int __init arm64_enter_virtual_mo } mapsize = memmap.map_end - memmap.map; -early_memunmap (memmap.map, mapsize);if (efi_runtime_disabled ()) {pr_info ("EFI runtime services will be disabled.\n" );
arch/arm64/kernel/setup.c +1 -0
@@ -394,6 +394,7 @@ void __init setup_arch(char **cmdline_p)request_standard_resources ();efi_idmap_init (); +early_ioremap_reset ();unflatten_device_tree ();
Greg Kroah-Hartman
maintainerPATCH 133/150 crypto: sha-mb - Add avx2_supported check.
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vinson Lee <[email protected]>
commit 0b8c960cf6defc56b3aa1a71b5af95872b6dff2b upstream.
This patch fixes this allyesconfig target build error with older binutils.
LD arch/x86/crypto/built-in.o
ld: arch/x86/crypto/sha-mb/built-in.o: No such file: No such file or directory
--- arch/x86/crypto/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/crypto/Makefile +1 -1
@@ -26,7 +26,6 @@ obj-$(CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL obj-$(CONFIG_CRYPTO_CRC32C_INTEL) += crc32c-intel.o obj-$(CONFIG_CRYPTO_SHA1_SSSE3) += sha1-ssse3.o -obj-$(CONFIG_CRYPTO_SHA1_MB) += sha-mb/ obj-$(CONFIG_CRYPTO_CRC32_PCLMUL) += crc32-pclmul.o obj-$(CONFIG_CRYPTO_SHA256_SSSE3) += sha256-ssse3.o obj-$(CONFIG_CRYPTO_SHA512_SSSE3) += sha512-ssse3.o
@@ -46,6 +45,7 @@ endif ifeq ($(avx2_supported),yes) obj-$(CONFIG_CRYPTO_CAMELLIA_AESNI_AVX2_X86_64) += camellia-aesni-avx2.o obj-$(CONFIG_CRYPTO_SERPENT_AVX2_X86_64) += serpent-avx2.o + obj-$(CONFIG_CRYPTO_SHA1_MB) += sha-mb/ endif aes-i586-y := aes-i586-asm_32.o aes_glue.o
Greg Kroah-Hartman
maintainerPATCH 134/150 crypto: aesni - fix "by8" variant for 128 bit keys
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Krause <[email protected]>
commit 0b1e95b2fa0934c3a08db483979c70d3b287f50e upstream.
The "by8" counter mode optimization is broken for 128 bit keys with input data longer than 128 bytes. It uses the wrong key material for en- and decryption.
The key registers xkey0, xkey4, xkey8 and xkey12 need to be preserved in case we're handling more than 128 bytes of input data -- they won't get reloaded after the initial load. They must therefore be (a) loaded on the first iteration and (b) be preserved for the latter ones. The implementation for 128 bit keys does not comply with (a) nor (b).
Fix this by bringing the implementation back to its original source and correctly load the key registers and preserve their values by *not* re-using the registers for other purposes.
Kudos to James for reporting the issue and providing a test case showing the discrepancies.
--- arch/x86/crypto/aes_ctrby8_avx-x86_64.S | 46 ++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 11 deletions(-)
arch/x86/crypto/aes_ctrby8_avx-x86_64.S +35 -11
@@ -208,7 +208,7 @@ ddq_add_8: .if (klen == KEY_128) .if (load_keys) - vmovdqa 3*16(p_keys), xkeyA + vmovdqa 3*16(p_keys), xkey4 .endif .else vmovdqa 3*16(p_keys), xkeyA
@@ -224,7 +224,7 @@ ddq_add_8: add $(16*by), p_in .if (klen == KEY_128) - vmovdqa 4*16(p_keys), xkey4 + vmovdqa 4*16(p_keys), xkeyB .else .if (load_keys) vmovdqa 4*16(p_keys), xkey4
@@ -234,7 +234,12 @@ ddq_add_8: .set i, 0 .rept by club XDATA, i - vaesenc xkeyA, var_xdata, var_xdata /* key 3 */ + /* key 3 */ + .if (klen == KEY_128) + vaesenc xkey4, var_xdata, var_xdata + .else + vaesenc xkeyA, var_xdata, var_xdata + .endif .set i, (i +1) .endr
@@ -243,13 +248,18 @@ ddq_add_8: .set i, 0 .rept by club XDATA, i - vaesenc xkey4, var_xdata, var_xdata /* key 4 */ + /* key 4 */ + .if (klen == KEY_128) + vaesenc xkeyB, var_xdata, var_xdata + .else + vaesenc xkey4, var_xdata, var_xdata + .endif .set i, (i +1) .endr .if (klen == KEY_128) .if (load_keys) - vmovdqa 6*16(p_keys), xkeyB + vmovdqa 6*16(p_keys), xkey8 .endif .else vmovdqa 6*16(p_keys), xkeyB
@@ -267,12 +277,17 @@ ddq_add_8: .set i, 0 .rept by club XDATA, i - vaesenc xkeyB, var_xdata, var_xdata /* key 6 */ + /* key 6 */ + .if (klen == KEY_128) + vaesenc xkey8, var_xdata, var_xdata + .else + vaesenc xkeyB, var_xdata, var_xdata + .endif .set i, (i +1) .endr .if (klen == KEY_128) - vmovdqa 8*16(p_keys), xkey8 + vmovdqa 8*16(p_keys), xkeyB .else .if (load_keys) vmovdqa 8*16(p_keys), xkey8
@@ -288,7 +303,7 @@ ddq_add_8: .if (klen == KEY_128) .if (load_keys) - vmovdqa 9*16(p_keys), xkeyA + vmovdqa 9*16(p_keys), xkey12 .endif .else vmovdqa 9*16(p_keys), xkeyA
@@ -297,7 +312,12 @@ ddq_add_8: .set i, 0 .rept by club XDATA, i - vaesenc xkey8, var_xdata, var_xdata /* key 8 */ + /* key 8 */ + .if (klen == KEY_128) + vaesenc xkeyB, var_xdata, var_xdata + .else + vaesenc xkey8, var_xdata, var_xdata + .endif .set i, (i +1) .endr
@@ -306,7 +326,12 @@ ddq_add_8: .set i, 0 .rept by club XDATA, i - vaesenc xkeyA, var_xdata, var_xdata /* key 9 */ + /* key 9 */ + .if (klen == KEY_128) + vaesenc xkey12, var_xdata, var_xdata + .else + vaesenc xkeyA, var_xdata, var_xdata + .endif .set i, (i +1) .endr
@@ -412,7 +437,6 @@ ddq_add_8: /* main body of aes ctr load */ .macro do_aes_ctrmain key_len - cmp $16, num_bytes jb .Ldo_return2\key_len
Greg Kroah-Hartman
maintainerPATCH 135/150 Btrfs: dont delay inode ref updates during log replay
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <[email protected]>
commit 6f8960541b1eb6054a642da48daae2320fddba93 upstream.
Commit 1d52c78afbb (Btrfs: try not to ENOSPC on log replay) added a check to skip delayed inode updates during log replay because it confuses the enospc code. But the delayed processing will end up ignoring delayed refs from log replay because the inode itself wasn't put through the delayed code.
This can end up triggering a warning at commit time:
WARNING: CPU: 2 PID: 778 at fs/btrfs/delayed-inode.c:1410 btrfs_assert_delayed_root_empty+0x32/0x34()
Which is repeated for each commit because we never process the delayed inode ref update.
The fix used here is to change btrfs_delayed_delete_inode_ref to return an error if we're currently in log replay. The caller will do the ref deletion immediately and everything will work properly.
--- fs/btrfs/delayed-inode.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/btrfs/delayed-inode.c +8 -0
@@ -1857,6 +1857,14 @@ int btrfs_delayed_delete_inode_ref(struc {struct btrfs_delayed_node *delayed_node; +/* +* we don't do delayed inode updates during log recovery because it +* leads to enospc problems. This means we also can't do +* delayed inode refs +*/ +if (BTRFS_I (inode)->root->fs_info->log_root_recovering) +return -EAGAIN ; + delayed_node =btrfs_get_or_create_delayed_node (inode);if (IS_ERR (delayed_node))return PTR_ERR (delayed_node);
Greg Kroah-Hartman
maintainerPATCH 136/150 Revert "mac80211: Fix accounting of the tailroom-needed counter"
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit 1e359a5de861a57aa04d92bb620f52a5c1d7f8b1 upstream.
This reverts commit ca34e3b5c808385b175650605faa29e71e91991b.
It turns out that the p54 and cw2100 drivers assume that there's tailroom even when they don't say they really need it. However, there's currently no way for them to explicitly say they do need it, so for now revert this.
This fixes https://bugzilla.kernel.org/show_bug.cgi?id=90331.
--- include/net/mac80211.h | 7 ++----- net/mac80211/key.c | 12 +++++++++--- 2 files changed, 11 insertions(+), 8 deletions(-)
include/net/mac80211.h +2 -5
@@ -1227,8 +1227,7 @@ struct ieee80211_vif *wdev_to_ieee80211_* * @IEEE80211_KEY_FLAG_GENERATE_IV: This flag should be set by the * driver to indicate that it requires IV generation for this -* particular key. Setting this flag does not necessarily mean that SKBs -* will have sufficient tailroom for ICV or MIC. +* particular key. * @IEEE80211_KEY_FLAG_GENERATE_MMIC: This flag should be set by * the driver for a TKIP key if it requires Michael MIC * generation in software.
@@ -1240,9 +1239,7 @@ struct ieee80211_vif *wdev_to_ieee80211_* @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver * if space should be prepared for the IV, but the IV * itself should not be generated. Do not set together with -* @IEEE80211_KEY_FLAG_GENERATE_IV on the same key. Setting this flag does -* not necessarily mean that SKBs will have sufficient tailroom for ICV or -* MIC. +* @IEEE80211_KEY_FLAG_GENERATE_IV on the same key. * @IEEE80211_KEY_FLAG_RX_MGMT: This key will be used to decrypt received * management frames. The flag can help drivers that have a hardware * crypto implementation that doesn't deal with management frames
net/mac80211/key.c +9 -3
@@ -131,7 +131,9 @@ static int ieee80211_key_enable_hw_accelif (!ret) { key->flags |=KEY_FLAG_UPLOADED_TO_HARDWARE ; -if (!(key->conf.flags &IEEE80211_KEY_FLAG_GENERATE_MMIC )) +if (!((key->conf.flags &IEEE80211_KEY_FLAG_GENERATE_MMIC ) || + (key->conf.flags &IEEE80211_KEY_FLAG_GENERATE_IV ) || + (key->conf.flags &IEEE80211_KEY_FLAG_PUT_IV_SPACE ))) sdata->crypto_tx_tailroom_needed_cnt--; WARN_ON((key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE) &&
@@ -179,7 +181,9 @@ static void ieee80211_key_disable_hw_acc sta = key->sta; sdata = key->sdata; -if (!(key->conf.flags &IEEE80211_KEY_FLAG_GENERATE_MMIC )) +if (!((key->conf.flags &IEEE80211_KEY_FLAG_GENERATE_MMIC ) || + (key->conf.flags &IEEE80211_KEY_FLAG_GENERATE_IV ) || + (key->conf.flags &IEEE80211_KEY_FLAG_PUT_IV_SPACE )))increment_tailroom_need_count (sdata); ret = drv_set_key(key->local, DISABLE_KEY, sdata,
@@ -875,7 +879,9 @@ void ieee80211_remove_key(struct ieee802if (key->flags &KEY_FLAG_UPLOADED_TO_HARDWARE ) { key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE ; -if (!(key->conf.flags &IEEE80211_KEY_FLAG_GENERATE_MMIC )) +if (!((key->conf.flags &IEEE80211_KEY_FLAG_GENERATE_MMIC ) || + (key->conf.flags &IEEE80211_KEY_FLAG_GENERATE_IV ) || + (key->conf.flags &IEEE80211_KEY_FLAG_PUT_IV_SPACE )))increment_tailroom_need_count (key->sdata); }
Greg Kroah-Hartman
maintainerPATCH 137/150 perf/x86/intel/uncore: Make sure only uncore events are collected
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <[email protected]>
commit af91568e762d04931dcbdd6bef4655433d8b9418 upstream.
The uncore_collect_events functions assumes that event group might contain only uncore events which is wrong, because it might contain any type of events.
This bug leads to uncore framework touching 'not' uncore events, which could end up all sorts of bugs.
One was triggered by Vince's perf fuzzer, when the uncore code touched breakpoint event private event space as if it was uncore event and caused BUG:
BUG: unable to handle kernel paging request at ffffffff82822068 IP: [<ffffffff81020338>] uncore_assign_events+0x188/0x250 ...
The code in uncore_assign_events() function was looking for event->hw.idx data while the event was initialized as a breakpoint with different members in event->hw union.
This patch forces uncore_collect_events() to collect only uncore events.
--- arch/x86/kernel/cpu/perf_event_intel_uncore.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
arch/x86/kernel/cpu/perf_event_intel_uncore.c +19 -3
@@ -276,6 +276,17 @@ static struct intel_uncore_box *uncore_areturn box; } +/* +* Using uncore_pmu_event_init pmu event_init callback +* as a detection point for uncore events. +*/ +static int uncore_pmu_event_init (struct perf_event *event); + +static bool is_uncore_event (struct perf_event *event) +{ +return event->pmu->event_init == uncore_pmu_event_init; +} +static int uncore_collect_events (struct intel_uncore_box *box,struct perf_event *leader,bool dogrp) {
@@ -290,13 +301,18 @@ uncore_collect_events(struct intel_uncorreturn -EINVAL ; n = box->n_events; - box->event_list[n] = leader; - n++; + +if (is_uncore_event (leader)) { + box->event_list[n] = leader; + n++; + } +if (!dogrp)return n;list_for_each_entry (event, &leader->sibling_list, group_entry) { -if (event->state <=PERF_EVENT_STATE_OFF ) +if (!is_uncore_event (event) || + event->state <=PERF_EVENT_STATE_OFF )continue ;if (n >= max_count)
Greg Kroah-Hartman
maintainerPATCH 138/150 perf: Fix events installation during moving group
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <[email protected]>
commit 9fc81d87420d0d3fd62d5e5529972c0ad9eab9cc upstream.
We allow PMU driver to change the cpu on which the event should be installed to. This happened in patch:
e2d37cd213dc ("perf: Allow the PMU driver to choose the CPU on which to install events")
This patch also forces all the group members to follow the currently opened events cpu if the group happened to be moved.
This and the change of event->cpu in perf_install_in_context() function introduced in:
0cda4c023132 ("perf: Introduce perf_pmu_migrate_context()")
forces group members to change their event->cpu, if the currently-opened-event's PMU changed the cpu and there is a group move.
Above behaviour causes problem for breakpoint events, which uses event->cpu to touch cpu specific data for breakpoints accounting. By changing event->cpu, some breakpoints slots were wrongly accounted for given cpu.
Vinces's perf fuzzer hit this issue and caused following WARN on my setup:
WARNING: CPU: 0 PID: 20214 at arch/x86/kernel/hw_breakpoint.c:119 arch_install_hw_breakpoint+0x142/0x150() Can't find any breakpoint slot [...]
This patch changes the group moving code to keep the event's original cpu.
--- kernel/events/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/events/core.c +2 -2
@@ -7435,11 +7435,11 @@ SYSCALL_DEFINE5(perf_event_open,if (move_group) {synchronize_rcu (); -perf_install_in_context (ctx, group_leader, event->cpu); +perf_install_in_context (ctx, group_leader, group_leader->cpu);get_ctx (ctx);list_for_each_entry (sibling, &group_leader->sibling_list, group_entry) { -perf_install_in_context (ctx, sibling, event->cpu); +perf_install_in_context (ctx, sibling, sibling->cpu);get_ctx (ctx); } }
Greg Kroah-Hartman
maintainerPATCH 139/150 perf/x86/uncore/hsw-ep: Handle systems with only two SBOXes
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andi Kleen <[email protected]>
commit 5306c31c5733cb4a79cc002e0c3ad256fd439614 upstream.
There was another report of a boot failure with a #GP fault in the uncore SBOX initialization. The earlier work around was not enough for this system.
The boot was failing while trying to initialize the third SBOX.
This patch detects parts with only two SBOXes and limits the number of SBOX units to two there.
Stable material, as it affects boot problems on 3.18.
--- arch/x86/kernel/cpu/perf_event_intel_uncore.h | 2 +- arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/perf_event_intel_uncore.h +1 -1
@@ -17,7 +17,7 @@#define UNCORE_PCI_DEV_TYPE (data) ((data >> 8) & 0xff)#define UNCORE_PCI_DEV_IDX (data) (data & 0xff)#define UNCORE_EXTRA_PCI_DEV 0xff -#define UNCORE_EXTRA_PCI_DEV_MAX 2 +#define UNCORE_EXTRA_PCI_DEV_MAX 3/* support up to 8 sockets */ #define UNCORE_SOCKET_MAX 8
arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c +17 -0
@@ -887,6 +887,7 @@ void snbep_uncore_cpu_init(void)enum {SNBEP_PCI_QPI_PORT0_FILTER ,SNBEP_PCI_QPI_PORT1_FILTER , +HSWEP_PCI_PCU_3 , };static int snbep_qpi_hw_config (struct intel_uncore_box *box,struct perf_event *event)
@@ -2022,6 +2023,17 @@ void hswep_uncore_cpu_init(void) {if (hswep_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores) hswep_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores; + +/* Detect 6-8 core systems with only two SBOXes */ +if (uncore_extra_pci_dev[0 ][HSWEP_PCI_PCU_3 ]) { +u32 capid4; + +pci_read_config_dword (uncore_extra_pci_dev[0 ][HSWEP_PCI_PCU_3 ], +0x94 , &capid4); +if (((capid4 >>6 ) &0x3 ) ==0 ) + hswep_uncore_sbox.num_boxes =2 ; + } + uncore_msr_uncores = hswep_msr_uncores; }
@@ -2279,6 +2291,11 @@ static DEFINE_PCI_DEVICE_TABLE(hswep_unc .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, SNBEP_PCI_QPI_PORT1_FILTER), }, + {/* PCU.3 (for Capability registers) */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2fc0), + .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, + HSWEP_PCI_PCU_3), + }, {/* end: all zeroes */ } };
Greg Kroah-Hartman
maintainerPATCH 140/150 perf session: Do not fail on processing out of order event
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <[email protected]>
commit f61ff6c06dc8f32c7036013ad802c899ec590607 upstream.
Linus reported perf report command being interrupted due to processing of 'out of order' event, with following error:
Timestamp below last timeslice flush
0x5733a8 [0x28]: failed to process type: 3
I could reproduce the issue and in my case it was caused by one CPU (mmap) being behind during record and userspace mmap reader seeing the data after other CPUs data were already stored.
This is expected under some circumstances because we need to limit the number of events that we queue for reordering when we receive a PERF_RECORD_FINISHED_ROUND or when we force flush due to memory pressure.
--- tools/perf/util/event.h | 1 + tools/perf/util/session.c | 11 +++++------ 2 files changed, 6 insertions(+), 6 deletions(-)
tools/perf/util/event.h +1 -0
@@ -214,6 +214,7 @@ struct events_stats {u32 nr_invalid_chains;u32 nr_unknown_id;u32 nr_unprocessable_samples; +u32 nr_unordered_events; };struct attr_event {
tools/perf/util/session.c +5 -6
@@ -521,15 +521,11 @@ int perf_session_queue_event(struct perfreturn -ETIME ;if (timestamp < oe->last_flush) { -WARN_ONCE (1 ,"Timestamp below last timeslice flush\n" ); - -pr_oe_time (timestamp,"out of order event" ); +pr_oe_time (timestamp,"out of order event\n" );pr_oe_time (oe->last_flush,"last flush, last_flush_type %d\n" , oe->last_flush_type); -/* We could get out of order messages after forced flush. */ -if (oe->last_flush_type !=OE_FLUSH__HALF ) -return -EINVAL ; + s->stats.nr_unordered_events++; } new =ordered_events__new (oe, timestamp, event);
@@ -1057,6 +1053,9 @@ static void perf_session__warn_about_err"Do you have a KVM guest running and not using 'perf kvm'?\n" , session->stats.nr_unprocessable_samples); } + +if (session->stats.nr_unordered_events !=0 ) +ui__warning ("%u out of order events recorded.\n" , session->stats.nr_unordered_events); }volatile int session_done;
Greg Kroah-Hartman
maintainerPATCH 141/150 spi: sh-msiof: Add runtime PM lock in initializing
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hisashi Nakamura <[email protected]>
commit 015760563ec77bf17cec712fa94afdf53b285287 upstream.
SH-MSIOF driver is enabled autosuspend API of spi framework. But autosuspend framework doesn't work during initializing. So runtime PM lock is added in SH-MSIOF driver initializing.
--- drivers/spi/spi-sh-msiof.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/spi/spi-sh-msiof.c +5 -0
@@ -480,6 +480,8 @@ static int sh_msiof_spi_setup(struct spistruct device_node *np = spi->master->dev.of_node;struct sh_msiof_spi_priv *p =spi_master_get_devdata (spi->master); +pm_runtime_get_sync (&p->pdev->dev); +if (!np) {/* * Use spi->controller_data for CS (same strategy as spi_gpio),
@@ -498,6 +500,9 @@ static int sh_msiof_spi_setup(struct spiif (spi->cs_gpio >=0 )gpio_set_value (spi->cs_gpio, !(spi->mode &SPI_CS_HIGH )); + +pm_runtime_put_sync (&p->pdev->dev); +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 143/150 nouveau: bring back legacy mmap handler
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
commit 2036eaa74031b11028ee8fc1f44f128fdc871dda upstream.
nouveau userspace back at 1.0.1 used to call the X server DRIOpenDRMMaster interface even for DRI2 (doh!), this attempts to map the sarea and fails if it can't.
Since 884c6dabb0eafe7227f099c9e78e514191efaf13 from Daniel, this fails, but only ancient drivers would see it.
Revert the nouveau bits of that fix.
--- drivers/gpu/drm/nouveau/nouveau_ttm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_ttm.c +2 -1
@@ -28,6 +28,7 @@#include "nouveau_ttm.h" #include "nouveau_gem.h" +#include "drm_legacy.h" static int nouveau_vram_manager_init (struct ttm_mem_type_manager *man,unsigned long psize) {
@@ -281,7 +282,7 @@ nouveau_ttm_mmap(struct file *filp, strustruct nouveau_drm *drm =nouveau_drm (file_priv->minor->dev);if (unlikely (vma->vm_pgoff <DRM_FILE_PAGE_OFFSET )) -return -EINVAL ; +return drm_legacy_mmap (filp, vma);return ttm_bo_mmap (filp, vma, &drm->ttm.bdev); }
Greg Kroah-Hartman
maintainerPATCH 144/150 regulator: s2mps11: Fix dw_mmc failure on Gear 2
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 1222d8fe578cd28a6c7f5e4e6c6b664c56abfdc0 upstream.
Invalid buck4 configuration for linear mapping of voltage in S2MPS14 regulators caused boot failure on Gear 2 (dw_mmc-exynos):
[ 3.569137] EXT4-fs (mmcblk0p15): mounted filesystem with ordered data mode. Opts: (null) [ 3.571716] VFS: Mounted root (ext4 filesystem) readonly on device 179:15. [ 3.629842] mmcblk0: error -110 sending status command, retrying [ 3.630244] mmcblk0: error -110 sending status command, retrying [ 3.636292] mmcblk0: error -110 sending status command, aborting
Buck4 voltage regulator has different minimal voltage value than other bucks. Commit merging multiple regulator description macros caused to use linear_min_sel from buck[1235] regulators as value for buck4. This lead to lower voltage of buck4 than required.
Output of the buck4 is used internally as power source for LDO{3,4,7,11,19,20,21,23}. On Gear 2 board LDO11 is used as MMC regulator (V_EMMC_1.8V).
--- drivers/regulator/s2mps11.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/regulator/s2mps11.c +12 -7
@@ -479,7 +479,7 @@ static struct regulator_ops s2mps14_reg_ .enable_mask = S2MPS14_ENABLE_MASK \ } -#define regulator_desc_s2mps14_buck (num, min, step) { \ +#define regulator_desc_s2mps14_buck (num, min, step, min_sel) { \ .name = "BUCK"#num, \ .id = S2MPS14_BUCK##num, \ .ops = &s2mps14_reg_ops, \
@@ -488,7 +488,7 @@ static struct regulator_ops s2mps14_reg_ .min_uV = min, \ .uV_step = step, \ .n_voltages = S2MPS14_BUCK_N_VOLTAGES, \ - .linear_min_sel = S2MPS14_BUCK1235_START_SEL, \ + .linear_min_sel = min_sel, \ .ramp_delay = S2MPS14_BUCK_RAMP_DELAY, \ .vsel_reg = S2MPS14_REG_B1CTRL2 + (num - 1) * 2, \ .vsel_mask = S2MPS14_BUCK_VSEL_MASK, \
@@ -522,11 +522,16 @@ static const struct regulator_desc s2mpsregulator_desc_s2mps14_ldo (23 ,MIN_800_MV ,STEP_25_MV ),regulator_desc_s2mps14_ldo (24 ,MIN_1800_MV ,STEP_25_MV ),regulator_desc_s2mps14_ldo (25 ,MIN_1800_MV ,STEP_25_MV ), -regulator_desc_s2mps14_buck (1 ,MIN_600_MV ,STEP_6_25_MV ), -regulator_desc_s2mps14_buck (2 ,MIN_600_MV ,STEP_6_25_MV ), -regulator_desc_s2mps14_buck (3 ,MIN_600_MV ,STEP_6_25_MV ), -regulator_desc_s2mps14_buck (4 ,MIN_1400_MV ,STEP_12_5_MV ), - regulator_desc_s2mps14_buck(5, MIN_600_MV, STEP_6_25_MV), +regulator_desc_s2mps14_buck (1 ,MIN_600_MV ,STEP_6_25_MV , +S2MPS14_BUCK1235_START_SEL ), +regulator_desc_s2mps14_buck (2 ,MIN_600_MV ,STEP_6_25_MV , +S2MPS14_BUCK1235_START_SEL ), +regulator_desc_s2mps14_buck (3 ,MIN_600_MV ,STEP_6_25_MV , +S2MPS14_BUCK1235_START_SEL ), +regulator_desc_s2mps14_buck (4 ,MIN_1400_MV ,STEP_12_5_MV , +S2MPS14_BUCK4_START_SEL ), +regulator_desc_s2mps14_buck (5 ,MIN_600_MV ,STEP_6_25_MV , + S2MPS14_BUCK1235_START_SEL), }; static int s2mps14_pmic_enable_ext_control(struct s2mps11_info *s2mps11,
Greg Kroah-Hartman
maintainerPATCH 145/150 mmc: sdhci: Fix sleep in atomic after inserting SD card
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 2836766a9d0bd02c66073f8dd44796e6cc23848d upstream.
Sleep in atomic context happened on Trats2 board after inserting or removing SD card because mmc_gpio_get_cd() was called under spin lock.
Fix this by moving card detection earlier, before acquiring spin lock. The mmc_gpio_get_cd() call does not have to be protected by spin lock because it does not access any sdhci internal data.
The sdhci_do_get_cd() call access host flags (SDHCI_DEVICE_DEAD). After moving it out side of spin lock it could theoretically race with driver removal but still there is no actual protection against manual card eject.
Dmesg after inserting SD card:
[ 41.663414] BUG: sleeping function called from invalid context at drivers/gpio/gpiolib.c:1511 [ 41.670469] in_atomic(): 1, irqs_disabled(): 128, pid: 30, name: kworker/u8:1 [ 41.677580] INFO: lockdep is turned off. [ 41.681486] irq event stamp: 61972 [ 41.684872] hardirqs last enabled at (61971): [<c0490ee0>] _raw_spin_unlock_irq+0x24/0x5c [ 41.693118] hardirqs last disabled at (61972): [<c04907ac>] _raw_spin_lock_irq+0x18/0x54 [ 41.701190] softirqs last enabled at (61648): [<c0026fd4>] __do_softirq+0x234/0x2c8 [ 41.708914] softirqs last disabled at (61631): [<c00273a0>] irq_exit+0xd0/0x114 [ 41.716206] Preemption disabled at:[< (null)>] (null) [ 41.721500] [ 41.722985] CPU: 3 PID: 30 Comm: kworker/u8:1 Tainted: G W 3.18.0-rc5-next-20141121 #883 [ 41.732111] Workqueue: kmmcd mmc_rescan [ 41.735945] [<c0014d2c>] (unwind_backtrace) from [<c0011c80>] (show_stack+0x10/0x14) [ 41.743661] [<c0011c80>] (show_stack) from [<c0489d14>] (dump_stack+0x70/0xbc) [ 41.750867] [<c0489d14>] (dump_stack) from [<c0228b74>] (gpiod_get_raw_value_cansleep+0x18/0x30) [ 41.759628] [<c0228b74>] (gpiod_get_raw_value_cansleep) from [<c03646e8>] (mmc_gpio_get_cd+0x38/0x58) [ 41.768821] [<c03646e8>] (mmc_gpio_get_cd) from [<c036d378>] (sdhci_request+0x50/0x1a4) [ 41.776808] [<c036d378>] (sdhci_request) from [<c0357934>] (mmc_start_request+0x138/0x268) [ 41.785051] [<c0357934>] (mmc_start_request) from [<c0357cc8>] (mmc_wait_for_req+0x58/0x1a0) [ 41.793469] [<c0357cc8>] (mmc_wait_for_req) from [<c0357e68>] (mmc_wait_for_cmd+0x58/0x78) [ 41.801714] [<c0357e68>] (mmc_wait_for_cmd) from [<c0361c00>] (mmc_io_rw_direct_host+0x98/0x124) [ 41.810480] [<c0361c00>] (mmc_io_rw_direct_host) from [<c03620f8>] (sdio_reset+0x2c/0x64) [ 41.818641] [<c03620f8>] (sdio_reset) from [<c035a3d8>] (mmc_rescan+0x254/0x2e4) [ 41.826028] [<c035a3d8>] (mmc_rescan) from [<c003a0e0>] (process_one_work+0x180/0x3f4) [ 41.833920] [<c003a0e0>] (process_one_work) from [<c003a3bc>] (worker_thread+0x34/0x4b0) [ 41.841991] [<c003a3bc>] (worker_thread) from [<c003fed8>] (kthread+0xe4/0x104) [ 41.849285] [<c003fed8>] (kthread) from [<c000f268>] (ret_from_fork+0x14/0x2c) [ 42.038276] mmc0: new high speed SDHC card at address 1234
--- drivers/mmc/host/sdhci.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci.c +6 -2
@@ -1319,6 +1319,8 @@ static void sdhci_request(struct mmc_hossdhci_runtime_pm_get (host); + present =mmc_gpio_get_cd (host->mmc); +spin_lock_irqsave (&host->lock, flags);WARN_ON (host->mrq !=NULL );
@@ -1347,7 +1349,6 @@ static void sdhci_request(struct mmc_hos* zero: cd-gpio is used, and card is removed * one: cd-gpio is used, and card is present */ - present =mmc_gpio_get_cd (host->mmc);if (present <0 ) {/* If polling, assume that the card is always present. */ if (host->quirks &SDHCI_QUIRK_BROKEN_CARD_DETECTION )
@@ -2072,15 +2073,18 @@ static void sdhci_card_event(struct mmc_ {struct sdhci_host *host =mmc_priv (mmc);unsigned long flags; +int present;/* First check if client has provided their own card event */ if (host->ops->card_event) host->ops->card_event (host); + present =sdhci_do_get_cd (host); +spin_lock_irqsave (&host->lock, flags);/* Check host->mrq first in case we are runtime suspended */ -if (host->mrq && !sdhci_do_get_cd (host)) { +if (host->mrq && !present) {pr_err ("%s: Card removed during transfer!\n" ,mmc_hostname (host->mmc)); pr_err("%s: Resetting controller.\n",
Greg Kroah-Hartman
maintainerPATCH 146/150 exit: fix race between wait_consider_task() and wait_task_zombie()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
commit 3245d6acab981a2388ffb877c7ecc97e763c59d4 upstream.
wait_consider_task() checks EXIT_ZOMBIE after EXIT_DEAD/EXIT_TRACE and both checks can fail if we race with EXIT_ZOMBIE -> EXIT_DEAD/EXIT_TRACE change in between, gcc needs to reload p->exit_state after security_task_wait(). In this case ->notask_error will be wrongly cleared and do_wait() can hang forever if it was the last eligible child.
Many thanks to Arne who carefully investigated the problem.
Note: this bug is very old but it was pure theoretical until commit b3ab03160dfa ("wait: completely ignore the EXIT_DEAD tasks"). Before this commit "-O2" was probably enough to guarantee that compiler won't read ->exit_state twice.
--- kernel/exit.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
kernel/exit.c +9 -3
@@ -1302,9 +1302,15 @@ static int wait_task_continued(struct wastatic int wait_consider_task (struct wait_opts *wo,int ptrace,struct task_struct *p) { +/* +* We can race with wait_task_zombie() from another thread. +* Ensure that EXIT_ZOMBIE -> EXIT_DEAD/EXIT_TRACE transition +* can't confuse the checks below. +*/ +int exit_state =ACCESS_ONCE (p->exit_state);int ret; -if (unlikely (p->exit_state ==EXIT_DEAD )) +if (unlikely (exit_state ==EXIT_DEAD ))return 0 ; ret =eligible_child (wo, p);
@@ -1325,7 +1331,7 @@ static int wait_consider_task(struct waireturn 0 ; } -if (unlikely (p->exit_state ==EXIT_TRACE )) { +if (unlikely (exit_state ==EXIT_TRACE )) {/* * ptrace == 0 means we are the natural parent. In this case * we should clear notask_error, debugger will notify us.
@@ -1352,7 +1358,7 @@ static int wait_consider_task(struct wai }/* slay zombie? */ -if (p->exit_state ==EXIT_ZOMBIE ) { +if (exit_state ==EXIT_ZOMBIE ) {/* we don't reap group leaders with subthreads */ if (!delay_group_leader (p)) {/*
Greg Kroah-Hartman
maintainerPATCH 147/150 mm: protect set_page_dirty() from ongoing truncation
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Weiner <[email protected]>
commit 2d6d7f98284648c5ed113fe22a132148950b140f upstream.
Tejun, while reviewing the code, spotted the following race condition between the dirtying and truncation of a page:
__set_page_dirty_nobuffers() __delete_from_page_cache()
if (TestSetPageDirty(page))
page->mapping = NULL
if (PageDirty())
dec_zone_page_state(page, NR_FILE_DIRTY);
dec_bdi_stat(mapping->backing_dev_info, BDI_RECLAIMABLE);
if (page->mapping)
account_page_dirtied(page)
__inc_zone_page_state(page, NR_FILE_DIRTY);
__inc_bdi_stat(mapping->backing_dev_info, BDI_RECLAIMABLE);which results in an imbalance of NR_FILE_DIRTY and BDI_RECLAIMABLE.
Dirtiers usually lock out truncation, either by holding the page lock directly, or in case of zap_pte_range(), by pinning the mapcount with the page table lock held. The notable exception to this rule, though, is do_wp_page(), for which this race exists. However, do_wp_page() already waits for a locked page to unlock before setting the dirty bit, in order to prevent a race where clear_page_dirty() misses the page bit in the presence of dirty ptes. Upgrade that wait to a fully locked set_page_dirty() to also cover the situation explained above.
Afterwards, the code in set_page_dirty() dealing with a truncation race is no longer needed. Remove it.
--- include/linux/writeback.h | 1 - mm/memory.c | 27 +++++++++++++++++---------- mm/page-writeback.c | 43 ++++++++++++------------------------------- 3 files changed, 29 insertions(+), 42 deletions(-)
include/linux/writeback.h +0 -1
@@ -177,7 +177,6 @@ int write_cache_pages(struct address_spa struct writeback_control *wbc, writepage_t writepage, void *data);int do_writepages (struct address_space *mapping,struct writeback_control *wbc); -void set_page_dirty_balance (struct page *page);void writeback_set_ratelimit (void );void tag_pages_for_writeback (struct address_space *mapping,pgoff_t start,pgoff_t end);
mm/memory.c +17 -10
@@ -2150,17 +2150,24 @@ reuse:if (!dirty_page)return ret; -/* -* Yes, Virginia, this is actually required to prevent a race -* with clear_page_dirty_for_io() from clearing the page dirty -* bit after it clear all dirty ptes, but before a racing -* do_wp_page installs a dirty pte. -* -* do_shared_fault is protected similarly. -*/ if (!page_mkwrite) { -wait_on_page_locked (dirty_page); -set_page_dirty_balance (dirty_page); +struct address_space *mapping; +int dirtied; + +lock_page (dirty_page); + dirtied =set_page_dirty (dirty_page); +VM_BUG_ON_PAGE (PageAnon (dirty_page), dirty_page); + mapping = dirty_page->mapping; +unlock_page (dirty_page); + +if (dirtied && mapping) { +/* +* Some device drivers do not set page.mapping +* but still dirty their pages +*/ +balance_dirty_pages_ratelimited (mapping); + } +/* file_update_time outside page_lock */ if (vma->vm_file)file_update_time (vma->vm_file);
mm/page-writeback.c +12 -31
72 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 148/150 mm, vmscan: prevent kswapd livelock due to pfmemalloc-throttled process being killed
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vlastimil Babka <[email protected]>
commit 9e5e3661727eaf960d3480213f8e87c8d67b6956 upstream.
Charles Shirron and Paul Cassella from Cray Inc have reported kswapd stuck in a busy loop with nothing left to balance, but kswapd_try_to_sleep() failing to sleep. Their analysis found the cause to be a combination of several factors:
1. A process is waiting in throttle_direct_reclaim() on pgdat->pfmemalloc_wait
2. The process has been killed (by OOM in this case), but has not yet been scheduled to remove itself from the waitqueue and die.
3. kswapd checks for throttled processes in prepare_kswapd_sleep():
if (waitqueue_active(&pgdat->pfmemalloc_wait)) {
wake_up(&pgdat->pfmemalloc_wait);
return false; // kswapd will not go to sleep
} However, for a process that was already killed, wake_up() does not remove the process from the waitqueue, since try_to_wake_up() checks its state first and returns false when the process is no longer waiting.
4. kswapd is running on the same CPU as the only CPU that the process is allowed to run on (through cpus_allowed, or possibly single-cpu system).
5. CONFIG_PREEMPT_NONE=y kernel is used. If there's nothing to balance, kswapd encounters no voluntary preemption points and repeatedly fails prepare_kswapd_sleep(), blocking the process from running and removing itself from the waitqueue, which would let kswapd sleep.
So, the source of the problem is that we prevent kswapd from going to sleep until there are processes waiting on the pfmemalloc_wait queue, and a process waiting on a queue is guaranteed to be removed from the queue only when it gets scheduled. This was done to make sure that no process is left sleeping on pfmemalloc_wait when kswapd itself goes to sleep.
However, it isn't necessary to postpone kswapd sleep until the pfmemalloc_wait queue actually empties. To prevent processes from being left sleeping, it's actually enough to guarantee that all processes waiting on pfmemalloc_wait queue have been woken up by the time we put kswapd to sleep.
This patch therefore fixes this issue by substituting 'wake_up' with 'wake_up_all' and removing 'return false' in the code snippet from prepare_kswapd_sleep() above. Note that if any process puts itself in the queue after this waitqueue_active() check, or after the wake up itself, it means that the process will also wake up kswapd - and since we are under prepare_to_wait(), the wake up won't be missed. Also we update the comment prepare_kswapd_sleep() to hopefully more clearly describe the races it is preventing.
--- mm/vmscan.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
mm/vmscan.c +13 -11
@@ -2904,18 +2904,20 @@ static bool prepare_kswapd_sleep(pg_datareturn false;/* -* There is a potential race between when kswapd checks its watermarks -* and a process gets throttled. There is also a potential race if -* processes get throttled, kswapd wakes, a large process exits therby -* balancing the zones that causes kswapd to miss a wakeup. If kswapd -* is going to sleep, no process should be sleeping on pfmemalloc_wait -* so wake them now if necessary. If necessary, processes will wake -* kswapd and get throttled again +* The throttled processes are normally woken up in balance_pgdat() as +* soon as pfmemalloc_watermark_ok() is true. But there is a potential +* race between when kswapd checks the watermarks and a process gets +* throttled. There is also a potential race if processes get +* throttled, kswapd wakes, a large process exits thereby balancing the +* zones, which causes kswapd to exit balance_pgdat() before reaching +* the wake up checks. If kswapd is going to sleep, no process should +* be sleeping on pfmemalloc_wait, so wake them now if necessary. If +* the wake up is premature, processes will wake kswapd and get +* throttled again. The difference from wake ups in balance_pgdat() is +* that here we are under prepare_to_wait(). */ -if (waitqueue_active (&pgdat->pfmemalloc_wait)) { -wake_up (&pgdat->pfmemalloc_wait); -return false; - } +if (waitqueue_active (&pgdat->pfmemalloc_wait)) +wake_up_all (&pgdat->pfmemalloc_wait);return pgdat_balanced (pgdat, order, classzone_idx); }
Greg Kroah-Hartman
maintainerPATCH 149/150 mm: propagate error from stack expansion even for guard page
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit fee7e49d45149fba60156f5b59014f764d3e3728 upstream.
Jay Foad reports that the address sanitizer test (asan) sometimes gets confused by a stack pointer that ends up being outside the stack vma that is reported by /proc/maps.
This happens due to an interaction between RLIMIT_STACK and the guard
page: when we do the guard page check, we ignore the potential error from the stack expansion, which effectively results in a missing guard page, since the expected stack expansion won't have been done.
And since /proc/maps explicitly ignores the guard page (commitd7824370e263: "mm: fix up some user-visible effects of the stack guard page"), the stack pointer ends up being outside the reported stack area.
This is the minimal patch: it just propagates the error. It also effectively makes the guard page part of the stack limit, which in turn measn that the actual real stack is one page less than the stack limit.
Let's see if anybody notices. We could teach acct_stack_growth() to allow an extra page for a grow-up/grow-down stack in the rlimit test, but I don't want to add more complexity if it isn't needed.
--- include/linux/mm.h | 2 +- mm/memory.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
include/linux/mm.h +1 -1
@@ -1936,7 +1936,7 @@ extern int expand_downwards(struct vm_ar#if VM_GROWSUP extern int expand_upwards (struct vm_area_struct *vma,unsigned long address);#else -#define expand_upwards (vma, address) do { } while (0) +#define expand_upwards (vma, address) (0)#endif /* Look up the first VMA which satisfies addr < vm_end, NULL if none. */
mm/memory.c +2 -2
@@ -2613,7 +2613,7 @@ static inline int check_stack_guard_pageif (prev && prev->vm_end == address)return prev->vm_flags &VM_GROWSDOWN ?0 : -ENOMEM ; -expand_downwards (vma, address -PAGE_SIZE ); +return expand_downwards (vma, address -PAGE_SIZE ); }if ((vma->vm_flags &VM_GROWSUP ) && address +PAGE_SIZE == vma->vm_end) {struct vm_area_struct *next = vma->vm_next;
@@ -2622,7 +2622,7 @@ static inline int check_stack_guard_pageif (next && next->vm_start == address +PAGE_SIZE )return next->vm_flags &VM_GROWSUP ?0 : -ENOMEM ; -expand_upwards (vma, address +PAGE_SIZE ); +return expand_upwards (vma, address +PAGE_SIZE ); }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 150/150 mm: Dont count the stack guard page towards RLIMIT_STACK
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit 690eac53daff34169a4d74fc7bfbd388c4896abb upstream.
Commit fee7e49d4514 ("mm: propagate error from stack expansion even for guard page") made sure that we return the error properly for stack growth conditions. It also theorized that counting the guard page towards the stack limit might break something, but also said "Let's see if anybody notices".
Somebody did notice. Apparently android-x86 sets the stack limit very close to the limit indeed, and including the guard page in the rlimit check causes the android 'zygote' process problems.
So this adds the (fairly trivial) code to make the stack rlimit check be against the actual real stack size, rather than the size of the vma that includes the guard page.
--- mm/mmap.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
mm/mmap.c +5 -2
@@ -2099,14 +2099,17 @@ static int acct_stack_growth(struct vm_a {struct mm_struct *mm = vma->vm_mm;struct rlimit *rlim = current->signal->rlim; -unsigned long new_start; +unsigned long new_start, actual_size;/* address space limit tests */ if (!may_expand_vm (mm, grow))return -ENOMEM ;/* Stack limit test */ -if (size >ACCESS_ONCE (rlim[RLIMIT_STACK ].rlim_cur)) + actual_size = size; +if (size && (vma->vm_flags & (VM_GROWSUP |VM_GROWSDOWN ))) + actual_size -=PAGE_SIZE ; +if (actual_size >ACCESS_ONCE (rlim[RLIMIT_STACK ].rlim_cur))return -ENOMEM ;/* mlock limit tests */
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.18.3 release. There are 150 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 Fri Jan 16 07:20:24 UTC 2015. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.18.3-rc1.gzand the diffstat can be found below.
thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Signature · 5 lines
Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) [email protected] | (970) 217-8978
Re: [PATCH 3.18 126/150] Revert "Input: atmel_mxt_ts - use deep sleep mode when stopped"
In reply to Greg Kroah-HartmanHi Greg,
Quoted 12 lines · Greg Kroah-Hartman
3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit
7f4054836d811c650c51f9c93088f8ebd61b0020upstream.This reverts commit
9d469d033d135d80742a4e39e6bbb4519dd5eee1.It breaks the Chromebook Pixel touchpad (and touchscreen).
Quoted 8 lines
Reported-by Dirk Hohndel <[email protected]>Bisected-by Linus Torvalds <[email protected]>Cc Nick Dyer <[email protected]>Cc Benson Leung <[email protected]>Cc Yufeng Shen <[email protected]>Cc Dmitry Torokhov <[email protected]>Signed-off-by Linus Torvalds <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
I'd rather we did not apply this to stable just yet - the patch does not fix Dirk's Pixel and Linus's still flaky and I have another patch I'm waiting on them to try out.
Thanks.
Quoted 168 lines
--- drivers/input/touchscreen/atmel_mxt_ts.c | 99 ++++++++----------------------- 1 file changed, 26 insertions(+), 73 deletions(-)drivers/input/touchscreen/atmel_mxt_ts.c +26
-73@@ -99,13 +99,9 @@#define MXT_T6_STATUS_COMSERR (1 << 2)/* MXT_GEN_POWER_T7 field */ -struct t7_config { -u8 idle; -u8 active; -} __packed; - -#define MXT_POWER_CFG_RUN 0 -#define MXT_POWER_CFG_DEEPSLEEP 1 +#define MXT_POWER_IDLEACQINT 0 +#define MXT_POWER_ACTVACQINT 1 +#define MXT_POWER_ACTV2IDLETO 2/* MXT_GEN_ACQUIRE_T8 field */ #define MXT_ACQUIRE_CHRGTIME 0@@ -117,6 +113,7 @@ struct t7_config {#define MXT_ACQUIRE_ATCHCALSTHR 7/* MXT_TOUCH_MULTI_T9 field */ +#define MXT_TOUCH_CTRL 0#define MXT_T9_ORIENT 9#define MXT_T9_RANGE 18@@ -256,7 +253,6 @@ struct mxt_data {bool update_input;u8 last_message_count;u8 num_touchids; -struct t7_config t7_cfg;/* Cached parameters from object table */ u16 T5_address;@@ -672,6 +668,20 @@ static void mxt_proc_t6_messages(struct data->t6_status = status; } +static int mxt_write_object (struct mxt_data *data, +u8 type,u8 offset,u8 val) +{ +struct mxt_object *object; +u16 reg; + + object =mxt_get_object (data, type); +if (!object || offset >=mxt_obj_size (object)) +return -EINVAL ; + + reg = object->start_address; +return mxt_write_reg (data->client, reg + offset, val); +} +static void mxt_input_button (struct mxt_data *data,u8 *message) {struct input_dev *input = data->input_dev;@@ -1742,60 +1752,6 @@ err_free_object_table:return error; } -static int mxt_set_t7_power_cfg (struct mxt_data *data,u8 sleep) -{ -struct device *dev = &data->client->dev; -int error; -struct t7_config *new_config; -struct t7_config deepsleep = { .active =0 , .idle =0 }; - -if (sleep ==MXT_POWER_CFG_DEEPSLEEP ) - new_config = &deepsleep; -else - new_config = &data->t7_cfg; - - error =__mxt_write_reg (data->client, data->T7_address, -sizeof (data->t7_cfg), new_config); -if (error) -return error; - -dev_dbg (dev,"Set T7 ACTV:%d IDLE:%d\n" , - new_config->active, new_config->idle); - -return 0 ; -} - -static int mxt_init_t7_power_cfg (struct mxt_data *data) -{ -struct device *dev = &data->client->dev; -int error; -bool retry = false; - -recheck: - error =__mxt_read_reg (data->client, data->T7_address, -sizeof (data->t7_cfg), &data->t7_cfg); -if (error) -return error; - -if (data->t7_cfg.active ==0 || data->t7_cfg.idle ==0 ) { -if (!retry) { -dev_dbg (dev,"T7 cfg zero, resetting\n" ); -mxt_soft_reset (data); - retry = true; - goto recheck; - }else { -dev_dbg (dev,"T7 cfg zero after reset, overriding\n" ); - data->t7_cfg.active =20 ; - data->t7_cfg.idle =100 ; -return mxt_set_t7_power_cfg (data,MXT_POWER_CFG_RUN ); - } - } - -dev_dbg (dev,"Initialized power cfg: ACTV %d, IDLE %d\n" , - data->t7_cfg.active, data->t7_cfg.idle); -return 0 ; -} -static int mxt_configure_objects (struct mxt_data *data,const struct firmware *cfg) {@@ -1809,12 +1765,6 @@ static int mxt_configure_objects(structdev_warn (dev,"Error %d updating config\n" , error); } - error =mxt_init_t7_power_cfg (data); -if (error) { -dev_err (dev,"Failed to initialize power cfg\n" ); -return error; - } - error =mxt_initialize_t9_input_device (data);if (error)return error;@@ -2093,15 +2043,16 @@ static const struct attribute_group mxt_static void mxt_start (struct mxt_data *data) { -mxt_set_t7_power_cfg (data,MXT_POWER_CFG_RUN ); - -/* Recalibrate since chip has been in deep sleep */ -mxt_t6_command (data,MXT_COMMAND_CALIBRATE ,1 , false); +/* Touch enable */ +mxt_write_object (data, +MXT_TOUCH_MULTI_T9 ,MXT_TOUCH_CTRL ,0x83 ); }static void mxt_stop (struct mxt_data *data) { -mxt_set_t7_power_cfg (data,MXT_POWER_CFG_DEEPSLEEP ); +/* Touch disable */ +mxt_write_object (data, +MXT_TOUCH_MULTI_T9 ,MXT_TOUCH_CTRL ,0 ); }static int mxt_input_open (struct input_dev *dev)@@ -2267,6 +2218,8 @@ static int mxt_resume(struct device *devstruct mxt_data *data =i2c_get_clientdata (client);struct input_dev *input_dev = data->input_dev; +mxt_soft_reset (data); +mutex_lock (&input_dev->mutex);if (input_dev->users)
Signature · 1 line
Dmitry
Greg Kroah-Hartman
maintainerQuoted 13 lines · Shuah Khan
Quoted 12 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.18.3 release. There are 150 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 Fri Jan 16 07:20:24 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/v3.0/stable-review/patch-3.18.3-rc1.gzand the diffstat can be found below.
Quoted 6 lines
Quoted 4 lines
thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
Thanks for testing all of these and letting me know.
greg k-h
Greg Kroah-Hartman
maintainerRe: [PATCH 3.18 126/150] Revert "Input: atmel_mxt_ts - use deep sleep mode when stopped"
In reply to Dmitry TorokhovQuoted 24 lines · Dmitry Torokhov
Hi Greg,
Quoted 12 lines · Greg Kroah-Hartman
3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit
7f4054836d811c650c51f9c93088f8ebd61b0020upstream.This reverts commit
9d469d033d135d80742a4e39e6bbb4519dd5eee1.It breaks the Chromebook Pixel touchpad (and touchscreen).
Quoted 8 lines
Reported-by Dirk Hohndel <[email protected]>Bisected-by Linus Torvalds <[email protected]>Cc Nick Dyer <[email protected]>Cc Benson Leung <[email protected]>Cc Yufeng Shen <[email protected]>Cc Dmitry Torokhov <[email protected]>Signed-off-by Linus Torvalds <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 3 lines
I'd rather we did not apply this to stable just yet - the patch does not fix Dirk's Pixel and Linus's still flaky and I have another patch I'm waiting on them to try out.
Thanks for letting me know, it's now dropped.
greg k-h
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.18.3 release. There are 150 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 Fri Jan 16 07:20:24 UTC 2015. Anything received after that time might be too late.
Build results:
total: 133 pass: 133 fail: 0 Qemu tests: total: 30 pass: 30 fail: 0
Guenter
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.18.3 release. There are 150 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 Fri Jan 16 07:20:24 UTC 2015. Anything received after that time might be too late.
Update: Tests still pass after you dropped a patch.
Guenter
Greg Kroah-Hartman
maintainerQuoted 11 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.18.3 release. There are 150 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 Fri Jan 16 07:20:24 UTC 2015. Anything received after that time might be too late.
Update: Tests still pass after you dropped a patch.
Great, thanks for testing all of these and letting me know.
greg k-h