4.14.60-stable review
Subsystems (11)
Greg Kroah-Hartman
maintainercover 4.14.60-stable review
This is the start of the stable review cycle for the 4.14.60 release. There are 246 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 Aug 3 16:49:18 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.60-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.14.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.14.60-rc1
Eric Dumazet <[email protected]>
tcp: add one more quick ack after after ECN events
Yousuk Seung <[email protected]>
tcp: refactor tcp_ecn_check_ce to remove sk type cast
Eric Dumazet <[email protected]>
tcp: do not aggressively quick ack after ECN events
Eric Dumazet <[email protected]>
tcp: add max_quickacks param to tcp_incr_quickack and tcp_enter_quickack_mode
Eric Dumazet <[email protected]>
tcp: do not force quickack when receiving out-of-order packets
Dmitry Safonov <[email protected]>
netlink: Don't shift with UB on nlk->ngroups
Dmitry Safonov <[email protected]>
netlink: Do not subscribe to non-existent groups
Xiao Liang <[email protected]>
xen-netfront: wait xenbus state change when load module manually
Neal Cardwell <[email protected]>
tcp_bbr: fix bw probing to raise in-flight data for very small BDPs
Eugeniy Paltsev <[email protected]>
NET: stmmac: align DMA stuff to largest cache line length
Anton Vasilyev <[email protected]>
net: mdio-mux: bcm-iproc: fix wrong getter and setter pair
Stefan Wahren <[email protected]>
net: lan78xx: fix rx handling before first packet is send
tangpengpeng <[email protected]>
net: fix amd-xgbe flow-control issue
Gal Pressman <[email protected]>
net: ena: Fix use of uninitialized DMA address bits field
Lorenzo Bianconi <[email protected]>
ipv4: remove BUG_ON() from fib_compute_spec_dst
Michal Vokáč <[email protected]>
net: dsa: qca8k: Allow overwriting CPU port setting
Michal Vokáč <[email protected]>
net: dsa: qca8k: Add QCA8334 binding documentation
Michal Vokáč <[email protected]>
net: dsa: qca8k: Enable RXMAC when bringing up a port
Michal Vokáč <[email protected]>
net: dsa: qca8k: Force CPU port to its highest bandwidth
Leon Romanovsky <[email protected]>
RDMA/uverbs: Protect from attempts to create flows on unsupported QP
Yoshihiro Shimoda <[email protected]>
usb: gadget: udc: renesas_usb3: should remove debugfs
Chengguang Xu <[email protected]>
ovl: Sync upper dirty data when syncing overlayfs
Lorenzo Pieralisi <[email protected]>
PCI: xgene: Remove leftover pci_scan_child_bus() call
Lukas Wunner <[email protected]>
PCI: pciehp: Assume NoCompl+ for Thunderbolt ports
Theodore Ts'o <[email protected]>
ext4: fix check to prevent initializing reserved inodes
Theodore Ts'o <[email protected]>
ext4: check for allocation block validity with block group locked
Theodore Ts'o <[email protected]>
ext4: fix inline data updates with checksums enabled
Linus Torvalds <[email protected]>
squashfs: be more careful about metadata corruption
Theodore Ts'o <[email protected]>
random: mix rdrand with entropy sent in from userspace
Greg Edwards <[email protected]>
block: reset bi_iter.bi_done after splitting bio
Martin Wilck <[email protected]>
blkdev: __blkdev_direct_IO_simple: fix leak in error case
Martin Wilck <[email protected]>
block: bio_iov_iter_get_pages: fix size of last iovec
Andy Shevchenko <[email protected]>
drm/dp/mst: Fix off-by-one typo when dump payload table
Ville Syrjälä <[email protected]>
drm/atomic-helper: Drop plane->fb references only for drm_atomic_helper_shutdown()
José Roberto de Souza <[email protected]>
drm: Add DP PSR2 sink enable bit
Kirill Marinushkin <[email protected]>
ASoC: topology: Add missing clock gating parameter when parsing hw_configs
Kirill Marinushkin <[email protected]>
ASoC: topology: Fix bclk and fsync inversion in set_link_hw_format()
Mauro Carvalho Chehab <[email protected]>
media: si470x: fix __be16 annotations
Mauro Carvalho Chehab <[email protected]>
media: atomisp: compat32: fix __user annotations
Matthew R. Ochs <[email protected]>
scsi: cxlflash: Avoid clobbering context control register value
Uma Krishnan <[email protected]>
scsi: cxlflash: Synchronize reset and remove ops
Shivasharan S <[email protected]>
scsi: megaraid_sas: Increase timeout by 1 sec for non-RAID fastpath IOs
Xose Vazquez Perez <[email protected]>
scsi: scsi_dh: replace too broad "TP9" string with the exact models
Douglas Anderson <[email protected]>
regulator: Don't return or expect -errno from of_map_mode()
Suman Anna <[email protected]>
media: omap3isp: fix unbalanced dma_iommu_mapping
Tudor-Dan Ambarus <[email protected]>
crypto: authenc - don't leak pointers to authenc keys
Tudor-Dan Ambarus <[email protected]>
crypto: authencesn - don't leak pointers to authenc keys
Dominik Bozek <[email protected]>
usb: hub: Don't wait for connect state at resume for powered-off ports
Michal Simek <[email protected]>
microblaze: Fix simpleImage format generation
Andrey Smirnov <[email protected]>
soc: imx: gpcv2: Do not pass static memory as platform data
Douglas Anderson <[email protected]>
serial: core: Make sure compiler barfs for 16-byte earlycon names
NeilBrown <[email protected]>
staging: lustre: ldlm: free resource when ldlm_lock_create() fails.
James Simmons <[email protected]>
staging: lustre: llite: correct removexattr detection
Stefan Wahren <[email protected]>
staging: vchiq_core: Fix missing semaphore release in error case
Ondrej Mosnáček <[email protected]>
audit: allow not equal op for audit by executable
Siva Rebbagondla <[email protected]>
rsi: fix nommu_map_sg overflow kernel panic
Siva Rebbagondla <[email protected]>
rsi: Fix 'invalid vdd' warning in mmc
Chris Novakovic <[email protected]>
ipconfig: Correctly initialise ic_nameservers
Luc Van Oostenryck <[email protected]>
drm/gma500: fix psb_intel_lvds_mode_valid()'s return type
Vinicius Costa Gomes <[email protected]>
igb: Fix queue selection on MAC filters on i210
Enric Balletbo i Serra <[email protected]>
arm64: defconfig: Enable Rockchip io-domain driver
Wei Xu <[email protected]>
nvme: lightnvm: add granby support
Dmitry Osipenko <[email protected]>
memory: tegra: Apply interrupts mask per SoC
Dmitry Osipenko <[email protected]>
memory: tegra: Do not handle spurious interrupts
Sebastian Andrzej Siewior <[email protected]>
delayacct: Use raw_spinlocks
Thomas Gleixner <[email protected]>
stop_machine: Use raw spinlocks
Wolfram Sang <[email protected]>
backlight: pwm_bl: Don't use GPIOF_* with gpiod_get_direction
Kirill Tkhai <[email protected]>
fasync: Fix deadlock between task-context and interrupt-context kill_fasync()
Yixun Lan <[email protected]>
dt-bindings: net: meson-dwmac: new compatible name for AXG SoC
Huazhong Tan <[email protected]>
net: hns3: Fixes the out of bounds access in hclge_map_tqp
Alexey Khoroshilov <[email protected]>
spi: meson-spicc: Fix error handling in meson_spicc_probe()
Martin Blumenstingl <[email protected]>
dt-bindings: pinctrl: meson: add support for the Meson8m2 SoC
Tobin C. Harding <[email protected]>
mmc: pwrseq: Use kmalloc_array instead of stack VLA
Shawn Lin <[email protected]>
mmc: dw_mmc: update actual clock for mmc debugfs
Takashi Sakamoto <[email protected]>
ALSA: hda/ca0132: fix build failure when a local macro is defined
Satendra Singh Thakur <[email protected]>
drm/atomic: Handling the case when setting old crtc for plane
Mauro Carvalho Chehab <[email protected]>
media: siano: get rid of __le32/__le16 cast warnings
Jaegeuk Kim <[email protected]>
f2fs: avoid fsync() failure caused by EAGAIN in writepage()
Jakub Kicinski <[email protected]>
bpf: fix references to free_bpf_prog_info() in comments
Bartlomiej Zolnierkiewicz <[email protected]>
thermal: exynos: fix setting rising_threshold for Exynos5433
Doug Oucharek <[email protected]>
staging: lustre: o2iblnd: Fix FastReg map/unmap for MLX5
Doug Oucahrek <[email protected]>
staging: lustre: o2iblnd: fix race at kiblnd_connect_peer
Chad Dupuis <[email protected]>
scsi: qedf: Set the UNLOADING flag when removing a vport
Xiang Chen <[email protected]>
scsi: hisi_sas: config ATA de-reset as an constrained command for v3 hw
Dan Carpenter <[email protected]>
scsi: megaraid: silence a static checker bug
Wenwen Wang <[email protected]>
scsi: 3w-xxxx: fix a missing-check bug
Wenwen Wang <[email protected]>
scsi: 3w-9xxx: fix a missing-check bug
Michael Chan <[email protected]>
bnxt_en: Check unsupported speeds in bnxt_update_link() on PF only.
Thomas Richter <[email protected]>
perf: fix invalid bit in diagnostic entry
Thomas Richter <[email protected]>
s390/cpum_sf: Add data entry sizes to sampling trailer entry
Sean Lanigan <[email protected]>
brcmfmac: Add support for bcm43364 wireless chipset
Jane Wan <[email protected]>
mtd: rawnand: fsl_ifc: fix FSL NAND driver to read all ONFI parameter pages
Brad Love <[email protected]>
media: saa7164: Fix driver name in debug output
Sami Tolvanen <[email protected]>
media: media-device: fix ioctl function types
Hans de Goede <[email protected]>
ACPI / LPSS: Only call pwm_add_table() for Bay Trail PWM if PMIC HRV is 2
Damien Le Moal <[email protected]>
libata: Fix command retry decision
Wei Yongjun <[email protected]>
media: rcar_jpu: Add missing clk_disable_unprepare() on error in jpu_open()
Florian Fainelli <[email protected]>
net: phy: phylink: Release link GPIO
Marc Zyngier <[email protected]>
dma-iommu: Fix compilation when !CONFIG_IOMMU_DMA
DaeRyong Jeong <[email protected]>
tty: Fix data race in tty_insert_flip_string_fixed_flag
Jacob Keller <[email protected]>
i40e: free the skb after clearing the bitlock
Mathieu Malaterre <[email protected]>
nvmem: properly handle returned value nvmem_reg_read
Geert Uytterhoeven <[email protected]>
ARM: dts: sh73a0: Add missing interrupt-affinity to PMU node
Geert Uytterhoeven <[email protected]>
ARM: dts: emev2: Add missing interrupt-affinity to PMU node
Patrice Chotard <[email protected]>
ARM: dts: stih407-pinctrl: Fix complain about IRQ_TYPE_NONE usage
Thor Thayer <[email protected]>
EDAC, altera: Fix ARM64 build warning
Dmitry Torokhov <[email protected]>
HID: i2c-hid: check if device is there before really probing
Jonathan Neuschäfer <[email protected]>
powerpc/embedded6xx/hlwd-pic: Prevent interrupts from being handled by Starlet
Samuel Li <[email protected]>
drm/amdgpu: Remove VRAM from shared bo domains.
Luc Van Oostenryck <[email protected]>
drm/radeon: fix mode_valid's return type
Kuninori Morimoto <[email protected]>
arm64: dts: renesas: salvator-common: use audio-graph-card for Sound
Terry Junge <[email protected]>
HID: hid-plantronics: Re-resend Update to map button for PTT products
Will Deacon <[email protected]>
arm64: cmpwait: Clear event register before arming exclusive monitor
Mauro Carvalho Chehab <[email protected]>
media: atomisp: ov2680: don't declare unused vars
Takashi Iwai <[email protected]>
ALSA: usb-audio: Apply rate limit to warning messages in URB complete callback
Grygorii Strashko <[email protected]>
net: ethernet: ti: cpsw-phy-sel: check bus_find_device() ret value
Colin Ian King <[email protected]>
media: smiapp: fix timeout checking in smiapp_read_nvm
Emil Tantilov <[email protected]>
ixgbevf: fix MAC address changes through ixgbevf_set_mac()
Yufen Yu <[email protected]>
md: fix NULL dereference of mddev->pers in remove_and_add_spares()
Gioh Kim <[email protected]>
md/raid1: add error handling of read error from FailFast device
Anson Huang <[email protected]>
regulator: pfuze100: add .is_enable() for pfuze100_swb_regulator_ops
Takashi Iwai <[email protected]>
ALSA: emu10k1: Rate-limit error messages about page errors
Alexandre Belloni <[email protected]>
rtc: tps65910: fix possible race condition
Alexandre Belloni <[email protected]>
rtc: vr41xx: fix possible race condition
Alexandre Belloni <[email protected]>
rtc: tps6586x: fix possible race condition
Vic Wei <[email protected]>
Bluetooth: btusb: add ID for LiteOn 04ca:301a
Ben Skeggs <[email protected]>
drm/nouveau/fifo/gk104-: poll for runlist update completion
Jens Remus <[email protected]>
scsi: zfcp: assert that the ERP lock is held when tracing a recovery trigger
Maya Erez <[email protected]>
scsi: ufs: fix exception event handling
Subhash Jadavani <[email protected]>
scsi: ufs: ufshcd: fix possible unclocked register access
Eric Biggers <[email protected]>
fscrypt: use unbound workqueue for decryption
Xi Wang <[email protected]>
net: hns3: Fix the missing client list node initialization
Tony Lindgren <[email protected]>
spi: Add missing pm_runtime_put_noidle() after failed get
Mark Rutland <[email protected]>
drivers/perf: arm-ccn: don't log to dmesg in event_init
Mimi Zohar <[email protected]>
ima: based on policy verify firmware signatures (pre-allocated buffer)
Xinming Hu <[email protected]>
mwifiex: correct histogram data with appropriate index
Michal Vokáč <[email protected]>
net: dsa: qca8k: Add support for QCA8334 switch
Mika Westerberg <[email protected]>
PCI: pciehp: Request control of native hotplug only if supported
Sandipan Das <[email protected]>
bpf: powerpc64: pad function address loads with NOPs
Julia Lawall <[email protected]>
pinctrl: at91-pio4: add missing of_node_put
Christophe Leroy <[email protected]>
powerpc/8xx: fix invalid register expression in head_8xx.S
Geert Uytterhoeven <[email protected]>
spi: sh-msiof: Fix setting SIRMDR1.SYNCAC to match SITMDR1.SYNCAC
Mathieu Malaterre <[email protected]>
powerpc: Add __printf verification to prom_printf
Mathieu Malaterre <[email protected]>
powerpc/powermac: Mark variable x as unused
Mathieu Malaterre <[email protected]>
powerpc/powermac: Add missing prototype for note_bootable_part()
Mathieu Malaterre <[email protected]>
powerpc/chrp/time: Make some functions static, add missing header include
Mathieu Malaterre <[email protected]>
powerpc/32: Add a missing include header
Sven Eckelmann <[email protected]>
ath: Add regulatory mapping for Bahamas
Sven Eckelmann <[email protected]>
ath: Add regulatory mapping for Bermuda
Sven Eckelmann <[email protected]>
ath: Add regulatory mapping for Serbia
Sven Eckelmann <[email protected]>
ath: Add regulatory mapping for Tanzania
Sven Eckelmann <[email protected]>
ath: Add regulatory mapping for Uganda
Sven Eckelmann <[email protected]>
ath: Add regulatory mapping for APL2_FCCA
Sven Eckelmann <[email protected]>
ath: Add regulatory mapping for APL13_WORLD
Sven Eckelmann <[email protected]>
ath: Add regulatory mapping for ETSI8_WORLD
Sven Eckelmann <[email protected]>
ath: Add regulatory mapping for FCC3_ETSIC
Keith Busch <[email protected]>
nvme-pci: Fix AER reset handling
Jianchao Wang <[email protected]>
nvme-rdma: stop admin queue before freeing it
Christoph Hellwig <[email protected]>
PCI: Prevent sysfs disable of device while driver is attached
Sebastian Andrzej Siewior <[email protected]>
PM / wakeup: Make s2idle_lock a RAW_SPINLOCK
Scott Wood <[email protected]>
x86/microcode: Make the late update update_lock a raw lock for RT
Qu Wenruo <[email protected]>
btrfs: qgroup: Finish rescan when hit the last leaf of extent tree
David Sterba <[email protected]>
btrfs: add barriers to btrfs_sync_log before log_commit_wait wakeups
Omar Sandoval <[email protected]>
Btrfs: don't BUG_ON() in btrfs_truncate_inode_items()
Omar Sandoval <[email protected]>
Btrfs: don't return ino to ino cache if inode item removal fails
Hans Verkuil <[email protected]>
media: videobuf2-core: don't call memop 'finish' when queueing
Ezequiel Garcia <[email protected]>
media: tw686x: Fix incorrect vb2_mem_ops GFP flags
Fuyun Liang <[email protected]>
net: hns3: Fixes the init of the VALID BD info in the descriptor
Eyal Reizer <[email protected]>
wlcore: sdio: check for valid platform device data before suspend
Ganapathi Bhat <[email protected]>
mwifiex: handle race during mwifiex_usb_disconnect
Vincent Palatin <[email protected]>
mfd: cros_ec: Fail early if we cannot identify the EC
Kai Chieh Chuang <[email protected]>
ASoC: dpcm: fix BE dai not hw_free and shutdown
Jian-Hong Pan <[email protected]>
Bluetooth: btusb: Add a new Realtek 8723DE ID 2ff8:b011
Thierry Escande <[email protected]>
Bluetooth: hci_qca: Fix "Sleep inside atomic section" warning
Shaul Triebitz <[email protected]>
iwlwifi: pcie: fix race in Rx buffer allocator
Ethan Lien <[email protected]>
btrfs: balance dirty metadata pages in btrfs_finish_ordered_io
Jan Kiszka <[email protected]>
PCI: Fix devm_pci_alloc_host_bridge() memory leak
Shuah Khan (Samsung OSG) <[email protected]>
selftests: intel_pstate: return Kselftest Skip code for skipped tests
Shuah Khan (Samsung OSG) <[email protected]>
selftests: memfd: return Kselftest Skip code for skipped tests
Daniel Díaz <[email protected]>
selftests/intel_pstate: Improve test, minor fixes
Kan Liang <[email protected]>
perf/x86/intel/uncore: Correct fixed counter index check for NHM
Kan Liang <[email protected]>
perf/x86/intel/uncore: Correct fixed counter index check in generic code
Michael Grzeschik <[email protected]>
usbip: dynamically allocate idev by nports found in sysfs
Shuah Khan (Samsung OSG) <[email protected]>
usbip: usbip_detach: Fix memory, udev context and udev leak
Filippo Muzzini <[email protected]>
block, bfq: remove wrong lock in bfq_requests_merged
Chao Yu <[email protected]>
f2fs: fix race in between GC and atomic open
Chao Yu <[email protected]>
f2fs: fix to detect failure of dquot_initialize
Sahitya Tummala <[email protected]>
f2fs: Fix deadlock in shutdown ioctl
Chao Yu <[email protected]>
f2fs: fix to wait page writeback during revoking atomic write
Chao Yu <[email protected]>
f2fs: fix to don't trigger writeback during recovery
Chao Yu <[email protected]>
f2fs: fix error path of move_data_page
Anatoly Pugachev <[email protected]>
disable loading f2fs module on PAGE_SIZE > 4KB
Trond Myklebust <[email protected]>
pnfs: Don't release the sequence slot until we've processed layoutget on open
Alexey Kodanev <[email protected]>
netfilter: nf_tables: check msg_type before nft_trans_set(trans)
Javier González <[email protected]>
lightnvm: pblk: warn in case of corrupted write buffer
Leon Romanovsky <[email protected]>
RDMA/mad: Convert BUG_ONs to error flows
Nicholas Piggin <[email protected]>
powerpc/64s: Fix compiler store ordering to SLB shadow area
Stewart Smith <[email protected]>
hvc_opal: don't set tb_ticks_per_usec in udbg_init_opal_common()
Sam Bobroff <[email protected]>
powerpc/eeh: Fix use-after-release of EEH driver
Michal Suchanek <[email protected]>
powerpc/64s: Add barrier_nospec
Christophe Leroy <[email protected]>
powerpc/lib: Adjust .balign inside string functions for PPC32
Cong Wang <[email protected]>
infiniband: fix a possible use-after-free bug
Benjamin Poirier <[email protected]>
e1000e: Ignore TSYNCRXCTL when getting I219 clock attributes
Chengguang Xu <[email protected]>
ceph: fix alignment of rasize
Wang YanQing <[email protected]>
bpf, arm32: fix inconsistent naming about emit_a32_lsr_{r64,i64}Sergey Senozhatsky <[email protected]>
printk: drop in_nmi check from printk_safe_flush_on_panic()
Marco Felsch <[email protected]>
watchdog: da9063: Fix updating timeout value
Laurentiu Tudor <[email protected]>
irqchip/ls-scfg-msi: Map MSIs in the iommu
Jozsef Kadlecsik <[email protected]>
netfilter: ipset: List timing out entries with "timeout 1" instead of zero
Florent Fourcot <[email protected]>
netfilter: ipset: forbid family for hash:mac sets
Jiri Olsa <[email protected]>
perf tools: Fix pmu events parsing rule
Alexandre Belloni <[email protected]>
rtc: ensure rtc_set_alarm fails when alarms are not supported
Mathieu Malaterre <[email protected]>
mm/slub.c: add __printf verification to slab_err()
Chintan Pandya <[email protected]>
mm: vmalloc: avoid racy handling of debugobjects in vunmap
Huang Ying <[email protected]>
mm: /proc/pid/pagemap: hide swap entries from unprivileged users
Tetsuo Handa <[email protected]>
kernel/hung_task.c: show all hung tasks before panic
Alex Williamson <[email protected]>
vfio/type1: Fix task tracking for QEMU vCPU hotplug
Alex Williamson <[email protected]>
vfio/mdev: Check globally for duplicate devices
Geert Uytterhoeven <[email protected]>
vfio: platform: Fix reset module leak in error path
Scott Mayhew <[email protected]>
nfsd: fix potential use-after-free in nfsd4_decode_getdeviceinfo
Trond Myklebust <[email protected]>
NFSv4.1: Fix the client behaviour on NFS4ERR_SEQ_FALSE_RETRY
Zhouyang Jia <[email protected]>
ALSA: fm801: add error handling for snd_ctl_add
Zhouyang Jia <[email protected]>
ALSA: emu10k1: add error handling for snd_ctl_add
Olga Kornievskaia <[email protected]>
skip LAYOUTRETURN if layout is invalid
Stephen Hemminger <[email protected]>
hv_netvsc: fix network namespace issues with VF support
Juergen Gross <[email protected]>
xen/netfront: raise max number of slots in xennet_get_responses()
Mark Rutland <[email protected]>
kcov: ensure irq code sees a valid area
Petr Machata <[email protected]>
mlxsw: spectrum_switchdev: Fix port_vlan refcounting
Johannes Weiner <[email protected]>
arm64: fix vmemmap BUILD_BUG_ON() triggering on !vmemmap setups
Steven Rostedt (VMware) <[email protected]>
tracing: Quiet gcc warning about maybe unused link variable
Artem Savkov <[email protected]>
tracing/kprobes: Fix trace_probe flags on enable_trace_kprobe() failure
Snild Dolkow <[email protected]>
kthread, tracing: Don't expose half-written comm when creating kthreads
Steven Rostedt (VMware) <[email protected]>
tracing: Fix possible double free in event_enable_trigger_func()
Steven Rostedt (VMware) <[email protected]>
tracing: Fix double free of event_trigger_data
Tejun Heo <[email protected]>
delayacct: fix crash in delayacct_blkio_end() after delayacct init failure
Shakeel Butt <[email protected]>
kvm, mm: account shadow page tables to kmemcg
KT Liao <[email protected]>
Input: elan_i2c - add another ACPI ID for Lenovo Ideapad 330-15AST
Chen-Yu Tsai <[email protected]>
Input: i8042 - add Lenovo LaVie Z to the i8042 reset list
Donald Shanty III <[email protected]>
Input: elan_i2c - add ACPI ID for lenovo ideapad 330
Marek Szyprowski <[email protected]>
spi: spi-s3c64xx: Fix system resume support
Andrew Morton <[email protected]>
drivers/infiniband/ulp/srpt/ib_srpt.c: fix build with gcc-4.4.4
Bart Van Assche <[email protected]>
IB/srpt: Fix an out-of-bounds stack access in srpt_zerolength_write()
Andrew Morton <[email protected]>
drivers/infiniband/core/verbs.c: fix build with gcc-4.4.4
Bart Van Assche <[email protected]>
RDMA/core: Avoid that ib_drain_qp() triggers an out-of-bounds stack access
Lixin Wang <[email protected]>
i2c: core: decrease reference count of device node in i2c_unregister_device
Kees Cook <[email protected]>
fork: unconditionally clear stack on fork
-------------
Diffstat:
.../devicetree/bindings/net/dsa/qca8k.txt | 23 ++++- .../devicetree/bindings/net/meson-dwmac.txt | 1 + .../devicetree/bindings/pinctrl/meson,pinctrl.txt | 2 + Documentation/vfio-mediated-device.txt | 5 + Makefile | 4 +- arch/arm/boot/dts/emev2.dtsi | 5 +- arch/arm/boot/dts/sh73a0.dtsi | 5 +- arch/arm/boot/dts/stih407-pinctrl.dtsi | 10 +- arch/arm/net/bpf_jit_32.c | 10 +- arch/arm64/boot/dts/renesas/salvator-common.dtsi | 38 ++++--- arch/arm64/configs/defconfig | 2 + arch/arm64/include/asm/cmpxchg.h | 4 +- arch/arm64/mm/init.c | 4 +- arch/microblaze/boot/Makefile | 10 +- arch/powerpc/include/asm/barrier.h | 15 +++ arch/powerpc/include/asm/cache.h | 3 + arch/powerpc/kernel/eeh_driver.c | 28 ++--- arch/powerpc/kernel/head_8xx.S | 2 +- arch/powerpc/kernel/pci_32.c | 1 + arch/powerpc/kernel/prom_init.c | 114 +++++++++++---------- arch/powerpc/lib/string.S | 7 +- arch/powerpc/mm/slb.c | 8 +- arch/powerpc/net/bpf_jit_comp64.c | 34 ++++-- arch/powerpc/platforms/chrp/time.c | 6 +- arch/powerpc/platforms/embedded6xx/hlwd-pic.c | 5 + arch/powerpc/platforms/powermac/bootx_init.c | 4 +- arch/powerpc/platforms/powermac/setup.c | 1 + arch/s390/include/asm/cpu_mf.h | 6 +- arch/x86/events/intel/uncore.c | 2 +- arch/x86/events/intel/uncore_nhmex.c | 2 +- arch/x86/kernel/cpu/microcode/core.c | 6 +- arch/x86/kvm/mmu.c | 2 +- block/bfq-iosched.c | 2 - block/bio.c | 19 ++-- crypto/authenc.c | 1 + crypto/authencesn.c | 1 + drivers/acpi/acpi_lpss.c | 6 +- drivers/acpi/pci_root.c | 4 +- drivers/ata/libata-eh.c | 12 ++- drivers/bluetooth/btusb.c | 4 + drivers/bluetooth/hci_qca.c | 2 +- drivers/bus/arm-ccn.c | 20 ++-- drivers/char/random.c | 10 +- drivers/edac/altera_edac.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 8 +- drivers/gpu/drm/drm_atomic.c | 4 +- drivers/gpu/drm/drm_atomic_helper.c | 78 +++++++------- drivers/gpu/drm/drm_dp_mst_topology.c | 9 +- drivers/gpu/drm/gma500/psb_intel_drv.h | 2 +- drivers/gpu/drm/gma500/psb_intel_lvds.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c | 8 +- drivers/gpu/drm/radeon/radeon_connectors.c | 10 +- drivers/hid/hid-plantronics.c | 6 +- drivers/hid/i2c-hid/i2c-hid.c | 8 ++ drivers/i2c/i2c-core-base.c | 5 +- drivers/infiniband/core/mad.c | 11 +- drivers/infiniband/core/ucma.c | 6 +- drivers/infiniband/core/uverbs_cmd.c | 5 + drivers/infiniband/core/verbs.c | 12 ++- drivers/infiniband/ulp/srpt/ib_srpt.c | 16 +-- drivers/input/mouse/elan_i2c_core.c | 2 + drivers/input/serio/i8042-x86ia64io.h | 7 ++ drivers/irqchip/irq-ls-scfg-msi.c | 3 + drivers/lightnvm/pblk-rb.c | 5 +- drivers/md/md.c | 3 + drivers/md/raid1.c | 2 + drivers/media/common/siano/smsendian.c | 14 +-- drivers/media/i2c/smiapp/smiapp-core.c | 11 +- drivers/media/media-device.c | 21 ++-- drivers/media/pci/saa7164/saa7164-fw.c | 3 +- drivers/media/pci/tw686x/tw686x-video.c | 3 +- drivers/media/platform/omap3isp/isp.c | 7 +- drivers/media/platform/rcar_jpu.c | 4 +- drivers/media/radio/si470x/radio-si470x-i2c.c | 6 +- drivers/media/v4l2-core/videobuf2-core.c | 9 +- drivers/memory/tegra/mc.c | 22 +--- drivers/memory/tegra/mc.h | 9 ++ drivers/memory/tegra/tegra114.c | 2 + drivers/memory/tegra/tegra124.c | 6 ++ drivers/memory/tegra/tegra210.c | 3 + drivers/memory/tegra/tegra30.c | 2 + drivers/mfd/cros_ec.c | 6 +- drivers/mmc/core/pwrseq_simple.c | 14 ++- drivers/mmc/host/dw_mmc.c | 4 + drivers/mtd/nand/fsl_ifc_nand.c | 17 +-- drivers/net/dsa/qca8k.c | 52 +++++++++- drivers/net/dsa/qca8k.h | 7 +- drivers/net/ethernet/amazon/ena/ena_com.c | 1 + drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 4 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 + .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 7 +- .../net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c | 4 + drivers/net/ethernet/intel/e1000e/netdev.c | 15 ++- drivers/net/ethernet/intel/i40e/i40e_ptp.c | 7 +- drivers/net/ethernet/intel/igb/igb_main.c | 9 +- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 1 + .../ethernet/mellanox/mlxsw/spectrum_switchdev.c | 4 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- drivers/net/ethernet/ti/cpsw-phy-sel.c | 8 +- drivers/net/hyperv/hyperv_net.h | 2 + drivers/net/hyperv/netvsc_drv.c | 43 ++++---- drivers/net/phy/mdio-mux-bcm-iproc.c | 2 +- drivers/net/phy/phylink.c | 2 + drivers/net/usb/lan78xx.c | 2 + drivers/net/wireless/ath/regd.h | 5 + drivers/net/wireless/ath/regd_common.h | 13 +++ .../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 1 + drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 2 + drivers/net/wireless/marvell/mwifiex/usb.c | 3 + drivers/net/wireless/marvell/mwifiex/util.c | 8 +- drivers/net/wireless/rsi/rsi_91x_hal.c | 35 ++++--- drivers/net/wireless/rsi/rsi_91x_sdio.c | 23 +++-- drivers/net/wireless/rsi/rsi_sdio.h | 2 +- drivers/net/wireless/ti/wlcore/sdio.c | 5 + drivers/net/xen-netfront.c | 10 +- drivers/nvme/host/pci.c | 5 + drivers/nvme/host/rdma.c | 10 +- drivers/nvmem/core.c | 7 ++ drivers/pci/host/pci-xgene.c | 1 - drivers/pci/hotplug/pciehp_hpc.c | 7 ++ drivers/pci/pci-sysfs.c | 15 +-- drivers/pci/probe.c | 4 +- drivers/pinctrl/pinctrl-at91-pio4.c | 4 +- drivers/regulator/cpcap-regulator.c | 2 +- drivers/regulator/of_regulator.c | 13 +-- drivers/regulator/pfuze100-regulator.c | 1 + drivers/regulator/twl-regulator.c | 2 +- drivers/rtc/interface.c | 5 + drivers/rtc/rtc-tps6586x.c | 14 ++- drivers/rtc/rtc-tps65910.c | 12 ++- drivers/rtc/rtc-vr41xx.c | 9 +- drivers/s390/scsi/zfcp_dbf.c | 2 + drivers/scsi/3w-9xxx.c | 5 + drivers/scsi/3w-xxxx.c | 3 + drivers/scsi/cxlflash/main.c | 11 +- drivers/scsi/cxlflash/sislite.h | 1 + drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 11 +- drivers/scsi/megaraid.c | 3 + drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 + drivers/scsi/qedf/qedf_main.c | 10 ++ drivers/scsi/scsi_dh.c | 5 +- drivers/scsi/ufs/ufshcd.c | 28 +++-- drivers/soc/imx/gpcv2.c | 22 ++-- drivers/spi/spi-meson-spicc.c | 11 +- drivers/spi/spi-s3c64xx.c | 4 +- drivers/spi/spi-sh-msiof.c | 6 +- drivers/spi/spi.c | 1 + .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 2 +- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 30 +++--- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 6 +- drivers/staging/lustre/lustre/llite/xattr.c | 6 +- drivers/staging/media/atomisp/i2c/ov2680.c | 6 +- .../atomisp/pci/atomisp2/atomisp_compat_ioctl32.c | 49 ++++----- .../vc04_services/interface/vchiq_arm/vchiq_core.c | 1 + drivers/thermal/samsung/exynos_tmu.c | 1 + drivers/tty/hvc/hvc_opal.c | 1 - drivers/tty/pty.c | 3 + drivers/usb/core/hub.c | 4 + drivers/usb/gadget/udc/renesas_usb3.c | 8 +- drivers/vfio/mdev/mdev_core.c | 102 +++++++----------- drivers/vfio/mdev/mdev_private.h | 2 +- drivers/vfio/platform/vfio_platform_common.c | 15 ++- drivers/vfio/vfio_iommu_type1.c | 73 ++++++++----- drivers/video/backlight/pwm_bl.c | 6 +- drivers/watchdog/da9063_wdt.c | 17 ++- fs/block_dev.c | 9 +- fs/btrfs/inode.c | 33 +++--- fs/btrfs/qgroup.c | 19 ++++ fs/btrfs/tree-log.c | 10 +- fs/ceph/super.c | 2 +- fs/crypto/crypto.c | 11 +- fs/ext4/balloc.c | 3 + fs/ext4/ialloc.c | 8 +- fs/ext4/inline.c | 19 ++-- fs/ext4/inode.c | 16 ++- fs/ext4/super.c | 8 +- fs/f2fs/data.c | 8 +- fs/f2fs/file.c | 18 +++- fs/f2fs/gc.c | 11 +- fs/f2fs/segment.c | 5 + fs/f2fs/super.c | 6 ++ fs/fcntl.c | 15 ++- fs/nfs/nfs4proc.c | 14 ++- fs/nfs/pnfs.c | 6 +- fs/nfsd/nfs4xdr.c | 2 + fs/overlayfs/super.c | 19 +++- fs/proc/task_mmu.c | 26 +++-- fs/squashfs/cache.c | 3 + fs/squashfs/file.c | 8 +- fs/squashfs/fragment.c | 4 +- fs/squashfs/squashfs_fs.h | 6 ++ include/drm/drm_dp_helper.h | 1 + include/linux/delayacct.h | 4 +- include/linux/dma-iommu.h | 1 + include/linux/fs.h | 2 +- include/linux/mmc/sdio_ids.h | 1 + include/linux/netfilter/ipset/ip_set_timeout.h | 10 +- include/linux/regulator/consumer.h | 1 + include/linux/serial_core.h | 3 +- include/linux/thread_info.h | 6 +- include/net/tcp.h | 2 +- include/soc/tegra/mc.h | 2 + include/uapi/sound/asoc.h | 23 ++++- kernel/auditfilter.c | 2 +- kernel/auditsc.c | 2 + kernel/bpf/verifier.c | 4 +- kernel/delayacct.c | 17 +-- kernel/fork.c | 3 +- kernel/hung_task.c | 11 +- kernel/kcov.c | 3 +- kernel/kthread.c | 8 +- kernel/power/suspend.c | 14 +-- kernel/printk/printk_safe.c | 2 +- kernel/stop_machine.c | 24 ++--- kernel/trace/trace_events_trigger.c | 18 +++- kernel/trace/trace_kprobe.c | 15 ++- mm/slub.c | 2 +- mm/vmalloc.c | 3 +- net/ipv4/fib_frontend.c | 4 +- net/ipv4/ipconfig.c | 13 +++ net/ipv4/tcp_bbr.c | 4 + net/ipv4/tcp_dctcp.c | 4 +- net/ipv4/tcp_input.c | 48 ++++----- net/netfilter/ipset/ip_set_hash_gen.h | 5 +- net/netfilter/nf_tables_api.c | 11 +- net/netlink/af_netlink.c | 5 + security/integrity/ima/ima_main.c | 1 + sound/pci/emu10k1/emupcm.c | 4 +- sound/pci/emu10k1/memory.c | 6 +- sound/pci/fm801.c | 16 ++- sound/pci/hda/patch_ca0132.c | 8 +- sound/soc/soc-pcm.c | 6 +- sound/soc/soc-topology.c | 19 +++- sound/usb/pcm.c | 2 +- tools/perf/util/parse-events.y | 14 ++- tools/testing/selftests/intel_pstate/run.sh | 29 +++--- tools/testing/selftests/memfd/run_tests.sh | 14 ++- tools/usb/usbip/libsrc/vhci_driver.c | 32 +++--- tools/usb/usbip/libsrc/vhci_driver.h | 3 +- tools/usb/usbip/src/usbip_detach.c | 9 +- 240 files changed, 1573 insertions(+), 835 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/246 fork: unconditionally clear stack on fork
4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
commit e01e80634ecdde1dd113ac43b3adad21b47f3957 upstream.
One of the classes of kernel stack content leaks[1] is exposing the contents of prior heap or stack contents when a new process stack is allocated. Normally, those stacks are not zeroed, and the old contents remain in place. In the face of stack content exposure flaws, those contents can leak to userspace.
Fixing this will make the kernel no longer vulnerable to these flaws, as the stack will be wiped each time a stack is assigned to a new process. There's not a meaningful change in runtime performance; it almost looks like it provides a benefit.
Performing back-to-back kernel builds before:
Run times: 157.86 157.09 158.90 160.94 160.80 Mean: 159.12 Std Dev: 1.54
and after:
Run times: 159.31 157.34 156.71 158.15 160.81 Mean: 158.46 Std Dev: 1.46
Instead of making this a build or runtime config, Andy Lutomirski recommended this just be enabled by default.
[1] A noisy search for many kinds of stack content leaks can be seen here:
https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=linux+kernel+stack+leak
I did some more with perf and cycle counts on running 100,000 execs of /bin/true.
before:
Cycles: 218858861551 218853036130 214727610969 227656844122 224980542841
Mean: 221015379122.60
Std Dev: 4662486552.47
after:
Cycles: 213868945060 213119275204 211820169456 224426673259 225489986348
Mean: 217745009865.40
Std Dev: 5935559279.99
It continues to look like it's faster, though the deviation is rather wide, but I'm not sure what I could do that would be less noisy. I'm open to ideas!
--- include/linux/thread_info.h | 6 +----- kernel/fork.c | 3 +-- 2 files changed, 2 insertions(+), 7 deletions(-)
include/linux/thread_info.h +1 -5
@@ -43,11 +43,7 @@ enum {#define THREAD_ALIGN THREAD_SIZE#endif -#if IS_ENABLED (CONFIG_DEBUG_STACK_USAGE ) ||IS_ENABLED (CONFIG_DEBUG_KMEMLEAK ) -# define THREADINFO_GFP (GFP_KERNEL_ACCOUNT | __GFP_ZERO) -#else -# define THREADINFO_GFP (GFP_KERNEL_ACCOUNT) -#endif +#define THREADINFO_GFP (GFP_KERNEL_ACCOUNT | __GFP_ZERO)/* * flag set/clear/test wrappers
kernel/fork.c +1 -2
@@ -215,10 +215,9 @@ static unsigned long *alloc_thread_stackif (!s)continue ; -#ifdef CONFIG_DEBUG_KMEMLEAK /* Clear stale pointers from reused stack. */ memset (s->addr,0 ,THREAD_SIZE ); -#endif + tsk->stack_vm_area = s;return s->addr; }
Greg Kroah-Hartman
maintainerPATCH 2/246 i2c: core: decrease reference count of device node in i2c_unregister_device
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lixin Wang <[email protected]>
commit e0638fa400eaccf9fa8060f67140264c4e276552 upstream.
Reference count of device node was increased in of_i2c_register_device, but without decreasing it in i2c_unregister_device. Then the added device node will never be released. Fix this by adding the of_node_put.
--- drivers/i2c/i2c-core-base.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/i2c/i2c-core-base.c +4 -1
@@ -808,8 +808,11 @@ EXPORT_SYMBOL_GPL(i2c_new_device);*/ void i2c_unregister_device (struct i2c_client *client) { -if (client->dev.of_node) +if (client->dev.of_node) {of_node_clear_flag (client->dev.of_node,OF_POPULATED ); +of_node_put (client->dev.of_node); + } +if (ACPI_COMPANION (&client->dev))acpi_device_clear_enumerated (ACPI_COMPANION (&client->dev));device_unregister (&client->dev);
Greg Kroah-Hartman
maintainerPATCH 3/246 RDMA/core: Avoid that ib_drain_qp() triggers an out-of-bounds stack access
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit a1ae7d0345edd593d6725d3218434d903a0af95d upstream.
This patch fixes the following KASAN complaint:
==================================================================
BUG: KASAN: stack-out-of-bounds in rxe_post_send+0x77d/0x9b0 [rdma_rxe]
Read of size 8 at addr ffff880061aef860 by task 01/1080
CPU: 2 PID: 1080 Comm: 01 Not tainted 4.16.0-rc3-dbg+ #2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014
Call Trace:
dump_stack+0x85/0xc7
print_address_description+0x65/0x270
kasan_report+0x231/0x350
rxe_post_send+0x77d/0x9b0 [rdma_rxe]
__ib_drain_sq+0x1ad/0x250 [ib_core]
ib_drain_qp+0x9/0x30 [ib_core]
srp_destroy_qp+0x51/0x70 [ib_srp]
srp_free_ch_ib+0xfc/0x380 [ib_srp]
srp_create_target+0x1071/0x19e0 [ib_srp]
kernfs_fop_write+0x180/0x210
__vfs_write+0xb1/0x2e0
vfs_write+0xf6/0x250
SyS_write+0x99/0x110
do_syscall_64+0xee/0x2b0
entry_SYSCALL_64_after_hwframe+0x42/0xb7
The buggy address belongs to the page:
page:ffffea000186bbc0 count:0 mapcount:0 mapping:0000000000000000 index:0x0
flags: 0x4000000000000000()
raw: 4000000000000000 0000000000000000 0000000000000000 00000000ffffffff
raw: 0000000000000000 ffffea000186bbe0 0000000000000000 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff880061aef700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff880061aef780: 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00
>ffff880061aef800: f2 f2 f2 f2 f2 f2 f2 00 00 00 00 00 f2 f2 f2 f2
^
ffff880061aef880: f2 f2 f2 00 00 00 00 00 00 00 00 00 00 00 f2 f2
ffff880061aef900: f2 f2 f2 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================--- drivers/infiniband/core/verbs.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/infiniband/core/verbs.c +8 -3
@@ -2115,10 +2115,15 @@ static void __ib_drain_sq(struct ib_qp *struct ib_cq *cq = qp->send_cq;struct ib_qp_attr attr = { .qp_state =IB_QPS_ERR };struct ib_drain_cqe sdrain; -struct ib_send_wr swr = {}, *bad_swr; +struct ib_send_wr *bad_swr; +struct ib_rdma_wr swr = { + .wr = { + .opcode =IB_WR_RDMA_WRITE , + .wr_cqe = &sdrain.cqe, + }, + };int ret; - swr.wr_cqe = &sdrain.cqe; sdrain.cqe.done = ib_drain_qp_done;init_completion (&sdrain.done);
@@ -2128,7 +2133,7 @@ static void __ib_drain_sq(struct ib_qp *return ; } - ret =ib_post_send (qp, &swr, &bad_swr); + ret =ib_post_send (qp, &swr.wr, &bad_swr);if (ret) {WARN_ONCE (ret,"failed to drain send queue: %d\n" , ret);return ;
Greg Kroah-Hartman
maintainerPATCH 5/246 IB/srpt: Fix an out-of-bounds stack access in srpt_zerolength_write()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 2a78cb4db487372152bed2055c038f9634d595e8 upstream.
Avoid triggering an out-of-bounds stack access by changing the type of 'wr' from ib_send_wr into ib_rdma_wr.
This patch fixes the following KASAN bug report:
BUG: KASAN: stack-out-of-bounds in rxe_post_send+0x7a9/0x9a0 [rdma_rxe] Read of size 8 at addr ffff880068197a48 by task kworker/2:1/44 Workqueue: ib_cm cm_work_handler [ib_cm] Call Trace: dump_stack+0x8e/0xcd print_address_description+0x6f/0x280 kasan_report+0x25a/0x380 __asan_load8+0x54/0x90 rxe_post_send+0x7a9/0x9a0 [rdma_rxe] srpt_zerolength_write+0xf0/0x180 [ib_srpt] srpt_cm_rtu_recv+0x68/0x110 [ib_srpt] srpt_rdma_cm_handler+0xbb/0x15b [ib_srpt] cma_ib_handler+0x1aa/0x4a0 [rdma_cm] cm_process_work+0x30/0x100 [ib_cm] cm_work_handler+0xa86/0x351b [ib_cm] process_one_work+0x475/0x9f0 worker_thread+0x69/0x690 kthread+0x1ad/0x1d0 ret_from_fork+0x3a/0x50
--- drivers/infiniband/ulp/srpt/ib_srpt.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/infiniband/ulp/srpt/ib_srpt.c +9 -6
@@ -787,13 +787,16 @@ static int srpt_post_recv(struct srpt_de*/ static int srpt_zerolength_write (struct srpt_rdma_ch *ch) { -struct ib_send_wr wr, *bad_wr; +struct ib_send_wr *bad_wr; +struct ib_rdma_wr wr = { + .wr = { + .opcode =IB_WR_RDMA_WRITE , + .wr_cqe = &ch->zw_cqe, + .send_flags =IB_SEND_SIGNALED , + } + }; -memset (&wr,0 ,sizeof (wr)); - wr.opcode =IB_WR_RDMA_WRITE ; - wr.wr_cqe = &ch->zw_cqe; - wr.send_flags =IB_SEND_SIGNALED ; -return ib_post_send (ch->qp, &wr, &bad_wr); +return ib_post_send (ch->qp, &wr.wr, &bad_wr); }static void srpt_zerolength_write_done (struct ib_cq *cq,struct ib_wc *wc)
Greg Kroah-Hartman
maintainerPATCH 12/246 delayacct: fix crash in delayacct_blkio_end() after delayacct init failure
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit b512719f771a82180211c9a315b8a7f628832b3d upstream.
While forking, if delayacct init fails due to memory shortage, it continues expecting all delayacct users to check task->delays pointer against NULL before dereferencing it, which all of them used to do.
Commit c96f5471ce7d ("delayacct: Account blkio completion on the correct task"), while updating delayacct_blkio_end() to take the target task instead of always using %current, made the function test NULL on %current->delays and then continue to operated on @p->delays. If %current succeeded init while @p didn't, it leads to the following crash.
BUG: unable to handle kernel NULL pointer dereference at 0000000000000004 IP: __delayacct_blkio_end+0xc/0x40 PGD 8000001fd07e1067 P4D 8000001fd07e1067 PUD 1fcffbb067 PMD 0 Oops: 0000 [#1] SMP PTI CPU: 4 PID: 25774 Comm: QIOThread0 Not tainted 4.16.0-9_fbk1_rc2_1180_g6b593215b4d7 #9 RIP: 0010:__delayacct_blkio_end+0xc/0x40 Call Trace: try_to_wake_up+0x2c0/0x600 autoremove_wake_function+0xe/0x30 __wake_up_common+0x74/0x120 wake_up_page_bit+0x9c/0xe0 mpage_end_io+0x27/0x70 blk_update_request+0x78/0x2c0 scsi_end_request+0x2c/0x1e0 scsi_io_completion+0x20b/0x5f0 blk_mq_complete_request+0xa2/0x100 ata_scsi_qc_complete+0x79/0x400 ata_qc_complete_multiple+0x86/0xd0 ahci_handle_port_interrupt+0xc9/0x5c0 ahci_handle_port_intr+0x54/0xb0 ahci_single_level_irq_intr+0x3b/0x60 __handle_irq_event_percpu+0x43/0x190 handle_irq_event_percpu+0x20/0x50 handle_irq_event+0x2a/0x50 handle_edge_irq+0x80/0x1c0 handle_irq+0xaf/0x120 do_IRQ+0x41/0xc0 common_interrupt+0xf/0xf
Fix it by updating delayacct_blkio_end() check @p->delays instead.
--- include/linux/delayacct.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/delayacct.h +1 -1
@@ -124,7 +124,7 @@ static inline void delayacct_blkio_startstatic inline void delayacct_blkio_end (struct task_struct *p) { -if (current->delays) +if (p->delays)__delayacct_blkio_end (p);delayacct_clear_flag (DELAYACCT_PF_BLKIO ); }
Greg Kroah-Hartman
maintainerPATCH 15/246 kthread, tracing: Dont expose half-written comm when creating kthreads
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Snild Dolkow <[email protected]>
commit 3e536e222f2930534c252c1cc7ae799c725c5ff9 upstream.
There is a window for racing when printing directly to task->comm, allowing other threads to see a non-terminated string. The vsnprintf function fills the buffer, counts the truncated chars, then finally writes the \0 at the end.
creator other
vsnprintf:
fill (not terminated)
count the rest trace_sched_waking(p):
... memcpy(comm, p->comm, TASK_COMM_LEN)
write \0
The consequences depend on how 'other' uses the string. In our case, it was copied into the tracing system's saved cmdlines, a buffer of adjacent TASK_COMM_LEN-byte buffers (note the 'n' where 0 should be):
crash-arm64> x/1024s savedcmd->saved_cmdlines | grep 'evenk' 0xffffffd5b3818640: "irq/497-pwr_evenkworker/u16:12"
...and a strcpy out of there would cause stack corruption:
[224761.522292] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ffffff9bf9783c78
crash-arm64> kbt | grep 'comm\|trace_print_context' #6 0xffffff9bf9783c78 in trace_print_context+0x18c(+396) comm (char [16]) = "irq/497-pwr_even" crash-arm64> rd 0xffffffd4d0e17d14 8 ffffffd4d0e17d14: 2f71726900000000 5f7277702d373934 ....irq/497-pwr_ ffffffd4d0e17d24: 726f776b6e657665 3a3631752f72656b evenkworker/u16: ffffffd4d0e17d34: f9780248ff003231 cede60e0ffffff9b 12..H.x......`.. ffffffd4d0e17d44: cede60c8ffffffd4 00000fffffffffd4 .....`..........
The workaround in e09e28671 (use strlcpy in __trace_find_cmdline) was likely needed because of this same bug.
Solved by vsnprintf:ing to a local buffer, then using set_task_comm(). This way, there won't be a window where comm is not terminated.
--- kernel/kthread.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
kernel/kthread.c +7 -1
@@ -311,8 +311,14 @@ struct task_struct *__kthread_create_on_ task = create->result;if (!IS_ERR (task)) {static const struct sched_param param = { .sched_priority =0 }; +char name[TASK_COMM_LEN ]; -vsnprintf (task->comm,sizeof (task->comm), namefmt, args); +/* +* task is already visible to other tasks, so updating +* COMM must be protected. +*/ +vsnprintf (name,sizeof (name), namefmt, args); +set_task_comm (task, name);/* * root may have changed our (kthreadd's) priority or CPU mask. * The kernel thread should not inherit these properties.
Greg Kroah-Hartman
maintainerPATCH 16/246 tracing/kprobes: Fix trace_probe flags on enable_trace_kprobe() failure
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artem Savkov <[email protected]>
commit 57ea2a34adf40f3a6e88409aafcf803b8945619a upstream.
If enable_trace_kprobe fails to enable the probe in enable_k(ret)probe it returns an error, but does not unset the tp flags it set previously. This results in a probe being considered enabled and failures like being unable to remove the probe through kprobe_events file since probes_open() expects every probe to be disabled.
--- kernel/trace/trace_kprobe.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
kernel/trace/trace_kprobe.c +11 -2
@@ -376,11 +376,10 @@ static struct trace_kprobe *find_trace_kstatic int enable_trace_kprobe (struct trace_kprobe *tk,struct trace_event_file *file) { +struct event_file_link *link;int ret =0 ;if (file) { -struct event_file_link *link; - link =kmalloc (sizeof (*link),GFP_KERNEL );if (!link) { ret = -ENOMEM ;
@@ -400,6 +399,16 @@ enable_trace_kprobe(struct trace_kprobeelse ret =enable_kprobe (&tk->rp.kp); } + +if (ret) { +if (file) { +list_del_rcu (&link->list); +kfree (link); + tk->tp.flags &= ~TP_FLAG_TRACE ; + }else { + tk->tp.flags &= ~TP_FLAG_PROFILE ; + } + } out:return ret; }
Greg Kroah-Hartman
maintainerPATCH 17/246 tracing: Quiet gcc warning about maybe unused link variable
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt (VMware) <[email protected]>
commit 2519c1bbe38d7acacc9aacba303ca6f97482ed53 upstream.
Commit 57ea2a34adf4 ("tracing/kprobes: Fix trace_probe flags on enable_trace_kprobe() failure") added an if statement that depends on another if statement that gcc doesn't see will initialize the "link" variable and gives the warning:
"warning: 'link' may be used uninitialized in this function"
It is really a false positive, but to quiet the warning, and also to make sure that it never actually is used uninitialized, initialize the "link" variable to NULL and add an if (!WARN_ON_ONCE(!link)) where the compiler thinks it could be used uninitialized.
--- kernel/trace/trace_kprobe.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/trace/trace_kprobe.c +4 -2
@@ -376,7 +376,7 @@ static struct trace_kprobe *find_trace_kstatic int enable_trace_kprobe (struct trace_kprobe *tk,struct trace_event_file *file) { -struct event_file_link *link; +struct event_file_link *link =NULL ;int ret =0 ;if (file) {
@@ -402,7 +402,9 @@ enable_trace_kprobe(struct trace_kprobeif (ret) {if (file) { -list_del_rcu (&link->list); +/* Notice the if is true on not WARN() */ +if (!WARN_ON_ONCE (!link)) +list_del_rcu (&link->list);kfree (link); tk->tp.flags &= ~TP_FLAG_TRACE ; }else {
Greg Kroah-Hartman
maintainerPATCH 18/246 arm64: fix vmemmap BUILD_BUG_ON() triggering on !vmemmap setups
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Weiner <[email protected]>
commit 7b0eb6b41a08fa1fa0d04b1c53becd62b5fbfaee upstream.
Arnd reports the following arm64 randconfig build error with the PSI patches that add another page flag:
/git/arm-soc/arch/arm64/mm/init.c: In function 'mem_init':
/git/arm-soc/include/linux/compiler.h:357:38: error: call to '__compiletime_assert_618' declared with attribute error: BUILD_BUG_ON
failed: sizeof(struct page) > (1 << STRUCT_PAGE_MAX_SHIFT)
The additional page flag causes other information stored in page->flags to get bumped into their own struct page member:
#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT+LAST_CPUPID_SHIFT <= BITS_PER_LONG - NR_PAGEFLAGS #define LAST_CPUPID_WIDTH LAST_CPUPID_SHIFT #else #define LAST_CPUPID_WIDTH 0 #endif #if defined(CONFIG_NUMA_BALANCING) && LAST_CPUPID_WIDTH == 0 #define LAST_CPUPID_NOT_IN_PAGE_FLAGS #endif
which in turn causes the struct page size to exceed the size set in STRUCT_PAGE_MAX_SHIFT. This value is an an estimate used to size the VMEMMAP page array according to address space and struct page size.
However, the check is performed - and triggers here - on a !VMEMMAP config, which consumes an additional 22 page bits for the sparse section id. When VMEMMAP is enabled, those bits are returned, cpupid doesn't need its own member, and the page passes the VMEMMAP check.
Restrict that check to the situation it was meant to check: that we are sizing the VMEMMAP page array correctly.
Says Arnd:
Further experiments show that the build error already existed before, but was only triggered with larger values of CONFIG_NR_CPU and/or CONFIG_NODES_SHIFT that might be used in actual configurations but not in randconfig builds.
With longer CPU and node masks, I could recreate the problem with kernels as old as linux-4.7 when arm64 NUMA support got added.
--- arch/arm64/mm/init.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm64/mm/init.c +3 -1
@@ -651,11 +651,13 @@ void __init mem_init(void)BUILD_BUG_ON (TASK_SIZE_32 >TASK_SIZE_64 );#endif +#ifdef CONFIG_SPARSEMEM_VMEMMAP /* * Make sure we chose the upper bound of sizeof(struct page) -* correctly. +* correctly when sizing the VMEMMAP array. */ BUILD_BUG_ON (sizeof (struct page ) > (1 <<STRUCT_PAGE_MAX_SHIFT )); +#endif if (PAGE_SIZE >=16384 &&get_num_physpages () <=128 ) {extern int sysctl_overcommit_memory;
Greg Kroah-Hartman
maintainerPATCH 19/246 mlxsw: spectrum_switchdev: Fix port_vlan refcounting
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Petr Machata <[email protected]>
[ Upstream commit 9e25826ffc942e985b8595b2f1cf2065d3880514 ]
Switchdev notifications for addition of SWITCHDEV_OBJ_ID_PORT_VLAN are distributed not only on clean addition, but also when flags on an existing VLAN are changed. mlxsw_sp_bridge_port_vlan_add() calls mlxsw_sp_port_vlan_get() to get at the port_vlan in question, which implicitly references the object. This then leads to discrepancies in reference counting when the VLAN is removed. spectrum.c warns about the problem when the module is removed:
[13578.493090] WARNING: CPU: 0 PID: 2454 at drivers/net/ethernet/mellanox/mlxsw/spectrum.c:2973 mlxsw_sp_port_remove+0xfd/0x110 [mlxsw_spectrum] [...] [13578.627106] Call Trace: [13578.629617] mlxsw_sp_fini+0x2a/0xe0 [mlxsw_spectrum] [13578.634748] mlxsw_core_bus_device_unregister+0x3e/0x130 [mlxsw_core] [13578.641290] mlxsw_pci_remove+0x13/0x40 [mlxsw_pci] [13578.646238] pci_device_remove+0x31/0xb0 [13578.650244] device_release_driver_internal+0x14f/0x220 [13578.655562] driver_detach+0x32/0x70 [13578.659183] bus_remove_driver+0x47/0xa0 [13578.663134] pci_unregister_driver+0x1e/0x80 [13578.667486] mlxsw_sp_module_exit+0xc/0x3fa [mlxsw_spectrum] [13578.673207] __x64_sys_delete_module+0x13b/0x1e0 [13578.677888] ? exit_to_usermode_loop+0x78/0x80 [13578.682374] do_syscall_64+0x39/0xe0 [13578.685976] entry_SYSCALL_64_after_hwframe+0x44/0xa9
Fix by putting the port_vlan when mlxsw_sp_port_vlan_bridge_join() determines it's a flag-only change.
--- drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +3 -1
@@ -912,8 +912,10 @@ mlxsw_sp_port_vlan_bridge_join(struct mlint err;/* No need to continue if only VLAN flags were changed */ -if (mlxsw_sp_port_vlan->bridge_port) +if (mlxsw_sp_port_vlan->bridge_port) { +mlxsw_sp_port_vlan_put (mlxsw_sp_port_vlan);return 0 ; + } err =mlxsw_sp_port_vlan_fid_join (mlxsw_sp_port_vlan, bridge_port);if (err)
Greg Kroah-Hartman
maintainerPATCH 21/246 xen/netfront: raise max number of slots in xennet_get_responses()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
[ Upstream commit 57f230ab04d2910a06d17d988f1c4d7586a59113 ]
The max number of slots used in xennet_get_responses() is set to MAX_SKB_FRAGS + (rx->status <= RX_COPY_THRESHOLD).
In old kernel-xen MAX_SKB_FRAGS was 18, while nowadays it is 17. This difference is resulting in frequent messages "too many slots" and a reduced network throughput for some workloads (factor 10 below that of a kernel-xen based guest).
Replacing MAX_SKB_FRAGS by XEN_NETIF_NR_SLOTS_MIN for calculation of the max number of slots to use solves that problem (tests showed no more messages "too many slots" and throughput was as high as with the kernel-xen based guest system).
Replace MAX_SKB_FRAGS-2 by XEN_NETIF_NR_SLOTS_MIN-1 in netfront_tx_slot_available() for making it clearer what is really being tested without actually modifying the tested value.
--- drivers/net/xen-netfront.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/xen-netfront.c +2 -2
@@ -239,7 +239,7 @@ static void rx_refill_timeout(unsigned lstatic int netfront_tx_slot_available (struct netfront_queue *queue) {return (queue->tx.req_prod_pvt - queue->tx.rsp_cons) < - (NET_TX_RING_SIZE -MAX_SKB_FRAGS -2 ); + (NET_TX_RING_SIZE -XEN_NETIF_NR_SLOTS_MIN -1 ); }static void xennet_maybe_wake_tx (struct netfront_queue *queue)
@@ -790,7 +790,7 @@ static int xennet_get_responses(struct nRING_IDX cons = queue->rx.rsp_cons;struct sk_buff *skb =xennet_get_rx_skb (queue, cons);grant_ref_t ref =xennet_get_rx_ref (queue, cons); -int max =MAX_SKB_FRAGS + (rx->status <=RX_COPY_THRESHOLD ); +int max =XEN_NETIF_NR_SLOTS_MIN + (rx->status <=RX_COPY_THRESHOLD );int slots =1 ;int err =0 ;unsigned long ret;
Greg Kroah-Hartman
maintainerPATCH 22/246 hv_netvsc: fix network namespace issues with VF support
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Hemminger <[email protected]>
[ Upstream commit 7bf7bb37f16a80465ee3bd7c6c966f96f5a075a6 ]
When finding the parent netvsc device, the search needs to be across all netvsc device instances (independent of network namespace).
Find parent device of VF using upper_dev_get routine which searches only adjacent list.
netns aware byref
--- drivers/net/hyperv/hyperv_net.h | 2 + drivers/net/hyperv/netvsc_drv.c | 45 ++++++++++++++++++---------------------- 2 files changed, 23 insertions(+), 24 deletions(-)
drivers/net/hyperv/hyperv_net.h +2 -0
@@ -724,6 +724,8 @@ struct net_device_context {struct hv_device *device_ctx;/* netvsc_device */ struct netvsc_device __rcu *nvdev; +/* list of netvsc net_devices */ +struct list_head list;/* reconfigure work */ struct delayed_work dwork;/* last reconfig time */
drivers/net/hyperv/netvsc_drv.c +21 -24
86 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 23/246 skip LAYOUTRETURN if layout is invalid
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olga Kornievskaia <[email protected]>
[ Upstream commit 93b7f7ad2018d2037559b1d0892417864c78b371 ]
Currently, when IO to DS fails, client returns the layout and retries against the MDS. However, then on umounting (inode eviction) it returns the layout again.
This is because pnfs_return_layout() was changed in
commit d78471d32bb6 ("pnfs/blocklayout: set PNFS_LAYOUTRETURN_ON_ERROR") to always set NFS_LAYOUT_RETURN_REQUESTED so even if we returned the layout, it will be returned again. Instead, let's also check if we have already marked the layout invalid.
--- fs/nfs/pnfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/nfs/pnfs.c +4 -2
@@ -1126,7 +1126,7 @@ _pnfs_return_layout(struct inode *ino)LIST_HEAD (tmp_list);nfs4_stateid stateid;int status =0 ; -bool send; +bool send, valid_layout;dprintk ("NFS: %s for inode %lu\n" , __func__, ino->i_ino);
@@ -1147,6 +1147,7 @@ _pnfs_return_layout(struct inode *ino) goto out_put_layout_hdr;spin_lock (&ino->i_lock); } + valid_layout =pnfs_layout_is_valid (lo);pnfs_clear_layoutcommit (ino, &tmp_list);pnfs_mark_matching_lsegs_invalid (lo, &tmp_list,NULL ,0 );
@@ -1160,7 +1161,8 @@ _pnfs_return_layout(struct inode *ino) }/* Don't send a LAYOUTRETURN if list was initially empty */ -if (!test_bit (NFS_LAYOUT_RETURN_REQUESTED , &lo->plh_flags)) { +if (!test_bit (NFS_LAYOUT_RETURN_REQUESTED , &lo->plh_flags) || + !valid_layout) {spin_unlock (&ino->i_lock);dprintk ("NFS: %s no layout segments to return\n" , __func__); goto out_put_layout_hdr;
Greg Kroah-Hartman
maintainerPATCH 24/246 ALSA: emu10k1: add error handling for snd_ctl_add
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhouyang Jia <[email protected]>
[ Upstream commit 6d531e7b972cb62ded011c2dfcc2d9f72ea6c421 ]
When snd_ctl_add fails, the lack of error-handling code may cause unexpected results.
This patch adds error-handling code after calling snd_ctl_add.
--- sound/pci/emu10k1/emupcm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/pci/emu10k1/emupcm.c +3 -1
@@ -1850,7 +1850,9 @@ int snd_emu10k1_pcm_efx(struct snd_emu10if (!kctl)return -ENOMEM ; kctl->id.device = device; -snd_ctl_add (emu->card, kctl); + err =snd_ctl_add (emu->card, kctl); +if (err <0 ) +return err;snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV ,snd_dma_pci_data (emu->pci),64 *1024 ,64 *1024 );
Greg Kroah-Hartman
maintainerPATCH 25/246 ALSA: fm801: add error handling for snd_ctl_add
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhouyang Jia <[email protected]>
[ Upstream commit ef1ffbe7889e99f5b5cccb41c89e5c94f50f3218 ]
When snd_ctl_add fails, the lack of error-handling code may cause unexpected results.
This patch adds error-handling code after calling snd_ctl_add.
--- sound/pci/fm801.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
sound/pci/fm801.c +12 -4
@@ -1068,11 +1068,19 @@ static int snd_fm801_mixer(struct fm801if ((err =snd_ac97_mixer (chip->ac97_bus, &ac97, &chip->ac97_sec)) <0 )return err; } -for (i =0 ; i <FM801_CONTROLS ; i++) -snd_ctl_add (chip->card,snd_ctl_new1 (&snd_fm801_controls[i], chip)); +for (i =0 ; i <FM801_CONTROLS ; i++) { + err =snd_ctl_add (chip->card, +snd_ctl_new1 (&snd_fm801_controls[i], chip)); +if (err <0 ) +return err; + }if (chip->multichannel) { -for (i =0 ; i <FM801_CONTROLS_MULTI ; i++) -snd_ctl_add (chip->card,snd_ctl_new1 (&snd_fm801_controls_multi[i], chip)); +for (i =0 ; i <FM801_CONTROLS_MULTI ; i++) { + err =snd_ctl_add (chip->card, +snd_ctl_new1 (&snd_fm801_controls_multi[i], chip)); +if (err <0 ) +return err; + } }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 30/246 vfio/type1: Fix task tracking for QEMU vCPU hotplug
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Williamson <[email protected]>
[ Upstream commit 48d8476b41eed63567dd2f0ad125c895b9ac648a ]
MAP_DMA ioctls might be called from various threads within a process, for example when using QEMU, the vCPU threads are often generating these calls and we therefore take a reference to that vCPU task. However, QEMU also supports vCPU hotplug on some machines and the task that called MAP_DMA may have exited by the time UNMAP_DMA is called, resulting in the mm_struct pointer being NULL and thus a failure to match against the existing mapping.
To resolve this, we instead take a reference to the thread group_leader, which has the same mm_struct and resource limits, but is less likely exit, at least in the QEMU case. A difficulty here is guaranteeing that the capabilities of the group_leader match that of the calling thread, which we resolve by tracking CAP_IPC_LOCK at the time of calling rather than at an indeterminate time in the future. Potentially this also results in better efficiency as this is now recorded once per MAP_DMA ioctl.
--- drivers/vfio/vfio_iommu_type1.c | 73 +++++++++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 26 deletions(-)
drivers/vfio/vfio_iommu_type1.c +47 -26
@@ -83,6 +83,7 @@ struct vfio_dma {size_t size;/* Map size (bytes) */ int prot;/* IOMMU_READ/WRITE */ bool iommu_mapped; +bool lock_cap;/* capable(CAP_IPC_LOCK) */ struct task_struct *task;struct rb_root pfn_list;/* Ex-user pinned pfn list */ };
@@ -246,29 +247,25 @@ static int vfio_iova_put_vfio_pfn(structreturn ret; } -static int vfio_lock_acct (struct task_struct *task,long npage,bool *lock_cap) +static int vfio_lock_acct (struct vfio_dma *dma,long npage,bool async) {struct mm_struct *mm; -bool is_current;int ret;if (!npage)return 0 ; - is_current = (task->mm == current->mm); - - mm = is_current ? task->mm :get_task_mm (task); + mm = async ?get_task_mm (dma->task) : dma->task->mm;if (!mm)return -ESRCH ;/* process exited */ ret =down_write_killable (&mm->mmap_sem);if (!ret) {if (npage >0 ) { -if (lock_cap ? !*lock_cap : - !has_capability (task,CAP_IPC_LOCK )) { +if (!dma->lock_cap) {unsigned long limit; - limit =task_rlimit (task, + limit =task_rlimit (dma->task,RLIMIT_MEMLOCK ) >>PAGE_SHIFT ;if (mm->locked_vm + npage > limit)
@@ -282,7 +279,7 @@ static int vfio_lock_acct(struct task_stup_write (&mm->mmap_sem); } -if (!is_current) +if (async)mmput (mm);return ret;
@@ -391,7 +388,7 @@ static int vaddr_get_pfn(struct mm_struc*/ static long vfio_pin_pages_remote (struct vfio_dma *dma,unsigned long vaddr,long npage,unsigned long *pfn_base, -bool lock_cap,unsigned long limit) +unsigned long limit) {unsigned long pfn =0 ;long ret, pinned =0 , lock_acct =0 ;
@@ -414,7 +411,7 @@ static long vfio_pin_pages_remote(struct* pages are already counted against the user. */ if (!rsvd && !vfio_find_vpfn (dma, iova)) { -if (!lock_cap && current->mm->locked_vm +1 > limit) { +if (!dma->lock_cap && current->mm->locked_vm +1 > limit) {put_pfn (*pfn_base, dma->prot);pr_warn ("%s: RLIMIT_MEMLOCK (%ld) exceeded\n" , __func__, limit <<PAGE_SHIFT );
@@ -440,7 +437,7 @@ static long vfio_pin_pages_remote(struct }if (!rsvd && !vfio_find_vpfn (dma, iova)) { -if (!lock_cap && +if (!dma->lock_cap && current->mm->locked_vm + lock_acct +1 > limit) {put_pfn (pfn, dma->prot); pr_warn("%s: RLIMIT_MEMLOCK (%ld) exceeded\n",
@@ -453,7 +450,7 @@ static long vfio_pin_pages_remote(struct } out: - ret =vfio_lock_acct (current, lock_acct, &lock_cap); + ret =vfio_lock_acct (dma, lock_acct, false); unpin_out:if (ret) {
@@ -484,7 +481,7 @@ static long vfio_unpin_pages_remote(stru }if (do_accounting) -vfio_lock_acct (dma->task, locked - unlocked,NULL ); +vfio_lock_acct (dma, locked - unlocked, true);return unlocked; }
@@ -501,7 +498,7 @@ static int vfio_pin_page_external(struct ret =vaddr_get_pfn (mm, vaddr, dma->prot, pfn_base);if (!ret && do_accounting && !is_invalid_reserved_pfn (*pfn_base)) { - ret =vfio_lock_acct (dma->task,1 ,NULL ); + ret =vfio_lock_acct (dma,1 , true);if (ret) {put_pfn (*pfn_base, dma->prot);if (ret == -ENOMEM )
@@ -528,7 +525,7 @@ static int vfio_unpin_page_external(stru unlocked =vfio_iova_put_vfio_pfn (dma, vpfn);if (do_accounting) -vfio_lock_acct (dma->task, -unlocked,NULL ); +vfio_lock_acct (dma, -unlocked, true);return unlocked; }
@@ -723,7 +720,7 @@ static long vfio_unmap_unpin(struct vfio dma->iommu_mapped = false;if (do_accounting) { -vfio_lock_acct (dma->task, -unlocked,NULL ); +vfio_lock_acct (dma, -unlocked, true);return 0 ; }return unlocked;
@@ -935,14 +932,12 @@ static int vfio_pin_map_dma(struct vfio_size_t size = map_size;long npage;unsigned long pfn, limit =rlimit (RLIMIT_MEMLOCK ) >>PAGE_SHIFT ; -bool lock_cap =capable (CAP_IPC_LOCK );int ret =0 ;while (size) {/* Pin a contiguous chunk of memory */ npage =vfio_pin_pages_remote (dma, vaddr + dma->size, - size >>PAGE_SHIFT , &pfn, - lock_cap, limit); + size >>PAGE_SHIFT , &pfn, limit);if (npage <=0 ) {WARN_ON (!npage); ret = (int )npage;
@@ -1017,8 +1012,36 @@ static int vfio_dma_do_map(struct vfio_i dma->iova = iova; dma->vaddr = vaddr; dma->prot = prot; -get_task_struct (current); - dma->task = current; + +/* +* We need to be able to both add to a task's locked memory and test +* against the locked memory limit and we need to be able to do both +* outside of this call path as pinning can be asynchronous via the +* external interfaces for mdev devices. RLIMIT_MEMLOCK requires a +* task_struct and VM locked pages requires an mm_struct, however +* holding an indefinite mm reference is not recommended, therefore we +* only hold a reference to a task. We could hold a reference to +* current, however QEMU uses this call path through vCPU threads, +* which can be killed resulting in a NULL mm and failure in the unmap +* path when called via a different thread. Avoid this problem by +* using the group_leader as threads within the same group require +* both CLONE_THREAD and CLONE_VM and will therefore use the same +* mm_struct. +* +* Previously we also used the task for testing CAP_IPC_LOCK at the +* time of pinning and accounting, however has_capability() makes use +* of real_cred, a copy-on-write field, so we can't guarantee that it +* matches group_leader, or in fact that it might not change by the +* time it's evaluated. If a process were to call MAP_DMA with +* CAP_IPC_LOCK but later drop it, it doesn't make sense that they +* possibly see different results for an iommu_mapped vfio_dma vs +* externally mapped. Therefore track CAP_IPC_LOCK in vfio_dma at the +* time of calling MAP_DMA. +*/ +get_task_struct (current->group_leader); + dma->task = current->group_leader; + dma->lock_cap =capable (CAP_IPC_LOCK ); + dma->pfn_list =RB_ROOT ;/* Insert zero-sized and grow as we map chunks of it */
@@ -1053,7 +1076,6 @@ static int vfio_iommu_replay(struct vfiostruct vfio_domain *d;struct rb_node *n;unsigned long limit =rlimit (RLIMIT_MEMLOCK ) >>PAGE_SHIFT ; -bool lock_cap =capable (CAP_IPC_LOCK );int ret;/* Arbitrarily pick the first domain in the list for lookups */
@@ -1100,8 +1122,7 @@ static int vfio_iommu_replay(struct vfio npage =vfio_pin_pages_remote (dma, vaddr, n >>PAGE_SHIFT , - &pfn, lock_cap, - limit); + &pfn, limit);if (npage <=0 ) {WARN_ON (!npage); ret = (int )npage;
@@ -1378,7 +1399,7 @@ static void vfio_iommu_unmap_unpin_reaccif (!is_invalid_reserved_pfn (vpfn->pfn)) locked++; } -vfio_lock_acct (dma->task, locked - unlocked,NULL ); +vfio_lock_acct (dma, locked - unlocked, true); } }
Greg Kroah-Hartman
maintainerPATCH 31/246 kernel/hung_task.c: show all hung tasks before panic
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
[ Upstream commit 401c636a0eeb0d51862fce222da1bf08e3a0ffd0 ]
When we get a hung task it can often be valuable to see _all_ the hung tasks on the system before calling panic().
Quoting from https://syzkaller.appspot.com/text?tag=CrashReport&id=5316056503549952
----------------------------------------
INFO: task syz-executor0:6540 blocked for more than 120 seconds.
Not tainted 4.16.0+ #13
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
syz-executor0 D23560 6540 4521 0x80000004
Call Trace:
context_switch kernel/sched/core.c:2848 [inline]
__schedule+0x8fb/0x1ef0 kernel/sched/core.c:3490
schedule+0xf5/0x430 kernel/sched/core.c:3549
schedule_preempt_disabled+0x10/0x20 kernel/sched/core.c:3607
__mutex_lock_common kernel/locking/mutex.c:833 [inline]
__mutex_lock+0xb7f/0x1810 kernel/locking/mutex.c:893
mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908
lo_ioctl+0x8b/0x1b70 drivers/block/loop.c:1355
__blkdev_driver_ioctl block/ioctl.c:303 [inline]
blkdev_ioctl+0x1759/0x1e00 block/ioctl.c:601
ioctl_by_bdev+0xa5/0x110 fs/block_dev.c:2060
isofs_get_last_session fs/isofs/inode.c:567 [inline]
isofs_fill_super+0x2ba9/0x3bc0 fs/isofs/inode.c:660
mount_bdev+0x2b7/0x370 fs/super.c:1119
isofs_mount+0x34/0x40 fs/isofs/inode.c:1560
mount_fs+0x66/0x2d0 fs/super.c:1222
vfs_kern_mount.part.26+0xc6/0x4a0 fs/namespace.c:1037
vfs_kern_mount fs/namespace.c:2514 [inline]
do_new_mount fs/namespace.c:2517 [inline]
do_mount+0xea4/0x2b90 fs/namespace.c:2847
ksys_mount+0xab/0x120 fs/namespace.c:3063
SYSC_mount fs/namespace.c:3077 [inline]
SyS_mount+0x39/0x50 fs/namespace.c:3074
do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287
entry_SYSCALL_64_after_hwframe+0x42/0xb7
(...snipped...)
Showing all locks held in the system:(...snipped...)
2 locks held by syz-executor0/6540:
#0: 00000000566d4c39 (&type->s_umount_key#49/1){+.+.}, at: alloc_super fs/super.c:211 [inline]
#0: 00000000566d4c39 (&type->s_umount_key#49/1){+.+.}, at: sget_userns+0x3b2/0xe60 fs/super.c:502 /* down_write_nested(&s->s_umount, SINGLE_DEPTH_NESTING); */ #1: 0000000043ca8836 (&lo->lo_ctl_mutex/1){+.+.}, at: lo_ioctl+0x8b/0x1b70 drivers/block/loop.c:1355 /* mutex_lock_nested(&lo->lo_ctl_mutex, 1); */
(...snipped...)
3 locks held by syz-executor7/6541:
#0: 0000000043ca8836 (&lo->lo_ctl_mutex/1){+.+.}, at: lo_ioctl+0x8b/0x1b70 drivers/block/loop.c:1355 /* mutex_lock_nested(&lo->lo_ctl_mutex, 1); */ #1: 000000007bf3d3f9 (&bdev->bd_mutex){+.+.}, at: blkdev_reread_part+0x1e/0x40 block/ioctl.c:192
#2: 00000000566d4c39 (&type->s_umount_key#50){.+.+}, at: __get_super.part.10+0x1d3/0x280 fs/super.c:663 /* down_read(&sb->s_umount); */
----------------------------------------
When reporting an AB-BA deadlock like shown above, it would be nice if trace of PID=6541 is printed as well as trace of PID=6540 before calling panic().
Showing hung tasks up to /proc/sys/kernel/hung_task_warnings could delay calling panic() but normally there should not be so many hung tasks.
--- kernel/hung_task.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
kernel/hung_task.c +7 -4
@@ -44,6 +44,7 @@ int __read_mostly sysctl_hung_task_warnistatic int __read_mostly did_panic;static bool hung_task_show_lock; +static bool hung_task_call_panic;static struct task_struct *watchdog_task;
@@ -127,10 +128,8 @@ static void check_hung_task(struct task_touch_nmi_watchdog ();if (sysctl_hung_task_panic) { -if (hung_task_show_lock) -debug_show_all_locks (); -trigger_all_cpu_backtrace (); -panic ("hung_task: blocked tasks" ); + hung_task_show_lock = true; + hung_task_call_panic = true; } }
@@ -193,6 +192,10 @@ static void check_hung_uninterruptible_trcu_read_unlock ();if (hung_task_show_lock)debug_show_all_locks (); +if (hung_task_call_panic) { +trigger_all_cpu_backtrace (); +panic ("hung_task: blocked tasks" ); + } } static long hung_timeout_jiffies(unsigned long last_checked,
Greg Kroah-Hartman
maintainerPATCH 32/246 mm: /proc/pid/pagemap: hide swap entries from unprivileged users
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huang Ying <[email protected]>
[ Upstream commit ab6ecf247a9321e3180e021a6a60164dee53ab2e ]
In commit ab676b7d6fbf ("pagemap: do not leak physical addresses to non-privileged userspace"), the /proc/PID/pagemap is restricted to be readable only by CAP_SYS_ADMIN to address some security issue.
In commit 1c90308e7a77 ("pagemap: hide physical addresses from non-privileged users"), the restriction is relieved to make /proc/PID/pagemap readable, but hide the physical addresses for non-privileged users.
But the swap entries are readable for non-privileged users too. This has some security issues. For example, for page under migrating, the swap entry has physical address information. So, in this patch, the swap entries are hided for non-privileged users too.
--- fs/proc/task_mmu.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
fs/proc/task_mmu.c +16 -10
@@ -1275,8 +1275,9 @@ static pagemap_entry_t pte_to_pagemap_enif (pte_swp_soft_dirty (pte)) flags |=PM_SOFT_DIRTY ; entry =pte_to_swp_entry (pte); - frame =swp_type (entry) | - (swp_offset (entry) <<MAX_SWAPFILES_SHIFT ); +if (pm->show_pfn) + frame =swp_type (entry) | + (swp_offset (entry) <<MAX_SWAPFILES_SHIFT ); flags |=PM_SWAP ;if (is_migration_entry (entry)) page =migration_entry_to_page (entry);
@@ -1327,11 +1328,14 @@ static int pagemap_pmd_range(pmd_t *pmdp#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION else if (is_swap_pmd(pmd)) {swp_entry_t entry =pmd_to_swp_entry (pmd); -unsigned long offset =swp_offset (entry); +unsigned long offset; - offset += (addr & ~PMD_MASK ) >>PAGE_SHIFT ; - frame =swp_type (entry) | - (offset <<MAX_SWAPFILES_SHIFT ); +if (pm->show_pfn) { + offset =swp_offset (entry) + + ((addr & ~PMD_MASK ) >>PAGE_SHIFT ); + frame =swp_type (entry) | + (offset <<MAX_SWAPFILES_SHIFT ); + } flags |=PM_SWAP ;if (pmd_swp_soft_dirty (pmd)) flags |=PM_SOFT_DIRTY ;
@@ -1349,10 +1353,12 @@ static int pagemap_pmd_range(pmd_t *pmdp err =add_to_pagemap (addr, &pme, pm);if (err)break ; -if (pm->show_pfn && (flags &PM_PRESENT )) - frame++; -else if (flags &PM_SWAP ) - frame += (1 <<MAX_SWAPFILES_SHIFT ); +if (pm->show_pfn) { +if (flags &PM_PRESENT ) + frame++; +else if (flags &PM_SWAP ) + frame += (1 <<MAX_SWAPFILES_SHIFT ); + } }spin_unlock (ptl);return err;
Greg Kroah-Hartman
maintainerPATCH 34/246 mm/slub.c: add __printf verification to slab_err()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathieu Malaterre <[email protected]>
[ Upstream commit a38965bf941b7c2af50de09c96bc5f03e136caef ]
__printf is useful to verify format and arguments. Remove the following warning (with W=1):
mm/slub.c:721:2: warning: function might be possible candidate for `gnu_printf' format attribute [-Wsuggest-attribute=format]
--- mm/slub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/slub.c +1 -1
@@ -708,7 +708,7 @@ void object_err(struct kmem_cache *s, stprint_trailer (s, page, object); } -static void slab_err (struct kmem_cache *s,struct page *page, +static __printf(3, 4) void slab_err(struct kmem_cache *s, struct page *page,const char *fmt, ...) {va_list args;
Greg Kroah-Hartman
maintainerPATCH 37/246 netfilter: ipset: forbid family for hash:mac sets
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florent Fourcot <[email protected]>
[ Upstream commit cbdebe481a14b42c45aa9f4ceb5ff19b55de2c57 ]
Userspace ipset command forbids family option for hash:mac type:
ipset create test hash:mac family inet4
ipset v6.30: Unknown argument: `family'
However, this check is not done in kernel itself. When someone use external netlink applications (pyroute2 python library for example), one can create hash:mac with invalid family and inconsistant results from userspace (ipset command cannot read set content anymore).
This patch enforce the logic in kernel, and forbids insertion of hash:mac with a family set.
Since IP_SET_PROTO_UNDEF is defined only for hash:mac, this patch has no impact on other hash:* sets
--- net/netfilter/ipset/ip_set_hash_gen.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/netfilter/ipset/ip_set_hash_gen.h +4 -1
@@ -1241,7 +1241,10 @@ IPSET_TOKEN(HTYPE, _create)(struct net *pr_debug ("Create set %s with family %s\n" , set->name, set->family ==NFPROTO_IPV4 ?"inet" :"inet6" ); -#ifndef IP_SET_PROTO_UNDEF +#ifdef IP_SET_PROTO_UNDEF +if (set->family !=NFPROTO_UNSPEC ) +return -IPSET_ERR_INVALID_FAMILY ; +#else if (!(set->family ==NFPROTO_IPV4 || set->family ==NFPROTO_IPV6 ))return -IPSET_ERR_INVALID_FAMILY ;#endif
Greg Kroah-Hartman
maintainerPATCH 38/246 netfilter: ipset: List timing out entries with "timeout 1" instead of zero
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jozsef Kadlecsik <[email protected]>
[ Upstream commit bd975e691486ba52790ba23cc9b4fecab7bc0d31 ]
When listing sets with timeout support, there's a probability that just timing out entries with "0" timeout value is listed/saved. However when restoring the saved list, the zero timeout value means permanent elelements.
The new behaviour is that timing out entries are listed with "timeout 1" instead of zero.
Fixes netfilter bugzilla #1258.
--- include/linux/netfilter/ipset/ip_set_timeout.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
include/linux/netfilter/ipset/ip_set_timeout.h +8 -2
@@ -65,8 +65,14 @@ ip_set_timeout_set(unsigned long *timeoustatic inline u32 ip_set_timeout_get (const unsigned long *timeout) { -return *timeout ==IPSET_ELEM_PERMANENT ?0 : -jiffies_to_msecs (*timeout - jiffies)/MSEC_PER_SEC ; +u32 t; + +if (*timeout ==IPSET_ELEM_PERMANENT ) +return 0 ; + + t =jiffies_to_msecs (*timeout - jiffies)/MSEC_PER_SEC ; +/* Zero value in userspace means no timeout */ +return t ==0 ?1 : t; }#endif /* __KERNEL__ */
Greg Kroah-Hartman
maintainerPATCH 41/246 printk: drop in_nmi check from printk_safe_flush_on_panic()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Senozhatsky <[email protected]>
[ Upstream commit 554755be08fba31c74f66b82a485e5513205af84 ]
Drop the in_nmi() check from printk_safe_flush_on_panic() and attempt to re-init (IOW unlock) locked logbuf spinlock from panic CPU regardless of its context.
Otherwise, theoretically, we can deadlock on logbuf trying to flush per-CPU buffers:
a) Panic CPU is running in non-NMI context
b) Panic CPU sends out shutdown IPI via reboot vector
c) Panic CPU fails to stop all remote CPUs
d) Panic CPU sends out shutdown IPI via NMI vector One of the CPUs that we bring down via NMI vector can hold logbuf spin lock (theoretically).
To: Steven Rostedt <[email protected]>
--- kernel/printk/printk_safe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/printk/printk_safe.c +1 -1
@@ -284,7 +284,7 @@ void printk_safe_flush_on_panic(void)* Make sure that we could access the main ring buffer. * Do not risk a double release when more CPUs are up. */ -if (in_nmi () &&raw_spin_is_locked (&logbuf_lock)) { +if (raw_spin_is_locked (&logbuf_lock)) {if (num_online_cpus () >1 )return ;
Greg Kroah-Hartman
maintainerPATCH 42/246 bpf, arm32: fix inconsistent naming about emit_a32_lsr_{r64,i64}
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang YanQing <[email protected]>
[ Upstream commit 68565a1af9f7012e6f2fe2bdd612f67d2d830c28 ]
The names for BPF_ALU64 | BPF_ARSH are emit_a32_arsh_*, the names for BPF_ALU64 | BPF_LSH are emit_a32_lsh_*, but the names for BPF_ALU64 | BPF_RSH are emit_a32_lsr_*.
For consistence reason, let's rename emit_a32_lsr_* to emit_a32_rsh_*.
This patch also corrects a wrong comment.
--- arch/arm/net/bpf_jit_32.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm/net/bpf_jit_32.c +5 -5
@@ -718,7 +718,7 @@ static inline void emit_a32_arsh_r64(con }/* dst = dst >> src */ -static inline void emit_a32_lsr_r64 (const u8 dst[],const u8 src[],bool dstk, +static inline void emit_a32_rsh_r64 (const u8 dst[],const u8 src[],bool dstk,bool sstk,struct jit_ctx *ctx) {const u8 *tmp = bpf2a32[TMP_REG_1 ];const u8 *tmp2 = bpf2a32[TMP_REG_2 ];
@@ -734,7 +734,7 @@ static inline void emit_a32_lsr_r64(consemit (ARM_LDR_I (rm,ARM_SP ,STACK_VAR (dst_hi)), ctx); } -/* Do LSH operation */ +/* Do RSH operation */ emit (ARM_RSB_I (ARM_IP , rt,32 ), ctx);emit (ARM_SUBS_I (tmp2[0 ], rt,32 ), ctx);emit (ARM_MOV_SR (ARM_LR , rd,SRTYPE_LSR , rt), ctx);
@@ -784,7 +784,7 @@ static inline void emit_a32_lsh_i64(cons }/* dst = dst >> val */ -static inline void emit_a32_lsr_i64 (const u8 dst[],bool dstk, +static inline void emit_a32_rsh_i64 (const u8 dst[],bool dstk,const u32 val,struct jit_ctx *ctx) {const u8 *tmp = bpf2a32[TMP_REG_1 ];const u8 *tmp2 = bpf2a32[TMP_REG_2 ];
@@ -1340,7 +1340,7 @@ static int build_insn(const struct bpf_icase BPF_ALU64 |BPF_RSH |BPF_K :if (unlikely (imm >63 ))return -EINVAL ; -emit_a32_lsr_i64 (dst, dstk, imm, ctx); +emit_a32_rsh_i64 (dst, dstk, imm, ctx);break ;/* dst = dst << src */ case BPF_ALU64 |BPF_LSH |BPF_X :
@@ -1348,7 +1348,7 @@ static int build_insn(const struct bpf_ibreak ;/* dst = dst >> src */ case BPF_ALU64 |BPF_RSH |BPF_X : -emit_a32_lsr_r64 (dst, src, dstk, sstk, ctx); +emit_a32_rsh_r64 (dst, src, dstk, sstk, ctx);break ;/* dst = dst >> src (signed) */ case BPF_ALU64 |BPF_ARSH |BPF_X :
Greg Kroah-Hartman
maintainerPATCH 44/246 e1000e: Ignore TSYNCRXCTL when getting I219 clock attributes
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Poirier <[email protected]>
[ Upstream commit fff200caf6f9179dd9a7fc67acd659e614c3f72f ]
There have been multiple reports of crashes that look like
kernel: RIP: 0010:[<ffffffff8110303f>] timecounter_read+0xf/0x50 [...]
kernel: Call Trace: kernel: [<ffffffffa0806b0f>] e1000e_phc_gettime+0x2f/0x60 [e1000e] kernel: [<ffffffffa0806c5d>] e1000e_systim_overflow_work+0x1d/0x80 [e1000e] kernel: [<ffffffff810992c5>] process_one_work+0x155/0x440 kernel: [<ffffffff81099e16>] worker_thread+0x116/0x4b0 kernel: [<ffffffff8109f422>] kthread+0xd2/0xf0 kernel: [<ffffffff8163184f>] ret_from_fork+0x3f/0x70
These can be traced back to the fact that e1000e_systim_reset() skips the timecounter_init() call if e1000e_get_base_timinca() returns -EINVAL, which leads to a null deref in timecounter_read().
Commit 83129b37ef35 ("e1000e: fix systim issues", v4.2-rc1) reworked e1000e_get_base_timinca() in such a way that it can return -EINVAL for e1000_pch_spt if the SYSCFI bit is not set in TSYNCRXCTL.
Some experimentation has shown that on I219 (e1000_pch_spt, "MAC: 12") adapters, the E1000_TSYNCRXCTL_SYSCFI flag is unstable; TSYNCRXCTL reads sometimes don't have the SYSCFI bit set. Retrying the read shortly after finds the bit to be set. This was observed at boot (probe) but also link up and link down.
Moreover, the phc (PTP Hardware Clock) seems to operate normally even after reads where SYSCFI=0. Therefore, remove this register read and unconditionally set the clock parameters.
Message-Id: <20180425065243.g5mqewg5irkwgwgv@f2>
Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1075876
--- drivers/net/ethernet/intel/e1000e/netdev.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/net/ethernet/intel/e1000e/netdev.c +6 -9
@@ -3558,15 +3558,12 @@ s32 e1000e_get_base_timinca(struct e1000 }break ;case e1000_pch_spt: -if (er32 (TSYNCRXCTL ) &E1000_TSYNCRXCTL_SYSCFI ) { -/* Stable 24MHz frequency */ - incperiod =INCPERIOD_24MHZ ; - incvalue =INCVALUE_24MHZ ; - shift =INCVALUE_SHIFT_24MHZ ; - adapter->cc.shift = shift; -break ; - } -return -EINVAL ; +/* Stable 24MHz frequency */ + incperiod =INCPERIOD_24MHZ ; + incvalue =INCVALUE_24MHZ ; + shift =INCVALUE_SHIFT_24MHZ ; + adapter->cc.shift = shift; +break ;case e1000_pch_cnp:if (er32 (TSYNCRXCTL ) &E1000_TSYNCRXCTL_SYSCFI ) {/* Stable 24MHz frequency */
Greg Kroah-Hartman
maintainerPATCH 45/246 infiniband: fix a possible use-after-free bug
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cong Wang <[email protected]>
[ Upstream commit cb2595c1393b4a5211534e6f0a0fbad369e21ad8 ]
ucma_process_join() will free the new allocated "mc" struct, if there is any error after that, especially the copy_to_user().
But in parallel, ucma_leave_multicast() could find this "mc" through idr_find() before ucma_process_join() frees it, since it is already published.
So "mc" could be used in ucma_leave_multicast() after it is been allocated and freed in ucma_process_join(), since we don't refcnt it.
Fix this by separating "publish" from ID allocation, so that we can get an ID first and publish it later after copy_to_user().
--- drivers/infiniband/core/ucma.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/infiniband/core/ucma.c +5 -1
@@ -218,7 +218,7 @@ static struct ucma_multicast* ucma_allocreturn NULL ;mutex_lock (&mut); - mc->id =idr_alloc (&multicast_idr, mc,0 ,0 ,GFP_KERNEL ); + mc->id =idr_alloc (&multicast_idr,NULL ,0 ,0 ,GFP_KERNEL );mutex_unlock (&mut);if (mc->id <0 ) goto error;
@@ -1404,6 +1404,10 @@ static ssize_t ucma_process_join(struct goto err3; } +mutex_lock (&mut); +idr_replace (&multicast_idr, mc, mc->id); +mutex_unlock (&mut); +mutex_unlock (&file->mut);ucma_put_ctx (ctx);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 47/246 powerpc/64s: Add barrier_nospec
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Suchanek <[email protected]>
[ Upstream commit a6b3964ad71a61bb7c61d80a60bea7d42187b2eb ]
A no-op form of ori (or immediate of 0 into r31 and the result stored in r31) has been re-tasked as a speculation barrier. The instruction only acts as a barrier on newer machines with appropriate firmware support. On older CPUs it remains a harmless no-op.
Implement barrier_nospec using this instruction.
mpe: The semantics of the instruction are believed to be that it prevents execution of subsequent instructions until preceding branches have been fully resolved and are no longer executing speculatively. There is no further documentation available at this time.
--- arch/powerpc/include/asm/barrier.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
arch/powerpc/include/asm/barrier.h +15 -0
@@ -76,6 +76,21 @@ do { \ ___p1; \ }) +#ifdef CONFIG_PPC_BOOK3S_64 +/* +* Prevent execution of subsequent instructions until preceding branches have +* been fully resolved and are no longer executing speculatively. +*/ +#define barrier_nospec_asm ori 31,31,0 + +// This also acts as a compiler barrier due to the memory clobber. +#define barrier_nospec () asm (stringify_in_c(barrier_nospec_asm) ::: "memory") + +#else /* !CONFIG_PPC_BOOK3S_64 */ +#define barrier_nospec_asm +#define barrier_nospec () +#endif +#include <asm-generic/barrier.h> #endif /* _ASM_POWERPC_BARRIER_H */
Greg Kroah-Hartman
maintainerPATCH 49/246 hvc_opal: dont set tb_ticks_per_usec in udbg_init_opal_common()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stewart Smith <[email protected]>
[ Upstream commit 447808bf500a7cc92173266a59f8a494e132b122 ]
time_init() will set up tb_ticks_per_usec based on reality. time_init() is called *after* udbg_init_opal_common() during boot.
from arch/powerpc/kernel/time.c:
unsigned long tb_ticks_per_usec = 100; /* sane default */
Currently, all powernv systems have a timebase frequency of 512mhz (512000000/1000000 == 0x200) - although there's nothing written down anywhere that I can find saying that we couldn't make that different based on the requirements in the ISA.
So, we've been (accidentally) thwacking the (currently) correct (for powernv at least) value for tb_ticks_per_usec earlier than we otherwise would have.
The "sane default" seems to be adequate for our purposes between udbg_init_opal_common() and time_init() being called, and if it isn't, then we should probably be setting it somewhere that isn't hvc_opal.c!
--- drivers/tty/hvc/hvc_opal.c | 1 - 1 file changed, 1 deletion(-)
drivers/tty/hvc/hvc_opal.c +0 -1
@@ -332,7 +332,6 @@ static void udbg_init_opal_common(void) udbg_putc = udbg_opal_putc; udbg_getc = udbg_opal_getc; udbg_getc_poll = udbg_opal_getc_poll; - tb_ticks_per_usec =0x200 ;/* Make udelay not suck */ }void __init hvc_opal_init_early (void )
Greg Kroah-Hartman
maintainerPATCH 50/246 powerpc/64s: Fix compiler store ordering to SLB shadow area
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Piggin <[email protected]>
[ Upstream commit 926bc2f100c24d4842b3064b5af44ae964c1d81c ]
The stores to update the SLB shadow area must be made as they appear in the C code, so that the hypervisor does not see an entry with mismatched vsid and esid. Use WRITE_ONCE for this.
GCC has been observed to elide the first store to esid in the update, which means that if the hypervisor interrupts the guest after storing to vsid, it could see an entry with old esid and new vsid, which may possibly result in memory corruption.
--- arch/powerpc/mm/slb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/powerpc/mm/slb.c +4 -4
@@ -62,14 +62,14 @@ static inline void slb_shadow_update(uns* updating it. No write barriers are needed here, provided * we only update the current CPU's SLB shadow buffer. */ - p->save_area[index].esid =0 ; - p->save_area[index].vsid =cpu_to_be64 (mk_vsid_data (ea, ssize, flags)); - p->save_area[index].esid =cpu_to_be64 (mk_esid_data (ea, ssize, index)); +WRITE_ONCE (p->save_area[index].esid,0 ); +WRITE_ONCE (p->save_area[index].vsid,cpu_to_be64 (mk_vsid_data (ea, ssize, flags))); +WRITE_ONCE (p->save_area[index].esid,cpu_to_be64 (mk_esid_data (ea, ssize, index))); }static inline void slb_shadow_clear (enum slb_index index) { -get_slb_shadow ()->save_area[index].esid =0 ; +WRITE_ONCE (get_slb_shadow ()->save_area[index].esid,0 ); } static inline void create_shadowed_slbe(unsigned long ea, int ssize,
Greg Kroah-Hartman
maintainerPATCH 51/246 RDMA/mad: Convert BUG_ONs to error flows
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
[ Upstream commit 2468b82d69e3a53d024f28d79ba0fdb8bf43dfbf ]
Let's perform checks in-place instead of BUG_ONs.
--- drivers/infiniband/core/mad.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/infiniband/core/mad.c +7 -4
@@ -1558,7 +1558,8 @@ static int add_oui_reg_req(struct ib_mad mad_reg_req->oui, 3)) { method = &(*vendor_table)->vendor_class[ vclass]->method_table[i]; -BUG_ON (!*method); +if (!*method) + goto error3; goto check_in_use; } }
@@ -1568,10 +1569,12 @@ static int add_oui_reg_req(struct ib_mad vclass]->oui[i])) { method = &(*vendor_table)->vendor_class[ vclass]->method_table[i]; -BUG_ON (*method);/* Allocate method table for this OUI */ -if ((ret =allocate_method_table (method))) - goto error3; +if (!*method) { + ret =allocate_method_table (method); +if (ret) + goto error3; + }memcpy ((*vendor_table)->vendor_class[vclass]->oui[i], mad_reg_req->oui,3 ); goto check_in_use;
Greg Kroah-Hartman
maintainerPATCH 53/246 netfilter: nf_tables: check msg_type before nft_trans_set(trans)
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Kodanev <[email protected]>
[ Upstream commit 9c7f96fd77b0dbe1fe7ed1f9c462c45dc48a1076 ]
The patch moves the "trans->msg_type == NFT_MSG_NEWSET" check before using nft_trans_set(trans). Otherwise we can get out of bounds read.
For example, KASAN reported the one when running 0001_cache_handling_0 nft test. In this case "trans->msg_type" was NFT_MSG_NEWTABLE:
[75517.177808] BUG: KASAN: slab-out-of-bounds in nft_set_lookup_global+0x22f/0x270 [nf_tables] [75517.279094] Read of size 8 at addr ffff881bdb643fc8 by task nft/7356 ... [75517.375605] CPU: 26 PID: 7356 Comm: nft Tainted: G E 4.17.0-rc7.1.x86_64 #1 [75517.489587] Hardware name: Oracle Corporation SUN SERVER X4-2 [75517.618129] Call Trace: [75517.648821] dump_stack+0xd1/0x13b [75517.691040] ? show_regs_print_info+0x5/0x5 [75517.742519] ? kmsg_dump_rewind_nolock+0xf5/0xf5 [75517.799300] ? lock_acquire+0x143/0x310 [75517.846738] print_address_description+0x85/0x3a0 [75517.904547] kasan_report+0x18d/0x4b0 [75517.949892] ? nft_set_lookup_global+0x22f/0x270 [nf_tables] [75518.019153] ? nft_set_lookup_global+0x22f/0x270 [nf_tables] [75518.088420] ? nft_set_lookup_global+0x22f/0x270 [nf_tables] [75518.157689] nft_set_lookup_global+0x22f/0x270 [nf_tables] [75518.224869] nf_tables_newsetelem+0x1a5/0x5d0 [nf_tables] [75518.291024] ? nft_add_set_elem+0x2280/0x2280 [nf_tables] [75518.357154] ? nla_parse+0x1a5/0x300 [75518.401455] ? kasan_kmalloc+0xa6/0xd0 [75518.447842] nfnetlink_rcv+0xc43/0x1bdf [nfnetlink] [75518.507743] ? nfnetlink_rcv+0x7a5/0x1bdf [nfnetlink] [75518.569745] ? nfnl_err_reset+0x3c0/0x3c0 [nfnetlink] [75518.631711] ? lock_acquire+0x143/0x310 [75518.679133] ? netlink_deliver_tap+0x9b/0x1070 [75518.733840] ? kasan_unpoison_shadow+0x31/0x40 [75518.788542] netlink_unicast+0x45d/0x680 [75518.837111] ? __isolate_free_page+0x890/0x890 [75518.891913] ? netlink_attachskb+0x6b0/0x6b0 [75518.944542] netlink_sendmsg+0x6fa/0xd30 [75518.993107] ? netlink_unicast+0x680/0x680 [75519.043758] ? netlink_unicast+0x680/0x680 [75519.094402] sock_sendmsg+0xd9/0x160 [75519.138810] ___sys_sendmsg+0x64d/0x980 [75519.186234] ? copy_msghdr_from_user+0x350/0x350 [75519.243118] ? lock_downgrade+0x650/0x650 [75519.292738] ? do_raw_spin_unlock+0x5d/0x250 [75519.345456] ? _raw_spin_unlock+0x24/0x30 [75519.395065] ? __handle_mm_fault+0xbde/0x3410 [75519.448830] ? sock_setsockopt+0x3d2/0x1940 [75519.500516] ? __lock_acquire.isra.25+0xdc/0x19d0 [75519.558448] ? lock_downgrade+0x650/0x650 [75519.608057] ? __audit_syscall_entry+0x317/0x720 [75519.664960] ? __fget_light+0x58/0x250 [75519.711325] ? __sys_sendmsg+0xde/0x170 [75519.758850] __sys_sendmsg+0xde/0x170 [75519.804193] ? __ia32_sys_shutdown+0x90/0x90 [75519.856725] ? syscall_trace_enter+0x897/0x10e0 [75519.912354] ? trace_event_raw_event_sys_enter+0x920/0x920 [75519.979432] ? __audit_syscall_entry+0x720/0x720 [75520.036118] do_syscall_64+0xa3/0x3d0 [75520.081248] ? prepare_exit_to_usermode+0x47/0x1d0 [75520.139904] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [75520.201680] RIP: 0033:0x7fc153320ba0 [75520.245772] RSP: 002b:00007ffe294c3638 EFLAGS: 00000246 ORIG_RAX: 000000000000002e [75520.337708] RAX: ffffffffffffffda RBX: 00007ffe294c4820 RCX: 00007fc153320ba0 [75520.424547] RDX: 0000000000000000 RSI: 00007ffe294c46b0 RDI: 0000000000000003 [75520.511386] RBP: 00007ffe294c47b0 R08: 0000000000000004 R09: 0000000002114090 [75520.598225] R10: 00007ffe294c30a0 R11: 0000000000000246 R12: 00007ffe294c3660 [75520.684961] R13: 0000000000000001 R14: 00007ffe294c3650 R15: 0000000000000001
[75520.790946] Allocated by task 7356: [75520.833994] kasan_kmalloc+0xa6/0xd0 [75520.878088] __kmalloc+0x189/0x450 [75520.920107] nft_trans_alloc_gfp+0x20/0x190 [nf_tables] [75520.983961] nf_tables_newtable+0xcd0/0x1bd0 [nf_tables] [75521.048857] nfnetlink_rcv+0xc43/0x1bdf [nfnetlink] [75521.108655] netlink_unicast+0x45d/0x680 [75521.157013] netlink_sendmsg+0x6fa/0xd30 [75521.205271] sock_sendmsg+0xd9/0x160 [75521.249365] ___sys_sendmsg+0x64d/0x980 [75521.296686] __sys_sendmsg+0xde/0x170 [75521.341822] do_syscall_64+0xa3/0x3d0 [75521.386957] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[75521.467867] Freed by task 23454: [75521.507804] __kasan_slab_free+0x132/0x180 [75521.558137] kfree+0x14d/0x4d0 [75521.596005] free_rt_sched_group+0x153/0x280 [75521.648410] sched_autogroup_create_attach+0x19a/0x520 [75521.711330] ksys_setsid+0x2ba/0x400 [75521.755529] __ia32_sys_setsid+0xa/0x10 [75521.802850] do_syscall_64+0xa3/0x3d0 [75521.848090] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[75521.929000] The buggy address belongs to the object at ffff881bdb643f80 which belongs to the cache kmalloc-96 of size 96 [75522.079797] The buggy address is located 72 bytes inside of 96-byte region [ffff881bdb643f80, ffff881bdb643fe0) [75522.221234] The buggy address belongs to the page: [75522.280100] page:ffffea006f6d90c0 count:1 mapcount:0 mapping:0000000000000000 index:0x0 [75522.377443] flags: 0x2fffff80000100(slab) [75522.426956] raw: 002fffff80000100 0000000000000000 0000000000000000 0000000180200020 [75522.521275] raw: ffffea006e6fafc0 0000000c0000000c ffff881bf180f400 0000000000000000 [75522.615601] page dumped because: kasan: bad access detected
--- net/netfilter/nf_tables_api.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
net/netfilter/nf_tables_api.c +6 -5
@@ -2710,12 +2710,13 @@ static struct nft_set *nf_tables_set_loou32 id =ntohl (nla_get_be32 (nla));list_for_each_entry (trans, &net->nft.commit_list, list) { -struct nft_set *set =nft_trans_set (trans); +if (trans->msg_type ==NFT_MSG_NEWSET ) { +struct nft_set *set =nft_trans_set (trans); -if (trans->msg_type ==NFT_MSG_NEWSET && - id ==nft_trans_set_id (trans) && -nft_active_genmask (set, genmask)) -return set; +if (id ==nft_trans_set_id (trans) && +nft_active_genmask (set, genmask)) +return set; + } }return ERR_PTR (-ENOENT ); }
Greg Kroah-Hartman
maintainerPATCH 56/246 f2fs: fix error path of move_data_page
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit 14a28559f43ac7c0b98dd1b0e73ec9ec8ab4fc45 ]
This patch fixes error path of move_data_page:
- clear cold data flag if it fails to write page.
- redirty page for non-ENOMEM case.
--- fs/f2fs/gc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
fs/f2fs/gc.c +8 -3
@@ -768,9 +768,14 @@ retry:set_cold_data (page); err =do_write_data_page (&fio); -if (err == -ENOMEM && is_dirty) { -congestion_wait (BLK_RW_ASYNC ,HZ /50 ); - goto retry; +if (err) { +clear_cold_data (page); +if (err == -ENOMEM ) { +congestion_wait (BLK_RW_ASYNC ,HZ /50 ); + goto retry; + } +if (is_dirty) +set_page_dirty (page); } } out:
Greg Kroah-Hartman
maintainerPATCH 58/246 f2fs: fix to wait page writeback during revoking atomic write
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit e5e5732d8120654159254c16834bc8663d8be124 ]
After revoking atomic write, related LBA can be reused by others, so we need to wait page writeback before reusing the LBA, in order to avoid interference between old atomic written in-flight IO and new IO.
--- fs/f2fs/segment.c | 2 ++ 1 file changed, 2 insertions(+)
fs/f2fs/segment.c +2 -0
@@ -225,6 +225,8 @@ static int __revoke_inmem_pages(struct ilock_page (page); +f2fs_wait_on_page_writeback (page,DATA , true); +if (recover) {struct dnode_of_data dn;struct node_info ni;
Greg Kroah-Hartman
maintainerPATCH 60/246 f2fs: fix to detect failure of dquot_initialize
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit c22aecd75919511abea872b201751e0be1add898 ]
dquot_initialize() can fail due to any exception inside quota subsystem, f2fs needs to be aware of it, and return correct return value to caller.
--- fs/f2fs/file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/f2fs/file.c +3 -1
@@ -2493,7 +2493,9 @@ static int f2fs_ioc_setproject(struct fi }f2fs_put_page (ipage,1 ); -dquot_initialize (inode); + err =dquot_initialize (inode); +if (err) + goto out_unlock; transfer_to[PRJQUOTA ] =dqget (sb,make_kqid_projid (kprojid));if (!IS_ERR (transfer_to[PRJQUOTA ])) {
Greg Kroah-Hartman
maintainerPATCH 64/246 usbip: dynamically allocate idev by nports found in sysfs
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Grzeschik <[email protected]>
[ Upstream commit de19ca6fd72c7dd45ad82403e7b3fe9c74ef6767 ]
As the amount of available ports varies by the kernels build configuration. To remove the limitation of the fixed 128 ports we allocate the amount of idevs by using the number we get from the kernel.
--- tools/usb/usbip/libsrc/vhci_driver.c | 32 +++++++++++++++++++------------- tools/usb/usbip/libsrc/vhci_driver.h | 3 +-- 2 files changed, 20 insertions(+), 15 deletions(-)
tools/usb/usbip/libsrc/vhci_driver.c +19 -13
@@ -135,11 +135,11 @@ static int refresh_imported_device_list(return 0 ; } -static int get_nports (void ) +static int get_nports (struct udev_device *hc_device) {const char *attr_nports; - attr_nports =udev_device_get_sysattr_value (vhci_driver->hc_device,"nports" ); + attr_nports =udev_device_get_sysattr_value (hc_device,"nports" );if (!attr_nports) {err ("udev_device_get_sysattr_value nports failed" );return -1 ;
@@ -242,35 +242,41 @@ static int read_record(int rhport, charint usbip_vhci_driver_open (void ) { +int nports; +struct udev_device *hc_device; + udev_context =udev_new ();if (!udev_context) {err ("udev_new failed" );return -1 ; } - vhci_driver =calloc (1 ,sizeof (struct usbip_vhci_driver )); -/* will be freed in usbip_driver_close() */ - vhci_driver->hc_device = + hc_device =udev_device_new_from_subsystem_sysname (udev_context,USBIP_VHCI_BUS_TYPE ,USBIP_VHCI_DEVICE_NAME ); -if (!vhci_driver->hc_device) { +if (!hc_device) {err ("udev_device_new_from_subsystem_sysname failed" ); goto err; } - vhci_driver->nports =get_nports (); -dbg ("available ports: %d" , vhci_driver->nports); - -if (vhci_driver->nports <=0 ) { + nports =get_nports (hc_device); +if (nports <=0 ) {err ("no available ports" ); goto err; - }else if (vhci_driver->nports >MAXNPORT ) { -err ("port number exceeds %d" ,MAXNPORT ); + } +dbg ("available ports: %d" , nports); + + vhci_driver =calloc (1 ,sizeof (struct usbip_vhci_driver ) + + nports *sizeof (struct usbip_imported_device )); +if (!vhci_driver) { +err ("vhci_driver allocation failed" ); goto err; } + vhci_driver->nports = nports; + vhci_driver->hc_device = hc_device; vhci_driver->ncontrollers =get_ncontrollers ();dbg ("available controllers: %d" , vhci_driver->ncontrollers);
@@ -285,7 +291,7 @@ int usbip_vhci_driver_open(void)return 0 ; err: -udev_device_unref (vhci_driver->hc_device); +udev_device_unref (hc_device);if (vhci_driver)free (vhci_driver);
tools/usb/usbip/libsrc/vhci_driver.h +1 -2
@@ -13,7 +13,6 @@#define USBIP_VHCI_BUS_TYPE "platform"#define USBIP_VHCI_DEVICE_NAME "vhci_hcd.0" -#define MAXNPORT 128enum hub_speed {HUB_SPEED_HIGH =0 ,
@@ -41,7 +40,7 @@ struct usbip_vhci_driver {int ncontrollers;int nports; -struct usbip_imported_device idev[MAXNPORT ]; +struct usbip_imported_device idev[]; };
Greg Kroah-Hartman
maintainerPATCH 65/246 perf/x86/intel/uncore: Correct fixed counter index check in generic code
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kan Liang <[email protected]>
[ Upstream commit 4749f8196452eeb73cf2086a6a9705bae479d33d ]
There is no index which is bigger than UNCORE_PMC_IDX_FIXED. The only exception is client IMC uncore, which has been specially handled. For generic code, it is not correct to use >= to check fixed counter. The code quality issue will bring problem when a new counter index is introduced.
--- arch/x86/events/intel/uncore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/intel/uncore.c +1 -1
@@ -218,7 +218,7 @@ void uncore_perf_event_update(struct intu64 prev_count, new_count, delta;int shift; -if (event->hw.idx >=UNCORE_PMC_IDX_FIXED ) +if (event->hw.idx ==UNCORE_PMC_IDX_FIXED ) shift =64 -uncore_fixed_ctr_bits (box);else shift =64 -uncore_perf_ctr_bits (box);
Greg Kroah-Hartman
maintainerPATCH 66/246 perf/x86/intel/uncore: Correct fixed counter index check for NHM
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kan Liang <[email protected]>
[ Upstream commit d71f11c076c420c4e2fceb4faefa144e055e0935 ]
For Nehalem and Westmere, there is only one fixed counter for W-Box. There is no index which is bigger than UNCORE_PMC_IDX_FIXED. It is not correct to use >= to check fixed counter.
The code quality issue will bring problem when new counter index is introduced.
--- arch/x86/events/intel/uncore_nhmex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/intel/uncore_nhmex.c +1 -1
@@ -246,7 +246,7 @@ static void nhmex_uncore_msr_enable_even {struct hw_perf_event *hwc = &event->hw; -if (hwc->idx >=UNCORE_PMC_IDX_FIXED ) +if (hwc->idx ==UNCORE_PMC_IDX_FIXED )wrmsrl (hwc->config_base,NHMEX_PMON_CTL_EN_BIT0 );else if (box->pmu->type->event_mask &NHMEX_PMON_CTL_EN_BIT0 )wrmsrl (hwc->config_base, hwc->config |NHMEX_PMON_CTL_EN_BIT22 );
Greg Kroah-Hartman
maintainerPATCH 71/246 btrfs: balance dirty metadata pages in btrfs_finish_ordered_io
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ethan Lien <[email protected]>
[ Upstream commit e73e81b6d0114d4a303205a952ab2e87c44bd279 ]
[Problem description and how we fix it]
We should balance dirty metadata pages at the end of btrfs_finish_ordered_io, since a small, unmergeable random write can potentially produce dirty metadata which is multiple times larger than the data itself. For example, a small, unmergeable 4KiB write may produce:
16KiB dirty leaf (and possibly 16KiB dirty node) in subvolume tree 16KiB dirty leaf (and possibly 16KiB dirty node) in checksum tree 16KiB dirty leaf (and possibly 16KiB dirty node) in extent tree
Although we do call balance dirty pages in write side, but in the buffered write path, most metadata are dirtied only after we reach the dirty background limit (which by far only counts dirty data pages) and wakeup the flusher thread. If there are many small, unmergeable random writes spread in a large btree, we'll find a burst of dirty pages exceeds the dirty_bytes limit after we wakeup the flusher thread - which is not what we expect. In our machine, it caused out-of-memory problem since a page cannot be dropped if it is marked dirty.
Someone may worry about we may sleep in btrfs_btree_balance_dirty_nodelay, but since we do btrfs_finish_ordered_io in a separate worker, it will not stop the flusher consuming dirty pages. Also, we use different worker for metadata writeback endio, sleep in btrfs_finish_ordered_io help us throttle the size of dirty metadata pages.
[Reproduce steps]
To reproduce the problem, we need to do 4KiB write randomly spread in a large btree. In our 2GiB RAM machine:
1) Create 4 subvolumes.
2) Run fio on each subvolume:
[global]
direct=0
rw=randwrite
ioengine=libaio
bs=4k
iodepth=16
numjobs=1
group_reporting
size=128G
runtime=1800
norandommap
time_based
randrepeat=0
3) Take snapshot on each subvolume and repeat fio on existing files.
4) Repeat step (3) until we get large btrees.
In our case, by observing btrfs_root_item->bytes_used, we have 2GiB of metadata in each subvolume tree and 12GiB of metadata in extent tree.
5) Stop all fio, take snapshot again, and wait until all delayed work is completed.
6) Start all fio. Few seconds later we hit OOM when the flusher starts to work.
It can be reproduced even when using nocow write.
--- fs/btrfs/inode.c | 3 +++ 1 file changed, 3 insertions(+)
fs/btrfs/inode.c +3 -0
@@ -3162,6 +3162,9 @@ out:/* once for the tree */ btrfs_put_ordered_extent (ordered_extent); +/* Try to release some metadata so we don't get an OOM but don't wait */ +btrfs_btree_balance_dirty_nodelay (fs_info); +return ret; }
Greg Kroah-Hartman
maintainerPATCH 74/246 Bluetooth: btusb: Add a new Realtek 8723DE ID 2ff8:b011
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jian-Hong Pan <[email protected]>
[ Upstream commit 66d9975c5a7c40aa7e4bb0ec0b0c37ba1f190923 ]
Without this patch we cannot turn on the Bluethooth adapter on ASUS E406MA.
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 0 D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=2ff8 ProdID=b011 Rev= 2.00 S: Manufacturer=Realtek S: Product=802.11n WLAN Adapter S: SerialNumber=00e04c000001 C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA 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=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=82(I) 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=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms E: Ad=83(I) 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=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms E: Ad=83(I) 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=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms E: Ad=83(I) 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=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms E: Ad=83(I) 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=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms E: Ad=83(I) 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=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
--- drivers/bluetooth/btusb.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/bluetooth/btusb.c +3 -0
@@ -373,6 +373,9 @@ static const struct usb_device_id blackl/* Additional Realtek 8723BU Bluetooth devices */ { USB_DEVICE(0x7392, 0xa611), .driver_info = BTUSB_REALTEK }, + /* Additional Realtek 8723DE Bluetooth devices */ + { USB_DEVICE(0x2ff8, 0xb011), .driver_info = BTUSB_REALTEK }, + /* Additional Realtek 8821AE Bluetooth devices */ { USB_DEVICE(0x0b05, 0x17dc), .driver_info = BTUSB_REALTEK }, { USB_DEVICE(0x13d3, 0x3414), .driver_info = BTUSB_REALTEK },
Greg Kroah-Hartman
maintainerPATCH 75/246 ASoC: dpcm: fix BE dai not hw_free and shutdown
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kai Chieh Chuang <[email protected]>
[ Upstream commit 9c0ac70ad24d76b873c1551e27790c7f6a815d5c ]
In case, one BE is used by two FE1/FE2
FE1--->BE-->
|
FE2----]
when FE1/FE2 call dpcm_be_dai_hw_free() together the BE users will be 2 (> 1), hence cannot be hw_free the be state will leave at, ex. SND_SOC_DPCM_STATE_STOP
later FE1/FE2 call dpcm_be_dai_shutdown(),
will be skip due to wrong state.
leaving the BE not being hw_free and shutdown.
The BE dai will be hw_free later when callingdpcm_be_dai_shutdown() if still in invalid state.
--- sound/soc/soc-pcm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
sound/soc/soc-pcm.c +4 -2
@@ -1779,8 +1779,10 @@ int dpcm_be_dai_shutdown(struct snd_soc_continue ;if ((be->dpcm[stream].state !=SND_SOC_DPCM_STATE_HW_FREE ) && - (be->dpcm[stream].state !=SND_SOC_DPCM_STATE_OPEN )) -continue ; + (be->dpcm[stream].state !=SND_SOC_DPCM_STATE_OPEN )) { +soc_pcm_hw_free (be_substream); + be->dpcm[stream].state =SND_SOC_DPCM_STATE_HW_FREE ; + }dev_dbg (be->dev,"ASoC: close BE %s\n" , be->dai_link->name);
Greg Kroah-Hartman
maintainerPATCH 77/246 mwifiex: handle race during mwifiex_usb_disconnect
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ganapathi Bhat <[email protected]>
[ Upstream commit b817047ae70c0bd67b677b65d0d69d72cd6e9728 ]
Race condition is observed during rmmod of mwifiex_usb:
1. The rmmod thread will call mwifiex_usb_disconnect(), download SHUTDOWN command and do wait_event_interruptible_timeout(), waiting for response.
2. The main thread will handle the response and will do a wake_up_interruptible(), unblocking rmmod thread.
3. On getting unblocked, rmmod thread will make rx_cmd.urb = NULL in mwifiex_usb_free().
4. The main thread will try to resubmit rx_cmd.urb in mwifiex_usb_submit_rx_urb(), which is NULL.
To fix, wait for main thread to complete before calling mwifiex_usb_free().
--- drivers/net/wireless/marvell/mwifiex/usb.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/marvell/mwifiex/usb.c +3 -0
@@ -644,6 +644,9 @@ static void mwifiex_usb_disconnect(struc MWIFIEX_FUNC_SHUTDOWN); } +if (adapter->workqueue) +flush_workqueue (adapter->workqueue); +mwifiex_usb_free (card); mwifiex_dbg(adapter, FATAL,
Greg Kroah-Hartman
maintainerPATCH 81/246 media: videobuf2-core: dont call memop finish when queueing
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
[ Upstream commit 90b2da89a083e1395cb322521a42397c49ae4500 ]
When a buffer is queued or requeued in vb2_buffer_done, then don't call the finish memop. In this case the buffer is only returned to vb2, not to userspace.
Calling 'finish' here will cause an unbalance when the queue is canceled, since the core will call the same memop again.
--- drivers/media/v4l2-core/videobuf2-core.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/media/v4l2-core/videobuf2-core.c +6 -3
@@ -912,9 +912,12 @@ void vb2_buffer_done(struct vb2_buffer *dprintk (4 ,"done processing on buffer %d, state: %d\n" , vb->index, state); -/* sync buffers */ -for (plane =0 ; plane < vb->num_planes; ++plane) -call_void_memop (vb, finish, vb->planes[plane].mem_priv); +if (state !=VB2_BUF_STATE_QUEUED && + state !=VB2_BUF_STATE_REQUEUEING ) { +/* sync buffers */ +for (plane =0 ; plane < vb->num_planes; ++plane) +call_void_memop (vb, finish, vb->planes[plane].mem_priv); + }spin_lock_irqsave (&q->done_lock, flags); if (state == VB2_BUF_STATE_QUEUED ||
Greg Kroah-Hartman
maintainerPATCH 82/246 Btrfs: dont return ino to ino cache if inode item removal fails
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Omar Sandoval <[email protected]>
[ Upstream commit c08db7d8d295a4f3a10faaca376de011afff7950 ]
In btrfs_evict_inode(), if btrfs_truncate_inode_items() fails, the inode item will still be in the tree but we still return the ino to the ino cache. That will blow up later when someone tries to allocate that ino, so don't return it to the cache.
--- fs/btrfs/inode.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
fs/btrfs/inode.c +13 -12
@@ -5499,13 +5499,18 @@ void btrfs_evict_inode(struct inode *ino trans->block_rsv = rsv; ret =btrfs_truncate_inode_items (trans, root, inode,0 ,0 ); -if (ret != -ENOSPC && ret != -EAGAIN ) +if (ret) { + trans->block_rsv = &fs_info->trans_block_rsv; +btrfs_end_transaction (trans); +btrfs_btree_balance_dirty (fs_info); +if (ret != -ENOSPC && ret != -EAGAIN ) { +btrfs_orphan_del (NULL ,BTRFS_I (inode)); +btrfs_free_block_rsv (fs_info, rsv); + goto no_delete; + } + }else {break ; - - trans->block_rsv = &fs_info->trans_block_rsv; -btrfs_end_transaction (trans); - trans =NULL ; -btrfs_btree_balance_dirty (fs_info); + } }btrfs_free_block_rsv (fs_info, rsv);
@@ -5514,12 +5519,8 @@ void btrfs_evict_inode(struct inode *ino* Errors here aren't a big deal, it just means we leave orphan items * in the tree. They will be cleaned up on the next mount. */ -if (ret ==0 ) { - trans->block_rsv = root->orphan_block_rsv; -btrfs_orphan_del (trans,BTRFS_I (inode)); - }else { -btrfs_orphan_del (NULL ,BTRFS_I (inode)); - } + trans->block_rsv = root->orphan_block_rsv; +btrfs_orphan_del (trans,BTRFS_I (inode)); trans->block_rsv = &fs_info->trans_block_rsv; if (!(root == fs_info->tree_root ||
Greg Kroah-Hartman
maintainerPATCH 84/246 btrfs: add barriers to btrfs_sync_log before log_commit_wait wakeups
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Sterba <[email protected]>
[ Upstream commit 3d3a2e610ea5e7c6d4f9481ecce5d8e2d8317843 ]
Currently the code assumes that there's an implied barrier by the sequence of code preceding the wakeup, namely the mutex unlock.
As Nikolay pointed out:
I think this is wrong (not your code) but the original assumption that the RELEASE semantics provided by mutex_unlock is sufficient. According to memory-barriers.txt:
Section 'LOCK ACQUISITION FUNCTIONS' states:
(2) RELEASE operation implication:
Memory operations issued before the RELEASE will be completed before the RELEASE operation has completed.
Memory operations issued after the RELEASE *may* be completed before the RELEASE operation has completed.
(I've bolded the may portion)
The example given there:
As an example, consider the following:
*A = a;
*B = b;
ACQUIRE
*C = c;
*D = d;
RELEASE
*E = e;
*F = f;The following sequence of events is acceptable:
ACQUIRE, {*F,*A}, *E, {*C,*D}, *B, RELEASESo if we assume that *C is modifying the flag which the waitqueue is checking, and *E is the actual wakeup, then those accesses can be re-ordered...
IMHO this code should be considered broken...
---
To be on the safe side, add the barriers. The synchronization logic around log using the mutexes and several other threads does not make it easy to reason for/against the barrier.
--- fs/btrfs/tree-log.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
fs/btrfs/tree-log.c +8 -2
@@ -3041,8 +3041,11 @@ out_wake_log_root:mutex_unlock (&log_root_tree->log_mutex);/* -* The barrier before waitqueue_active is implied by mutex_unlock +* The barrier before waitqueue_active is needed so all the updates +* above are seen by the woken threads. It might not be necessary, but +* proving that seems to be hard. */ +smp_mb ();if (waitqueue_active (&log_root_tree->log_commit_wait[index2]))wake_up (&log_root_tree->log_commit_wait[index2]); out:
@@ -3053,8 +3056,11 @@ out:mutex_unlock (&root->log_mutex);/* -* The barrier before waitqueue_active is implied by mutex_unlock +* The barrier before waitqueue_active is needed so all the updates +* above are seen by the woken threads. It might not be necessary, but +* proving that seems to be hard. */ +smp_mb ();if (waitqueue_active (&root->log_commit_wait[index1]))wake_up (&root->log_commit_wait[index1]);return ret;
Greg Kroah-Hartman
maintainerPATCH 86/246 x86/microcode: Make the late update update_lock a raw lock for RT
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Scott Wood <[email protected]>
[ Upstream commit ff987fcf011d20c53b3a613edf6e2055ea48e26e ]
__reload_late() is called from stop_machine context and thus cannot acquire a non-raw spinlock on PREEMPT_RT.
--- arch/x86/kernel/cpu/microcode/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/kernel/cpu/microcode/core.c +3 -3
@@ -70,7 +70,7 @@ static DEFINE_MUTEX(microcode_mutex);/* * Serialize late loading so that CPUs get updated one-by-one. */ -static DEFINE_SPINLOCK (update_lock); +static DEFINE_RAW_SPINLOCK (update_lock);struct ucode_cpu_info ucode_cpu_info[NR_CPUS ];
@@ -560,9 +560,9 @@ static int __reload_late(void *info)if (__wait_for_cpus (&late_cpus_in,NSEC_PER_SEC ))return -1 ; -spin_lock (&update_lock); +raw_spin_lock (&update_lock);apply_microcode_local (&err); -spin_unlock (&update_lock); +raw_spin_unlock (&update_lock);/* siblings return UCODE_OK because their engine got updated already */ if (err >UCODE_NFOUND ) {
Greg Kroah-Hartman
maintainerPATCH 87/246 PM / wakeup: Make s2idle_lock a RAW_SPINLOCK
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
[ Upstream commit 62fc00a6611a0014c85763f9def1fc07c15d1302 ]
The `s2idle_lock' is acquired during suspend while interrupts are disabled even on RT. The lock is acquired for short sections only. Make it a RAW lock which avoids "sleeping while atomic" warnings on RT.
--- kernel/power/suspend.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
kernel/power/suspend.c +7 -7
@@ -60,7 +60,7 @@ static const struct platform_s2idle_opsstatic DECLARE_WAIT_QUEUE_HEAD (s2idle_wait_head);enum s2idle_states __read_mostly s2idle_state; -static DEFINE_SPINLOCK (s2idle_lock); +static DEFINE_RAW_SPINLOCK (s2idle_lock);void s2idle_set_ops (const struct platform_s2idle_ops *ops) {
@@ -78,12 +78,12 @@ static void s2idle_enter(void) {trace_suspend_resume (TPS ("machine_suspend" ),PM_SUSPEND_TO_IDLE , true); -spin_lock_irq (&s2idle_lock); +raw_spin_lock_irq (&s2idle_lock);if (pm_wakeup_pending ()) goto out; s2idle_state =S2IDLE_STATE_ENTER ; -spin_unlock_irq (&s2idle_lock); +raw_spin_unlock_irq (&s2idle_lock);get_online_cpus ();cpuidle_resume ();
@@ -97,11 +97,11 @@ static void s2idle_enter(void)cpuidle_pause ();put_online_cpus (); -spin_lock_irq (&s2idle_lock); +raw_spin_lock_irq (&s2idle_lock); out: s2idle_state =S2IDLE_STATE_NONE ; -spin_unlock_irq (&s2idle_lock); +raw_spin_unlock_irq (&s2idle_lock);trace_suspend_resume (TPS ("machine_suspend" ),PM_SUSPEND_TO_IDLE , false); }
@@ -156,12 +156,12 @@ void s2idle_wake(void) {unsigned long flags; -spin_lock_irqsave (&s2idle_lock, flags); +raw_spin_lock_irqsave (&s2idle_lock, flags);if (s2idle_state >S2IDLE_STATE_NONE ) { s2idle_state =S2IDLE_STATE_WAKE ;wake_up (&s2idle_wait_head); } -spin_unlock_irqrestore (&s2idle_lock, flags); +raw_spin_unlock_irqrestore (&s2idle_lock, flags); }EXPORT_SYMBOL_GPL (s2idle_wake);
Greg Kroah-Hartman
maintainerPATCH 89/246 nvme-rdma: stop admin queue before freeing it
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jianchao Wang <[email protected]>
[ Upstream commit 2e050f00a0f0e07467050cb4afae0234941e5bf3 ]
For any failure after nvme_rdma_start_queue in nvme_rdma_configure_admin_queue, the admin queue will be freed with the NVME_RDMA_Q_LIVE flag still set. Once nvme_rdma_stop_queue is invoked, that will cause a use-after-free.
BUG: KASAN: use-after-free in rdma_disconnect+0x1f/0xe0 [rdma_cm]
To fix it, call nvme_rdma_stop_queue for all the failed cases after nvme_rdma_start_queue.
--- drivers/nvme/host/rdma.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/nvme/host/rdma.c +6 -4
@@ -796,7 +796,7 @@ static int nvme_rdma_configure_admin_queif (error) {dev_err (ctrl->ctrl.device,"prop_get NVME_REG_CAP failed\n" ); - goto out_cleanup_queue; + goto out_stop_queue; } ctrl->ctrl.sqsize =
@@ -804,23 +804,25 @@ static int nvme_rdma_configure_admin_que error =nvme_enable_ctrl (&ctrl->ctrl, ctrl->ctrl.cap);if (error) - goto out_cleanup_queue; + goto out_stop_queue; ctrl->ctrl.max_hw_sectors = (ctrl->max_fr_pages -1 ) << (ilog2 (SZ_4K ) -9 ); error =nvme_init_identify (&ctrl->ctrl);if (error) - goto out_cleanup_queue; + goto out_stop_queue; error =nvme_rdma_alloc_qe (ctrl->queues[0 ].device->dev, &ctrl->async_event_sqe,sizeof (struct nvme_command ),DMA_TO_DEVICE );if (error) - goto out_cleanup_queue; + goto out_stop_queue;return 0 ; +out_stop_queue: +nvme_rdma_stop_queue (&ctrl->queues[0 ]); out_cleanup_queue:if (new)blk_cleanup_queue (ctrl->ctrl.admin_q);
Greg Kroah-Hartman
maintainerPATCH 90/246 nvme-pci: Fix AER reset handling
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Keith Busch <[email protected]>
[ Upstream commit 72cd4cc28e234ed7189ee508ed65ab60c80a97c8 ]
The nvme timeout handling doesn't do anything if the pci channel is offline, which is the case when recovering from PCI error event, so it was a bad idea to sync the controller reset in this state. This patch flushes the reset work in the error_resume callback instead when the channel is back to online. This keeps AER handling serialized and can recover from timeouts.
--- drivers/nvme/host/pci.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/nvme/host/pci.c +3 -0
@@ -2519,6 +2519,9 @@ static pci_ers_result_t nvme_slot_reset(static void nvme_error_resume (struct pci_dev *pdev) { +struct nvme_dev *dev =pci_get_drvdata (pdev); + +flush_work (&dev->ctrl.reset_work);pci_cleanup_aer_uncorrect_error_status (pdev); }
Greg Kroah-Hartman
maintainerPATCH 92/246 ath: Add regulatory mapping for ETSI8_WORLD
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
[ Upstream commit 45faf6e096da8bb80e1ddf8c08a26a9601d9469e ]
The regdomain code is used to select the correct the correct conformance test limits (CTL) for a country. If the regdomain code isn't available and it is still programmed in the EEPROM then it will cause an error and stop the initialization with:
Invalid EEPROM contents
The current CTL mappings for this regdomain code are:
* 2.4GHz: ETSI
* 5GHz: ETSI
--- drivers/net/wireless/ath/regd_common.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/ath/regd_common.h +2 -0
@@ -45,6 +45,7 @@ enum EnumRd {ETSI4_ETSIC =0x38 ,ETSI5_WORLD =0x39 ,ETSI6_WORLD =0x34 , +ETSI8_WORLD =0x3D ,ETSI_RESERVED =0x33 , MKK1_MKKA = 0x40,
@@ -181,6 +182,7 @@ static struct reg_dmn_pair_mapping regDo {ETSI4_WORLD, CTL_ETSI, CTL_ETSI}, {ETSI5_WORLD, CTL_ETSI, CTL_ETSI}, {ETSI6_WORLD, CTL_ETSI, CTL_ETSI}, + {ETSI8_WORLD, CTL_ETSI, CTL_ETSI},/* XXX: For ETSI3_ETSIA, Was NO_CTL meant for the 2 GHz band ? */ {ETSI3_ETSIA, CTL_ETSI, CTL_ETSI},
Greg Kroah-Hartman
maintainerPATCH 94/246 ath: Add regulatory mapping for APL2_FCCA
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
[ Upstream commit 4f183687e3fad3ce0e06e38976cad81bc4541990 ]
The regdomain code is used to select the correct the correct conformance test limits (CTL) for a country. If the regdomain code isn't available and it is still programmed in the EEPROM then it will cause an error and stop the initialization with:
Invalid EEPROM contents
The current CTL mappings for this regdomain code are:
* 2.4GHz: FCC
* 5GHz: FCC
--- drivers/net/wireless/ath/regd_common.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/ath/regd_common.h +2 -0
@@ -61,6 +61,7 @@ enum EnumRd {MKK1_MKKA1 =0x4A ,MKK1_MKKA2 =0x4B ,MKK1_MKKC =0x4C , +APL2_FCCA =0x4D ,APL3_FCCA =0x50 , APL1_WORLD = 0x52,
@@ -193,6 +194,7 @@ static struct reg_dmn_pair_mapping regDo {FCC1_FCCA, CTL_FCC, CTL_FCC}, {APL1_WORLD, CTL_FCC, CTL_ETSI}, {APL2_WORLD, CTL_FCC, CTL_ETSI}, + {APL2_FCCA, CTL_FCC, CTL_FCC}, {APL3_WORLD, CTL_FCC, CTL_ETSI}, {APL4_WORLD, CTL_FCC, CTL_ETSI}, {APL5_WORLD, CTL_FCC, CTL_ETSI},
Greg Kroah-Hartman
maintainerPATCH 99/246 ath: Add regulatory mapping for Bahamas
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
[ Upstream commit 699e2302c286a14afe7b7394151ce6c4e1790cc1 ]
The country code is used by the ath to detect the ISO 3166-1 alpha-2 name and to select the correct conformance test limits (CTL) for a country. If the country isn't available and it is still programmed in the EEPROM then it will cause an error and stop the initialization with:
Invalid EEPROM contents
The current CTL mappings for this country are:
* 2.4GHz: ETSI
* 5GHz: FCC
--- drivers/net/wireless/ath/regd.h | 1 + drivers/net/wireless/ath/regd_common.h | 1 + 2 files changed, 2 insertions(+)
drivers/net/wireless/ath/regd.h +1 -0
@@ -68,6 +68,7 @@ enum CountryCode {CTRY_AUSTRALIA =36 ,CTRY_AUSTRIA =40 ,CTRY_AZERBAIJAN =31 , +CTRY_BAHAMAS =44 ,CTRY_BAHRAIN =48 ,CTRY_BANGLADESH =50 , CTRY_BARBADOS = 52,
drivers/net/wireless/ath/regd_common.h +1 -0
@@ -306,6 +306,7 @@ static struct country_code_to_enum_rd al {CTRY_AUSTRALIA2, FCC6_WORLD, "AU"}, {CTRY_AUSTRIA, ETSI1_WORLD, "AT"}, {CTRY_AZERBAIJAN, ETSI4_WORLD, "AZ"}, + {CTRY_BAHAMAS, FCC3_WORLD, "BS"}, {CTRY_BAHRAIN, APL6_WORLD, "BH"}, {CTRY_BANGLADESH, NULL1_WORLD, "BD"}, {CTRY_BARBADOS, FCC2_WORLD, "BB"},
Greg Kroah-Hartman
maintainerPATCH 106/246 powerpc/8xx: fix invalid register expression in head_8xx.S
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Leroy <[email protected]>
[ Upstream commit e4ccb1dae6bdef228d729c076c38161ef6e7ca34 ]
New binutils generate the following warning
AS arch/powerpc/kernel/head_8xx.oarch/powerpc/kernel/head_8xx.S: Assembler messages:arch/powerpc/kernel/head_8xx.S:916: Warning: invalid register expression
This patch fixes it.
--- arch/powerpc/kernel/head_8xx.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/head_8xx.S +1 -1
@@ -958,7 +958,7 @@ start_here: tovirt(r6,r6) lis r5, abatron_pteptrs@h ori r5, r5, abatron_pteptrs@l - stw r5, 0xf0(r0) /* Must match your Abatron config file */ + stw r5, 0xf0(0) /* Must match your Abatron config file */ tophys(r5,r5) stw r6, 0(r5)
Greg Kroah-Hartman
maintainerPATCH 111/246 mwifiex: correct histogram data with appropriate index
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xinming Hu <[email protected]>
[ Upstream commit 30bfce0b63fa68c14ae1613eb9d259fa18644074 ]
Correct snr/nr/rssi data index to avoid possible buffer underflow.
--- drivers/net/wireless/marvell/mwifiex/util.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/wireless/marvell/mwifiex/util.c +5 -3
@@ -708,12 +708,14 @@ void mwifiex_hist_data_set(struct mwifie s8 nflr) {struct mwifiex_histogram_data *phist_data = priv->hist_data; +s8 nf = -nflr; +s8 rssi = snr - nflr;atomic_inc (&phist_data->num_samples);atomic_inc (&phist_data->rx_rate[rx_rate]); -atomic_inc (&phist_data->snr[snr]); -atomic_inc (&phist_data->noise_flr[128 + nflr]); -atomic_inc (&phist_data->sig_str[nflr - snr]); +atomic_inc (&phist_data->snr[snr +128 ]); +atomic_inc (&phist_data->noise_flr[nf +128 ]); +atomic_inc (&phist_data->sig_str[rssi +128 ]); }/* function to reset histogram data during init/reset */
Greg Kroah-Hartman
maintainerPATCH 113/246 drivers/perf: arm-ccn: dont log to dmesg in event_init
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Rutland <[email protected]>
[ Upstream commit 1898eb61fbc9703efee886d3abec27a388cf28c3 ]
The ARM CCN PMU driver uses dev_warn() to complain about parameters in the user-provided perf_event_attr. This means that under normal operation (e.g. a single invocation of the perf tool), a number of messages warnings may be logged to dmesg.
Tools may issue multiple syscalls to probe for feature support, and multiple applications (from multiple users) can attempt to open events simultaneously, so this is not very helpful, even if a user happens to have access to dmesg. Worse, this can push important information out of the dmesg ring buffer, and can significantly slow down syscall fuzzers, vastly increasing the time it takes to find critical bugs.
Demote the dev_warn() instances to dev_dbg(), as is the case for all other PMU drivers under drivers/perf/. Users who wish to debug PMU event initialisation can enable dynamic debug to receive these messages.
--- drivers/bus/arm-ccn.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/bus/arm-ccn.c +10 -10
@@ -736,7 +736,7 @@ static int arm_ccn_pmu_event_init(struct ccn =pmu_to_arm_ccn (event->pmu);if (hw->sample_period) { -dev_warn (ccn->dev,"Sampling not supported!\n" ); +dev_dbg (ccn->dev,"Sampling not supported!\n" );return -EOPNOTSUPP ; }
@@ -744,12 +744,12 @@ static int arm_ccn_pmu_event_init(struct event->attr.exclude_kernel || event->attr.exclude_hv || event->attr.exclude_idle || event->attr.exclude_host || event->attr.exclude_guest) { -dev_warn (ccn->dev,"Can't exclude execution levels!\n" ); +dev_dbg (ccn->dev,"Can't exclude execution levels!\n" );return -EINVAL ; }if (event->cpu <0 ) { -dev_warn (ccn->dev,"Can't provide per-task data!\n" ); +dev_dbg (ccn->dev,"Can't provide per-task data!\n" );return -EOPNOTSUPP ; }/*
@@ -771,13 +771,13 @@ static int arm_ccn_pmu_event_init(structswitch (type) {case CCN_TYPE_MN :if (node_xp != ccn->mn_id) { -dev_warn (ccn->dev,"Invalid MN ID %d!\n" , node_xp); +dev_dbg (ccn->dev,"Invalid MN ID %d!\n" , node_xp);return -EINVAL ; }break ;case CCN_TYPE_XP :if (node_xp >= ccn->num_xps) { -dev_warn (ccn->dev,"Invalid XP ID %d!\n" , node_xp); +dev_dbg (ccn->dev,"Invalid XP ID %d!\n" , node_xp);return -EINVAL ; }break ;
@@ -785,11 +785,11 @@ static int arm_ccn_pmu_event_init(structbreak ;default :if (node_xp >= ccn->num_nodes) { -dev_warn (ccn->dev,"Invalid node ID %d!\n" , node_xp); +dev_dbg (ccn->dev,"Invalid node ID %d!\n" , node_xp);return -EINVAL ; }if (!arm_ccn_pmu_type_eq (type, ccn->node[node_xp].type)) { -dev_warn (ccn->dev,"Invalid type 0x%x for node %d!\n" , +dev_dbg (ccn->dev,"Invalid type 0x%x for node %d!\n" , type, node_xp);return -EINVAL ; }
@@ -808,19 +808,19 @@ static int arm_ccn_pmu_event_init(structif (event_id != e->event)continue ;if (e->num_ports && port >= e->num_ports) { -dev_warn (ccn->dev,"Invalid port %d for node/XP %d!\n" , +dev_dbg (ccn->dev,"Invalid port %d for node/XP %d!\n" , port, node_xp);return -EINVAL ; }if (e->num_vcs && vc >= e->num_vcs) { -dev_warn (ccn->dev,"Invalid vc %d for node/XP %d!\n" , +dev_dbg (ccn->dev,"Invalid vc %d for node/XP %d!\n" , vc, node_xp);return -EINVAL ; } valid =1 ; }if (!valid) { -dev_warn (ccn->dev,"Invalid event 0x%x for node/XP %d!\n" , +dev_dbg (ccn->dev,"Invalid event 0x%x for node/XP %d!\n" , event_id, node_xp);return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 114/246 spi: Add missing pm_runtime_put_noidle() after failed get
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tony Lindgren <[email protected]>
[ Upstream commit 7e48e23a1f4a50f93ac1073f1326e0a73829b631 ]
If pm_runtime_get_sync() fails we should call pm_runtime_put_noidle(). This is probably not a critical fix as we should only hit this when things are broken elsewhere.
--- drivers/spi/spi.c | 1 + 1 file changed, 1 insertion(+)
drivers/spi/spi.c +1 -0
@@ -1222,6 +1222,7 @@ static void __spi_pump_messages(struct sif (!was_busy && ctlr->auto_runtime_pm) { ret =pm_runtime_get_sync (ctlr->dev.parent);if (ret <0 ) { +pm_runtime_put_noidle (ctlr->dev.parent);dev_err (&ctlr->dev,"Failed to power device: %d\n" , ret);mutex_unlock (&ctlr->io_mutex);
Greg Kroah-Hartman
maintainerPATCH 117/246 scsi: ufs: ufshcd: fix possible unclocked register access
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Subhash Jadavani <[email protected]>
[ Upstream commit b334456ec2021b1addc19806990115e69ec4ac32 ]
Vendor specific setup_clocks ops may depend on clocks managed by ufshcd driver so if the vendor specific setup_clocks callback is called when the required clocks are turned off, it results into unclocked register access.
This change make sure that required clocks are enabled before vendor specific setup_clocks callback is called.
--- drivers/scsi/ufs/ufshcd.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-)
drivers/scsi/ufs/ufshcd.c +20 -6
@@ -6761,9 +6761,16 @@ static int __ufshcd_setup_clocks(structif (list_empty (head)) goto out; - ret =ufshcd_vops_setup_clocks (hba, on,PRE_CHANGE ); -if (ret) -return ret; +/* +* vendor specific setup_clocks ops may depend on clocks managed by +* this standard driver hence call the vendor specific setup_clocks +* before disabling the clocks managed here. +*/ +if (!on) { + ret =ufshcd_vops_setup_clocks (hba, on,PRE_CHANGE ); +if (ret) +return ret; + }list_for_each_entry (clki, head, list) {if (!IS_ERR_OR_NULL (clki->clk)) {
@@ -6787,9 +6794,16 @@ static int __ufshcd_setup_clocks(struct } } - ret =ufshcd_vops_setup_clocks (hba, on,POST_CHANGE ); -if (ret) -return ret; +/* +* vendor specific setup_clocks ops may depend on clocks managed by +* this standard driver hence call the vendor specific setup_clocks +* after enabling the clocks managed here. +*/ +if (on) { + ret =ufshcd_vops_setup_clocks (hba, on,POST_CHANGE ); +if (ret) +return ret; + } out:if (ret) {
Greg Kroah-Hartman
maintainerPATCH 118/246 scsi: ufs: fix exception event handling
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maya Erez <[email protected]>
[ Upstream commit 2e3611e9546c2ed4def152a51dfd34e8dddae7a5 ]
The device can set the exception event bit in one of the response UPIU, for example to notify the need for urgent BKOPs operation. In such a case, the host driver calls ufshcd_exception_event_handler to handle this notification. When trying to check the exception event status (for finding the cause for the exception event), the device may be busy with additional SCSI commands handling and may not respond within the 100ms timeout.
To prevent that, we need to block SCSI commands during handling of exception events and allow retransmissions of the query requests, in case of timeout.
--- drivers/scsi/ufs/ufshcd.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/ufs/ufshcd.c +2 -0
@@ -4947,6 +4947,7 @@ static void ufshcd_exception_event_handl hba = container_of(work, struct ufs_hba, eeh_work);pm_runtime_get_sync (hba->dev); +scsi_block_requests (hba->host); err =ufshcd_get_ee_status (hba, &status);if (err) { dev_err(hba->dev, "%s: failed to get exception status %d\n",
@@ -4960,6 +4961,7 @@ static void ufshcd_exception_event_handlufshcd_bkops_exception_event_handler (hba); out: +scsi_unblock_requests (hba->host);pm_runtime_put_sync (hba->dev);return ; }
Greg Kroah-Hartman
maintainerPATCH 124/246 rtc: tps65910: fix possible race condition
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Belloni <[email protected]>
[ Upstream commit e6000a438e534ee0afd9e83b67f4e23a26dd1067 ]
The IRQ is requested before the struct rtc is allocated and registered, but this struct is used in the IRQ handler. This may lead to a NULL pointer dereference.
Switch to devm_rtc_allocate_device/rtc_register_device to allocate the rtc before requesting the IRQ.
--- drivers/rtc/rtc-tps65910.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/rtc/rtc-tps65910.c +8 -4
@@ -380,6 +380,10 @@ static int tps65910_rtc_probe(struct plaif (!tps_rtc)return -ENOMEM ; + tps_rtc->rtc =devm_rtc_allocate_device (&pdev->dev); +if (IS_ERR (tps_rtc->rtc)) +return PTR_ERR (tps_rtc->rtc); +/* Clear pending interrupts */ ret =regmap_read (tps65910->regmap,TPS65910_RTC_STATUS , &rtc_reg);if (ret <0 )
@@ -421,10 +425,10 @@ static int tps65910_rtc_probe(struct pla tps_rtc->irq = irq;device_set_wakeup_capable (&pdev->dev,1 ); - tps_rtc->rtc =devm_rtc_device_register (&pdev->dev, pdev->name, - &tps65910_rtc_ops,THIS_MODULE ); -if (IS_ERR (tps_rtc->rtc)) { - ret =PTR_ERR (tps_rtc->rtc); + tps_rtc->rtc->ops = &tps65910_rtc_ops; + + ret =rtc_register_device (tps_rtc->rtc); +if (ret) {dev_err (&pdev->dev,"RTC device register: err %d\n" , ret);return ret; }
Greg Kroah-Hartman
maintainerPATCH 125/246 ALSA: emu10k1: Rate-limit error messages about page errors
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 11d42c81036324697d367600bfc16f6dd37636fd ]
The error messages at sanity checks of memory pages tend to repeat too many times once when it hits, and without the rate limit, it may flood and become unreadable. Replace such messages with the *_ratelimited() variant.
Bugzilla: http://bugzilla.opensuse.org/show_bug.cgi?id=1093027
--- sound/pci/emu10k1/memory.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/pci/emu10k1/memory.c +3 -3
@@ -237,13 +237,13 @@ __found_pages:static int is_valid_page (struct snd_emu10k1 *emu,dma_addr_t addr) {if (addr & ~emu->dma_mask) { -dev_err (emu->card->dev, +dev_err_ratelimited (emu->card->dev,"max memory size is 0x%lx (addr = 0x%lx)!!\n" , emu->dma_mask, (unsigned long )addr);return 0 ; }if (addr & (EMUPAGESIZE -1 )) { -dev_err (emu->card->dev,"page is not aligned\n" ); +dev_err_ratelimited (emu->card->dev,"page is not aligned\n" );return 0 ; }return 1 ;
@@ -334,7 +334,7 @@ snd_emu10k1_alloc_pages(struct snd_emu10else addr =snd_pcm_sgbuf_get_addr (substream, ofs);if (!is_valid_page (emu, addr)) { -dev_err (emu->card->dev, +dev_err_ratelimited (emu->card->dev,"emu: failure page = %d\n" , idx);mutex_unlock (&hdr->block_mutex);return NULL ;
Greg Kroah-Hartman
maintainerPATCH 126/246 regulator: pfuze100: add .is_enable() for pfuze100_swb_regulator_ops
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anson Huang <[email protected]>
[ Upstream commit 0b01fd3d40fe6402e5fa3b491ef23109feb1aaa5 ]
If is_enabled() is not defined, regulator core will assume this regulator is already enabled, then it can NOT be really enabled after disabled.
Based on Li Jun's patch from the NXP kernel tree.
--- drivers/regulator/pfuze100-regulator.c | 1 + 1 file changed, 1 insertion(+)
drivers/regulator/pfuze100-regulator.c +1 -0
@@ -158,6 +158,7 @@ static const struct regulator_ops pfuze1static const struct regulator_ops pfuze100_swb_regulator_ops = { .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, + .is_enabled = regulator_is_enabled_regmap, .list_voltage = regulator_list_voltage_table, .map_voltage = regulator_map_voltage_ascend, .set_voltage_sel = regulator_set_voltage_sel_regmap,
Greg Kroah-Hartman
maintainerPATCH 128/246 md: fix NULL dereference of mddev->pers in remove_and_add_spares()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yufen Yu <[email protected]>
[ Upstream commit c42a0e2675721e1444f56e6132a07b7b1ec169ac ]
We met NULL pointer BUG as follow:
[ 151.760358] BUG: unable to handle kernel NULL pointer dereference at 0000000000000060 [ 151.761340] PGD 80000001011eb067 P4D 80000001011eb067 PUD 1011ea067 PMD 0 [ 151.762039] Oops: 0000 [#1] SMP PTI [ 151.762406] Modules linked in: [ 151.762723] CPU: 2 PID: 3561 Comm: mdadm-test Kdump: loaded Not tainted 4.17.0-rc1+ #238 [ 151.763542] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1.fc26 04/01/2014 [ 151.764432] RIP: 0010:remove_and_add_spares.part.56+0x13c/0x3a0 [ 151.765061] RSP: 0018:ffffc90001d7fcd8 EFLAGS: 00010246 [ 151.765590] RAX: 0000000000000000 RBX: ffff88013601d600 RCX: 0000000000000000 [ 151.766306] RDX: 0000000000000000 RSI: ffff88013601d600 RDI: ffff880136187000 [ 151.767014] RBP: ffff880136187018 R08: 0000000000000003 R09: 0000000000000051 [ 151.767728] R10: ffffc90001d7fed8 R11: 0000000000000000 R12: ffff88013601d600 [ 151.768447] R13: ffff8801298b1300 R14: ffff880136187000 R15: 0000000000000000 [ 151.769160] FS: 00007f2624276700(0000) GS:ffff88013ae80000(0000) knlGS:0000000000000000 [ 151.769971] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 151.770554] CR2: 0000000000000060 CR3: 0000000111aac000 CR4: 00000000000006e0 [ 151.771272] Call Trace: [ 151.771542] md_ioctl+0x1df2/0x1e10 [ 151.771906] ? __switch_to+0x129/0x440 [ 151.772295] ? __schedule+0x244/0x850 [ 151.772672] blkdev_ioctl+0x4bd/0x970 [ 151.773048] block_ioctl+0x39/0x40 [ 151.773402] do_vfs_ioctl+0xa4/0x610 [ 151.773770] ? dput.part.23+0x87/0x100 [ 151.774151] ksys_ioctl+0x70/0x80 [ 151.774493] __x64_sys_ioctl+0x16/0x20 [ 151.774877] do_syscall_64+0x5b/0x180 [ 151.775258] entry_SYSCALL_64_after_hwframe+0x44/0xa9
For raid6, when two disk of the array are offline, two spare disks can be added into the array. Before spare disks recovery completing, system reboot and mdadm thinks it is ok to restart the degraded array by md_ioctl(). Since disks in raid6 is not only_parity(), raid5_run() will abort, when there is no PPL feature or not setting 'start_dirty_degraded' parameter. Therefore, mddev->pers is NULL.
But, mddev->raid_disks has been set and it will not be cleared when raid5_run abort. md_ioctl() can execute cmd 'HOT_REMOVE_DISK' to remove a disk by mdadm, which will cause NULL pointer dereference in remove_and_add_spares() finally.
--- drivers/md/md.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/md/md.c +3 -0
@@ -6498,6 +6498,9 @@ static int hot_remove_disk(struct mddevchar b[BDEVNAME_SIZE ];struct md_rdev *rdev; +if (!mddev->pers) +return -ENODEV ; + rdev =find_rdev (mddev, dev);if (!rdev)return -ENXIO ;
Greg Kroah-Hartman
maintainerPATCH 129/246 ixgbevf: fix MAC address changes through ixgbevf_set_mac()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emil Tantilov <[email protected]>
[ Upstream commit 6e7d0ba1e59b1a306761a731e67634c0f2efea2a ]
Set hw->mac.perm_addr in ixgbevf_set_mac() in order to avoid losing the custom MAC on reset. This can happen in the following case:
Quoted 2 lines
ip link set $vf address $mac
ethtool -r $vf
--- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +1 -0
@@ -3737,6 +3737,7 @@ static int ixgbevf_set_mac(struct net_dereturn -EPERM ;ether_addr_copy (hw->mac.addr, addr->sa_data); +ether_addr_copy (hw->mac.perm_addr, addr->sa_data);ether_addr_copy (netdev->dev_addr, addr->sa_data);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 130/246 media: smiapp: fix timeout checking in smiapp_read_nvm
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
[ Upstream commit 7a2148dfda8001c983f0effd9afd8a7fa58e99c4 ]
The current code decrements the timeout counter i and the end of each loop i is incremented, so the check for timeout will always be false and hence the timeout mechanism is just a dead code path. Potentially, if the RD_READY bit is not set, we could end up in an infinite loop.
Fix this so the timeout starts from 1000 and decrements to zero, if at the end of the loop i is zero we have a timeout condition.
Detected by CoverityScan, CID#1324008 ("Logically dead code")
--- drivers/media/i2c/smiapp/smiapp-core.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/media/i2c/smiapp/smiapp-core.c +5 -6
@@ -1001,7 +1001,7 @@ static int smiapp_read_nvm(struct smiappif (rval) goto out; -for (i =0 ; i <1000 ; i++) { +for (i =1000 ; i >0 ; i--) { rval =smiapp_read ( sensor,SMIAPP_REG_U8_DATA_TRANSFER_IF_1_STATUS , &s);
@@ -1012,11 +1012,10 @@ static int smiapp_read_nvm(struct smiappif (s &SMIAPP_DATA_TRANSFER_IF_1_STATUS_RD_READY )break ; -if (--i ==0 ) { - rval = -ETIMEDOUT ; - goto out; - } - + } +if (!i) { + rval = -ETIMEDOUT ; + goto out; }for (i =0 ; i <SMIAPP_NVM_PAGE_SIZE ; i++) {
Greg Kroah-Hartman
maintainerPATCH 137/246 drm/radeon: fix mode_valids return type
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luc Van Oostenryck <[email protected]>
[ Upstream commit 7a47f20eb1fb8fa8d7a8fe3a4fd8c721f04c2174 ]
The method struct drm_connector_helper_funcs::mode_valid is defined as returning an 'enum drm_mode_status' but the driver implementation for this method uses an 'int' for it.
Fix this by using 'enum drm_mode_status' in the driver too.
--- drivers/gpu/drm/radeon/radeon_connectors.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/radeon/radeon_connectors.c +5 -5
@@ -853,7 +853,7 @@ static int radeon_lvds_get_modes(structreturn ret; } -static int radeon_lvds_mode_valid (struct drm_connector *connector, +static enum drm_mode_status radeon_lvds_mode_valid (struct drm_connector *connector,struct drm_display_mode *mode) {struct drm_encoder *encoder =radeon_best_single_encoder (connector);
@@ -1013,7 +1013,7 @@ static int radeon_vga_get_modes(struct dreturn ret; } -static int radeon_vga_mode_valid (struct drm_connector *connector, +static enum drm_mode_status radeon_vga_mode_valid (struct drm_connector *connector,struct drm_display_mode *mode) {struct drm_device *dev = connector->dev;
@@ -1157,7 +1157,7 @@ static int radeon_tv_get_modes(struct drreturn 1 ; } -static int radeon_tv_mode_valid (struct drm_connector *connector, +static enum drm_mode_status radeon_tv_mode_valid (struct drm_connector *connector,struct drm_display_mode *mode) {if ((mode->hdisplay >1024 ) || (mode->vdisplay >768 ))
@@ -1499,7 +1499,7 @@ static void radeon_dvi_force(struct drm_ radeon_connector->use_digital = true; } -static int radeon_dvi_mode_valid (struct drm_connector *connector, +static enum drm_mode_status radeon_dvi_mode_valid (struct drm_connector *connector,struct drm_display_mode *mode) {struct drm_device *dev = connector->dev;
@@ -1801,7 +1801,7 @@ out:return ret; } -static int radeon_dp_mode_valid (struct drm_connector *connector, +static enum drm_mode_status radeon_dp_mode_valid (struct drm_connector *connector,struct drm_display_mode *mode) {struct drm_device *dev = connector->dev;
Greg Kroah-Hartman
maintainerPATCH 141/246 EDAC, altera: Fix ARM64 build warning
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thor Thayer <[email protected]>
[ Upstream commit 9ef20753e044f7468c4113e5aecd785419b0b3cc ]
The kbuild test robot reported the following warning:
drivers/edac/altera_edac.c: In function 'ocram_free_mem':
drivers/edac/altera_edac.c:1410:42: warning: cast from pointer to integer
of different size [-Wpointer-to-int-cast]
gen_pool_free((struct gen_pool *)other, (u32)p, size);
^After adding support for ARM64 architectures, the unsigned long parameter is 64 bits and causes a build warning on 64-bit configs. Fix by casting to the correct size (unsigned long) instead of u32.
--- drivers/edac/altera_edac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/edac/altera_edac.c +1 -1
@@ -1106,7 +1106,7 @@ static void *ocram_alloc_mem(size_t sizestatic void ocram_free_mem (void *p,size_t size,void *other) { -gen_pool_free ((struct gen_pool *)other, (u32 )p, size); +gen_pool_free ((struct gen_pool *)other, (unsigned long )p, size); }static const struct edac_device_prv_data ocramecc_data = {
Greg Kroah-Hartman
maintainerPATCH 154/246 media: saa7164: Fix driver name in debug output
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brad Love <[email protected]>
[ Upstream commit 0cc4655cb57af0b7e105d075c4f83f8046efafe7 ]
This issue was reported by a user who downloaded a corrupt saa7164 firmware, then went looking for a valid xc5000 firmware to fix the error displayed...but the device in question has no xc5000, thus after much effort, the wild goose chase eventually led to a support call.
The xc5000 has nothing to do with saa7164 (as far as I can tell), so replace the string with saa7164 as well as give a meaningful hint on the firmware mismatch.
--- drivers/media/pci/saa7164/saa7164-fw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/pci/saa7164/saa7164-fw.c +2 -1
@@ -426,7 +426,8 @@ int saa7164_downloadfirmware(struct saa7 __func__, fw->size);if (fw->size != fwlength) { -printk (KERN_ERR "xc5000: firmware incorrect size\n" ); +printk (KERN_ERR "saa7164: firmware incorrect size %zu != %u\n" , + fw->size, fwlength); ret = -ENOMEM ; goto out; }
Greg Kroah-Hartman
maintainerPATCH 157/246 s390/cpum_sf: Add data entry sizes to sampling trailer entry
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Richter <[email protected]>
[ Upstream commit 77715b7ddb446bd39a06f3376e85f4bb95b29bb8 ]
The CPU Measurement sampling facility creates a trailer entry for each Sample-Data-Block of stored samples. The trailer entry contains the sizes (in bytes) of the stored sampling types:
- basic-sampling data entry size
- diagnostic-sampling data entry size
Both sizes are 2 bytes long.
This patch changes the trailer entry definition to reflect this.
--- arch/s390/include/asm/cpu_mf.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/s390/include/asm/cpu_mf.h +3 -1
@@ -132,7 +132,9 @@ struct hws_trailer_entry { unsigned int f:1; /* 0 - Block Full Indicator */ unsigned int a:1; /* 1 - Alert request control */ unsigned int t:1; /* 2 - Timestamp format */ - unsigned long long:61; /* 3 - 63: Reserved */ + unsigned int :29; /* 3 - 31: Reserved */ + unsigned int bsdes:16; /* 32-47: size of basic SDE */ + unsigned int dsdes:16; /* 48-63: size of diagnostic SDE */ };unsigned long long flags;/* 0 - 63: All indicators */ };
Greg Kroah-Hartman
maintainerPATCH 162/246 scsi: megaraid: silence a static checker bug
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 27e833dabab74ee665e487e291c9afc6d71effba ]
If we had more than 32 megaraid cards then it would cause memory corruption. That's not likely, of course, but it's handy to enforce it and make the static checker happy.
--- drivers/scsi/megaraid.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/scsi/megaraid.c +3 -0
@@ -4199,6 +4199,9 @@ megaraid_probe_one(struct pci_dev *pdev,int irq, i, j;int error = -ENODEV ; +if (hba_count >=MAX_CONTROLLERS ) + goto out; +if (pci_enable_device (pdev)) goto out;pci_set_master (pdev);
Greg Kroah-Hartman
maintainerPATCH 164/246 scsi: qedf: Set the UNLOADING flag when removing a vport
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chad Dupuis <[email protected]>
[ Upstream commit 4f4616ceebaf045c59e8a6aa01f08826d18d5c63 ]
Similar to what we do when we remove a PCI function, set the QEDF_UNLOADING flag to prevent any requests from being queued while a vport is being deleted. This prevents any requests from getting stuck in limbo when the vport is unloaded or deleted.
Fixes the crash:
PID: 106676 TASK: ffff9a436aa90000 CPU: 12 COMMAND: "multipathd"
#0 [ffff9a43567d3550] machine_kexec+522 at ffffffffaca60b2a #1 [ffff9a43567d35b0] __crash_kexec+114 at ffffffffacb13512 #2 [ffff9a43567d3680] crash_kexec+48 at ffffffffacb13600 #3 [ffff9a43567d3698] oops_end+168 at ffffffffad117768
#4 [ffff9a43567d36c0] no_context+645 at ffffffffad106f52 #5 [ffff9a43567d3710] __bad_area_nosemaphore+116 at ffffffffad106fe9 #6 [ffff9a43567d3760] bad_area+70 at ffffffffad107379
#7 [ffff9a43567d3788] __do_page_fault+1247 at ffffffffad11a8cf #8 [ffff9a43567d37f0] do_page_fault+53 at ffffffffad11a915 #9 [ffff9a43567d3820] page_fault+40 at ffffffffad116768
[exception RIP: qedf_init_task+61]
RIP: ffffffffc0e13c2d RSP: ffff9a43567d38d0 RFLAGS: 00010046
RAX: 0000000000000000 RBX: ffffbe920472c738 RCX: ffff9a434fa0e3e8
RDX: ffff9a434f695280 RSI: ffffbe920472c738 RDI: ffff9a43aa359c80
RBP: ffff9a43567d3950 R8: 0000000000000c15 R9: ffff9a3fb09b9880
R10: ffff9a434fa0e3e8 R11: ffff9a43567d35ce R12: 0000000000000000
R13: ffff9a434f695280 R14: ffff9a43aa359c80 R15: ffff9a3fb9e005c0
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018--- drivers/scsi/qedf/qedf_main.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/scsi/qedf/qedf_main.c +10 -0
@@ -1649,6 +1649,15 @@ static int qedf_vport_destroy(struct fc_struct Scsi_Host *shost =vport_to_shost (vport);struct fc_lport *n_port =shost_priv (shost);struct fc_lport *vn_port = vport->dd_data; +struct qedf_ctx *qedf =lport_priv (vn_port); + +if (!qedf) { +QEDF_ERR (NULL ,"qedf is NULL.\n" ); + goto out; + } + +/* Set unloading bit on vport qedf_ctx to prevent more I/O */ +set_bit (QEDF_UNLOADING , &qedf->flags);mutex_lock (&n_port->lp_mutex);list_del (&vn_port->list);
@@ -1675,6 +1684,7 @@ static int qedf_vport_destroy(struct fc_if (vn_port->host)scsi_host_put (vn_port->host); +out:return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 168/246 bpf: fix references to free_bpf_prog_info() in comments
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit ab7f5bf0928be2f148d000a6eaa6c0a36e74750e ]
Comments in the verifier refer to free_bpf_prog_info() which seems to have never existed in tree. Replace it with free_used_maps().
--- kernel/bpf/verifier.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/bpf/verifier.c +2 -2
@@ -4110,7 +4110,7 @@ static int replace_map_fd_with_map_ptr(s/* hold the map. If the program is rejected by verifier, * the map will be released by release_maps() or it * will be used by the valid program until it's unloaded -* and all maps are released in free_bpf_prog_info() +* and all maps are released in free_used_maps() */ map =bpf_map_inc (map, false);if (IS_ERR (map)) {
@@ -4623,7 +4623,7 @@ free_log_buf:vfree (log_buf);if (!env->prog->aux->used_maps)/* if we didn't copy map pointers into bpf_prog_info, release -* them now. Otherwise free_bpf_prog_info() will release them. +* them now. Otherwise free_used_maps() will release them. */ release_maps (env); *prog = env->prog;
Greg Kroah-Hartman
maintainerPATCH 170/246 media: siano: get rid of __le32/__le16 cast warnings
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit e1b7f11b37def5f3021c06e8c2b4953e099357aa ]
Those are all false-positives that appear with smatch when building for arm:
drivers/media/common/siano/smsendian.c:38:36: warning: cast to restricted __le32 drivers/media/common/siano/smsendian.c:38:36: warning: cast to restricted __le32 drivers/media/common/siano/smsendian.c:38:36: warning: cast to restricted __le32 drivers/media/common/siano/smsendian.c:38:36: warning: cast to restricted __le32 drivers/media/common/siano/smsendian.c:38:36: warning: cast to restricted __le32 drivers/media/common/siano/smsendian.c:38:36: warning: cast to restricted __le32 drivers/media/common/siano/smsendian.c:47:44: warning: cast to restricted __le32 drivers/media/common/siano/smsendian.c:47:44: warning: cast to restricted __le32 drivers/media/common/siano/smsendian.c:47:44: warning: cast to restricted __le32 drivers/media/common/siano/smsendian.c:47:44: warning: cast to restricted __le32 drivers/media/common/siano/smsendian.c:47:44: warning: cast to restricted __le32 drivers/media/common/siano/smsendian.c:47:44: warning: cast to restricted __le32 drivers/media/common/siano/smsendian.c:67:35: warning: cast to restricted __le16 drivers/media/common/siano/smsendian.c:67:35: warning: cast to restricted __le16 drivers/media/common/siano/smsendian.c:67:35: warning: cast to restricted __le16 drivers/media/common/siano/smsendian.c:67:35: warning: cast to restricted __le16 drivers/media/common/siano/smsendian.c:84:44: warning: cast to restricted __le32 drivers/media/common/siano/smsendian.c:84:44: warning: cast to restricted __le32 drivers/media/common/siano/smsendian.c:84:44: warning: cast to restricted __le32 drivers/media/common/siano/smsendian.c:84:44: warning: cast to restricted __le32 drivers/media/common/siano/smsendian.c:84:44: warning: cast to restricted __le32 drivers/media/common/siano/smsendian.c:84:44: warning: cast to restricted __le32 drivers/media/common/siano/smsendian.c:98:26: warning: cast to restricted __le16 drivers/media/common/siano/smsendian.c:98:26: warning: cast to restricted __le16 drivers/media/common/siano/smsendian.c:98:26: warning: cast to restricted __le16 drivers/media/common/siano/smsendian.c:98:26: warning: cast to restricted __le16 drivers/media/common/siano/smsendian.c:99:28: warning: cast to restricted __le16 drivers/media/common/siano/smsendian.c:99:28: warning: cast to restricted __le16 drivers/media/common/siano/smsendian.c:99:28: warning: cast to restricted __le16 drivers/media/common/siano/smsendian.c:99:28: warning: cast to restricted __le16 drivers/media/common/siano/smsendian.c:100:27: warning: cast to restricted __le16 drivers/media/common/siano/smsendian.c:100:27: warning: cast to restricted __le16 drivers/media/common/siano/smsendian.c:100:27: warning: cast to restricted __le16 drivers/media/common/siano/smsendian.c:100:27: warning: cast to restricted __le16
Get rid of them by adding explicit forced casts.
--- drivers/media/common/siano/smsendian.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/media/common/siano/smsendian.c +7 -7
@@ -35,7 +35,7 @@ void smsendian_handle_tx_message(void *bswitch (msg->x_msg_header.msg_type) {case MSG_SMS_DATA_DOWNLOAD_REQ : { - msg->msg_data[0 ] =le32_to_cpu (msg->msg_data[0 ]); + msg->msg_data[0 ] =le32_to_cpu ((__force __le32)(msg->msg_data[0 ]));break ; }
@@ -44,7 +44,7 @@ void smsendian_handle_tx_message(void *b sizeof(struct sms_msg_hdr))/4;for (i =0 ; i < msg_words; i++) - msg->msg_data[i] =le32_to_cpu (msg->msg_data[i]); + msg->msg_data[i] =le32_to_cpu ((__force __le32 )msg->msg_data[i]);break ; }
@@ -64,7 +64,7 @@ void smsendian_handle_rx_message(void *b {struct sms_version_res *ver = (struct sms_version_res *) msg; - ver->chip_model =le16_to_cpu (ver->chip_model); + ver->chip_model =le16_to_cpu ((__force __le16 )ver->chip_model);break ; }
@@ -81,7 +81,7 @@ void smsendian_handle_rx_message(void *b sizeof(struct sms_msg_hdr))/4;for (i =0 ; i < msg_words; i++) - msg->msg_data[i] =le32_to_cpu (msg->msg_data[i]); + msg->msg_data[i] =le32_to_cpu ((__force __le32 )msg->msg_data[i]);break ; }
@@ -95,9 +95,9 @@ void smsendian_handle_message_header(voi#ifdef __BIG_ENDIANstruct sms_msg_hdr *phdr = (struct sms_msg_hdr *)msg; - phdr->msg_type =le16_to_cpu (phdr->msg_type); - phdr->msg_length =le16_to_cpu (phdr->msg_length); - phdr->msg_flags =le16_to_cpu (phdr->msg_flags); + phdr->msg_type =le16_to_cpu ((__force __le16 )phdr->msg_type); + phdr->msg_length =le16_to_cpu ((__force __le16 )phdr->msg_length); + phdr->msg_flags =le16_to_cpu ((__force __le16 )phdr->msg_flags);#endif /* __BIG_ENDIAN */ }EXPORT_SYMBOL_GPL (smsendian_handle_message_header);
Greg Kroah-Hartman
maintainerPATCH 171/246 drm/atomic: Handling the case when setting old crtc for plane
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Satendra Singh Thakur <[email protected]>
[ Upstream commit fc2a69f3903dfd97cd47f593e642b47918c949df ]
In the func drm_atomic_set_crtc_for_plane, with the current code, if crtc of the plane_state and crtc passed as argument to the func are same, entire func will executed in vein.
It will get state of crtc and clear and set the bits in plane_mask. All these steps are not required for same old crtc.
Ideally, we should do nothing in this case, this patch handles the same, and causes the program to return without doing anything in such scenario.
--- drivers/gpu/drm/drm_atomic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_atomic.c +3 -1
@@ -1355,7 +1355,9 @@ drm_atomic_set_crtc_for_plane(struct drm {struct drm_plane *plane = plane_state->plane;struct drm_crtc_state *crtc_state; - +/* Nothing to do for same crtc*/ +if (plane_state->crtc == crtc) +return 0 ;if (plane_state->crtc) { crtc_state =drm_atomic_get_crtc_state (plane_state->state, plane_state->crtc);
Greg Kroah-Hartman
maintainerPATCH 173/246 mmc: dw_mmc: update actual clock for mmc debugfs
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shawn Lin <[email protected]>
[ Upstream commit ff178981bd5fd1667f373098740cb1c6d6efa1ba ]
Respect the actual clock for mmc debugfs to help better debug the hardware.
mmc_host mmc0: Bus speed (slot 0) = 135475200Hz (slot req 150000000Hz, actual 135475200HZ div = 0)
cat /sys/kernel/debug/mmc0/ios
clock: 150000000 Hz actual clock: 135475200 Hz vdd: 21 (3.3 ~ 3.4 V) bus mode: 2 (push-pull) chip select: 0 (don't care) power mode: 2 (on) bus width: 3 (8 bits) timing spec: 9 (mmc HS200) signal voltage: 0 (1.80 V) driver type: 0 (driver type B)
--- drivers/mmc/host/dw_mmc.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/mmc/host/dw_mmc.c +4 -0
@@ -1255,6 +1255,8 @@ static void dw_mci_setup_bus(struct dw_mif (host->state ==STATE_WAITING_CMD11_DONE ) sdmmc_cmd_bits |=SDMMC_CMD_VOLT_SWITCH ; + slot->mmc->actual_clock =0 ; +if (!clock) {mci_writel (host,CLKENA ,0 );mci_send_cmd (slot, sdmmc_cmd_bits,0 );
@@ -1313,6 +1315,8 @@ static void dw_mci_setup_bus(struct dw_m/* keep the last clock value that was requested from core */ slot->__clk_old = clock; + slot->mmc->actual_clock = div ? ((host->bus_hz / div) >>1 ) : + host->bus_hz; } host->current_speed = clock;
Greg Kroah-Hartman
maintainerPATCH 178/246 dt-bindings: net: meson-dwmac: new compatible name for AXG SoC
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yixun Lan <[email protected]>
[ Upstream commit 7e5d05e18ba1ed491c6f836edee7f0b90f3167bc ]
We need to introduce a new compatible name for the Meson-AXG SoC in order to support the RMII 100M ethernet PHY, since the PRG_ETH0 register of the dwmac glue layer is changed from previous old SoC.
--- Documentation/devicetree/bindings/net/meson-dwmac.txt | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/net/meson-dwmac.txt +1 -0
@@ -10,6 +10,7 @@ Required properties on all platforms: - "amlogic,meson6-dwmac" - "amlogic,meson8b-dwmac" - "amlogic,meson-gxbb-dwmac" + - "amlogic,meson-axg-dwmac" Additionally "snps,dwmac" and any applicable more detailed version number described in net/stmmac.txt should be used.
Greg Kroah-Hartman
maintainerPATCH 179/246 fasync: Fix deadlock between task-context and interrupt-context kill_fasync()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kirill Tkhai <[email protected]>
[ Upstream commit 7a107c0f55a3b4c6f84a4323df5610360bde1684 ]
I observed the following deadlock between them:
[task 1] [task 2] [task 3]
kill_fasync() mm_update_next_owner() copy_process()
spin_lock_irqsave(&fa->fa_lock) read_lock(&tasklist_lock) write_lock_irq(&tasklist_lock)
send_sigio() <IRQ> ...
read_lock(&fown->lock) kill_fasync() ...
read_lock(&tasklist_lock) spin_lock_irqsave(&fa->fa_lock) ...Task 1 can't acquire read locked tasklist_lock, since there is already task 3 expressed its wish to take the lock exclusive. Task 2 holds the read locked lock, but it can't take the spin lock.
Also, there is possible another deadlock (which I haven't observed):
[task 1] [task 2]f_getown() kill_fasync()
read_lock(&f_own->lock) spin_lock_irqsave(&fa->fa_lock,)
<IRQ> send_sigio() write_lock_irq(&f_own->lock) kill_fasync() read_lock(&fown->lock) spin_lock_irqsave(&fa->fa_lock,)
Actually, we do not need exclusive fa->fa_lock in kill_fasync_rcu(), as it guarantees fa->fa_file->f_owner integrity only. It may seem, that it used to give a task a small possibility to receive two sequential signals, if there are two parallel kill_fasync() callers, and task handles the first signal fastly, but the behaviour won't become different, since there is exclusive sighand lock in do_send_sig_info().
The patch converts fa_lock into rwlock_t, and this fixes two above deadlocks, as rwlock is allowed to be taken from interrupt handler by qrwlock design.
--- fs/fcntl.c | 15 +++++++-------- include/linux/fs.h | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-)
fs/fcntl.c +7 -8
@@ -864,9 +864,9 @@ int fasync_remove_entry(struct file *filif (fa->fa_file != filp)continue ; -spin_lock_irq (&fa->fa_lock); +write_lock_irq (&fa->fa_lock); fa->fa_file =NULL ; -spin_unlock_irq (&fa->fa_lock); +write_unlock_irq (&fa->fa_lock); *fp = fa->fa_next;call_rcu (&fa->fa_rcu, fasync_free_rcu);
@@ -911,13 +911,13 @@ struct fasync_struct *fasync_insert_entrif (fa->fa_file != filp)continue ; -spin_lock_irq (&fa->fa_lock); +write_lock_irq (&fa->fa_lock); fa->fa_fd = fd; -spin_unlock_irq (&fa->fa_lock); +write_unlock_irq (&fa->fa_lock); goto out; } -spin_lock_init (&new->fa_lock); +rwlock_init (&new->fa_lock); new->magic =FASYNC_MAGIC ; new->fa_file = filp; new->fa_fd = fd;
@@ -980,14 +980,13 @@ static void kill_fasync_rcu(struct fasyn {while (fa) {struct fown_struct *fown; -unsigned long flags;if (fa->magic !=FASYNC_MAGIC ) {printk (KERN_ERR "kill_fasync: bad magic number in " "fasync_struct!\n" );return ; } -spin_lock_irqsave (&fa->fa_lock, flags); +read_lock (&fa->fa_lock);if (fa->fa_file) { fown = &fa->fa_file->f_owner;/* Don't send SIGURG to processes which have not set a
@@ -996,7 +995,7 @@ static void kill_fasync_rcu(struct fasynif (!(sig ==SIGURG && fown->signum ==0 ))send_sigio (fown, fa->fa_fd, band); } -spin_unlock_irqrestore (&fa->fa_lock, flags); +read_unlock (&fa->fa_lock); fa =rcu_dereference (fa->fa_next); } }
include/linux/fs.h +1 -1
@@ -1245,7 +1245,7 @@ static inline int locks_lock_file_wait(s }struct fasync_struct { -spinlock_t fa_lock; +rwlock_t fa_lock;int magic;int fa_fd;struct fasync_struct *fa_next;/* singly linked list */
Greg Kroah-Hartman
maintainerPATCH 180/246 backlight: pwm_bl: Dont use GPIOF_* with gpiod_get_direction
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
[ Upstream commit bb084c0f61d659f0e6d371b096e0e57998f191d6 ]
The documentation was wrong, gpiod_get_direction() returns 0/1 instead of the GPIOF_* flags. The docs were fixed with commit 94fc73094abe47 ("gpio: correct docs about return value of gpiod_get_direction"). Now, fix this user (until a better, system-wide solution is in place).
--- drivers/video/backlight/pwm_bl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/video/backlight/pwm_bl.c +3 -3
@@ -301,14 +301,14 @@ static int pwm_backlight_probe(struct pl/* * If the GPIO is not known to be already configured as output, that -* is, if gpiod_get_direction returns either GPIOF_DIR_IN or -EINVAL, -* change the direction to output and set the GPIO as active. +* is, if gpiod_get_direction returns either 1 or -EINVAL, change the +* direction to output and set the GPIO as active. * Do not force the GPIO to active when it was already output as it * could cause backlight flickering or we would enable the backlight too * early. Leave the decision of the initial backlight state for later. */ if (pb->enable_gpio && -gpiod_get_direction (pb->enable_gpio) !=GPIOF_DIR_OUT ) +gpiod_get_direction (pb->enable_gpio) !=0 )gpiod_direction_output (pb->enable_gpio,1 ); pb->power_supply =devm_regulator_get (&pdev->dev,"power" );
Greg Kroah-Hartman
maintainerPATCH 182/246 delayacct: Use raw_spinlocks
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
[ Upstream commit 02acc80d19edb0d5684c997b2004ad19f9f5236e ]
try_to_wake_up() might invoke delayacct_blkio_end() while holding the pi_lock (which is a raw_spinlock_t). delayacct_blkio_end() acquires task_delay_info.lock which is a spinlock_t. This causes a might sleep splat on -RT where non raw spinlocks are converted to 'sleeping' spinlocks.
task_delay_info.lock is only held for a short amount of time so it's not a problem latency wise to make convert it to a raw spinlock.
--- include/linux/delayacct.h | 2 +- kernel/delayacct.c | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-)
include/linux/delayacct.h +1 -1
@@ -29,7 +29,7 @@ #ifdef CONFIG_TASK_DELAY_ACCT struct task_delay_info { - spinlock_t lock; + raw_spinlock_t lock; unsigned int flags; /* Private per-task flags */ /* For each stat XXX, add following, aligned appropriately
kernel/delayacct.c +9 -8
@@ -44,23 +44,24 @@ void __delayacct_tsk_init(struct task_st { tsk->delays =kmem_cache_zalloc (delayacct_cache,GFP_KERNEL );if (tsk->delays) -spin_lock_init (&tsk->delays->lock); +raw_spin_lock_init (&tsk->delays->lock); }/* * Finish delay accounting for a statistic using its timestamps (@start), * accumalator (@total) and @count */ -static void delayacct_end (spinlock_t *lock,u64 *start,u64 *total,u32 *count) +static void delayacct_end (raw_spinlock_t *lock,u64 *start,u64 *total, +u32 *count) {s64 ns =ktime_get_ns () - *start;unsigned long flags;if (ns >0 ) { -spin_lock_irqsave (lock, flags); +raw_spin_lock_irqsave (lock, flags); *total += ns; (*count)++; -spin_unlock_irqrestore (lock, flags); +raw_spin_unlock_irqrestore (lock, flags); } }
@@ -127,7 +128,7 @@ int __delayacct_add_tsk(struct taskstats/* zero XXX_total, non-zero XXX_count implies XXX stat overflowed */ -spin_lock_irqsave (&tsk->delays->lock, flags); +raw_spin_lock_irqsave (&tsk->delays->lock, flags); tmp = d->blkio_delay_total + tsk->delays->blkio_delay; d->blkio_delay_total = (tmp < d->blkio_delay_total) ?0 : tmp; tmp = d->swapin_delay_total + tsk->delays->swapin_delay;
@@ -137,7 +138,7 @@ int __delayacct_add_tsk(struct taskstats d->blkio_count += tsk->delays->blkio_count; d->swapin_count += tsk->delays->swapin_count; d->freepages_count += tsk->delays->freepages_count; -spin_unlock_irqrestore (&tsk->delays->lock, flags); +raw_spin_unlock_irqrestore (&tsk->delays->lock, flags);return 0 ; }
@@ -147,10 +148,10 @@ __u64 __delayacct_blkio_ticks(struct tas__u64 ret;unsigned long flags; -spin_lock_irqsave (&tsk->delays->lock, flags); +raw_spin_lock_irqsave (&tsk->delays->lock, flags); ret =nsec_to_clock_t (tsk->delays->blkio_delay + tsk->delays->swapin_delay); -spin_unlock_irqrestore (&tsk->delays->lock, flags); +raw_spin_unlock_irqrestore (&tsk->delays->lock, flags);return ret; }
Greg Kroah-Hartman
maintainerPATCH 184/246 memory: tegra: Apply interrupts mask per SoC
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Osipenko <[email protected]>
[ Upstream commit 1c74d5c0de0c2cc29fef97a19251da2ad6f579bd ]
Currently we are enabling handling of interrupts specific to Tegra124+ which happen to overlap with previous generations. Let's specify interrupts mask per SoC generation for consistency and in a preparation of squashing of Tegra20 driver into the common one that will enable handling of GART faults which may be undesirable by newer generations.
--- drivers/memory/tegra/mc.c | 21 +++------------------ drivers/memory/tegra/mc.h | 9 +++++++++ drivers/memory/tegra/tegra114.c | 2 ++ drivers/memory/tegra/tegra124.c | 6 ++++++ drivers/memory/tegra/tegra210.c | 3 +++ drivers/memory/tegra/tegra30.c | 2 ++ include/soc/tegra/mc.h | 2 ++ 7 files changed, 27 insertions(+), 18 deletions(-)
drivers/memory/tegra/mc.c +3 -18
@@ -20,14 +20,6 @@#include "mc.h" #define MC_INTSTATUS 0x000 -#define MC_INT_DECERR_MTS (1 << 16) -#define MC_INT_SECERR_SEC (1 << 13) -#define MC_INT_DECERR_VPR (1 << 12) -#define MC_INT_INVALID_APB_ASID_UPDATE (1 << 11) -#define MC_INT_INVALID_SMMU_PAGE (1 << 10) -#define MC_INT_ARBITRATION_EMEM (1 << 9) -#define MC_INT_SECURITY_VIOLATION (1 << 8) -#define MC_INT_DECERR_EMEM (1 << 6)#define MC_INTMASK 0x004
@@ -248,13 +240,11 @@ static const char *const error_names[8]static irqreturn_t tegra_mc_irq (int irq,void *data) {struct tegra_mc *mc = data; -unsigned long status, mask; +unsigned long status;unsigned int bit;/* mask all interrupts to avoid flooding */ - mask =mc_readl (mc,MC_INTMASK ); - status =mc_readl (mc,MC_INTSTATUS ) & mask; - + status =mc_readl (mc,MC_INTSTATUS ) & mc->soc->intmask;if (!status)return IRQ_NONE ;
@@ -349,7 +339,6 @@ static int tegra_mc_probe(struct platforconst struct of_device_id *match;struct resource *res;struct tegra_mc *mc; -u32 value;int err; match =of_match_node (tegra_mc_of_match, pdev->dev.of_node);
@@ -417,11 +406,7 @@ static int tegra_mc_probe(struct platforWARN (!mc->soc->client_id_mask,"Missing client ID mask for this SoC\n" ); - value =MC_INT_DECERR_MTS |MC_INT_SECERR_SEC |MC_INT_DECERR_VPR | -MC_INT_INVALID_APB_ASID_UPDATE |MC_INT_INVALID_SMMU_PAGE | -MC_INT_SECURITY_VIOLATION |MC_INT_DECERR_EMEM ; - -mc_writel (mc, value,MC_INTMASK ); +mc_writel (mc, mc->soc->intmask,MC_INTMASK );return 0 ; }
drivers/memory/tegra/mc.h +9 -0
@@ -14,6 +14,15 @@#include <soc/tegra/mc.h> +#define MC_INT_DECERR_MTS (1 << 16) +#define MC_INT_SECERR_SEC (1 << 13) +#define MC_INT_DECERR_VPR (1 << 12) +#define MC_INT_INVALID_APB_ASID_UPDATE (1 << 11) +#define MC_INT_INVALID_SMMU_PAGE (1 << 10) +#define MC_INT_ARBITRATION_EMEM (1 << 9) +#define MC_INT_SECURITY_VIOLATION (1 << 8) +#define MC_INT_DECERR_EMEM (1 << 6) +static inline u32 mc_readl (struct tegra_mc *mc,unsigned long offset) {return readl (mc->regs + offset);
drivers/memory/tegra/tegra114.c +2 -0
@@ -930,4 +930,6 @@ const struct tegra_mc_soc tegra114_mc_so .atom_size = 32, .client_id_mask = 0x7f, .smmu = &tegra114_smmu_soc, + .intmask = MC_INT_INVALID_SMMU_PAGE | MC_INT_SECURITY_VIOLATION | + MC_INT_DECERR_EMEM, };
drivers/memory/tegra/tegra124.c +6 -0
@@ -1020,6 +1020,9 @@ const struct tegra_mc_soc tegra124_mc_so .smmu = &tegra124_smmu_soc, .emem_regs = tegra124_mc_emem_regs, .num_emem_regs = ARRAY_SIZE(tegra124_mc_emem_regs), + .intmask =MC_INT_DECERR_MTS |MC_INT_SECERR_SEC |MC_INT_DECERR_VPR | +MC_INT_INVALID_APB_ASID_UPDATE |MC_INT_INVALID_SMMU_PAGE | + MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM, };#endif /* CONFIG_ARCH_TEGRA_124_SOC */
@@ -1042,5 +1045,8 @@ const struct tegra_mc_soc tegra132_mc_so .atom_size = 32, .client_id_mask = 0x7f, .smmu = &tegra132_smmu_soc, + .intmask =MC_INT_DECERR_MTS |MC_INT_SECERR_SEC |MC_INT_DECERR_VPR | +MC_INT_INVALID_APB_ASID_UPDATE |MC_INT_INVALID_SMMU_PAGE | + MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM, };#endif /* CONFIG_ARCH_TEGRA_132_SOC */
drivers/memory/tegra/tegra210.c +3 -0
@@ -1077,4 +1077,7 @@ const struct tegra_mc_soc tegra210_mc_so .atom_size = 64, .client_id_mask = 0xff, .smmu = &tegra210_smmu_soc, + .intmask =MC_INT_DECERR_MTS |MC_INT_SECERR_SEC |MC_INT_DECERR_VPR | +MC_INT_INVALID_APB_ASID_UPDATE |MC_INT_INVALID_SMMU_PAGE | + MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM, };
drivers/memory/tegra/tegra30.c +2 -0
@@ -952,4 +952,6 @@ const struct tegra_mc_soc tegra30_mc_soc .atom_size = 16, .client_id_mask = 0x7f, .smmu = &tegra30_smmu_soc, + .intmask = MC_INT_INVALID_SMMU_PAGE | MC_INT_SECURITY_VIOLATION | + MC_INT_DECERR_EMEM, };
include/soc/tegra/mc.h +2 -0
@@ -99,6 +99,8 @@ struct tegra_mc_soc {u8 client_id_mask;const struct tegra_smmu_soc *smmu; + +u32 intmask; };struct tegra_mc {
Greg Kroah-Hartman
maintainerPATCH 188/246 drm/gma500: fix psb_intel_lvds_mode_valid()s return type
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luc Van Oostenryck <[email protected]>
[ Upstream commit 2ea009095c6e7396915a1d0dd480c41f02985f79 ]
The method struct drm_connector_helper_funcs::mode_valid is defined as returning an 'enum drm_mode_status' but the driver implementation for this method, psb_intel_lvds_mode_valid(), uses an 'int' for it.
Fix this by using 'enum drm_mode_status' for psb_intel_lvds_mode_valid().
--- drivers/gpu/drm/gma500/psb_intel_drv.h | 2 +- drivers/gpu/drm/gma500/psb_intel_lvds.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/gma500/psb_intel_drv.h +1 -1
@@ -255,7 +255,7 @@ extern int intelfb_remove(struct drm_devextern bool psb_intel_lvds_mode_fixup (struct drm_encoder *encoder,const struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode); -extern int psb_intel_lvds_mode_valid (struct drm_connector *connector, +extern enum drm_mode_status psb_intel_lvds_mode_valid (struct drm_connector *connector,struct drm_display_mode *mode); extern int psb_intel_lvds_set_property(struct drm_connector *connector, struct drm_property *property,
drivers/gpu/drm/gma500/psb_intel_lvds.c +1 -1
@@ -343,7 +343,7 @@ static void psb_intel_lvds_restore(struc } } -int psb_intel_lvds_mode_valid (struct drm_connector *connector, +enum drm_mode_status psb_intel_lvds_mode_valid (struct drm_connector *connector,struct drm_display_mode *mode) {struct drm_psb_private *dev_priv = connector->dev->dev_private;
Greg Kroah-Hartman
maintainerPATCH 191/246 rsi: fix nommu_map_sg overflow kernel panic
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Siva Rebbagondla <[email protected]>
[ Upstream commit f700546682a62a87a9615121a37ee7452dab4b76 ]
Following overflow kernel panic is observed on some platforms while loading the driver. It is fixed if dynamically allocated memory is passed to SDIO instead of static one
[ 927.513963] nommu_map_sg: overflow 17d54064ba7c+20 of device mask ffffffff [ 927.517712] Modules linked in: rsi_sdio(+) cmac bnep arc4 rsi_91x mac80211 cfg80211 btrsi rfcomm bluetooth ecdh_generic snd_soc_sst_bytcr_rt5660 [ 927.517861] CPU: 0 PID: 1624 Comm: insmod Tainted: G W 4.15.0-1000 #1 [ 927.517870] RIP: 0010:sdhci_send_command+0x5f0/0xa90 [sdhci] [ 927.517873] RSP: 0000:ffffac3fc064b6d8 EFLAGS: 00010086 [ 927.517895] Call Trace: [ 927.517908] ? __schedule+0x3cd/0x890 [ 927.517915] ? mod_timer+0x17b/0x3c0 [ 927.517922] sdhci_request+0x7c/0xf0 [sdhci] [ 927.517928] __mmc_start_request+0x5a/0x170 [ 927.517932] mmc_start_request+0x74/0x90 [ 927.517936] mmc_wait_for_req+0x87/0xe0 [ 927.517940] mmc_io_rw_extended+0x2fd/0x330 [ 927.517946] ? mmc_wait_data_done+0x30/0x30 [ 927.517951] sdio_io_rw_ext_helper+0x160/0x210 [ 927.517956] sdio_writesb+0x1d/0x20 [ 927.517966] rsi_sdio_write_register_multiple+0x68/0x110 [rsi_sdio] [ 927.517976] rsi_hal_device_init+0x357/0x910 [rsi_91x] [ 927.517983] ? rsi_hal_device_init+0x357/0x910 [rsi_91x] [ 927.517990] rsi_probe+0x2c6/0x450 [rsi_sdio] [ 927.517995] sdio_bus_probe+0xfc/0x110 [ 927.518000] driver_probe_device+0x2b3/0x490 [ 927.518005] __driver_attach+0xdf/0xf0 [ 927.518008] ? driver_probe_device+0x490/0x490 [ 927.518014] bus_for_each_dev+0x6c/0xc0 [ 927.518018] driver_attach+0x1e/0x20 [ 927.518021] bus_add_driver+0x1f4/0x270 [ 927.518028] ? rsi_sdio_ack_intr+0x50/0x50 [rsi_sdio] [ 927.518031] driver_register+0x60/0xe0 [ 927.518038] ? rsi_sdio_ack_intr+0x50/0x50 [rsi_sdio] [ 927.518041] sdio_register_driver+0x20/0x30 [ 927.518047] rsi_module_init+0x16/0x40 [rsi_sdio]
--- drivers/net/wireless/rsi/rsi_91x_hal.c | 35 +++++++++++++++++++------------- drivers/net/wireless/rsi/rsi_91x_sdio.c | 21 ++++++++++++------- drivers/net/wireless/rsi/rsi_sdio.h | 2 - 3 files changed, 36 insertions(+), 22 deletions(-)
drivers/net/wireless/rsi/rsi_91x_hal.c +21 -14
@@ -557,28 +557,32 @@ static int bl_write_header(struct rsi_hw u32 content_size) {struct rsi_host_intf_ops *hif_ops = adapter->host_intf_ops; -struct bl_header bl_hdr; +struct bl_header *bl_hdr;u32 write_addr, write_len;int status; - bl_hdr.flags =0 ; - bl_hdr.image_no =cpu_to_le32 (adapter->priv->coex_mode); - bl_hdr.check_sum =cpu_to_le32 ( - *(u32 *)&flash_content[CHECK_SUM_OFFSET ]); - bl_hdr.flash_start_address =cpu_to_le32 ( - *(u32 *)&flash_content[ADDR_OFFSET ]); - bl_hdr.flash_len =cpu_to_le32 (*(u32 *)&flash_content[LEN_OFFSET ]); + bl_hdr =kzalloc (sizeof (*bl_hdr),GFP_KERNEL ); +if (!bl_hdr) +return -ENOMEM ; + + bl_hdr->flags =0 ; + bl_hdr->image_no =cpu_to_le32 (adapter->priv->coex_mode); + bl_hdr->check_sum = +cpu_to_le32 (*(u32 *)&flash_content[CHECK_SUM_OFFSET ]); + bl_hdr->flash_start_address = +cpu_to_le32 (*(u32 *)&flash_content[ADDR_OFFSET ]); + bl_hdr->flash_len =cpu_to_le32 (*(u32 *)&flash_content[LEN_OFFSET ]); write_len =sizeof (struct bl_header );if (adapter->rsi_host_intf ==RSI_HOST_INTF_USB ) { write_addr =PING_BUFFER_ADDRESS ; status = hif_ops->write_reg_multiple (adapter, write_addr, - (u8 *)&bl_hdr, write_len); + (u8 *)bl_hdr, write_len);if (status <0 ) {rsi_dbg (ERR_ZONE ,"%s: Failed to load Version/CRC structure\n" , __func__); -return status; + goto fail; } }else { write_addr =PING_BUFFER_ADDRESS >>16 ;
@@ -587,20 +591,23 @@ static int bl_write_header(struct rsi_hwrsi_dbg (ERR_ZONE ,"%s: Unable to set ms word to common reg\n" , __func__); -return status; + goto fail; } write_addr =RSI_SD_REQUEST_MASTER | (PING_BUFFER_ADDRESS &0xFFFF ); status = hif_ops->write_reg_multiple (adapter, write_addr, - (u8 *)&bl_hdr, write_len); + (u8 *)bl_hdr, write_len);if (status <0 ) {rsi_dbg (ERR_ZONE ,"%s: Failed to load Version/CRC structure\n" , __func__); -return status; + goto fail; } } -return 0 ; + status =0 ; +fail: +kfree (bl_hdr); +return status; }static u32 read_flash_capacity (struct rsi_hw *adapter)
drivers/net/wireless/rsi/rsi_91x_sdio.c +14 -7
@@ -968,17 +968,21 @@ static void ulp_read_write(struct rsi_hw/*This function resets and re-initializes the chip.*/ static void rsi_reset_chip (struct rsi_hw *adapter) { -__le32 data; +u8 *data;u8 sdio_interrupt_status =0 ;u8 request =1 ;int ret; + data =kzalloc (sizeof (u32),GFP_KERNEL ); +if (!data) +return ; +rsi_dbg (INFO_ZONE ,"Writing disable to wakeup register\n" ); ret =rsi_sdio_write_register (adapter,0 ,SDIO_WAKEUP_REG , &request);if (ret <0 ) {rsi_dbg (ERR_ZONE ,"%s: Failed to write SDIO wakeup register\n" , __func__); -return ; + goto err; }msleep (20 ); ret = rsi_sdio_read_register(adapter, RSI_FN1_INT_REGISTER,
@@ -986,7 +990,7 @@ static void rsi_reset_chip(struct rsi_hwif (ret <0 ) {rsi_dbg (ERR_ZONE ,"%s: Failed to Read Intr Status Register\n" , __func__); -return ; + goto err; }rsi_dbg (INFO_ZONE ,"%s: Intr Status Register value = %d\n" , __func__, sdio_interrupt_status);
@@ -996,17 +1000,17 @@ static void rsi_reset_chip(struct rsi_hwrsi_dbg (ERR_ZONE ,"%s: Unable to set ms word to common reg\n" , __func__); -return ; + goto err; } - data =TA_HOLD_THREAD_VALUE ; +put_unaligned_le32 (TA_HOLD_THREAD_VALUE , data);if (rsi_sdio_write_register_multiple (adapter,TA_HOLD_THREAD_REG |RSI_SD_REQUEST_MASTER , - (u8 *)&data,4 )) { + data,4 )) {rsi_dbg (ERR_ZONE ,"%s: Unable to hold Thread-Arch processor threads\n" , __func__); -return ; + goto err; }/* This msleep will ensure Thread-Arch processor to go to hold
@@ -1027,6 +1031,9 @@ static void rsi_reset_chip(struct rsi_hw* read write operations to complete for chip reset. */ msleep (500 ); +err: +kfree (data); +return ; }/**
drivers/net/wireless/rsi/rsi_sdio.h +1 -1
@@ -85,7 +85,7 @@ enum sdio_interrupt_type {#define TA_SOFT_RST_CLR 0#define TA_SOFT_RST_SET BIT(0)#define TA_PC_ZERO 0 -#define TA_HOLD_THREAD_VALUE cpu_to_le32(0xF) +#define TA_HOLD_THREAD_VALUE 0xF#define TA_RELEASE_THREAD_VALUE cpu_to_le32(0xF)#define TA_BASE_ADDR 0x2200#define MISC_CFG_BASE_ADDR 0x4105
Greg Kroah-Hartman
maintainerPATCH 193/246 staging: vchiq_core: Fix missing semaphore release in error case
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Wahren <[email protected]>
[ Upstream commit 8113b89fc615cfb531df0334fb3a091cf6a45ce0 ]
The bail out branch in case of a invalid tx_pos missed a semaphore release. Dan Carpenter found this with a static checker.
--- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +1 -0
@@ -601,6 +601,7 @@ reserve_space(VCHIQ_STATE_T *state, size }if (tx_pos == (state->slot_queue_available *VCHIQ_SLOT_SIZE )) { +up (&state->slot_available_event);pr_warn ("%s: invalid tx_pos: %d\n" , __func__, tx_pos);return NULL ; }
Greg Kroah-Hartman
maintainerPATCH 194/246 staging: lustre: llite: correct removexattr detection
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Simmons <[email protected]>
[ Upstream commit 1b60f6dfa38403ff7c4d0b4b7ecdb810f9789a2a ]
In ll_xattr_set_common() detect the removexattr() case correctly by testing for a NULL value as well as XATTR_REPLACE.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-10787
Reviewed-on: https://review.whamcloud.com/
--- drivers/staging/lustre/lustre/llite/xattr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/llite/xattr.c +5 -1
@@ -93,7 +93,11 @@ ll_xattr_set_common(const struct xattr_h__u64 valid;int rc; -if (flags ==XATTR_REPLACE ) { +/* When setxattr() is called with a size of 0 the value is +* unconditionally replaced by "". When removexattr() is +* called we get a NULL value and XATTR_REPLACE for flags. +*/ +if (!value && flags ==XATTR_REPLACE ) {ll_stats_ops_tally (ll_i2sbi (inode),LPROC_LL_REMOVEXATTR ,1 ); valid =OBD_MD_FLXATTRRM ; }else {
Greg Kroah-Hartman
maintainerPATCH 197/246 soc: imx: gpcv2: Do not pass static memory as platform data
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Smirnov <[email protected]>
[ Upstream commit 050f810e238f268670f14a8f8b793ba2dbf2e92f ]
Platform device core assumes the ownership of dev.platform_data as well as that it is dynamically allocated and it will try to kfree it as a part of platform_device_release(). Change the code to use platform_device_add_data() n instead of a pointer to a static memory to avoid causing a BUG() when calling platform_device_put().
The problem can be reproduced by artificially enabling the error path of platform_device_add() call (around line 357).
Note that this change also allows us to constify imx7_pgc_domains, since we no longer need to be able to modify it.
--- drivers/soc/imx/gpcv2.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/soc/imx/gpcv2.c +15 -7
@@ -155,7 +155,7 @@ static int imx7_gpc_pu_pgc_sw_pdn_req(streturn imx7_gpc_pu_pgc_sw_pxx_req (genpd, false); } -static struct imx7_pgc_domain imx7_pgc_domains[] = { +static const struct imx7_pgc_domain imx7_pgc_domains[] = { [IMX7_POWER_DOMAIN_MIPI_PHY ] = { .genpd = { .name ="mipi-phy" ,
@@ -321,11 +321,6 @@ static int imx_gpcv2_probe(struct platfocontinue ; } - domain = &imx7_pgc_domains[domain_index]; - domain->regmap = regmap; - domain->genpd.power_on = imx7_gpc_pu_pgc_sw_pup_req; - domain->genpd.power_off = imx7_gpc_pu_pgc_sw_pdn_req; - pd_pdev =platform_device_alloc ("imx7-pgc-domain" , domain_index);if (!pd_pdev) {
@@ -334,7 +329,20 @@ static int imx_gpcv2_probe(struct platforeturn -ENOMEM ; } - pd_pdev->dev.platform_data = domain; + ret =platform_device_add_data (pd_pdev, + &imx7_pgc_domains[domain_index], +sizeof (imx7_pgc_domains[domain_index])); +if (ret) { +platform_device_put (pd_pdev); +of_node_put (np); +return ret; + } + + domain = pd_pdev->dev.platform_data; + domain->regmap = regmap; + domain->genpd.power_on = imx7_gpc_pu_pgc_sw_pup_req; + domain->genpd.power_off = imx7_gpc_pu_pgc_sw_pdn_req; + pd_pdev->dev.parent = dev; pd_pdev->dev.of_node = np;
Greg Kroah-Hartman
maintainerPATCH 198/246 microblaze: Fix simpleImage format generation
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Simek <[email protected]>
[ Upstream commit ece97f3a5fb50cf5f98886fbc63c9665f2bb199d ]
simpleImage generation was broken for some time. This patch is fixing steps how simpleImage.*.ub file is generated. Steps are objdump of vmlinux and create .ub.
Also make sure that there is striped elf version with .strip suffix.
--- arch/microblaze/boot/Makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
arch/microblaze/boot/Makefile +6 -4
@@ -22,17 +22,19 @@ $(obj)/linux.bin.gz: $(obj)/linux.bin FO quiet_cmd_cp = CP $< $@$2 cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false) -quiet_cmd_strip = STRIP $@ +quiet_cmd_strip = STRIP $< $@$2 cmd_strip = $(STRIP) -K microblaze_start -K _end -K __log_buf \ - -K _fdt_start vmlinux -o $@ + -K _fdt_start $< -o $@$2 UIMAGE_LOADADDR = $(CONFIG_KERNEL_BASE_ADDR) +UIMAGE_IN = $@ +UIMAGE_OUT = [email protected] $(obj)/simpleImage.%: vmlinux FORCE $(call if_changed,cp,.unstrip) $(call if_changed,objcopy) $(call if_changed,uimage) - $(call if_changed,strip) - @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' + $(call if_changed,strip,.strip) + @echo 'Kernel: $(UIMAGE_OUT) is ready' ' (#'`cat .version`')' clean-files += simpleImage.*.unstrip linux.bin.ub dts/*.dtb
Greg Kroah-Hartman
maintainerPATCH 201/246 crypto: authenc - dont leak pointers to authenc keys
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tudor-Dan Ambarus <[email protected]>
[ Upstream commit ad2fdcdf75d169e7a5aec6c7cb421c0bec8ec711 ]
In crypto_authenc_setkey we save pointers to the authenc keys in a local variable of type struct crypto_authenc_keys and we don't zeroize it after use. Fix this and don't leak pointers to the authenc keys.
--- crypto/authenc.c | 1 + 1 file changed, 1 insertion(+)
crypto/authenc.c +1 -0
@@ -108,6 +108,7 @@ static int crypto_authenc_setkey(struct CRYPTO_TFM_RES_MASK); out: +memzero_explicit (&keys,sizeof (keys));return err; badkey:
Greg Kroah-Hartman
maintainerPATCH 202/246 media: omap3isp: fix unbalanced dma_iommu_mapping
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suman Anna <[email protected]>
[ Upstream commit b7e1e6859fbf60519fd82d7120cee106a6019512 ]
The OMAP3 ISP driver manages its MMU mappings through the IOMMU-aware ARM DMA backend. The current code creates a dma_iommu_mapping and attaches this to the ISP device, but never detaches the mapping in either the probe failure paths or the driver remove path resulting in an unbalanced mapping refcount and a memory leak. Fix this properly.
--- drivers/media/platform/omap3isp/isp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/media/platform/omap3isp/isp.c +4 -3
@@ -1945,6 +1945,7 @@ error_csi2:static void isp_detach_iommu (struct isp_device *isp) { +arm_iommu_detach_device (isp->dev);arm_iommu_release_mapping (isp->mapping); isp->mapping =NULL ; }
@@ -1961,8 +1962,7 @@ static int isp_attach_iommu(struct isp_d mapping =arm_iommu_create_mapping (&platform_bus_type,SZ_1G ,SZ_2G );if (IS_ERR (mapping)) {dev_err (isp->dev,"failed to create ARM IOMMU mapping\n" ); - ret =PTR_ERR (mapping); - goto error; +return PTR_ERR (mapping); } isp->mapping = mapping;
@@ -1977,7 +1977,8 @@ static int isp_attach_iommu(struct isp_dreturn 0 ; error: -isp_detach_iommu (isp); +arm_iommu_release_mapping (isp->mapping); + isp->mapping =NULL ;return ret; }
Greg Kroah-Hartman
maintainerPATCH 204/246 scsi: scsi_dh: replace too broad "TP9" string with the exact models
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xose Vazquez Perez <[email protected]>
[ Upstream commit 37b37d2609cb0ac267280ef27350b962d16d272e ]
SGI/TP9100 is not an RDAC array:
^^^
This partially reverts commit 35204772ea03 ("[SCSI] scsi_dh_rdac :
Consolidate rdac strings together")
[mkp: fixed up the new entries to align with rest of struct]
--- drivers/scsi/scsi_dh.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/scsi/scsi_dh.c +4 -1
@@ -58,7 +58,10 @@ static const struct scsi_dh_blist scsi_d {"IBM", "3526", "rdac", }, {"IBM", "3542", "rdac", }, {"IBM", "3552", "rdac", }, - {"SGI", "TP9", "rdac", }, + {"SGI", "TP9300", "rdac", }, + {"SGI", "TP9400", "rdac", }, + {"SGI", "TP9500", "rdac", }, + {"SGI", "TP9700", "rdac", }, {"SGI", "IS", "rdac", }, {"STK", "OPENstorage", "rdac", }, {"STK", "FLEXLINE 380", "rdac", },
Greg Kroah-Hartman
maintainerPATCH 210/246 ASoC: topology: Fix bclk and fsync inversion in set_link_hw_format()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kirill Marinushkin <[email protected]>
[ Upstream commit a941e2fab3207cb0d57dc4ec47b1b12c8ea78b84 ]
The values of bclk and fsync are inverted WRT the codec. But the existing solution already works for Broadwell, see the alsa-lib config:
alsa-lib/src/conf/topology/broadwell/broadwell.conf
This commit provides the backwards-compatible solution to fix this misuse.
--- include/uapi/sound/asoc.h | 16 ++++++++++++++-- sound/soc/soc-topology.c | 12 +++++++----- 2 files changed, 21 insertions(+), 7 deletions(-)
include/uapi/sound/asoc.h +14 -2
@@ -160,6 +160,18 @@#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2)#define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3) +/* DAI topology BCLK parameter +* For the backwards capability, by default codec is bclk master +*/ +#define SND_SOC_TPLG_BCLK_CM 0/* codec is bclk master */ +#define SND_SOC_TPLG_BCLK_CS 1/* codec is bclk slave */ + +/* DAI topology FSYNC parameter +* For the backwards capability, by default codec is fsync master +*/ +#define SND_SOC_TPLG_FSYNC_CM 0/* codec is fsync master */ +#define SND_SOC_TPLG_FSYNC_CS 1/* codec is fsync slave */ +/* * Block Header. * This header precedes all object and object arrays below.
@@ -315,8 +327,8 @@ struct snd_soc_tplg_hw_config {__u8 clock_gated;/* 1 if clock can be gated to save power */ __u8 invert_bclk;/* 1 for inverted BCLK, 0 for normal */ __u8 invert_fsync;/* 1 for inverted frame clock, 0 for normal */ -__u8 bclk_master;/* 1 for master of BCLK, 0 for slave */ -__u8 fsync_master;/* 1 for master of FSYNC, 0 for slave */ +__u8 bclk_master;/* SND_SOC_TPLG_BCLK_ value */ +__u8 fsync_master;/* SND_SOC_TPLG_FSYNC_ value */ __u8 mclk_direction;/* 0 for input, 1 for output */ __le16 reserved;/* for 32bit alignment */ __le32 mclk_rate;/* MCLK or SYSCLK freqency in Hz */
sound/soc/soc-topology.c +7 -5
@@ -2010,13 +2010,15 @@ static void set_link_hw_format(struct sn link->dai_fmt |=SND_SOC_DAIFMT_IB_IF ;/* clock masters */ - bclk_master = hw_config->bclk_master; - fsync_master = hw_config->fsync_master; -if (!bclk_master && !fsync_master) + bclk_master = (hw_config->bclk_master == +SND_SOC_TPLG_BCLK_CM ); + fsync_master = (hw_config->fsync_master == +SND_SOC_TPLG_FSYNC_CM ); +if (bclk_master && fsync_master) link->dai_fmt |=SND_SOC_DAIFMT_CBM_CFM ; -else if (bclk_master && !fsync_master) - link->dai_fmt |=SND_SOC_DAIFMT_CBS_CFM ;else if (!bclk_master && fsync_master) + link->dai_fmt |=SND_SOC_DAIFMT_CBS_CFM ; +else if (bclk_master && !fsync_master) link->dai_fmt |=SND_SOC_DAIFMT_CBM_CFS ;else link->dai_fmt |=SND_SOC_DAIFMT_CBS_CFS ;
Greg Kroah-Hartman
maintainerPATCH 211/246 ASoC: topology: Add missing clock gating parameter when parsing hw_configs
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kirill Marinushkin <[email protected]>
[ Upstream commit 933e1c4a667103c4d10ebdc9505a0a6abd8c3fbd ]
Clock gating parameter is a part of dai_fmt. It is supported by alsa-lib when creating a topology binary file, but ignored by kernel when loading this topology file.
After applying this commit, the clock gating parameter is not ignored any more. This solution is backwards compatible. The existing behaviour is not broken, because by default the parameter value is 0 and is ignored.
snd_soc_tplg_hw_config.clock_gated = 0 => no effect snd_soc_tplg_hw_config.clock_gated = 1 => SND_SOC_DAIFMT_GATED snd_soc_tplg_hw_config.clock_gated = 2 => SND_SOC_DAIFMT_CONT
For example, the following config, based on alsa-lib/src/conf/topology/broadwell/broadwell.conf, is now supported:
~~~~
SectionHWConfig."CodecHWConfig" {
id "1"
format "I2S" # physical audio format.
pm_gate_clocks "true" # clock can be gated
}
SectionLink."Codec" {
# used for binding to the physical link
id "0" hw_configs [
"CodecHWConfig"
]
default_hw_conf_id "1"
}~~~~
--- include/uapi/sound/asoc.h | 7 ++++++- sound/soc/soc-topology.c | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-)
include/uapi/sound/asoc.h +6 -1
@@ -139,6 +139,11 @@#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS (1 << 1)#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2) +/* DAI clock gating */ +#define SND_SOC_TPLG_DAI_CLK_GATE_UNDEFINED 0 +#define SND_SOC_TPLG_DAI_CLK_GATE_GATED 1 +#define SND_SOC_TPLG_DAI_CLK_GATE_CONT 2 +/* DAI physical PCM data formats. * Add new formats to the end of the list. */
@@ -324,7 +329,7 @@ struct snd_soc_tplg_hw_config {__le32 size;/* in bytes of this structure */ __le32 id;/* unique ID - - used to match */ __le32 fmt;/* SND_SOC_DAI_FORMAT_ format value */ -__u8 clock_gated;/* 1 if clock can be gated to save power */ +__u8 clock_gated;/* SND_SOC_TPLG_DAI_CLK_GATE_ value */ __u8 invert_bclk;/* 1 for inverted BCLK, 0 for normal */ __u8 invert_fsync;/* 1 for inverted frame clock, 0 for normal */ __u8 bclk_master;/* SND_SOC_TPLG_BCLK_ value */
sound/soc/soc-topology.c +7 -0
@@ -1997,6 +1997,13 @@ static void set_link_hw_format(struct sn link->dai_fmt = hw_config->fmt &SND_SOC_DAIFMT_FORMAT_MASK ; +/* clock gating */ +if (hw_config->clock_gated ==SND_SOC_TPLG_DAI_CLK_GATE_GATED ) + link->dai_fmt |=SND_SOC_DAIFMT_GATED ; +else if (hw_config->clock_gated == +SND_SOC_TPLG_DAI_CLK_GATE_CONT ) + link->dai_fmt |=SND_SOC_DAIFMT_CONT ; +/* clock signal polarity */ invert_bclk = hw_config->invert_bclk; invert_fsync = hw_config->invert_fsync;
Greg Kroah-Hartman
maintainerPATCH 214/246 drm/dp/mst: Fix off-by-one typo when dump payload table
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 7056a2bccc3b5afc51f9b35b30a46f0d9219968d ]
It seems there is a classical off-by-one typo from the beginning when commit
ad7f8a1f9ced ("drm/helper: add Displayport multi-stream helper (v0.6)")
introduced a new helper.
Fix a typo by introducing a macro constant.
--- drivers/gpu/drm/drm_dp_mst_topology.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +5 -4
@@ -2862,12 +2862,14 @@ static void drm_dp_mst_dump_mstb(struct } } +#define DP_PAYLOAD_TABLE_SIZE 64 +static bool dump_dp_payload_table (struct drm_dp_mst_topology_mgr *mgr,char *buf) {int i; -for (i =0 ; i <64 ; i +=16 ) { +for (i =0 ; i <DP_PAYLOAD_TABLE_SIZE ; i +=16 ) {if (drm_dp_dpcd_read (mgr->aux,DP_PAYLOAD_TABLE_UPDATE_STATUS + i, &buf[i],16 ) !=16 )
@@ -2936,7 +2938,7 @@ void drm_dp_mst_dump_topology(struct seqmutex_lock (&mgr->lock);if (mgr->mst_primary) { -u8 buf[64 ]; +u8 buf[DP_PAYLOAD_TABLE_SIZE ];int ret; ret =drm_dp_dpcd_read (mgr->aux,DP_DPCD_REV , buf,DP_RECEIVER_CAP_SIZE );
@@ -2954,8 +2956,7 @@ void drm_dp_mst_dump_topology(struct seqseq_printf (m," revision: hw: %x.%x sw: %x.%x\n" , buf[0x9 ] >>4 , buf[0x9 ] &0xf , buf[0xa ], buf[0xb ]);if (dump_dp_payload_table (mgr, buf)) -seq_printf (m,"payload table: %*ph\n" ,63 , buf); - +seq_printf (m,"payload table: %*ph\n" ,DP_PAYLOAD_TABLE_SIZE , buf); }mutex_unlock (&mgr->lock);
Greg Kroah-Hartman
maintainerPATCH 218/246 random: mix rdrand with entropy sent in from userspace
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 81e69df38e2911b642ec121dec319fad2a4782f3 upstream.
Fedora has integrated the jitter entropy daemon to work around slow boot problems, especially on VM's that don't support virtio-rng:
https://bugzilla.redhat.com/show_bug.cgi?id=1572944
It's understandable why they did this, but the Jitter entropy daemon works fundamentally on the principle: "the CPU microarchitecture is **so** complicated and we can't figure it out, so it *must* be random". Yes, it uses statistical tests to "prove" it is secure, but AES_ENCRYPT(NSA_KEY, COUNTER++) will also pass statistical tests with flying colors.
So if RDRAND is available, mix it into entropy submitted from userspace. It can't hurt, and if you believe the NSA has backdoored RDRAND, then they probably have enough details about the Intel microarchitecture that they can reverse engineer how the Jitter entropy daemon affects the microarchitecture, and attack its output stream. And if RDRAND is in fact an honest DRNG, it will immeasurably improve on what the Jitter entropy daemon might produce.
This also provides some protection against someone who is able to read or set the entropy seed file.
--- drivers/char/random.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/char/random.c +9 -1
@@ -1897,14 +1897,22 @@ static int write_pool(struct entropy_store *r, const char __user *buffer, size_t count) { size_t bytes; -__u32 buf[16 ]; +__u32 t, buf[16 ];const char __user *p = buffer;while (count >0 ) { +int b, i =0 ; + bytes =min (count,sizeof (buf));if (copy_from_user (&buf, p, bytes))return -EFAULT ; +for (b = bytes ; b >0 ; b -=sizeof (__u32), i++) { +if (!arch_get_random_int (&t)) +break ; + buf[i] ^= t; + } + count -= bytes; p += bytes;
Greg Kroah-Hartman
maintainerPATCH 220/246 ext4: fix inline data updates with checksums enabled
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 362eca70b53389bddf3143fe20f53dcce2cfdf61 upstream.
The inline data code was updating the raw inode directly; this is problematic since if metadata checksums are enabled, ext4_mark_inode_dirty() must be called to update the inode's checksum. In addition, the jbd2 layer requires that get_write_access() be called before the metadata buffer is modified. Fix both of these problems.
https://bugzilla.kernel.org/show_bug.cgi?id=200443
--- fs/ext4/inline.c | 19 +++++++++++-------- fs/ext4/inode.c | 16 +++++++--------- 2 files changed, 18 insertions(+), 17 deletions(-)
fs/ext4/inline.c +11 -8
@@ -688,6 +688,10 @@ int ext4_try_to_write_inline_data(struct goto convert; } + ret =ext4_journal_get_write_access (handle, iloc.bh); +if (ret) + goto out; + flags |=AOP_FLAG_NOFS ; page =grab_cache_page_write_begin (mapping,0 , flags);
@@ -716,7 +720,7 @@ int ext4_try_to_write_inline_data(struct out_up_read:up_read (&EXT4_I (inode)->xattr_sem); out: -if (handle) +if (handle && (ret !=1 ))ext4_journal_stop (handle);brelse (iloc.bh);return ret;
@@ -758,6 +762,7 @@ int ext4_write_inline_data_end(struct inext4_write_unlock_xattr (inode, &no_expand);brelse (iloc.bh); +mark_inode_dirty (inode); out:return copied; }
@@ -904,7 +909,6 @@ retry_journal: goto out; } - page =grab_cache_page_write_begin (mapping,0 , flags);if (!page) { ret = -ENOMEM ;
@@ -922,6 +926,9 @@ retry_journal:if (ret <0 ) goto out_release_page; } + ret =ext4_journal_get_write_access (handle, iloc.bh); +if (ret) + goto out_release_page;up_read (&EXT4_I (inode)->xattr_sem); *pagep = page;
@@ -942,7 +949,6 @@ int ext4_da_write_inline_data_end(struct unsigned len, unsigned copied, struct page *page) { - int i_size_changed = 0; int ret; ret =ext4_write_inline_data_end (inode, pos, len, copied, page);
@@ -960,10 +966,8 @@ int ext4_da_write_inline_data_end(struct* But it's important to update i_size while still holding page lock: * page writeout could otherwise come in and zero beyond i_size. */ -if (pos+copied > inode->i_size) { +if (pos+copied > inode->i_size)i_size_write (inode, pos+copied); - i_size_changed =1 ; - }unlock_page (page);put_page (page);
@@ -973,8 +977,7 @@ int ext4_da_write_inline_data_end(struct* ordering of page lock and transaction start for journaling * filesystems. */ -if (i_size_changed) -mark_inode_dirty (inode); +mark_inode_dirty (inode);return copied; }
fs/ext4/inode.c +7 -9
@@ -1388,9 +1388,10 @@ static int ext4_write_end(struct file *floff_t old_size = inode->i_size;int ret =0 , ret2;int i_size_changed =0 ; +int inline_data =ext4_has_inline_data (inode);trace_ext4_write_end (inode, pos, len, copied); -if (ext4_has_inline_data (inode)) { +if (inline_data) { ret =ext4_write_inline_data_end (inode, pos, len, copied, page);if (ret <0 ) {
@@ -1418,7 +1419,7 @@ static int ext4_write_end(struct file *f* ordering of page lock and transaction start for journaling * filesystems. */ -if (i_size_changed) +if (i_size_changed || inline_data)ext4_mark_inode_dirty (handle, inode);if (pos + len > inode->i_size &&ext4_can_truncate (inode))
@@ -1492,6 +1493,7 @@ static int ext4_journalled_write_end(strint partial =0 ;unsigned from, to;int size_changed =0 ; +int inline_data =ext4_has_inline_data (inode);trace_ext4_journalled_write_end (inode, pos, len, copied); from = pos & (PAGE_SIZE -1 );
@@ -1499,7 +1501,7 @@ static int ext4_journalled_write_end(strBUG_ON (!ext4_handle_valid (handle)); -if (ext4_has_inline_data (inode)) { +if (inline_data) { ret =ext4_write_inline_data_end (inode, pos, len, copied, page);if (ret <0 ) {
@@ -1530,7 +1532,7 @@ static int ext4_journalled_write_end(strif (old_size < pos)pagecache_isize_extended (inode, old_size, pos); -if (size_changed) { +if (size_changed || inline_data) { ret2 =ext4_mark_inode_dirty (handle, inode);if (!ret) ret = ret2;
@@ -2027,11 +2029,7 @@ static int __ext4_journalled_writepage(s }if (inline_data) { -BUFFER_TRACE (inode_bh,"get write access" ); - ret =ext4_journal_get_write_access (handle, inode_bh); - - err =ext4_handle_dirty_metadata (handle, inode, inode_bh); - + ret =ext4_mark_inode_dirty (handle, inode); }else { ret =ext4_walk_page_buffers (handle, page_bufs,0 , len,NULL , do_journal_get_write_access);
Greg Kroah-Hartman
maintainerPATCH 221/246 ext4: check for allocation block validity with block group locked
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 8d5a803c6a6ce4ec258e31f76059ea5153ba46ef upstream.
With commit 044e6e3d74a3: "ext4: don't update checksum of new initialized bitmaps" the buffer valid bit will get set without actually setting up the checksum for the allocation bitmap, since the checksum will get calculated once we actually allocate an inode or block.
If we are doing this, then we need to (re-)check the verified bit after we take the block group lock. Otherwise, we could race with another process reading and verifying the bitmap, which would then complain about the checksum being invalid.
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1780137
--- fs/ext4/balloc.c | 3 +++ fs/ext4/ialloc.c | 3 +++ 2 files changed, 6 insertions(+)
fs/ext4/balloc.c +3 -0
@@ -379,6 +379,8 @@ static int ext4_validate_block_bitmap(streturn -EFSCORRUPTED ;ext4_lock_group (sb, block_group); +if (buffer_verified (bh)) + goto verified;if (unlikely (!ext4_block_bitmap_csum_verify (sb, block_group, desc, bh))) {ext4_unlock_group (sb, block_group);
@@ -401,6 +403,7 @@ static int ext4_validate_block_bitmap(streturn -EFSCORRUPTED ; }set_buffer_verified (bh); +verified:ext4_unlock_group (sb, block_group);return 0 ; }
fs/ext4/ialloc.c +3 -0
@@ -91,6 +91,8 @@ static int ext4_validate_inode_bitmap(streturn -EFSCORRUPTED ;ext4_lock_group (sb, block_group); +if (buffer_verified (bh)) + goto verified; blk =ext4_inode_bitmap (sb, desc);if (!ext4_inode_bitmap_csum_verify (sb, block_group, desc, bh,EXT4_INODES_PER_GROUP (sb) /8 )) {
@@ -108,6 +110,7 @@ static int ext4_validate_inode_bitmap(streturn -EFSBADCRC ; }set_buffer_verified (bh); +verified:ext4_unlock_group (sb, block_group);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 223/246 PCI: pciehp: Assume NoCompl+ for Thunderbolt ports
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Wunner <[email protected]>
commit 493fb50e958c1c6deef7feff0b8c3855def78d75 upstream.
Certain Thunderbolt 1 controllers claim to support Command Completed events (value of 0b in the No Command Completed Support field of the Slot Capabilities register) but in reality they neither set the Command Completed bit in the Slot Status register nor signal a Command Completed interrupt:
8086:1513 CV82524 [Light Ridge 4C 2010] 8086:151a DSL2310 [Eagle Ridge 2C 2011] 8086:151b CVL2510 [Light Peak 2C 2010] 8086:1547 DSL3510 [Cactus Ridge 4C 2012] 8086:1548 DSL3310 [Cactus Ridge 2C 2012] 8086:1549 DSL2210 [Port Ridge 1C 2011]
All known newer chips (Redwood Ridge and onwards) set No Command Completed Support, indicating that they do not support Command Completed events.
The user-visible impact is that after unplugging such a device, 2 seconds elapse until pciehp is unbound. That's because on ->remove, pcie_write_cmd() is called via pcie_disable_notification() and every call to pcie_write_cmd() takes 2 seconds (1 second for each invocation of pcie_wait_cmd()):
[ 337.942727] pciehp 0000:0a:00.0:pcie204: Timeout on hotplug command 0x1038 (issued 21176 msec ago) [ 340.014735] pciehp 0000:0a:00.0:pcie204: Timeout on hotplug command 0x0000 (issued 2072 msec ago)
That by itself has always been unpleasant, but the situation has become worse with commit cc27b735ad3a ("PCI/portdrv: Turn off PCIe services during shutdown"): Now pciehp is unbound on ->shutdown. Because Thunderbolt controllers typically have 4 hotplug ports, every reboot and shutdown is now delayed by 8 seconds, plus another 2 seconds for every attached Thunderbolt 1 device.
Thunderbolt hotplug slots are not physical slots that one inserts cards into, but rather logical hotplug slots implemented in silicon. Devices appear beyond those logical slots once a PCI tunnel is established on top of the Thunderbolt Converged I/O switch. One would expect commands written to the Slot Control register to be executed immediately by the silicon, so for simplicity we always assume NoCompl+ for Thunderbolt ports.
--- drivers/pci/hotplug/pciehp_hpc.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/pci/hotplug/pciehp_hpc.c +7 -0
@@ -863,6 +863,13 @@ struct controller *pcie_init(struct pcieif (pdev->hotplug_user_indicators) slot_cap &= ~(PCI_EXP_SLTCAP_AIP |PCI_EXP_SLTCAP_PIP ); +/* +* We assume no Thunderbolt controllers support Command Complete events, +* but some controllers falsely claim they do. +*/ +if (pdev->is_thunderbolt) + slot_cap |=PCI_EXP_SLTCAP_NCCS ; + ctrl->slot_cap = slot_cap;mutex_init (&ctrl->ctrl_lock);init_waitqueue_head (&ctrl->queue);
Greg Kroah-Hartman
maintainerPATCH 225/246 ovl: Sync upper dirty data when syncing overlayfs
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengguang Xu <[email protected]>
commit e8d4bfe3a71537284a90561f77c85dea6c154369 upstream.
When executing filesystem sync or umount on overlayfs, dirty data does not get synced as expected on upper filesystem. This patch fixes sync filesystem method to keep data consistency for overlayfs.
--- fs/overlayfs/super.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
fs/overlayfs/super.c +15 -4
@@ -232,6 +232,7 @@ static void ovl_put_super(struct super_bkfree (ufs); } +/* Sync real dirty inodes in upper filesystem (if it exists) */ static int ovl_sync_fs (struct super_block *sb,int wait) {struct ovl_fs *ufs = sb->s_fs_info;
@@ -240,14 +241,24 @@ static int ovl_sync_fs(struct super_blocif (!ufs->upper_mnt)return 0 ; - upper_sb = ufs->upper_mnt->mnt_sb; -if (!upper_sb->s_op->sync_fs) + +/* +* If this is a sync(2) call or an emergency sync, all the super blocks +* will be iterated, including upper_sb, so no need to do anything. +* +* If this is a syncfs(2) call, then we do need to call +* sync_filesystem() on upper_sb, but enough if we do it when being +* called with wait == 1. +*/ +if (!wait)return 0 ; -/* real inodes have already been synced by sync_filesystem(ovl_sb) */ + upper_sb = ufs->upper_mnt->mnt_sb; +down_read (&upper_sb->s_umount); - ret = upper_sb->s_op->sync_fs (upper_sb, wait); + ret =sync_filesystem (upper_sb);up_read (&upper_sb->s_umount); +return ret; }
Greg Kroah-Hartman
maintainerPATCH 226/246 usb: gadget: udc: renesas_usb3: should remove debugfs
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yoshihiro Shimoda <[email protected]>
commit 1990cf7c21ea185cec98c6d45a82c04481261e35 upstream.
This patch fixes an issue that this driver doesn't remove its debugfs.
--- drivers/usb/gadget/udc/renesas_usb3.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/usb/gadget/udc/renesas_usb3.c +7 -1
@@ -334,6 +334,7 @@ struct renesas_usb3 {struct usb_gadget_driver *driver;struct extcon_dev *extcon;struct work_struct extcon_work; +struct dentry *dentry;struct renesas_usb3_ep *usb3_ep;int num_usb3_eps;
@@ -2397,8 +2398,12 @@ static void renesas_usb3_debugfs_init(st file =debugfs_create_file ("b_device" ,0644 , root, usb3, &renesas_usb3_b_device_fops); -if (!file) +if (!file) {dev_info (dev,"%s: Can't create debugfs mode\n" , __func__); +debugfs_remove_recursive (root); + }else { + usb3->dentry = root; + } }/*------- platform_driver ------------------------------------------------*/
@@ -2406,6 +2411,7 @@ static int renesas_usb3_remove(struct pl {struct renesas_usb3 *usb3 =platform_get_drvdata (pdev); +debugfs_remove_recursive (usb3->dentry);device_remove_file (&pdev->dev, &dev_attr_role);usb_del_gadget_udc (&usb3->gadget);
Greg Kroah-Hartman
maintainerPATCH 233/246 net: ena: Fix use of uninitialized DMA address bits field
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gal Pressman <[email protected]>
[ Upstream commit 101f0cd4f2216d32f1b8a75a2154cf3997484ee2 ]
UBSAN triggers the following undefined behaviour warnings:
[...]
[ 13.236124] UBSAN: Undefined behaviour in drivers/net/ethernet/amazon/ena/ena_eth_com.c:468:22 [ 13.240043] shift exponent 64 is too large for 64-bit type 'long long unsigned int' [...] [ 13.744769] UBSAN: Undefined behaviour in drivers/net/ethernet/amazon/ena/ena_eth_com.c:373:4 [ 13.748694] shift exponent 64 is too large for 64-bit type 'long long unsigned int'
[...]
When splitting the address to high and low, GENMASK_ULL is used to generate a bitmask with dma_addr_bits field from io_sq (in ena_com_prepare_tx and ena_com_add_single_rx_desc).
The problem is that dma_addr_bits is not initialized with a proper value (besides being cleared in ena_com_create_io_queue).
Assign dma_addr_bits the correct value that is stored in ena_dev when initializing the SQ.
--- drivers/net/ethernet/amazon/ena/ena_com.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/amazon/ena/ena_com.c +1 -0
@@ -331,6 +331,7 @@ static int ena_com_init_io_sq(struct enamemset (&io_sq->desc_addr,0x0 ,sizeof (io_sq->desc_addr)); + io_sq->dma_addr_bits = ena_dev->dma_addr_bits; io_sq->desc_entry_size = (io_sq->direction ==ENA_COM_IO_QUEUE_DIRECTION_TX ) ? sizeof(struct ena_eth_io_tx_desc) :
Greg Kroah-Hartman
maintainerPATCH 235/246 net: lan78xx: fix rx handling before first packet is send
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Wahren <[email protected]>
[ Upstream commit 136f55f660192ce04af091642efc75d85e017364 ]
As long the bh tasklet isn't scheduled once, no packet from the rx path will be handled. Since the tx path also schedule the same tasklet this situation only persits until the first packet transmission. So fix this issue by scheduling the tasklet after link reset.
--- drivers/net/usb/lan78xx.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/usb/lan78xx.c +2 -0
@@ -1216,6 +1216,8 @@ static int lan78xx_link_reset(struct lanmod_timer (&dev->stat_monitor, jiffies +STAT_UPDATE_TIMER ); } + +tasklet_schedule (&dev->bh); }return ret;
Greg Kroah-Hartman
maintainerPATCH 238/246 tcp_bbr: fix bw probing to raise in-flight data for very small BDPs
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Neal Cardwell <[email protected]>
[ Upstream commit 383d470936c05554219094a4d364d964cb324827 ]
For some very small BDPs (with just a few packets) there was a quantization effect where the target number of packets in flight during the super-unity-gain (1.25x) phase of gain cycling was implicitly truncated to a number of packets no larger than the normal unity-gain (1.0x) phase of gain cycling. This meant that in multi-flow scenarios some flows could get stuck with a lower bandwidth, because they did not push enough packets inflight to discover that there was more bandwidth available. This was really only an issue in multi-flow LAN scenarios, where RTTs and BDPs are low enough for this to be an issue.
This fix ensures that gain cycling can raise inflight for small BDPs by ensuring that in PROBE_BW mode target inflight values with a super-unity gain are always greater than inflight values with a gain <= 1. Importantly, this applies whether the inflight value is calculated for use as a cwnd value, or as a target inflight value for the end of the super-unity phase in bbr_is_next_cycle_phase() (both need to be bigger to ensure we can probe with more packets in flight reliably).
This is a candidate fix for stable releases.
--- net/ipv4/tcp_bbr.c | 4 ++++ 1 file changed, 4 insertions(+)
net/ipv4/tcp_bbr.c +4 -0
@@ -353,6 +353,10 @@ static u32 bbr_target_cwnd(struct sock */* Reduce delayed ACKs by rounding up cwnd to the next even number. */ cwnd = (cwnd +1 ) & ~1U ; +/* Ensure gain cycling gets inflight above BDP even for small BDPs. */ +if (bbr->mode ==BBR_PROBE_BW && gain >BBR_UNIT ) + cwnd +=2 ; +return cwnd; }
Greg Kroah-Hartman
maintainerPATCH 240/246 netlink: Do not subscribe to non-existent groups
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Safonov <[email protected]>
[ Upstream commit 7acf9d4237c46894e0fa0492dd96314a41742e84 ]
Make ABI more strict about subscribing to group > ngroups. Code doesn't check for that and it looks bogus.
(one can subscribe to non-existing group)
Still, it's possible to bind() to all possible groups with (-1)
--- net/netlink/af_netlink.c | 1 + 1 file changed, 1 insertion(+)
net/netlink/af_netlink.c +1 -0
@@ -976,6 +976,7 @@ static int netlink_bind(struct socket *sif (err)return err; } + groups &= (1UL << nlk->ngroups) -1 ; bound = nlk->bound;if (bound) {
Greg Kroah-Hartman
maintainerPATCH 242/246 tcp: do not force quickack when receiving out-of-order packets
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit a3893637e1eb0ef5eb1bbc52b3a8d2dfa317a35d ]
As explained in commit 9f9843a751d0 ("tcp: properly handle stretch acks in slow start"), TCP stacks have to consider how many packets are acknowledged in one single ACK, because of GRO, but also because of ACK compression or losses.
We plan to add SACK compression in the following patch, we must therefore not call tcp_enter_quickack_mode()
--- net/ipv4/tcp_input.c | 2 -- 1 file changed, 2 deletions(-)
net/ipv4/tcp_input.c +0 -2
@@ -4721,8 +4721,6 @@ drop:if (!before (TCP_SKB_CB (skb)->seq, tp->rcv_nxt +tcp_receive_window (tp))) goto out_of_window; -tcp_enter_quickack_mode (sk); -if (before (TCP_SKB_CB (skb)->seq, tp->rcv_nxt)) {/* Partial packet, seq < rcv_next < end_seq */ SOCK_DEBUG(sk, "partial packet: rcv_next %X seq %X - %X\n",
Greg Kroah-Hartman
maintainerPATCH 243/246 tcp: add max_quickacks param to tcp_incr_quickack and tcp_enter_quickack_mode
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 9a9c9b51e54618861420093ae6e9b50a961914c5 ]
We want to add finer control of the number of ACK packets sent after ECN events.
This patch is not changing current behavior, it only enables following change.
--- include/net/tcp.h | 2 +- net/ipv4/tcp_dctcp.c | 4 ++-- net/ipv4/tcp_input.c | 24 +++++++++++++----------- 3 files changed, 16 insertions(+), 14 deletions(-)
include/net/tcp.h +1 -1
@@ -372,7 +372,7 @@ ssize_t tcp_splice_read(struct socket *s struct pipe_inode_info *pipe, size_t len, unsigned int flags); -void tcp_enter_quickack_mode (struct sock *sk); +void tcp_enter_quickack_mode (struct sock *sk,unsigned int max_quickacks);static inline void tcp_dec_quickack_mode (struct sock *sk,const unsigned int pkts) {
net/ipv4/tcp_dctcp.c +2 -2
@@ -138,7 +138,7 @@ static void dctcp_ce_state_0_to_1(struct*/ if (inet_csk (sk)->icsk_ack.pending &ICSK_ACK_TIMER )__tcp_send_ack (sk, ca->prior_rcv_nxt); -tcp_enter_quickack_mode (sk); +tcp_enter_quickack_mode (sk,1 ); } ca->prior_rcv_nxt = tp->rcv_nxt;
@@ -159,7 +159,7 @@ static void dctcp_ce_state_1_to_0(struct*/ if (inet_csk (sk)->icsk_ack.pending &ICSK_ACK_TIMER )__tcp_send_ack (sk, ca->prior_rcv_nxt); -tcp_enter_quickack_mode (sk); +tcp_enter_quickack_mode (sk,1 ); } ca->prior_rcv_nxt = tp->rcv_nxt;
net/ipv4/tcp_input.c +13 -11
@@ -198,21 +198,23 @@ static void tcp_measure_rcv_mss(struct s } } -static void tcp_incr_quickack (struct sock *sk) +static void tcp_incr_quickack (struct sock *sk,unsigned int max_quickacks) {struct inet_connection_sock *icsk =inet_csk (sk);unsigned int quickacks =tcp_sk (sk)->rcv_wnd / (2 * icsk->icsk_ack.rcv_mss);if (quickacks ==0 ) quickacks =2 ; + quickacks =min (quickacks, max_quickacks);if (quickacks > icsk->icsk_ack.quick) - icsk->icsk_ack.quick =min (quickacks,TCP_MAX_QUICKACKS ); + icsk->icsk_ack.quick = quickacks; } -void tcp_enter_quickack_mode (struct sock *sk) +void tcp_enter_quickack_mode (struct sock *sk,unsigned int max_quickacks) {struct inet_connection_sock *icsk =inet_csk (sk); -tcp_incr_quickack (sk); + +tcp_incr_quickack (sk, max_quickacks); icsk->icsk_ack.pingpong =0 ; icsk->icsk_ack.ato =TCP_ATO_MIN ; }
@@ -257,7 +259,7 @@ static void __tcp_ecn_check_ce(struct tc* it is probably a retransmit. */ if (tp->ecn_flags &TCP_ECN_SEEN ) -tcp_enter_quickack_mode ((struct sock *)tp); +tcp_enter_quickack_mode ((struct sock *)tp,TCP_MAX_QUICKACKS );break ;case INET_ECN_CE :if (tcp_ca_needs_ecn ((struct sock *)tp))
@@ -265,7 +267,7 @@ static void __tcp_ecn_check_ce(struct tcif (!(tp->ecn_flags &TCP_ECN_DEMAND_CWR )) {/* Better not delay acks, sender can have a very low cwnd */ -tcp_enter_quickack_mode ((struct sock *)tp); +tcp_enter_quickack_mode ((struct sock *)tp,TCP_MAX_QUICKACKS ); tp->ecn_flags |=TCP_ECN_DEMAND_CWR ; } tp->ecn_flags |=TCP_ECN_SEEN ;
@@ -686,7 +688,7 @@ static void tcp_event_data_recv(struct s/* The _first_ data packet received, initialize * delayed ACK engine. */ -tcp_incr_quickack (sk); +tcp_incr_quickack (sk,TCP_MAX_QUICKACKS ); icsk->icsk_ack.ato =TCP_ATO_MIN ; }else {int m = now - icsk->icsk_ack.lrcvtime;
@@ -702,7 +704,7 @@ static void tcp_event_data_recv(struct s/* Too long gap. Apparently sender failed to * restart window, so that we send ACKs quickly. */ -tcp_incr_quickack (sk); +tcp_incr_quickack (sk,TCP_MAX_QUICKACKS );sk_mem_reclaim (sk); } }
@@ -4160,7 +4162,7 @@ static void tcp_send_dupack(struct sockif (TCP_SKB_CB (skb)->end_seq !=TCP_SKB_CB (skb)->seq &&before (TCP_SKB_CB (skb)->seq, tp->rcv_nxt)) {NET_INC_STATS (sock_net (sk),LINUX_MIB_DELAYEDACKLOST ); -tcp_enter_quickack_mode (sk); +tcp_enter_quickack_mode (sk,TCP_MAX_QUICKACKS );if (tcp_is_sack (tp) && sysctl_tcp_dsack) {u32 end_seq =TCP_SKB_CB (skb)->end_seq;
@@ -4710,7 +4712,7 @@ queue_and_out:tcp_dsack_set (sk,TCP_SKB_CB (skb)->seq,TCP_SKB_CB (skb)->end_seq); out_of_window: -tcp_enter_quickack_mode (sk); +tcp_enter_quickack_mode (sk,TCP_MAX_QUICKACKS );inet_csk_schedule_ack (sk); drop:tcp_drop (sk, skb);
@@ -5791,7 +5793,7 @@ static int tcp_rcv_synsent_state_process* to stand against the temptation 8) --ANK */ inet_csk_schedule_ack (sk); -tcp_enter_quickack_mode (sk); +tcp_enter_quickack_mode (sk,TCP_MAX_QUICKACKS );inet_csk_reset_xmit_timer (sk,ICSK_TIME_DACK ,TCP_DELACK_MAX ,TCP_RTO_MAX );
Greg Kroah-Hartman
maintainerPATCH 245/246 tcp: refactor tcp_ecn_check_ce to remove sk type cast
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yousuk Seung <[email protected]>
[ Upstream commit f4c9f85f3b2cb7669830cd04d0be61192a4d2436 ]
Refactor tcp_ecn_check_ce and __tcp_ecn_check_ce to accept struct sock* instead of tcp_sock* to clean up type casts. This is a pure refactor patch.
--- net/ipv4/tcp_input.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
net/ipv4/tcp_input.c +14 -12
@@ -250,8 +250,10 @@ static void tcp_ecn_withdraw_cwr(struct tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR ; } -static void __tcp_ecn_check_ce (struct tcp_sock *tp,const struct sk_buff *skb) +static void __tcp_ecn_check_ce (struct sock *sk,const struct sk_buff *skb) { +struct tcp_sock *tp =tcp_sk (sk); +switch (TCP_SKB_CB (skb)->ip_dsfield &INET_ECN_MASK ) {case INET_ECN_NOT_ECT :/* Funny extension: if ECT is not set on a segment,
@@ -259,31 +261,31 @@ static void __tcp_ecn_check_ce(struct tc* it is probably a retransmit. */ if (tp->ecn_flags &TCP_ECN_SEEN ) -tcp_enter_quickack_mode ((struct sock *)tp,1 ); +tcp_enter_quickack_mode (sk,1 );break ;case INET_ECN_CE : -if (tcp_ca_needs_ecn ((struct sock *)tp)) -tcp_ca_event ((struct sock *)tp,CA_EVENT_ECN_IS_CE ); +if (tcp_ca_needs_ecn (sk)) +tcp_ca_event (sk,CA_EVENT_ECN_IS_CE );if (!(tp->ecn_flags &TCP_ECN_DEMAND_CWR )) {/* Better not delay acks, sender can have a very low cwnd */ -tcp_enter_quickack_mode ((struct sock *)tp,1 ); +tcp_enter_quickack_mode (sk,1 ); tp->ecn_flags |=TCP_ECN_DEMAND_CWR ; } tp->ecn_flags |=TCP_ECN_SEEN ;break ;default : -if (tcp_ca_needs_ecn ((struct sock *)tp)) -tcp_ca_event ((struct sock *)tp,CA_EVENT_ECN_NO_CE ); +if (tcp_ca_needs_ecn (sk)) +tcp_ca_event (sk,CA_EVENT_ECN_NO_CE ); tp->ecn_flags |=TCP_ECN_SEEN ;break ; } } -static void tcp_ecn_check_ce (struct tcp_sock *tp,const struct sk_buff *skb) +static void tcp_ecn_check_ce (struct sock *sk,const struct sk_buff *skb) { -if (tp->ecn_flags &TCP_ECN_OK ) -__tcp_ecn_check_ce (tp, skb); +if (tcp_sk (sk)->ecn_flags &TCP_ECN_OK ) +__tcp_ecn_check_ce (sk, skb); }static void tcp_ecn_rcv_synack (struct tcp_sock *tp,const struct tcphdr *th)
@@ -710,7 +712,7 @@ static void tcp_event_data_recv(struct s } icsk->icsk_ack.lrcvtime = now; -tcp_ecn_check_ce (tp, skb); +tcp_ecn_check_ce (sk, skb);if (skb->len >=128 )tcp_grow_window (sk, skb);
@@ -4443,7 +4445,7 @@ static void tcp_data_queue_ofo(struct sou32 seq, end_seq;bool fragstolen; -tcp_ecn_check_ce (tp, skb); +tcp_ecn_check_ce (sk, skb);if (unlikely (tcp_try_rmem_schedule (sk, skb, skb->truesize))) {NET_INC_STATS (sock_net (sk),LINUX_MIB_TCPOFODROP );
Greg Kroah-Hartman
maintainerPATCH 246/246 tcp: add one more quick ack after after ECN events
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 15ecbe94a45ef88491ca459b26efdd02f91edb6d ]
Larry Brakmo proposal ( https://patchwork.ozlabs.org/patch/935233/
tcp: force cwnd at least 2 in tcp_cwnd_reduction) made us rethink about our recent patch removing ~16 quick acks after ECN events.
tcp_enter_quickack_mode(sk, 1) makes sure one immediate ack is sent, but in the case the sender cwnd was lowered to 1, we do not want to have a delayed ack for the next packet we will receive.
--- net/ipv4/tcp_input.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/tcp_input.c +2 -2
@@ -261,7 +261,7 @@ static void __tcp_ecn_check_ce(struct so* it is probably a retransmit. */ if (tp->ecn_flags &TCP_ECN_SEEN ) -tcp_enter_quickack_mode (sk,1 ); +tcp_enter_quickack_mode (sk,2 );break ;case INET_ECN_CE :if (tcp_ca_needs_ecn (sk))
@@ -269,7 +269,7 @@ static void __tcp_ecn_check_ce(struct soif (!(tp->ecn_flags &TCP_ECN_DEMAND_CWR )) {/* Better not delay acks, sender can have a very low cwnd */ -tcp_enter_quickack_mode (sk,1 ); +tcp_enter_quickack_mode (sk,2 ); tp->ecn_flags |=TCP_ECN_DEMAND_CWR ; } tp->ecn_flags |=TCP_ECN_SEEN ;
Greg Kroah-Hartman
maintainerPATCH 68/246 selftests: memfd: return Kselftest Skip code for skipped tests
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Shuah Khan (Samsung OSG)" <[email protected]>
[ Upstream commit b27f0259e8cea74c627327c063742a83613dd460 ]
When memfd test is skipped because of unmet dependencies and/or unsupported configuration, it returns non-zero value which is treated as a fail by the Kselftest framework. This leads to false negative result even when the test could not be run.
Change it to return kselftest skip code when a test gets skipped to clearly report that the test could not be run.
Added an explicit check for root user at the start of memfd hugetlbfs test and return skip code if a non-root user attempts to run it.
In addition, return skip code when not enough huge pages are available to run the test.
Kselftest framework SKIP code is 4 and the framework prints appropriate messages to indicate that the test is skipped.
--- tools/testing/selftests/memfd/run_tests.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
tools/testing/selftests/memfd/run_tests.sh +9 -5
@@ -1,6 +1,9 @@ #!/bin/bash # please run as root +# Kselftest framework requirement - SKIP code is 4. +ksft_skip=4 + # # Normal tests requiring no special resources #
@@ -29,12 +32,13 @@ if [ -n "$freepgs" ] && [ $freepgs -lt $ nr_hugepgs=`cat /proc/sys/vm/nr_hugepages` hpages_needed=`expr $hpages_test - $freepgs` + if [ $UID != 0 ]; then + echo "Please run memfd with hugetlbfs test as root" + exit $ksft_skip + fi + echo 3 > /proc/sys/vm/drop_caches echo $(( $hpages_needed + $nr_hugepgs )) > /proc/sys/vm/nr_hugepages - if [ $? -ne 0 ]; then - echo "Please run this test as root" - exit 1 - fi while read name size unit; do if [ "$name" = "HugePages_Free:" ]; then freepgs=$size
@@ -53,7 +57,7 @@ if [ $freepgs -lt $hpages_test ]; then fi printf "Not enough huge pages available (%d < %d)\n" \ $freepgs $needpgs - exit 1 + exit $ksft_skip fi #
Greg Kroah-Hartman
maintainerPATCH 69/246 selftests: intel_pstate: return Kselftest Skip code for skipped tests
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Shuah Khan (Samsung OSG)" <[email protected]>
[ Upstream commit 5c30a038fb8ec8cdff011e6b5d5d51eb415381d4 ]
When intel_pstate test is skipped because of unmet dependencies and/or unsupported configuration, it returns 0 which is treated as a pass by the Kselftest framework. This leads to false positive result even when the test could not be run.
Change it to return kselftest skip code when a test gets skipped to clearly report that the test could not be run.
Kselftest framework SKIP code is 4 and the framework prints appropriate messages to indicate that the test is skipped.
--- tools/testing/selftests/intel_pstate/run.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/testing/selftests/intel_pstate/run.sh +4 -1
@@ -30,9 +30,12 @@ EVALUATE_ONLY=0 +# Kselftest framework requirement - SKIP code is 4. +ksft_skip=4 + if ! uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ | grep -q x86; then echo "$0 # Skipped: Test can only run on x86 architectures." - exit 0 + exit $ksft_skip fi max_cpus=$(($(nproc)-1))
Greg Kroah-Hartman
maintainerPATCH 70/246 PCI: Fix devm_pci_alloc_host_bridge() memory leak
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kiszka <[email protected]>
[ Upstream commit 3bbce531788719749520f28052cabdef16af6b16 ]
Fix a memory leak by freeing the PCI resource list in devm_pci_release_host_bridge_dev().
--- drivers/pci/probe.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/probe.c +3 -1
@@ -516,12 +516,14 @@ static void devm_pci_release_host_bridgeif (bridge->release_fn) bridge->release_fn (bridge); + +pci_free_resource_list (&bridge->windows); }static void pci_release_host_bridge_dev (struct device *dev) {devm_pci_release_host_bridge_dev (dev); -pci_free_host_bridge (to_pci_host_bridge (dev)); +kfree (to_pci_host_bridge (dev)); }struct pci_host_bridge *pci_alloc_host_bridge (size_t priv)
Greg Kroah-Hartman
maintainerPATCH 61/246 f2fs: fix race in between GC and atomic open
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit 27319ba4044c0c67d62ae39e53c0118c89f0a029 ]
Thread GC thread
- f2fs_ioc_start_atomic_write
- get_dirty_pages
- filemap_write_and_wait_range
- f2fs_gc
- do_garbage_collect
- gc_data_segment
- move_data_page
- f2fs_is_atomic_file
- set_page_dirty
- set_inode_flag(, FI_ATOMIC_FILE)
Dirty data page can still be generated by GC in race condition as above call stack.
This patch adds fi->dio_rwsem[WRITE] in f2fs_ioc_start_atomic_write to avoid such race.
--- fs/f2fs/file.c | 3 +++ 1 file changed, 3 insertions(+)
fs/f2fs/file.c +3 -0
@@ -1630,6 +1630,8 @@ static int f2fs_ioc_start_atomic_write(sinode_lock (inode); +down_write (&F2FS_I (inode)->dio_rwsem[WRITE ]); +if (f2fs_is_atomic_file (inode)) goto out;
@@ -1659,6 +1661,7 @@ inc_stat:stat_inc_atomic_write (inode);stat_update_max_atomic_write (inode); out: +up_write (&F2FS_I (inode)->dio_rwsem[WRITE ]);inode_unlock (inode);mnt_drop_write_file (filp);return ret;
Greg Kroah-Hartman
maintainerPATCH 105/246 spi: sh-msiof: Fix setting SIRMDR1.SYNCAC to match SITMDR1.SYNCAC
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 0921e11e1e12802ae0a3c19cb02e33354ca51967 ]
According to section 59.2.4 MSIOF Receive Mode Register 1 (SIRMDR1) in the R-Car Gen3 datasheet Rev.1.00, the value of the SIRMDR1.SYNCAC bit must match the value of the SITMDR1.SYNCAC bit. However, sh_msiof_spi_setup() changes only the latter.
Fix this by updating the SIRMDR1 register like the SITMDR1 register, taking into account register bits that exist in SITMDR1 only.
--- drivers/spi/spi-sh-msiof.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/spi/spi-sh-msiof.c +4 -2
@@ -555,14 +555,16 @@ static int sh_msiof_spi_setup(struct spi/* Configure native chip select mode/polarity early */ clr =MDR1_SYNCMD_MASK ; - set =MDR1_TRMD |TMDR1_PCON |MDR1_SYNCMD_SPI ; + set =MDR1_SYNCMD_SPI ;if (spi->mode &SPI_CS_HIGH ) clr |=BIT (MDR1_SYNCAC_SHIFT );else set |=BIT (MDR1_SYNCAC_SHIFT );pm_runtime_get_sync (&p->pdev->dev); tmp =sh_msiof_read (p,TMDR1 ) & ~clr; -sh_msiof_write (p,TMDR1 , tmp | set); +sh_msiof_write (p,TMDR1 , tmp | set |MDR1_TRMD |TMDR1_PCON ); + tmp =sh_msiof_read (p,RMDR1 ) & ~clr; +sh_msiof_write (p,RMDR1 , tmp | set);pm_runtime_put (&p->pdev->dev); p->native_cs_high = spi->mode &SPI_CS_HIGH ; p->native_cs_inited = true;
Greg Kroah-Hartman
maintainerPATCH 115/246 net: hns3: Fix the missing client list node initialization
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xi Wang <[email protected]>
[ Upstream commit 13562d1f5e2fbe2cf33b23a00abca3f71264c4ac ]
This patch fixes the missing initialization of the client list node in the hnae3_register_client() function.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c +2 -0
@@ -2883,6 +2883,8 @@ static int __init hns3_init_module(void) client.ops = &client_ops; +INIT_LIST_HEAD (&client.node); + ret =hnae3_register_client (&client);if (ret)return ret;
Greg Kroah-Hartman
maintainerPATCH 116/246 fscrypt: use unbound workqueue for decryption
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
[ Upstream commit 36dd26e0c8d42699eeba87431246c07c28075bae ]
Improve fscrypt read performance by switching the decryption workqueue from bound to unbound. With the bound workqueue, when multiple bios completed on the same CPU, they were decrypted on that same CPU. But with the unbound queue, they are now decrypted in parallel on any CPU.
Although fscrypt read performance can be tough to measure due to the many sources of variation, this change is most beneficial when decryption is slow, e.g. on CPUs without AES instructions. For example, I timed tarring up encrypted directories on f2fs. On x86 with AES-NI instructions disabled, the unbound workqueue improved performance by about 25-35%, using 1 to NUM_CPUs jobs with 4 or 8 CPUs available. But with AES-NI enabled, performance was unchanged to within ~2%.
I also did the same test on a quad-core ARM CPU using xts-speck128-neon encryption. There performance was usually about 10% better with the unbound workqueue, bringing it closer to the unencrypted speed.
The unbound workqueue may be worse in some cases due to worse locality, but I think it's still the better default. dm-crypt uses an unbound workqueue by default too, so this change makes fscrypt match.
--- fs/crypto/crypto.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
fs/crypto/crypto.c +10 -1
@@ -446,8 +446,17 @@ fail:*/ static int __init fscrypt_init (void ) { +/* +* Use an unbound workqueue to allow bios to be decrypted in parallel +* even when they happen to complete on the same CPU. This sacrifices +* locality, but it's worthwhile since decryption is CPU-intensive. +* +* Also use a high-priority workqueue to prioritize decryption work, +* which blocks reads from completing, over regular application tasks. +*/ fscrypt_read_workqueue =alloc_workqueue ("fscrypt_read_queue" , -WQ_HIGHPRI ,0 ); +WQ_UNBOUND |WQ_HIGHPRI , +num_online_cpus ());if (!fscrypt_read_workqueue) goto fail;
Greg Kroah-Hartman
maintainerPATCH 119/246 scsi: zfcp: assert that the ERP lock is held when tracing a recovery trigger
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Remus <[email protected]>
[ Upstream commit 9e156c54ace310ce7fb1cd960e62416947f3d47c ]
Otherwise iterating with list_for_each() over the adapter->erp_ready_head and adapter->erp_running_head lists can lead to an infinite loop. See commit "zfcp: fix infinite iteration on erp_ready_head list".
The run-time check is only performed for debug kernels which have the kernel lock validator enabled. Following is an example of the warning that is reported, if the ERP lock is not held when calling zfcp_dbf_rec_trig():
WARNING: CPU: 0 PID: 604 at drivers/s390/scsi/zfcp_dbf.c:288 zfcp_dbf_rec_trig+0x172/0x188
Modules linked in: ...
CPU: 0 PID: 604 Comm: kworker/u128:3 Not tainted 4.16.0-... #1
Hardware name: IBM 2964 N96 702 (z/VM 6.4.0)
Workqueue: zfcp_q_0.0.1906 zfcp_scsi_rport_work
Krnl PSW : 00000000330fdbf9 00000000367e9728 (zfcp_dbf_rec_trig+0x172/0x188)
R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:3 PM:0 RI:0 EA:3
Krnl GPRS: 00000000c57a5d99 3288200000000000 0000000000000000 000000006cc82740
00000000009d09d6 0000000000000000 00000000000000ff 0000000000000000
0000000000000000 0000000000e1b5fe 000000006de01d38 0000000076130958
000000006cc82548 000000006de01a98 00000000009d09d6 000000006a6d3c80
Krnl Code: 00000000009d0ad2: eb7ff0b80004 lmg %r7,%r15,184(%r15)
00000000009d0ad8: c0f4000d7dd0 brcl 15,b80678
#00000000009d0ade: a7f40001 brc 15,9d0ae0
>00000000009d0ae2: a7f4ff7d brc 15,9d09dc
00000000009d0ae6: e340f0f00004 lg %r4,240(%r15)
00000000009d0aec: eb7ff0b80004 lmg %r7,%r15,184(%r15)
00000000009d0af2: 07f4 bcr 15,%r4
00000000009d0af4: 0707 bcr 0,%r7
Call Trace:
([<00000000009d09d6>] zfcp_dbf_rec_trig+0x66/0x188)
[<00000000009dd740>] zfcp_scsi_rport_work+0x98/0x190
[<0000000000169b34>] process_one_work+0x3d4/0x6f8
[<000000000016a08a>] worker_thread+0x232/0x418
[<000000000017219e>] kthread+0x166/0x178
[<0000000000b815ea>] kernel_thread_starter+0x6/0xc
[<0000000000b815e4>] kernel_thread_starter+0x0/0xc
2 locks held by kworker/u128:3/604:
#0: ((wq_completion)name){+.+.}, at: [<0000000082af1024>] process_one_work+0x1dc/0x6f8
#1: ((work_completion)(&port->rport_work)){+.+.}, at: [<0000000082af1024>] process_one_work+0x1dc/0x6f8
Last Breaking-Event-Address:
[<00000000009d0ade>] zfcp_dbf_rec_trig+0x16e/0x188
---[ end trace b2f4020572e2c124 ]------ drivers/s390/scsi/zfcp_dbf.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/s390/scsi/zfcp_dbf.c +2 -0
@@ -285,6 +285,8 @@ void zfcp_dbf_rec_trig(char *tag, structstruct list_head *entry;unsigned long flags; +lockdep_assert_held (&adapter->erp_lock); +if (unlikely (!debug_level_enabled (dbf->rec, level)))return ;
Greg Kroah-Hartman
maintainerPATCH 120/246 drm/nouveau/fifo/gk104-: poll for runlist update completion
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Skeggs <[email protected]>
[ Upstream commit 4f2fc25c0f8bcc8db1b8a7b21e88c3d7f35c5acb ]
Newer HW doesn't appear to send this event, which will cause long delays in runlist updates if they don't complete immediately.
RM doesn't use these events anywhere, and an NVGPU commit message notes that polling is the preferred method even on HW that supports the event.
--- drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c +4 -4
@@ -155,10 +155,10 @@ gk104_fifo_runlist_commit(struct gk104_f (target << 28));nvkm_wr32 (device,0x002274 , (runl <<20 ) | nr); -if (wait_event_timeout (fifo->runlist[runl].wait, - !(nvkm_rd32 (device,0x002284 + (runl *0x08 )) - &0x00100000 ), -msecs_to_jiffies (2000 )) ==0 ) +if (nvkm_msec (device,2000 , + if (!(nvkm_rd32(device, 0x002284 + (runl * 0x08)) & 0x00100000)) + break; + ) <0 )nvkm_error (subdev,"runlist %d update timeout\n" , runl); unlock:mutex_unlock (&subdev->mutex);
Greg Kroah-Hartman
maintainerPATCH 121/246 Bluetooth: btusb: add ID for LiteOn 04ca:301a
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vic Wei <[email protected]>
[ Upstream commit d666fc5479ad76a1bcbe6476d4997cea714bab2d ]
Contains a QCA6174A chipset, with USB BT. Let's support loading firmware on it.
Quoted 1 line
From usb-devices:
T: Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 0 D: Ver= 2.01 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=04ca ProdID=301a Rev= 0.01
C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
--- drivers/bluetooth/btusb.c | 1 + 1 file changed, 1 insertion(+)
drivers/bluetooth/btusb.c +1 -0
@@ -279,6 +279,7 @@ static const struct usb_device_id blackl { USB_DEVICE(0x04ca, 0x3011), .driver_info = BTUSB_QCA_ROME }, { USB_DEVICE(0x04ca, 0x3015), .driver_info = BTUSB_QCA_ROME }, { USB_DEVICE(0x04ca, 0x3016), .driver_info = BTUSB_QCA_ROME }, + { USB_DEVICE(0x04ca, 0x301a), .driver_info = BTUSB_QCA_ROME }, /* Broadcom BCM2035 */ { USB_DEVICE(0x0a5c, 0x2009), .driver_info = BTUSB_BCM92035 },
Greg Kroah-Hartman
maintainerPATCH 122/246 rtc: tps6586x: fix possible race condition
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Belloni <[email protected]>
[ Upstream commit 63d22063073b0ab46d1e06fe633fb5de8f5c58e1 ]
The probe function is not allowed to fail after the RTC is registered because the following may happen:
CPU0: CPU1:sys_load_module()
do_init_module()
do_one_initcall()
cmos_do_probe()
rtc_device_register()
__register_chrdev()
cdev->owner = struct module*
open("/dev/rtc0")
rtc_device_unregister()
module_put()
free_module()
module_free(mod->module_core)
/* struct module *module is now
freed */
chrdev_open()
spin_lock(cdev_lock)
cdev_get()
try_module_get()
module_is_live()
/* dereferences already
freed struct module* */--- drivers/rtc/rtc-tps6586x.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/rtc/rtc-tps6586x.c +11 -3
@@ -276,14 +276,15 @@ static int tps6586x_rtc_probe(struct pladevice_init_wakeup (&pdev->dev,1 );platform_set_drvdata (pdev, rtc); - rtc->rtc =devm_rtc_device_register (&pdev->dev,dev_name (&pdev->dev), - &tps6586x_rtc_ops,THIS_MODULE ); + rtc->rtc =devm_rtc_allocate_device (&pdev->dev);if (IS_ERR (rtc->rtc)) { ret =PTR_ERR (rtc->rtc); -dev_err (&pdev->dev,"RTC device register: ret %d\n" , ret); +dev_err (&pdev->dev,"RTC allocate device: ret %d\n" , ret); goto fail_rtc_register; } + rtc->rtc->ops = &tps6586x_rtc_ops; + ret = devm_request_threaded_irq(&pdev->dev, rtc->irq, NULL, tps6586x_rtc_irq, IRQF_ONESHOT,
@@ -294,6 +295,13 @@ static int tps6586x_rtc_probe(struct pla goto fail_rtc_register; }disable_irq (rtc->irq); + + ret =rtc_register_device (rtc->rtc); +if (ret) { +dev_err (&pdev->dev,"RTC device register: ret %d\n" , ret); + goto fail_rtc_register; + } +return 0 ; fail_rtc_register:
Greg Kroah-Hartman
maintainerPATCH 123/246 rtc: vr41xx: fix possible race condition
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Belloni <[email protected]>
[ Upstream commit 9a99247c9c1d1c95c6e8153d013979aac6111c6e ]
The probe function is not allowed to fail after the RTC is registered because the following may happen:
CPU0: CPU1:sys_load_module()
do_init_module()
do_one_initcall()
cmos_do_probe()
rtc_device_register()
__register_chrdev()
cdev->owner = struct module*
open("/dev/rtc0")
rtc_device_unregister()
module_put()
free_module()
module_free(mod->module_core)
/* struct module *module is now
freed */
chrdev_open()
spin_lock(cdev_lock)
cdev_get()
try_module_get()
module_is_live()
/* dereferences already
freed struct module* */--- drivers/rtc/rtc-vr41xx.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/rtc/rtc-vr41xx.c +7 -2
@@ -292,13 +292,14 @@ static int rtc_probe(struct platform_dev goto err_rtc1_iounmap; } - rtc =devm_rtc_device_register (&pdev->dev, rtc_name, &vr41xx_rtc_ops, -THIS_MODULE ); + rtc =devm_rtc_allocate_device (&pdev->dev);if (IS_ERR (rtc)) { retval =PTR_ERR (rtc); goto err_iounmap_all; } + rtc->ops = &vr41xx_rtc_ops; + rtc->max_user_freq =MAX_PERIODIC_RATE ;spin_lock_irq (&rtc_lock);
@@ -340,6 +341,10 @@ static int rtc_probe(struct platform_devdev_info (&pdev->dev,"Real Time Clock of NEC VR4100 series\n" ); + retval =rtc_register_device (rtc); +if (retval) + goto err_iounmap_all; +return 0 ; err_iounmap_all:
Greg Kroah-Hartman
maintainerPATCH 127/246 md/raid1: add error handling of read error from FailFast device
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gioh Kim <[email protected]>
[ Upstream commit b33d10624fdc15cdf1495f3f00481afccec76783 ]
Current handle_read_error() function calls fix_read_error() only if md device is RW and rdev does not include FailFast flag. It does not handle a read error from a RW device including FailFast flag.
I am not sure it is intended. But I found that write IO error sets rdev faulty. The md module should handle the read IO error and write IO error equally. So I think read IO error should set rdev faulty.
--- drivers/md/raid1.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/md/raid1.c +2 -0
@@ -2462,6 +2462,8 @@ static void handle_read_error(struct r1cfix_read_error (conf, r1_bio->read_disk, r1_bio->sector, r1_bio->sectors);unfreeze_array (conf); + }else if (mddev->ro ==0 &&test_bit (FailFast, &rdev->flags)) { +md_error (mddev, rdev); }else { r1_bio->bios[r1_bio->read_disk] =IO_BLOCKED ; }
Greg Kroah-Hartman
maintainerPATCH 131/246 net: ethernet: ti: cpsw-phy-sel: check bus_find_device() ret value
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Grygorii Strashko <[email protected]>
[ Upstream commit c6213eb1aee308e67377fd1890d84f7284caf531 ]
This fixes klockworks warnings: Pointer 'dev' returned from call to function 'bus_find_device' at line 179 may be NULL and will be dereferenced at line 181.
cpsw-phy-sel.c:179: 'dev' is assigned the return value from function 'bus_find_device'. bus.c:342: 'bus_find_device' explicitly returns a NULL value. cpsw-phy-sel.c:181: 'dev' is dereferenced by passing argument 1 to function 'dev_get_drvdata'. device.h:1024: 'dev' is passed to function 'dev_get_drvdata'.
device.h:1026: 'dev' is explicitly dereferenced.
--- drivers/net/ethernet/ti/cpsw-phy-sel.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/ethernet/ti/cpsw-phy-sel.c +7 -1
@@ -177,12 +177,18 @@ void cpsw_phy_sel(struct device *dev, ph } dev =bus_find_device (&platform_bus_type,NULL , node, match); -of_node_put (node); +if (!dev) { +dev_err (dev,"unable to find platform device for %pOF\n" , node); + goto out; + } + priv =dev_get_drvdata (dev); priv->cpsw_phy_sel (priv, phy_mode, slave);put_device (dev); +out: +of_node_put (node); }EXPORT_SYMBOL_GPL (cpsw_phy_sel);
Greg Kroah-Hartman
maintainerPATCH 132/246 ALSA: usb-audio: Apply rate limit to warning messages in URB complete callback
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 377a879d9832f4ba69bd6a1fc996bb4181b1e504 ]
retire_capture_urb() may print warning messages when the given URB doesn't align, and this may flood the system log easily. Put the rate limit to the message for avoiding it.
Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1093485
--- sound/usb/pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/pcm.c +1 -1
@@ -1311,7 +1311,7 @@ static void retire_capture_urb(struct snif (bytes % (runtime->sample_bits >>3 ) !=0 ) {int oldbytes = bytes; bytes = frames * stride; -dev_warn (&subs->dev->dev, +dev_warn_ratelimited (&subs->dev->dev,"Corrected urb data len. %d->%d\n" , oldbytes, bytes); }
Greg Kroah-Hartman
maintainerPATCH 107/246 pinctrl: at91-pio4: add missing of_node_put
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julia Lawall <[email protected]>
[ Upstream commit 21816364715f508c10da1e087e352bc1e326614f ]
The device node iterators perform an of_node_get on each iteration, so a jump out of the loop requires an of_node_put.
The semantic patch that fixes this problem is as follows
(http://coccinelle.lip6.fr):
// <smpl>
@@
expression root,e;
local idexpression child;
iterator name for_each_child_of_node;
@@
for_each_child_of_node(root, child) {
... when != of_node_put(child)
when != e = child
+ of_node_put(child);
? break;
...
}
... when != child
// </smpl>
--- drivers/pinctrl/pinctrl-at91-pio4.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pinctrl/pinctrl-at91-pio4.c +3 -1
@@ -576,8 +576,10 @@ static int atmel_pctl_dt_node_to_map(strfor_each_child_of_node (np_config, np) { ret =atmel_pctl_dt_subnode_to_map (pctldev, np, map, &reserved_maps, num_maps); -if (ret <0 ) +if (ret <0 ) { +of_node_put (np);break ; + } } }
Greg Kroah-Hartman
maintainerPATCH 134/246 arm64: cmpwait: Clear event register before arming exclusive monitor
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
[ Upstream commit 1cfc63b5ae60fe7e01773f38132f98d8b13a99a0 ]
When waiting for a cacheline to change state in cmpwait, we may immediately wake-up the first time around the outer loop if the event register was already set (for example, because of the event stream).
Avoid these spurious wakeups by explicitly clearing the event register before loading the cacheline and setting the exclusive monitor.
--- arch/arm64/include/asm/cmpxchg.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm64/include/asm/cmpxchg.h +3 -1
@@ -229,7 +229,9 @@ static inline void __cmpwait_case_##nameunsigned long tmp; \ \ asm volatile( \ - " ldxr" #sz "\t%" #w "[tmp], %[v]\n" \ + " sevl\n" \ + " wfe\n" \ + " ldxr" #sz "\t%" #w "[tmp], %[v]\n" \ " eor %" #w "[tmp], %" #w "[tmp], %" #w "[val]\n" \ " cbnz %" #w "[tmp], 1f\n" \ " wfe\n" \
Greg Kroah-Hartman
maintainerPATCH 135/246 HID: hid-plantronics: Re-resend Update to map button for PTT products
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Terry Junge <[email protected]>
[ Upstream commit 37e376df5f4993677c33968a0c19b0c5acbf1108 ]
Add a mapping for Push-To-Talk joystick trigger button.
Tested on ChromeBox/ChromeBook with various Plantronics devices.
--- drivers/hid/hid-plantronics.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/hid/hid-plantronics.c +5 -1
@@ -2,7 +2,7 @@* Plantronics USB HID Driver * * Copyright (c) 2014 JD Cole <[email protected]> -* Copyright (c) 2015 Terry Junge <[email protected]> +* Copyright (c) 2015-2018 Terry Junge <[email protected]> */ /*
@@ -48,6 +48,10 @@ static int plantronics_input_mapping(strunsigned short mapped_key;unsigned long plt_type = (unsigned long )hid_get_drvdata (hdev); +/* special case for PTT products */ +if (field->application ==HID_GD_JOYSTICK ) + goto defaulted; +/* handle volume up/down mapping */ /* non-standard types or multi-HID interfaces - plt_type is PID */ if (!(plt_type &HID_USAGE_PAGE )) {
Greg Kroah-Hartman
maintainerPATCH 136/246 arm64: dts: renesas: salvator-common: use audio-graph-card for Sound
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuninori Morimoto <[email protected]>
[ Upstream commit 06a574c7ef69bd0bd26ed08e35967acb76622ab3 ]
Current Sound is using simple-audio-card which can't support HDMI. To use HDMI sound, we need to use audio-graph-card. But, one note is that r8a7795 has 2 HDMI ports, but r8a7796 has 1. Because of this mismatch, supporting HDMI on salvator-common is impossible.
Thus, this patch exchange sound card to audio-graph-card and keep supporting ak4613 as 1st sound node.
r8a7795/r8a7796 salvator-x{s} need to add HDMI sound individually.
--- arch/arm64/boot/dts/renesas/salvator-common.dtsi | 38 +++++++++++++---------- 1 file changed, 22 insertions(+), 16 deletions(-)
arch/arm64/boot/dts/renesas/salvator-common.dtsi +22 -16
@@ -93,20 +93,12 @@ regulator-always-on; }; - rsnd_ak4613: sound { - compatible = "simple-audio-card"; + sound_card: sound { + compatible = "audio-graph-card"; - simple-audio-card,format = "left_j"; - simple-audio-card,bitclock-master = <&sndcpu>; - simple-audio-card,frame-master = <&sndcpu>; + label = "rcar-sound"; - sndcpu: simple-audio-card,cpu { - sound-dai = <&rcar_sound>; - }; - - sndcodec: simple-audio-card,codec { - sound-dai = <&ak4613>; - }; + dais = <&rsnd_port0>; }; vbus0_usb2: regulator-vbus0-usb2 {
@@ -320,6 +312,12 @@ asahi-kasei,out4-single-end; asahi-kasei,out5-single-end; asahi-kasei,out6-single-end; + + port { + ak4613_endpoint: endpoint { + remote-endpoint = <&rsnd_endpoint0>; + }; + }; }; cs2000: clk_multiplier@4f {
@@ -538,10 +536,18 @@ <&audio_clk_c>, <&cpg CPG_CORE CPG_AUDIO_CLK_I>; - rcar_sound,dai { - dai0 { - playback = <&ssi0 &src0 &dvc0>; - capture = <&ssi1 &src1 &dvc1>; + ports { + rsnd_port0: port@0 { + rsnd_endpoint0: endpoint { + remote-endpoint = <&ak4613_endpoint>; + + dai-format = "left_j"; + bitclock-master = <&rsnd_endpoint0>; + frame-master = <&rsnd_endpoint0>; + + playback = <&ssi0 &src0 &dvc0>; + capture = <&ssi1 &src1 &dvc1>; + }; }; }; };
Greg Kroah-Hartman
maintainerPATCH 140/246 HID: i2c-hid: check if device is there before really probing
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <[email protected]>
[ Upstream commit b3a81b6c4fc6730ac49e20d789a93c0faabafc98 ]
On many Chromebooks touch devices are multi-sourced; the components are electrically compatible and one can be freely swapped for another without changing the OS image or firmware.
To avoid bunch of scary messages when device is not actually present in the system let's try testing basic communication with it and if there is no response terminate probe early with -ENXIO.
--- drivers/hid/i2c-hid/i2c-hid.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/hid/i2c-hid/i2c-hid.c +8 -0
@@ -1036,6 +1036,14 @@ static int i2c_hid_probe(struct i2c_cliepm_runtime_enable (&client->dev);device_enable_async_suspend (&client->dev); +/* Make sure there is something at this address */ + ret =i2c_smbus_read_byte (client); +if (ret <0 ) { +dev_dbg (&client->dev,"nothing at this address: %d\n" , ret); + ret = -ENXIO ; + goto err_pm; + } + ret =i2c_hid_fetch_hid_descriptor (ihid);if (ret <0 ) goto err_pm;
Greg Kroah-Hartman
maintainerPATCH 142/246 ARM: dts: stih407-pinctrl: Fix complain about IRQ_TYPE_NONE usage
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Patrice Chotard <[email protected]>
[ Upstream commit e95b8e718f9bd2386a29639dd21c633b4951dc21 ]
Since commit 83a86fbb5b56 ("irqchip/gic: Loudly complain about the use of IRQ_TYPE_NONE") kernel is complaining about the IRQ_TYPE_NONE usage which shouldn't
be used.
Use IRQ_TYPE_LEVEL_HIGH instead.
--- arch/arm/boot/dts/stih407-pinctrl.dtsi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm/boot/dts/stih407-pinctrl.dtsi +5 -5
@@ -52,7 +52,7 @@ st,syscfg = <&syscfg_sbc>; reg = <0x0961f080 0x4>; reg-names = "irqmux"; - interrupts = <GIC_SPI 188 IRQ_TYPE_NONE>; + interrupts = <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "irqmux"; ranges = <0 0x09610000 0x6000>;
@@ -376,7 +376,7 @@ st,syscfg = <&syscfg_front>; reg = <0x0920f080 0x4>; reg-names = "irqmux"; - interrupts = <GIC_SPI 189 IRQ_TYPE_NONE>; + interrupts = <GIC_SPI 189 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "irqmux"; ranges = <0 0x09200000 0x10000>;
@@ -936,7 +936,7 @@ st,syscfg = <&syscfg_front>; reg = <0x0921f080 0x4>; reg-names = "irqmux"; - interrupts = <GIC_SPI 190 IRQ_TYPE_NONE>; + interrupts = <GIC_SPI 190 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "irqmux"; ranges = <0 0x09210000 0x10000>;
@@ -969,7 +969,7 @@ st,syscfg = <&syscfg_rear>; reg = <0x0922f080 0x4>; reg-names = "irqmux"; - interrupts = <GIC_SPI 191 IRQ_TYPE_NONE>; + interrupts = <GIC_SPI 191 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "irqmux"; ranges = <0 0x09220000 0x6000>;
@@ -1164,7 +1164,7 @@ st,syscfg = <&syscfg_flash>; reg = <0x0923f080 0x4>; reg-names = "irqmux"; - interrupts = <GIC_SPI 192 IRQ_TYPE_NONE>; + interrupts = <GIC_SPI 192 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "irqmux"; ranges = <0 0x09230000 0x3000>;
Greg Kroah-Hartman
maintainerPATCH 143/246 ARM: dts: emev2: Add missing interrupt-affinity to PMU node
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 7207b94754b6f503b278b5b200faaf662ffa1da8 ]
The PMU node references two interrupts, but lacks the interrupt-affinity property, which is required in that case:
hw perfevents: no interrupt-affinity property for /pmu, guessing.
Add the missing property to fix this.
--- arch/arm/boot/dts/emev2.dtsi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/arm/boot/dts/emev2.dtsi +3 -2
@@ -31,13 +31,13 @@ #address-cells = <1>; #size-cells = <0>; - cpu@0 { + cpu0: cpu@0 { device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <0>; clock-frequency = <533000000>; }; - cpu@1 { + cpu1: cpu@1 { device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <1>;
@@ -57,6 +57,7 @@ compatible = "arm,cortex-a9-pmu"; interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>; + interrupt-affinity = <&cpu0>, <&cpu1>; }; clocks@e0110000 {
Greg Kroah-Hartman
maintainerPATCH 144/246 ARM: dts: sh73a0: Add missing interrupt-affinity to PMU node
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 57a66497e1b7486609250a482f05935eae5035e9 ]
The PMU node references two interrupts, but lacks the interrupt-affinity property, which is required in that case:
hw perfevents: no interrupt-affinity property for /pmu, guessing.
Add the missing property to fix this.
--- arch/arm/boot/dts/sh73a0.dtsi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/arm/boot/dts/sh73a0.dtsi +3 -2
@@ -22,7 +22,7 @@ #address-cells = <1>; #size-cells = <0>; - cpu@0 { + cpu0: cpu@0 { device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <0>;
@@ -30,7 +30,7 @@ power-domains = <&pd_a2sl>; next-level-cache = <&L2>; }; - cpu@1 { + cpu1: cpu@1 { device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <1>;
@@ -89,6 +89,7 @@ compatible = "arm,cortex-a9-pmu"; interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>; + interrupt-affinity = <&cpu0>, <&cpu1>; }; cmt1: timer@e6138000 {
Greg Kroah-Hartman
maintainerPATCH 145/246 nvmem: properly handle returned value nvmem_reg_read
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathieu Malaterre <[email protected]>
[ Upstream commit 50808bfcc14b854775a9f1d0abe3dac2babcf5c3 ]
Function nvmem_reg_read can return a non zero value indicating an error. This returned value must be read and error propagated to nvmem_cell_prepare_write_buffer. Silence the following gcc warning (W=1):
drivers/nvmem/core.c:1093:9: warning: variable 'rc' set but
not used [-Wunused-but-set-variable]
--- drivers/nvmem/core.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/nvmem/core.c +7 -0
@@ -1049,6 +1049,8 @@ static inline void *nvmem_cell_prepare_w/* setup the first byte with lsb bits from nvmem */ rc =nvmem_reg_read (nvmem, cell->offset, &v,1 ); +if (rc) + goto err; *b++ |=GENMASK (bit_offset -1 ,0 ) & v;/* setup rest of the byte if any */
@@ -1067,11 +1069,16 @@ static inline void *nvmem_cell_prepare_w/* setup the last byte with msb bits from nvmem */ rc =nvmem_reg_read (nvmem, cell->offset + cell->bytes -1 , &v,1 ); +if (rc) + goto err; *p |=GENMASK (7 , (nbits + bit_offset) %BITS_PER_BYTE ) & v; }return buf; +err: +kfree (buf); +return ERR_PTR (rc); }/**
Greg Kroah-Hartman
maintainerPATCH 109/246 PCI: pciehp: Request control of native hotplug only if supported
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mika Westerberg <[email protected]>
[ Upstream commit 408fec36a1ab3d14273c2116b449ef1e9be3cb8b ]
Currently we request control of native PCIe hotplug unconditionally. Native PCIe hotplug events are handled by the pciehp driver, and if it is not enabled those events will be lost.
Request control of native PCIe hotplug only if the pciehp driver is enabled, so we will actually handle native PCIe hotplug events.
--- drivers/acpi/pci_root.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/acpi/pci_root.c +3 -1
@@ -472,9 +472,11 @@ static void negotiate_os_control(struct } control =OSC_PCI_EXPRESS_CAPABILITY_CONTROL - |OSC_PCI_EXPRESS_NATIVE_HP_CONTROL |OSC_PCI_EXPRESS_PME_CONTROL ; +if (IS_ENABLED (CONFIG_HOTPLUG_PCI_PCIE )) + control |=OSC_PCI_EXPRESS_NATIVE_HP_CONTROL ; +if (pci_aer_available ()) {if (aer_acpi_firmware_first ()) dev_info(&device->dev,
Greg Kroah-Hartman
maintainerPATCH 112/246 ima: based on policy verify firmware signatures (pre-allocated buffer)
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mimi Zohar <[email protected]>
[ Upstream commit fd90bc559bfba743ae8de87ff23b92a5e4668062 ]
Don't differentiate, for now, between kernel_read_file_id READING_FIRMWARE and READING_FIRMWARE_PREALLOC_BUFFER enumerations.
--- security/integrity/ima/ima_main.c | 1 + 1 file changed, 1 insertion(+)
security/integrity/ima/ima_main.c +1 -0
@@ -379,6 +379,7 @@ int ima_read_file(struct file *file, enustatic int read_idmap[READING_MAX_ID ] = { [READING_FIRMWARE ] =FIRMWARE_CHECK , + [READING_FIRMWARE_PREALLOC_BUFFER ] =FIRMWARE_CHECK , [READING_MODULE ] =MODULE_CHECK , [READING_KEXEC_IMAGE ] =KEXEC_KERNEL_CHECK , [READING_KEXEC_INITRAMFS ] =KEXEC_INITRAMFS_CHECK ,
Greg Kroah-Hartman
maintainerPATCH 147/246 tty: Fix data race in tty_insert_flip_string_fixed_flag
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: DaeRyong Jeong <[email protected]>
[ Upstream commit b6da31b2c07c46f2dcad1d86caa835227a16d9ff ]
Unlike normal serials, in pty layer, there is no guarantee that multiple threads don't insert input characters at the same time. If it is happened, tty_insert_flip_string_fixed_flag can be executed concurrently. This can lead slab out-of-bounds write in tty_insert_flip_string_fixed_flag.
Call sequences are as follows.
CPU0 CPU1 n_tty_ioctl_helper n_tty_ioctl_helper __start_tty tty_send_xchar tty_wakeup pty_write n_hdlc_tty_wakeup tty_insert_flip_string n_hdlc_send_frames tty_insert_flip_string_fixed_flag
pty_writetty_insert_flip_stringtty_insert_flip_string_fixed_flag
To fix the race, acquire port->lock in pty_write() before it inserts input characters to tty buffer. It prevents multiple threads from inserting input characters concurrently.
The crash log is as follows:
BUG: KASAN: slab-out-of-bounds in tty_insert_flip_string_fixed_flag+0xb5/ 0x130 drivers/tty/tty_buffer.c:316 at addr ffff880114fcc121 Write of size 1792 by task syz-executor0/30017 CPU: 1 PID: 30017 Comm: syz-executor0 Not tainted 4.8.0 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
BIOS rel-1.8.2-0-g33fbe13 by qemu-project.org 04/01/2014
0000000000000000 ffff88011638f888 ffffffff81694cc3 ffff88007d802140 ffff880114fcb300 ffff880114fcc300 ffff880114fcb300 ffff88011638f8b0 ffffffff8130075c ffff88011638f940 ffff88007d802140 ffff880194fcc121
Call Trace: __dump_stack lib/dump_stack.c:15 [inline] dump_stack+0xb3/0x110 lib/dump_stack.c:51 kasan_object_err+0x1c/0x70 mm/kasan/report.c:156 print_address_description mm/kasan/report.c:194 [inline] kasan_report_error+0x1f7/0x4e0 mm/kasan/report.c:283 kasan_report+0x36/0x40 mm/kasan/report.c:303 check_memory_region_inline mm/kasan/kasan.c:292 [inline] check_memory_region+0x13e/0x1a0 mm/kasan/kasan.c:299 memcpy+0x37/0x50 mm/kasan/kasan.c:335 tty_insert_flip_string_fixed_flag+0xb5/0x130 drivers/tty/tty_buffer.c:316 tty_insert_flip_string include/linux/tty_flip.h:35 [inline] pty_write+0x7f/0xc0 drivers/tty/pty.c:115 n_hdlc_send_frames+0x1d4/0x3b0 drivers/tty/n_hdlc.c:419 n_hdlc_tty_wakeup+0x73/0xa0 drivers/tty/n_hdlc.c:496 tty_wakeup+0x92/0xb0 drivers/tty/tty_io.c:601 __start_tty.part.26+0x66/0x70 drivers/tty/tty_io.c:1018 __start_tty+0x34/0x40 drivers/tty/tty_io.c:1013 n_tty_ioctl_helper+0x146/0x1e0 drivers/tty/tty_ioctl.c:1138 n_hdlc_tty_ioctl+0xb3/0x2b0 drivers/tty/n_hdlc.c:794 tty_ioctl+0xa85/0x16d0 drivers/tty/tty_io.c:2992 vfs_ioctl fs/ioctl.c:43 [inline] do_vfs_ioctl+0x13e/0xba0 fs/ioctl.c:679 SYSC_ioctl fs/ioctl.c:694 [inline] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:685 entry_SYSCALL_64_fastpath+0x1f/0xbd
--- drivers/tty/pty.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/tty/pty.c +3 -0
@@ -110,16 +110,19 @@ static void pty_unthrottle(struct tty_ststatic int pty_write (struct tty_struct *tty,const unsigned char *buf,int c) {struct tty_struct *to = tty->link; +unsigned long flags;if (tty->stopped)return 0 ;if (c >0 ) { +spin_lock_irqsave (&to->port->lock, flags);/* Stuff the data into the input queue of the other end */ c =tty_insert_flip_string (to->port, buf, c);/* And shovel */ if (c)tty_flip_buffer_push (to->port); +spin_unlock_irqrestore (&to->port->lock, flags); }return c; }
Greg Kroah-Hartman
maintainerPATCH 156/246 brcmfmac: Add support for bcm43364 wireless chipset
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Lanigan <[email protected]>
[ Upstream commit 9c4a121e82634aa000a702c98cd6f05b27d6e186 ]
Add support for the BCM43364 chipset via an SDIO interface, as used in e.g. the Murata 1FX module.
The BCM43364 uses the same firmware as the BCM43430 (which is already included), the only difference is the omission of Bluetooth.
However, the SDIO_ID for the BCM43364 is 02D0:A9A4, giving it a MODALIAS of sdio:c00v02D0dA9A4, which doesn't get recognised and hence doesn't load the brcmfmac module. Adding the 'A9A4' ID in the appropriate place triggers the brcmfmac driver to load, and then correctly use the firmware file 'brcmfmac43430-sdio.bin'.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 1 + include/linux/mmc/sdio_ids.h | 1 + 2 files changed, 2 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +1 -0
@@ -1098,6 +1098,7 @@ static const struct sdio_device_id brcmfBRCMF_SDIO_DEVICE (SDIO_DEVICE_ID_BROADCOM_43340 ),BRCMF_SDIO_DEVICE (SDIO_DEVICE_ID_BROADCOM_43341 ),BRCMF_SDIO_DEVICE (SDIO_DEVICE_ID_BROADCOM_43362 ), +BRCMF_SDIO_DEVICE (SDIO_DEVICE_ID_BROADCOM_43364 ),BRCMF_SDIO_DEVICE (SDIO_DEVICE_ID_BROADCOM_4335_4339 ),BRCMF_SDIO_DEVICE (SDIO_DEVICE_ID_BROADCOM_4339 ), BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43430),
include/linux/mmc/sdio_ids.h +1 -0
@@ -35,6 +35,7 @@#define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335#define SDIO_DEVICE_ID_BROADCOM_4339 0x4339#define SDIO_DEVICE_ID_BROADCOM_43362 0xa962 +#define SDIO_DEVICE_ID_BROADCOM_43364 0xa9a4#define SDIO_DEVICE_ID_BROADCOM_43430 0xa9a6#define SDIO_DEVICE_ID_BROADCOM_4345 0x4345#define SDIO_DEVICE_ID_BROADCOM_43455 0xa9bf
Greg Kroah-Hartman
maintainerPATCH 158/246 perf: fix invalid bit in diagnostic entry
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Richter <[email protected]>
[ Upstream commit 3c0a83b14ea71fef5ccc93a3bd2de5f892be3194 ]
The s390 CPU measurement facility sampling mode supports basic entries and diagnostic entries. Each entry has a valid bit to indicate the status of the entry as valid or invalid.
This bit is bit 31 in the diagnostic entry, but the bit mask definition refers to bit 30.
Fix this by making the reserved field one bit larger.
--- arch/s390/include/asm/cpu_mf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/include/asm/cpu_mf.h +1 -1
@@ -116,7 +116,7 @@ struct hws_basic_entry {struct hws_diag_entry {unsigned int def:16 ;/* 0-15 Data Entry Format */ -unsigned int R:14 ;/* 16-19 and 20-30 reserved */ +unsigned int R:15 ;/* 16-19 and 20-30 reserved */ unsigned int I:1 ;/* 31 entry valid or invalid */ u8 data[];/* Machine-dependent sample data */ } __packed;
Greg Kroah-Hartman
maintainerPATCH 159/246 bnxt_en: Check unsupported speeds in bnxt_update_link() on PF only.
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Chan <[email protected]>
[ Upstream commit dac0490718bd17df5e3995ffca14255e5f9ed22d ]
Only non-NPAR PFs need to actively check and manage unsupported link speeds. NPAR functions and VFs do not control the link speed and should skip the unsupported speed detection logic, to avoid warning messages from firmware rejecting the unsupported firmware calls.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +3 -0
@@ -5927,6 +5927,9 @@ static int bnxt_update_link(struct bnxt }mutex_unlock (&bp->hwrm_cmd_lock); +if (!BNXT_SINGLE_PF (bp)) +return 0 ; + diff = link_info->support_auto_speeds ^ link_info->advertising;if ((link_info->support_auto_speeds | diff) != link_info->support_auto_speeds) {
Greg Kroah-Hartman
maintainerPATCH 160/246 scsi: 3w-9xxx: fix a missing-check bug
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wenwen Wang <[email protected]>
[ Upstream commit c9318a3e0218bc9dacc25be46b9eec363259536f ]
In twa_chrdev_ioctl(), the ioctl driver command is firstly copied from the userspace pointer 'argp' and saved to the kernel object 'driver_command'. Then a security check is performed on the data buffer size indicated by 'driver_command', which is 'driver_command.buffer_length'. If the security check is passed, the entire ioctl command is copied again from the 'argp' pointer and saved to the kernel object 'tw_ioctl'. Then, various operations are performed on 'tw_ioctl' according to the 'cmd'. Given that the 'argp' pointer resides in userspace, a malicious userspace process can race to change the buffer size between the two copies. This way, the user can bypass the security check and inject invalid data buffer size. This can cause potential security issues in the following execution.
This patch checks for capable(CAP_SYS_ADMIN) in twa_chrdev_open()t o avoid the above issues.
--- drivers/scsi/3w-9xxx.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/scsi/3w-9xxx.c +5 -0
@@ -886,6 +886,11 @@ static int twa_chrdev_open(struct inodeunsigned int minor_number;int retval =TW_IOCTL_ERROR_OS_ENODEV ; +if (!capable (CAP_SYS_ADMIN )) { + retval = -EACCES ; + goto out; + } + minor_number =iminor (inode);if (minor_number >= twa_device_extension_count) goto out;
Greg Kroah-Hartman
maintainerPATCH 161/246 scsi: 3w-xxxx: fix a missing-check bug
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wenwen Wang <[email protected]>
[ Upstream commit 9899e4d3523faaef17c67141aa80ff2088f17871 ]
In tw_chrdev_ioctl(), the length of the data buffer is firstly copied from the userspace pointer 'argp' and saved to the kernel object 'data_buffer_length'. Then a security check is performed on it to make sure that the length is not more than 'TW_MAX_IOCTL_SECTORS * 512'. Otherwise, an error code -EINVAL is returned. If the security check is passed, the entire ioctl command is copied again from the 'argp' pointer and saved to the kernel object 'tw_ioctl'. Then, various operations are performed on 'tw_ioctl' according to the 'cmd'. Given that the 'argp' pointer resides in userspace, a malicious userspace process can race to change the buffer length between the two copies. This way, the user can bypass the security check and inject invalid data buffer length. This can cause potential security issues in the following execution.
This patch checks for capable(CAP_SYS_ADMIN) in tw_chrdev_open() to avoid the above issues.
--- drivers/scsi/3w-xxxx.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/scsi/3w-xxxx.c +3 -0
@@ -1033,6 +1033,9 @@ static int tw_chrdev_open(struct inode *dprintk (KERN_WARNING "3w-xxxx: tw_ioctl_open()\n" ); +if (!capable (CAP_SYS_ADMIN )) +return -EACCES ; + minor_number =iminor (inode);if (minor_number >= tw_device_extension_count)return -ENODEV ;
Greg Kroah-Hartman
maintainerPATCH 163/246 scsi: hisi_sas: config ATA de-reset as an constrained command for v3 hw
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiang Chen <[email protected]>
[ Upstream commit 9413532788df7470297dd0475995c5dc5b07f362 ]
As a unconstrained command, a command can be sent to SATA disk even if SATA disk status is BUSY, ERR or DRQ.
If an ATA reset assert is successful but ATA reset de-assert fails, then it will retry the reset de-assert. If reset de- assert retry is successful, we think it is okay to probe the device but actually it still has Err status.
Apparently we need to retry the ATA reset assertion and de- assertion instead for this mentioned scenario.
As such, we config ATA reset assert as a constrained command, if ATA reset de-assert fails, then ATA reset de-assert retry will also fail. Then we will retry the proper process of ATA reset assert and de-assert again.
--- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +6 -5
@@ -328,10 +328,11 @@ enum {#define DIR_TO_DEVICE 2#define DIR_RESERVED 3 -#define CMD_IS_UNCONSTRAINT (cmd) \ - ((cmd == ATA_CMD_READ_LOG_EXT) || \ - (cmd == ATA_CMD_READ_LOG_DMA_EXT) || \ - (cmd == ATA_CMD_DEV_RESET)) +#define FIS_CMD_IS_UNCONSTRAINED (fis) \ + ((fis.command == ATA_CMD_READ_LOG_EXT) || \ + (fis.command == ATA_CMD_READ_LOG_DMA_EXT) || \ + ((fis.command == ATA_CMD_DEV_RESET) && \ + ((fis.control & ATA_SRST) != 0)))static u32 hisi_sas_read32 (struct hisi_hba *hisi_hba,u32 off) {
@@ -1044,7 +1045,7 @@ static int prep_ata_v3_hw(struct hisi_hb << CMD_HDR_FRAME_TYPE_OFF; dw1 |= sas_dev->device_id <<CMD_HDR_DEV_ID_OFF ; -if (CMD_IS_UNCONSTRAINT (task->ata_task.fis.command)) +if (FIS_CMD_IS_UNCONSTRAINED (task->ata_task.fis)) dw1 |=1 <<CMD_HDR_UNCON_CMD_OFF ; hdr->dw1 =cpu_to_le32 (dw1);
Greg Kroah-Hartman
maintainerPATCH 165/246 staging: lustre: o2iblnd: fix race at kiblnd_connect_peer
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Doug Oucahrek <[email protected]>
[ Upstream commit cf04968efe341b9b1c30a527e5dd61b2af9c43d2 ]
cmid will be destroyed at OFED if kiblnd_cm_callback return error. if error happen before the end of kiblnd_connect_peer, it will touch destroyed cmid and fail as (o2iblnd_cb.c:1315:kiblnd_connect_peer())
ASSERTION( cmid->device != ((void *)0) ) failed:
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-10015
--- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 18 +++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +12 -6
@@ -1289,11 +1289,6 @@ kiblnd_connect_peer(struct kib_peer *pee goto failed2; } -LASSERT (cmid->device); -CDEBUG (D_NET ,"%s: connection bound to %s:%pI4h:%s\n" , -libcfs_nid2str (peer->ibp_nid), dev->ibd_ifname, - &dev->ibd_ifip, cmid->device->name); -return ; failed2:
@@ -2995,8 +2990,19 @@ kiblnd_cm_callback(struct rdma_cm_id *cm }else { rc =rdma_resolve_route ( cmid, *kiblnd_tunables.kib_timeout *1000 ); -if (!rc) +if (!rc) { +struct kib_net *net = peer->ibp_ni->ni_data; +struct kib_dev *dev = net->ibn_dev; + +CDEBUG (D_NET ,"%s: connection bound to " \ +"%s:%pI4h:%s\n" , +libcfs_nid2str (peer->ibp_nid), + dev->ibd_ifname, + &dev->ibd_ifip, cmid->device->name); +return 0 ; + } +/* Can't initiate route resolution */ CERROR ("Can't resolve route for %s: %d\n" ,libcfs_nid2str (peer->ibp_nid), rc);
Greg Kroah-Hartman
maintainerPATCH 166/246 staging: lustre: o2iblnd: Fix FastReg map/unmap for MLX5
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Doug Oucharek <[email protected]>
[ Upstream commit 24d4b7c8de007cff9c7d83c06ae76099fdcce008 ]
The FastReg support in ko2iblnd was not unmapping pool items causing the items to leak. In addition, the mapping code is not growing the pool like we do with FMR.
This patch makes sure we are unmapping FastReg pool elements when we are done with them. It also makes sure the pool will grow when we depleat the pool.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9472
Reviewed-on: https://review.whamcloud.com/27015
--- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 2 +- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-)
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +1 -1
@@ -1710,7 +1710,7 @@ int kiblnd_fmr_pool_map(struct kib_fmr_preturn 0 ; }spin_unlock (&fps->fps_lock); - rc = -EBUSY ; + rc = -EAGAIN ; }spin_lock (&fps->fps_lock);
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +4 -8
@@ -47,7 +47,7 @@ static int kiblnd_init_rdma(struct kib_c __u64 dstcookie);static void kiblnd_queue_tx_locked (struct kib_tx *tx,struct kib_conn *conn);static void kiblnd_queue_tx (struct kib_tx *tx,struct kib_conn *conn); -static void kiblnd_unmap_tx (struct lnet_ni *ni,struct kib_tx *tx); +static void kiblnd_unmap_tx (struct kib_tx *tx);static void kiblnd_check_sends_locked (struct kib_conn *conn); static void
@@ -65,7 +65,7 @@ kiblnd_tx_done(struct lnet_ni *ni, strucLASSERT (!tx->tx_waiting);/* mustn't be awaiting peer response */ LASSERT (tx->tx_pool); -kiblnd_unmap_tx (ni, tx); +kiblnd_unmap_tx (tx);/* tx may have up to 2 lnet msgs to finalise */ lntmsg[0 ] = tx->tx_lntmsg[0 ]; tx->tx_lntmsg[0 ] =NULL ;
@@ -590,13 +590,9 @@ kiblnd_fmr_map_tx(struct kib_net *net, sreturn 0 ; } -static void kiblnd_unmap_tx (struct lnet_ni *ni,struct kib_tx *tx) +static void kiblnd_unmap_tx (struct kib_tx *tx) { -struct kib_net *net = ni->ni_data; - -LASSERT (net); - -if (net->ibn_fmr_ps) +if (tx->fmr.fmr_pfmr || tx->fmr.fmr_frd)kiblnd_fmr_pool_unmap (&tx->fmr, tx->tx_status);if (tx->tx_nfrags) {
Greg Kroah-Hartman
maintainerPATCH 167/246 thermal: exynos: fix setting rising_threshold for Exynos5433
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartlomiej Zolnierkiewicz <[email protected]>
[ Upstream commit 8bfc218d0ebbabcba8ed2b8ec1831e0cf1f71629 ]
Add missing clearing of the previous value when setting rising temperature threshold.
--- drivers/thermal/samsung/exynos_tmu.c | 1 + 1 file changed, 1 insertion(+)
drivers/thermal/samsung/exynos_tmu.c +1 -0
@@ -598,6 +598,7 @@ static int exynos5433_tmu_initialize(str threshold_code =temp_to_code (data, temp); rising_threshold =readl (data->base + rising_reg_offset); + rising_threshold &= ~(0xff << j *8 ); rising_threshold |= (threshold_code << j *8 );writel (rising_threshold, data->base + rising_reg_offset);
Greg Kroah-Hartman
maintainerPATCH 169/246 f2fs: avoid fsync() failure caused by EAGAIN in writepage()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jaegeuk Kim <[email protected]>
[ Upstream commit 5b19d284f5195a925dd015a6397bfce184097378 ]
pageout() in MM traslates EAGAIN, so calls handle_write_error()
-> mapping_set_error() -> set_bit(AS_EIO, ...). file_write_and_wait_range() will see EIO error, which is critical to return value of fsync() followed by atomic_write failure to user.
--- fs/f2fs/data.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
fs/f2fs/data.c +7 -1
@@ -1601,7 +1601,13 @@ out: redirty_out:redirty_page_for_writepage (wbc, page); -if (!err) +/* +* pageout() in MM traslates EAGAIN, so calls handle_write_error() +* -> mapping_set_error() -> set_bit(AS_EIO, ...). +* file_write_and_wait_range() will see EIO error, which is critical +* to return value of fsync() followed by atomic_write failure to user. +*/ +if (!err || wbc->for_reclaim)return AOP_WRITEPAGE_ACTIVATE ;unlock_page (page);return err;
Greg Kroah-Hartman
maintainerPATCH 172/246 ALSA: hda/ca0132: fix build failure when a local macro is defined
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Sakamoto <[email protected]>
[ Upstream commit 8e142e9e628975b0dddd05cf1b095331dff6e2de ]
DECLARE_TLV_DB_SCALE (alias of SNDRV_CTL_TLVD_DECLARE_DB_SCALE) is used but tlv.h is not included. This causes build failure when local macro is defined by comment-out.
This commit fixes the bug. At the same time, the alias macro is replaced with a destination macro added at a commit 46e860f76804 ("ALSA: rename TLV-related macros so that they're friendly to user applications")
--- sound/pci/hda/patch_ca0132.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/pci/hda/patch_ca0132.c +6 -2
@@ -38,6 +38,10 @@/* Enable this to see controls for tuning purpose. */ /*#define ENABLE_TUNING_CONTROLS*/ +#ifdef ENABLE_TUNING_CONTROLS +#include <sound/tlv.h> +#endif +#define FLOAT_ZERO 0x00000000#define FLOAT_ONE 0x3f800000#define FLOAT_TWO 0x40000000
@@ -3067,8 +3071,8 @@ static int equalizer_ctl_put(struct snd_return 1 ; } -static const DECLARE_TLV_DB_SCALE(voice_focus_db_scale, 2000, 100, 0); -static const DECLARE_TLV_DB_SCALE(eq_db_scale, -2400, 100, 0); +static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(voice_focus_db_scale, 2000, 100, 0); +static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(eq_db_scale, -2400, 100, 0); static int add_tuning_control(struct hda_codec *codec, hda_nid_t pnid, hda_nid_t nid,
Greg Kroah-Hartman
maintainerPATCH 174/246 mmc: pwrseq: Use kmalloc_array instead of stack VLA
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Tobin C. Harding" <[email protected]>
[ Upstream commit 486e6661367b40f927aadbed73237693396cbf94 ]
The use of stack Variable Length Arrays needs to be avoided, as they can be a vector for stack exhaustion, which can be both a runtime bug (kernel Oops) or a security flaw (overwriting memory beyond the stack). Also, in general, as code evolves it is easy to lose track of how big a VLA can get. Thus, we can end up having runtime failures that are hard to debug. As part of the directive[1] to remove all VLAs from the kernel, and build with -Wvla.
Currently driver is using a VLA declared using the number of descriptors. This array is used to store integer values and is later used as an argument to gpiod_set_array_value_cansleep() This can be avoided by using kmalloc_array() to allocate memory for the array of integer values. Memory is free'd before return from function.
Quoted 1 line
From the code it appears that it is safe to sleep so we can use
GFP_KERNEL
(based _cansleep() suffix of function gpiod_set_array_value_cansleep().
It can be expected that this patch will result in a small increase in overhead due to the use of kmalloc_array()
[1] https://lkml.org/lkml/2018/3/7/621
--- drivers/mmc/core/pwrseq_simple.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/mmc/core/pwrseq_simple.c +9 -5
@@ -40,14 +40,18 @@ static void mmc_pwrseq_simple_set_gpios_struct gpio_descs *reset_gpios = pwrseq->reset_gpios;if (!IS_ERR (reset_gpios)) { -int i; -int values[reset_gpios->ndescs]; +int i, *values; +int nvalues = reset_gpios->ndescs; -for (i =0 ; i < reset_gpios->ndescs; i++) + values =kmalloc_array (nvalues,sizeof (int ),GFP_KERNEL ); +if (!values) +return ; + +for (i =0 ; i < nvalues; i++) values[i] = value; -gpiod_set_array_value_cansleep ( - reset_gpios->ndescs, reset_gpios->desc, values); +gpiod_set_array_value_cansleep (nvalues, reset_gpios->desc, values); +kfree (values); } }
Greg Kroah-Hartman
maintainerPATCH 175/246 dt-bindings: pinctrl: meson: add support for the Meson8m2 SoC
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Blumenstingl <[email protected]>
[ Upstream commit 03d9fbc39730b3e6b2e7047dc85f0f70de8fb97d ]
The Meson8m2 SoC is a variant of Meson8 with some updates from Meson8b (such as the Gigabit capable DesignWare MAC).
It is mostly pin compatible with Meson8, only 10 (existing) CBUS pins get an additional function (four of these are Ethernet RXD2, RXD3, TXD2 and TXD3 which are required when the board uses an RGMII PHY). The AOBUS pins seem to be identical on Meson8 and Meson8m2.
--- Documentation/devicetree/bindings/pinctrl/meson,pinctrl.txt | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/pinctrl/meson,pinctrl.txt +2 -0
@@ -3,8 +3,10 @@ Required properties for the root node: - compatible: one of "amlogic,meson8-cbus-pinctrl" "amlogic,meson8b-cbus-pinctrl" + "amlogic,meson8m2-cbus-pinctrl" "amlogic,meson8-aobus-pinctrl" "amlogic,meson8b-aobus-pinctrl" + "amlogic,meson8m2-aobus-pinctrl" "amlogic,meson-gxbb-periphs-pinctrl" "amlogic,meson-gxbb-aobus-pinctrl" "amlogic,meson-gxl-periphs-pinctrl"
Greg Kroah-Hartman
maintainerPATCH 149/246 net: phy: phylink: Release link GPIO
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
[ Upstream commit daab3349ad1a69663ccad278ed71d55974d104b4 ]
We are not releasing the link GPIO descriptor with gpiod_put() which results in subsequent probing to get -EBUSY when calling fwnode_get_named_gpiod(). Fix this by doing the release in phylink_destroy().
--- drivers/net/phy/phylink.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/phy/phylink.c +2 -0
@@ -561,6 +561,8 @@ void phylink_destroy(struct phylink *pl) {if (pl->sfp_bus)sfp_unregister_upstream (pl->sfp_bus); +if (!IS_ERR (pl->link_gpio)) +gpiod_put (pl->link_gpio);cancel_work_sync (&pl->resolve);kfree (pl);
Greg Kroah-Hartman
maintainerPATCH 176/246 spi: meson-spicc: Fix error handling in meson_spicc_probe()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Khoroshilov <[email protected]>
[ Upstream commit ded5fa4e8bac25612caab8f0822691308a28a552 ]
If devm_spi_register_master() fails in meson_spicc_probe(), spicc->core is left undisabled. The patch fixes that.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/spi/spi-meson-spicc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/spi/spi-meson-spicc.c +8 -3
@@ -574,10 +574,15 @@ static int meson_spicc_probe(struct plat master->max_speed_hz = rate >>2 ; ret =devm_spi_register_master (&pdev->dev, master); -if (!ret) -return 0 ; +if (ret) { +dev_err (&pdev->dev,"spi master registration failed\n" ); + goto out_clk; + } -dev_err (&pdev->dev,"spi master registration failed\n" ); +return 0 ; + +out_clk: +clk_disable_unprepare (spicc->core); out_master:spi_master_put (master);
Greg Kroah-Hartman
maintainerPATCH 177/246 net: hns3: Fixes the out of bounds access in hclge_map_tqp
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huazhong Tan <[email protected]>
[ Upstream commit 38e62046d4c95272e2fb001d2d72baf48fa090e9 ]
This patch fixes the handling of the check when number of vports are detected to be more than available TPQs. Current handling causes an out of bounds access in hclge_map_tqp().
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +5 -2
@@ -1272,8 +1272,11 @@ static int hclge_alloc_vport(struct hclg/* We need to alloc a vport for main NIC of PF */ num_vport = hdev->num_vmdq_vport + hdev->num_req_vfs +1 ; -if (hdev->num_tqps < num_vport) - num_vport = hdev->num_tqps; +if (hdev->num_tqps < num_vport) { +dev_err (&hdev->pdev->dev,"tqps(%d) is less than vports(%d)" , + hdev->num_tqps, num_vport); +return -EINVAL ; + }/* Alloc the same number of TQPs for every vport */ tqp_per_vport = hdev->num_tqps / num_vport;
Greg Kroah-Hartman
maintainerPATCH 181/246 stop_machine: Use raw spinlocks
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
[ Upstream commit de5b55c1d4e30740009864eb35ce4ed856aac01d ]
Use raw-locks in stop_machine() to allow locking in irq-off and preempt-disabled regions on -RT. This also documents the possible locking context in general.
--- kernel/stop_machine.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
kernel/stop_machine.c +12 -12
@@ -37,7 +37,7 @@ struct cpu_stop_done {struct cpu_stopper {struct task_struct *thread; -spinlock_t lock; +raw_spinlock_t lock;bool enabled;/* is this stopper enabled? */ struct list_head works;/* list of pending works */
@@ -81,13 +81,13 @@ static bool cpu_stop_queue_work(unsignedunsigned long flags;bool enabled; -spin_lock_irqsave (&stopper->lock, flags); +raw_spin_lock_irqsave (&stopper->lock, flags); enabled = stopper->enabled;if (enabled)__cpu_stop_queue_work (stopper, work, &wakeq);else if (work->done)cpu_stop_signal_done (work->done); -spin_unlock_irqrestore (&stopper->lock, flags); +raw_spin_unlock_irqrestore (&stopper->lock, flags);wake_up_q (&wakeq);
@@ -237,8 +237,8 @@ static int cpu_stop_queue_two_works(intDEFINE_WAKE_Q (wakeq);int err; retry: -spin_lock_irq (&stopper1->lock); -spin_lock_nested (&stopper2->lock,SINGLE_DEPTH_NESTING ); +raw_spin_lock_irq (&stopper1->lock); +raw_spin_lock_nested (&stopper2->lock,SINGLE_DEPTH_NESTING ); err = -ENOENT ;if (!stopper1->enabled || !stopper2->enabled)
@@ -261,8 +261,8 @@ retry:__cpu_stop_queue_work (stopper1, work1, &wakeq);__cpu_stop_queue_work (stopper2, work2, &wakeq); unlock: -spin_unlock (&stopper2->lock); -spin_unlock_irq (&stopper1->lock); +raw_spin_unlock (&stopper2->lock); +raw_spin_unlock_irq (&stopper1->lock);if (unlikely (err == -EDEADLK )) {while (stop_cpus_in_progress)
@@ -461,9 +461,9 @@ static int cpu_stop_should_run(unsignedunsigned long flags;int run; -spin_lock_irqsave (&stopper->lock, flags); +raw_spin_lock_irqsave (&stopper->lock, flags); run = !list_empty (&stopper->works); -spin_unlock_irqrestore (&stopper->lock, flags); +raw_spin_unlock_irqrestore (&stopper->lock, flags);return run; }
@@ -474,13 +474,13 @@ static void cpu_stopper_thread(unsigned repeat: work =NULL ; -spin_lock_irq (&stopper->lock); +raw_spin_lock_irq (&stopper->lock);if (!list_empty (&stopper->works)) { work =list_first_entry (&stopper->works, struct cpu_stop_work, list);list_del_init (&work->list); } -spin_unlock_irq (&stopper->lock); +raw_spin_unlock_irq (&stopper->lock);if (work) {cpu_stop_fn_t fn = work->fn;
@@ -554,7 +554,7 @@ static int __init cpu_stop_init(void)for_each_possible_cpu (cpu) {struct cpu_stopper *stopper = &per_cpu (cpu_stopper, cpu); -spin_lock_init (&stopper->lock); +raw_spin_lock_init (&stopper->lock);INIT_LIST_HEAD (&stopper->works); }
Greg Kroah-Hartman
maintainerPATCH 183/246 memory: tegra: Do not handle spurious interrupts
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Osipenko <[email protected]>
[ Upstream commit bf3fbdfbec947cdd04b2f2c4bce11534c8786eee ]
The ISR reads interrupts-enable mask, but doesn't utilize it. Apply the mask to the interrupt status and don't handle interrupts that MC driver haven't asked for. Kernel would disable spurious MC IRQ and report the error. This would happen only in a case of a very severe bug.
--- drivers/memory/tegra/mc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/memory/tegra/mc.c +4 -1
@@ -252,8 +252,11 @@ static irqreturn_t tegra_mc_irq(int irq,unsigned int bit;/* mask all interrupts to avoid flooding */ - status =mc_readl (mc,MC_INTSTATUS ); mask =mc_readl (mc,MC_INTMASK ); + status =mc_readl (mc,MC_INTSTATUS ) & mask; + +if (!status) +return IRQ_NONE ;for_each_set_bit (bit, &status,32 ) {const char *error = status_names[bit] ?:"unknown" ;
Greg Kroah-Hartman
maintainerPATCH 150/246 media: rcar_jpu: Add missing clk_disable_unprepare() on error in jpu_open()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Yongjun <[email protected]>
[ Upstream commit 43d0d3c52787df0221d1c52494daabd824fe84f1 ]
Add the missing clk_disable_unprepare() before return from jpu_open() in the software reset error handling case.
--- drivers/media/platform/rcar_jpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/platform/rcar_jpu.c +3 -1
@@ -1280,7 +1280,7 @@ static int jpu_open(struct file *file)/* ...issue software reset */ ret =jpu_reset (jpu);if (ret) - goto device_prepare_rollback; + goto jpu_reset_rollback; } jpu->ref_count++;
@@ -1288,6 +1288,8 @@ static int jpu_open(struct file *file)mutex_unlock (&jpu->mutex);return 0 ; +jpu_reset_rollback: +clk_disable_unprepare (jpu->clk); device_prepare_rollback:mutex_unlock (&jpu->mutex); v4l_prepare_rollback:
Greg Kroah-Hartman
maintainerPATCH 187/246 igb: Fix queue selection on MAC filters on i210
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vinicius Costa Gomes <[email protected]>
[ Upstream commit 4dc93fcf0b95dc3fda4db917effae31fbb8ad2a8 ]
On the RAH registers there are semantic differences on the meaning of the "queue" parameter for traffic steering depending on the controller
model: there is the 82575 meaning, which "queue" means a RX Hardware Queue, and the i350 meaning, where it is a reception pool.
The previous behaviour was having no effect for i210 based controllers because the QSEL bit of the RAH register wasn't being set.
This patch separates the condition in discrete cases, so the different handling is clearer.
--- drivers/net/ethernet/intel/igb/igb_main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +7 -2
@@ -8376,12 +8376,17 @@ static void igb_rar_set_index(struct igbif (is_valid_ether_addr (addr)) rar_high |=E1000_RAH_AV ; -if (hw->mac.type == e1000_82575) +switch (hw->mac.type) { +case e1000_82575: +case e1000_i210: rar_high |=E1000_RAH_POOL_1 * adapter->mac_table[index].queue; -else +break ; +default : rar_high |=E1000_RAH_POOL_1 << adapter->mac_table[index].queue; +break ; + } }wr32 (E1000_RAL (index), rar_low);
Greg Kroah-Hartman
maintainerPATCH 151/246 libata: Fix command retry decision
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Damien Le Moal <[email protected]>
[ Upstream commit 804689ad2d9b66d0d3920b48cf05881049d44589 ]
For failed commands with valid sense data (e.g. NCQ commands), scsi_check_sense() is used in ata_analyze_tf() to determine if the command can be retried. In such case, rely on this decision and ignore the command error mask based decision done in ata_worth_retry().
This fixes useless retries of commands such as unaligned writes on zoned disks (TYPE_ZAC).
--- drivers/ata/libata-eh.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/ata/libata-eh.c +8 -4
@@ -2217,12 +2217,16 @@ static void ata_eh_link_autopsy(struct aif (qc->err_mask & ~AC_ERR_OTHER ) qc->err_mask &= ~AC_ERR_OTHER ; -/* SENSE_VALID trumps dev/unknown error and revalidation */ +/* +* SENSE_VALID trumps dev/unknown error and revalidation. Upper +* layers will determine whether the command is worth retrying +* based on the sense data and device class/type. Otherwise, +* determine directly if the command is worth retrying using its +* error mask and flags. +*/ if (qc->flags &ATA_QCFLAG_SENSE_VALID ) qc->err_mask &= ~(AC_ERR_DEV |AC_ERR_OTHER ); - -/* determine whether the command is worth retrying */ -if (ata_eh_worth_retry (qc)) +else if (ata_eh_worth_retry (qc)) qc->flags |=ATA_QCFLAG_RETRY ;/* accumulate error info */
Greg Kroah-Hartman
maintainerPATCH 152/246 ACPI / LPSS: Only call pwm_add_table() for Bay Trail PWM if PMIC HRV is 2
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit c975e472ec12392a0c34de1350e634310f8a1dea ]
The Point of View mobii wintab p800w Bay Trail tablet comes with a Crystal Cove PMIC, yet uses the LPSS PWM for backlight control, rather then the Crystal Cove's PWM, so we need to call pwm_add_table() to add a pwm_backlight mapping for the LPSS pwm despite there being an INT33FD ACPI device present.
On all Bay Trail devices the _HRV object of the INT33FD ACPI device will normally return 2, to indicate the Bay Trail variant of the CRC PMIC is present, except on this tablet where _HRV is 0xffff. I guess this is a hack to make the windows Crystal Cove PWM driver not bind.
Out of the 44 DSTDs with an INT33FD device in there which I have (from different model devices) only the pov mobii wintab p800w uses 0xffff for the HRV.
The byt_pwm_setup code calls acpi_dev_present to check for the presence of a INT33FD ACPI device which indicates that a CRC PMIC is present and if the INT33FD ACPI device is present then byt_pwm_setup will not add a pwm_backlight mapping for the LPSS pwm, so that the CRC PWM will get used instead.
acpi_dev_present has a hrv parameter, this commit make us pass 2 instead of -1, so that things still match on normal tablets, but on this special case with its _HRV of 0xffff, the check will now fail so that the pwm_backlight mapping for the LPSS pwm gets added fixing backlight brightness control on this device.
--- drivers/acpi/acpi_lpss.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/acpi/acpi_lpss.c +5 -1
@@ -69,6 +69,10 @@ ACPI_MODULE_NAME("acpi_lpss");#define LPSS_SAVE_CTX BIT(4)#define LPSS_NO_D3_DELAY BIT(5) +/* Crystal Cove PMIC shares same ACPI ID between different platforms */ +#define BYT_CRC_HRV 2 +#define CHT_CRC_HRV 3 +struct lpss_private_data ;struct lpss_device_desc {
@@ -162,7 +166,7 @@ static void byt_pwm_setup(struct lpss_prif (!adev->pnp.unique_id ||strcmp (adev->pnp.unique_id,"1" ))return ; -if (!acpi_dev_present ("INT33FD" ,NULL ,-1 )) +if (!acpi_dev_present ("INT33FD" ,NULL ,BYT_CRC_HRV ))pwm_add_table (byt_pwm_lookup,ARRAY_SIZE (byt_pwm_lookup)); }
Greg Kroah-Hartman
maintainerPATCH 153/246 media: media-device: fix ioctl function types
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sami Tolvanen <[email protected]>
[ Upstream commit daa36370b62428cca6d48d1b2530a8419f631c8c ]
This change fixes function types for media device ioctls to avoid indirect call mismatches with Control-Flow Integrity checking.
--- drivers/media/media-device.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/media/media-device.c +11 -10
@@ -54,9 +54,10 @@ static int media_device_close(struct filreturn 0 ; } -static int media_device_get_info (struct media_device *dev, -struct media_device_info *info) +static long media_device_get_info (struct media_device *dev,void *arg) { +struct media_device_info *info = arg; +memset (info,0 ,sizeof (*info));if (dev->driver_name[0 ])
@@ -93,9 +94,9 @@ static struct media_entity *find_entity(return NULL ; } -static long media_device_enum_entities (struct media_device *mdev, -struct media_entity_desc *entd) +static long media_device_enum_entities (struct media_device *mdev,void *arg) { +struct media_entity_desc *entd = arg;struct media_entity *ent; ent =find_entity (mdev, entd->id);
@@ -146,9 +147,9 @@ static void media_device_kpad_to_upad(co upad->flags = kpad->flags; } -static long media_device_enum_links (struct media_device *mdev, -struct media_links_enum *links) +static long media_device_enum_links (struct media_device *mdev,void *arg) { +struct media_links_enum *links = arg;struct media_entity *entity; entity =find_entity (mdev, links->entity);
@@ -194,9 +195,9 @@ static long media_device_enum_links(strureturn 0 ; } -static long media_device_setup_link (struct media_device *mdev, -struct media_link_desc *linkd) +static long media_device_setup_link (struct media_device *mdev,void *arg) { +struct media_link_desc *linkd = arg;struct media_link *link =NULL ;struct media_entity *source;struct media_entity *sink;
@@ -222,9 +223,9 @@ static long media_device_setup_link(strureturn __media_entity_setup_link (link, linkd->flags); } -static long media_device_get_topology (struct media_device *mdev, -struct media_v2_topology *topo) +static long media_device_get_topology (struct media_device *mdev,void *arg) { +struct media_v2_topology *topo = arg;struct media_entity *entity;struct media_interface *intf;struct media_pad *pad;
Greg Kroah-Hartman
maintainerPATCH 155/246 mtd: rawnand: fsl_ifc: fix FSL NAND driver to read all ONFI parameter pages
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jane Wan <[email protected]>
[ Upstream commit a75bbe71a27875fdc61cde1af6d799037cef6bed ]
Per ONFI specification (Rev. 4.0), if the CRC of the first parameter page read is not valid, the host should read redundant parameter page copies. Fix FSL NAND driver to read the two redundant copies which are mandatory in the specification.
--- drivers/mtd/nand/fsl_ifc_nand.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/mtd/nand/fsl_ifc_nand.c +10 -7
@@ -342,9 +342,16 @@ static void fsl_ifc_cmdfunc(struct mtd_icase NAND_CMD_READID :case NAND_CMD_PARAM : { +/* +* For READID, read 8 bytes that are currently used. +* For PARAM, read all 3 copies of 256-bytes pages. +*/ +int len =8 ;int timing =IFC_FIR_OP_RB ; -if (command ==NAND_CMD_PARAM ) +if (command ==NAND_CMD_PARAM ) { timing =IFC_FIR_OP_RBCD ; + len =256 *3 ; + } ifc_out32((IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) | (IFC_FIR_OP_UA << IFC_NAND_FIR0_OP1_SHIFT) |
@@ -354,12 +361,8 @@ static void fsl_ifc_cmdfunc(struct mtd_i &ifc->ifc_nand.nand_fcr0);ifc_out32 (column, &ifc->ifc_nand.row3); -/* -* although currently it's 8 bytes for READID, we always read -* the maximum 256 bytes(for PARAM) -*/ -ifc_out32 (256 , &ifc->ifc_nand.nand_fbcr); - ifc_nand_ctrl->read_bytes =256 ; +ifc_out32 (len, &ifc->ifc_nand.nand_fbcr); + ifc_nand_ctrl->read_bytes = len;set_addr (mtd,0 ,0 ,0 );fsl_ifc_run_command (mtd);
Greg Kroah-Hartman
maintainerPATCH 146/246 i40e: free the skb after clearing the bitlock
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Keller <[email protected]>
[ Upstream commit c79756cb5f084736b138da9319a02f7c72644548 ]
In commit bbc4e7d273b5 ("i40e: fix race condition with PTP_TX_IN_PROGRESS bits") we modified the code which handles Tx timestamps so that we would clear the progress bit as soon as possible.
A later commit 0bc0706b46cd ("i40e: check for Tx timestamp timeouts during watchdog") introduced similar code for detecting and handling cleanup of a blocked Tx timestamp. This code did not use the same pattern for cleaning up the skb.
Update this code to wait to free the skb until after the bit lock is free, by first setting the ptp_tx_skb to NULL and clearing the lock.
--- drivers/net/ethernet/intel/i40e/i40e_ptp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_ptp.c +6 -1
@@ -337,6 +337,8 @@ void i40e_ptp_rx_hang(struct i40e_pf *pf**/ void i40e_ptp_tx_hang (struct i40e_pf *pf) { +struct sk_buff *skb; +if (!(pf->flags &I40E_FLAG_PTP ) || !pf->ptp_tx)return ;
@@ -349,9 +351,12 @@ void i40e_ptp_tx_hang(struct i40e_pf *pf* within a second it is reasonable to assume that we never will. */ if (time_is_before_jiffies (pf->ptp_tx_start +HZ )) { -dev_kfree_skb_any (pf->ptp_tx_skb); + skb = pf->ptp_tx_skb; pf->ptp_tx_skb =NULL ;clear_bit_unlock (__I40E_PTP_TX_IN_PROGRESS, pf->state); + +/* Free the skb after we clear the bitlock */ +dev_kfree_skb_any (skb); pf->tx_hwtstamp_timeouts++; } }
Greg Kroah-Hartman
maintainerPATCH 189/246 ipconfig: Correctly initialise ic_nameservers
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Novakovic <[email protected]>
[ Upstream commit 300eec7c0a2495f771709c7642aa15f7cc148b83 ]
ic_nameservers, which stores the list of name servers discovered by ipconfig, is initialised (i.e. has all of its elements set to NONE, or 0xffffffff) by ic_nameservers_predef() in the following scenarios:
- before the "ip=" and "nfsaddrs=" kernel command line parameters are parsed (in ip_auto_config_setup());
- before autoconfiguring via DHCP or BOOTP (in ic_bootp_init()), in order to clear any values that may have been set after parsing "ip=" or "nfsaddrs=" and are no longer needed.
This means that ic_nameservers_predef() is not called when neither "ip=" nor "nfsaddrs=" is specified on the kernel command line. In this scenario, every element in ic_nameservers remains set to 0x00000000, which is indistinguishable from ANY and causes pnp_seq_show() to write the following (bogus) information to /proc/net/pnp:
#MANUAL
nameserver 0.0.0.0
nameserver 0.0.0.0
nameserver 0.0.0.0
This is potentially problematic for systems that blindly link /etc/resolv.conf to /proc/net/pnp.
Ensure that ic_nameservers is also initialised when neither "ip=" nor "nfsaddrs=" are specified by calling ic_nameservers_predef() in ip_auto_config(), but only when ip_auto_config_setup() was not called earlier. This causes the following to be written to /proc/net/pnp, and is consistent with what gets written when ipconfig is configured manually but no name servers are specified on the kernel command line:
#MANUAL
--- net/ipv4/ipconfig.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
net/ipv4/ipconfig.c +13 -0
@@ -781,6 +781,11 @@ static void __init ic_bootp_init_ext(u8*/ static inline void __init ic_bootp_init (void ) { +/* Re-initialise all name servers to NONE, in case any were set via the +* "ip=" or "nfsaddrs=" kernel command line parameters: any IP addresses +* specified there will already have been decoded but are no longer +* needed +*/ ic_nameservers_predef ();dev_add_pack (&bootp_packet_type);
@@ -1402,6 +1407,13 @@ static int __init ip_auto_config(void)int err;unsigned int i; +/* Initialise all name servers to NONE (but only if the "ip=" or +* "nfsaddrs=" kernel command line parameters weren't decoded, otherwise +* we'll overwrite the IP addresses specified there) +*/ +if (ic_set_manually ==0 ) +ic_nameservers_predef (); +#ifdef CONFIG_PROC_FS proc_create ("pnp" ,S_IRUGO , init_net.proc_net, &pnp_seq_fops);#endif /* CONFIG_PROC_FS */
@@ -1622,6 +1634,7 @@ static int __init ip_auto_config_setup(creturn 1 ; } +/* Initialise all name servers to NONE */ ic_nameservers_predef ();/* Parse string for static IP assignment. */
Greg Kroah-Hartman
maintainerPATCH 199/246 usb: hub: Dont wait for connect state at resume for powered-off ports
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dominik Bozek <[email protected]>
[ Upstream commit 5d111f5190848d6fb1c414dc57797efea3526a2f ]
wait_for_connected() wait till a port change status to USB_PORT_STAT_CONNECTION, but this is not possible if the port is unpowered. The loop will only exit at timeout.
Such case take place if an over-current incident happen while system is in S3. Then during resume wait_for_connected() will wait 2s, which may be noticeable by the user.
--- drivers/usb/core/hub.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/core/hub.c +4 -0
@@ -3361,6 +3361,10 @@ static int wait_for_connected(struct usbwhile (delay_ms <2000 ) {if (status || *portstatus &USB_PORT_STAT_CONNECTION )break ; +if (!port_is_power_on (hub, *portstatus)) { + status = -ENODEV ; +break ; + }msleep (20 ); delay_ms +=20 ; status =hub_port_status (hub, *port1, portstatus, portchange);
Greg Kroah-Hartman
maintainerPATCH 200/246 crypto: authencesn - dont leak pointers to authenc keys
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tudor-Dan Ambarus <[email protected]>
[ Upstream commit 31545df391d58a3bb60e29b1192644a6f2b5a8dd ]
In crypto_authenc_esn_setkey we save pointers to the authenc keys in a local variable of type struct crypto_authenc_keys and we don't zeroize it after use. Fix this and don't leak pointers to the authenc keys.
--- crypto/authencesn.c | 1 + 1 file changed, 1 insertion(+)
crypto/authencesn.c +1 -0
@@ -90,6 +90,7 @@ static int crypto_authenc_esn_setkey(str CRYPTO_TFM_RES_MASK); out: +memzero_explicit (&keys,sizeof (keys));return err; badkey:
Greg Kroah-Hartman
maintainerPATCH 206/246 scsi: cxlflash: Synchronize reset and remove ops
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uma Krishnan <[email protected]>
[ Upstream commit a3feb6ef50def7c91244d7bd15a3625b7b49b81f ]
The following Oops can be encountered if a device removal or system shutdown is initiated while an EEH recovery is in process:
[c000000ff2f479c0] c008000015256f18 cxlflash_pci_slot_reset+0xa0/0x100
[cxlflash]
[c000000ff2f47a30] c00800000dae22e0 cxl_pci_slot_reset+0x168/0x290 [cxl] [c000000ff2f47ae0] c00000000003ef1c eeh_report_reset+0xec/0x170 [c000000ff2f47b20] c00000000003d0b8 eeh_pe_dev_traverse+0x98/0x170 [c000000ff2f47bb0] c00000000003f80c eeh_handle_normal_event+0x56c/0x580 [c000000ff2f47c60] c00000000003fba4 eeh_handle_event+0x2a4/0x338 [c000000ff2f47d10] c0000000000400b8 eeh_event_handler+0x1f8/0x200 [c000000ff2f47dc0] c00000000013da48 kthread+0x1a8/0x1b0 [c000000ff2f47e30] c00000000000b528 ret_from_kernel_thread+0x5c/0xb4
The remove handler frees AFU memory while the EEH recovery is in progress, leading to a race condition. This can result in a crash if the recovery thread tries to access this memory.
To resolve this issue, the cxlflash remove handler will evaluate the device state and yield to any active reset or probing threads.
--- drivers/scsi/cxlflash/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/cxlflash/main.c +3 -3
@@ -946,9 +946,9 @@ static void cxlflash_remove(struct pci_dreturn ; } -/* If a Task Management Function is active, wait for it to complete -* before continuing with remove. -*/ +/* Yield to running recovery threads before continuing with remove */ +wait_event (cfg->reset_waitq, cfg->state !=STATE_RESET && + cfg->state !=STATE_PROBING );spin_lock_irqsave (&cfg->tmf_slock, lock_flags);if (cfg->tmf_active) wait_event_interruptible_lock_irq(cfg->tmf_waitq,
Greg Kroah-Hartman
maintainerPATCH 207/246 scsi: cxlflash: Avoid clobbering context control register value
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Matthew R. Ochs" <[email protected]>
[ Upstream commit 465891fe9237b02f8d0fd26448f733fae7236f4a ]
The SISLite specification originally defined the context control register with a single field of bits to represent the LISN and also stipulated that the register reset value be 0. The cxlflash driver took advantage of this when programming the LISN for the master contexts via an unconditional write - no other bits were preserved.
When unmap support was added, SISLite was updated to define bit 0 of the context control register as a way for the AFU to notify the context owner that unmap operations were supported. Thus the assumptions under which the register is setup changed and the existing unconditional write is clobbering the unmap state for master contexts. This is presently not an issue due to the order in which the context control register is programmed in relation to the unmap bit being queried but should be addressed to avoid a future regression in the event this code is moved elsewhere.
To remedy this issue, preserve the bits when programming the LISN field in the context control register. Since the LISN will now be programmed using a read value, assert that the initial state of the LISN field is as described in SISLite (0).
--- drivers/scsi/cxlflash/main.c | 5 ++++- drivers/scsi/cxlflash/sislite.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/scsi/cxlflash/main.c +4 -1
@@ -1303,7 +1303,10 @@ static void afu_err_intr_init(struct afufor (i =0 ; i < afu->num_hwqs; i++) { hwq =get_hwq (afu, i); -writeq_be (SISL_MSI_SYNC_ERROR , &hwq->host_map->ctx_ctrl); + reg =readq_be (&hwq->host_map->ctx_ctrl); +WARN_ON ((reg &SISL_CTX_CTRL_LISN_MASK ) !=0 ); + reg |=SISL_MSI_SYNC_ERROR ; +writeq_be (reg, &hwq->host_map->ctx_ctrl);writeq_be (SISL_ISTATUS_MASK , &hwq->host_map->intr_mask); } }
drivers/scsi/cxlflash/sislite.h +1 -0
@@ -284,6 +284,7 @@ struct sisl_host_map {__be64 cmd_room;__be64 ctx_ctrl;/* least significant byte or b56:63 is LISN# */ #define SISL_CTX_CTRL_UNMAP_SECTOR 0x8000000000000000ULL/* b0 */ +#define SISL_CTX_CTRL_LISN_MASK (0xFFULL)__be64 mbox_w;/* restricted use */ __be64 sq_start;/* Submission Queue (R/W): write sequence and */ __be64 sq_end;/* inclusion semantics are the same as RRQ */
Greg Kroah-Hartman
maintainerPATCH 190/246 rsi: Fix invalid vdd warning in mmc
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Siva Rebbagondla <[email protected]>
[ Upstream commit 78e450719c702784e42af6da912d3692fd3da0cb ]
While performing cleanup, driver is messing with card->ocr value by not masking rocr against ocr_avail. Below panic is observed with some of the SDIO host controllers due to this. Issue is resolved by reverting incorrect modifications to vdd.
[ 927.423821] mmc1: Invalid vdd 0x1f [ 927.423925] Modules linked in: rsi_sdio(+) cmac bnep arc4 rsi_91x mac80211 cfg80211 btrsi rfcomm bluetooth ecdh_generic [ 927.424073] CPU: 0 PID: 1624 Comm: insmod Tainted: G W 4.15.0-1000-caracalla #1 [ 927.424075] Hardware name: Dell Inc. Edge Gateway 3003/ , BIOS 01.00.06 01/22/2018 [ 927.424082] RIP: 0010:sdhci_set_power_noreg+0xdd/0x190[sdhci] [ 927.424085] RSP: 0018:ffffac3fc064b930 EFLAGS: 00010282 [ 927.424107] Call Trace: [ 927.424118] sdhci_set_power+0x5a/0x60 [sdhci] [ 927.424125] sdhci_set_ios+0x360/0x3b0 [sdhci] [ 927.424133] mmc_set_initial_state+0x92/0x120 [ 927.424137] mmc_power_up.part.34+0x33/0x1d0 [ 927.424141] mmc_power_up+0x17/0x20 [ 927.424147] mmc_sdio_runtime_resume+0x2d/0x50 [ 927.424151] mmc_runtime_resume+0x17/0x20 [ 927.424156] __rpm_callback+0xc4/0x200 [ 927.424161] ? idr_alloc_cyclic+0x57/0xd0 [ 927.424165] ? mmc_runtime_suspend+0x20/0x20 [ 927.424169] rpm_callback+0x24/0x80 [ 927.424172] ? mmc_runtime_suspend+0x20/0x20 [ 927.424176] rpm_resume+0x4b3/0x6c0 [ 927.424181] __pm_runtime_resume+0x4e/0x80 [ 927.424188] driver_probe_device+0x41/0x490 [ 927.424192] __driver_attach+0xdf/0xf0 [ 927.424196] ? driver_probe_device+0x490/0x490 [ 927.424201] bus_for_each_dev+0x6c/0xc0 [ 927.424205] driver_attach+0x1e/0x20 [ 927.424209] bus_add_driver+0x1f4/0x270 [ 927.424217] ? rsi_sdio_ack_intr+0x50/0x50 [rsi_sdio] [ 927.424221] driver_register+0x60/0xe0 [ 927.424227] ? rsi_sdio_ack_intr+0x50/0x50 [rsi_sdio] [ 927.424231] sdio_register_driver+0x20/0x30 [ 927.424237] rsi_module_init+0x16/0x40 [rsi_sdio]
--- drivers/net/wireless/rsi/rsi_91x_sdio.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/wireless/rsi/rsi_91x_sdio.c +0 -2
@@ -161,7 +161,6 @@ static void rsi_reset_card(struct sdio_fint err;struct mmc_card *card = pfunction->card;struct mmc_host *host = card->host; -s32 bit = (fls (host->ocr_avail) -1 );u8 cmd52_resp;u32 clock, resp, i;u16 rca;
@@ -181,7 +180,6 @@ static void rsi_reset_card(struct sdio_fmsleep (20 );/* Initialize the SDIO card */ - host->ios.vdd = bit; host->ios.chip_select =MMC_CS_DONTCARE ; host->ios.bus_mode =MMC_BUSMODE_OPENDRAIN ; host->ios.power_mode =MMC_POWER_UP ;
Greg Kroah-Hartman
maintainerPATCH 208/246 media: atomisp: compat32: fix __user annotations
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit ad4222a0e29664666a71685a6e732923ca7c7e45 ]
The __user annotations at the compat32 code is not right:
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:81:18: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:81:18: expected void *base
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:81:18: got void [noderef] <asn:1>*
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:232:23: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:232:23: expected unsigned int [usertype] *xcoords_y
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:232:23: got void [noderef] <asn:1>*
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:233:23: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:233:23: expected unsigned int [usertype] *ycoords_y
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:233:23: got void [noderef] <asn:1>*
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:234:24: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:234:24: expected unsigned int [usertype] *xcoords_uv
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:234:24: got void [noderef] <asn:1>*
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:235:24: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:235:24: expected unsigned int [usertype] *ycoords_uv
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:235:24: got void [noderef] <asn:1>*
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:296:29: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:296:29: expected unsigned int [usertype] *effective_width
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:296:29: got void [noderef] <asn:1>*
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:360:29: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:360:29: expected unsigned int [usertype] *effective_width
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:360:29: got void [noderef] <asn:1>*
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:437:19: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:437:19: expected struct v4l2_framebuffer *frame
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:437:19: got void [noderef] <asn:1>*
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:481:29: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:481:29: expected unsigned short *calb_grp_values
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:481:29: got void [noderef] <asn:1>*
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:701:39: warning: cast removes address space of expression drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:704:21: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:704:21: expected void const volatile [noderef] <asn:1>*<noident>
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:704:21: got unsigned int [usertype] *src
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:737:43: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:737:43: expected struct atomisp_shading_table *shading_table
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:737:43: got void [noderef] <asn:1>*
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:742:44: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:742:44: expected void [noderef] <asn:1>*to
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:742:44: got struct atomisp_shading_table *shading_table
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:755:41: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:755:41: expected struct atomisp_morph_table *morph_table
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:755:41: got void [noderef] <asn:1>*
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:760:44: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:760:44: expected void [noderef] <asn:1>*to
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:760:44: got struct atomisp_morph_table *morph_table
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:772:40: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:772:40: expected struct atomisp_dvs2_coefficients *dvs2_coefs
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:772:40: got void [noderef] <asn:1>*
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:777:44: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:777:44: expected void [noderef] <asn:1>*to
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:777:44: got struct atomisp_dvs2_coefficients *dvs2_coefs
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:788:46: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:788:46: expected struct atomisp_dvs_6axis_config *dvs_6axis_config
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:788:46: got void [noderef] <asn:1>*
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:793:44: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:793:44: expected void [noderef] <asn:1>*to
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:793:44: got struct atomisp_dvs_6axis_config *dvs_6axis_config
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:853:17: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:853:17: expected struct atomisp_sensor_ae_bracketing_lut_entry *lut
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:853:17: got void [noderef] <asn:1>*
--- drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c | 49 +++++----- 1 file changed, 26 insertions(+), 23 deletions(-)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c +26 -23
@@ -81,7 +81,7 @@ static int get_v4l2_framebuffer32(struct get_user(kp->flags, &up->flags))return -EFAULT ; - kp->base =compat_ptr (tmp); + kp->base = (void __force *)compat_ptr (tmp);get_v4l2_pix_format ((struct v4l2_pix_format *)&kp->fmt, &up->fmt);return 0 ; }
@@ -232,10 +232,10 @@ static int get_atomisp_dvs_6axis_config3 get_user(ycoords_uv, &up->ycoords_uv))return -EFAULT ; - kp->xcoords_y =compat_ptr (xcoords_y); - kp->ycoords_y =compat_ptr (ycoords_y); - kp->xcoords_uv =compat_ptr (xcoords_uv); - kp->ycoords_uv =compat_ptr (ycoords_uv); + kp->xcoords_y = (void __force *)compat_ptr (xcoords_y); + kp->ycoords_y = (void __force *)compat_ptr (ycoords_y); + kp->xcoords_uv = (void __force *)compat_ptr (xcoords_uv); + kp->ycoords_uv = (void __force *)compat_ptr (ycoords_uv);return 0 ; }
@@ -296,7 +296,7 @@ static int get_atomisp_metadata_stat32(sreturn -EFAULT ; kp->data =compat_ptr (data); - kp->effective_width =compat_ptr (effective_width); + kp->effective_width = (void __force *)compat_ptr (effective_width);return 0 ; }
@@ -360,7 +360,7 @@ static int get_atomisp_metadata_by_type_return -EFAULT ; kp->data =compat_ptr (data); - kp->effective_width =compat_ptr (effective_width); + kp->effective_width = (void __force *)compat_ptr (effective_width);return 0 ; }
@@ -437,7 +437,7 @@ static int get_atomisp_overlay32(struct get_user(kp->overlay_start_x, &up->overlay_start_y)) return -EFAULT; - kp->frame =compat_ptr (frame); + kp->frame = (void __force *)compat_ptr (frame);return 0 ; }
@@ -481,7 +481,7 @@ static int get_atomisp_calibration_group get_user(calb_grp_values, &up->calb_grp_values)) return -EFAULT; - kp->calb_grp_values =compat_ptr (calb_grp_values); + kp->calb_grp_values = (void __force *)compat_ptr (calb_grp_values);return 0 ; }
@@ -703,8 +703,8 @@ static int get_atomisp_parameters32(strureturn -EFAULT ;while (n >=0 ) { -compat_uptr_t *src = (compat_uptr_t *)up + n; -uintptr_t *dst = (uintptr_t *)kp + n; +compat_uptr_t __user *src = ((compat_uptr_t __user *)up) + n; +uintptr_t *dst = ((uintptr_t *)kp) + n;if (get_user ((*dst), src))return -EFAULT ;
@@ -751,12 +751,12 @@ static int get_atomisp_parameters32(stru#endif return -EFAULT ; - kp->shading_table = user_ptr + offset; + kp->shading_table = (void __force *)user_ptr + offset; offset =sizeof (struct atomisp_shading_table );if (!kp->shading_table)return -EFAULT ; -if (copy_to_user (kp->shading_table, +if (copy_to_user ((void __user *)kp->shading_table, &karg.shading_table,sizeof (struct atomisp_shading_table )))return -EFAULT ;
@@ -777,13 +777,14 @@ static int get_atomisp_parameters32(stru#endif return -EFAULT ; - kp->morph_table = user_ptr + offset; + kp->morph_table = (void __force *)user_ptr + offset; offset +=sizeof (struct atomisp_morph_table );if (!kp->morph_table)return -EFAULT ; -if (copy_to_user (kp->morph_table, &karg.morph_table, -sizeof (struct atomisp_morph_table ))) +if (copy_to_user ((void __user *)kp->morph_table, + &karg.morph_table, +sizeof (struct atomisp_morph_table )))return -EFAULT ; }
@@ -802,13 +803,14 @@ static int get_atomisp_parameters32(stru#endif return -EFAULT ; - kp->dvs2_coefs = user_ptr + offset; + kp->dvs2_coefs = (void __force *)user_ptr + offset; offset +=sizeof (struct atomisp_dis_coefficients );if (!kp->dvs2_coefs)return -EFAULT ; -if (copy_to_user (kp->dvs2_coefs, &karg.dvs2_coefs, -sizeof (struct atomisp_dis_coefficients ))) +if (copy_to_user ((void __user *)kp->dvs2_coefs, + &karg.dvs2_coefs, +sizeof (struct atomisp_dis_coefficients )))return -EFAULT ; }/* handle dvs 6axis configuration */
@@ -826,13 +828,14 @@ static int get_atomisp_parameters32(stru#endif return -EFAULT ; - kp->dvs_6axis_config = user_ptr + offset; + kp->dvs_6axis_config = (void __force *)user_ptr + offset; offset +=sizeof (struct atomisp_dvs_6axis_config );if (!kp->dvs_6axis_config)return -EFAULT ; -if (copy_to_user (kp->dvs_6axis_config, &karg.dvs_6axis_config, -sizeof (struct atomisp_dvs_6axis_config ))) +if (copy_to_user ((void __user *)kp->dvs_6axis_config, + &karg.dvs_6axis_config, +sizeof (struct atomisp_dvs_6axis_config )))return -EFAULT ; } }
@@ -891,7 +894,7 @@ static int get_atomisp_sensor_ae_bracket get_user(lut, &up->lut))return -EFAULT ; - kp->lut =compat_ptr (lut); + kp->lut = (void __force *)compat_ptr (lut);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 209/246 media: si470x: fix __be16 annotations
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit 90db5c829692a0a7845e977e45719b4699216bd4 ]
The annotations there are wrong as warned:
drivers/media/radio/si470x/radio-si470x-i2c.c:107:35: warning: cast to restricted __be16 drivers/media/radio/si470x/radio-si470x-i2c.c:107:35: warning: cast to restricted __be16 drivers/media/radio/si470x/radio-si470x-i2c.c:107:35: warning: cast to restricted __be16 drivers/media/radio/si470x/radio-si470x-i2c.c:107:35: warning: cast to restricted __be16 drivers/media/radio/si470x/radio-si470x-i2c.c:129:24: warning: incorrect type in assignment (different base types)
drivers/media/radio/si470x/radio-si470x-i2c.c:129:24: expected unsigned short [unsigned] [short] <noident>
drivers/media/radio/si470x/radio-si470x-i2c.c:129:24: got restricted __be16 [usertype] <noident>
drivers/media/radio/si470x/radio-si470x-i2c.c:163:39: warning: cast to restricted __be16 drivers/media/radio/si470x/radio-si470x-i2c.c:163:39: warning: cast to restricted __be16 drivers/media/radio/si470x/radio-si470x-i2c.c:163:39: warning: cast to restricted __be16 drivers/media/radio/si470x/radio-si470x-i2c.c:163:39: warning: cast to restricted __be16
--- drivers/media/radio/si470x/radio-si470x-i2c.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/radio/si470x/radio-si470x-i2c.c +3 -3
@@ -92,7 +92,7 @@ MODULE_PARM_DESC(max_rds_errors, "RDS ma*/ int si470x_get_register (struct si470x_device *radio,int regnr) { -u16 buf[READ_REG_NUM ]; +__be16 buf[READ_REG_NUM ];struct i2c_msg msgs[1 ] = { { .addr = radio->client->addr,
@@ -117,7 +117,7 @@ int si470x_get_register(struct si470x_deint si470x_set_register (struct si470x_device *radio,int regnr) {int i; -u16 buf[WRITE_REG_NUM ]; +__be16 buf[WRITE_REG_NUM ];struct i2c_msg msgs[1 ] = { { .addr = radio->client->addr,
@@ -147,7 +147,7 @@ int si470x_set_register(struct si470x_destatic int si470x_get_all_registers (struct si470x_device *radio) {int i; -u16 buf[READ_REG_NUM ]; +__be16 buf[READ_REG_NUM ];struct i2c_msg msgs[1 ] = { { .addr = radio->client->addr,
Greg Kroah-Hartman
maintainerPATCH 215/246 block: bio_iov_iter_get_pages: fix size of last iovec
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Wilck <[email protected]>
commit b403ea2404889e1227812fa9657667a1deb9c694 upstream.
If the last page of the bio is not "full", the length of the last vector slot needs to be corrected. This slot has the index (bio->bi_vcnt - 1), but only in bio->bi_io_vec. In the "bv" helper array, which is shifted by the value of bio->bi_vcnt at function invocation, the correct index is (nr_pages - 1).
v2: improved readability following suggestions from Ming Lei.
v3: followed a formatting suggestion from Christoph Hellwig.
--- block/bio.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
block/bio.c +8 -10
@@ -881,16 +881,16 @@ EXPORT_SYMBOL(bio_add_page);*/ int bio_iov_iter_get_pages (struct bio *bio,struct iov_iter *iter) { -unsigned short nr_pages = bio->bi_max_vecs - bio->bi_vcnt; +unsigned short nr_pages = bio->bi_max_vecs - bio->bi_vcnt, idx;struct bio_vec *bv = bio->bi_io_vec + bio->bi_vcnt;struct page **pages = (struct page **)bv; -size_t offset, diff; +size_t offset;ssize_t size; size =iov_iter_get_pages (iter, pages,LONG_MAX , nr_pages, &offset);if (unlikely (size <=0 ))return size ? size : -EFAULT ; - nr_pages = (size + offset +PAGE_SIZE -1 ) /PAGE_SIZE ; + idx = nr_pages = (size + offset +PAGE_SIZE -1 ) /PAGE_SIZE ;/* * Deep magic below: We need to walk the pinned pages backwards
@@ -903,17 +903,15 @@ int bio_iov_iter_get_pages(struct bio *b bio->bi_iter.bi_size += size; bio->bi_vcnt += nr_pages; - diff = (nr_pages *PAGE_SIZE - offset) - size; -while (nr_pages--) { - bv[nr_pages].bv_page = pages[nr_pages]; - bv[nr_pages].bv_len =PAGE_SIZE ; - bv[nr_pages].bv_offset =0 ; +while (idx--) { + bv[idx].bv_page = pages[idx]; + bv[idx].bv_len =PAGE_SIZE ; + bv[idx].bv_offset =0 ; } bv[0 ].bv_offset += offset; bv[0 ].bv_len -= offset; -if (diff) - bv[bio->bi_vcnt -1 ].bv_len -= diff; + bv[nr_pages -1 ].bv_len -= nr_pages *PAGE_SIZE - offset - size;iov_iter_advance (iter, size);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 216/246 blkdev: __blkdev_direct_IO_simple: fix leak in error case
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Wilck <[email protected]>
commit 9362dd1109f87a9d0a798fbc890cb339c171ed35 upstream.
--- fs/block_dev.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
fs/block_dev.c +5 -4
@@ -231,7 +231,7 @@ __blkdev_direct_IO_simple(struct kiocb * ret =bio_iov_iter_get_pages (&bio, iter);if (unlikely (ret)) -return ret; + goto out; ret = bio.bi_iter.bi_size;if (iov_iter_rw (iter) ==READ ) {
@@ -260,12 +260,13 @@ __blkdev_direct_IO_simple(struct kiocb *put_page (bvec->bv_page); } -if (vecs != inline_vecs) -kfree (vecs); -if (unlikely (bio.bi_status)) ret =blk_status_to_errno (bio.bi_status); +out: +if (vecs != inline_vecs) +kfree (vecs); +bio_uninit (&bio);return ret;
Greg Kroah-Hartman
maintainerPATCH 219/246 squashfs: be more careful about metadata corruption
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit 01cfb7937a9af2abb1136c7e89fbf3fd92952956 upstream.
Anatoly Trosinenko reports that a corrupted squashfs image can cause a kernel oops. It turns out that squashfs can end up being confused about negative fragment lengths.
The regular squashfs_read_data() does check for negative lengths, but squashfs_read_metadata() did not, and the fragment size code just blindly trusted the on-disk value. Fix both the fragment parsing and the metadata reading code.
--- fs/squashfs/cache.c | 3 +++ fs/squashfs/file.c | 8 ++++++-- fs/squashfs/fragment.c | 4 +--- fs/squashfs/squashfs_fs.h | 6 ++++++ 4 files changed, 16 insertions(+), 5 deletions(-)
fs/squashfs/cache.c +3 -0
@@ -350,6 +350,9 @@ int squashfs_read_metadata(struct super_TRACE ("Entered squashfs_read_metadata [%llx:%x]\n" , *block, *offset); +if (unlikely (length <0 )) +return -EIO ; +while (length) { entry =squashfs_cache_get (sb, msblk->block_cache, *block,0 );if (entry->error) {
fs/squashfs/file.c +6 -2
@@ -194,7 +194,11 @@ static long long read_indexes(struct sup }for (i =0 ; i < blocks; i++) { -int size =le32_to_cpu (blist[i]); +int size =squashfs_block_size (blist[i]); +if (size <0 ) { + err = size; + goto failure; + } block +=SQUASHFS_COMPRESSED_SIZE_BLOCK (size); } n -= blocks;
@@ -367,7 +371,7 @@ static int read_blocklist(struct inode * sizeof(size));if (res <0 )return res; -return le32_to_cpu (size); +return squashfs_block_size (size); }/* Copy data into page cache */
fs/squashfs/fragment.c +1 -3
@@ -61,9 +61,7 @@ int squashfs_frag_lookup(struct super_blreturn size; *fragment_block =le64_to_cpu (fragment_entry.start_block); - size =le32_to_cpu (fragment_entry.size); - -return size; +return squashfs_block_size (fragment_entry.size); }
fs/squashfs/squashfs_fs.h +6 -0
@@ -129,6 +129,12 @@#define SQUASHFS_COMPRESSED_BLOCK (B ) (!((B) & SQUASHFS_COMPRESSED_BIT_BLOCK)) +static inline int squashfs_block_size (__le32 raw) +{ +u32 size =le32_to_cpu (raw); +return (size >>25 ) ? -EIO : size; +} +/* * Inode number ops. Inodes consist of a compressed block number, and an * uncompressed offset within that block
Greg Kroah-Hartman
maintainerPATCH 222/246 ext4: fix check to prevent initializing reserved inodes
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 5012284700775a4e6e3fbe7eac4c543c4874b559 upstream.
Commit 8844618d8aa7: "ext4: only look at the bg_flags field if it is valid" will complain if block group zero does not have the EXT4_BG_INODE_ZEROED flag set. Unfortunately, this is not correct, since a freshly created file system has this flag cleared. It gets almost immediately after the file system is mounted read-write --- but the following somewhat unlikely sequence will end up triggering a false positive report of a corrupted file system:
mkfs.ext4 /dev/vdc
mount -o ro /dev/vdc /vdc
mount -o remount,rw /dev/vdc
Instead, when initializing the inode table for block group zero, test to make sure that itable_unused count is not too large, since that is the case that will result in some or all of the reserved inodes getting cleared.
This fixes the failures reported by Eric Whiteney when running generic/230 and generic/231 in the the nojournal test case.
--- fs/ext4/ialloc.c | 5 ++++- fs/ext4/super.c | 8 +------- 2 files changed, 5 insertions(+), 8 deletions(-)
fs/ext4/ialloc.c +4 -1
@@ -1397,7 +1397,10 @@ int ext4_init_inode_table(struct super_b ext4_itable_unused_count(sb, gdp)), sbi->s_inodes_per_block); -if ((used_blks <0 ) || (used_blks > sbi->s_itb_per_group)) { +if ((used_blks <0 ) || (used_blks > sbi->s_itb_per_group) || + ((group ==0 ) && ((EXT4_INODES_PER_GROUP (sb) - +ext4_itable_unused_count (sb, gdp)) < +EXT4_FIRST_INO (sb)))) { ext4_error(sb, "Something is wrong with group %u: " "used itable blocks: %d; " "itable unused count: %u",
fs/ext4/super.c +1 -7
@@ -3103,14 +3103,8 @@ static ext4_group_t ext4_has_uninit_itabif (!gdp)continue ; -if (gdp->bg_flags &cpu_to_le16 (EXT4_BG_INODE_ZEROED )) -continue ; -if (group !=0 ) +if (!(gdp->bg_flags &cpu_to_le16 (EXT4_BG_INODE_ZEROED )))break ; -ext4_error (sb,"Inode table for bg 0 marked as " -"needing zeroing" ); -if (sb_rdonly (sb)) -return ngroups; }return group;