5.4.9-stable review
Subsystems (12)
Greg Kroah-Hartman
maintainercover 5.4.9-stable review
This is the start of the stable review cycle for the 5.4.9 release. There are 191 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 Thu, 09 Jan 2020 20:44:51 +0000. 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/v5.x/stable-review/patch-5.4.9-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-5.4.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.4.9-rc1
Waiman Long <[email protected]>
mm/hugetlb: defer freeing of huge pages if in non-task context
Taehee Yoo <[email protected]>
hsr: fix a race condition in node list insertion and deletion
Taehee Yoo <[email protected]>
hsr: fix error handling routine in hsr_dev_finalize()
Taehee Yoo <[email protected]>
hsr: avoid debugfs warning message when module is remove
Eric Dumazet <[email protected]>
net: annotate lockless accesses to sk->sk_pacing_shift
Alexander Shishkin <[email protected]>
perf/x86/intel/bts: Fix the use of page_private()
Ard Biesheuvel <[email protected]>
efi: Don't attempt to map RCI2 config table if it doesn't exist
Julien Grall <[email protected]>
lib/ubsan: don't serialize UBSAN report
SeongJae Park <[email protected]>
xen/blkback: Avoid unmapping unmapped grant pages
Ilya Leoshkevich <[email protected]>
mm/sparse.c: mark populate_section_memmap as __meminit
Heiko Carstens <[email protected]>
s390/smp: fix physical to logical CPU map for SMT
Chris Mason <[email protected]>
Btrfs: only associate the locked page with one async_chunk struct
Omar Sandoval <[email protected]>
btrfs: get rid of unique workqueue helper functions
Zhihao Cheng <[email protected]>
ubifs: ubifs_tnc_start_commit: Fix OOB in layout_in_gaps
Eric Dumazet <[email protected]>
net: add annotations on hh->hh_len lockless accesses
Darrick J. Wong <[email protected]>
xfs: periodically yield scrub threads to the scheduler
Chris Wilson <[email protected]>
drm/i915/execlists: Fix annotation for decoupling virtual request
Masashi Honma <[email protected]>
ath9k_htc: Discard undersized packets
Masashi Honma <[email protected]>
ath9k_htc: Modify byte order for an error message
Al Viro <[email protected]>
fix compat handling of FICLONERANGE, FIDEDUPERANGE and FS_IOC_FIEMAP
Deepa Dinamani <[email protected]>
fs: cifs: Fix atime update check vs mtime
Paulo Alcantara (SUSE) <[email protected]>
cifs: Fix lookup of root ses in DFS referral cache
Leo Yan <[email protected]>
tty: serial: msm_serial: Fix lockup for sysrq and oops
Geert Uytterhoeven <[email protected]>
phy: renesas: rcar-gen3-usb2: Use platform_get_irq_optional() for optional irq
Anand Moon <[email protected]>
arm64: dts: meson: odroid-c2: Disable usb_otg bus to avoid power failed warning
Geert Uytterhoeven <[email protected]>
dt-bindings: clock: renesas: rcar-usb2-clock-sel: Fix typo in example
Navid Emamdoost <[email protected]>
media: usb: fix memory leak in af9005_identify_state
Stephan Gerhold <[email protected]>
regulator: ab8500: Remove AB8505 USB regulator
Colin Ian King <[email protected]>
media: flexcop-usb: ensure -EIO is returned on error condition
Christian Hewitt <[email protected]>
arm64: dts: meson-gxm-khadas-vim2: fix uart_A bluetooth node
Christian Hewitt <[email protected]>
arm64: dts: meson-gxl-s905x-khadas-vim: fix uart_A bluetooth node
Navid Emamdoost <[email protected]>
Bluetooth: Fix memory leak in hci_connect_le_scan
Dan Carpenter <[email protected]>
Bluetooth: delete a stray unlock
Oliver Neukum <[email protected]>
Bluetooth: btusb: fix PM leak in error case of setup
Michael Ellerman <[email protected]>
powerpc/mm: Mark get_slice_psize() & slice_addr_is_low() as notrace
Chen-Yu Tsai <[email protected]>
regulator: axp20x: Fix AXP22x ELDO2 regulator enable bitmask
Kunihiko Hayashi <[email protected]>
spi: uniphier: Fix FIFO threshold
Axel Lin <[email protected]>
regulator: bd70528: Remove .set_ramp_delay for bd70528_ldo_ops
Axel Lin <[email protected]>
regulator: axp20x: Fix axp20x_set_ramp_delay
YueHaibing <[email protected]>
watchdog: tqmx86_wdt: Fix build error
Alexander Lobakin <[email protected]>
net, sysctl: Fix compiler warning when only cBPF is present
Marco Oliverio <[email protected]>
netfilter: nf_queue: enqueue skbs with NULL dst
Michael Haener <[email protected]>
platform/x86: pmc_atom: Add Siemens CONNECT X300 to critclk_systems DMI table
Omar Sandoval <[email protected]>
xfs: don't check for AG deadlock for realtime files in bunmapi
Wen Yang <[email protected]>
firmware: arm_scmi: Avoid double free in error flow
Paulo Alcantara (SUSE) <[email protected]>
cifs: Fix potential softlockups while refreshing DFS cache
Frank Rowand <[email protected]>
of: overlay: add_changeset_property() memory leak
Lu Baolu <[email protected]>
iommu/vt-d: Remove incorrect PSI capability check
Adrian Hunter <[email protected]>
perf callchain: Fix segfault in thread__resolve_callchain_sample()
Yunfeng Ye <[email protected]>
ACPI: sysfs: Change ACPI_MASKABLE_GPE_MAX to 0x100
Konstantin Khorenko <[email protected]>
kernel/module.c: wakeup processes in module_wq on module unload
Eric Dumazet <[email protected]>
net/sched: annotate lockless accesses to qdisc->empty
Kai-Heng Feng <[email protected]>
HID: i2c-hid: Reset ALPS touchpads on resume
Alastair D'Silva <[email protected]>
powerpc: Chunk calls to flush_dcache_range in arch_*_memory
Scott Mayhew <[email protected]>
nfsd4: fix up replay_matches_cache()
Jeffrey Hugo <[email protected]>
arm64: dts: qcom: msm8998-clamshell: Remove retention idle state
Pavel Tikhomirov <[email protected]>
sunrpc: fix crash when cache_head become valid before update
Leonard Crestez <[email protected]>
PM / devfreq: Check NULL governor in available_governors_show
Arnd Bergmann <[email protected]>
drm/msm: include linux/sched/task.h
Vladimir Oltean <[email protected]>
spi: spi-fsl-dspi: Fix 16-bit word order in 32-bit XSPI mode
Wen Yang <[email protected]>
ftrace: Avoid potential division by zero in function profiler
Catalin Marinas <[email protected]>
arm64: Revert support for execute-only user mappings
chenqiwu <[email protected]>
exit: panic before exit_mm() on global init exit
James Smart <[email protected]>
scsi: lpfc: Fix rpi release when deleting vport
Takashi Iwai <[email protected]>
ALSA: firewire-motu: Correct a typo in the clock proc string
Takashi Iwai <[email protected]>
ALSA: pcm: Yet another missing check of non-cached buffer type
Colin Ian King <[email protected]>
ALSA: cs4236: fix error return comparison of an unsigned integer
Masahiro Yamada <[email protected]>
gen_initramfs_list.sh: fix 'bad variable name' error
Peter Ujfalusi <[email protected]>
dmaengine: virt-dma: Fix access after free in vchan_complete()
John Johansen <[email protected]>
apparmor: fix aa_xattrs_match() may sleep while holding a RCU lock
Navid Emamdoost <[email protected]>
mm/gup: fix memory leak in __gup_benchmark_ioctl
Jens Axboe <[email protected]>
io_uring: use current task creds instead of allocating a new one
Sven Schnelle <[email protected]>
samples/trace_printk: Wait for IRQ work to finish
Sven Schnelle <[email protected]>
tracing: Fix endianness bug in histogram trigger
Steven Rostedt (VMware) <[email protected]>
tracing: Have the histogram compare functions convert to u64 first
Keita Suzuki <[email protected]>
tracing: Avoid memory leak in process_system_preds()
Prateek Sood <[email protected]>
tracing: Fix lock inversion in trace_event_enable_tgid_record()
Mathieu Desnoyers <[email protected]>
rseq/selftests: Fix: Namespace gettid() for compatibility with glibc 2.30
Zong Li <[email protected]>
riscv: ftrace: correct the condition logic in function graph tracer
Zong Li <[email protected]>
clocksource: riscv: add notrace to riscv_sched_clock
Russell King <[email protected]>
gpiolib: fix up emulated open drain outputs
Max Filippov <[email protected]>
gpio: xtensa: fix driver build
Sascha Hauer <[email protected]>
libata: Fix retrieving of active qcs
Florian Fainelli <[email protected]>
ata: ahci_brcm: BCM7425 AHCI requires AHCI_HFLAG_DELAY_ENGINE
Florian Fainelli <[email protected]>
ata: ahci_brcm: Add missing clock management during recovery
Florian Fainelli <[email protected]>
ata: ahci_brcm: Fix AHCI resources management
Florian Fainelli <[email protected]>
ata: libahci_platform: Export again ahci_platform_<en/dis>able_phys()
Daniel Borkmann <[email protected]>
bpf: Fix precision tracking for unbounded scalars
Arnd Bergmann <[email protected]>
compat_ioctl: block: handle BLKGETZONESZ/BLKGETNRZONES
Arnd Bergmann <[email protected]>
compat_ioctl: block: handle BLKREPORTZONE/BLKRESETZONE
Arnd Bergmann <[email protected]>
compat_ioctl: block: handle Persistent Reservations
Ming Lei <[email protected]>
block: fix splitting segments on boundary masks
Filipe Manana <[email protected]>
Btrfs: fix infinite loop during nocow writeback due to race
Paul Cercueil <[email protected]>
dmaengine: dma-jz4780: Also break descriptor chains on JZ4725B
Lukas Wunner <[email protected]>
dmaengine: Fix access to uninitialized dma_slave_caps
Sargun Dhillon <[email protected]>
selftests/seccomp: Catch garbage on SECCOMP_IOCTL_NOTIF_RECV
Sargun Dhillon <[email protected]>
samples/seccomp: Zero out members based on seccomp_notif_sizes
Sargun Dhillon <[email protected]>
seccomp: Check that seccomp_notif is zeroed out by the user
Sargun Dhillon <[email protected]>
selftests/seccomp: Zero out seccomp_notif
Amir Goldstein <[email protected]>
locks: print unsigned ino in /proc/locks
Arnd Bergmann <[email protected]>
gcc-plugins: make it possible to disable CONFIG_GCC_PLUGINS again
Kees Cook <[email protected]>
pstore/ram: Fix error-path memory leak in persistent_ram_new() callers
Aleksandr Yashkin <[email protected]>
pstore/ram: Write new dumps to start of recycled zones
Gang He <[email protected]>
ocfs2: fix the crash due to call ocfs2_get_dlm_debug once less
Ilya Dryomov <[email protected]>
mm/oom: fix pgtables units mismatch in Killed process message
Yang Shi <[email protected]>
mm: move_pages: return valid node id in status if the page is already on the target node
Shakeel Butt <[email protected]>
memcg: account security cred as well to kmemcg
Chanho Min <[email protected]>
mm/zsmalloc.c: fix the migrated zspage statistics.
David Hildenbrand <[email protected]>
mm/memory_hotplug: shrink zones when offlining memory
Hans Verkuil <[email protected]>
media: cec: check 'transmit_in_progress', not 'transmitting'
Hans Verkuil <[email protected]>
media: cec: avoid decrementing transmit_queue_sz if it is 0
Hans Verkuil <[email protected]>
media: cec: CEC 2.0-only bcast messages were ignored
Hans Verkuil <[email protected]>
media: pulse8-cec: fix lost cec_transmit_attempt_done() call
Paul Burton <[email protected]>
MIPS: Avoid VDSO ABI breakage due to global register variable
Alexander Lobakin <[email protected]>
MIPS: BPF: eBPF JIT: check for MIPS ISA compliance in Kconfig
Paul Burton <[email protected]>
MIPS: BPF: Disable MIPS32 eBPF JIT
Alex Deucher <[email protected]>
drm/amdgpu/smu: add metrics table lock for vega20 (v2)
Alex Deucher <[email protected]>
drm/amdgpu/smu: add metrics table lock for navi (v2)
Alex Deucher <[email protected]>
drm/amdgpu/smu: add metrics table lock for arcturus (v2)
Alex Deucher <[email protected]>
drm/amdgpu/smu: add metrics table lock
Stefan Mavrodiev <[email protected]>
drm/sun4i: hdmi: Remove duplicate cleanup calls
Kailang Yang <[email protected]>
ALSA: hda/realtek - Add headset Mic no shutup for ALC283
Takashi Iwai <[email protected]>
ALSA: hda - Apply sync-write workaround to old Intel platforms, too
Hui Wang <[email protected]>
ALSA: usb-audio: set the interface format after resume on Dell WD19
Johan Hovold <[email protected]>
ALSA: usb-audio: fix set_format altsetting sanity check
Takashi Iwai <[email protected]>
ALSA: ice1724: Fix sleep-in-atomic in Infrasonic Quartet support code
Johannes Weiner <[email protected]>
mm: drop mmap_sem before calling balance_dirty_pages() in write fault
Ming Lei <[email protected]>
block: add bio_truncate to fix guard_bio_eod
Phil Sutter <[email protected]>
netfilter: nft_tproxy: Fix port selector on Big Endian
Takashi Iwai <[email protected]>
ALSA: hda - Downgrade error message for single-cmd fallback
Christian Brauner <[email protected]>
taskstats: fix data-race
Kirill A. Shutemov <[email protected]>
shmem: pin the file in shmem_fault() if mmap_sem is dropped
Eric Dumazet <[email protected]>
tcp: fix data-race in tcp_recvmsg()
Jaroslav Kysela <[email protected]>
ALSA: hda - fixup for the bass speaker on Lenovo Carbon X1 7th gen
Takashi Iwai <[email protected]>
PCI: Fix missing inline for pci_pr3_present()
Kai-Heng Feng <[email protected]>
ALSA: hda: Allow HDA to be runtime suspended when dGPU is not bound to a driver
Kai-Heng Feng <[email protected]>
PCI: Add a helper to check Power Resource Requirements _PR3 existence
Chris Chiu <[email protected]>
ALSA: hda/realtek - Enable the bass speaker of ASUS UX431FLC
Kailang Yang <[email protected]>
ALSA: hda/realtek - Add Bass Speaker and fixed dac for bass speaker
Andy Whitcroft <[email protected]>
PM / hibernate: memory_bm_find_bit(): Tighten node optimisation
Juergen Gross <[email protected]>
xen/balloon: fix ballooned page accounting without hotplug enabled
Paul Durrant <[email protected]>
xen-blkback: prevent premature module unload
Maor Gottlieb <[email protected]>
IB/mlx5: Fix steering rule of drop and count
Parav Pandit <[email protected]>
IB/mlx4: Follow mirror sequence of device add during device removal
Mark Zhang <[email protected]>
RDMA/counter: Prevent auto-binding a QP which are not tracked with res
Thomas Richter <[email protected]>
s390/cpum_sf: Avoid SBD overflow condition in irq handler
Thomas Richter <[email protected]>
s390/cpum_sf: Adjust sampling interval to avoid hitting sample limits
Zhiqiang Liu <[email protected]>
md: raid1: check rdev before reference in raid1_sync_request func
Guoqing Jiang <[email protected]>
raid5: need to set STRIPE_HANDLE for batch head
David Howells <[email protected]>
afs: Fix creation calls in the dynamic root to fail with EOPNOTSUPP
David Howells <[email protected]>
afs: Fix mountpoint parsing
Jens Axboe <[email protected]>
net: make socket read/write_iter() honor IOCB_NOWAIT
EJ Hsu <[email protected]>
usb: gadget: fix wrong endpoint desc
Ben Skeggs <[email protected]>
drm/nouveau/kms/nv50-: fix panel scaling
Hans de Goede <[email protected]>
drm/nouveau: Fix drm-core using atomic code-paths on pre-nv50 hardware
Hans de Goede <[email protected]>
drm/nouveau: Move the declaration of struct nouveau_conn_atom up a bit
Kay Friedrich <[email protected]>
staging/wlan-ng: add CRC32 dependency in Kconfig
Bo Wu <[email protected]>
scsi: iscsi: Avoid potential deadlock in iscsi_if_rx func
Jason Yan <[email protected]>
scsi: libsas: stop discovering if oob mode is disconnected
Dan Carpenter <[email protected]>
scsi: iscsi: qla4xxx: fix double free in probe
Roman Bolshakov <[email protected]>
scsi: qla2xxx: Ignore PORT UPDATE after N2N PLOGI
Roman Bolshakov <[email protected]>
scsi: qla2xxx: Don't defer relogin unconditonally
Roman Bolshakov <[email protected]>
scsi: qla2xxx: Send Notify ACK after N2N PLOGI
Roman Bolshakov <[email protected]>
scsi: qla2xxx: Configure local loop for N2N target
Roman Bolshakov <[email protected]>
scsi: qla2xxx: Fix PLOGI payload and ELS IOCB dump length
Roman Bolshakov <[email protected]>
scsi: qla2xxx: Don't call qlt_async_event twice
Roman Bolshakov <[email protected]>
scsi: qla2xxx: Drop superfluous INIT_WORK of del_work
Quinn Tran <[email protected]>
scsi: qla2xxx: Use explicit LOGO in target mode
Bo Wu <[email protected]>
scsi: lpfc: Fix memory leak on lpfc_bsg_write_ebuf_set func
Steve Wise <[email protected]>
rxe: correctly calculate iCRC for unaligned payloads
Chuhong Yuan <[email protected]>
RDMA/cma: add missed unregister_pernet_subsys in init failure
David Howells <[email protected]>
afs: Fix SELinux setting security label on /afs
Marc Dionne <[email protected]>
afs: Fix afs_find_server lookups for ipv4 peers
Leonard Crestez <[email protected]>
PM / devfreq: Don't fail devfreq_dev_release if not in list
Leonard Crestez <[email protected]>
PM / devfreq: Set scaling_max_freq to max on OPP notifier error
Leonard Crestez <[email protected]>
PM / devfreq: Fix devfreq_notifier_call returning errno
Geert Uytterhoeven <[email protected]>
iio: adc: max9611: Fix too short conversion time delay
YueHaibing <[email protected]>
iio: st_accel: Fix unused variable warning
Keith Busch <[email protected]>
nvme/pci: Fix read queue count
Keith Busch <[email protected]>
nvme/pci: Fix write and poll queue types
Eric Yang <[email protected]>
drm/amd/display: update dispclk and dppclk vco frequency
Nikola Cornij <[email protected]>
drm/amd/display: Reset steer fifo before unblanking the stream
Leo (Hanghong) Ma <[email protected]>
drm/amd/display: Change the delay time before enabling FEC
David Galiffi <[email protected]>
drm/amd/display: Fixed kernel panic when booting with DP-to-HDMI dongle
Nikola Cornij <[email protected]>
drm/amd/display: Map DSC resources 1-to-1 if numbers of OPPs and DSCs are equal
Pierre-Eric Pelloux-Prayer <[email protected]>
drm/amdgpu: add cache flush workaround to gfx8 emit_fence
Alex Deucher <[email protected]>
drm/amdgpu: add header line for power profile on Arcturus
Guchun Chen <[email protected]>
drm/amdgpu: add check before enabling/disabling broadcast mode
James Smart <[email protected]>
nvme-fc: fix double-free scenarios on hw queues
James Smart <[email protected]>
nvme_fc: add module to ops template to allow module references
Stephan Gerhold <[email protected]>
drm/mcde: dsi: Fix invalid pointer dereference if panel cannot be found
-------------
Diffstat:
Documentation/admin-guide/kernel-parameters.txt | 2 +- .../bindings/clock/renesas,rcar-usb2-clock-sel.txt | 2 +- Makefile | 4 +- .../arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 4 +- .../dts/amlogic/meson-gxl-s905x-khadas-vim.dts | 3 + .../boot/dts/amlogic/meson-gxm-khadas-vim2.dts | 3 + arch/arm64/boot/dts/qcom/msm8998-clamshell.dtsi | 37 ++++++ arch/arm64/include/asm/pgtable-prot.h | 5 +- arch/arm64/include/asm/pgtable.h | 10 +- arch/arm64/mm/fault.c | 2 +- arch/arm64/mm/mmu.c | 4 +- arch/ia64/mm/init.c | 4 +- arch/mips/Kconfig | 2 +- arch/mips/include/asm/thread_info.h | 20 +++- arch/mips/net/ebpf_jit.c | 2 +- arch/powerpc/mm/mem.c | 30 ++++- arch/powerpc/mm/slice.c | 4 +- arch/riscv/kernel/ftrace.c | 2 +- arch/s390/kernel/perf_cpum_sf.c | 22 +++- arch/s390/kernel/smp.c | 80 +++++++++---- arch/s390/mm/init.c | 4 +- arch/sh/mm/init.c | 4 +- arch/x86/events/intel/bts.c | 16 ++- arch/x86/mm/init_32.c | 4 +- arch/x86/mm/init_64.c | 4 +- block/bio.c | 39 ++++++ block/blk-merge.c | 18 +-- block/compat_ioctl.c | 13 ++ drivers/acpi/sysfs.c | 6 +- drivers/ata/ahci_brcm.c | 133 +++++++++++++++------ drivers/ata/libahci_platform.c | 6 +- drivers/ata/libata-core.c | 24 ++++ drivers/ata/sata_fsl.c | 2 +- drivers/ata/sata_mv.c | 2 +- drivers/ata/sata_nv.c | 2 +- drivers/block/xen-blkback/blkback.c | 2 + drivers/block/xen-blkback/xenbus.c | 10 ++ drivers/bluetooth/btusb.c | 3 +- drivers/clocksource/timer-riscv.c | 2 +- drivers/devfreq/devfreq.c | 30 ++--- drivers/dma/dma-jz4780.c | 3 +- drivers/dma/virt-dma.c | 3 +- drivers/firewire/net.c | 6 +- drivers/firmware/arm_scmi/bus.c | 8 +- drivers/firmware/efi/rci2-table.c | 3 + drivers/gpio/gpio-xtensa.c | 7 +- drivers/gpio/gpiolib.c | 8 ++ drivers/gpu/drm/amd/amdgpu/df_v3_6.c | 38 +++--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 22 +++- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 2 +- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 9 +- .../gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | 13 +- .../amd/display/dc/dcn20/dcn20_stream_encoder.c | 12 +- .../gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 2 +- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 1 + drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 8 ++ drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 1 + drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 3 + drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 3 + drivers/gpu/drm/i915/gt/intel_lrc.c | 3 +- drivers/gpu/drm/mcde/mcde_dsi.c | 6 +- drivers/gpu/drm/msm/msm_gpu.c | 1 + drivers/gpu/drm/nouveau/dispnv50/disp.c | 6 +- drivers/gpu/drm/nouveau/nouveau_connector.c | 28 +++-- drivers/gpu/drm/nouveau/nouveau_connector.h | 116 +++++++++--------- drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 2 - drivers/hid/i2c-hid/i2c-hid-core.c | 12 +- drivers/iio/accel/st_accel_core.c | 8 +- drivers/iio/adc/max9611.c | 16 ++- drivers/infiniband/core/cma.c | 1 + drivers/infiniband/core/counters.c | 3 + drivers/infiniband/hw/mlx4/main.c | 9 +- drivers/infiniband/hw/mlx5/main.c | 13 +- drivers/infiniband/sw/rxe/rxe_recv.c | 2 +- drivers/infiniband/sw/rxe/rxe_req.c | 6 + drivers/infiniband/sw/rxe/rxe_resp.c | 7 ++ drivers/iommu/intel-svm.c | 6 +- drivers/md/raid1.c | 2 +- drivers/md/raid5.c | 2 +- drivers/media/cec/cec-adap.c | 40 +++++-- drivers/media/usb/b2c2/flexcop-usb.c | 2 +- drivers/media/usb/dvb-usb/af9005.c | 5 +- drivers/media/usb/pulse8-cec/pulse8-cec.c | 17 ++- drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 23 +++- drivers/nvme/host/fc.c | 32 ++++- drivers/nvme/host/pci.c | 14 +-- drivers/nvme/target/fcloop.c | 1 + drivers/of/overlay.c | 37 +++--- drivers/pci/pci.c | 18 +++ drivers/phy/renesas/phy-rcar-gen3-usb2.c | 2 +- drivers/platform/x86/pmc_atom.c | 8 ++ drivers/regulator/ab8500.c | 17 --- drivers/regulator/axp20x-regulator.c | 11 +- drivers/regulator/bd70528-regulator.c | 1 - drivers/scsi/libsas/sas_discover.c | 11 +- drivers/scsi/lpfc/lpfc_bsg.c | 15 ++- drivers/scsi/lpfc/lpfc_hbadisc.c | 88 +++++++++----- drivers/scsi/lpfc/lpfc_nvme.c | 2 + drivers/scsi/lpfc/lpfc_sli.c | 2 + drivers/scsi/qla2xxx/qla_def.h | 1 + drivers/scsi/qla2xxx/qla_init.c | 11 +- drivers/scsi/qla2xxx/qla_iocb.c | 22 +++- drivers/scsi/qla2xxx/qla_isr.c | 4 - drivers/scsi/qla2xxx/qla_mbx.c | 3 +- drivers/scsi/qla2xxx/qla_nvme.c | 1 + drivers/scsi/qla2xxx/qla_target.c | 3 +- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 1 + drivers/scsi/qla4xxx/ql4_os.c | 1 - drivers/scsi/scsi_transport_iscsi.c | 7 ++ drivers/spi/spi-fsl-dspi.c | 15 +-- drivers/spi/spi-uniphier.c | 31 +++-- drivers/staging/wlan-ng/Kconfig | 1 + drivers/tty/serial/msm_serial.c | 13 +- drivers/usb/gadget/function/f_ecm.c | 6 +- drivers/usb/gadget/function/f_rndis.c | 1 + drivers/watchdog/Kconfig | 1 + drivers/xen/balloon.c | 3 +- fs/afs/dynroot.c | 3 + fs/afs/mntpt.c | 6 +- fs/afs/server.c | 21 ++-- fs/afs/super.c | 1 - fs/btrfs/async-thread.c | 58 ++------- fs/btrfs/async-thread.h | 33 +---- fs/btrfs/block-group.c | 3 +- fs/btrfs/delayed-inode.c | 4 +- fs/btrfs/disk-io.c | 34 ++---- fs/btrfs/extent_io.c | 2 +- fs/btrfs/inode.c | 67 ++++++----- fs/btrfs/ordered-data.c | 1 - fs/btrfs/qgroup.c | 1 - fs/btrfs/raid56.c | 5 +- fs/btrfs/reada.c | 3 +- fs/btrfs/scrub.c | 14 +-- fs/btrfs/volumes.c | 3 +- fs/buffer.c | 25 +--- fs/cifs/dfs_cache.c | 3 +- fs/cifs/inode.c | 2 +- fs/cifs/smb2pdu.c | 41 +++++-- fs/compat_ioctl.c | 3 +- fs/io_uring.c | 4 +- fs/locks.c | 2 +- fs/nfsd/nfs4state.c | 15 ++- fs/ocfs2/dlmglue.c | 1 + fs/pstore/ram.c | 13 ++ fs/ubifs/tnc_commit.c | 34 ++++-- fs/xfs/libxfs/xfs_bmap.c | 2 +- fs/xfs/scrub/common.h | 9 +- include/linux/ahci_platform.h | 2 + include/linux/bio.h | 1 + include/linux/dmaengine.h | 5 +- include/linux/libata.h | 1 + include/linux/memory_hotplug.h | 7 +- include/linux/nvme-fc-driver.h | 4 + include/linux/pci.h | 2 + include/linux/regulator/ab8500.h | 1 - include/net/neighbour.h | 2 +- include/net/sch_generic.h | 6 +- include/net/sock.h | 4 +- kernel/bpf/verifier.c | 43 +++---- kernel/cred.c | 6 +- kernel/exit.c | 12 +- kernel/module.c | 2 + kernel/power/snapshot.c | 9 +- kernel/seccomp.c | 7 ++ kernel/taskstats.c | 30 +++-- kernel/trace/ftrace.c | 6 +- kernel/trace/trace.c | 8 ++ kernel/trace/trace_events.c | 8 +- kernel/trace/trace_events_filter.c | 2 +- kernel/trace/trace_events_hist.c | 21 +++- kernel/trace/tracing_map.c | 4 +- lib/ubsan.c | 64 ++++------ mm/filemap.c | 21 ---- mm/gup_benchmark.c | 8 +- mm/hugetlb.c | 51 +++++++- mm/internal.h | 21 ++++ mm/memory.c | 38 ++++-- mm/memory_hotplug.c | 31 ++--- mm/memremap.c | 2 +- mm/migrate.c | 23 +++- mm/mmap.c | 6 - mm/oom_kill.c | 2 +- mm/shmem.c | 11 +- mm/sparse.c | 4 +- mm/zsmalloc.c | 5 + net/bluetooth/hci_conn.c | 4 +- net/bluetooth/l2cap_core.c | 4 +- net/core/dev.c | 2 +- net/core/neighbour.c | 4 +- net/core/sock.c | 2 +- net/core/sysctl_net_core.c | 2 + net/ethernet/eth.c | 7 +- net/hsr/hsr_debugfs.c | 16 ++- net/hsr/hsr_device.c | 26 ++-- net/hsr/hsr_framereg.c | 73 ++++++----- net/hsr/hsr_framereg.h | 6 +- net/hsr/hsr_main.c | 2 +- net/hsr/hsr_main.h | 16 ++- net/ipv4/tcp.c | 14 +-- net/ipv4/tcp_bbr.c | 3 +- net/ipv4/tcp_output.c | 4 +- net/netfilter/nf_queue.c | 2 +- net/netfilter/nft_tproxy.c | 4 +- net/sched/sch_generic.c | 2 +- net/socket.c | 4 +- net/sunrpc/cache.c | 6 - samples/seccomp/user-trap.c | 4 +- samples/trace_printk/trace-printk.c | 1 + scripts/gcc-plugins/Kconfig | 9 +- security/apparmor/apparmorfs.c | 2 +- security/apparmor/domain.c | 82 +++++++------ security/apparmor/policy.c | 4 +- sound/core/pcm_native.c | 3 +- sound/firewire/motu/motu-proc.c | 2 +- sound/isa/cs423x/cs4236.c | 3 +- sound/pci/hda/hda_controller.c | 2 +- sound/pci/hda/hda_intel.c | 17 ++- sound/pci/hda/patch_realtek.c | 61 ++++++++-- sound/pci/ice1712/ice1724.c | 9 +- sound/usb/card.h | 1 + sound/usb/pcm.c | 25 +++- sound/usb/quirks-table.h | 3 +- sound/usb/quirks.c | 11 ++ sound/usb/usbaudio.h | 3 +- tools/perf/util/machine.c | 2 +- tools/testing/selftests/rseq/param_test.c | 18 +-- tools/testing/selftests/seccomp/seccomp_bpf.c | 15 ++- usr/gen_initramfs_list.sh | 2 +- 228 files changed, 1774 insertions(+), 1039 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/191 drm/mcde: dsi: Fix invalid pointer dereference if panel cannot be found
From: Stephan Gerhold <[email protected]>
[ Upstream commit c131280c03bd1c225c2e64e9ef75873ffca3d96e ]
The "panel" pointer is not reset to NULL if of_drm_find_panel() returns an error. Therefore we later assume that a panel was found, and try to dereference the error pointer, resulting in:
mcde-dsi a0351000.dsi: failed to find panel try bridge (4294966779)
Unable to handle kernel paging request at virtual address fffffe03
PC is at drm_panel_bridge_add.part.0+0x10/0x5c
LR is at mcde_dsi_bind+0x120/0x464
...Reset "panel" to NULL to avoid this problem.
Also change the format string of the error to %ld to print the negative errors correctly. The crash above then becomes:
mcde-dsi a0351000.dsi: failed to find panel try bridge (-517)
mcde-dsi a0351000.dsi: no panel or bridge
...--- drivers/gpu/drm/mcde/mcde_dsi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/mcde/mcde_dsi.c +4 -2
@@ -935,11 +935,13 @@ static int mcde_dsi_bind(struct device *dev, struct device *master,for_each_available_child_of_node (dev->of_node, child) { panel =of_drm_find_panel (child);if (IS_ERR (panel)) { -dev_err (dev,"failed to find panel try bridge (%lu)\n" , +dev_err (dev,"failed to find panel try bridge (%ld)\n" ,PTR_ERR (panel)); + panel =NULL ; + bridge =of_drm_find_bridge (child);if (IS_ERR (bridge)) { -dev_err (dev,"failed to find bridge (%lu)\n" , +dev_err (dev,"failed to find bridge (%ld)\n" ,PTR_ERR (bridge));return PTR_ERR (bridge); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 2/191 nvme_fc: add module to ops template to allow module references
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit 863fbae929c7a5b64e96b8a3ffb34a29eefb9f8f ]
In nvme-fc: it's possible to have connected active controllers and as no references are taken on the LLDD, the LLDD can be unloaded. The controller would enter a reconnect state and as long as the LLDD resumed within the reconnect timeout, the controller would resume. But if a namespace on the controller is the root device, allowing the driver to unload can be problematic. To reload the driver, it may require new io to the boot device, and as it's no longer connected we get into a catch-22 that eventually fails, and the system locks up.
Fix this issue by taking a module reference for every connected controller (which is what the core layer did to the transport module). Reference is cleared when the controller is removed.
--- drivers/nvme/host/fc.c | 14 ++++++++++++-- drivers/nvme/target/fcloop.c | 1 + drivers/scsi/lpfc/lpfc_nvme.c | 2 ++ drivers/scsi/qla2xxx/qla_nvme.c | 1 + include/linux/nvme-fc-driver.h | 4 ++++ 5 files changed, 20 insertions(+), 2 deletions(-)
drivers/nvme/host/fc.c +12 -2
@@ -342,7 +342,8 @@ nvme_fc_register_localport(struct nvme_fc_port_info *pinfo, !template->ls_req || !template->fcp_io || !template->ls_abort || !template->fcp_abort || !template->max_hw_queues || !template->max_sgl_segments || - !template->max_dif_sgl_segments || !template->dma_boundary) { + !template->max_dif_sgl_segments || !template->dma_boundary || + !template->module) { ret = -EINVAL; goto out_reghost_failed; }
@@ -2015,6 +2016,7 @@ nvme_fc_ctrl_free(struct kref *ref) {struct nvme_fc_ctrl *ctrl = container_of(ref, struct nvme_fc_ctrl, ref); +struct nvme_fc_lport *lport = ctrl->lport;unsigned long flags;if (ctrl->ctrl.tagset) {
@@ -2041,6 +2043,7 @@ nvme_fc_ctrl_free(struct kref *ref)if (ctrl->ctrl.opts)nvmf_free_options (ctrl->ctrl.opts);kfree (ctrl); +module_put (lport->ops->module); } static void
@@ -3056,10 +3059,15 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, goto out_fail; } +if (!try_module_get (lport->ops->module)) { + ret = -EUNATCH ; + goto out_free_ctrl; + } + idx =ida_simple_get (&nvme_fc_ctrl_cnt,0 ,0 ,GFP_KERNEL );if (idx <0 ) { ret = -ENOSPC ; - goto out_free_ctrl; + goto out_mod_put; } ctrl->ctrl.opts = opts;
@@ -3212,6 +3220,8 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, out_free_ida:put_device (ctrl->dev);ida_simple_remove (&nvme_fc_ctrl_cnt, ctrl->cnum); +out_mod_put: +module_put (lport->ops->module); out_free_ctrl:kfree (ctrl); out_fail:
drivers/nvme/target/fcloop.c +1 -0
@@ -850,6 +850,7 @@ fcloop_targetport_delete(struct nvmet_fc_target_port *targetport)#define FCLOOP_DMABOUND_4G 0xFFFFFFFFstatic struct nvme_fc_port_template fctemplate = { + .module =THIS_MODULE , .localport_delete = fcloop_localport_delete, .remoteport_delete = fcloop_remoteport_delete, .create_queue = fcloop_create_queue,
drivers/scsi/lpfc/lpfc_nvme.c +2 -0
@@ -1976,6 +1976,8 @@ lpfc_nvme_fcp_abort(struct nvme_fc_local_port *pnvme_lport,/* Declare and initialization an instance of the FC NVME template. */ static struct nvme_fc_port_template lpfc_nvme_template = { + .module =THIS_MODULE , +/* initiator-based functions */ .localport_delete = lpfc_nvme_localport_delete, .remoteport_delete = lpfc_nvme_remoteport_delete,
drivers/scsi/qla2xxx/qla_nvme.c +1 -0
@@ -610,6 +610,7 @@ static void qla_nvme_remoteport_delete(struct nvme_fc_remote_port *rport) }static struct nvme_fc_port_template qla_nvme_fc_transport = { + .module =THIS_MODULE , .localport_delete = qla_nvme_localport_delete, .remoteport_delete = qla_nvme_remoteport_delete, .create_queue = qla_nvme_alloc_queue,
include/linux/nvme-fc-driver.h +4 -0
@@ -270,6 +270,8 @@ struct nvme_fc_remote_port {* * Host/Initiator Transport Entrypoints/Parameters: * +* @module: The LLDD module using the interface +* * @localport_delete: The LLDD initiates deletion of a localport via * nvme_fc_deregister_localport(). However, the teardown is * asynchronous. This routine is called upon the completion of the
@@ -383,6 +385,8 @@ struct nvme_fc_remote_port {* Value is Mandatory. Allowed to be zero. */ struct nvme_fc_port_template { +struct module *module; +/* initiator-based functions */ void (*localport_delete)(struct nvme_fc_local_port *);void (*remoteport_delete)(struct nvme_fc_remote_port *);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 3/191 nvme-fc: fix double-free scenarios on hw queues
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit c869e494ef8b5846d9ba91f1e922c23cd444f0c1 ]
If an error occurs on one of the ios used for creating an association, the creating routine has error paths that are invoked by the command failure and the error paths will free up the controller resources created to that point.
But... the io was ultimately determined by an asynchronous completion routine that detected the error and which unconditionally invokes the error_recovery path which calls delete_association. Delete association deletes all outstanding io then tears down the controller resources. So the create_association thread can be running in parallel with the error_recovery thread. What was seen was the LLDD received a call to delete a queue, causing the LLDD to do a free of a resource, then the transport called the delete queue again causing the driver to repeat the free call. The second free routine corrupted the allocator. The transport shouldn't be making the duplicate call, and the delete queue is just one of the resources being freed.
To fix, it is realized that the create_association path is completely serialized with one command at a time. So the failed io completion will always be seen by the create_association path and as of the failure, there are no ios to terminate and there is no reason to be manipulating queue freeze states, etc. The serialized condition stays true until the controller is transitioned to the LIVE state. Thus the fix is to change the error recovery path to check the controller state and only invoke the teardown path if not already in the CONNECTING state.
--- drivers/nvme/host/fc.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/nvme/host/fc.c +15 -3
@@ -2910,10 +2910,22 @@ nvme_fc_reconnect_or_delete(struct nvme_fc_ctrl *ctrl, int status)static void __nvme_fc_terminate_io (struct nvme_fc_ctrl *ctrl) { -nvme_stop_keep_alive (&ctrl->ctrl); +/* +* if state is connecting - the error occurred as part of a +* reconnect attempt. The create_association error paths will +* clean up any outstanding io. +* +* if it's a different state - ensure all pending io is +* terminated. Given this can delay while waiting for the +* aborted io to return, we recheck adapter state below +* before changing state. +*/ +if (ctrl->ctrl.state !=NVME_CTRL_CONNECTING ) { +nvme_stop_keep_alive (&ctrl->ctrl); -/* will block will waiting for io to terminate */ -nvme_fc_delete_association (ctrl); +/* will block will waiting for io to terminate */ +nvme_fc_delete_association (ctrl); + }if (ctrl->ctrl.state !=NVME_CTRL_CONNECTING && !nvme_change_ctrl_state (&ctrl->ctrl,NVME_CTRL_CONNECTING ))
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 4/191 drm/amdgpu: add check before enabling/disabling broadcast mode
In reply to Greg Kroah-HartmanFrom: Guchun Chen <[email protected]>
[ Upstream commit 6e807535dae5dbbd53bcc5e81047a20bf5eb08ea ]
When security violation from new vbios happens, data fabric is risky to stop working. So prevent the direct access to DF mmFabricConfigAccessControl from the new vbios and onwards.
--- drivers/gpu/drm/amd/amdgpu/df_v3_6.c | 38 ++++++++++++++++------------ 1 file changed, 22 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/df_v3_6.c +22 -16
@@ -261,23 +261,29 @@ static void df_v3_6_update_medium_grain_clock_gating(struct amdgpu_device *adev, {u32 tmp; -/* Put DF on broadcast mode */ - adev->df_funcs->enable_broadcast_mode (adev, true); - -if (enable && (adev->cg_flags &AMD_CG_SUPPORT_DF_MGCG )) { - tmp =RREG32_SOC15 (DF ,0 , mmDF_PIE_AON0_DfGlobalClkGater); - tmp &= ~DF_PIE_AON0_DfGlobalClkGater__MGCGMode_MASK; - tmp |=DF_V3_6_MGCG_ENABLE_15_CYCLE_DELAY ; -WREG32_SOC15 (DF ,0 , mmDF_PIE_AON0_DfGlobalClkGater, tmp); - }else { - tmp =RREG32_SOC15 (DF ,0 , mmDF_PIE_AON0_DfGlobalClkGater); - tmp &= ~DF_PIE_AON0_DfGlobalClkGater__MGCGMode_MASK; - tmp |=DF_V3_6_MGCG_DISABLE ; -WREG32_SOC15 (DF ,0 , mmDF_PIE_AON0_DfGlobalClkGater, tmp); - } +if (adev->cg_flags &AMD_CG_SUPPORT_DF_MGCG ) { +/* Put DF on broadcast mode */ + adev->df_funcs->enable_broadcast_mode (adev, true); + +if (enable) { + tmp =RREG32_SOC15 (DF ,0 , + mmDF_PIE_AON0_DfGlobalClkGater); + tmp &= ~DF_PIE_AON0_DfGlobalClkGater__MGCGMode_MASK; + tmp |=DF_V3_6_MGCG_ENABLE_15_CYCLE_DELAY ; +WREG32_SOC15 (DF ,0 , + mmDF_PIE_AON0_DfGlobalClkGater, tmp); + }else { + tmp =RREG32_SOC15 (DF ,0 , + mmDF_PIE_AON0_DfGlobalClkGater); + tmp &= ~DF_PIE_AON0_DfGlobalClkGater__MGCGMode_MASK; + tmp |=DF_V3_6_MGCG_DISABLE ; +WREG32_SOC15 (DF ,0 , + mmDF_PIE_AON0_DfGlobalClkGater, tmp); + } -/* Exit broadcast mode */ - adev->df_funcs->enable_broadcast_mode (adev, false); +/* Exit broadcast mode */ + adev->df_funcs->enable_broadcast_mode (adev, false); + } } static void df_v3_6_get_clockgating_state(struct amdgpu_device *adev,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 5/191 drm/amdgpu: add header line for power profile on Arcturus
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
[ Upstream commit 14891c316ca7e15d81dba78f30fb630e3f9ee2c9 ]
So the output is consistent with other asics.
--- drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +5 -0
@@ -1388,12 +1388,17 @@ static int arcturus_get_power_profile_mode(struct smu_context *smu,"VR" ,"COMPUTE" , "CUSTOM"}; +static const char *title[] = { +"PROFILE_INDEX(NAME)" };uint32_t i, size =0 ;int16_t workload_type =0 ;if (!smu->pm_enabled || !buf)return -EINVAL ; + size +=sprintf (buf + size,"%16s\n" , + title[0 ]); +for (i =0 ; i <=PP_SMC_POWER_PROFILE_CUSTOM ; i++) {/* * Conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 6/191 drm/amdgpu: add cache flush workaround to gfx8 emit_fence
In reply to Greg Kroah-HartmanFrom: Pierre-Eric Pelloux-Prayer <[email protected]>
[ Upstream commit bf26da927a1cd57c9deb2db29ae8cf276ba8b17b ]
The same workaround is used for gfx7.
Both PAL and Mesa use it for gfx8 too, so port this commit to gfx_v8_0_ring_emit_fence_gfx.
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +19 -3
@@ -6184,7 +6184,23 @@ static void gfx_v8_0_ring_emit_fence_gfx(struct amdgpu_ring *ring, u64 addr,bool write64bit = flags &AMDGPU_FENCE_FLAG_64BIT ;bool int_sel = flags &AMDGPU_FENCE_FLAG_INT ; -/* EVENT_WRITE_EOP - flush caches, send int */ +/* Workaround for cache flush problems. First send a dummy EOP +* event down the pipe with seq one below. +*/ +amdgpu_ring_write (ring,PACKET3 (PACKET3_EVENT_WRITE_EOP ,4 )); +amdgpu_ring_write (ring, (EOP_TCL1_ACTION_EN | +EOP_TC_ACTION_EN | +EOP_TC_WB_ACTION_EN | +EVENT_TYPE (CACHE_FLUSH_AND_INV_TS_EVENT ) | +EVENT_INDEX (5 ))); +amdgpu_ring_write (ring, addr &0xfffffffc ); +amdgpu_ring_write (ring, (upper_32_bits (addr) &0xffff ) | +DATA_SEL (1 ) |INT_SEL (0 )); +amdgpu_ring_write (ring,lower_32_bits (seq -1 )); +amdgpu_ring_write (ring,upper_32_bits (seq -1 )); + +/* Then send the real EOP event down the pipe: +* EVENT_WRITE_EOP - flush caches, send int */ amdgpu_ring_write (ring,PACKET3 (PACKET3_EVENT_WRITE_EOP ,4 )); amdgpu_ring_write(ring, (EOP_TCL1_ACTION_EN | EOP_TC_ACTION_EN |
@@ -6926,7 +6942,7 @@ static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {5 +/* COND_EXEC */ 7 +/* PIPELINE_SYNC */ VI_FLUSH_GPU_TLB_NUM_WREG *5 +9 +/* VM_FLUSH */ -8 +/* FENCE for VM_FLUSH */ +12 +/* FENCE for VM_FLUSH */ 20 +/* GDS switch */ 4 +/* double SWITCH_BUFFER, the first COND_EXEC jump to the place just
@@ -6938,7 +6954,7 @@ static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {31 +/* DE_META */ 3 +/* CNTX_CTRL */ 5 +/* HDP_INVL */ -8 +8 +/* FENCE x2 */ +12 +12 +/* FENCE x2 */ 2, /* SWITCH_BUFFER */ .emit_ib_size = 4, /* gfx_v8_0_ring_emit_ib_gfx */ .emit_ib = gfx_v8_0_ring_emit_ib_gfx,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 7/191 drm/amd/display: Map DSC resources 1-to-1 if numbers of OPPs and DSCs are equal
In reply to Greg Kroah-HartmanFrom: Nikola Cornij <[email protected]>
[ Upstream commit a1fc44b609b4e9c0941f0e4a1fc69d367af5ab69 ]
[why]
On ASICs where number of DSCs is the same as OPPs there's no need for DSC resource management. Mappping 1-to-1 fixes mode-set- or S3- -related issues for such platforms.
[how]
Map DSC resources 1-to-1 to pipes only if number of OPPs is the same as number of DSCs. This will still keep other ASICs working. A follow-up patch to fix mode-set issues on those ASICs will be required if testing shows issues with mode set.
--- .../gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +10 -3
@@ -1419,13 +1419,20 @@ enum dc_status dcn20_build_mapped_resource(const struct dc *dc, struct dc_statestatic void acquire_dsc (struct resource_context *res_ctx,const struct resource_pool *pool, -struct display_stream_compressor **dsc) +struct display_stream_compressor **dsc, +int pipe_idx) {int i;ASSERT (*dsc ==NULL ); *dsc =NULL ; +if (pool->res_cap->num_dsc == pool->res_cap->num_opp) { + *dsc = pool->dscs[pipe_idx]; + res_ctx->is_dsc_acquired[pipe_idx] = true; +return ; + } +/* Find first free DSC */ for (i =0 ; i < pool->res_cap->num_dsc; i++)if (!res_ctx->is_dsc_acquired[i]) {
@@ -1468,7 +1475,7 @@ static enum dc_status add_dsc_to_stream_resource(struct dc *dc,if (pipe_ctx->stream != dc_stream)continue ; -acquire_dsc (&dc_ctx->res_ctx, pool, &pipe_ctx->stream_res.dsc); +acquire_dsc (&dc_ctx->res_ctx, pool, &pipe_ctx->stream_res.dsc, i);/* The number of DSCs can be less than the number of pipes */ if (!pipe_ctx->stream_res.dsc) {
@@ -1669,7 +1676,7 @@ static bool dcn20_split_stream_for_odm( next_odm_pipe->stream_res.opp = pool->opps[next_odm_pipe->pipe_idx];#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT if (next_odm_pipe->stream->timing.flags.DSC ==1 ) { -acquire_dsc (res_ctx, pool, &next_odm_pipe->stream_res.dsc); +acquire_dsc (res_ctx, pool, &next_odm_pipe->stream_res.dsc, next_odm_pipe->pipe_idx);ASSERT (next_odm_pipe->stream_res.dsc);if (next_odm_pipe->stream_res.dsc ==NULL )return false;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 8/191 drm/amd/display: Fixed kernel panic when booting with DP-to-HDMI dongle
In reply to Greg Kroah-HartmanFrom: David Galiffi <[email protected]>
[ Upstream commit a51d9f8fe756beac51ce26ef54195da00a260d13 ]
[Why]
In dc_link_is_dp_sink_present, if dal_ddc_open fails, then dal_gpio_destroy_ddc is called, destroying pin_data and pin_clock. They are created only on dc_construct, and next aux access will cause a panic.
[How]
Instead of calling dal_gpio_destroy_ddc, call dal_ddc_close.
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1 -1
@@ -373,7 +373,7 @@ bool dc_link_is_dp_sink_present(struct dc_link *link)if (GPIO_RESULT_OK !=dal_ddc_open ( ddc,GPIO_MODE_INPUT ,GPIO_DDC_CONFIG_TYPE_MODE_I2C )) { -dal_gpio_destroy_ddc (&ddc); +dal_ddc_close (ddc);return present; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 9/191 drm/amd/display: Change the delay time before enabling FEC
In reply to Greg Kroah-HartmanFrom: Leo (Hanghong) Ma <[email protected]>
[ Upstream commit 28fa24ad14e8f7d23c62283eaf9c79b4fd165c16 ]
[why]
DP spec requires 1000 symbols delay between the end of link training and enabling FEC in the stream. Currently we are using 1 miliseconds delay which is not accurate.
[how]
One lane RBR should have the maximum time for transmitting 1000 LL codes which is 6.173 us. So using 7 microseconds delay instead of 1 miliseconds.
--- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +8 -1
@@ -3492,7 +3492,14 @@ void dp_set_fec_enable(struct dc_link *link, bool enable)if (link_enc->funcs->fec_set_enable && link->dpcd_caps.fec_cap.bits.FEC_CAPABLE) {if (link->fec_state == dc_link_fec_ready && enable) { -msleep (1 ); +/* Accord to DP spec, FEC enable sequence can first +* be transmitted anytime after 1000 LL codes have +* been transmitted on the link after link training +* completion. Using 1 lane RBR should have the maximum +* time for transmitting 1000 LL codes which is 6.173 us. +* So use 7 microseconds delay instead. +*/ +udelay (7 ); link_enc->funcs->fec_set_enable (link_enc, true); link->fec_state = dc_link_fec_enabled; }else if (link->fec_state == dc_link_fec_enabled && !enable) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 10/191 drm/amd/display: Reset steer fifo before unblanking the stream
In reply to Greg Kroah-HartmanFrom: Nikola Cornij <[email protected]>
[ Upstream commit 87de6cb2f28153bc74d0a001ca099c29453e145f ]
[why]
During mode transition steer fifo could overflow. Quite often it recovers by itself, but sometimes it doesn't.
[how]
Add steer fifo reset before unblanking the stream. Also add a short delay when resetting dig resync fifo to make sure register writes don't end up back-to-back, in which case the HW might miss the reset request.
--- .../drm/amd/display/dc/dcn20/dcn20_stream_encoder.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_stream_encoder.c +10 -2
@@ -492,15 +492,23 @@ void enc2_stream_encoder_dp_unblank( DP_VID_N_MUL, n_multiply); } -/* set DIG_START to 0x1 to reset FIFO */ +/* make sure stream is disabled before resetting steer fifo */ +REG_UPDATE (DP_VID_STREAM_CNTL ,DP_VID_STREAM_ENABLE , false); +REG_WAIT (DP_VID_STREAM_CNTL ,DP_VID_STREAM_STATUS ,0 ,10 ,5000 ); +/* set DIG_START to 0x1 to reset FIFO */ REG_UPDATE (DIG_FE_CNTL ,DIG_START ,1 ); +udelay (1 );/* write 0 to take the FIFO out of reset */ REG_UPDATE (DIG_FE_CNTL ,DIG_START ,0 ); -/* switch DP encoder to CRTC data */ +/* switch DP encoder to CRTC data, but reset it the fifo first. It may happen +* that it overflows during mode transition, and sometimes doesn't recover. +*/ +REG_UPDATE (DP_STEER_FIFO ,DP_STEER_FIFO_RESET ,1 ); +udelay (10 );REG_UPDATE (DP_STEER_FIFO ,DP_STEER_FIFO_RESET ,0 );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 11/191 drm/amd/display: update dispclk and dppclk vco frequency
In reply to Greg Kroah-HartmanFrom: Eric Yang <[email protected]>
[ Upstream commit 44ce6c3dc8479bb3ed68df13b502b0901675e7d6 ]
Value obtained from DV is not allowing 8k60 CTA mode with DSC to pass, after checking real value being used in hw, find out that correct value is 3600, which will allow that mode.
--- drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +1 -1
@@ -258,7 +258,7 @@ struct _vcs_dpi_soc_bounding_box_st dcn2_1_soc = { .vmm_page_size_bytes = 4096, .dram_clock_change_latency_us = 23.84, .return_bus_width_bytes = 64, - .dispclk_dppclk_vco_speed_mhz = 3550, + .dispclk_dppclk_vco_speed_mhz = 3600, .xfc_bus_transport_time_us = 4, .xfc_xbuf_latency_tolerance_us = 4, .use_urgent_burst_bw = 1,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 12/191 nvme/pci: Fix write and poll queue types
In reply to Greg Kroah-HartmanFrom: Keith Busch <[email protected]>
[ Upstream commit 3f68baf706ec68c4120867c25bc439c845fe3e17 ]
The number of poll or write queues should never be negative. Use unsigned types so that it's not possible to break have the driver not allocate any queues.
--- drivers/nvme/host/pci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/nvme/host/pci.c +4 -4
@@ -68,14 +68,14 @@ static int io_queue_depth = 1024;module_param_cb (io_queue_depth, &io_queue_depth_ops, &io_queue_depth,0644 );MODULE_PARM_DESC (io_queue_depth,"set io queue depth, should >= 2" ); -static int write_queues; -module_param (write_queues, int,0644 ); +static unsigned int write_queues; +module_param (write_queues, uint,0644 );MODULE_PARM_DESC (write_queues,"Number of queues to use for writes. If not set, reads and writes " "will share a queue set." ); -static int poll_queues; -module_param (poll_queues, int,0644 ); +static unsigned int poll_queues; +module_param (poll_queues, uint,0644 );MODULE_PARM_DESC (poll_queues,"Number of queues to use for polled IO." );struct nvme_dev ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 13/191 nvme/pci: Fix read queue count
In reply to Greg Kroah-HartmanFrom: Keith Busch <[email protected]>
[ Upstream commit 7e4c6b9a5d22485acf009b3c3510a370f096dd54 ]
If nvme.write_queues equals the number of CPUs, the driver had decreased the number of interrupts available such that there could only be one read queue even if the controller could support more. Remove the interrupt count reduction in this case. The driver wouldn't request more IRQs than it wants queues anyway.
--- drivers/nvme/host/pci.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/nvme/host/pci.c +1 -5
@@ -2060,7 +2060,6 @@ static int nvme_setup_irqs(struct nvme_dev *dev, unsigned int nr_io_queues) .priv = dev, };unsigned int irq_queues, this_p_queues; -unsigned int nr_cpus =num_possible_cpus ();/* * Poll queues don't need interrupts, but we need at least one IO
@@ -2071,10 +2070,7 @@ static int nvme_setup_irqs(struct nvme_dev *dev, unsigned int nr_io_queues) this_p_queues = nr_io_queues -1 ; irq_queues =1 ; }else { -if (nr_cpus < nr_io_queues - this_p_queues) - irq_queues = nr_cpus +1 ; -else - irq_queues = nr_io_queues - this_p_queues +1 ; + irq_queues = nr_io_queues - this_p_queues +1 ; } dev->io_queues[HCTX_TYPE_POLL ] = this_p_queues;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 14/191 iio: st_accel: Fix unused variable warning
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 0163c1c521ff8b09cd8ca395003cc00178161d77 ]
drivers/iio/accel/st_accel_core.c:1005:44: warning:
mount_matrix_ext_info defined but not used [-Wunused-const-variable=]
Using stub helper while CONFIG_ACPI is disabled to fix it.
--- drivers/iio/accel/st_accel_core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/iio/accel/st_accel_core.c +6 -2
@@ -993,6 +993,7 @@ static const struct iio_trigger_ops st_accel_trigger_ops = {#define ST_ACCEL_TRIGGER_OPS NULL#endif +#ifdef CONFIG_ACPI static const struct iio_mount_matrix *get_mount_matrix (const struct iio_dev *indio_dev,const struct iio_chan_spec *chan)
@@ -1013,7 +1014,6 @@ static const struct iio_chan_spec_ext_info mount_matrix_ext_info[] = {static int apply_acpi_orientation (struct iio_dev *indio_dev,struct iio_chan_spec *channels) { -#ifdef CONFIG_ACPI struct st_sensor_data *adata =iio_priv (indio_dev);struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER ,NULL };struct acpi_device *adev;
@@ -1141,10 +1141,14 @@ static int apply_acpi_orientation(struct iio_dev *indio_dev, out:kfree (buffer.pointer); return ret; +}#else /* !CONFIG_ACPI */ +static int apply_acpi_orientation (struct iio_dev *indio_dev, +struct iio_chan_spec *channels) +{return 0 ; -#endif } +#endif /* * st_accel_get_settings() - get sensor settings from device name
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 15/191 iio: adc: max9611: Fix too short conversion time delay
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 9fd229c478fbf77c41c8528aa757ef14210365f6 ]
As of commit b9ddd5091160793e ("iio: adc: max9611: Fix temperature reading in probe"), max9611 initialization sometimes fails on the Salvator-X(S) development board with:
max9611 4-007f: Invalid value received from ADC 0x8000: aborting
max9611: probe of 4-007f failed with error -5The max9611 driver tests communications with the chip by reading the die temperature during the probe function, which returns an invalid value.
According to the datasheet, the typical ADC conversion time is 2 ms, but no minimum or maximum values are provided. Maxim Technical Support confirmed this was tested with temperature Ta=25 degreeC, and promised to inform me if a maximum/minimum value is available (they didn't get back to me, so I assume it is not).
However, the driver assumes a 1 ms conversion time. Usually the usleep_range() call returns after more than 1.8 ms, hence it succeeds. When it returns earlier, the data register may be read too early, and the previous measurement value will be returned. After boot, this is the temperature POR (power-on reset) value, causing the failure above.
Fix this by increasing the delay from 1000-2000 µs to 3000-3300 µs.
Note that this issue has always been present, but it was exposed by the aformentioned commit.
--- drivers/iio/adc/max9611.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/iio/adc/max9611.c +10 -6
@@ -89,6 +89,12 @@#define MAX9611_TEMP_SCALE_NUM 1000000#define MAX9611_TEMP_SCALE_DIV 2083 +/* +* Conversion time is 2 ms (typically) at Ta=25 degreeC +* No maximum value is known, so play it safe. +*/ +#define MAX9611_CONV_TIME_US_RANGE 3000, 3300 +struct max9611_dev {struct device *dev;struct i2c_client *i2c_client;
@@ -236,11 +242,9 @@ static int max9611_read_single(struct max9611_dev *max9611,return ret; } -/* -* need a delay here to make register configuration -* stabilize. 1 msec at least, from empirical testing. -*/ -usleep_range (1000 ,2000 ); +/* need a delay here to make register configuration stabilize. */ + +usleep_range (MAX9611_CONV_TIME_US_RANGE ); ret =i2c_smbus_read_word_swapped (max9611->i2c_client, reg_addr);if (ret <0 ) {
@@ -507,7 +511,7 @@ static int max9611_init(struct max9611_dev *max9611) MAX9611_REG_CTRL2, 0);return ret; } -usleep_range (1000 ,2000 ); +usleep_range (MAX9611_CONV_TIME_US_RANGE );return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 16/191 PM / devfreq: Fix devfreq_notifier_call returning errno
In reply to Greg Kroah-HartmanFrom: Leonard Crestez <[email protected]>
[ Upstream commit e876e710ede23f670494331e062d643928e4142a ]
Notifier callbacks shouldn't return negative errno but one of the NOTIFY_OK/DONE/BAD values.
The OPP core will ignore return values from notifiers but returning a value that matches NOTIFY_STOP_MASK will stop the notification chain.
Fix by always returning NOTIFY_OK.
--- drivers/devfreq/devfreq.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
drivers/devfreq/devfreq.c +13 -11
@@ -551,26 +551,28 @@ static int devfreq_notifier_call(struct notifier_block *nb, unsigned long type, void *devp) { struct devfreq *devfreq = container_of(nb, struct devfreq, nb); -int ret; +int err = -EINVAL ;mutex_lock (&devfreq->lock); devfreq->scaling_min_freq =find_available_min_freq (devfreq); -if (!devfreq->scaling_min_freq) { -mutex_unlock (&devfreq->lock); -return -EINVAL ; - } +if (!devfreq->scaling_min_freq) + goto out; devfreq->scaling_max_freq =find_available_max_freq (devfreq); -if (!devfreq->scaling_max_freq) { -mutex_unlock (&devfreq->lock); -return -EINVAL ; - } +if (!devfreq->scaling_max_freq) + goto out; + + err =update_devfreq (devfreq); - ret =update_devfreq (devfreq); +out:mutex_unlock (&devfreq->lock); +if (err) +dev_err (devfreq->dev.parent, +"failed to update frequency from OPP notifier (%d)\n" , + err); -return ret; +return NOTIFY_OK ; }/**
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 17/191 PM / devfreq: Set scaling_max_freq to max on OPP notifier error
In reply to Greg Kroah-HartmanFrom: Leonard Crestez <[email protected]>
[ Upstream commit e7cc792d00049c874010b398a27c3cc7bc8fef34 ]
The devfreq_notifier_call functions will update scaling_min_freq and scaling_max_freq when the OPP table is updated.
If fetching the maximum frequency fails then scaling_max_freq remains set to zero which is confusing. Set to ULONG_MAX instead so we don't need special handling for this case in other places.
--- drivers/devfreq/devfreq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/devfreq/devfreq.c +3 -1
@@ -560,8 +560,10 @@ static int devfreq_notifier_call(struct notifier_block *nb, unsigned long type, goto out; devfreq->scaling_max_freq =find_available_max_freq (devfreq); -if (!devfreq->scaling_max_freq) +if (!devfreq->scaling_max_freq) { + devfreq->scaling_max_freq =ULONG_MAX ; goto out; + } err =update_devfreq (devfreq);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 18/191 PM / devfreq: Dont fail devfreq_dev_release if not in list
In reply to Greg Kroah-HartmanFrom: Leonard Crestez <[email protected]>
[ Upstream commit 42a6b25e67df6ee6675e8d1eaf18065bd73328ba ]
Right now devfreq_dev_release will print a warning and abort the rest of the cleanup if the devfreq instance is not part of the global devfreq_list. But this is a valid scenario, for example it can happen if the governor can't be found or on any other init error that happens after device_register.
Initialize devfreq->node to an empty list head in devfreq_add_device so that list_del becomes a safe noop inside devfreq_dev_release and we can continue the rest of the cleanup.
--- drivers/devfreq/devfreq.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/devfreq/devfreq.c +1 -5
@@ -588,11 +588,6 @@ static void devfreq_dev_release(struct device *dev)struct devfreq *devfreq =to_devfreq (dev);mutex_lock (&devfreq_list_lock); -if (IS_ERR (find_device_devfreq (devfreq->dev.parent))) { -mutex_unlock (&devfreq_list_lock); -dev_warn (&devfreq->dev,"releasing devfreq which doesn't exist\n" ); -return ; - }list_del (&devfreq->node);mutex_unlock (&devfreq_list_lock);
@@ -647,6 +642,7 @@ struct devfreq *devfreq_add_device(struct device *dev, devfreq->dev.parent = dev; devfreq->dev.class = devfreq_class; devfreq->dev.release = devfreq_dev_release; +INIT_LIST_HEAD (&devfreq->node); devfreq->profile = profile;strncpy (devfreq->governor_name, governor_name,DEVFREQ_NAME_LEN ); devfreq->previous_freq = profile->initial_freq;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 19/191 afs: Fix afs_find_server lookups for ipv4 peers
In reply to Greg Kroah-HartmanFrom: Marc Dionne <[email protected]>
[ Upstream commit 9bd0160d12370a076e44f8d1320cde9c83f2c647 ]
afs_find_server tries to find a server that has an address that matches the transport address of an rxrpc peer. The code assumes that the transport address is always ipv6, with ipv4 represented as ipv4 mapped addresses, but that's not the case. If the transport family is AF_INET, srx->transport.sin6.sin6_addr.s6_addr32[] will be beyond the actual ipv4 address and will always be 0, and all ipv4 addresses will be seen as matching.
As a result, the first ipv4 address seen on any server will be considered a match, and the server returned may be the wrong one.
One of the consequences is that callbacks received over ipv4 will only be correctly applied for the server that happens to have the first ipv4 address on the fs_addresses4 list. Callbacks over ipv4 from all other servers are dropped, causing the client to serve stale data.
This is fixed by looking at the transport family, and comparing ipv4 addresses based on a sockaddr_in structure rather than a sockaddr_in6.
--- fs/afs/server.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-)
fs/afs/server.c +8 -13
@@ -32,18 +32,11 @@ static void afs_dec_servers_outstanding(struct afs_net *net)struct afs_server *afs_find_server (struct afs_net *net,const struct sockaddr_rxrpc *srx) { -const struct sockaddr_in6 *a = &srx->transport.sin6, *b;const struct afs_addr_list *alist;struct afs_server *server =NULL ;unsigned int i; -bool ipv6 = true;int seq =0 , diff; -if (srx->transport.sin6.sin6_addr.s6_addr32[0 ] ==0 || - srx->transport.sin6.sin6_addr.s6_addr32[1 ] ==0 || - srx->transport.sin6.sin6_addr.s6_addr32[2 ] ==htonl (0xffff )) - ipv6 = false; -rcu_read_lock (); do {
@@ -52,7 +45,8 @@ struct afs_server *afs_find_server(struct afs_net *net, server =NULL ;read_seqbegin_or_lock (&net->fs_addr_lock, &seq); -if (ipv6) { +if (srx->transport.family ==AF_INET6 ) { +const struct sockaddr_in6 *a = &srx->transport.sin6, *b;hlist_for_each_entry_rcu (server, &net->fs_addresses6, addr6_link) { alist =rcu_dereference (server->addresses);for (i = alist->nr_ipv4; i < alist->nr_addrs; i++) {
@@ -68,15 +62,16 @@ struct afs_server *afs_find_server(struct afs_net *net, } } }else { +const struct sockaddr_in *a = &srx->transport.sin, *b;hlist_for_each_entry_rcu (server, &net->fs_addresses4, addr4_link) { alist =rcu_dereference (server->addresses);for (i =0 ; i < alist->nr_ipv4; i++) { - b = &alist->addrs[i].transport.sin6; - diff = ((u16 __force )a->sin6_port - - (u16 __force )b->sin6_port); + b = &alist->addrs[i].transport.sin; + diff = ((u16 __force )a->sin_port - + (u16 __force )b->sin_port);if (diff ==0 ) - diff = ((u32 __force )a->sin6_addr.s6_addr32[3 ] - - (u32 __force )b->sin6_addr.s6_addr32[3 ]); + diff = ((u32 __force )a->sin_addr.s_addr - + (u32 __force )b->sin_addr.s_addr);if (diff ==0 ) goto found; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 20/191 afs: Fix SELinux setting security label on /afs
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit bcbccaf2edcf1b76f73f890e968babef446151a4 ]
Make the AFS dynamic root superblock R/W so that SELinux can set the security label on it. Without this, upgrades to, say, the Fedora filesystem-afs RPM fail if afs is mounted on it because the SELinux label can't be (re-)applied.
It might be better to make it possible to bypass the R/O check for LSM label application through setxattr.
--- fs/afs/super.c | 1 - 1 file changed, 1 deletion(-)
fs/afs/super.c +0 -1
@@ -448,7 +448,6 @@ static int afs_fill_super(struct super_block *sb, struct afs_fs_context *ctx)/* allocate the root inode and dentry */ if (as->dyn_root) { inode =afs_iget_pseudo_dir (sb, true); - sb->s_flags |=SB_RDONLY ; }else {sprintf (sb->s_id,"%llu" , as->volume->vid);afs_activate_volume (as->volume);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 21/191 RDMA/cma: add missed unregister_pernet_subsys in init failure
In reply to Greg Kroah-HartmanFrom: Chuhong Yuan <[email protected]>
[ Upstream commit 44a7b6759000ac51b92715579a7bba9e3f9245c2 ]
The driver forgets to call unregister_pernet_subsys() in the error path of cma_init().
Add the missed call to fix it.
--- drivers/infiniband/core/cma.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/core/cma.c +1 -0
@@ -4736,6 +4736,7 @@ static int __init cma_init(void) err:unregister_netdevice_notifier (&cma_nb);ib_sa_unregister_client (&sa_client); +unregister_pernet_subsys (&cma_pernet_operations); err_wq:destroy_workqueue (cma_wq);return ret;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 22/191 rxe: correctly calculate iCRC for unaligned payloads
In reply to Greg Kroah-HartmanFrom: Steve Wise <[email protected]>
[ Upstream commit 2030abddec6884aaf5892f5724c48fc340e6826f ]
If RoCE PDUs being sent or received contain pad bytes, then the iCRC is miscalculated, resulting in PDUs being emitted by RXE with an incorrect iCRC, as well as ingress PDUs being dropped due to erroneously detecting a bad iCRC in the PDU. The fix is to include the pad bytes, if any, in iCRC computations.
Note: This bug has caused broken on-the-wire compatibility with actual hardware RoCE devices since the soft-RoCE driver was first put into the mainstream kernel. Fixing it will create an incompatibility with the original soft-RoCE devices, but is necessary to be compatible with real hardware devices.
--- drivers/infiniband/sw/rxe/rxe_recv.c | 2 +- drivers/infiniband/sw/rxe/rxe_req.c | 6 ++++++ drivers/infiniband/sw/rxe/rxe_resp.c | 7 +++++++ 3 files changed, 14 insertions(+), 1 deletion(-)
drivers/infiniband/sw/rxe/rxe_recv.c +1 -1
@@ -389,7 +389,7 @@ void rxe_rcv(struct sk_buff *skb) calc_icrc =rxe_icrc_hdr (pkt, skb); calc_icrc =rxe_crc32 (rxe, calc_icrc, (u8 *)payload_addr (pkt), -payload_size (pkt)); +payload_size (pkt) +bth_pad (pkt)); calc_icrc = (__force u32 )cpu_to_be32 (~calc_icrc);if (unlikely (calc_icrc != pack_icrc)) {if (skb->protocol ==htons (ETH_P_IPV6 ))
drivers/infiniband/sw/rxe/rxe_req.c +6 -0
@@ -500,6 +500,12 @@ static int fill_packet(struct rxe_qp *qp, struct rxe_send_wqe *wqe,if (err)return err; } +if (bth_pad (pkt)) { +u8 *pad =payload_addr (pkt) + paylen; + +memset (pad,0 ,bth_pad (pkt)); + crc =rxe_crc32 (rxe, crc, pad,bth_pad (pkt)); + } } p =payload_addr (pkt) + paylen +bth_pad (pkt);
drivers/infiniband/sw/rxe/rxe_resp.c +7 -0
@@ -732,6 +732,13 @@ static enum resp_states read_reply(struct rxe_qp *qp,if (err)pr_err ("Failed copying memory\n" ); +if (bth_pad (&ack_pkt)) { +struct rxe_dev *rxe =to_rdev (qp->ibqp.device); +u8 *pad =payload_addr (&ack_pkt) + payload; + +memset (pad,0 ,bth_pad (&ack_pkt)); + icrc =rxe_crc32 (rxe, icrc, pad,bth_pad (&ack_pkt)); + } p =payload_addr (&ack_pkt) + payload +bth_pad (&ack_pkt); *p = ~icrc;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 23/191 scsi: lpfc: Fix memory leak on lpfc_bsg_write_ebuf_set func
In reply to Greg Kroah-HartmanFrom: Bo Wu <[email protected]>
[ Upstream commit 9a1b0b9a6dab452fb0e39fe96880c4faf3878369 ]
When phba->mbox_ext_buf_ctx.seqNum != phba->mbox_ext_buf_ctx.numBuf, dd_data should be freed before return SLI_CONFIG_HANDLED.
When lpfc_sli_issue_mbox func return fails, pmboxq should be also freed in job_error tag.
--- drivers/scsi/lpfc/lpfc_bsg.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/scsi/lpfc/lpfc_bsg.c +9 -6
@@ -4489,12 +4489,6 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct bsg_job *job, phba->mbox_ext_buf_ctx.seqNum++; nemb_tp = phba->mbox_ext_buf_ctx.nembType; - dd_data =kmalloc (sizeof (struct bsg_job_data ),GFP_KERNEL ); -if (!dd_data) { - rc = -ENOMEM ; - goto job_error; - } - pbuf = (uint8_t *)dmabuf->virt; size = job->request_payload.payload_len; sg_copy_to_buffer(job->request_payload.sg_list,
@@ -4531,6 +4525,13 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct bsg_job *job,"2968 SLI_CONFIG ext-buffer wr all %d " "ebuffers received\n" , phba->mbox_ext_buf_ctx.numBuf); + + dd_data =kmalloc (sizeof (struct bsg_job_data ),GFP_KERNEL ); +if (!dd_data) { + rc = -ENOMEM ; + goto job_error; + } +/* mailbox command structure for base driver */ pmboxq =mempool_alloc (phba->mbox_mem_pool,GFP_KERNEL );if (!pmboxq) {
@@ -4579,6 +4580,8 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct bsg_job *job,return SLI_CONFIG_HANDLED ; job_error: +if (pmboxq) +mempool_free (pmboxq, phba->mbox_mem_pool);lpfc_bsg_dma_page_free (phba, dmabuf);kfree (dd_data);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 24/191 scsi: qla2xxx: Use explicit LOGO in target mode
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
[ Upstream commit 86196a8fa8a84af1395a28ea0548f2ce6ae9bc22 ]
Target makes implicit LOGO on session teardown. LOGO ELS is not send on the wire and initiator is not aware that target no longer wants talking to it. Initiator keeps sending I/O requests, target responds with BA_RJT, they time out and then initiator sends ABORT TASK (ABTS-LS).
Current behaviour incurs unneeded I/O timeout and can be fixed for some initiators by making explicit LOGO on session deletion.
--- drivers/scsi/qla2xxx/qla_def.h | 1 + drivers/scsi/qla2xxx/qla_iocb.c | 16 ++++++++++++---- drivers/scsi/qla2xxx/qla_target.c | 1 + drivers/scsi/qla2xxx/tcm_qla2xxx.c | 1 + 4 files changed, 15 insertions(+), 4 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +1 -0
@@ -2401,6 +2401,7 @@ typedef struct fc_port { unsigned int id_changed:1; unsigned int scan_needed:1; unsigned int n2n_flag:1; + unsigned int explicit_logout:1;struct completion nvme_del_done;uint32_t nvme_prli_service_param;
drivers/scsi/qla2xxx/qla_iocb.c +12 -4
@@ -2405,11 +2405,19 @@ qla2x00_login_iocb(srb_t *sp, struct mbx_entry *mbx)static void qla24xx_logout_iocb (srb_t *sp,struct logio_entry_24xx *logio) { +u16 control_flags =LCF_COMMAND_LOGO ; logio->entry_type =LOGINOUT_PORT_IOCB_TYPE ; - logio->control_flags = -cpu_to_le16 (LCF_COMMAND_LOGO |LCF_IMPL_LOGO ); -if (!sp->fcport->keep_nport_handle) - logio->control_flags |=cpu_to_le16 (LCF_FREE_NPORT ); + +if (sp->fcport->explicit_logout) { + control_flags |=LCF_EXPL_LOGO |LCF_FREE_NPORT ; + }else { + control_flags |=LCF_IMPL_LOGO ; + +if (!sp->fcport->keep_nport_handle) + control_flags |=LCF_FREE_NPORT ; + } + + logio->control_flags =cpu_to_le16 (control_flags); logio->nport_handle =cpu_to_le16 (sp->fcport->loop_id); logio->port_id[0 ] = sp->fcport->d_id.b.al_pa; logio->port_id[1 ] = sp->fcport->d_id.b.area;
drivers/scsi/qla2xxx/qla_target.c +1 -0
@@ -1104,6 +1104,7 @@ void qlt_free_session_done(struct work_struct *work) } } + sess->explicit_logout =0 ;spin_unlock_irqrestore (&ha->tgt.sess_lock, flags); sess->free_pending =0 ;
drivers/scsi/qla2xxx/tcm_qla2xxx.c +1 -0
@@ -350,6 +350,7 @@ static void tcm_qla2xxx_close_session(struct se_session *se_sess)target_sess_cmd_list_set_waiting (se_sess);spin_unlock_irqrestore (&vha->hw->tgt.sess_lock, flags); + sess->explicit_logout =1 ;tcm_qla2xxx_put_sess (sess); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 25/191 scsi: qla2xxx: Drop superfluous INIT_WORK of del_work
In reply to Greg Kroah-HartmanFrom: Roman Bolshakov <[email protected]>
[ Upstream commit 600954e6f2df695434887dfc6a99a098859990cf ]
del_work is already initialized inside qla2x00_alloc_fcport, there's no need to overwrite it. Indeed, it might prevent complete traversal of workqueue list.
--- drivers/scsi/qla2xxx/qla_target.c | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/qla2xxx/qla_target.c +0 -1
@@ -1265,7 +1265,6 @@ void qlt_schedule_sess_for_deletion(struct fc_port *sess)"Scheduling sess %p for deletion %8phC\n" , sess, sess->port_name); -INIT_WORK (&sess->del_work, qla24xx_delete_sess_fn);WARN_ON (!queue_work (sess->vha->hw->wq, &sess->del_work)); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 26/191 scsi: qla2xxx: Dont call qlt_async_event twice
In reply to Greg Kroah-HartmanFrom: Roman Bolshakov <[email protected]>
[ Upstream commit 2c2f4bed9b6299e6430a65a29b5d27b8763fdf25 ]
MBA_PORT_UPDATE generates duplicate log lines in target mode because qlt_async_event is called twice. Drop the calls within the case as the function will be called right after the switch statement.
--- drivers/scsi/qla2xxx/qla_isr.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/scsi/qla2xxx/qla_isr.c +0 -4
@@ -1061,8 +1061,6 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb)ql_dbg (ql_dbg_async, vha,0x5011 ,"Asynchronous PORT UPDATE ignored %04x/%04x/%04x.\n" , mb[1 ], mb[2 ], mb[3 ]); - -qlt_async_event (mb[0 ], vha, mb);break ; }
@@ -1079,8 +1077,6 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb)set_bit (LOOP_RESYNC_NEEDED , &vha->dpc_flags);set_bit (LOCAL_LOOP_UPDATE , &vha->dpc_flags);set_bit (VP_CONFIG_OK , &vha->vp_flags); - -qlt_async_event (mb[0 ], vha, mb);break ;case MBA_RSCN_UPDATE :/* State Change Registration */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 27/191 scsi: qla2xxx: Fix PLOGI payload and ELS IOCB dump length
In reply to Greg Kroah-HartmanFrom: Roman Bolshakov <[email protected]>
[ Upstream commit 0334cdea1fba36fad8bdf9516f267ce01de625f7 ]
The size of the buffer is hardcoded as 0x70 or 112 bytes, while the size of ELS IOCB is 0x40 and the size of PLOGI payload returned by Get Parameters command is 0x74.
--- drivers/scsi/qla2xxx/qla_iocb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_iocb.c +4 -2
@@ -2684,7 +2684,8 @@ qla24xx_els_logo_iocb(srb_t *sp, struct els_entry_24xx *els_iocb)ql_dbg (ql_dbg_io + ql_dbg_buffer, vha,0x3073 ,"PLOGI ELS IOCB:\n" );ql_dump_buffer (ql_log_info, vha,0x0109 , - (uint8_t *)els_iocb,0x70 ); + (uint8_t *)els_iocb, +sizeof (*els_iocb)); }else { els_iocb->control_flags =1 <<13 ; els_iocb->tx_byte_count =
@@ -2850,7 +2851,8 @@ qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode,ql_dbg (ql_dbg_disc + ql_dbg_buffer, vha,0x3073 ,"PLOGI buffer:\n" );ql_dump_buffer (ql_dbg_disc + ql_dbg_buffer, vha,0x0109 , - (uint8_t *)elsio->u.els_plogi.els_plogi_pyld,0x70 ); + (uint8_t *)elsio->u.els_plogi.els_plogi_pyld, +sizeof (*elsio->u.els_plogi.els_plogi_pyld)); rval =qla2x00_start_sp (sp);if (rval !=QLA_SUCCESS ) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 28/191 scsi: qla2xxx: Configure local loop for N2N target
In reply to Greg Kroah-HartmanFrom: Roman Bolshakov <[email protected]>
[ Upstream commit fd1de5830a5abaf444cc4312871e02c41e24fdc1 ]
qla2x00_configure_local_loop initializes PLOGI payload for PLOGI ELS using Get Parameters mailbox command.
In the case when the driver is running in target mode, the topology is N2N and the target port has higher WWPN, LOCAL_LOOP_UPDATE bit is cleared too early and PLOGI payload is not initialized by the Get Parameters command. That causes a failure of ELS IOCB carrying the PLOGI with 0x15 aka Data Underrun error.
LOCAL_LOOP_UPDATE has to be set to initialize PLOGI payload.
--- drivers/scsi/qla2xxx/qla_init.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +2 -8
@@ -4927,14 +4927,8 @@ qla2x00_configure_loop(scsi_qla_host_t *vha)set_bit (RSCN_UPDATE , &flags);clear_bit (LOCAL_LOOP_UPDATE , &flags); - }else if (ha->current_topology ==ISP_CFG_N ) { -clear_bit (RSCN_UPDATE , &flags); -if (qla_tgt_mode_enabled (vha)) { -/* allow the other side to start the login */ -clear_bit (LOCAL_LOOP_UPDATE , &flags); -set_bit (RELOGIN_NEEDED , &vha->dpc_flags); - } - }else if (ha->current_topology ==ISP_CFG_NL ) { + }else if (ha->current_topology ==ISP_CFG_NL || + ha->current_topology ==ISP_CFG_N ) {clear_bit (RSCN_UPDATE , &flags);set_bit (LOCAL_LOOP_UPDATE , &flags); } else if (!vha->flags.online ||
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 29/191 scsi: qla2xxx: Send Notify ACK after N2N PLOGI
In reply to Greg Kroah-HartmanFrom: Roman Bolshakov <[email protected]>
[ Upstream commit 5e6b01d84b9d20bcd77fc7c4733a2a4149bf220a ]
qlt_handle_login schedules session for deletion even if a login is in progress. That causes login bouncing, i.e. a few logins are made before it settles down.
Complete the first login by sending Notify Acknowledge IOCB via qlt_plogi_ack_unref if the session is pending login completion.
--- drivers/scsi/qla2xxx/qla_target.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/qla2xxx/qla_target.c +1 -0
@@ -4803,6 +4803,7 @@ static int qlt_handle_login(struct scsi_qla_host *vha,switch (sess->disc_state) {case DSC_DELETED : +case DSC_LOGIN_PEND :qlt_plogi_ack_unref (vha, pla);break ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 30/191 scsi: qla2xxx: Dont defer relogin unconditonally
In reply to Greg Kroah-HartmanFrom: Roman Bolshakov <[email protected]>
[ Upstream commit dabc5ec915f3a2c657ecfb529cd3d4ec303a4412 ]
qla2x00_configure_local_loop sets RELOGIN_NEEDED bit and calls qla24xx_fcport_handle_login to perform the login. This bit triggers a wake up of DPC later after a successful login.
The deferred call is not needed if login succeeds, and it's set in qla24xx_fcport_handle_login in case of errors, hence it should be safe to drop.
--- drivers/scsi/qla2xxx/qla_init.c | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/qla2xxx/qla_init.c +0 -1
@@ -5045,7 +5045,6 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha)memcpy (&ha->plogi_els_payld.data, (void *)ha->init_cb,sizeof (ha->plogi_els_payld.data)); -set_bit (RELOGIN_NEEDED , &vha->dpc_flags); }else {ql_dbg (ql_dbg_init, vha,0x00d1 ,"PLOGI ELS param read fail.\n" );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 31/191 scsi: qla2xxx: Ignore PORT UPDATE after N2N PLOGI
In reply to Greg Kroah-HartmanFrom: Roman Bolshakov <[email protected]>
[ Upstream commit af22f0c7b052c5c203207f1e5ebd6aa65f87c538 ]
PORT UPDATE asynchronous event is generated on the host that issues PLOGI ELS (in the case of higher WWPN). In that case, the event shouldn't be handled as it sets unwanted DPC flags (i.e. LOOP_RESYNC_NEEDED) that trigger link flap.
Ignore the event if the host has higher WWPN, but handle otherwise.
--- drivers/scsi/qla2xxx/qla_mbx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_mbx.c +2 -1
@@ -3920,6 +3920,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, vha->d_id.b24 =0 ; vha->d_id.b.al_pa =1 ; ha->flags.n2n_bigger =1 ; + ha->flags.n2n_ae =0 ; id.b.al_pa =2 ; ql_dbg(ql_dbg_async, vha, 0x5075,
@@ -3930,6 +3931,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,"Format 1: Remote login - Waiting for WWPN %8phC.\n" , rptid_entry->u.f1.port_name); ha->flags.n2n_bigger =0 ; + ha->flags.n2n_ae =1 ; } qla24xx_post_newsess_work(vha, &id, rptid_entry->u.f1.port_name,
@@ -3941,7 +3943,6 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,/* if our portname is higher then initiate N2N login */ set_bit (N2N_LOGIN_NEEDED , &vha->dpc_flags); - ha->flags.n2n_ae =1 ;return ;break ;case TOPO_FL :
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 32/191 scsi: iscsi: qla4xxx: fix double free in probe
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit fee92f25777789d73e1936b91472e9c4644457c8 ]
On this error path we call qla4xxx_mem_free() and then the caller also calls qla4xxx_free_adapter() which calls qla4xxx_mem_free(). It leads to a couple double frees:
drivers/scsi/qla4xxx/ql4_os.c:8856 qla4xxx_probe_adapter() warn: 'ha->chap_dma_pool' double freed drivers/scsi/qla4xxx/ql4_os.c:8856 qla4xxx_probe_adapter() warn: 'ha->fw_ddb_dma_pool' double freed
--- drivers/scsi/qla4xxx/ql4_os.c | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/qla4xxx/ql4_os.c +0 -1
@@ -4275,7 +4275,6 @@ static int qla4xxx_mem_alloc(struct scsi_qla_host *ha)return QLA_SUCCESS ; mem_alloc_error_exit: -qla4xxx_mem_free (ha);return QLA_ERROR ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 33/191 scsi: libsas: stop discovering if oob mode is disconnected
In reply to Greg Kroah-HartmanFrom: Jason Yan <[email protected]>
[ Upstream commit f70267f379b5e5e11bdc5d72a56bf17e5feed01f ]
The discovering of sas port is driven by workqueue in libsas. When libsas is processing port events or phy events in workqueue, new events may rise up and change the state of some structures such as asd_sas_phy. This may cause some problems such as follows:
==>thread 1 ==>thread 2
==>phy up
==>phy_up_v3_hw()
==>oob_mode = SATA_OOB_MODE;
==>phy down quickly
==>hisi_sas_phy_down()
==>sas_ha->notify_phy_event()
==>sas_phy_disconnected()
==>oob_mode = OOB_NOT_CONNECTED
==>workqueue wakeup
==>sas_form_port()
==>sas_discover_domain()
==>sas_get_port_device()
==>oob_mode is OOB_NOT_CONNECTED and device
is wrongly taken as expanderThis at last lead to the panic when libsas trying to issue a command to discover the device.
[183047.614035] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000058 [183047.622896] Mem abort info: [183047.625762] ESR = 0x96000004 [183047.628893] Exception class = DABT (current EL), IL = 32 bits [183047.634888] SET = 0, FnV = 0 [183047.638015] EA = 0, S1PTW = 0 [183047.641232] Data abort info: [183047.644189] ISV = 0, ISS = 0x00000004 [183047.648100] CM = 0, WnR = 0 [183047.651145] user pgtable: 4k pages, 48-bit VAs, pgdp = 00000000b7df67be [183047.657834] [0000000000000058] pgd=0000000000000000 [183047.662789] Internal error: Oops: 96000004 [#1] SMP [183047.667740] Process kworker/u16:2 (pid: 31291, stack limit = 0x00000000417c4974) [183047.675208] CPU: 0 PID: 3291 Comm: kworker/u16:2 Tainted: G W OE 4.19.36-vhulk1907.1.0.h410.eulerosv2r8.aarch64 #1 [183047.687015] Hardware name: N/A N/A/Kunpeng Desktop Board D920S10, BIOS 0.15 10/22/2019 [183047.695007] Workqueue: 0000:74:02.0_disco_q sas_discover_domain [183047.700999] pstate: 20c00009 (nzCv daif +PAN +UAO) [183047.705864] pc : prep_ata_v3_hw+0xf8/0x230 [hisi_sas_v3_hw] [183047.711510] lr : prep_ata_v3_hw+0xb0/0x230 [hisi_sas_v3_hw] [183047.717153] sp : ffff00000f28ba60 [183047.720541] x29: ffff00000f28ba60 x28: ffff8026852d7228 [183047.725925] x27: ffff8027dba3e0a8 x26: ffff8027c05fc200 [183047.731310] x25: 0000000000000000 x24: ffff8026bafa8dc0 [183047.736695] x23: ffff8027c05fc218 x22: ffff8026852d7228 [183047.742079] x21: ffff80007c2f2940 x20: ffff8027c05fc200 [183047.747464] x19: 0000000000f80800 x18: 0000000000000010 [183047.752848] x17: 0000000000000000 x16: 0000000000000000 [183047.758232] x15: ffff000089a5a4ff x14: 0000000000000005 [183047.763617] x13: ffff000009a5a50e x12: ffff8026bafa1e20 [183047.769001] x11: ffff0000087453b8 x10: ffff00000f28b870 [183047.774385] x9 : 0000000000000000 x8 : ffff80007e58f9b0 [183047.779770] x7 : 0000000000000000 x6 : 000000000000003f [183047.785154] x5 : 0000000000000040 x4 : ffffffffffffffe0 [183047.790538] x3 : 00000000000000f8 x2 : 0000000002000007 [183047.795922] x1 : 0000000000000008 x0 : 0000000000000000 [183047.801307] Call trace: [183047.803827] prep_ata_v3_hw+0xf8/0x230 [hisi_sas_v3_hw] [183047.809127] hisi_sas_task_prep+0x750/0x888 [hisi_sas_main] [183047.814773] hisi_sas_task_exec.isra.7+0x88/0x1f0 [hisi_sas_main] [183047.820939] hisi_sas_queue_command+0x28/0x38 [hisi_sas_main] [183047.826757] smp_execute_task_sg+0xec/0x218 [183047.831013] smp_execute_task+0x74/0xa0 [183047.834921] sas_discover_expander.part.7+0x9c/0x5f8 [183047.839959] sas_discover_root_expander+0x90/0x160 [183047.844822] sas_discover_domain+0x1b8/0x1e8 [183047.849164] process_one_work+0x1b4/0x3f8 [183047.853246] worker_thread+0x54/0x470 [183047.856981] kthread+0x134/0x138 [183047.860283] ret_from_fork+0x10/0x18 [183047.863931] Code: f9407a80 528000e2 39409281 72a04002 (b9405800) [183047.870097] kernel fault(0x1) notification starting on CPU 0 [183047.875828] kernel fault(0x1) notification finished on CPU 0 [183047.881559] Modules linked in: unibsp(OE) hns3(OE) hclge(OE) hnae3(OE) mem_drv(OE) hisi_sas_v3_hw(OE) hisi_sas_main(OE) [183047.892418] ---[ end trace 4cc26083fc11b783 ]--- [183047.897107] Kernel panic - not syncing: Fatal exception [183047.902403] kernel fault(0x5) notification starting on CPU 0 [183047.908134] kernel fault(0x5) notification finished on CPU 0 [183047.913865] SMP: stopping secondary CPUs [183047.917861] Kernel Offset: disabled [183047.921422] CPU features: 0x2,a2a00a38 [183047.925243] Memory Limit: none [183047.928372] kernel reboot(0x2) notification starting on CPU 0 [183047.934190] kernel reboot(0x2) notification finished on CPU 0 [183047.940008] ---[ end Kernel panic - not syncing: Fatal exception
]---
--- drivers/scsi/libsas/sas_discover.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/scsi/libsas/sas_discover.c +10 -1
@@ -81,12 +81,21 @@ static int sas_get_port_device(struct asd_sas_port *port)else dev->dev_type =SAS_SATA_DEV ; dev->tproto =SAS_PROTOCOL_SATA ; - }else { + }else if (port->oob_mode ==SAS_OOB_MODE ) {struct sas_identify_frame *id = (struct sas_identify_frame *) dev->frame_rcvd; dev->dev_type = id->dev_type; dev->iproto = id->initiator_bits; dev->tproto = id->target_bits; + }else { +/* If the oob mode is OOB_NOT_CONNECTED, the port is +* disconnected due to race with PHY down. We cannot +* continue to discover this port +*/ +sas_put_device (dev); +pr_warn ("Port %016llx is disconnected when discovering\n" , +SAS_ADDR (port->attached_sas_addr)); +return -ENODEV ; }sas_init_dev (dev);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 34/191 scsi: iscsi: Avoid potential deadlock in iscsi_if_rx func
In reply to Greg Kroah-HartmanFrom: Bo Wu <[email protected]>
[ Upstream commit bba340c79bfe3644829db5c852fdfa9e33837d6d ]
In iscsi_if_rx func, after receiving one request through iscsi_if_recv_msg func, iscsi_if_send_reply will be called to try to reply to the request in a do-while loop. If the iscsi_if_send_reply function keeps returning -EAGAIN, a deadlock will occur.
For example, a client only send msg without calling recvmsg func, then it will result in the watchdog soft lockup. The details are given as follows:
sock_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ISCSI);
retval = bind(sock_fd, (struct sock addr*) & src_addr, sizeof(src_addr);
while (1) {
state_msg = sendmsg(sock_fd, &msg, 0);
//Note: recvmsg(sock_fd, &msg, 0) is not processed here.
}
close(sock_fd);watchdog: BUG: soft lockup - CPU#7 stuck for 22s! [netlink_test:253305] Sample time: 4000897528 ns(HZ: 250) Sample stat:
curr: user: 675503481560, nice: 321724050, sys: 448689506750, idle: 4654054240530, iowait: 40885550700, irq: 14161174020, softirq: 8104324140, st: 0
deta: user: 0, nice: 0, sys: 3998210100, idle: 0, iowait: 0, irq: 1547170, softirq: 242870, st: 0 Sample softirq:
TIMER: 992
SCHED: 8
Sample irqstat:
irq 2: delta 1003, curr: 3103802, arch_timer
CPU: 7 PID: 253305 Comm: netlink_test Kdump: loaded Tainted: G OE
Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015
pstate: 40400005 (nZcv daif +PAN -UAO)
pc : __alloc_skb+0x104/0x1b0
lr : __alloc_skb+0x9c/0x1b0sp : ffff000033603a30
x29: ffff000033603a30 x28: 00000000000002dd
x27: ffff800b34ced810 x26: ffff800ba7569f00
x25: 00000000ffffffff x24: 0000000000000000
x23: ffff800f7c43f600 x22: 0000000000480020
x21: ffff0000091d9000 x20: ffff800b34eff200
x19: ffff800ba7569f00 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000
x15: 0000000000000000 x14: 0001000101000100
x13: 0000000101010000 x12: 0101000001010100
x11: 0001010101010001 x10: 00000000000002dd
x9 : ffff000033603d58 x8 : ffff800b34eff400
x7 : ffff800ba7569200 x6 : ffff800b34eff400
x5 : 0000000000000000 x4 : 00000000ffffffff
x3 : 0000000000000000 x2 : 0000000000000001
x1 : ffff800b34eff2c0 x0 : 0000000000000300 Call trace:
__alloc_skb+0x104/0x1b0 iscsi_if_rx+0x144/0x12bc [scsi_transport_iscsi] netlink_unicast+0x1e0/0x258 netlink_sendmsg+0x310/0x378 sock_sendmsg+0x4c/0x70 sock_write_iter+0x90/0xf0 __vfs_write+0x11c/0x190 vfs_write+0xac/0x1c0 ksys_write+0x6c/0xd8 __arm64_sys_write+0x24/0x30 el0_svc_common+0x78/0x130 el0_svc_handler+0x38/0x78 el0_svc+0x8/0xc
--- drivers/scsi/scsi_transport_iscsi.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/scsi/scsi_transport_iscsi.c +7 -0
@@ -24,6 +24,8 @@#define ISCSI_TRANSPORT_VERSION "2.0-870" +#define ISCSI_SEND_MAX_ALLOWED 10 +#define CREATE_TRACE_POINTS #include <trace/events/iscsi.h>
@@ -3682,6 +3684,7 @@ iscsi_if_rx(struct sk_buff *skb)struct nlmsghdr *nlh;struct iscsi_uevent *ev;uint32_t group; +int retries =ISCSI_SEND_MAX_ALLOWED ; nlh =nlmsg_hdr (skb); if (nlh->nlmsg_len < sizeof(*nlh) + sizeof(*ev) ||
@@ -3712,6 +3715,10 @@ iscsi_if_rx(struct sk_buff *skb)break ; err =iscsi_if_send_reply (portid, nlh->nlmsg_type, ev,sizeof (*ev)); +if (err == -EAGAIN && --retries <0 ) { +printk (KERN_WARNING "Send reply failed, error %d\n" , err); +break ; + } }while (err <0 && err != -ECONNREFUSED && err != -ESRCH );skb_pull (skb, rlen); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 35/191 staging/wlan-ng: add CRC32 dependency in Kconfig
In reply to Greg Kroah-HartmanFrom: Kay Friedrich <[email protected]>
[ Upstream commit 2740bd3351cd5a4351f458aabaa1c9b77de3867b ]
wlan-ng uses the function crc32_le,
but CRC32 wasn't a dependency of wlan-ng
--- drivers/staging/wlan-ng/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/staging/wlan-ng/Kconfig +1 -0
@@ -4,6 +4,7 @@ config PRISM2_USB depends on WLAN && USB && CFG80211 select WIRELESS_EXT select WEXT_PRIV + select CRC32 help This is the wlan-ng prism 2.5/3 USB driver for a wide range of old USB wireless devices.
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 36/191 drm/nouveau: Move the declaration of struct nouveau_conn_atom up a bit
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 37a68eab4cd92b507c9e8afd760fdc18e4fecac6 ]
Place the declaration of struct nouveau_conn_atom above that of struct nouveau_connector. This commit makes no changes to the moved block what so ever, it just moves it up a bit.
This is a preparation patch to fix some issues with connector handling on pre nv50 displays (which do not use atomic modesetting).
--- drivers/gpu/drm/nouveau/nouveau_connector.h | 110 ++++++++++---------- 1 file changed, 55 insertions(+), 55 deletions(-)
drivers/gpu/drm/nouveau/nouveau_connector.h +55 -55
@@ -29,6 +29,7 @@#include <nvif/notify.h> +#include <drm/drm_crtc.h> #include <drm/drm_edid.h> #include <drm/drm_encoder.h> #include <drm/drm_dp_helper.h>
@@ -44,6 +45,60 @@ struct dcb_output;struct nouveau_backlight ;#endif +#define nouveau_conn_atom (p) \ + container_of((p), struct nouveau_conn_atom, state) + +struct nouveau_conn_atom { +struct drm_connector_state state; + +struct { +/* The enum values specifically defined here match nv50/gf119 +* hw values, and the code relies on this. +*/ +enum { +DITHERING_MODE_OFF =0x00 , +DITHERING_MODE_ON =0x01 , +DITHERING_MODE_DYNAMIC2X2 =0x10 |DITHERING_MODE_ON , +DITHERING_MODE_STATIC2X2 =0x18 |DITHERING_MODE_ON , +DITHERING_MODE_TEMPORAL =0x20 |DITHERING_MODE_ON , +DITHERING_MODE_AUTO + } mode; +enum { +DITHERING_DEPTH_6BPC =0x00 , +DITHERING_DEPTH_8BPC =0x02 , +DITHERING_DEPTH_AUTO + } depth; + } dither; + +struct { +int mode;/* DRM_MODE_SCALE_* */ +struct { +enum { +UNDERSCAN_OFF , +UNDERSCAN_ON , +UNDERSCAN_AUTO , + } mode; +u32 hborder; +u32 vborder; + } underscan; +bool full; + } scaler; + +struct { +int color_vibrance; +int vibrant_hue; + } procamp; + +union { +struct { +bool dither:1 ; +bool scaler:1 ; +bool procamp:1 ; + }; +u8 mask; + } set; +}; +struct nouveau_connector {struct drm_connector base;enum dcb_connector_type type;
@@ -121,61 +176,6 @@ extern int nouveau_ignorelid;extern int nouveau_duallink;extern int nouveau_hdmimhz; -#include <drm/drm_crtc.h> -#define nouveau_conn_atom (p) \ - container_of((p), struct nouveau_conn_atom, state) - -struct nouveau_conn_atom { -struct drm_connector_state state; - -struct { -/* The enum values specifically defined here match nv50/gf119 -* hw values, and the code relies on this. -*/ -enum { -DITHERING_MODE_OFF =0x00 , -DITHERING_MODE_ON =0x01 , -DITHERING_MODE_DYNAMIC2X2 =0x10 |DITHERING_MODE_ON , -DITHERING_MODE_STATIC2X2 =0x18 |DITHERING_MODE_ON , -DITHERING_MODE_TEMPORAL =0x20 |DITHERING_MODE_ON , -DITHERING_MODE_AUTO - } mode; -enum { -DITHERING_DEPTH_6BPC =0x00 , -DITHERING_DEPTH_8BPC =0x02 , -DITHERING_DEPTH_AUTO - } depth; - } dither; - -struct { -int mode;/* DRM_MODE_SCALE_* */ -struct { -enum { -UNDERSCAN_OFF , -UNDERSCAN_ON , -UNDERSCAN_AUTO , - } mode; -u32 hborder; -u32 vborder; - } underscan; -bool full; - } scaler; - -struct { -int color_vibrance; -int vibrant_hue; - } procamp; - -union { -struct { -bool dither:1 ; -bool scaler:1 ; -bool procamp:1 ; - }; -u8 mask; - } set; -}; -void nouveau_conn_attach_properties (struct drm_connector *);void nouveau_conn_reset (struct drm_connector *); struct drm_connector_state *
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 37/191 drm/nouveau: Fix drm-core using atomic code-paths on pre-nv50 hardware
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 64d17f25dcad518461ccf0c260544e1e379c5b35 ]
We do not support atomic modesetting on pre-nv50 hardware, but until now our connector code was setting drm_connector->state on pre-nv50 hardware.
This causes the core to enter atomic modesetting paths in at least:
1. drm_connector_get_encoder(), returning connector->state->best_encoder which is always 0, causing us to always report 0 as encoder_id in the drmModeConnector struct returned by drmModeGetConnector().
2. drm_encoder_get_crtc(), returning NULL because uses_atomic get set, causing us to always report 0 as crtc_id in the drmModeEncoder struct returned by drmModeGetEncoder()
Which in turn confuses userspace, at least plymouth thinks that the pipe has changed because of this and tries to reconfigure it unnecessarily.
More in general we should not set drm_connector->state in the non-atomic code as this violates the drm-core's expectations.
This commit fixes this by using a nouveau_conn_atom struct embedded in the nouveau_connector struct for property handling in the non-atomic case.
--- drivers/gpu/drm/nouveau/nouveau_connector.c | 28 +++++++++++++++------ drivers/gpu/drm/nouveau/nouveau_connector.h | 6 +++++ 2 files changed, 27 insertions(+), 7 deletions(-)
drivers/gpu/drm/nouveau/nouveau_connector.c +21 -7
@@ -245,14 +245,22 @@ nouveau_conn_atomic_duplicate_state(struct drm_connector *connector)void nouveau_conn_reset (struct drm_connector *connector) { +struct nouveau_connector *nv_connector =nouveau_connector (connector);struct nouveau_conn_atom *asyc; -if (WARN_ON (!(asyc =kzalloc (sizeof (*asyc),GFP_KERNEL )))) -return ; +if (drm_drv_uses_atomic_modeset (connector->dev)) { +if (WARN_ON (!(asyc =kzalloc (sizeof (*asyc),GFP_KERNEL )))) +return ; + +if (connector->state) +nouveau_conn_atomic_destroy_state (connector, + connector->state); + +__drm_atomic_helper_connector_reset (connector, &asyc->state); + }else { + asyc = &nv_connector->properties_state; + } -if (connector->state) -nouveau_conn_atomic_destroy_state (connector, connector->state); -__drm_atomic_helper_connector_reset (connector, &asyc->state); asyc->dither.mode =DITHERING_MODE_AUTO ; asyc->dither.depth =DITHERING_DEPTH_AUTO ; asyc->scaler.mode =DRM_MODE_SCALE_NONE ;
@@ -276,8 +284,14 @@ void nouveau_conn_attach_properties(struct drm_connector *connector) {struct drm_device *dev = connector->dev; -struct nouveau_conn_atom *armc =nouveau_conn_atom (connector->state);struct nouveau_display *disp =nouveau_display (dev); +struct nouveau_connector *nv_connector =nouveau_connector (connector); +struct nouveau_conn_atom *armc; + +if (drm_drv_uses_atomic_modeset (connector->dev)) + armc =nouveau_conn_atom (connector->state); +else + armc = &nv_connector->properties_state;/* Init DVI-I specific properties. */ if (connector->connector_type ==DRM_MODE_CONNECTOR_DVII )
@@ -749,9 +763,9 @@ static int nouveau_connector_set_property(struct drm_connector *connector, struct drm_property *property, uint64_t value) { - struct nouveau_conn_atom *asyc = nouveau_conn_atom(connector->state); struct nouveau_connector *nv_connector = nouveau_connector(connector);struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder; +struct nouveau_conn_atom *asyc = &nv_connector->properties_state;struct drm_encoder *encoder =to_drm_encoder (nv_encoder);int ret;
drivers/gpu/drm/nouveau/nouveau_connector.h +6 -0
@@ -118,6 +118,12 @@ struct nouveau_connector {#ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT struct nouveau_backlight *backlight;#endif +/* +* Our connector property code expects a nouveau_conn_atom struct +* even on pre-nv50 where we do not support atomic. This embedded +* version gets used in the non atomic modeset case. +*/ +struct nouveau_conn_atom properties_state; }; static inline struct nouveau_connector *nouveau_connector(
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 38/191 drm/nouveau/kms/nv50-: fix panel scaling
In reply to Greg Kroah-HartmanFrom: Ben Skeggs <[email protected]>
[ Upstream commit 3d1890ef8023e61934e070021b06cc9f417260c0 ]
Under certain circumstances, encoder atomic_check() can be entered without adjusted_mode having been reset to the same as mode, which confuses the scaling logic and can lead to a misprogrammed display.
Fix this by checking against the user-provided mode directly.
--- drivers/gpu/drm/nouveau/dispnv50/disp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/nouveau/dispnv50/disp.c +3 -3
@@ -326,9 +326,9 @@ nv50_outp_atomic_check_view(struct drm_encoder *encoder,* same size as the native one (e.g. different * refresh rate) */ -if (adjusted_mode->hdisplay == native_mode->hdisplay && - adjusted_mode->vdisplay == native_mode->vdisplay && - adjusted_mode->type &DRM_MODE_TYPE_DRIVER ) +if (mode->hdisplay == native_mode->hdisplay && + mode->vdisplay == native_mode->vdisplay && + mode->type &DRM_MODE_TYPE_DRIVER )break ; mode = native_mode; asyc->scaler.full = true;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 39/191 usb: gadget: fix wrong endpoint desc
In reply to Greg Kroah-HartmanFrom: EJ Hsu <[email protected]>
[ Upstream commit e5b5da96da50ef30abb39cb9f694e99366404d24 ]
Gadget driver should always use config_ep_by_speed() to initialize usb_ep struct according to usb device's operating speed. Otherwise, usb_ep struct may be wrong if usb devcie's operating speed is changed.
The key point in this patch is that we want to make sure the desc pointer in usb_ep struct will be set to NULL when gadget is disconnected. This will force it to call config_ep_by_speed() to correctly initialize usb_ep struct based on the new operating speed when gadget is re-connected later.
--- drivers/usb/gadget/function/f_ecm.c | 6 +++++- drivers/usb/gadget/function/f_rndis.c | 1 + 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/usb/gadget/function/f_ecm.c +5 -1
@@ -621,8 +621,12 @@ static void ecm_disable(struct usb_function *f)DBG (cdev,"ecm deactivated\n" ); -if (ecm->port.in_ep->enabled) +if (ecm->port.in_ep->enabled) {gether_disconnect (&ecm->port); + }else { + ecm->port.in_ep->desc =NULL ; + ecm->port.out_ep->desc =NULL ; + }usb_ep_disable (ecm->notify); ecm->notify->desc =NULL ;
drivers/usb/gadget/function/f_rndis.c +1 -0
@@ -618,6 +618,7 @@ static void rndis_disable(struct usb_function *f)gether_disconnect (&rndis->port);usb_ep_disable (rndis->notify); + rndis->notify->desc =NULL ; }/*-------------------------------------------------------------------------*/
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 40/191 net: make socket read/write_iter() honor IOCB_NOWAIT
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
[ Upstream commit ebfcd8955c0b52eb793bcbc9e71140e3d0cdb228 ]
The socket read/write helpers only look at the file O_NONBLOCK. not the iocb IOCB_NOWAIT flag. This breaks users like preadv2/pwritev2 and io_uring that rely on not having the file itself marked nonblocking, but rather the iocb itself.
--- net/socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/socket.c +2 -2
@@ -955,7 +955,7 @@ static ssize_t sock_read_iter(struct kiocb *iocb, struct iov_iter *to) .msg_iocb = iocb};ssize_t res; -if (file->f_flags &O_NONBLOCK ) +if (file->f_flags &O_NONBLOCK || (iocb->ki_flags &IOCB_NOWAIT )) msg.msg_flags =MSG_DONTWAIT ;if (iocb->ki_pos !=0 )
@@ -980,7 +980,7 @@ static ssize_t sock_write_iter(struct kiocb *iocb, struct iov_iter *from)if (iocb->ki_pos !=0 )return -ESPIPE ; -if (file->f_flags &O_NONBLOCK ) +if (file->f_flags &O_NONBLOCK || (iocb->ki_flags &IOCB_NOWAIT )) msg.msg_flags =MSG_DONTWAIT ;if (sock->type ==SOCK_SEQPACKET )
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 41/191 afs: Fix mountpoint parsing
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 158d58335393af3956a9c06f0816ee75ed1f1447 ]
Each AFS mountpoint has strings that define the target to be mounted. This is required to end in a dot that is supposed to be stripped off. The string can include suffixes of ".readonly" or ".backup" - which are supposed to come before the terminal dot. To add to the confusion, the "fs lsmount" afs utility does not show the terminal dot when displaying the string.
The kernel mount source string parser, however, assumes that the terminal dot marks the suffix and that the suffix is always "" and is thus ignored. In most cases, there is no suffix and this is not a problem - but if there is a suffix, it is lost and this affects the ability to mount the correct volume.
The command line mount command, on the other hand, is expected not to include a terminal dot - so the problem doesn't arise there.
Fix this by making sure that the dot exists and then stripping it when passing the string to the mount configuration.
--- fs/afs/mntpt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/afs/mntpt.c +4 -2
@@ -126,7 +126,7 @@ static int afs_mntpt_set_params(struct fs_context *fc, struct dentry *mntpt)if (src_as->cell) ctx->cell =afs_get_cell (src_as->cell); -if (size >PAGE_SIZE -1 ) +if (size <2 || size >PAGE_SIZE -1 )return -EINVAL ; page =read_mapping_page (d_inode (mntpt)->i_mapping,0 ,NULL );
@@ -140,7 +140,9 @@ static int afs_mntpt_set_params(struct fs_context *fc, struct dentry *mntpt) } buf =kmap (page); - ret =vfs_parse_fs_string (fc,"source" , buf, size); + ret = -EINVAL ; +if (buf[size -1 ] =='.' ) + ret =vfs_parse_fs_string (fc,"source" , buf, size -1 );kunmap (page);put_page (page);if (ret <0 )
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 42/191 afs: Fix creation calls in the dynamic root to fail with EOPNOTSUPP
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 1da4bd9f9d187f53618890d7b66b9628bbec3c70 ]
Fix the lookup method on the dynamic root directory such that creation calls, such as mkdir, open(O_CREAT), symlink, etc. fail with EOPNOTSUPP rather than failing with some odd error (such as EEXIST).
lookup() itself tries to create automount directories when it is invoked. These are cached locally in RAM and not committed to storage.
--- fs/afs/dynroot.c | 3 +++ 1 file changed, 3 insertions(+)
fs/afs/dynroot.c +3 -0
@@ -136,6 +136,9 @@ static struct dentry *afs_dynroot_lookup(struct inode *dir, struct dentry *dentr ASSERTCMP(d_inode(dentry), ==, NULL); +if (flags &LOOKUP_CREATE ) +return ERR_PTR (-EOPNOTSUPP ); +if (dentry->d_name.len >=AFSNAMEMAX ) {_leave (" = -ENAMETOOLONG" );return ERR_PTR (-ENAMETOOLONG );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 43/191 raid5: need to set STRIPE_HANDLE for batch head
In reply to Greg Kroah-HartmanFrom: Guoqing Jiang <[email protected]>
[ Upstream commit a7ede3d16808b8f3915c8572d783530a82b2f027 ]
With commit 6ce220dd2f8ea71d6afc29b9a7524c12e39f374a ("raid5: don't set STRIPE_HANDLE to stripe which is in batch list"), we don't want to set STRIPE_HANDLE flag for sh which is already in batch list.
However, the stripe which is the head of batch list should set this flag, otherwise panic could happen inside init_stripe at BUG_ON(sh->batch_head), it is reproducible with raid5 on top of nvdimm devices per Xiao oberserved.
Thanks for Xiao's effort to verify the change.
--- drivers/md/raid5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/raid5.c +1 -1
@@ -5726,7 +5726,7 @@ static bool raid5_make_request(struct mddev *mddev, struct bio * bi) do_flush = false; } -if (!sh->batch_head) +if (!sh->batch_head || sh == sh->batch_head)set_bit (STRIPE_HANDLE , &sh->state);clear_bit (STRIPE_DELAYED , &sh->state); if ((!sh->batch_head || sh == sh->batch_head) &&
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 44/191 md: raid1: check rdev before reference in raid1_sync_request func
In reply to Greg Kroah-HartmanFrom: Zhiqiang Liu <[email protected]>
[ Upstream commit 028288df635f5a9addd48ac4677b720192747944 ]
In raid1_sync_request func, rdev should be checked before reference.
--- drivers/md/raid1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/raid1.c +1 -1
@@ -2781,7 +2781,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr, write_targets++; } } -if (bio->bi_end_io) { +if (rdev && bio->bi_end_io) {atomic_inc (&rdev->nr_pending); bio->bi_iter.bi_sector = sector_nr + rdev->data_offset;bio_set_dev (bio, rdev->bdev);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 45/191 s390/cpum_sf: Adjust sampling interval to avoid hitting sample limits
In reply to Greg Kroah-HartmanFrom: Thomas Richter <[email protected]>
[ Upstream commit 39d4a501a9ef55c57b51e3ef07fc2aeed7f30b3b ]
Function perf_event_ever_overflow() and perf_event_account_interrupt() are called every time samples are processed by the interrupt handler. However function perf_event_account_interrupt() has checks to avoid being flooded with interrupts (more then 1000 samples are received per task_tick). Samples are then dropped and a PERF_RECORD_THROTTLED is added to the perf data. The perf subsystem limit calculation is:
maximum sample frequency := 100000 --> 1 samples per 10 us
task_tick = 10ms = 10000us --> 1000 samples per task_tickThe work flow is
measurement_alert() uses SDBT head and each SBDT points to 511
SDB pages, each with 126 sample entries. After processing 8 SBDs and for each valid sample calling:
perf_event_overflow()
perf_event_account_interrupts()
there is a considerable amount of samples being dropped, especially when the sample frequency is very high and near the 100000 limit.
To avoid the high amount of samples being dropped near the end of a task_tick time frame, increment the sampling interval in case of dropped events. The CPU Measurement sampling facility on the s390 supports only intervals, specifiing how many CPU cycles have to be executed before a sample is generated. Increase the interval when the samples being generated hit the task_tick limit.
--- arch/s390/kernel/perf_cpum_sf.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
arch/s390/kernel/perf_cpum_sf.c +16 -0
@@ -1325,6 +1325,22 @@ static void hw_perf_event_update(struct perf_event *event, int flush_all)if (sampl_overflow)OVERFLOW_REG (hwc) =DIV_ROUND_UP (OVERFLOW_REG (hwc) + sampl_overflow,1 + num_sdb); + +/* Perf_event_overflow() and perf_event_account_interrupt() limit +* the interrupt rate to an upper limit. Roughly 1000 samples per +* task tick. +* Hitting this limit results in a large number +* of throttled REF_REPORT_THROTTLE entries and the samples +* are dropped. +* Slightly increase the interval to avoid hitting this limit. +*/ +if (event_overflow) { +SAMPL_RATE (hwc) +=DIV_ROUND_UP (SAMPL_RATE (hwc),10 ); +debug_sprintf_event (sfdbg,1 ,"%s: rate adjustment %ld\n" , + __func__, +DIV_ROUND_UP (SAMPL_RATE (hwc),10 )); + } +if (sampl_overflow || event_overflow) debug_sprintf_event(sfdbg, 4, "hw_perf_event_update: " "overflow stats: sample=%llu event=%llu\n",
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 46/191 s390/cpum_sf: Avoid SBD overflow condition in irq handler
In reply to Greg Kroah-HartmanFrom: Thomas Richter <[email protected]>
[ Upstream commit 0539ad0b22877225095d8adef0c376f52cc23834 ]
The s390 CPU Measurement sampling facility has an overflow condition which fires when all entries in a SBD are used.
The measurement alert interrupt is triggered and reads out all samples in this SDB. It then tests the successor SDB, if this SBD is not full, the interrupt handler does not read any samples at all from this SDB The design waits for the hardware to fill this SBD and then trigger another meassurement alert interrupt.
This scheme works nicely until
an perf_event_overflow() function call discards the sample due to a too high sampling rate.
The interrupt handler has logic to read out a partially filled SDB when the perf event overflow condition in linux common code is met. This causes the CPUM sampling measurement hardware and the PMU device driver to operate on the same SBD's trailer entry. This should not happen.
This can be seen here using this trace:
cpumsf_pmu_add: tear:0xb5286000
hw_perf_event_update: sdbt 0xb5286000 full 1 over 0 flush_all:0
hw_perf_event_update: sdbt 0xb5286008 full 0 over 0 flush_all:0
above shows 1. interrupt
hw_perf_event_update: sdbt 0xb5286008 full 1 over 0 flush_all:0
hw_perf_event_update: sdbt 0xb5286008 full 0 over 0 flush_all:0
above shows 2. interrupt
... this goes on fine until...
hw_perf_event_update: sdbt 0xb5286068 full 1 over 0 flush_all:0
perf_push_sample1: overflow
one or more samples read from the IRQ handler are rejected by perf_event_overflow() and the IRQ handler advances to the next SDB and modifies the trailer entry of a partially filled SDB.
hw_perf_event_update: sdbt 0xb5286070 full 0 over 0 flush_all:1
timestamp: 14:32:52.519953
Next time the IRQ handler is called for this SDB the trailer entry shows an overflow count of 19 missed entries.
hw_perf_event_update: sdbt 0xb5286070 full 1 over 19 flush_all:1
timestamp: 14:32:52.970058
Remove access to a follow on SDB when event overflow happened.
--- arch/s390/kernel/perf_cpum_sf.c | 6 ------ 1 file changed, 6 deletions(-)
arch/s390/kernel/perf_cpum_sf.c +0 -6
@@ -1313,12 +1313,6 @@ static void hw_perf_event_update(struct perf_event *event, int flush_all)*/ if (flush_all && done)break ; - -/* If an event overflow happened, discard samples by -* processing any remaining sample-data-blocks. -*/ -if (event_overflow) - flush_all =1 ; }/* Account sample overflows in the event hardware structure */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 47/191 RDMA/counter: Prevent auto-binding a QP which are not tracked with res
In reply to Greg Kroah-HartmanFrom: Mark Zhang <[email protected]>
[ Upstream commit 33df2f1929df4a1cb13303e344fbf8a75f0dc41f ]
Some QPs (e.g. XRC QP) are not tracked in kernel, in this case they have an invalid res and should not be bound to any dynamically-allocated counter in auto mode.
This fixes below call trace:
BUG: kernel NULL pointer dereference, address: 0000000000000390 PGD 80000001a7233067 P4D 80000001a7233067 PUD 1a7215067 PMD 0 Oops: 0000 [#1] SMP PTI CPU: 2 PID: 24822 Comm: ibv_xsrq_pingpo Not tainted 5.4.0-rc5+ #21 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-2.fc27 04/01/2014 RIP: 0010:rdma_counter_bind_qp_auto+0x142/0x270 [ib_core] Code: e1 48 85 c0 48 89 c2 0f 84 bc 00 00 00 49 8b 06 48 39 42 48 75 d6 40 3a aa 90 00 00 00 75 cd 49 8b 86 00 01 00 00 48 8b 4a 28 <8b> 80 90 03 00 00 39 81 90 03 00 00 75 b4 85 c0 74 b0 48 8b 04 24 RSP: 0018:ffffc900003f39c0 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000000000 RDX: ffff88820020ec00 RSI: 0000000000000004 RDI: ffffffffffffffc0 RBP: 0000000000000001 R08: ffff888224149ff0 R09: ffffc900003f3968 R10: ffffffffffffffff R11: ffff8882249c5848 R12: ffffffffffffffff R13: ffff88821d5aca50 R14: ffff8881f7690800 R15: ffff8881ff890000 FS: 00007fe53a3e1740(0000) GS:ffff888237b00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000390 CR3: 00000001a7292006 CR4: 00000000003606a0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: _ib_modify_qp+0x3a4/0x3f0 [ib_core] ? lookup_get_idr_uobject.part.8+0x23/0x40 [ib_uverbs] modify_qp+0x322/0x3e0 [ib_uverbs] ib_uverbs_modify_qp+0x43/0x70 [ib_uverbs] ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0xb1/0xf0 [ib_uverbs] ib_uverbs_run_method+0x6be/0x760 [ib_uverbs] ? uverbs_disassociate_api+0xd0/0xd0 [ib_uverbs] ib_uverbs_cmd_verbs+0x18d/0x3a0 [ib_uverbs] ? get_acl+0x1a/0x120 ? __alloc_pages_nodemask+0x15d/0x2c0 ib_uverbs_ioctl+0xa7/0x110 [ib_uverbs] do_vfs_ioctl+0xa5/0x610 ksys_ioctl+0x60/0x90 __x64_sys_ioctl+0x16/0x20 do_syscall_64+0x48/0x110 entry_SYSCALL_64_after_hwframe+0x44/0xa9
--- drivers/infiniband/core/counters.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/infiniband/core/counters.c +3 -0
@@ -282,6 +282,9 @@ int rdma_counter_bind_qp_auto(struct ib_qp *qp, u8 port)struct rdma_counter *counter;int ret; +if (!qp->res.valid) +return 0 ; +if (!rdma_is_port_valid (dev, port))return -EINVAL ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 48/191 IB/mlx4: Follow mirror sequence of device add during device removal
In reply to Greg Kroah-HartmanFrom: Parav Pandit <[email protected]>
[ Upstream commit 89f988d93c62384758b19323c886db917a80c371 ]
Current code device add sequence is:
ib_register_device()ib_mad_init()init_sriov_init()register_netdev_notifier()
Therefore, the remove sequence should be,
unregister_netdev_notifier()close_sriov()mad_cleanup()ib_unregister_device()
However it is not above.
Hence, make do above remove sequence.
--- drivers/infiniband/hw/mlx4/main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/infiniband/hw/mlx4/main.c +5 -4
@@ -3008,16 +3008,17 @@ static void mlx4_ib_remove(struct mlx4_dev *dev, void *ibdev_ptr) ibdev->ib_active = false;flush_workqueue (wq); -mlx4_ib_close_sriov (ibdev); -mlx4_ib_mad_cleanup (ibdev); -ib_unregister_device (&ibdev->ib_dev); -mlx4_ib_diag_cleanup (ibdev);if (ibdev->iboe.nb.notifier_call) {if (unregister_netdevice_notifier (&ibdev->iboe.nb))pr_warn ("failure unregistering notifier\n" ); ibdev->iboe.nb.notifier_call =NULL ; } +mlx4_ib_close_sriov (ibdev); +mlx4_ib_mad_cleanup (ibdev); +ib_unregister_device (&ibdev->ib_dev); +mlx4_ib_diag_cleanup (ibdev); +mlx4_qp_release_range (dev, ibdev->steer_qpn_base, ibdev->steer_qpn_count);kfree (ibdev->ib_uc_qpns_bitmap);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 49/191 IB/mlx5: Fix steering rule of drop and count
In reply to Greg Kroah-HartmanFrom: Maor Gottlieb <[email protected]>
[ Upstream commit ed9085fed9d95d5921582e3c8474f3736c5d2782 ]
There are two flow rule destinations: QP and packet. While users are setting DROP packet rule, the QP should not be set as a destination.
--- drivers/infiniband/hw/mlx5/main.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/infiniband/hw/mlx5/main.c +6 -7
@@ -3548,10 +3548,6 @@ static struct mlx5_ib_flow_handler *_create_flow_rule(struct mlx5_ib_dev *dev, }INIT_LIST_HEAD (&handler->list); -if (dst) { -memcpy (&dest_arr[0 ], dst,sizeof (*dst)); - dest_num++; - }for (spec_index =0 ; spec_index < flow_attr->num_of_specs; spec_index++) { err = parse_flow_attr(dev->mdev, spec,
@@ -3564,6 +3560,11 @@ static struct mlx5_ib_flow_handler *_create_flow_rule(struct mlx5_ib_dev *dev, ib_flow += ((union ib_flow_spec *)ib_flow)->size; } +if (dst && !(flow_act.action &MLX5_FLOW_CONTEXT_ACTION_DROP )) { +memcpy (&dest_arr[0 ], dst,sizeof (*dst)); + dest_num++; + } +if (!flow_is_multicast_only (flow_attr))set_underlay_qp (dev, spec, underlay_qpn);
@@ -3604,10 +3605,8 @@ static struct mlx5_ib_flow_handler *_create_flow_rule(struct mlx5_ib_dev *dev, }if (flow_act.action &MLX5_FLOW_CONTEXT_ACTION_DROP ) { -if (!(flow_act.action &MLX5_FLOW_CONTEXT_ACTION_COUNT )) { +if (!dest_num) rule_dst =NULL ; - dest_num =0 ; - } }else {if (is_egress) flow_act.action |=MLX5_FLOW_CONTEXT_ACTION_ALLOW ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 50/191 xen-blkback: prevent premature module unload
In reply to Greg Kroah-HartmanFrom: Paul Durrant <[email protected]>
[ Upstream commit fa2ac657f9783f0891b2935490afe9a7fd29d3fa ]
Objects allocated by xen_blkif_alloc come from the 'blkif_cache' kmem cache. This cache is destoyed when xen-blkif is unloaded so it is necessary to wait for the deferred free routine used for such objects to complete. This necessity was missed in commit 14855954f636 "xen-blkback:
allow module to be cleanly unloaded". This patch fixes the problem by taking/releasing extra module references in xen_blkif_alloc/free() respectively.
--- drivers/block/xen-blkback/xenbus.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/block/xen-blkback/xenbus.c +10 -0
@@ -171,6 +171,15 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid) blkif->domid = domid;atomic_set (&blkif->refcnt,1 );init_completion (&blkif->drain_complete); + +/* +* Because freeing back to the cache may be deferred, it is not +* safe to unload the module (and hence destroy the cache) until +* this has completed. To prevent premature unloading, take an +* extra module reference here and release only when the object +* has been freed back to the cache. +*/ +__module_get (THIS_MODULE );INIT_WORK (&blkif->free_work, xen_blkif_deferred_free);return blkif;
@@ -320,6 +329,7 @@ static void xen_blkif_free(struct xen_blkif *blkif)/* Make sure everything is drained before shutting down */ kmem_cache_free (xen_blkif_cachep, blkif); +module_put (THIS_MODULE ); }int __init xen_blkif_interface_init (void )
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 51/191 xen/balloon: fix ballooned page accounting without hotplug enabled
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
[ Upstream commit c673ec61ade89bf2f417960f986bc25671762efb ]
When CONFIG_XEN_BALLOON_MEMORY_HOTPLUG is not defined reserve_additional_memory() will set balloon_stats.target_pages to a wrong value in case there are still some ballooned pages allocated via alloc_xenballooned_pages().
This will result in balloon_process() no longer be triggered when ballooned pages are freed in batches.
--- drivers/xen/balloon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/xen/balloon.c +2 -1
@@ -395,7 +395,8 @@ static struct notifier_block xen_memory_nb = {#else static enum bp_state reserve_additional_memory (void ) { - balloon_stats.target_pages = balloon_stats.current_pages; + balloon_stats.target_pages = balloon_stats.current_pages + + balloon_stats.target_unpopulated;return BP_ECANCELED ; }#endif /* CONFIG_XEN_BALLOON_MEMORY_HOTPLUG */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 52/191 PM / hibernate: memory_bm_find_bit(): Tighten node optimisation
In reply to Greg Kroah-HartmanFrom: Andy Whitcroft <[email protected]>
[ Upstream commit da6043fe85eb5ec621e34a92540735dcebbea134 ]
When looking for a bit by number we make use of the cached result from the preceding lookup to speed up operation. Firstly we check if the requested pfn is within the cached zone and if not lookup the new zone. We then check if the offset for that pfn falls within the existing cached node. This happens regardless of whether the node is within the zone we are now scanning. With certain memory layouts it is possible for this to false trigger creating a temporary alias for the pfn to a different bit. This leads the hibernation code to free memory which it was never allocated with the expected fallout.
Ensure the zone we are scanning matches the cached zone before considering the cached node.
Deep thanks go to Andrea for many, many, many hours of hacking and testing that went into cornering this bug.
--- kernel/power/snapshot.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
kernel/power/snapshot.c +8 -1
@@ -734,8 +734,15 @@ static int memory_bm_find_bit(struct memory_bitmap *bm, unsigned long pfn,* We have found the zone. Now walk the radix tree to find the leaf node * for our PFN. */ + +/* +* If the zone we wish to scan is the the current zone and the +* pfn falls into the current node then we do not need to walk +* the tree. +*/ node = bm->cur.node; -if (((pfn - zone->start_pfn) & ~BM_BLOCK_MASK ) == bm->cur.node_pfn) +if (zone == bm->cur.zone && + ((pfn - zone->start_pfn) & ~BM_BLOCK_MASK ) == bm->cur.node_pfn) goto node_found; node = zone->rtree;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 53/191 ALSA: hda/realtek - Add Bass Speaker and fixed dac for bass speaker
In reply to Greg Kroah-HartmanFrom: Kailang Yang <[email protected]>
[ Upstream commit e79c22695abd3b75a6aecf4ea4b9607e8d82c49c ]
Dell has new platform which has dual speaker connecting. They want dual speaker which use same dac for output.
--- sound/pci/hda/patch_realtek.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
sound/pci/hda/patch_realtek.c +19 -0
@@ -5896,6 +5896,8 @@ enum {ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC ,ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE ,ALC294_FIXUP_ASUS_INTSPK_GPIO , +ALC289_FIXUP_DELL_SPK2 , + ALC289_FIXUP_DUAL_SPK, }; static const struct hda_fixup alc269_fixups[] = {
@@ -6993,6 +6995,21 @@ static const struct hda_fixup alc269_fixups[] = { .chained = true, .chain_id =ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC }, + [ALC289_FIXUP_DELL_SPK2] = { + .type = HDA_FIXUP_PINS, + .v.pins = (const struct hda_pintbl []) { + {0x17 ,0x90170130 },/* bass spk */ + { } + }, + .chained = true, + .chain_id =ALC269_FIXUP_DELL4_MIC_NO_PRESENCE + }, + [ALC289_FIXUP_DUAL_SPK] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc285_fixup_speaker2_to_dac1, + .chained = true, + .chain_id =ALC289_FIXUP_DELL_SPK2 + }, };static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -7065,6 +7082,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1028 ,0x08ad ,"Dell WYSE AIO" ,ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x08ae ,"Dell WYSE NB" ,ALC225_FIXUP_DELL1_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x0935 ,"Dell" ,ALC274_FIXUP_DELL_AIO_LINEOUT_VERB ), +SND_PCI_QUIRK (0x1028 ,0x097e ,"Dell Precision" ,ALC289_FIXUP_DUAL_SPK ), +SND_PCI_QUIRK (0x1028 ,0x097d ,"Dell Precision" ,ALC289_FIXUP_DUAL_SPK ),SND_PCI_QUIRK (0x1028 ,0x164a ,"Dell" ,ALC293_FIXUP_DELL1_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x164b ,"Dell" ,ALC293_FIXUP_DELL1_MIC_NO_PRESENCE ), SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 54/191 ALSA: hda/realtek - Enable the bass speaker of ASUS UX431FLC
In reply to Greg Kroah-HartmanFrom: Chris Chiu <[email protected]>
[ Upstream commit 48e01504cf5315cbe6de9b7412e792bfcc3dd9e1 ]
ASUS reported that there's an bass speaker in addition to internal speaker and it uses DAC 0x02. It was not enabled in the commit 436e25505f34 ("ALSA: hda/realtek - Enable internal speaker of ASUS UX431FLC") which only enables the amplifier and the front speaker. This commit enables the bass speaker on top of the aforementioned work to improve the acoustic experience.
--- sound/pci/hda/patch_realtek.c | 38 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 20 deletions(-)
sound/pci/hda/patch_realtek.c +18 -20
@@ -5893,11 +5893,12 @@ enum {ALC256_FIXUP_ASUS_HEADSET_MIC ,ALC256_FIXUP_ASUS_MIC_NO_PRESENCE ,ALC299_FIXUP_PREDATOR_SPK , -ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC ,ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE , -ALC294_FIXUP_ASUS_INTSPK_GPIO ,ALC289_FIXUP_DELL_SPK2 ,ALC289_FIXUP_DUAL_SPK , +ALC294_FIXUP_SPK2_TO_DAC1 , + ALC294_FIXUP_ASUS_DUAL_SPK, + }; static const struct hda_fixup alc269_fixups[] = {
@@ -6968,16 +6969,6 @@ static const struct hda_fixup alc269_fixups[] = { { } } }, - [ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC] = { - .type = HDA_FIXUP_PINS, - .v.pins = (const struct hda_pintbl[]) { - { 0x14, 0x411111f0 }, /* disable confusing internal speaker */ - { 0x19, 0x04a11150 }, /* use as headset mic, without its own jack detect */ - { } - }, - .chained = true, - .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC - }, [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = { .type = HDA_FIXUP_PINS, .v.pins = (const struct hda_pintbl[]) {
@@ -6988,13 +6979,6 @@ static const struct hda_fixup alc269_fixups[] = { .chained = true, .chain_id =ALC256_FIXUP_ASUS_HEADSET_MODE }, - [ALC294_FIXUP_ASUS_INTSPK_GPIO] = { - .type = HDA_FIXUP_FUNC, -/* The GPIO must be pulled to initialize the AMP */ - .v.func = alc_fixup_gpio4, - .chained = true, - .chain_id =ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC - }, [ALC289_FIXUP_DELL_SPK2] = { .type = HDA_FIXUP_PINS, .v.pins = (const struct hda_pintbl[]) {
@@ -7010,6 +6994,20 @@ static const struct hda_fixup alc269_fixups[] = { .chained = true, .chain_id =ALC289_FIXUP_DELL_SPK2 }, + [ALC294_FIXUP_SPK2_TO_DAC1] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc285_fixup_speaker2_to_dac1, + .chained = true, + .chain_id =ALC294_FIXUP_ASUS_HEADSET_MIC + }, + [ALC294_FIXUP_ASUS_DUAL_SPK] = { + .type = HDA_FIXUP_FUNC, +/* The GPIO must be pulled to initialize the AMP */ + .v.func = alc_fixup_gpio4, + .chained = true, + .chain_id =ALC294_FIXUP_SPK2_TO_DAC1 + }, + };static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -7171,7 +7169,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1043 ,0x1427 ,"Asus Zenbook UX31E" ,ALC269VB_FIXUP_ASUS_ZENBOOK ),SND_PCI_QUIRK (0x1043 ,0x1517 ,"Asus Zenbook UX31A" ,ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A ),SND_PCI_QUIRK (0x1043 ,0x16e3 ,"ASUS UX50" ,ALC269_FIXUP_STEREO_DMIC ), -SND_PCI_QUIRK (0x1043 ,0x17d1 ,"ASUS UX431FL" ,ALC294_FIXUP_ASUS_INTSPK_GPIO ), +SND_PCI_QUIRK (0x1043 ,0x17d1 ,"ASUS UX431FL" ,ALC294_FIXUP_ASUS_DUAL_SPK ),SND_PCI_QUIRK (0x1043 ,0x18b1 ,"Asus MJ401TA" ,ALC256_FIXUP_ASUS_HEADSET_MIC ),SND_PCI_QUIRK (0x1043 ,0x1a13 ,"Asus G73Jw" ,ALC269_FIXUP_ASUS_G73JW ), SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 55/191 PCI: Add a helper to check Power Resource Requirements _PR3 existence
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit 52525b7a3cf82adec5c6cf0ecbd23ff228badc94 ]
A driver may want to know the existence of _PR3, to choose different runtime suspend behavior. A user will be add in next patch.
This is mostly the same as nouveau_pr3_present().
--- drivers/pci/pci.c | 18 ++++++++++++++++++ include/linux/pci.h | 2 ++ 2 files changed, 20 insertions(+)
drivers/pci/pci.c +18 -0
@@ -5854,6 +5854,24 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode,return 0 ; } +#ifdef CONFIG_ACPI +bool pci_pr3_present (struct pci_dev *pdev) +{ +struct acpi_device *adev; + +if (acpi_disabled) +return false; + + adev =ACPI_COMPANION (&pdev->dev); +if (!adev) +return false; + +return adev->power.flags.power_resources && +acpi_has_method (adev->handle,"_PR3" ); +} +EXPORT_SYMBOL_GPL (pci_pr3_present); +#endif +/** * pci_add_dma_alias - Add a DMA devfn alias for a device * @dev: the PCI device for which alias is added
include/linux/pci.h +2 -0
@@ -2310,9 +2310,11 @@ struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus);void pci_msi_register_fwnode_provider (struct fwnode_handle *(*fn)(struct device *)); +bool pci_pr3_present (struct pci_dev *pdev);#else static inline struct irq_domain *pci_host_bridge_acpi_msi_domain (struct pci_bus *bus) {return NULL ; } +static bool pci_pr3_present (struct pci_dev *pdev) {return false; }#endif #ifdef CONFIG_EEH
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 56/191 ALSA: hda: Allow HDA to be runtime suspended when dGPU is not bound to a driver
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit bacd861452d2be86a4df341b12e32db7dac8021e ]
Nvidia proprietary driver doesn't support runtime power management, so when a user only wants to use the integrated GPU, it's a common practice to let dGPU not to bind any driver, and let its upstream port to be runtime suspended. At the end of runtime suspension the port uses platform power management to disable power through _OFF method of power resource, which is listed by _PR3.
After commit b516ea586d71 ("PCI: Enable NVIDIA HDA controllers"), when the dGPU comes with an HDA function, the HDA won't be suspended if the dGPU is unbound, so the power resource can't be turned off by its upstream port driver.
Commit 37a3a98ef601 ("ALSA: hda - Enable runtime PM only for discrete GPU") only allows HDA to be runtime suspended once GPU is bound, to keep APU's HDA working.
However, HDA on dGPU isn't that useful if dGPU is not bound to any driver. So let's relax the runtime suspend requirement for dGPU's HDA function, to disable the power source to save lots of power.
--- sound/pci/hda/hda_intel.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
sound/pci/hda/hda_intel.c +7 -1
@@ -1280,11 +1280,17 @@ static void init_vga_switcheroo(struct azx *chip) { struct hda_intel *hda = container_of(chip, struct hda_intel, chip);struct pci_dev *p =get_bound_vga (chip->pci); +struct pci_dev *parent;if (p) {dev_info (chip->card->dev,"Handle vga_switcheroo audio client\n" ); hda->use_vga_switcheroo =1 ; - chip->bus.keep_power =1 ;/* cleared in either gpu_bound op or codec probe */ + +/* cleared in either gpu_bound op or codec probe, or when its +* upstream port has _PR3 (i.e. dGPU). +*/ + parent =pci_upstream_bridge (p); + chip->bus.keep_power = parent ? !pci_pr3_present (parent) :1 ; chip->driver_caps |=AZX_DCAPS_PM_RUNTIME ;pci_dev_put (p); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 57/191 PCI: Fix missing inline for pci_pr3_present()
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 46b4bff6572b0552b1ee062043621e4b252638d8 ]
The inline prefix was missing in the dummy function pci_pr3_present() definition. Fix it.
--- include/linux/pci.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/pci.h +1 -1
@@ -2314,7 +2314,7 @@ bool pci_pr3_present(struct pci_dev *pdev);#else static inline struct irq_domain *pci_host_bridge_acpi_msi_domain (struct pci_bus *bus) {return NULL ; } -static bool pci_pr3_present (struct pci_dev *pdev) {return false; } +static inline bool pci_pr3_present (struct pci_dev *pdev) {return false; }#endif #ifdef CONFIG_EEH
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 58/191 ALSA: hda - fixup for the bass speaker on Lenovo Carbon X1 7th gen
In reply to Greg Kroah-HartmanFrom: Jaroslav Kysela <[email protected]>
[ Upstream commit d2cd795c4ece1a24fda170c35eeb4f17d9826cbb ]
The auto-parser assigns the bass speaker to DAC3 (NID 0x06) which is without the volume control. I do not see a reason to use DAC2, because the shared output to all speakers produces the sufficient and well balanced sound. The stereo support is enough for this purpose (laptop).
--- sound/pci/hda/patch_realtek.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
sound/pci/hda/patch_realtek.c +17 -0
@@ -5547,6 +5547,16 @@ static void alc295_fixup_disable_dac3(struct hda_codec *codec, } } +/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */ +static void alc285_fixup_speaker2_to_dac1 (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { +hda_nid_t conn[1 ] = {0x02 }; +snd_hda_override_conn_list (codec,0x17 ,1 , conn); + } +} +/* Hook to update amp GPIO4 for automute */ static void alc280_hp_gpio4_automute_hook (struct hda_codec *codec,struct hda_jack_callback *jack)
@@ -5849,6 +5859,7 @@ enum {ALC225_FIXUP_DISABLE_MIC_VREF ,ALC225_FIXUP_DELL1_MIC_NO_PRESENCE ,ALC295_FIXUP_DISABLE_DAC3 , +ALC285_FIXUP_SPEAKER2_TO_DAC1 ,ALC280_FIXUP_HP_HEADSET_MIC ,ALC221_FIXUP_HP_FRONT_MIC , ALC292_FIXUP_TPT460,
@@ -6652,6 +6663,10 @@ static const struct hda_fixup alc269_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc295_fixup_disable_dac3, }, + [ALC285_FIXUP_SPEAKER2_TO_DAC1] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc285_fixup_speaker2_to_dac1, + }, [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = { .type = HDA_FIXUP_PINS, .v.pins = (const struct hda_pintbl []) {
@@ -7241,6 +7256,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x17aa ,0x224c ,"Thinkpad" ,ALC298_FIXUP_TPT470_DOCK ),SND_PCI_QUIRK (0x17aa ,0x224d ,"Thinkpad" ,ALC298_FIXUP_TPT470_DOCK ),SND_PCI_QUIRK (0x17aa ,0x225d ,"Thinkpad T480" ,ALC269_FIXUP_LIMIT_INT_MIC_BOOST ), +SND_PCI_QUIRK (0x17aa ,0x2293 ,"Thinkpad X1 Carbon 7th" ,ALC285_FIXUP_SPEAKER2_TO_DAC1 ),SND_PCI_QUIRK (0x17aa ,0x30bb ,"ThinkCentre AIO" ,ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY ),SND_PCI_QUIRK (0x17aa ,0x30e2 ,"ThinkCentre AIO" ,ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY ), SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
@@ -7425,6 +7441,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"}, {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"}, {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"}, + {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"}, {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"}, {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"}, {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 59/191 tcp: fix data-race in tcp_recvmsg()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit a5a7daa52edb5197a3b696afee13ef174dc2e993 ]
Reading tp->recvmsg_inq after socket lock is released raises a KCSAN warning [1]
Replace has_tss & has_cmsg by cmsg_flags and make
sure to not read tp->recvmsg_inq a second time.
[1]
BUG: KCSAN: data-race in tcp_chrono_stop / tcp_recvmsg
write to 0xffff888126adef24 of 2 bytes by interrupt on cpu 0:
tcp_chrono_set net/ipv4/tcp_output.c:2309 [inline] tcp_chrono_stop+0x14c/0x280 net/ipv4/tcp_output.c:2338 tcp_clean_rtx_queue net/ipv4/tcp_input.c:3165 [inline] tcp_ack+0x274f/0x3170 net/ipv4/tcp_input.c:3688 tcp_rcv_established+0x37e/0xf50 net/ipv4/tcp_input.c:5696 tcp_v4_do_rcv+0x381/0x4e0 net/ipv4/tcp_ipv4.c:1561 tcp_v4_rcv+0x19dc/0x1bb0 net/ipv4/tcp_ipv4.c:1942 ip_protocol_deliver_rcu+0x4d/0x420 net/ipv4/ip_input.c:204 ip_local_deliver_finish+0x110/0x140 net/ipv4/ip_input.c:231 NF_HOOK include/linux/netfilter.h:305 [inline] NF_HOOK include/linux/netfilter.h:299 [inline] ip_local_deliver+0x133/0x210 net/ipv4/ip_input.c:252 dst_input include/net/dst.h:442 [inline] ip_rcv_finish+0x121/0x160 net/ipv4/ip_input.c:413 NF_HOOK include/linux/netfilter.h:305 [inline] NF_HOOK include/linux/netfilter.h:299 [inline] ip_rcv+0x18f/0x1a0 net/ipv4/ip_input.c:523 __netif_receive_skb_one_core+0xa7/0xe0 net/core/dev.c:5010 __netif_receive_skb+0x37/0xf0 net/core/dev.c:5124 netif_receive_skb_internal+0x59/0x190 net/core/dev.c:5214 napi_skb_finish net/core/dev.c:5677 [inline] napi_gro_receive+0x28f/0x330 net/core/dev.c:5710
read to 0xffff888126adef25 of 1 bytes by task 7275 on cpu 1:
tcp_recvmsg+0x77b/0x1a30 net/ipv4/tcp.c:2187 inet_recvmsg+0xbb/0x250 net/ipv4/af_inet.c:838 sock_recvmsg_nosec net/socket.c:871 [inline] sock_recvmsg net/socket.c:889 [inline] sock_recvmsg+0x92/0xb0 net/socket.c:885 sock_read_iter+0x15f/0x1e0 net/socket.c:967 call_read_iter include/linux/fs.h:1889 [inline] new_sync_read+0x389/0x4f0 fs/read_write.c:414 __vfs_read+0xb1/0xc0 fs/read_write.c:427 vfs_read fs/read_write.c:461 [inline] vfs_read+0x143/0x2c0 fs/read_write.c:446 ksys_read+0xd5/0x1b0 fs/read_write.c:587 __do_sys_read fs/read_write.c:597 [inline] __se_sys_read fs/read_write.c:595 [inline] __x64_sys_read+0x4c/0x60 fs/read_write.c:595 do_syscall_64+0xcc/0x370 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9
Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 7275 Comm: sshd Not tainted 5.4.0-rc3+ #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- net/ipv4/tcp.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
net/ipv4/tcp.c +6 -8
@@ -1958,8 +1958,7 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock,struct sk_buff *skb, *last;u32 urg_hole =0 ;struct scm_timestamping_internal tss; -bool has_tss = false; -bool has_cmsg; +int cmsg_flags;if (unlikely (flags &MSG_ERRQUEUE ))return inet_recv_error (sk, msg, len, addr_len);
@@ -1974,7 +1973,7 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock,if (sk->sk_state ==TCP_LISTEN ) goto out; - has_cmsg = tp->recvmsg_inq; + cmsg_flags = tp->recvmsg_inq ?1 :0 ; timeo =sock_rcvtimeo (sk, nonblock);/* Urgent data needs to be handled specially. */
@@ -2157,8 +2156,7 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock,if (TCP_SKB_CB (skb)->has_rxtstamp) {tcp_update_recv_tstamps (skb, &tss); - has_tss = true; - has_cmsg = true; + cmsg_flags |=2 ; }if (TCP_SKB_CB (skb)->tcp_flags &TCPHDR_FIN ) goto found_fin_ok;
@@ -2183,10 +2181,10 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock,release_sock (sk); -if (has_cmsg) { -if (has_tss) +if (cmsg_flags) { +if (cmsg_flags &2 )tcp_recv_timestamp (msg, sk, &tss); -if (tp->recvmsg_inq) { +if (cmsg_flags &1 ) { inq =tcp_inq_hint (sk);put_cmsg (msg,SOL_TCP ,TCP_CM_INQ ,sizeof (inq), &inq); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 60/191 shmem: pin the file in shmem_fault() if mmap_sem is dropped
In reply to Greg Kroah-HartmanFrom: Kirill A. Shutemov <[email protected]>
[ Upstream commit 8897c1b1a1795cab23d5ac13e4e23bf0b5f4e0c6 ]
syzbot found the following crash:
BUG: KASAN: use-after-free in perf_trace_lock_acquire+0x401/0x530 include/trace/events/lock.h:13
Read of size 8 at addr ffff8880a5cf2c50 by task syz-executor.0/26173
CPU: 0 PID: 26173 Comm: syz-executor.0 Not tainted 5.3.0-rc6 #146
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
perf_trace_lock_acquire+0x401/0x530 include/trace/events/lock.h:13
trace_lock_acquire include/trace/events/lock.h:13 [inline]
lock_acquire+0x2de/0x410 kernel/locking/lockdep.c:4411
__raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline]
_raw_spin_lock+0x2f/0x40 kernel/locking/spinlock.c:151
spin_lock include/linux/spinlock.h:338 [inline]
shmem_fault+0x5ec/0x7b0 mm/shmem.c:2034
__do_fault+0x111/0x540 mm/memory.c:3083
do_shared_fault mm/memory.c:3535 [inline]
do_fault mm/memory.c:3613 [inline]
handle_pte_fault mm/memory.c:3840 [inline]
__handle_mm_fault+0x2adf/0x3f20 mm/memory.c:3964
handle_mm_fault+0x1b5/0x6b0 mm/memory.c:4001
do_user_addr_fault arch/x86/mm/fault.c:1441 [inline]
__do_page_fault+0x536/0xdd0 arch/x86/mm/fault.c:1506
do_page_fault+0x38/0x590 arch/x86/mm/fault.c:1530
page_fault+0x39/0x40 arch/x86/entry/entry_64.S:1202It happens if the VMA got unmapped under us while we dropped mmap_sem and inode got freed.
Pinning the file if we drop mmap_sem fixes the issue.
--- mm/shmem.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
mm/shmem.c +6 -5
@@ -2022,16 +2022,14 @@ static vm_fault_t shmem_fault(struct vm_fault *vmf) shmem_falloc->waitq && vmf->pgoff >= shmem_falloc->start && vmf->pgoff < shmem_falloc->next) { +struct file *fpin;wait_queue_head_t *shmem_falloc_waitq;DEFINE_WAIT_FUNC (shmem_fault_wait, synchronous_wake_function); ret =VM_FAULT_NOPAGE ; -if ((vmf->flags &FAULT_FLAG_ALLOW_RETRY ) && - !(vmf->flags &FAULT_FLAG_RETRY_NOWAIT )) { -/* It's polite to up mmap_sem if we can */ -up_read (&vma->vm_mm->mmap_sem); + fpin =maybe_unlock_mmap_for_io (vmf,NULL ); +if (fpin) ret =VM_FAULT_RETRY ; - } shmem_falloc_waitq = shmem_falloc->waitq; prepare_to_wait(shmem_falloc_waitq, &shmem_fault_wait,
@@ -2049,6 +2047,9 @@ static vm_fault_t shmem_fault(struct vm_fault *vmf)spin_lock (&inode->i_lock);finish_wait (shmem_falloc_waitq, &shmem_fault_wait);spin_unlock (&inode->i_lock); + +if (fpin) +fput (fpin);return ret; }spin_unlock (&inode->i_lock);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 61/191 taskstats: fix data-race
In reply to Greg Kroah-HartmanFrom: Christian Brauner <[email protected]>
[ Upstream commit 0b8d616fb5a8ffa307b1d3af37f55c15dae14f28 ]
When assiging and testing taskstats in taskstats_exit() there's a race when setting up and reading sig->stats when a thread-group with more than one thread exits:
write to 0xffff8881157bbe10 of 8 bytes by task 7951 on cpu 0:
taskstats_tgid_alloc kernel/taskstats.c:567 [inline] taskstats_exit+0x6b7/0x717 kernel/taskstats.c:596 do_exit+0x2c2/0x18e0 kernel/exit.c:864 do_group_exit+0xb4/0x1c0 kernel/exit.c:983 get_signal+0x2a2/0x1320 kernel/signal.c:2734 do_signal+0x3b/0xc00 arch/x86/kernel/signal.c:815 exit_to_usermode_loop+0x250/0x2c0 arch/x86/entry/common.c:159 prepare_exit_to_usermode arch/x86/entry/common.c:194 [inline] syscall_return_slowpath arch/x86/entry/common.c:274 [inline] do_syscall_64+0x2d7/0x2f0 arch/x86/entry/common.c:299 entry_SYSCALL_64_after_hwframe+0x44/0xa9
read to 0xffff8881157bbe10 of 8 bytes by task 7949 on cpu 1:
taskstats_tgid_alloc kernel/taskstats.c:559 [inline] taskstats_exit+0xb2/0x717 kernel/taskstats.c:596 do_exit+0x2c2/0x18e0 kernel/exit.c:864 do_group_exit+0xb4/0x1c0 kernel/exit.c:983 __do_sys_exit_group kernel/exit.c:994 [inline] __se_sys_exit_group kernel/exit.c:992 [inline] __x64_sys_exit_group+0x2e/0x30 kernel/exit.c:992 do_syscall_64+0xcf/0x2f0 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x44/0xa9
Fix this by using smp_load_acquire() and smp_store_release().
--- kernel/taskstats.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-)
kernel/taskstats.c +19 -11
@@ -554,25 +554,33 @@ static int taskstats_user_cmd(struct sk_buff *skb, struct genl_info *info)static struct taskstats *taskstats_tgid_alloc (struct task_struct *tsk) {struct signal_struct *sig = tsk->signal; -struct taskstats *stats; +struct taskstats *stats_new, *stats; -if (sig->stats ||thread_group_empty (tsk)) - goto ret; +/* Pairs with smp_store_release() below. */ + stats =smp_load_acquire (&sig->stats); +if (stats ||thread_group_empty (tsk)) +return stats;/* No problem if kmem_cache_zalloc() fails */ - stats =kmem_cache_zalloc (taskstats_cache,GFP_KERNEL ); + stats_new =kmem_cache_zalloc (taskstats_cache,GFP_KERNEL );spin_lock_irq (&tsk->sighand->siglock); -if (!sig->stats) { - sig->stats = stats; - stats =NULL ; + stats = sig->stats; +if (!stats) { +/* +* Pairs with smp_store_release() above and order the +* kmem_cache_zalloc(). +*/ +smp_store_release (&sig->stats, stats_new); + stats = stats_new; + stats_new =NULL ; }spin_unlock_irq (&tsk->sighand->siglock); -if (stats) -kmem_cache_free (taskstats_cache, stats); -ret: -return sig->stats; +if (stats_new) +kmem_cache_free (taskstats_cache, stats_new); + +return stats; }/* Send pid data out on exit */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 62/191 ALSA: hda - Downgrade error message for single-cmd fallback
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 475feec0c41ad71cb7d02f0310e56256606b57c5 ]
We made the error message for the CORB/RIRB communication clearer by upgrading to dev_WARN() so that user can notice better. But this struck us like a boomerang: now it caught syzbot and reported back as a fatal issue although it's not really any too serious bug that worth for stopping the whole system.
OK, OK, let's be softy, downgrade it to the standard dev_err() again.
--- sound/pci/hda/hda_controller.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/hda_controller.c +1 -1
@@ -884,7 +884,7 @@ static int azx_rirb_get_response(struct hdac_bus *bus, unsigned int addr,return -EAGAIN ;/* give a chance to retry */ } -dev_WARN (chip->card->dev, +dev_err (chip->card->dev,"azx_get_response timeout, switching to single_cmd mode: last cmd=0x%08x\n" , bus->last_cmd[addr]); chip->single_cmd =1 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 63/191 netfilter: nft_tproxy: Fix port selector on Big Endian
In reply to Greg Kroah-HartmanFrom: Phil Sutter <[email protected]>
[ Upstream commit 8cb4ec44de42b99b92399b4d1daf3dc430ed0186 ]
On Big Endian architectures, u16 port value was extracted from the wrong parts of u32 sreg_port, just like commit 10596608c4d62 ("netfilter:nf_tables: fix mismatch in big-endian system") describes.
--- net/netfilter/nft_tproxy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nft_tproxy.c +2 -2
@@ -50,7 +50,7 @@ static void nft_tproxy_eval_v4(const struct nft_expr *expr, taddr =nf_tproxy_laddr4 (skb, taddr, iph->daddr);if (priv->sreg_port) - tport = regs->data[priv->sreg_port]; + tport =nft_reg_load16 (®s->data[priv->sreg_port]);if (!tport) tport = hp->dest;
@@ -117,7 +117,7 @@ static void nft_tproxy_eval_v6(const struct nft_expr *expr, taddr = *nf_tproxy_laddr6 (skb, &taddr, &iph->daddr);if (priv->sreg_port) - tport = regs->data[priv->sreg_port]; + tport =nft_reg_load16 (®s->data[priv->sreg_port]);if (!tport) tport = hp->dest;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 64/191 block: add bio_truncate to fix guard_bio_eod
In reply to Greg Kroah-HartmanFrom: Ming Lei <[email protected]>
[ Upstream commit 85a8ce62c2eabe28b9d76ca4eecf37922402df93 ]
Some filesystem, such as vfat, may send bio which crosses device boundary, and the worse thing is that the IO request starting within device boundaries can contain more than one segment past EOD.
Commit dce30ca9e3b6 ("fs: fix guard_bio_eod to check for real EOD errors") tries to fix this issue by returning -EIO for this situation. However, this way lets fs user code lose chance to handle -EIO, then sync_inodes_sb() may hang for ever.
Also the current truncating on last segment is dangerous by updating the last bvec, given bvec table becomes not immutable any more, and fs bio users may not retrieve the truncated pages via bio_for_each_segment_all() in its .end_io callback.
Fixes this issue by supporting multi-segment truncating. And the approach is simpler:
- just update bio size since block layer can make correct bvec with the updated bio size. Then bvec table becomes really immutable.
- zero all truncated segments for read bio
--- block/bio.c | 39 +++++++++++++++++++++++++++++++++++++++ fs/buffer.c | 25 +------------------------ include/linux/bio.h | 1 + 3 files changed, 41 insertions(+), 24 deletions(-)
block/bio.c +39 -0
@@ -535,6 +535,45 @@ void zero_fill_bio_iter(struct bio *bio, struct bvec_iter start) }EXPORT_SYMBOL (zero_fill_bio_iter); +void bio_truncate (struct bio *bio,unsigned new_size) +{ +struct bio_vec bv; +struct bvec_iter iter; +unsigned int done =0 ; +bool truncated = false; + +if (new_size >= bio->bi_iter.bi_size) +return ; + +if (bio_data_dir (bio) !=READ ) + goto exit; + +bio_for_each_segment (bv, bio, iter) { +if (done + bv.bv_len > new_size) { +unsigned offset; + +if (!truncated) + offset = new_size - done; +else + offset =0 ; +zero_user (bv.bv_page, offset, bv.bv_len - offset); + truncated = true; + } + done += bv.bv_len; + } + + exit: +/* +* Don't touch bvec table here and make it really immutable, since +* fs bio user has to retrieve all pages via bio_for_each_segment_all +* in its .end_bio() callback. +* +* It is enough to truncate bio by updating .bi_size since we can make +* correct bvec with the updated .bi_size for drivers. +*/ + bio->bi_iter.bi_size = new_size; +} +/** * bio_put - release a reference to a bio * @bio: bio to release reference to
fs/buffer.c +1 -24
@@ -2994,8 +2994,6 @@ static void end_bio_bh_io_sync(struct bio *bio)void guard_bio_eod (int op,struct bio *bio) {sector_t maxsector; -struct bio_vec *bvec =bio_last_bvec_all (bio); -unsigned truncated_bytes;struct hd_struct *part;rcu_read_lock ();
@@ -3021,28 +3019,7 @@ void guard_bio_eod(int op, struct bio *bio)if (likely ((bio->bi_iter.bi_size >>9 ) <= maxsector))return ; -/* Uhhuh. We've got a bio that straddles the device size! */ - truncated_bytes = bio->bi_iter.bi_size - (maxsector <<9 ); - -/* -* The bio contains more than one segment which spans EOD, just return -* and let IO layer turn it into an EIO -*/ -if (truncated_bytes > bvec->bv_len) -return ; - -/* Truncate the bio.. */ - bio->bi_iter.bi_size -= truncated_bytes; - bvec->bv_len -= truncated_bytes; - -/* ..and clear the end of the buffer for reads */ -if (op ==REQ_OP_READ ) { -struct bio_vec bv; - -mp_bvec_last_segment (bvec, &bv); -zero_user (bv.bv_page, bv.bv_offset + bv.bv_len, - truncated_bytes); - } +bio_truncate (bio, maxsector <<9 ); } static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
include/linux/bio.h +1 -0
@@ -470,6 +470,7 @@ extern struct bio *bio_copy_user_iov(struct request_queue *, gfp_t);extern int bio_uncopy_user (struct bio *);void zero_fill_bio_iter (struct bio *bio,struct bvec_iter iter); +void bio_truncate (struct bio *bio,unsigned new_size);static inline void zero_fill_bio (struct bio *bio) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 65/191 mm: drop mmap_sem before calling balance_dirty_pages() in write fault
In reply to Greg Kroah-HartmanFrom: Johannes Weiner <[email protected]>
[ Upstream commit 89b15332af7c0312a41e50846819ca6613b58b4c ]
One of our services is observing hanging ps/top/etc under heavy write IO, and the task states show this is an mmap_sem priority inversion:
A write fault is holding the mmap_sem in read-mode and waiting for (heavily cgroup-limited) IO in balance_dirty_pages():
balance_dirty_pages+0x724/0x905
balance_dirty_pages_ratelimited+0x254/0x390
fault_dirty_shared_page.isra.96+0x4a/0x90
do_wp_page+0x33e/0x400
__handle_mm_fault+0x6f0/0xfa0
handle_mm_fault+0xe4/0x200
__do_page_fault+0x22b/0x4a0
page_fault+0x45/0x50Somebody tries to change the address space, contending for the mmap_sem in write-mode:
call_rwsem_down_write_failed_killable+0x13/0x20
do_mprotect_pkey+0xa8/0x330
SyS_mprotect+0xf/0x20
do_syscall_64+0x5b/0x100
entry_SYSCALL_64_after_hwframe+0x3d/0xa2The waiting writer locks out all subsequent readers to avoid lock starvation, and several threads can be seen hanging like this:
call_rwsem_down_read_failed+0x14/0x30
proc_pid_cmdline_read+0xa0/0x480
__vfs_read+0x23/0x140
vfs_read+0x87/0x130
SyS_read+0x42/0x90
do_syscall_64+0x5b/0x100
entry_SYSCALL_64_after_hwframe+0x3d/0xa2To fix this, do what we do for cache read faults already: drop the mmap_sem before calling into anything IO bound, in this case the balance_dirty_pages() function, and return VM_FAULT_RETRY.
--- mm/filemap.c | 21 --------------------- mm/internal.h | 21 +++++++++++++++++++++ mm/memory.c | 38 +++++++++++++++++++++++++++----------- 3 files changed, 48 insertions(+), 32 deletions(-)
mm/filemap.c +0 -21
@@ -2329,27 +2329,6 @@ EXPORT_SYMBOL(generic_file_read_iter);#ifdef CONFIG_MMU #define MMAP_LOTSAMISS (100) -static struct file *maybe_unlock_mmap_for_io (struct vm_fault *vmf, -struct file *fpin) -{ -int flags = vmf->flags; - -if (fpin) -return fpin; - -/* -* FAULT_FLAG_RETRY_NOWAIT means we don't want to wait on page locks or -* anything, so we only pin the file and drop the mmap_sem if only -* FAULT_FLAG_ALLOW_RETRY is set. -*/ -if ((flags & (FAULT_FLAG_ALLOW_RETRY |FAULT_FLAG_RETRY_NOWAIT )) == -FAULT_FLAG_ALLOW_RETRY ) { - fpin =get_file (vmf->vma->vm_file); -up_read (&vmf->vma->vm_mm->mmap_sem); - } -return fpin; -} -/* * lock_page_maybe_drop_mmap - lock the page, possibly dropping the mmap_sem * @vmf - the vm_fault for this fault.
mm/internal.h +21 -0
@@ -362,6 +362,27 @@ vma_address(struct page *page, struct vm_area_struct *vma) return max(start, vma->vm_start); } +static inline struct file *maybe_unlock_mmap_for_io (struct vm_fault *vmf, +struct file *fpin) +{ +int flags = vmf->flags; + +if (fpin) +return fpin; + +/* +* FAULT_FLAG_RETRY_NOWAIT means we don't want to wait on page locks or +* anything, so we only pin the file and drop the mmap_sem if only +* FAULT_FLAG_ALLOW_RETRY is set. +*/ +if ((flags & (FAULT_FLAG_ALLOW_RETRY |FAULT_FLAG_RETRY_NOWAIT )) == +FAULT_FLAG_ALLOW_RETRY ) { + fpin =get_file (vmf->vma->vm_file); +up_read (&vmf->vma->vm_mm->mmap_sem); + } +return fpin; +} +#else /* !CONFIG_MMU */ static inline void clear_page_mlock (struct page *page) { }static inline void mlock_vma_page (struct page *page) { }
mm/memory.c +27 -11
@@ -2227,10 +2227,11 @@ static vm_fault_t do_page_mkwrite(struct vm_fault *vmf)* * The function expects the page to be locked and unlocks it. */ -static void fault_dirty_shared_page (struct vm_area_struct *vma, -struct page *page) +static vm_fault_t fault_dirty_shared_page (struct vm_fault *vmf) { +struct vm_area_struct *vma = vmf->vma;struct address_space *mapping; +struct page *page = vmf->page;bool dirtied;bool page_mkwrite = vma->vm_ops && vma->vm_ops->page_mkwrite;
@@ -2245,16 +2246,30 @@ static void fault_dirty_shared_page(struct vm_area_struct *vma, mapping =page_rmapping (page);unlock_page (page); +if (!page_mkwrite) +file_update_time (vma->vm_file); + +/* +* Throttle page dirtying rate down to writeback speed. +* +* mapping may be NULL here because some device drivers do not +* set page.mapping but still dirty their pages +* +* Drop the mmap_sem before waiting on IO, if we can. The file +* is pinning the mapping, as per above. +*/ if ((dirtied || page_mkwrite) && mapping) { -/* -* Some device drivers do not set page.mapping -* but still dirty their pages -*/ +struct file *fpin; + + fpin =maybe_unlock_mmap_for_io (vmf,NULL );balance_dirty_pages_ratelimited (mapping); +if (fpin) { +fput (fpin); +return VM_FAULT_RETRY ; + } } -if (!page_mkwrite) -file_update_time (vma->vm_file); +return 0 ; }/*
@@ -2497,6 +2512,7 @@ static vm_fault_t wp_page_shared(struct vm_fault *vmf) __releases(vmf->ptl) {struct vm_area_struct *vma = vmf->vma; +vm_fault_t ret =VM_FAULT_WRITE ;get_page (vmf->page);
@@ -2520,10 +2536,10 @@ static vm_fault_t wp_page_shared(struct vm_fault *vmf)wp_page_reuse (vmf);lock_page (vmf->page); } -fault_dirty_shared_page (vma, vmf->page); + ret |=fault_dirty_shared_page (vmf);put_page (vmf->page); -return VM_FAULT_WRITE ; +return ret; }/*
@@ -3567,7 +3583,7 @@ static vm_fault_t do_shared_fault(struct vm_fault *vmf)return ret; } -fault_dirty_shared_page (vma, vmf->page); + ret |=fault_dirty_shared_page (vmf);return ret; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 66/191 ALSA: ice1724: Fix sleep-in-atomic in Infrasonic Quartet support code
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 0aec96f5897ac16ad9945f531b4bef9a2edd2ebd upstream.
Jia-Ju Bai reported a possible sleep-in-atomic scenario in the ice1724 driver with Infrasonic Quartet support code: namely, ice->set_rate callback gets called inside ice->reg_lock spinlock, while the callback in quartet.c holds ice->gpio_mutex.
This patch fixes the invalid call: it simply moves the calls of ice->set_rate and ice->set_mclk callbacks outside the spinlock.
--- sound/pci/ice1712/ice1724.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
sound/pci/ice1712/ice1724.c +6 -3
@@ -647,6 +647,7 @@ static int snd_vt1724_set_pro_rate(strucunsigned long flags;unsigned char mclk_change;unsigned int i, old_rate; +bool call_set_rate = false;if (rate > ice->hw_rates->list[ice->hw_rates->count -1 ])return -EINVAL ;
@@ -670,7 +671,7 @@ static int snd_vt1724_set_pro_rate(struc* setting clock rate for internal clock mode */ old_rate = ice->get_rate (ice);if (force || (old_rate != rate)) - ice->set_rate (ice, rate); + call_set_rate = true;else if (rate == ice->cur_rate) {spin_unlock_irqrestore (&ice->reg_lock, flags);return 0 ;
@@ -678,12 +679,14 @@ static int snd_vt1724_set_pro_rate(struc } ice->cur_rate = rate; +spin_unlock_irqrestore (&ice->reg_lock, flags); + +if (call_set_rate) + ice->set_rate (ice, rate);/* setting master clock */ mclk_change = ice->set_mclk (ice, rate); -spin_unlock_irqrestore (&ice->reg_lock, flags); -if (mclk_change && ice->gpio.i2s_mclk_changed) ice->gpio.i2s_mclk_changed (ice);if (ice->gpio.set_pro_rate)
Greg Kroah-Hartman
maintainerPATCH 67/191 ALSA: usb-audio: fix set_format altsetting sanity check
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 0141254b0a74b37aa7eb13d42a56adba84d51c73 upstream.
Make sure to check the return value of usb_altnum_to_altsetting() to avoid dereferencing a NULL pointer when the requested alternate settings is missing.
The format altsetting number may come from a quirk table and there does not seem to be any other validation of it (the corresponding index is checked however).
--- sound/usb/pcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/usb/pcm.c +2 -2
@@ -506,9 +506,9 @@ static int set_format(struct snd_usb_subif (WARN_ON (!iface))return -EINVAL ; alts =usb_altnum_to_altsetting (iface, fmt->altsetting); - altsd =get_iface_desc (alts); -if (WARN_ON (altsd->bAlternateSetting != fmt->altsetting)) +if (WARN_ON (!alts))return -EINVAL ; + altsd =get_iface_desc (alts);if (fmt == subs->cur_audiofmt)return 0 ;
Greg Kroah-Hartman
maintainerPATCH 68/191 ALSA: usb-audio: set the interface format after resume on Dell WD19
In reply to Greg Kroah-HartmanFrom: Hui Wang <[email protected]>
commit 92adc96f8eecd9522a907c197cc3d62e405539fe upstream.
Recently we found the headset-mic on the Dell Dock WD19 doesn't work anymore after s3 (s2i or deep), this problem could be workarounded by closing (pcm_close) the app and then reopening (pcm_open) the app, so this bug is not easy to be detected by users.
When problem happens, retire_capture_urb() could still be called periodically, but the size of captured data is always 0, it could be a firmware bug on the dock. Anyway I found after resuming, the snd_usb_pcm_prepare() will be called, and if we forcibly run set_format() to set the interface and its endpoint, the capture size will be normal again. This problem and workaound also apply to playback.
To fix it in the kernel, add a quirk to let set_format() run forcibly once after resume.
--- sound/usb/card.h | 1 + sound/usb/pcm.c | 21 +++++++++++++++++++-- sound/usb/quirks-table.h | 3 ++- sound/usb/quirks.c | 11 +++++++++++ sound/usb/usbaudio.h | 3 ++- 5 files changed, 35 insertions(+), 4 deletions(-)
sound/usb/card.h +1 -0
@@ -145,6 +145,7 @@ struct snd_usb_substream {struct snd_usb_endpoint *sync_endpoint;unsigned long flags;bool need_setup_ep;/* (re)configure EP at prepare? */ +bool need_setup_fmt;/* (re)configure fmt after resume? */ unsigned int speed;/* USB_SPEED_XXX */ u64 formats;/* format bitmasks (all or'ed) */
sound/usb/pcm.c +19 -2
@@ -510,11 +510,11 @@ static int set_format(struct snd_usb_subreturn -EINVAL ; altsd =get_iface_desc (alts); -if (fmt == subs->cur_audiofmt) +if (fmt == subs->cur_audiofmt && !subs->need_setup_fmt)return 0 ;/* close the old interface */ -if (subs->interface >=0 && subs->interface != fmt->iface) { +if (subs->interface >=0 && (subs->interface != fmt->iface || subs->need_setup_fmt)) {if (!subs->stream->chip->keep_iface) { err =usb_set_interface (subs->dev, subs->interface,0 );if (err <0 ) {
@@ -528,6 +528,9 @@ static int set_format(struct snd_usb_sub subs->altset_idx =0 ; } +if (subs->need_setup_fmt) + subs->need_setup_fmt = false; +/* set interface */ if (iface->cur_altsetting != alts) { err =snd_usb_select_mode_quirk (subs, fmt);
@@ -1735,6 +1738,13 @@ static int snd_usb_substream_playback_tr subs->data_endpoint->retire_data_urb = retire_playback_urb; subs->running =0 ;return 0 ; +case SNDRV_PCM_TRIGGER_SUSPEND : +if (subs->stream->chip->setup_fmt_after_resume_quirk) { +stop_endpoints (subs, true); + subs->need_setup_fmt = true; +return 0 ; + } +break ; }return -EINVAL ;
@@ -1767,6 +1777,13 @@ static int snd_usb_substream_capture_tri subs->data_endpoint->retire_data_urb = retire_capture_urb; subs->running =1 ;return 0 ; +case SNDRV_PCM_TRIGGER_SUSPEND : +if (subs->stream->chip->setup_fmt_after_resume_quirk) { +stop_endpoints (subs, true); + subs->need_setup_fmt = true; +return 0 ; + } +break ; }return -EINVAL ;
sound/usb/quirks-table.h +2 -1
@@ -3466,7 +3466,8 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge .vendor_name = "Dell", .product_name = "WD19 Dock", .profile_name = "Dell-WD15-Dock", - .ifnum = QUIRK_NO_INTERFACE + .ifnum = QUIRK_ANY_INTERFACE, + .type = QUIRK_SETUP_FMT_AFTER_RESUME } },/* MOTU Microbook II */
sound/usb/quirks.c +11 -0
@@ -508,6 +508,16 @@ static int create_standard_mixer_quirk(sreturn snd_usb_create_mixer (chip, quirk->ifnum,0 ); } + +static int setup_fmt_after_resume_quirk (struct snd_usb_audio *chip, +struct usb_interface *iface, +struct usb_driver *driver, +const struct snd_usb_audio_quirk *quirk) +{ + chip->setup_fmt_after_resume_quirk =1 ; +return 1 ;/* Continue with creating streams and mixer */ +} +/* * audio-interface quirks *
@@ -546,6 +556,7 @@ int snd_usb_create_quirk(struct snd_usb_ [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk, [QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk, [QUIRK_AUDIO_STANDARD_MIXER] = create_standard_mixer_quirk, + [QUIRK_SETUP_FMT_AFTER_RESUME] = setup_fmt_after_resume_quirk, };if (quirk->type <QUIRK_TYPE_COUNT ) {
sound/usb/usbaudio.h +2 -1
@@ -33,7 +33,7 @@ struct snd_usb_audio {wait_queue_head_t shutdown_wait; unsigned int txfr_quirk:1; /* Subframe boundaries on transfers */ unsigned int tx_length_quirk:1; /* Put length specifier in transfers */ - + unsigned int setup_fmt_after_resume_quirk:1; /* setup the format to interface after resume */int num_interfaces;int num_suspended_intf;int sample_rate_read_error;
@@ -98,6 +98,7 @@ enum quirk_type {QUIRK_AUDIO_EDIROL_UAXX ,QUIRK_AUDIO_ALIGN_TRANSFER ,QUIRK_AUDIO_STANDARD_MIXER , +QUIRK_SETUP_FMT_AFTER_RESUME , QUIRK_TYPE_COUNT };
Greg Kroah-Hartman
maintainerPATCH 69/191 ALSA: hda - Apply sync-write workaround to old Intel platforms, too
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit c366b3dbbab14b28d044b94eb9ce77c23482ea35 upstream.
Klaus Ethgen reported occasional high CPU usages in his system that seem caused by HD-audio driver. The perf output revealed that it's in the unsolicited event handling in the workqueue, and the problem seems triggered by some communication stall between the controller and the codec at the runtime or system resume.
Actually a similar phenomenon was seen in the past for other Intel platforms, and we already applied the workaround to enforce sync-write for CORB/RIRB verbs for Skylake and newer chipsets (commit 2756d9143aa5 "ALSA: hda - Fix intermittent CORB/RIRB stall on Intel chips"). Fortunately, the same workaround is applicable to the old chipset, and the experiment showed the positive effect.
Based on the experiment result, this patch enables the sync-write workaround for all Intel chipsets. The only reason I hesitated to apply this workaround was about the possibly slightly higher CPU usage. But if the lack of sync causes a much severer problem even for quite old chip, we should think this would be necessary for all Intel chips.
--- sound/pci/hda/hda_intel.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
sound/pci/hda/hda_intel.c +5 -4
@@ -280,12 +280,13 @@ enum {/* quirks for old Intel chipsets */ #define AZX_DCAPS_INTEL_ICH \ - (AZX_DCAPS_OLD_SSYNC | AZX_DCAPS_NO_ALIGN_BUFSIZE) + (AZX_DCAPS_OLD_SSYNC | AZX_DCAPS_NO_ALIGN_BUFSIZE |\ + AZX_DCAPS_SYNC_WRITE)/* quirks for Intel PCH */ #define AZX_DCAPS_INTEL_PCH_BASE \ (AZX_DCAPS_NO_ALIGN_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY |\ - AZX_DCAPS_SNOOP_TYPE(SCH)) + AZX_DCAPS_SNOOP_TYPE(SCH) | AZX_DCAPS_SYNC_WRITE)/* PCH up to IVB; no runtime PM; bind with i915 gfx */ #define AZX_DCAPS_INTEL_PCH_NOPM \
@@ -300,13 +301,13 @@ enum { #define AZX_DCAPS_INTEL_HASWELL \ (/*AZX_DCAPS_ALIGN_BUFSIZE |*/ AZX_DCAPS_COUNT_LPIB_DELAY |\ AZX_DCAPS_PM_RUNTIME | AZX_DCAPS_I915_COMPONENT |\ - AZX_DCAPS_SNOOP_TYPE(SCH)) + AZX_DCAPS_SNOOP_TYPE(SCH) | AZX_DCAPS_SYNC_WRITE)/* Broadwell HDMI can't use position buffer reliably, force to use LPIB */ #define AZX_DCAPS_INTEL_BROADWELL \ (/*AZX_DCAPS_ALIGN_BUFSIZE |*/ AZX_DCAPS_POSFIX_LPIB |\ AZX_DCAPS_PM_RUNTIME | AZX_DCAPS_I915_COMPONENT |\ - AZX_DCAPS_SNOOP_TYPE(SCH)) + AZX_DCAPS_SNOOP_TYPE(SCH) | AZX_DCAPS_SYNC_WRITE)#define AZX_DCAPS_INTEL_BAYTRAIL \ (AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_I915_COMPONENT)
Greg Kroah-Hartman
maintainerPATCH 70/191 ALSA: hda/realtek - Add headset Mic no shutup for ALC283
In reply to Greg Kroah-HartmanFrom: Kailang Yang <[email protected]>
commit 66c5d718e5a6f80153b5e8d6ad8ba8e9c3320839 upstream.
Chrome machine had humming noise from external speaker plugin at codec D3 state.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -501,6 +501,7 @@ static void alc_shutup_pins(struct hda_cstruct alc_spec *spec = codec->spec;switch (codec->core.vendor_id) { +case 0x10ec0283 :case 0x10ec0286 :case 0x10ec0288 :case 0x10ec0298 :
Greg Kroah-Hartman
maintainerPATCH 71/191 drm/sun4i: hdmi: Remove duplicate cleanup calls
In reply to Greg Kroah-HartmanFrom: Stefan Mavrodiev <[email protected]>
commit 57177d214ee0816c4436c23d6c933ccb32c571f1 upstream.
When the HDMI unbinds drm_connector_cleanup() and drm_encoder_cleanup() are called. This also happens when the connector and the encoder are destroyed. This double call triggers a NULL pointer exception.
The patch fixes this by removing the cleanup calls in the unbind function.
--- drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +0 -2
@@ -683,8 +683,6 @@ static void sun4i_hdmi_unbind(struct devstruct sun4i_hdmi *hdmi =dev_get_drvdata (dev);cec_unregister_adapter (hdmi->cec_adap); -drm_connector_cleanup (&hdmi->connector); -drm_encoder_cleanup (&hdmi->encoder);i2c_del_adapter (hdmi->i2c);i2c_put_adapter (hdmi->ddc_i2c);clk_disable_unprepare (hdmi->mod_clk);
Greg Kroah-Hartman
maintainerPATCH 72/191 drm/amdgpu/smu: add metrics table lock
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
commit 073d5eef9e043c2b7e3ef12bc6c879b1d248e831 upstream.
This table is used for lots of things, add it's own lock.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 1 + drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 1 + 2 files changed, 2 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1 -0
@@ -844,6 +844,7 @@ static int smu_sw_init(void *handle) smu->smu_baco.platform_support = false;mutex_init (&smu->sensor_lock); +mutex_init (&smu->metrics_lock); smu->watermarks_bitmap =0 ; smu->power_profile_mode =PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT ;
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 -0
@@ -345,6 +345,7 @@ struct smu_contextconst struct pptable_funcs *ppt_funcs;struct mutex mutex;struct mutex sensor_lock; +struct mutex metrics_lock;uint64_t pool_size;struct smu_table_context smu_table;
Greg Kroah-Hartman
maintainerPATCH 73/191 drm/amdgpu/smu: add metrics table lock for arcturus (v2)
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
commit 1da87c9f67c98d552679974dbfc1f0f65b6a0a53 upstream.
To protect access to the metrics table.
v2: unlock on error
--- drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +3 -0
@@ -910,18 +910,21 @@ static int arcturus_get_metrics_table(ststruct smu_table_context *smu_table= &smu->smu_table;int ret =0 ; +mutex_lock (&smu->metrics_lock);if (!smu_table->metrics_time ||time_after (jiffies, smu_table->metrics_time +HZ /1000 )) { ret =smu_update_table (smu,SMU_TABLE_SMU_METRICS ,0 , (void *)smu_table->metrics_table, false);if (ret) {pr_info ("Failed to export SMU metrics table!\n" ); +mutex_unlock (&smu->metrics_lock);return ret; } smu_table->metrics_time = jiffies; }memcpy (metrics_table, smu_table->metrics_table,sizeof (SmuMetrics_t)); +mutex_unlock (&smu->metrics_lock);return ret; }
Greg Kroah-Hartman
maintainerPATCH 74/191 drm/amdgpu/smu: add metrics table lock for navi (v2)
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
commit e0e384c398d4638e54b6d2098f0ceaafdab870ee upstream.
To protect access to the metrics table.
v2: unlock on error
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +3 -0
@@ -547,17 +547,20 @@ static int navi10_get_metrics_table(strustruct smu_table_context *smu_table= &smu->smu_table;int ret =0 ; +mutex_lock (&smu->metrics_lock);if (!smu_table->metrics_time ||time_after (jiffies, smu_table->metrics_time +msecs_to_jiffies (100 ))) { ret =smu_update_table (smu,SMU_TABLE_SMU_METRICS ,0 , (void *)smu_table->metrics_table, false);if (ret) {pr_info ("Failed to export SMU metrics table!\n" ); +mutex_unlock (&smu->metrics_lock);return ret; } smu_table->metrics_time = jiffies; }memcpy (metrics_table, smu_table->metrics_table,sizeof (SmuMetrics_t)); +mutex_unlock (&smu->metrics_lock);return ret; }
Greg Kroah-Hartman
maintainerPATCH 75/191 drm/amdgpu/smu: add metrics table lock for vega20 (v2)
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
commit 1c455101c6d10c99b310d6bcf613244c97854012 upstream.
To protect access to the metrics table.
v2: unlock on error
--- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +3 -0
@@ -1691,17 +1691,20 @@ static int vega20_get_metrics_table(strustruct smu_table_context *smu_table= &smu->smu_table;int ret =0 ; +mutex_lock (&smu->metrics_lock);if (!smu_table->metrics_time ||time_after (jiffies, smu_table->metrics_time +HZ /1000 )) { ret =smu_update_table (smu,SMU_TABLE_SMU_METRICS ,0 , (void *)smu_table->metrics_table, false);if (ret) {pr_info ("Failed to export SMU metrics table!\n" ); +mutex_unlock (&smu->metrics_lock);return ret; } smu_table->metrics_time = jiffies; }memcpy (metrics_table, smu_table->metrics_table,sizeof (SmuMetrics_t)); +mutex_unlock (&smu->metrics_lock);return ret; }
Greg Kroah-Hartman
maintainerPATCH 76/191 MIPS: BPF: Disable MIPS32 eBPF JIT
In reply to Greg Kroah-HartmanFrom: Paul Burton <[email protected]>
commit f8fffebdea752a25757b906f3dffecf1a59a6194 upstream.
Commit 716850ab104d ("MIPS: eBPF: Initial eBPF support for MIPS32 architecture.") enabled our eBPF JIT for MIPS32 kernels, whereas it has previously only been availailable for MIPS64. It was my understanding at the time that the BPF test suite was passing & JITing a comparable number of tests to our cBPF JIT [1], but it turns out that was not the case.
The eBPF JIT has a number of problems on MIPS32:
- Most notably various code paths still result in emission of MIPS64 instructions which will cause reserved instruction exceptions & kernel panics when run on MIPS32 CPUs.
- The eBPF JIT doesn't account for differences between the O32 ABI used by MIPS32 kernels versus the N64 ABI used by MIPS64 kernels. Notably arguments beyond the first 4 are passed on the stack in O32, and this is entirely unhandled when JITing a BPF_CALL instruction. Stack space must be reserved for arguments even if they all fit in registers, and the callee is free to assume that stack space has been reserved for its use - with the eBPF JIT this is not the case, so calling any function can result in clobbering values on the stack & unpredictable behaviour. Function arguments in eBPF are always 64-bit values which is also entirely unhandled - the JIT still uses a single (32-bit) register per argument. As a result all function arguments are always passed incorrectly when JITing a BPF_CALL instruction, leading to kernel crashes or strange behavior.
- The JIT attempts to bail our on use of ALU64 instructions or 64-bit memory access instructions. The code doing this at the start of build_one_insn() incorrectly checks whether BPF_OP() equals BPF_DW, when it should really be checking BPF_SIZE() & only doing so when BPF_CLASS() is one of BPF_{LD,LDX,ST,STX}. This results in false positives that cause more bailouts than intended, and that in turns hides some of the problems described above.
- The kernel's cBPF->eBPF translation makes heavy use of 64-bit eBPF instructions that the MIPS32 eBPF JIT bails out on, leading to most cBPF programs not being JITed at all.
Until these problems are resolved, revert the enabling of the eBPF JIT on MIPS32 done by commit 716850ab104d ("MIPS: eBPF: Initial eBPF support for MIPS32 architecture.").
Note that this does not undo the changes made to the eBPF JIT by that commit, since they are a useful starting point to providing MIPS32 support - they're just not nearly complete.
--- arch/mips/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/Kconfig +1 -1
@@ -46,7 +46,7 @@ config MIPS select HAVE_ARCH_TRACEHOOK select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES select HAVE_ASM_MODVERSIONS - select HAVE_EBPF_JIT if (!CPU_MICROMIPS) + select HAVE_EBPF_JIT if (64BIT && !CPU_MICROMIPS) select HAVE_CONTEXT_TRACKING select HAVE_COPY_THREAD_TLS select HAVE_C_RECORDMCOUNT
Greg Kroah-Hartman
maintainerPATCH 77/191 MIPS: BPF: eBPF JIT: check for MIPS ISA compliance in Kconfig
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
commit f596cf0d8062cb5d0a4513a8b3afca318c13be10 upstream.
It is completely wrong to check for compile-time MIPS ISA revision in the body of bpf_int_jit_compile() as it may lead to get MIPS JIT fully omitted by the CC while the rest system will think that the JIT is actually present and works [1].
We can check if the selected CPU really supports MIPS eBPF JIT at configure time and avoid such situations when kernel can be built without both JIT and interpreter, but with CONFIG_BPF_SYSCALL=y.
[1] https://lore.kernel.org/linux-mips/[email protected]/
--- arch/mips/Kconfig | 2 +- arch/mips/net/ebpf_jit.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/mips/Kconfig +1 -1
@@ -46,7 +46,7 @@ config MIPS select HAVE_ARCH_TRACEHOOK select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES select HAVE_ASM_MODVERSIONS - select HAVE_EBPF_JIT if (64BIT && !CPU_MICROMIPS) + select HAVE_EBPF_JIT if 64BIT && !CPU_MICROMIPS && TARGET_ISA_REV >= 2 select HAVE_CONTEXT_TRACKING select HAVE_COPY_THREAD_TLS select HAVE_C_RECORDMCOUNT
arch/mips/net/ebpf_jit.c +1 -1
@@ -1803,7 +1803,7 @@ struct bpf_prog *bpf_int_jit_compile(strunsigned int image_size;u8 *image_ptr; -if (!prog->jit_requested ||MIPS_ISA_REV <2 ) +if (!prog->jit_requested)return prog; tmp =bpf_jit_blind_constants (prog);
Greg Kroah-Hartman
maintainerPATCH 78/191 MIPS: Avoid VDSO ABI breakage due to global register variable
In reply to Greg Kroah-HartmanFrom: Paul Burton <[email protected]>
commit bbcc5672b0063b0e9d65dc8787a4f09c3b5bb5cc upstream.
Declaring __current_thread_info as a global register variable has the effect of preventing GCC from saving & restoring its value in cases where the ABI would typically do so.
To quote GCC documentation:
Quoted 4 lines
If the register is a call-saved register, call ABI is affected: the register will not be restored in function epilogue sequences after the variable has been assigned. Therefore, functions cannot safely return to callers that assume standard ABI.
When our position independent VDSO is built for the n32 or n64 ABIs all functions it exposes should be preserving the value of $gp/$28 for their caller, but in the presence of the __current_thread_info global register variable GCC stops doing so & simply clobbers $gp/$28 when calculating the address of the GOT.
In cases where the VDSO returns success this problem will typically be masked by the caller in libc returning & restoring $gp/$28 itself, but that is by no means guaranteed. In cases where the VDSO returns an error libc will typically contain a fallback path which will now fail (typically with a bad memory access) if it attempts anything which relies upon the value of $gp/$28 - eg. accessing anything via the GOT.
One fix for this would be to move the declaration of __current_thread_info inside the current_thread_info() function, demoting it from global register variable to local register variable & avoiding inadvertently creating a non-standard calling ABI for the VDSO. Unfortunately this causes issues for clang, which doesn't support local register variables as pointed out by commit fe92da0f355e ("MIPS: Changed current_thread_info() to an equivalent supported by both clang and GCC") which introduced the global register variable before we had a VDSO to worry about.
Instead, fix this by continuing to use the global register variable for the kernel proper but declare __current_thread_info as a simple extern variable when building the VDSO. It should never be referenced, and will cause a link error if it is. This resolves the calling convention issue for the VDSO without having any impact upon the build of the kernel itself for either clang or gcc.
--- arch/mips/include/asm/thread_info.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
arch/mips/include/asm/thread_info.h +19 -1
@@ -49,8 +49,26 @@ struct thread_info { .addr_limit = KERNEL_DS, \ } -/* How to get the thread information struct from C. */ +/* +* A pointer to the struct thread_info for the currently executing thread is +* held in register $28/$gp. +* +* We declare __current_thread_info as a global register variable rather than a +* local register variable within current_thread_info() because clang doesn't +* support explicit local register variables. +* +* When building the VDSO we take care not to declare the global register +* variable because this causes GCC to not preserve the value of $28/$gp in +* functions that change its value (which is common in the PIC VDSO when +* accessing the GOT). Since the VDSO shouldn't be accessing +* __current_thread_info anyway we declare it extern in order to cause a link +* failure if it's referenced. +*/ +#ifdef __VDSO__ +extern struct thread_info *__current_thread_info; +#else registerstruct thread_info *__current_thread_info __asm__("$28" ); +#endif static inline struct thread_info *current_thread_info (void ) {
Greg Kroah-Hartman
maintainerPATCH 79/191 media: pulse8-cec: fix lost cec_transmit_attempt_done() call
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
commit e5a52a1d15c79bb48a430fb263852263ec1d3f11 upstream.
The periodic PING command could interfere with the result of a CEC transmit, causing a lost cec_transmit_attempt_done() call.
--- drivers/media/usb/pulse8-cec/pulse8-cec.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/media/usb/pulse8-cec/pulse8-cec.c +13 -4
@@ -116,6 +116,7 @@ struct pulse8 {unsigned int vers;struct completion cmd_done;struct work_struct work; +u8 work_result;struct delayed_work ping_eeprom_work;struct cec_msg rx_msg;u8 data[DATA_SIZE ];
@@ -137,8 +138,10 @@ static void pulse8_irq_work_handler(stru {struct pulse8 *pulse8 = container_of(work, struct pulse8, work); +u8 result = pulse8->work_result; -switch (pulse8->data[0 ] &0x3f ) { + pulse8->work_result =0 ; +switch (result &0x3f ) {case MSGCODE_FRAME_DATA :cec_received_msg (pulse8->adap, &pulse8->rx_msg);break ;
@@ -172,12 +175,12 @@ static irqreturn_t pulse8_interrupt(stru pulse8->escape = false; }else if (data ==MSGEND ) {struct cec_msg *msg = &pulse8->rx_msg; +u8 msgcode = pulse8->buf[0 ];if (debug)dev_info (pulse8->dev,"received: %*ph\n" , pulse8->idx, pulse8->buf); - pulse8->data[0 ] = pulse8->buf[0 ]; -switch (pulse8->buf[0 ] &0x3f ) { +switch (msgcode &0x3f ) {case MSGCODE_FRAME_START : msg->len =1 ; msg->msg[0 ] = pulse8->buf[1 ];
@@ -186,14 +189,20 @@ static irqreturn_t pulse8_interrupt(struif (msg->len ==CEC_MAX_MSG_SIZE )break ; msg->msg[msg->len++] = pulse8->buf[1 ]; -if (pulse8->buf[0 ] &MSGCODE_FRAME_EOM ) +if (msgcode &MSGCODE_FRAME_EOM ) { +WARN_ON (pulse8->work_result); + pulse8->work_result = msgcode;schedule_work (&pulse8->work); +break ; + }break ;case MSGCODE_TRANSMIT_SUCCEEDED :case MSGCODE_TRANSMIT_FAILED_LINE :case MSGCODE_TRANSMIT_FAILED_ACK :case MSGCODE_TRANSMIT_FAILED_TIMEOUT_DATA :case MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE : +WARN_ON (pulse8->work_result); + pulse8->work_result = msgcode;schedule_work (&pulse8->work);break ;case MSGCODE_HIGH_ERROR :
Greg Kroah-Hartman
maintainerPATCH 80/191 media: cec: CEC 2.0-only bcast messages were ignored
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
commit cec935ce69fc386f13959578deb40963ebbb85c3 upstream.
Some messages are allowed to be a broadcast message in CEC 2.0 only, and should be ignored by CEC 1.4 devices.
Unfortunately, the check was wrong, causing such messages to be marked as invalid under CEC 2.0.
--- drivers/media/cec/cec-adap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/cec/cec-adap.c +3 -3
@@ -1083,11 +1083,11 @@ void cec_received_msg_ts(struct cec_adap valid_la = false; else if (!cec_msg_is_broadcast(msg) && !(dir_fl & DIRECTED)) valid_la = false; - else if (cec_msg_is_broadcast(msg) && !(dir_fl & BCAST1_4)) + else if (cec_msg_is_broadcast(msg) && !(dir_fl & BCAST)) valid_la = false; else if (cec_msg_is_broadcast(msg) && - adap->log_addrs.cec_version >= CEC_OP_CEC_VERSION_2_0 && - !(dir_fl & BCAST2_0)) + adap->log_addrs.cec_version < CEC_OP_CEC_VERSION_2_0 && + !(dir_fl & BCAST1_4)) valid_la = false; }if (valid_la && min_len) {
Greg Kroah-Hartman
maintainerPATCH 81/191 media: cec: avoid decrementing transmit_queue_sz if it is 0
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
commit 95c29d46ab2a517e4c26d0a07300edca6768db17 upstream.
WARN if transmit_queue_sz is 0 but do not decrement it. The CEC adapter will become unresponsive if it goes below 0 since then it thinks there are 4 billion messages in the queue.
Obviously this should not happen, but a driver bug could cause this.
--- drivers/media/cec/cec-adap.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/media/cec/cec-adap.c +12 -2
@@ -378,7 +378,8 @@ static void cec_data_cancel(struct cec_d }else {list_del_init (&data->list);if (!(data->msg.tx_status &CEC_TX_STATUS_OK )) - data->adap->transmit_queue_sz--; +if (!WARN_ON (!data->adap->transmit_queue_sz)) + data->adap->transmit_queue_sz--; }if (data->msg.tx_status &CEC_TX_STATUS_OK ) {
@@ -430,6 +431,14 @@ static void cec_flush(struct cec_adapter* need to do anything special in that case. */ } +/* +* If something went wrong and this counter isn't what it should +* be, then this will reset it back to 0. Warn if it is not 0, +* since it indicates a bug, either in this framework or in a +* CEC driver. +*/ +if (WARN_ON (adap->transmit_queue_sz)) + adap->transmit_queue_sz =0 ; }/*
@@ -520,7 +529,8 @@ int cec_thread_func(void *_adap) data =list_first_entry (&adap->transmit_queue, struct cec_data, list);list_del_init (&data->list); - adap->transmit_queue_sz--; +if (!WARN_ON (!data->adap->transmit_queue_sz)) + adap->transmit_queue_sz--;/* Make this the current transmitting message */ adap->transmitting = data;
Greg Kroah-Hartman
maintainerPATCH 82/191 media: cec: check transmit_in_progress, not transmitting
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
commit ac479b51f3f4aaa852b5d3f00ecfb9290230cf64 upstream.
Currently wait_event_interruptible_timeout is called in cec_thread_func() when adap->transmitting is set. But if the adapter is unconfigured while transmitting, then adap->transmitting is set to NULL. But the hardware is still actually transmitting the message, and that's indicated by adap->transmit_in_progress and we should wait until that is finished or times out before transmitting new messages.
As the original commit says: adap->transmitting is the userspace view, adap->transmit_in_progress reflects the hardware state.
However, if adap->transmitting is NULL and adap->transmit_in_progress is true, then wait_event_interruptible is called (no timeout), which can get stuck indefinitely if the CEC driver is flaky and never marks the transmit-in-progress as 'done'.
So test against transmit_in_progress when deciding whether to use the timeout variant or not, instead of testing against adap->transmitting.
--- drivers/media/cec/cec-adap.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/media/cec/cec-adap.c +12 -8
@@ -463,7 +463,7 @@ int cec_thread_func(void *_adap)bool timeout = false;u8 attempts; -if (adap->transmitting) { +if (adap->transmit_in_progress) {int err;/*
@@ -498,7 +498,7 @@ int cec_thread_func(void *_adap) goto unlock; } -if (adap->transmitting && timeout) { +if (adap->transmit_in_progress && timeout) {/* * If we timeout, then log that. Normally this does * not happen and it is an indication of a faulty CEC
@@ -507,14 +507,18 @@ int cec_thread_func(void *_adap)* so much traffic on the bus that the adapter was * unable to transmit for CEC_XFER_TIMEOUT_MS (2.1s). */ -pr_warn ("cec-%s: message %*ph timed out\n" , adap->name, - adap->transmitting->msg.len, - adap->transmitting->msg.msg); +if (adap->transmitting) { +pr_warn ("cec-%s: message %*ph timed out\n" , adap->name, + adap->transmitting->msg.len, + adap->transmitting->msg.msg); +/* Just give up on this. */ +cec_data_cancel (adap->transmitting, +CEC_TX_STATUS_TIMEOUT ); + }else { +pr_warn ("cec-%s: transmit timed out\n" , adap->name); + } adap->transmit_in_progress = false; adap->tx_timeouts++; -/* Just give up on this. */ -cec_data_cancel (adap->transmitting, -CEC_TX_STATUS_TIMEOUT ); goto unlock; }
Greg Kroah-Hartman
maintainerPATCH 83/191 mm/memory_hotplug: shrink zones when offlining memory
In reply to Greg Kroah-HartmanFrom: David Hildenbrand <[email protected]>
commit feee6b2989165631b17ac6d4ccdbf6759254e85a upstream.
We currently try to shrink a single zone when removing memory. We use the zone of the first page of the memory we are removing. If that memmap was never initialized (e.g., memory was never onlined), we will read garbage and can trigger kernel BUGs (due to a stale pointer):
BUG: unable to handle page fault for address: 000000000000353d
#PF: supervisor write access in kernel mode
#PF: error_code(0x0002) - not-present page
PGD 0 P4D 0
Oops: 0002 [#1] SMP PTI
CPU: 1 PID: 7 Comm: kworker/u8:0 Not tainted 5.3.0-rc5-next-20190820+ #317
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.4
Workqueue: kacpi_hotplug acpi_hotplug_work_fn
RIP: 0010:clear_zone_contiguous+0x5/0x10
Code: 48 89 c6 48 89 c3 e8 2a fe ff ff 48 85 c0 75 cf 5b 5d c3 c6 85 fd 05 00 00 01 5b 5d c3 0f 1f 840
RSP: 0018:ffffad2400043c98 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 0000000200000000 RCX: 0000000000000000
RDX: 0000000000200000 RSI: 0000000000140000 RDI: 0000000000002f40
RBP: 0000000140000000 R08: 0000000000000000 R09: 0000000000000001
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000140000
R13: 0000000000140000 R14: 0000000000002f40 R15: ffff9e3e7aff3680
FS: 0000000000000000(0000) GS:ffff9e3e7bb00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000000000353d CR3: 0000000058610000 CR4: 00000000000006e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
__remove_pages+0x4b/0x640
arch_remove_memory+0x63/0x8d
try_remove_memory+0xdb/0x130
__remove_memory+0xa/0x11
acpi_memory_device_remove+0x70/0x100
acpi_bus_trim+0x55/0x90
acpi_device_hotplug+0x227/0x3a0
acpi_hotplug_work_fn+0x1a/0x30
process_one_work+0x221/0x550
worker_thread+0x50/0x3b0
kthread+0x105/0x140
ret_from_fork+0x3a/0x50
Modules linked in:
CR2: 000000000000353dInstead, shrink the zones when offlining memory or when onlining failed. Introduce and use remove_pfn_range_from_zone(() for that. We now properly shrink the zones, even if we have DIMMs whereby
- Some memory blocks fall into no zone (never onlined)
- Some memory blocks fall into multiple zones (offlined+re-onlined)
- Multiple memory blocks that fall into different zones
Drop the zone parameter (with a potential dubious value) from __remove_pages() and __remove_section().
--- arch/arm64/mm/mmu.c | 4 +--- arch/ia64/mm/init.c | 4 +--- arch/powerpc/mm/mem.c | 3 +-- arch/s390/mm/init.c | 4 +--- arch/sh/mm/init.c | 4 +--- arch/x86/mm/init_32.c | 4 +--- arch/x86/mm/init_64.c | 4 +--- include/linux/memory_hotplug.h | 7 +++++-- mm/memory_hotplug.c | 31 ++++++++++++++++--------------- mm/memremap.c | 2 +- 10 files changed, 29 insertions(+), 38 deletions(-)
arch/arm64/mm/mmu.c +1 -3
@@ -1069,7 +1069,6 @@ void arch_remove_memory(int nid, u64 sta {unsigned long start_pfn = start >>PAGE_SHIFT ;unsigned long nr_pages = size >>PAGE_SHIFT ; -struct zone *zone;/* * FIXME: Cleanup page tables (also in arch_add_memory() in case
@@ -1078,7 +1077,6 @@ void arch_remove_memory(int nid, u64 sta* unplug. ARCH_ENABLE_MEMORY_HOTREMOVE must not be * unlocked yet. */ - zone =page_zone (pfn_to_page (start_pfn)); - __remove_pages(zone, start_pfn, nr_pages, altmap); + __remove_pages(start_pfn, nr_pages, altmap); }#endif
arch/ia64/mm/init.c +1 -3
@@ -689,9 +689,7 @@ void arch_remove_memory(int nid, u64 sta {unsigned long start_pfn = start >>PAGE_SHIFT ;unsigned long nr_pages = size >>PAGE_SHIFT ; -struct zone *zone; - zone =page_zone (pfn_to_page (start_pfn)); -__remove_pages (zone, start_pfn, nr_pages, altmap); +__remove_pages (start_pfn, nr_pages, altmap); }#endif
arch/powerpc/mm/mem.c +1 -2
@@ -130,10 +130,9 @@ void __ref arch_remove_memory(int nid, u {unsigned long start_pfn = start >>PAGE_SHIFT ;unsigned long nr_pages = size >>PAGE_SHIFT ; -struct page *page =pfn_to_page (start_pfn) +vmem_altmap_offset (altmap);int ret; -__remove_pages (page_zone (page), start_pfn, nr_pages, altmap); +__remove_pages (start_pfn, nr_pages, altmap);/* Remove htab bolted mappings for this section of memory */ start = (unsigned long )__va (start);
arch/s390/mm/init.c +1 -3
@@ -291,10 +291,8 @@ void arch_remove_memory(int nid, u64 sta {unsigned long start_pfn = start >>PAGE_SHIFT ;unsigned long nr_pages = size >>PAGE_SHIFT ; -struct zone *zone; - zone =page_zone (pfn_to_page (start_pfn)); -__remove_pages (zone, start_pfn, nr_pages, altmap); +__remove_pages (start_pfn, nr_pages, altmap);vmem_remove_mapping (start, size); }#endif /* CONFIG_MEMORY_HOTPLUG */
arch/sh/mm/init.c +1 -3
@@ -434,9 +434,7 @@ void arch_remove_memory(int nid, u64 sta {unsigned long start_pfn =PFN_DOWN (start);unsigned long nr_pages = size >>PAGE_SHIFT ; -struct zone *zone; - zone =page_zone (pfn_to_page (start_pfn)); -__remove_pages (zone, start_pfn, nr_pages, altmap); +__remove_pages (start_pfn, nr_pages, altmap); }#endif /* CONFIG_MEMORY_HOTPLUG */
arch/x86/mm/init_32.c +1 -3
@@ -865,10 +865,8 @@ void arch_remove_memory(int nid, u64 sta {unsigned long start_pfn = start >>PAGE_SHIFT ;unsigned long nr_pages = size >>PAGE_SHIFT ; -struct zone *zone; - zone =page_zone (pfn_to_page (start_pfn)); -__remove_pages (zone, start_pfn, nr_pages, altmap); +__remove_pages (start_pfn, nr_pages, altmap); }#endif
arch/x86/mm/init_64.c +1 -3
@@ -1212,10 +1212,8 @@ void __ref arch_remove_memory(int nid, u {unsigned long start_pfn = start >>PAGE_SHIFT ;unsigned long nr_pages = size >>PAGE_SHIFT ; -struct page *page =pfn_to_page (start_pfn) +vmem_altmap_offset (altmap); -struct zone *zone =page_zone (page); -__remove_pages (zone, start_pfn, nr_pages, altmap); +__remove_pages (start_pfn, nr_pages, altmap);kernel_physical_mapping_remove (start, start + size); }#endif /* CONFIG_MEMORY_HOTPLUG */
include/linux/memory_hotplug.h +5 -2
@@ -125,8 +125,8 @@ static inline bool movable_node_is_enablextern void arch_remove_memory (int nid,u64 start,u64 size,struct vmem_altmap *altmap); -extern void __remove_pages (struct zone *zone,unsigned long start_pfn, -unsigned long nr_pages,struct vmem_altmap *altmap); +extern void __remove_pages (unsigned long start_pfn,unsigned long nr_pages, +struct vmem_altmap *altmap);/* reasonably generic interface to expand the physical pages */ extern int __add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages,
@@ -345,6 +345,9 @@ extern int add_memory(int nid, u64 startextern int add_memory_resource (int nid,struct resource *resource);extern void move_pfn_range_to_zone (struct zone *zone,unsigned long start_pfn,unsigned long nr_pages,struct vmem_altmap *altmap); +extern void remove_pfn_range_from_zone (struct zone *zone, +unsigned long start_pfn, +unsigned long nr_pages);extern bool is_memblock_offlined (struct memory_block *mem);extern int sparse_add_section (int nid,unsigned long pfn,unsigned long nr_pages,struct vmem_altmap *altmap);
mm/memory_hotplug.c +16 -15
@@ -465,8 +465,9 @@ static void update_pgdat_span(struct pgl pgdat->node_spanned_pages = node_end_pfn - node_start_pfn; } -static void __remove_zone (struct zone *zone,unsigned long start_pfn, -unsigned long nr_pages) +void __ref remove_pfn_range_from_zone (struct zone *zone, +unsigned long start_pfn, +unsigned long nr_pages) {struct pglist_data *pgdat = zone->zone_pgdat;unsigned long flags;
@@ -481,28 +482,30 @@ static void __remove_zone(struct zone *zreturn ;#endif +clear_zone_contiguous (zone); +pgdat_resize_lock (zone->zone_pgdat, &flags);shrink_zone_span (zone, start_pfn, start_pfn + nr_pages);update_pgdat_span (pgdat);pgdat_resize_unlock (zone->zone_pgdat, &flags); + +set_zone_contiguous (zone); } -static void __remove_section (struct zone *zone,unsigned long pfn, -unsigned long nr_pages,unsigned long map_offset, -struct vmem_altmap *altmap) +static void __remove_section (unsigned long pfn,unsigned long nr_pages, +unsigned long map_offset, +struct vmem_altmap *altmap) {struct mem_section *ms =__nr_to_section (pfn_to_section_nr (pfn));if (WARN_ON_ONCE (!valid_section (ms)))return ; -__remove_zone (zone, pfn, nr_pages);sparse_remove_section (ms, pfn, nr_pages, map_offset, altmap); }/** -* __remove_pages() - remove sections of pages from a zone -* @zone: zone from which pages need to be removed +* __remove_pages() - remove sections of pages * @pfn: starting pageframe (must be aligned to start of a section) * @nr_pages: number of pages to remove (must be multiple of section size) * @altmap: alternative device page map or %NULL if default memmap is used
@@ -512,16 +515,14 @@ static void __remove_section(struct zone* sure that pages are marked reserved and zones are adjust properly by * calling offline_pages(). */ -void __remove_pages (struct zone *zone,unsigned long pfn, -unsigned long nr_pages,struct vmem_altmap *altmap) +void __remove_pages (unsigned long pfn,unsigned long nr_pages, +struct vmem_altmap *altmap) {unsigned long map_offset =0 ;unsigned long nr, start_sec, end_sec; map_offset =vmem_altmap_offset (altmap); -clear_zone_contiguous (zone); -if (check_pfn_span (pfn, nr_pages,"remove" ))return ;
@@ -533,13 +534,11 @@ void __remove_pages(struct zone *zone, ucond_resched (); pfns =min (nr_pages,PAGES_PER_SECTION - (pfn & ~PAGE_SECTION_MASK )); -__remove_section (zone, pfn, pfns, map_offset, altmap); +__remove_section (pfn, pfns, map_offset, altmap); pfn += pfns; nr_pages -= pfns; map_offset =0 ; } - -set_zone_contiguous (zone); }int set_online_page_callback (online_page_callback_t callback)
@@ -867,6 +866,7 @@ failed_addition: (unsigned long long ) pfn <<PAGE_SHIFT , (((unsigned long long) pfn + nr_pages) << PAGE_SHIFT) - 1);memory_notify (MEM_CANCEL_ONLINE , &arg); +remove_pfn_range_from_zone (zone, pfn, nr_pages);mem_hotplug_done ();return ret; }
@@ -1602,6 +1602,7 @@ static int __ref __offline_pages(unsignewriteback_set_ratelimit ();memory_notify (MEM_OFFLINE , &arg); +remove_pfn_range_from_zone (zone, start_pfn, nr_pages);mem_hotplug_done ();return 0 ;
mm/memremap.c +1 -1
@@ -120,7 +120,7 @@ void memunmap_pages(struct dev_pagemap *mem_hotplug_begin ();if (pgmap->type ==MEMORY_DEVICE_PRIVATE ) { -__remove_pages (page_zone (first_page),PHYS_PFN (res->start), +__remove_pages (PHYS_PFN (res->start),PHYS_PFN (resource_size (res)),NULL ); }else { arch_remove_memory(nid, res->start, resource_size(res),
Greg Kroah-Hartman
maintainerPATCH 84/191 mm/zsmalloc.c: fix the migrated zspage statistics.
In reply to Greg Kroah-HartmanFrom: Chanho Min <[email protected]>
commit ac8f05da5174c560de122c499ce5dfb5d0dfbee5 upstream.
When zspage is migrated to the other zone, the zone page state should be updated as well, otherwise the NR_ZSPAGE for each zone shows wrong counts including proc/zoneinfo in practice.
--- mm/zsmalloc.c | 5 +++++ 1 file changed, 5 insertions(+)
mm/zsmalloc.c +5 -0
@@ -2069,6 +2069,11 @@ static int zs_page_migrate(struct addreszs_pool_dec_isolated (pool); } +if (page_zone (newpage) !=page_zone (page)) { +dec_zone_page_state (page,NR_ZSPAGES ); +inc_zone_page_state (newpage,NR_ZSPAGES ); + } +reset_page (page);put_page (page); page = newpage;
Greg Kroah-Hartman
maintainerPATCH 85/191 memcg: account security cred as well to kmemcg
In reply to Greg Kroah-HartmanFrom: Shakeel Butt <[email protected]>
commit 84029fd04c201a4c7e0b07ba262664900f47c6f5 upstream.
The cred_jar kmem_cache is already memcg accounted in the current kernel but cred->security is not. Account cred->security to kmemcg.
Recently we saw high root slab usage on our production and on further inspection, we found a buggy application leaking processes. Though that buggy application was contained within its memcg but we observe much more system memory overhead, couple of GiBs, during that period. This overhead can adversely impact the isolation on the system.
One source of high overhead we found was cred->security objects, which have a lifetime of at least the life of the process which allocated them.
--- kernel/cred.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/cred.c +3 -3
@@ -223,7 +223,7 @@ struct cred *cred_alloc_blank(void) new->magic =CRED_MAGIC ;#endif -if (security_cred_alloc_blank (new,GFP_KERNEL ) <0 ) +if (security_cred_alloc_blank (new,GFP_KERNEL_ACCOUNT ) <0 ) goto error;return new;
@@ -282,7 +282,7 @@ struct cred *prepare_creds(void) new->security =NULL ;#endif -if (security_prepare_creds (new, old,GFP_KERNEL ) <0 ) +if (security_prepare_creds (new, old,GFP_KERNEL_ACCOUNT ) <0 ) goto error;validate_creds (new);return new;
@@ -715,7 +715,7 @@ struct cred *prepare_kernel_cred(struct#ifdef CONFIG_SECURITY new->security =NULL ;#endif -if (security_prepare_creds (new, old,GFP_KERNEL ) <0 ) +if (security_prepare_creds (new, old,GFP_KERNEL_ACCOUNT ) <0 ) goto error;put_cred (old);
Greg Kroah-Hartman
maintainerPATCH 86/191 mm: move_pages: return valid node id in status if the page is already on the target node
In reply to Greg Kroah-HartmanFrom: Yang Shi <[email protected]>
commit e0153fc2c7606f101392b682e720a7a456d6c766 upstream.
Felix Abecassis reports move_pages() would return random status if the pages are already on the target node by the below test program:
int main(void)
{
const long node_id = 1;
const long page_size = sysconf(_SC_PAGESIZE);
const int64_t num_pages = 8;
unsigned long nodemask = 1 << node_id;
long ret = set_mempolicy(MPOL_BIND, &nodemask, sizeof(nodemask));
if (ret < 0)
return (EXIT_FAILURE);
void **pages = malloc(sizeof(void*) * num_pages);
for (int i = 0; i < num_pages; ++i) {
pages[i] = mmap(NULL, page_size, PROT_WRITE | PROT_READ,
MAP_PRIVATE | MAP_POPULATE | MAP_ANONYMOUS,
-1, 0);
if (pages[i] == MAP_FAILED)
return (EXIT_FAILURE);
}
ret = set_mempolicy(MPOL_DEFAULT, NULL, 0);
if (ret < 0)
return (EXIT_FAILURE);
int *nodes = malloc(sizeof(int) * num_pages);
int *status = malloc(sizeof(int) * num_pages);
for (int i = 0; i < num_pages; ++i) {
nodes[i] = node_id;
status[i] = 0xd0; /* simulate garbage values */
}
ret = move_pages(0, num_pages, pages, nodes, status, MPOL_MF_MOVE);
printf("move_pages: %ld\n", ret);
for (int i = 0; i < num_pages; ++i)
printf("status[%d] = %d\n", i, status[i]);}
Then running the program would return nonsense status values:
$ ./move_pages_bug move_pages: 0 status[0] = 208 status[1] = 208 status[2] = 208 status[3] = 208 status[4] = 208 status[5] = 208 status[6] = 208 status[7] = 208
This is because the status is not set if the page is already on the target node, but move_pages() should return valid status as long as it succeeds. The valid status may be errno or node id.
We can't simply initialize status array to zero since the pages may be not on node 0. Fix it by updating status with node id which the page is already on.
--- mm/migrate.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
mm/migrate.c +17 -6
@@ -1516,9 +1516,11 @@ static int do_move_pages_to_node(struct/* * Resolves the given address to a struct page, isolates it from the LRU and * puts it to the given pagelist. -* Returns -errno if the page cannot be found/isolated or 0 when it has been -* queued or the page doesn't need to be migrated because it is already on -* the target node +* Returns: +* errno - if the page cannot be found/isolated +* 0 - when it doesn't have to be migrated because it is already on the +* target node +* 1 - when it has been queued */ static int add_page_for_migration (struct mm_struct *mm,unsigned long addr,int node,struct list_head *pagelist,bool migrate_all)
@@ -1557,7 +1559,7 @@ static int add_page_for_migration(structif (PageHuge (page)) {if (PageHead (page)) {isolate_huge_page (page, pagelist); - err =0 ; + err =1 ; } }else {struct page *head;
@@ -1567,7 +1569,7 @@ static int add_page_for_migration(structif (err) goto out_putpage; - err =0 ; + err =1 ;list_add_tail (&head->lru, pagelist); mod_node_page_state(page_pgdat(head), NR_ISOLATED_ANON + page_is_file_cache(head),
@@ -1644,8 +1646,17 @@ static int do_pages_move(struct mm_struc*/ err =add_page_for_migration (mm, addr, current_node, &pagelist, flags &MPOL_MF_MOVE_ALL ); -if (!err) + +if (!err) { +/* The page is already on the target node */ + err =store_status (status, i, current_node,1 ); +if (err) + goto out_flush;continue ; + }else if (err >0 ) { +/* The page is successfully queued for migration */ +continue ; + } err =store_status (status, i, err,1 );if (err)
Greg Kroah-Hartman
maintainerPATCH 87/191 mm/oom: fix pgtables units mismatch in Killed process message
In reply to Greg Kroah-HartmanFrom: Ilya Dryomov <[email protected]>
commit 941f762bcb276259a78e7931674668874ccbda59 upstream.
pr_err() expects kB, but mm_pgtables_bytes() returns the number of bytes. As everything else is printed in kB, I chose to fix the value rather than the string.
Before:
[ pid ] uid tgid total_vm rss pgtables_bytes swapents oom_score_adj name
...
[ 1878] 1000 1878 217253 151144 1269760 0 0 python
...
Out of memory: Killed process 1878 (python) total-vm:869012kB, anon-rss:604572kB, file-rss:4kB, shmem-rss:0kB, UID:1000 pgtables:1269760kB oom_score_adj:0
After:
[ pid ] uid tgid total_vm rss pgtables_bytes swapents oom_score_adj name
...
[ 1436] 1000 1436 217253 151890 1294336 0 0 python
...
Out of memory: Killed process 1436 (python) total-vm:869012kB, anon-rss:607516kB, file-rss:44kB, shmem-rss:0kB, UID:1000 pgtables:1264kB oom_score_adj:0
--- mm/oom_kill.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/oom_kill.c +1 -1
@@ -890,7 +890,7 @@ static void __oom_kill_process(struct taK (get_mm_counter (mm,MM_FILEPAGES )),K (get_mm_counter (mm,MM_SHMEMPAGES )),from_kuid (&init_user_ns,task_uid (victim)), - mm_pgtables_bytes(mm), victim->signal->oom_score_adj); + mm_pgtables_bytes(mm) >> 10, victim->signal->oom_score_adj);task_unlock (victim);/*
Greg Kroah-Hartman
maintainerPATCH 88/191 ocfs2: fix the crash due to call ocfs2_get_dlm_debug once less
In reply to Greg Kroah-HartmanFrom: Gang He <[email protected]>
commit b73eba2a867e10b9b4477738677341f3307c07bb upstream.
Because ocfs2_get_dlm_debug() function is called once less here, ocfs2 file system will trigger the system crash, usually after ocfs2 file system is unmounted.
This system crash is caused by a generic memory corruption, these crash backtraces are not always the same, for exapmle,
ocfs2: Unmounting device (253,16) on (node 172167785)
general protection fault: 0000 [#1] SMP PTI
CPU: 3 PID: 14107 Comm: fence_legacy Kdump:
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
RIP: 0010:__kmalloc+0xa5/0x2a0
Code: 00 00 4d 8b 07 65 4d 8b
RSP: 0018:ffffaa1fc094bbe8 EFLAGS: 00010286
RAX: 0000000000000000 RBX: d310a8800d7a3faf RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000dc0 RDI: ffff96e68fc036c0
RBP: d310a8800d7a3faf R08: ffff96e6ffdb10a0 R09: 00000000752e7079
R10: 000000000001c513 R11: 0000000004091041 R12: 0000000000000dc0
R13: 0000000000000039 R14: ffff96e68fc036c0 R15: ffff96e68fc036c0
FS: 00007f699dfba540(0000) GS:ffff96e6ffd80000(0000) knlGS:00000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055f3a9d9b768 CR3: 000000002cd1c000 CR4: 00000000000006e0
Call Trace:
ext4_htree_store_dirent+0x35/0x100 [ext4]
htree_dirblock_to_tree+0xea/0x290 [ext4]
ext4_htree_fill_tree+0x1c1/0x2d0 [ext4]
ext4_readdir+0x67c/0x9d0 [ext4]
iterate_dir+0x8d/0x1a0
__x64_sys_getdents+0xab/0x130
do_syscall_64+0x60/0x1f0
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f699d33a9fbThis regression problem was introduced by commit e581595ea29c ("ocfs: no need to check return value of debugfs_create functions").
--- fs/ocfs2/dlmglue.c | 1 + 1 file changed, 1 insertion(+)
fs/ocfs2/dlmglue.c +1 -0
@@ -3282,6 +3282,7 @@ static void ocfs2_dlm_init_debug(structdebugfs_create_u32 ("locking_filter" ,0600 , osb->osb_debug_root, &dlm_debug->d_filter_secs); +ocfs2_get_dlm_debug (dlm_debug); }static void ocfs2_dlm_shutdown_debug (struct ocfs2_super *osb)
Greg Kroah-Hartman
maintainerPATCH 89/191 pstore/ram: Write new dumps to start of recycled zones
In reply to Greg Kroah-HartmanFrom: Aleksandr Yashkin <[email protected]>
commit 9e5f1c19800b808a37fb9815a26d382132c26c3d upstream.
The ram_core.c routines treat przs as circular buffers. When writing a new crash dump, the old buffer needs to be cleared so that the new dump doesn't end up in the wrong place (i.e. at the end).
The solution to this problem is to reset the circular buffer state before writing a new Oops dump.
--- fs/pstore/ram.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
fs/pstore/ram.c +11 -0
@@ -407,6 +407,17 @@ static int notrace ramoops_pstore_write( prz = cxt->dprzs[cxt->dump_write_cnt]; +/* +* Since this is a new crash dump, we need to reset the buffer in +* case it still has an old dump present. Without this, the new dump +* will get appended, which would seriously confuse anything trying +* to check dump file contents. Specifically, ramoops_read_kmsg_hdr() +* expects to find a dump header in the beginning of buffer data, so +* we must to reset the buffer values, in order to ensure that the +* header will be written to the beginning of the buffer. +*/ +persistent_ram_zap (prz); +/* Build header and append record contents. */ hlen =ramoops_write_kmsg_hdr (prz, record);if (!hlen)
Greg Kroah-Hartman
maintainerPATCH 90/191 pstore/ram: Fix error-path memory leak in persistent_ram_new() callers
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
commit 8df955a32a73315055e0cd187cbb1cea5820394b upstream.
For callers that allocated a label for persistent_ram_new(), if the call fails, they must clean up the allocation.
--- fs/pstore/ram.c | 2 ++ 1 file changed, 2 insertions(+)
fs/pstore/ram.c +2 -0
@@ -588,6 +588,7 @@ static int ramoops_init_przs(const chardev_err (dev,"failed to request %s mem region (0x%zx@0x%llx): %d\n" , name, record_size, (unsigned long long )*paddr, err); +kfree (label);while (i >0 ) { i--;
@@ -633,6 +634,7 @@ static int ramoops_init_prz(const char *dev_err (dev,"failed to request %s mem region (0x%zx@0x%llx): %d\n" , name, sz, (unsigned long long )*paddr, err); +kfree (label);return err; }
Greg Kroah-Hartman
maintainerPATCH 91/191 gcc-plugins: make it possible to disable CONFIG_GCC_PLUGINS again
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit a5b0dc5a46c221725c43bd9b01570239a4cd78b1 upstream.
I noticed that randconfig builds with gcc no longer produce a lot of ccache hits, unlike with clang, and traced this back to plugins now being enabled unconditionally if they are supported.
I am now working around this by adding
export CCACHE_COMPILERCHECK=/usr/bin/size -A %compiler%
to my top-level Makefile. This changes the heuristic that ccache uses to determine whether the plugins are the same after a 'make clean'.
However, it also seems that being able to just turn off the plugins is generally useful, at least for build testing it adds noticeable overhead but does not find a lot of bugs additional bugs, and may be easier for ccache users than my workaround.
--- scripts/gcc-plugins/Kconfig | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
scripts/gcc-plugins/Kconfig +4 -5
@@ -14,8 +14,8 @@ config HAVE_GCC_PLUGINS An arch should select this symbol if it supports building with GCC plugins. -config GCC_PLUGINS - bool +menuconfig GCC_PLUGINS + bool "GCC plugins" depends on HAVE_GCC_PLUGINS depends on PLUGIN_HOSTCC != "" default y
@@ -25,8 +25,7 @@ config GCC_PLUGINS See Documentation/core-api/gcc-plugins.rst for details. -menu "GCC plugins" - depends on GCC_PLUGINS +if GCC_PLUGINS config GCC_PLUGIN_CYC_COMPLEXITY bool "Compute the cyclomatic complexity of a function" if EXPERT
@@ -113,4 +112,4 @@ config GCC_PLUGIN_ARM_SSP_PER_TASK bool depends on GCC_PLUGINS && ARM -endmenu +endif
Greg Kroah-Hartman
maintainerPATCH 92/191 locks: print unsigned ino in /proc/locks
In reply to Greg Kroah-HartmanFrom: Amir Goldstein <[email protected]>
commit 98ca480a8f22fdbd768e3dad07024c8d4856576c upstream.
An ino is unsigned, so display it as such in /proc/locks.
--- fs/locks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/locks.c +1 -1
@@ -2853,7 +2853,7 @@ static void lock_get_status(struct seq_f }if (inode) {/* userspace relies on this representation of dev_t */ -seq_printf (f,"%d %02x:%02x:%ld " , fl_pid, +seq_printf (f,"%d %02x:%02x:%lu " , fl_pid,MAJOR (inode->i_sb->s_dev),MINOR (inode->i_sb->s_dev), inode->i_ino); }else {
Greg Kroah-Hartman
maintainerPATCH 93/191 selftests/seccomp: Zero out seccomp_notif
In reply to Greg Kroah-HartmanFrom: Sargun Dhillon <[email protected]>
commit 88c13f8bd71472fbab5338b01d99122908c77e53 upstream.
The seccomp_notif structure should be zeroed out prior to calling the SECCOMP_IOCTL_NOTIF_RECV ioctl. Previously, the kernel did not check whether these structures were zeroed out or not, so these worked.
This patch zeroes out the seccomp_notif data structure prior to calling the ioctl.
--- tools/testing/selftests/seccomp/seccomp_bpf.c | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/seccomp/seccomp_bpf.c +2 -0
@@ -3267,6 +3267,7 @@ TEST(user_notification_signal)close (sk_pair[1 ]); +memset (&req,0 ,sizeof (req));EXPECT_EQ (ioctl (listener,SECCOMP_IOCTL_NOTIF_RECV , &req),0 );EXPECT_EQ (kill (pid,SIGUSR1 ),0 );
@@ -3285,6 +3286,7 @@ TEST(user_notification_signal)EXPECT_EQ (ioctl (listener,SECCOMP_IOCTL_NOTIF_SEND , &resp),-1 );EXPECT_EQ (errno,ENOENT ); +memset (&req,0 ,sizeof (req));EXPECT_EQ (ioctl (listener,SECCOMP_IOCTL_NOTIF_RECV , &req),0 ); resp.id = req.id;
Greg Kroah-Hartman
maintainerPATCH 94/191 seccomp: Check that seccomp_notif is zeroed out by the user
In reply to Greg Kroah-HartmanFrom: Sargun Dhillon <[email protected]>
commit 2882d53c9c6f3b8311d225062522f03772cf0179 upstream.
This patch is a small change in enforcement of the uapi for SECCOMP_IOCTL_NOTIF_RECV ioctl. Specifically, the datastructure which is passed (seccomp_notif) must be zeroed out. Previously any of its members could be set to nonsense values, and we would ignore it.
This ensures all fields are set to their zero value.
--- kernel/seccomp.c | 7 +++++++ 1 file changed, 7 insertions(+)
kernel/seccomp.c +7 -0
@@ -1015,6 +1015,13 @@ static long seccomp_notify_recv(struct sstruct seccomp_notif unotif;ssize_t ret; +/* Verify that we're not given garbage to keep struct extensible. */ + ret =check_zeroed_user (buf,sizeof (unotif)); +if (ret <0 ) +return ret; +if (!ret) +return -EINVAL ; +memset (&unotif,0 ,sizeof (unotif)); ret =down_interruptible (&filter->notif->request);
Greg Kroah-Hartman
maintainerPATCH 95/191 samples/seccomp: Zero out members based on seccomp_notif_sizes
In reply to Greg Kroah-HartmanFrom: Sargun Dhillon <[email protected]>
commit 771b894f2f3dfedc2ba5561731fffa0e39b1bbb6 upstream.
The sizes by which seccomp_notif and seccomp_notif_resp are allocated are based on the SECCOMP_GET_NOTIF_SIZES ioctl. This allows for graceful extension of these datastructures. If userspace zeroes out the datastructure based on its version, and it is lagging behind the kernel's version, it will end up sending trailing garbage. On the other hand, if it is ahead of the kernel version, it will write extra zero space, and potentially cause corruption.
--- samples/seccomp/user-trap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
samples/seccomp/user-trap.c +2 -2
@@ -298,14 +298,14 @@ int main(void) req =malloc (sizes.seccomp_notif);if (!req) goto out_close; -memset (req,0 ,sizeof (*req)); resp =malloc (sizes.seccomp_notif_resp);if (!resp) goto out_req; -memset (resp,0 ,sizeof (*resp)); +memset (resp,0 , sizes.seccomp_notif_resp);while (1 ) { +memset (req,0 , sizes.seccomp_notif);if (ioctl (listener,SECCOMP_IOCTL_NOTIF_RECV , req)) {perror ("ioctl recv" ); goto out_resp;
Greg Kroah-Hartman
maintainerPATCH 96/191 selftests/seccomp: Catch garbage on SECCOMP_IOCTL_NOTIF_RECV
In reply to Greg Kroah-HartmanFrom: Sargun Dhillon <[email protected]>
commit e4ab5ccc357b978999328fadae164e098c26fa40 upstream.
This adds logic to the user_notification_basic test to set a member of struct seccomp_notif to an invalid value to ensure that the kernel returns EINVAL if any of the struct seccomp_notif members are set to invalid values.
--- tools/testing/selftests/seccomp/seccomp_bpf.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
tools/testing/selftests/seccomp/seccomp_bpf.c +12 -1
@@ -3147,7 +3147,18 @@ TEST(user_notification_basic)EXPECT_GT (poll (&pollfd,1 ,-1 ),0 );EXPECT_EQ (pollfd.revents,POLLIN ); -EXPECT_EQ (ioctl (listener,SECCOMP_IOCTL_NOTIF_RECV , &req),0 ); +/* Test that we can't pass garbage to the kernel. */ +memset (&req,0 ,sizeof (req)); + req.pid =-1 ; + errno =0 ; + ret =ioctl (listener,SECCOMP_IOCTL_NOTIF_RECV , &req); +EXPECT_EQ (-1 , ret); +EXPECT_EQ (EINVAL , errno); + +if (ret) { + req.pid =0 ; +EXPECT_EQ (ioctl (listener,SECCOMP_IOCTL_NOTIF_RECV , &req),0 ); + } pollfd.fd = listener; pollfd.events =POLLIN |POLLOUT ;
Greg Kroah-Hartman
maintainerPATCH 97/191 dmaengine: Fix access to uninitialized dma_slave_caps
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
commit 53a256a9b925b47c7e67fc1f16ca41561a7b877c upstream.
dmaengine_desc_set_reuse() allocates a struct dma_slave_caps on the stack, populates it using dma_get_slave_caps() and then accesses one of its members.
However dma_get_slave_caps() may fail and this isn't accounted for, leading to a legitimate warning of gcc-4.9 (but not newer versions):
In file included from drivers/spi/spi-bcm2835.c:19:0:
drivers/spi/spi-bcm2835.c: In function 'dmaengine_desc_set_reuse':
Quoted 1 line
Quoted 1 line
include/linux/dmaengine.h:1370:10: warning: 'caps.descriptor_reuse' is used uninitialized in this function [-Wuninitialized]
if (caps.descriptor_reuse) {Fix it, thereby also silencing the gcc-4.9 warning.
The issue has been present for 4 years but surfaces only now that the first caller of dmaengine_desc_set_reuse() has been added in spi-bcm2835.c. Another user of reusable DMA descriptors has existed for a while in pxa_camera.c, but it sets the DMA_CTRL_REUSE flag directly instead of calling dmaengine_desc_set_reuse(). Nevertheless, tag this commit for stable in case there are out-of-tree users.
--- include/linux/dmaengine.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/linux/dmaengine.h +4 -1
@@ -1364,8 +1364,11 @@ static inline int dma_get_slave_caps(strstatic inline int dmaengine_desc_set_reuse (struct dma_async_tx_descriptor *tx) {struct dma_slave_caps caps; +int ret; -dma_get_slave_caps (tx->chan, &caps); + ret =dma_get_slave_caps (tx->chan, &caps); +if (ret) +return ret;if (caps.descriptor_reuse) { tx->flags |=DMA_CTRL_REUSE ;
Greg Kroah-Hartman
maintainerPATCH 98/191 dmaengine: dma-jz4780: Also break descriptor chains on JZ4725B
In reply to Greg Kroah-HartmanFrom: Paul Cercueil <[email protected]>
commit a40c94be2336f3002563c9ae16572143ae3422e2 upstream.
It turns out that the JZ4725B displays the same buggy behaviour as the JZ4740 that was described in commit f4c255f1a747 ("dmaengine: dma-jz4780:
Break descriptor chains on JZ4740").
Work around it by using the same workaround previously used for the JZ4740.
Fixes commit f4c255f1a747 ("dmaengine: dma-jz4780: Break descriptor chains on JZ4740")
--- drivers/dma/dma-jz4780.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/dma/dma-jz4780.c +2 -1
@@ -1004,7 +1004,8 @@ static const struct jz4780_dma_soc_datastatic const struct jz4780_dma_soc_data jz4725b_dma_soc_data = { .nb_channels =6 , .transfer_ord_max =5 , - .flags =JZ_SOC_DATA_PER_CHAN_PM |JZ_SOC_DATA_NO_DCKES_DCKEC , + .flags =JZ_SOC_DATA_PER_CHAN_PM |JZ_SOC_DATA_NO_DCKES_DCKEC | +JZ_SOC_DATA_BREAK_LINKS , };static const struct jz4780_dma_soc_data jz4770_dma_soc_data = {
Greg Kroah-Hartman
maintainerPATCH 99/191 Btrfs: fix infinite loop during nocow writeback due to race
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit de7999afedff02c6631feab3ea726a0e8f8c3d40 upstream.
When starting writeback for a range that covers part of a preallocated extent, due to a race with writeback for another range that also covers another part of the same preallocated extent, we can end up in an infinite loop.
Consider the following example where for inode 280 we have two dirty ranges:
range A, from 294912 to 303103, 8192 bytes
range B, from 348160 to 438271, 90112 bytes
and we have the following file extent item layout for our inode:
leaf 38895616 gen 24544 total ptrs 29 free space 13820 owner 5
(...)
item 27 key (280 108 200704) itemoff 14598 itemsize 53
extent data disk bytenr 0 nr 0 type 1 (regular)
extent data offset 0 nr 94208 ram 94208
item 28 key (280 108 294912) itemoff 14545 itemsize 53
extent data disk bytenr 10433052672 nr 81920 type 2 (prealloc)
extent data offset 0 nr 81920 ram 81920Then the following happens:
1) Writeback starts for range B (from 348160 to 438271), execution of run_delalloc_nocow() starts;
2) The first iteration of run_delalloc_nocow()'s whil loop leaves us at the extent item at slot 28, pointing to the prealloc extent item covering the range from 294912 to 376831. This extent covers part of our range;
3) An ordered extent is created against that extent, covering the file range from 348160 to 376831 (28672 bytes);
4) We adjust 'cur_offset' to 376832 and move on to the next iteration of the while loop;
5) The call to btrfs_lookup_file_extent() leaves us at the same leaf, pointing to slot 29, 1 slot after the last item (the extent item we processed in the previous iteration);
6) Because we are a slot beyond the last item, we call btrfs_next_leaf(), which releases the search path before doing a another search for the last key of the leaf (280 108 294912);
7) Right after btrfs_next_leaf() released the path, and before it did another search for the last key of the leaf, writeback for the range A (from 294912 to 303103) completes (it was previously started at some point);
8) Upon completion of the ordered extent for range A, the prealloc extent we previously found got split into two extent items, one covering the range from 294912 to 303103 (8192 bytes), with a type of regular extent (and no longer prealloc) and another covering the range from 303104 to 376831 (73728 bytes), with a type of prealloc and an offset of 8192 bytes. So our leaf now has the following layout:
leaf 38895616 gen 24544 total ptrs 31 free space 13664 owner 5
(...)
item 27 key (280 108 200704) itemoff 14598 itemsize 53
extent data disk bytenr 0 nr 0 type 1
extent data offset 0 nr 8192 ram 94208
item 28 key (280 108 208896) itemoff 14545 itemsize 53
extent data disk bytenr 10433142784 nr 86016 type 1
extent data offset 0 nr 86016 ram 86016
item 29 key (280 108 294912) itemoff 14492 itemsize 53
extent data disk bytenr 10433052672 nr 81920 type 1
extent data offset 0 nr 8192 ram 81920
item 30 key (280 108 303104) itemoff 14439 itemsize 53
extent data disk bytenr 10433052672 nr 81920 type 2
extent data offset 8192 nr 73728 ram 819209) After btrfs_next_leaf() returns, we have our path pointing to that same leaf and at slot 30, since it has a key we didn't have before and it's the first key greater then the key that was previously the last key of the leaf (key (280 108 294912));
10) The extent item at slot 30 covers the range from 303104 to 376831 which is in our target range, so we process it, despite having already created an ordered extent against this extent for the file range from 348160 to 376831. This is because we skip to the next extent item only if its end is less than or equals to the start of our delalloc range, and not less than or equals to the current offset ('cur_offset');
11) As a result we compute 'num_bytes' as:
num_bytes = min(end + 1, extent_end) - cur_offset;
= min(438271 + 1, 376832) - 376832 = 012) We then call create_io_em() for a 0 bytes range starting at offset
376832;
13) Then create_io_em() enters an infinite loop because its calls to
btrfs_drop_extent_cache() do nothing due to the 0 length range
passed to it. So no existing extent maps that cover the offset
376832 get removed, and therefore calls to add_extent_mapping()
return -EEXIST, resulting in an infinite loop. This loop from
create_io_em() is the following:
do {
btrfs_drop_extent_cache(BTRFS_I(inode), em->start,
em->start + em->len - 1, 0);
write_lock(&em_tree->lock);
ret = add_extent_mapping(em_tree, em, 1);
write_unlock(&em_tree->lock);
/*
* The caller has taken lock_extent(), who could race with us
* to add em?
*/
} while (ret == -EEXIST);Also, each call to btrfs_drop_extent_cache() triggers a warning because the start offset passed to it (376832) is smaller then the end offset (376832 - 1) passed to it by -1, due to the 0 length:
[258532.052621] ------------[ cut here ]------------ [258532.052643] WARNING: CPU: 0 PID: 9987 at fs/btrfs/file.c:602 btrfs_drop_extent_cache+0x3f4/0x590 [btrfs] (...) [258532.052672] CPU: 0 PID: 9987 Comm: fsx Tainted: G W 5.4.0-rc7-btrfs-next-64 #1 [258532.052673] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-0-ga698c8995f-prebuilt.qemu.org 04/01/2014 [258532.052691] RIP: 0010:btrfs_drop_extent_cache+0x3f4/0x590 [btrfs] (...) [258532.052695] RSP: 0018:ffffb4be0153f860 EFLAGS: 00010287 [258532.052700] RAX: ffff975b445ee360 RBX: ffff975b44eb3e08 RCX: 0000000000000000 [258532.052700] RDX: 0000000000038fff RSI: 0000000000039000 RDI: ffff975b445ee308 [258532.052700] RBP: 0000000000038fff R08: 0000000000000000 R09: 0000000000000001 [258532.052701] R10: ffff975b513c5c10 R11: 00000000e3c0cfa9 R12: 0000000000039000 [258532.052703] R13: ffff975b445ee360 R14: 00000000ffffffef R15: ffff975b445ee308 [258532.052705] FS: 00007f86a821de80(0000) GS:ffff975b76a00000(0000) knlGS:0000000000000000 [258532.052707] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [258532.052708] CR2: 00007fdacf0f3ab4 CR3: 00000001f9d26002 CR4: 00000000003606f0 [258532.052712] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [258532.052717] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [258532.052717] Call Trace: [258532.052718] ? preempt_schedule_common+0x32/0x70 [258532.052722] ? ___preempt_schedule+0x16/0x20 [258532.052741] create_io_em+0xff/0x180 [btrfs] [258532.052767] run_delalloc_nocow+0x942/0xb10 [btrfs] [258532.052791] btrfs_run_delalloc_range+0x30b/0x520 [btrfs] [258532.052812] ? find_lock_delalloc_range+0x221/0x250 [btrfs] [258532.052834] writepage_delalloc+0xe4/0x140 [btrfs] [258532.052855] __extent_writepage+0x110/0x4e0 [btrfs] [258532.052876] extent_write_cache_pages+0x21c/0x480 [btrfs] [258532.052906] extent_writepages+0x52/0xb0 [btrfs] [258532.052911] do_writepages+0x23/0x80 [258532.052915] __filemap_fdatawrite_range+0xd2/0x110 [258532.052938] btrfs_fdatawrite_range+0x1b/0x50 [btrfs] [258532.052954] start_ordered_ops+0x57/0xa0 [btrfs] [258532.052973] ? btrfs_sync_file+0x225/0x490 [btrfs] [258532.052988] btrfs_sync_file+0x225/0x490 [btrfs] [258532.052997] __x64_sys_msync+0x199/0x200 [258532.053004] do_syscall_64+0x5c/0x250 [258532.053007] entry_SYSCALL_64_after_hwframe+0x49/0xbe [258532.053010] RIP: 0033:0x7f86a7dfd760 (...) [258532.053014] RSP: 002b:00007ffd99af0368 EFLAGS: 00000246 ORIG_RAX: 000000000000001a [258532.053016] RAX: ffffffffffffffda RBX: 0000000000000ec9 RCX: 00007f86a7dfd760 [258532.053017] RDX: 0000000000000004 RSI: 000000000000836c RDI: 00007f86a8221000 [258532.053019] RBP: 0000000000021ec9 R08: 0000000000000003 R09: 00007f86a812037c [258532.053020] R10: 0000000000000001 R11: 0000000000000246 R12: 00000000000074a3 [258532.053021] R13: 00007f86a8221000 R14: 000000000000836c R15: 0000000000000001 [258532.053032] irq event stamp: 1653450494 [258532.053035] hardirqs last enabled at (1653450493): [<ffffffff9dec69f9>] _raw_spin_unlock_irq+0x29/0x50 [258532.053037] hardirqs last disabled at (1653450494): [<ffffffff9d4048ea>] trace_hardirqs_off_thunk+0x1a/0x20 [258532.053039] softirqs last enabled at (1653449852): [<ffffffff9e200466>] __do_softirq+0x466/0x6bd [258532.053042] softirqs last disabled at (1653449845): [<ffffffff9d4c8a0c>] irq_exit+0xec/0x120 [258532.053043] ---[ end trace 8476fce13d9ce20a ]---
Which results in flooding dmesg/syslog since btrfs_drop_extent_cache() uses WARN_ON() and not WARN_ON_ONCE().
So fix this issue by changing run_delalloc_nocow()'s loop to move to the next extent item when the current extent item ends at at offset less than or equals to the current offset instead of the start offset.
--- fs/btrfs/inode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/btrfs/inode.c +3 -3
@@ -1439,10 +1439,10 @@ next_slot: disk_num_bytes =btrfs_file_extent_disk_num_bytes (leaf, fi);/* -* If extent we got ends before our range starts, skip -* to next extent +* If the extent we got ends before our current offset, +* skip to the next extent. */ -if (extent_end <= start) { +if (extent_end <= cur_offset) { path->slots[0 ]++; goto next_slot; }
Greg Kroah-Hartman
maintainerPATCH 100/191 block: fix splitting segments on boundary masks
In reply to Greg Kroah-HartmanFrom: Ming Lei <[email protected]>
commit 429120f3df2dba2bf3a4a19f4212a53ecefc7102 upstream.
We ran into a problem with a mpt3sas based controller, where we would see random (and hard to reproduce) file corruption). The issue seemed specific to this controller, but wasn't specific to the file system. After a lot of debugging, we find out that it's caused by segments spanning a 4G memory boundary. This shouldn't happen, as the default setting for segment boundary masks is 4G.
Turns out there are two issues in get_max_segment_size():
1) The default segment boundary mask is bypassed
2) The segment start address isn't taken into account when checking segment boundary limit
Fix these two issues by removing the bypass of the segment boundary check even if the mask is set to the default value, and taking into account the actual start address of the request when checking if a segment needs splitting.
Dropped const on the page pointer, ppc page_to_phys() doesn't mark the page as const...
--- block/blk-merge.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
block/blk-merge.c +9 -9
@@ -157,16 +157,14 @@ static inline unsigned get_max_io_size(sreturn sectors & (lbs -1 ); } -static unsigned get_max_segment_size (const struct request_queue *q, -unsigned offset) +static inline unsigned get_max_segment_size (const struct request_queue *q, +struct page *start_page, +unsigned long offset) {unsigned long mask =queue_segment_boundary (q); -/* default segment boundary mask means no boundary limit */ -if (mask ==BLK_SEG_BOUNDARY_MASK ) -return queue_max_segment_size (q); - - return min_t(unsigned long, mask - (mask & offset) + 1, + offset = mask & (page_to_phys (start_page) + offset); + return min_t(unsigned long, mask - offset + 1,queue_max_segment_size (q)); }
@@ -201,7 +199,8 @@ static bool bvec_split_segs(const structunsigned seg_size =0 ;while (len && *nsegs < max_segs) { - seg_size =get_max_segment_size (q, bv->bv_offset + total_len); + seg_size =get_max_segment_size (q, bv->bv_page, + bv->bv_offset + total_len); seg_size =min (seg_size, len); (*nsegs)++;
@@ -404,7 +403,8 @@ static unsigned blk_bvec_map_sg(struct rwhile (nbytes >0 ) {unsigned offset = bvec->bv_offset + total; -unsigned len =min (get_max_segment_size (q, offset), nbytes); +unsigned len =min (get_max_segment_size (q, bvec->bv_page, + offset), nbytes);struct page *page = bvec->bv_page;/*
Re: [PATCH 5.4 100/191] block: fix splitting segments on boundary masks
Quoted 15 lines · Greg Kroah-Hartman
From: Ming Lei <[email protected]>
commit
429120f3df2dba2bf3a4a19f4212a53ecefc7102upstream.We ran into a problem with a mpt3sas based controller, where we would see random (and hard to reproduce) file corruption). The issue seemed specific to this controller, but wasn't specific to the file system. After a lot of debugging, we find out that it's caused by segments spanning a 4G memory boundary. This shouldn't happen, as the default setting for segment boundary masks is 4G.
Turns out there are two issues in
get_max_segment_size():1) The default segment boundary mask is bypassed
Quoted 7 lines
2) The segment start address isn't taken into account when checking segment boundary limit
Fix these two issues by removing the bypass of the segment boundary check even if the mask is set to the default value, and taking into account the actual start address of the request when checking if a segment needs splitting.
Greg, there's a problem with this one on ARM. Should be resolved shortly, but probably best to defer this one until the next 5.4 stable release.
I'll ping you with both patches once the dust has settled.
Signature · 1 line
Jens Axboe
Greg Kroah-Hartman
maintainerRe: [PATCH 5.4 100/191] block: fix splitting segments on boundary masks
Quoted 24 lines · Jens Axboe
Quoted 15 lines · Greg Kroah-Hartman
From: Ming Lei <[email protected]>
commit
429120f3df2dba2bf3a4a19f4212a53ecefc7102upstream.We ran into a problem with a mpt3sas based controller, where we would see random (and hard to reproduce) file corruption). The issue seemed specific to this controller, but wasn't specific to the file system. After a lot of debugging, we find out that it's caused by segments spanning a 4G memory boundary. This shouldn't happen, as the default setting for segment boundary masks is 4G.
Turns out there are two issues in
get_max_segment_size():1) The default segment boundary mask is bypassed
Quoted 7 lines
2) The segment start address isn't taken into account when checking segment boundary limit
Fix these two issues by removing the bypass of the segment boundary check even if the mask is set to the default value, and taking into account the actual start address of the request when checking if a segment needs splitting.
Quoted 5 lines
Greg, there's a problem with this one on ARM. Should be resolved shortly, but probably best to defer this one until the next 5.4 stable release.
I'll ping you with both patches once the dust has settled.
Thanks for letting me know, I've now dropped this from the queue.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 101/191 compat_ioctl: block: handle Persistent Reservations
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit b2c0fcd28772f99236d261509bcd242135677965 upstream.
These were added to blkdev_ioctl() in linux-5.5 but not blkdev_compat_ioctl, so add them now.
Fold in followup patch from Arnd with missing pr.h header include.
--- block/compat_ioctl.c | 9 +++++++++ 1 file changed, 9 insertions(+)
block/compat_ioctl.c +9 -0
@@ -6,6 +6,7 @@#include <linux/compat.h> #include <linux/elevator.h> #include <linux/hdreg.h> +#include <linux/pr.h> #include <linux/slab.h> #include <linux/syscalls.h> #include <linux/types.h>
@@ -401,6 +402,14 @@ long compat_blkdev_ioctl(struct file *ficase BLKTRACETEARDOWN :/* compatible */ ret =blk_trace_ioctl (bdev, cmd,compat_ptr (arg));return ret; +case IOC_PR_REGISTER : +case IOC_PR_RESERVE : +case IOC_PR_RELEASE : +case IOC_PR_PREEMPT : +case IOC_PR_PREEMPT_ABORT : +case IOC_PR_CLEAR : +return blkdev_ioctl (bdev, mode, cmd, + (unsigned long )compat_ptr (arg));default :if (disk->fops->compat_ioctl) ret = disk->fops->compat_ioctl (bdev, mode, cmd, arg);
Greg Kroah-Hartman
maintainerPATCH 102/191 compat_ioctl: block: handle BLKREPORTZONE/BLKRESETZONE
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit 673bdf8ce0a387ef585c13b69a2676096c6edfe9 upstream.
These were added to blkdev_ioctl() but not blkdev_compat_ioctl, so add them now.
--- block/compat_ioctl.c | 2 ++ 1 file changed, 2 insertions(+)
block/compat_ioctl.c +2 -0
@@ -355,6 +355,8 @@ long compat_blkdev_ioctl(struct file *fi* but we call blkdev_ioctl, which gets the lock for us */ case BLKRRPART : +case BLKREPORTZONE : +case BLKRESETZONE :return blkdev_ioctl (bdev, mode, cmd, (unsigned long )compat_ptr (arg));case BLKBSZSET_32 :
Greg Kroah-Hartman
maintainerPATCH 103/191 compat_ioctl: block: handle BLKGETZONESZ/BLKGETNRZONES
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit 21d37340912d74b1222d43c11aa9dd0687162573 upstream.
These were added to blkdev_ioctl() in v4.20 but not blkdev_compat_ioctl, so add them now.
--- block/compat_ioctl.c | 2 ++ 1 file changed, 2 insertions(+)
block/compat_ioctl.c +2 -0
@@ -357,6 +357,8 @@ long compat_blkdev_ioctl(struct file *ficase BLKRRPART :case BLKREPORTZONE :case BLKRESETZONE : +case BLKGETZONESZ : +case BLKGETNRZONES :return blkdev_ioctl (bdev, mode, cmd, (unsigned long )compat_ptr (arg));case BLKBSZSET_32 :
Greg Kroah-Hartman
maintainerPATCH 104/191 bpf: Fix precision tracking for unbounded scalars
In reply to Greg Kroah-HartmanFrom: Daniel Borkmann <[email protected]>
commit f54c7898ed1c3c9331376c0337a5049c38f66497 upstream.
Anatoly has been fuzzing with kBdysch harness and reported a hang in one of the outcomes. Upon closer analysis, it turns out that precise scalar value tracking is missing a few precision markings for unknown scalars:
0: R1=ctx(id=0,off=0,imm=0) R10=fp0
0: (b7) r0 = 0
1: R0_w=invP0 R1=ctx(id=0,off=0,imm=0) R10=fp0 1: (35) if r0 >= 0xf72e goto pc+0
--> only follow fallthrough
2: R0_w=invP0 R1=ctx(id=0,off=0,imm=0) R10=fp0 2: (35) if r0 >= 0x80fe0000 goto pc+0
--> only follow fallthrough
3: R0_w=invP0 R1=ctx(id=0,off=0,imm=0) R10=fp0 3: (14) w0 -= -536870912
4: R0_w=invP536870912 R1=ctx(id=0,off=0,imm=0) R10=fp0 4: (0f) r1 += r0
5: R0_w=invP536870912 R1_w=inv(id=0) R10=fp0 5: (55) if r1 != 0x104c1500 goto pc+0
--> push other branch for later analysis R0_w=invP536870912 R1_w=inv273421568 R10=fp0 6: R0_w=invP536870912 R1_w=inv273421568 R10=fp0 6: (b7) r0 = 0
7: R0=invP0 R1=inv273421568 R10=fp0
7: (76) if w1 s>= 0xffffff00 goto pc+3
--> only follow goto
11: R0=invP0 R1=inv273421568 R10=fp0
11: (95) exit
6: R0_w=invP536870912 R1_w=inv(id=0) R10=fp0 6: (b7) r0 = 0
propagating r0
7: safe
processed 11 insns [...]
In the analysis of the second path coming after the successful exit above, the path is being pruned at line 7. Pruning analysis found that both r0 are precise P0 and both R1 are non-precise scalars and given prior path with R1 as non-precise scalar succeeded, this one is therefore safe as well.
However, problem is that given condition at insn 7 in the first run, we only followed goto and didn't push the other branch for later analysis, we've never walked the few insns in there and therefore dead-code sanitation rewrites it as goto pc-1, causing the hang depending on the skb address hitting these conditions. The issue is that R1 should have been marked as precise as well such that pruning enforces range check and conluded that new R1 is not in range of old R1. In insn 4, we mark R1 (skb) as unknown scalar via __mark_reg_unbounded() but not mark_reg_unbounded() and therefore regs->precise remains as false.
Back in b5dc0163d8fd ("bpf: precise scalar_value tracking"), this was not the case since marking out of __mark_reg_unbounded() had this covered as well. Once in both are set as precise in 4 as they should have been, we conclude that given R1 was in prior fall-through path 0x104c1500 and now is completely unknown, the check at insn 7 concludes that we need to continue walking. Analysis after the fix:
0: R1=ctx(id=0,off=0,imm=0) R10=fp0
0: (b7) r0 = 0
1: R0_w=invP0 R1=ctx(id=0,off=0,imm=0) R10=fp0 1: (35) if r0 >= 0xf72e goto pc+0
2: R0_w=invP0 R1=ctx(id=0,off=0,imm=0) R10=fp0 2: (35) if r0 >= 0x80fe0000 goto pc+0
3: R0_w=invP0 R1=ctx(id=0,off=0,imm=0) R10=fp0 3: (14) w0 -= -536870912
4: R0_w=invP536870912 R1=ctx(id=0,off=0,imm=0) R10=fp0 4: (0f) r1 += r0
5: R0_w=invP536870912 R1_w=invP(id=0) R10=fp0 5: (55) if r1 != 0x104c1500 goto pc+0 R0_w=invP536870912 R1_w=invP273421568 R10=fp0 6: R0_w=invP536870912 R1_w=invP273421568 R10=fp0 6: (b7) r0 = 0
7: R0=invP0 R1=invP273421568 R10=fp0
7: (76) if w1 s>= 0xffffff00 goto pc+3
11: R0=invP0 R1=invP273421568 R10=fp0
11: (95) exit
6: R0_w=invP536870912 R1_w=invP(id=0) R10=fp0 6: (b7) r0 = 0
7: R0_w=invP0 R1_w=invP(id=0) R10=fp0
7: (76) if w1 s>= 0xffffff00 goto pc+3 R0_w=invP0 R1_w=invP(id=0) R10=fp0
8: R0_w=invP0 R1_w=invP(id=0) R10=fp0
8: (a5) if r0 < 0x2007002a goto pc+0
9: R0_w=invP0 R1_w=invP(id=0) R10=fp0
9: (57) r0 &= -16316416
10: R0_w=invP0 R1_w=invP(id=0) R10=fp0
10: (a6) if w0 < 0x1201 goto pc+0
11: R0_w=invP0 R1_w=invP(id=0) R10=fp0
11: (95) exit
11: R0=invP0 R1=invP(id=0) R10=fp0
11: (95) exit
processed 16 insns [...]
--- kernel/bpf/verifier.c | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-)
kernel/bpf/verifier.c +22 -21
@@ -852,7 +852,8 @@ static const int caller_saved[CALLER_SAV BPF_REG_0, BPF_REG_1, BPF_REG_2, BPF_REG_3, BPF_REG_4, BPF_REG_5 }; -static void __mark_reg_not_init (struct bpf_reg_state *reg); +static void __mark_reg_not_init (const struct bpf_verifier_env *env, +struct bpf_reg_state *reg);/* Mark the unknown part of a register (variable offset or scalar value) as * known to have the value @imm.
@@ -890,7 +891,7 @@ static void mark_reg_known_zero(struct bverbose (env,"mark_reg_known_zero(regs, %u)\n" , regno);/* Something bad happened, let's kill all regs */ for (regno =0 ; regno <MAX_BPF_REG ; regno++) -__mark_reg_not_init (regs + regno); +__mark_reg_not_init (env, regs + regno);return ; }__mark_reg_known_zero (regs + regno);
@@ -999,7 +1000,8 @@ static void __mark_reg_unbounded(struct }/* Mark a register as having a completely unknown (scalar) value. */ -static void __mark_reg_unknown (struct bpf_reg_state *reg) +static void __mark_reg_unknown (const struct bpf_verifier_env *env, +struct bpf_reg_state *reg) {/* * Clear type, id, off, and union(map_ptr, range) and
@@ -1009,6 +1011,8 @@ static void __mark_reg_unknown(struct bp reg->type =SCALAR_VALUE ; reg->var_off = tnum_unknown; reg->frameno =0 ; + reg->precise = env->subprog_cnt >1 || !env->allow_ptr_leaks ? + true : false;__mark_reg_unbounded (reg); }
@@ -1019,19 +1023,16 @@ static void mark_reg_unknown(struct bpf_verbose (env,"mark_reg_unknown(regs, %u)\n" , regno);/* Something bad happened, let's kill all regs except FP */ for (regno =0 ; regno <BPF_REG_FP ; regno++) -__mark_reg_not_init (regs + regno); +__mark_reg_not_init (env, regs + regno);return ; } - regs += regno; -__mark_reg_unknown (regs); -/* constant backtracking is enabled for root without bpf2bpf calls */ - regs->precise = env->subprog_cnt >1 || !env->allow_ptr_leaks ? - true : false; +__mark_reg_unknown (env, regs + regno); } -static void __mark_reg_not_init (struct bpf_reg_state *reg) +static void __mark_reg_not_init (const struct bpf_verifier_env *env, +struct bpf_reg_state *reg) { -__mark_reg_unknown (reg); +__mark_reg_unknown (env, reg); reg->type =NOT_INIT ; }
@@ -1042,10 +1043,10 @@ static void mark_reg_not_init(struct bpfverbose (env,"mark_reg_not_init(regs, %u)\n" , regno);/* Something bad happened, let's kill all regs except FP */ for (regno =0 ; regno <BPF_REG_FP ; regno++) -__mark_reg_not_init (regs + regno); +__mark_reg_not_init (env, regs + regno);return ; } -__mark_reg_not_init (regs + regno); +__mark_reg_not_init (env, regs + regno); }#define DEF_NOT_SUBREG (0)
@@ -3066,7 +3067,7 @@ static int check_stack_boundary(struct b }if (state->stack[spi].slot_type[0 ] ==STACK_SPILL && state->stack[spi].spilled_ptr.type ==SCALAR_VALUE ) { -__mark_reg_unknown (&state->stack[spi].spilled_ptr); +__mark_reg_unknown (env, &state->stack[spi].spilled_ptr);for (j =0 ; j <BPF_REG_SIZE ; j++) state->stack[spi].slot_type[j] =STACK_MISC ; goto mark;
@@ -3706,7 +3707,7 @@ static void __clear_all_pkt_pointers(strif (!reg)continue ;if (reg_is_pkt_pointer_any (reg)) -__mark_reg_unknown (reg); +__mark_reg_unknown (env, reg); } }
@@ -3734,7 +3735,7 @@ static void release_reg_references(strucif (!reg)continue ;if (reg->ref_obj_id == ref_obj_id) -__mark_reg_unknown (reg); +__mark_reg_unknown (env, reg); } }
@@ -4357,7 +4358,7 @@ static int adjust_ptr_min_max_vals(struc/* Taint dst register if offset had invalid bounds derived from * e.g. dead branches. */ -__mark_reg_unknown (dst_reg); +__mark_reg_unknown (env, dst_reg);return 0 ; }
@@ -4609,13 +4610,13 @@ static int adjust_scalar_min_max_vals(st/* Taint dst register if offset had invalid bounds derived from * e.g. dead branches. */ -__mark_reg_unknown (dst_reg); +__mark_reg_unknown (env, dst_reg);return 0 ; }if (!src_known && opcode !=BPF_ADD && opcode !=BPF_SUB && opcode !=BPF_AND ) { -__mark_reg_unknown (dst_reg); +__mark_reg_unknown (env, dst_reg);return 0 ; }
@@ -6746,7 +6747,7 @@ static void clean_func_state(struct bpf_/* since the register is unused, clear its state * to make further comparison simpler */ -__mark_reg_not_init (&st->regs[i]); +__mark_reg_not_init (env, &st->regs[i]); }for (i =0 ; i < st->allocated_stack /BPF_REG_SIZE ; i++) {
@@ -6754,7 +6755,7 @@ static void clean_func_state(struct bpf_/* liveness must not touch this stack slot anymore */ st->stack[i].spilled_ptr.live |=REG_LIVE_DONE ;if (!(live ®_LIVE_READ )) { -__mark_reg_not_init (&st->stack[i].spilled_ptr); +__mark_reg_not_init (env, &st->stack[i].spilled_ptr);for (j =0 ; j <BPF_REG_SIZE ; j++) st->stack[i].slot_type[j] =STACK_INVALID ; }
Greg Kroah-Hartman
maintainerPATCH 105/191 ata: libahci_platform: Export again ahci_platform_<en/dis>able_phys()
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
commit 84b032dbfdf1c139cd2b864e43959510646975f8 upstream.
This reverts commit 6bb86fefa086faba7b60bb452300b76a47cde1a5 ("libahci_platform: Staticize ahci_platform_<en/dis>able_phys()") we are going to need ahci_platform_{enable,disable}_phys() in a subsequent commit for ahci_brcm.c in order to properly control the PHY initialization order.
Also make sure the function prototypes are declared in include/linux/ahci_platform.h as a result.
--- drivers/ata/libahci_platform.c | 6 ++++-- include/linux/ahci_platform.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/ata/libahci_platform.c +4 -2
@@ -43,7 +43,7 @@ EXPORT_SYMBOL_GPL(ahci_platform_ops);* RETURNS: * 0 on success otherwise a negative error code */ -static int ahci_platform_enable_phys (struct ahci_host_priv *hpriv) +int ahci_platform_enable_phys (struct ahci_host_priv *hpriv) {int rc, i;
@@ -74,6 +74,7 @@ disable_phys: }return rc; } +EXPORT_SYMBOL_GPL (ahci_platform_enable_phys);/** * ahci_platform_disable_phys - Disable PHYs
@@ -81,7 +82,7 @@ disable_phys:* * This function disables all PHYs found in hpriv->phys. */ -static void ahci_platform_disable_phys (struct ahci_host_priv *hpriv) +void ahci_platform_disable_phys (struct ahci_host_priv *hpriv) {int i;
@@ -90,6 +91,7 @@ static void ahci_platform_disable_phys(sphy_exit (hpriv->phys[i]); } } +EXPORT_SYMBOL_GPL (ahci_platform_disable_phys);/** * ahci_platform_enable_clks - Enable platform clocks
include/linux/ahci_platform.h +2 -0
@@ -19,6 +19,8 @@ struct ahci_host_priv;struct platform_device ;struct scsi_host_template ; +int ahci_platform_enable_phys (struct ahci_host_priv *hpriv); +void ahci_platform_disable_phys (struct ahci_host_priv *hpriv);int ahci_platform_enable_clks (struct ahci_host_priv *hpriv);void ahci_platform_disable_clks (struct ahci_host_priv *hpriv);int ahci_platform_enable_regulators (struct ahci_host_priv *hpriv);
Greg Kroah-Hartman
maintainerPATCH 106/191 ata: ahci_brcm: Fix AHCI resources management
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
commit c0cdf2ac4b5bf3e5ef2451ea29fb4104278cdabc upstream.
The AHCI resources management within ahci_brcm.c is a little convoluted, largely because it historically had a dedicated clock that was managed within this file in the downstream tree. Once brough upstream though, the clock was left to be managed by libahci_platform.c which is entirely appropriate.
This patch series ensures that the AHCI resources are fetched and enabled before any register access is done, thus avoiding bus errors on platforms which clock gate the controller by default.
As a result we need to re-arrange the suspend() and resume() functions in order to avoid accessing registers after the clocks have been turned off respectively before the clocks have been turned on. Finally, we can refactor brcm_ahci_get_portmask() in order to fetch the number of ports from hpriv->mmio which is now accessible without jumping through hoops like we used to do.
The commit pointed in the Fixes tag is both old and new enough not to require major headaches for backporting of this patch.
--- drivers/ata/ahci_brcm.c | 105 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 76 insertions(+), 29 deletions(-)
drivers/ata/ahci_brcm.c +76 -29
@@ -213,19 +213,12 @@ static void brcm_sata_phys_disable(strucbrcm_sata_phy_disable (priv, i); } -static u32 brcm_ahci_get_portmask (struct platform_device *pdev, +static u32 brcm_ahci_get_portmask (struct ahci_host_priv *hpriv,struct brcm_ahci_priv *priv) { -void __iomem *ahci; -struct resource *res;u32 impl; - res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"ahci" ); - ahci =devm_ioremap_resource (&pdev->dev, res); -if (IS_ERR (ahci)) -return 0 ; - - impl =readl (ahci +HOST_PORTS_IMPL ); + impl =readl (hpriv->mmio +HOST_PORTS_IMPL );if (fls (impl) >SATA_TOP_MAX_PHYS ) dev_warn(priv->dev, "warning: more ports than PHYs (%#x)\n",
@@ -233,9 +226,6 @@ static u32 brcm_ahci_get_portmask(structelse if (!impl)dev_info (priv->dev,"no ports found\n" ); -devm_iounmap (&pdev->dev, ahci); -devm_release_mem_region (&pdev->dev, res->start,resource_size (res)); -return impl; }
@@ -347,11 +337,10 @@ static int brcm_ahci_suspend(struct devistruct ata_host *host =dev_get_drvdata (dev);struct ahci_host_priv *hpriv = host->private_data;struct brcm_ahci_priv *priv = hpriv->plat_data; -int ret; - ret =ahci_platform_suspend (dev);brcm_sata_phys_disable (priv); -return ret; + +return ahci_platform_suspend (dev); }static int brcm_ahci_resume (struct device *dev)
@@ -359,11 +348,44 @@ static int brcm_ahci_resume(struct devicstruct ata_host *host =dev_get_drvdata (dev);struct ahci_host_priv *hpriv = host->private_data;struct brcm_ahci_priv *priv = hpriv->plat_data; +int ret; + +/* Make sure clocks are turned on before re-configuration */ + ret =ahci_platform_enable_clks (hpriv); +if (ret) +return ret;brcm_sata_init (priv);brcm_sata_phys_enable (priv);brcm_sata_alpm_init (hpriv); - return ahci_platform_resume(dev); + +/* Since we had to enable clocks earlier on, we cannot use +* ahci_platform_resume() as-is since a second call to +* ahci_platform_enable_resources() would bump up the resources +* (regulators, clocks, PHYs) count artificially so we copy the part +* after ahci_platform_enable_resources(). +*/ + ret =ahci_platform_enable_phys (hpriv); +if (ret) + goto out_disable_phys; + + ret =ahci_platform_resume_host (dev); +if (ret) + goto out_disable_platform_phys; + +/* We resumed so update PM runtime state */ +pm_runtime_disable (dev); +pm_runtime_set_active (dev); +pm_runtime_enable (dev); + +return 0 ; + +out_disable_platform_phys: +ahci_platform_disable_phys (hpriv); +out_disable_phys: +brcm_sata_phys_disable (priv); +ahci_platform_disable_clks (hpriv); + return ret; }#endif
@@ -416,38 +438,63 @@ static int brcm_ahci_probe(struct platfo priv->quirks |=BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE ; } + hpriv =ahci_platform_get_resources (pdev,0 ); +if (IS_ERR (hpriv)) { + ret =PTR_ERR (hpriv); + goto out_reset; + } + + ret =ahci_platform_enable_clks (hpriv); +if (ret) + goto out_reset; + +/* Must be first so as to configure endianness including that +* of the standard AHCI register space. +*/ brcm_sata_init (priv); - priv->port_mask =brcm_ahci_get_portmask (pdev, priv); -if (!priv->port_mask) -return -ENODEV ; +/* Initializes priv->port_mask which is used below */ + priv->port_mask =brcm_ahci_get_portmask (hpriv, priv); +if (!priv->port_mask) { + ret = -ENODEV ; + goto out_disable_clks; + } +/* Must be done before ahci_platform_enable_phys() */ brcm_sata_phys_enable (priv); - hpriv =ahci_platform_get_resources (pdev,0 ); -if (IS_ERR (hpriv)) -return PTR_ERR (hpriv); hpriv->plat_data = priv; hpriv->flags =AHCI_HFLAG_WAKE_BEFORE_STOP ;brcm_sata_alpm_init (hpriv); - ret =ahci_platform_enable_resources (hpriv); -if (ret) -return ret; -if (priv->quirks &BRCM_AHCI_QUIRK_NO_NCQ ) hpriv->flags |=AHCI_HFLAG_NO_NCQ ; hpriv->flags |=AHCI_HFLAG_NO_WRITE_TO_RO ; + ret =ahci_platform_enable_phys (hpriv); +if (ret) + goto out_disable_phys; + ret =ahci_platform_init_host (pdev, hpriv, &ahci_brcm_port_info, &ahci_platform_sht);if (ret) -return ret; + goto out_disable_platform_phys;dev_info (dev,"Broadcom AHCI SATA3 registered\n" );return 0 ; + +out_disable_platform_phys: +ahci_platform_disable_phys (hpriv); +out_disable_phys: +brcm_sata_phys_disable (priv); +out_disable_clks: +ahci_platform_disable_clks (hpriv); +out_reset: +if (!IS_ERR_OR_NULL (priv->rcdev)) +reset_control_assert (priv->rcdev); +return ret; }static int brcm_ahci_remove (struct platform_device *pdev)
@@ -457,12 +504,12 @@ static int brcm_ahci_remove(struct platfstruct brcm_ahci_priv *priv = hpriv->plat_data;int ret; +brcm_sata_phys_disable (priv); + ret =ata_platform_remove_one (pdev);if (ret)return ret; -brcm_sata_phys_disable (priv); -return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 107/191 ata: ahci_brcm: Add missing clock management during recovery
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
commit bf0e5013bc2dcac205417e1252205dca39dfc005 upstream.
The downstream implementation of ahci_brcm.c did contain clock management recovery, but until recently, did that outside of the libahci_platform helpers and this was unintentionally stripped out while forward porting the patch upstream.
Add the missing clock management during recovery and sleep for 10 milliseconds per the design team recommendations to ensure the SATA PHY controller and AFE have been fully quiesced.
--- drivers/ata/ahci_brcm.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/ata/ahci_brcm.c +7 -0
@@ -275,6 +275,13 @@ static unsigned int brcm_ahci_read_id(st/* Perform the SATA PHY reset sequence */ brcm_sata_phy_disable (priv, ap->port_no); +/* Reset the SATA clock */ +ahci_platform_disable_clks (hpriv); +msleep (10 ); + +ahci_platform_enable_clks (hpriv); +msleep (10 ); +/* Bring the PHY back on */ brcm_sata_phy_enable (priv, ap->port_no);
Greg Kroah-Hartman
maintainerPATCH 108/191 ata: ahci_brcm: BCM7425 AHCI requires AHCI_HFLAG_DELAY_ENGINE
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
commit 1a3d78cb6e20779a19388315bd8efefbd8d4a656 upstream.
Set AHCI_HFLAG_DELAY_ENGINE for the BCM7425 AHCI controller thus making it conforming to the 'strict' AHCI implementation which this controller is based on.
This solves long link establishment with specific hard drives (e.g.:
Seagate ST1000VM002-9ZL1 SC12) that would otherwise have to complete the error recovery handling before finally establishing a succesful SATA link at the desired speed.
We re-order the hpriv->flags assignment to also remove the NONCQ quirk since we can set the flag directly.
--- drivers/ata/ahci_brcm.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-)
drivers/ata/ahci_brcm.c +16 -15
@@ -76,8 +76,7 @@ enum brcm_ahci_version { };enum brcm_ahci_quirks { -BRCM_AHCI_QUIRK_NO_NCQ =BIT (0 ), -BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE =BIT (1 ), +BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE =BIT (0 ), };struct brcm_ahci_priv {
@@ -439,18 +438,27 @@ static int brcm_ahci_probe(struct platfoif (!IS_ERR_OR_NULL (priv->rcdev))reset_control_deassert (priv->rcdev); -if ((priv->version ==BRCM_SATA_BCM7425 ) || - (priv->version ==BRCM_SATA_NSP )) { - priv->quirks |=BRCM_AHCI_QUIRK_NO_NCQ ; - priv->quirks |=BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE ; - } - hpriv =ahci_platform_get_resources (pdev,0 );if (IS_ERR (hpriv)) { ret =PTR_ERR (hpriv); goto out_reset; } + hpriv->plat_data = priv; + hpriv->flags =AHCI_HFLAG_WAKE_BEFORE_STOP |AHCI_HFLAG_NO_WRITE_TO_RO ; + +switch (priv->version) { +case BRCM_SATA_BCM7425 : + hpriv->flags |=AHCI_HFLAG_DELAY_ENGINE ; +/* fall through */ +case BRCM_SATA_NSP : + hpriv->flags |=AHCI_HFLAG_NO_NCQ ; + priv->quirks |=BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE ; +break ; +default : +break ; + } + ret =ahci_platform_enable_clks (hpriv);if (ret) goto out_reset;
@@ -470,15 +478,8 @@ static int brcm_ahci_probe(struct platfo/* Must be done before ahci_platform_enable_phys() */ brcm_sata_phys_enable (priv); - hpriv->plat_data = priv; - hpriv->flags =AHCI_HFLAG_WAKE_BEFORE_STOP ; -brcm_sata_alpm_init (hpriv); -if (priv->quirks &BRCM_AHCI_QUIRK_NO_NCQ ) - hpriv->flags |=AHCI_HFLAG_NO_NCQ ; - hpriv->flags |=AHCI_HFLAG_NO_WRITE_TO_RO ; - ret =ahci_platform_enable_phys (hpriv);if (ret) goto out_disable_phys;
Greg Kroah-Hartman
maintainerPATCH 109/191 libata: Fix retrieving of active qcs
In reply to Greg Kroah-HartmanFrom: Sascha Hauer <[email protected]>
commit 8385d756e114f2df8568e508902d5f9850817ffb upstream.
ata_qc_complete_multiple() is called with a mask of the still active tags.
mv_sata doesn't have this information directly and instead calculates the still active tags from the started tags (ap->qc_active) and the finished tags as (ap->qc_active ^ done_mask)
Since 28361c40368 the hw_tag and tag are no longer the same and the equation is no longer valid. In ata_exec_internal_sg() ap->qc_active is initialized as 1ULL << ATA_TAG_INTERNAL, but in hardware tag 0 is started and this will be in done_mask on completion. ap->qc_active ^ done_mask becomes 0x100000000 ^ 0x1 = 0x100000001 and thus tag 0 used as the internal tag will never be reported as completed.
This is fixed by introducing ata_qc_get_active() which returns the active hardware tags and calling it where appropriate.
This is tested on mv_sata, but sata_fsl and sata_nv suffer from the same problem. There is another case in sata_nv that most likely needs fixing as well, but this looks a little different, so I wasn't confident enough to change that.
Add missing export of ata_qc_get_active(), as per Pali.
--- drivers/ata/libata-core.c | 24 ++++++++++++++++++++++++ drivers/ata/sata_fsl.c | 2 +- drivers/ata/sata_mv.c | 2 +- drivers/ata/sata_nv.c | 2 +- include/linux/libata.h | 1 + 5 files changed, 28 insertions(+), 3 deletions(-)
drivers/ata/libata-core.c +24 -0
@@ -5326,6 +5326,30 @@ void ata_qc_complete(struct ata_queued_c }/** +* ata_qc_get_active - get bitmask of active qcs +* @ap: port in question +* +* LOCKING: +* spin_lock_irqsave(host lock) +* +* RETURNS: +* Bitmask of active qcs +*/ +u64 ata_qc_get_active (struct ata_port *ap) +{ +u64 qc_active = ap->qc_active; + +/* ATA_TAG_INTERNAL is sent to hw as tag 0 */ +if (qc_active & (1ULL <<ATA_TAG_INTERNAL )) { + qc_active |= (1 <<0 ); + qc_active &= ~(1ULL <<ATA_TAG_INTERNAL ); + } + +return qc_active; +} +EXPORT_SYMBOL_GPL (ata_qc_get_active); + +/** * ata_qc_complete_multiple - Complete multiple qcs successfully * @ap: port in question * @qc_active: new qc_active mask
drivers/ata/sata_fsl.c +1 -1
@@ -1278,7 +1278,7 @@ static void sata_fsl_host_intr(struct at i,ioread32 (hcr_base +CC ), ioread32(hcr_base + CA)); } -ata_qc_complete_multiple (ap, ap->qc_active ^ done_mask); +ata_qc_complete_multiple (ap,ata_qc_get_active (ap) ^ done_mask);return ; }else if ((ap->qc_active & (1ULL <<ATA_TAG_INTERNAL ))) {
drivers/ata/sata_mv.c +1 -1
@@ -2827,7 +2827,7 @@ static void mv_process_crpb_entries(stru }if (work_done) { -ata_qc_complete_multiple (ap, ap->qc_active ^ done_mask); +ata_qc_complete_multiple (ap,ata_qc_get_active (ap) ^ done_mask);/* Update the software queue position index in hardware */ writelfl((pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK) |
drivers/ata/sata_nv.c +1 -1
@@ -984,7 +984,7 @@ static irqreturn_t nv_adma_interrupt(int check_commands =0 ; check_commands &= ~(1 << pos); } -ata_qc_complete_multiple (ap, ap->qc_active ^ done_mask); +ata_qc_complete_multiple (ap,ata_qc_get_active (ap) ^ done_mask); } }
include/linux/libata.h +1 -0
@@ -1174,6 +1174,7 @@ extern unsigned int ata_do_dev_read_id(s struct ata_taskfile *tf, u16 *id);extern void ata_qc_complete (struct ata_queued_cmd *qc);extern int ata_qc_complete_multiple (struct ata_port *ap,u64 qc_active); +extern u64 ata_qc_get_active (struct ata_port *ap);extern void ata_scsi_simulate (struct ata_device *dev,struct scsi_cmnd *cmd); extern int ata_std_bios_param(struct scsi_device *sdev, struct block_device *bdev,
Greg Kroah-Hartman
maintainerPATCH 110/191 gpio: xtensa: fix driver build
In reply to Greg Kroah-HartmanFrom: Max Filippov <[email protected]>
commit 634f0348fe336fce8f6cab1933139115e983ed2f upstream.
Commit cad6fade6e78 ("xtensa: clean up WSR*/RSR*/get_sr/set_sr") removed {RSR,WSR}_CPENABLE from xtensa code, but did not fix up all users, breaking gpio-xtensa driver build. Update gpio-xtensa to use new xtensa_{get,set}_sr API.
--- drivers/gpio/gpio-xtensa.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpio/gpio-xtensa.c +3 -4
@@ -44,15 +44,14 @@ static inline unsigned long enable_cp(ununsigned long flags;local_irq_save (flags); -RSR_CPENABLE (*cpenable); -WSR_CPENABLE (*cpenable |BIT (XCHAL_CP_ID_XTIOP )); - + *cpenable =xtensa_get_sr (cpenable); +xtensa_set_sr (*cpenable |BIT (XCHAL_CP_ID_XTIOP ), cpenable);return flags; }static inline void disable_cp (unsigned long flags,unsigned long cpenable) { -WSR_CPENABLE (cpenable); +xtensa_set_sr (cpenable, cpenable);local_irq_restore (flags); }
Greg Kroah-Hartman
maintainerPATCH 111/191 gpiolib: fix up emulated open drain outputs
In reply to Greg Kroah-HartmanFrom: Russell King <[email protected]>
commit 256efaea1fdc4e38970489197409a26125ee0aaa upstream.
gpiolib has a corner case with open drain outputs that are emulated. When such outputs are outputting a logic 1, emulation will set the hardware to input mode, which will cause gpiod_get_direction() to report that it is in input mode. This is different from the behaviour with a true open-drain output.
Unify the semantics here.
--- drivers/gpio/gpiolib.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpio/gpiolib.c +8 -0
@@ -220,6 +220,14 @@ int gpiod_get_direction(struct gpio_desc chip =gpiod_to_chip (desc); offset =gpio_chip_hwgpio (desc); +/* +* Open drain emulation using input mode may incorrectly report +* input here, fix that up. +*/ +if (test_bit (FLAG_OPEN_DRAIN , &desc->flags) && +test_bit (FLAG_IS_OUT , &desc->flags)) +return 0 ; +if (!chip->get_direction)return -ENOTSUPP ;
Greg Kroah-Hartman
maintainerPATCH 112/191 clocksource: riscv: add notrace to riscv_sched_clock
In reply to Greg Kroah-HartmanFrom: Zong Li <[email protected]>
commit 9d05c18e8d7de566ff68f221fcae65e78708dd1d upstream.
When enabling ftrace graph tracer, it gets the tracing clock in ftrace_push_return_trace(). Eventually, it invokes riscv_sched_clock() to get the clock value. If riscv_sched_clock() isn't marked with 'notrace', it will call ftrace_push_return_trace() and cause infinite loop.
The result of failure as follow:
command: echo function_graph >current_tracer
[ 46.176787] Unable to handle kernel paging request at virtual address ffffffe04fb38c48 [ 46.177309] Oops [#1] [ 46.177478] Modules linked in: [ 46.177770] CPU: 0 PID: 256 Comm: $d Not tainted 5.5.0-rc1 #47 [ 46.177981] epc: ffffffe00035e59a ra : ffffffe00035e57e sp : ffffffe03a7569b0 [ 46.178216] gp : ffffffe000d29b90 tp : ffffffe03a756180 t0 : ffffffe03a756968 [ 46.178430] t1 : ffffffe00087f408 t2 : ffffffe03a7569a0 s0 : ffffffe03a7569f0 [ 46.178643] s1 : ffffffe00087f408 a0 : 0000000ac054cda4 a1 : 000000000087f411 [ 46.178856] a2 : 0000000ac054cda4 a3 : 0000000000373ca0 a4 : ffffffe04fb38c48 [ 46.179099] a5 : 00000000153e22a8 a6 : 00000000005522ff a7 : 0000000000000005 [ 46.179338] s2 : ffffffe03a756a90 s3 : ffffffe00032811c s4 : ffffffe03a756a58 [ 46.179570] s5 : ffffffe000d29fe0 s6 : 0000000000000001 s7 : 0000000000000003 [ 46.179809] s8 : 0000000000000003 s9 : 0000000000000002 s10: 0000000000000004 [ 46.180053] s11: 0000000000000000 t3 : 0000003fc815749c t4 : 00000000000efc90 [ 46.180293] t5 : ffffffe000d29658 t6 : 0000000000040000 [ 46.180482] status: 0000000000000100 badaddr: ffffffe04fb38c48 cause: 000000000000000f
--- drivers/clocksource/timer-riscv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/timer-riscv.c +1 -1
@@ -41,7 +41,7 @@ static unsigned long long riscv_clocksoureturn get_cycles64 (); } -static u64 riscv_sched_clock (void ) +static u64 notrace riscv_sched_clock(void) {return get_cycles64 (); }
Greg Kroah-Hartman
maintainerPATCH 113/191 riscv: ftrace: correct the condition logic in function graph tracer
In reply to Greg Kroah-HartmanFrom: Zong Li <[email protected]>
commit 1d8f65798240b6577d8c44d20c8ea8f1d429e495 upstream.
The condition should be logical NOT to assign the hook address to parent address. Because the return value 0 of function_graph_enter upon success.
--- arch/riscv/kernel/ftrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kernel/ftrace.c +1 -1
@@ -142,7 +142,7 @@ void prepare_ftrace_return(unsigned long*/ old = *parent; -if (function_graph_enter (old, self_addr, frame_pointer, parent)) +if (!function_graph_enter (old, self_addr, frame_pointer, parent)) *parent = return_hooker; }
Greg Kroah-Hartman
maintainerPATCH 114/191 rseq/selftests: Fix: Namespace gettid() for compatibility with glibc 2.30
In reply to Greg Kroah-HartmanFrom: Mathieu Desnoyers <[email protected]>
commit 8df34c56321479bfa1ec732c675b686c2b4df412 upstream.
glibc 2.30 introduces gettid() in public headers, which clashes with the internal static definition within rseq selftests.
Rename gettid() to rseq_gettid() to eliminate this symbol name clash.
--- tools/testing/selftests/rseq/param_test.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
tools/testing/selftests/rseq/param_test.c +10 -8
@@ -15,7 +15,7 @@#include <errno.h> #include <stddef.h> -static inline pid_t gettid (void ) +static inline pid_t rseq_gettid (void ) {return syscall (__NR_gettid); }
@@ -373,11 +373,12 @@ void *test_percpu_spinlock_thread(void *rseq_percpu_unlock (&data->lock, cpu);#ifndef BENCHMARK if (i !=0 && !(i % (reps /10 ))) -printf_verbose ("tid %d: count %lld\n" , (int )gettid (), i); +printf_verbose ("tid %d: count %lld\n" , + (int )rseq_gettid (), i);#endif }printf_verbose ("tid %d: number of rseq abort: %d, signals delivered: %u\n" , - (int )gettid (), nr_abort, signals_delivered); + (int )rseq_gettid (), nr_abort, signals_delivered);if (!opt_disable_rseq && thread_data->reg &&rseq_unregister_current_thread ())abort ();
@@ -454,11 +455,12 @@ void *test_percpu_inc_thread(void *arg) }while (rseq_unlikely (ret));#ifndef BENCHMARK if (i !=0 && !(i % (reps /10 ))) -printf_verbose ("tid %d: count %lld\n" , (int )gettid (), i); +printf_verbose ("tid %d: count %lld\n" , + (int )rseq_gettid (), i);#endif }printf_verbose ("tid %d: number of rseq abort: %d, signals delivered: %u\n" , - (int )gettid (), nr_abort, signals_delivered); + (int )rseq_gettid (), nr_abort, signals_delivered);if (!opt_disable_rseq && thread_data->reg &&rseq_unregister_current_thread ())abort ();
@@ -605,7 +607,7 @@ void *test_percpu_list_thread(void *arg) }printf_verbose ("tid %d: number of rseq abort: %d, signals delivered: %u\n" , - (int )gettid (), nr_abort, signals_delivered); + (int )rseq_gettid (), nr_abort, signals_delivered);if (!opt_disable_rseq &&rseq_unregister_current_thread ())abort ();
@@ -796,7 +798,7 @@ void *test_percpu_buffer_thread(void *ar }printf_verbose ("tid %d: number of rseq abort: %d, signals delivered: %u\n" , - (int )gettid (), nr_abort, signals_delivered); + (int )rseq_gettid (), nr_abort, signals_delivered);if (!opt_disable_rseq &&rseq_unregister_current_thread ())abort ();
@@ -1011,7 +1013,7 @@ void *test_percpu_memcpy_buffer_thread(v }printf_verbose ("tid %d: number of rseq abort: %d, signals delivered: %u\n" , - (int )gettid (), nr_abort, signals_delivered); + (int )rseq_gettid (), nr_abort, signals_delivered);if (!opt_disable_rseq &&rseq_unregister_current_thread ())abort ();
Greg Kroah-Hartman
maintainerPATCH 115/191 tracing: Fix lock inversion in trace_event_enable_tgid_record()
In reply to Greg Kroah-HartmanFrom: Prateek Sood <[email protected]>
commit 3a53acf1d9bea11b57c1f6205e3fe73f9d8a3688 upstream.
Task T2 Task T3trace_options_core_write() subsystem_open()
mutex_lock(trace_types_lock) mutex_lock(event_mutex)
set_tracer_flag()
trace_event_enable_tgid_record() mutex_lock(trace_types_lock)
mutex_lock(event_mutex)
This gives a circular dependency deadlock between trace_types_lock and event_mutex. To fix this invert the usage of trace_types_lock and event_mutex in trace_options_core_write(). This keeps the sequence of lock usage consistent.
--- kernel/trace/trace.c | 8 ++++++++ kernel/trace/trace_events.c | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-)
kernel/trace/trace.c +8 -0
@@ -4590,6 +4590,10 @@ int trace_keep_overwrite(struct tracer *int set_tracer_flag (struct trace_array *tr,unsigned int mask,int enabled) { +if ((mask ==TRACE_ITER_RECORD_TGID ) || + (mask ==TRACE_ITER_RECORD_CMD )) +lockdep_assert_held (&event_mutex); +/* do nothing if flag is already set */ if (!!(tr->trace_flags & mask) == !!enabled)return 0 ;
@@ -4657,6 +4661,7 @@ static int trace_set_options(struct trac cmp += len; +mutex_lock (&event_mutex);mutex_lock (&trace_types_lock); ret =match_string (trace_options,-1 , cmp);
@@ -4667,6 +4672,7 @@ static int trace_set_options(struct trac ret =set_tracer_flag (tr,1 << ret, !neg);mutex_unlock (&trace_types_lock); +mutex_unlock (&event_mutex);/* * If the first trailing whitespace is replaced with '\0' by strstrip,
@@ -7972,9 +7978,11 @@ trace_options_core_write(struct file *fiif (val !=0 && val !=1 )return -EINVAL ; +mutex_lock (&event_mutex);mutex_lock (&trace_types_lock); ret =set_tracer_flag (tr,1 << index, val);mutex_unlock (&trace_types_lock); +mutex_unlock (&event_mutex);if (ret <0 )return ret;
kernel/trace/trace_events.c +4 -4
@@ -320,7 +320,8 @@ void trace_event_enable_cmd_record(boolstruct trace_event_file *file;struct trace_array *tr; -mutex_lock (&event_mutex); +lockdep_assert_held (&event_mutex); +do_for_each_event_file (tr, file) {if (!(file->flags &EVENT_FILE_FL_ENABLED ))
@@ -334,7 +335,6 @@ void trace_event_enable_cmd_record(boolclear_bit (EVENT_FILE_FL_RECORDED_CMD_BIT , &file->flags); } }while_for_each_event_file (); -mutex_unlock (&event_mutex); }void trace_event_enable_tgid_record (bool enable)
@@ -342,7 +342,8 @@ void trace_event_enable_tgid_record(boolstruct trace_event_file *file;struct trace_array *tr; -mutex_lock (&event_mutex); +lockdep_assert_held (&event_mutex); +do_for_each_event_file (tr, file) {if (!(file->flags &EVENT_FILE_FL_ENABLED ))continue ;
@@ -356,7 +357,6 @@ void trace_event_enable_tgid_record(bool &file->flags); } }while_for_each_event_file (); -mutex_unlock (&event_mutex); } static int __ftrace_event_enable_disable(struct trace_event_file *file,
Greg Kroah-Hartman
maintainerPATCH 116/191 tracing: Avoid memory leak in process_system_preds()
In reply to Greg Kroah-HartmanFrom: Keita Suzuki <[email protected]>
commit 79e65c27f09683fbb50c33acab395d0ddf5302d2 upstream.
When failing in the allocation of filter_item, process_system_preds() goes to fail_mem, where the allocated filter is freed.
However, this leads to memory leak of filter->filter_string and filter->prog, which is allocated before and in process_preds(). This bug has been detected by kmemleak as well.
Fix this by changing kfree to __free_fiter.
unreferenced object 0xffff8880658007c0 (size 32):
comm "bash", pid 579, jiffies 4295096372 (age 17.752s) hex dump (first 32 bytes):
63 6f 6d 6d 6f 6e 5f 70 69 64 20 20 3e 20 31 30 common_pid > 10
00 00 00 00 00 00 00 00 65 73 00 00 00 00 00 00 ........es......
backtrace:
[<0000000067441602>] kstrdup+0x2d/0x60
[<00000000141cf7b7>] apply_subsystem_event_filter+0x378/0x932
[<000000009ca32334>] subsystem_filter_write+0x5a/0x90
[<0000000072da2bee>] vfs_write+0xe1/0x240
[<000000004f14f473>] ksys_write+0xb4/0x150
[<00000000a968b4a0>] do_syscall_64+0x6d/0x1e0
[<000000001a189f40>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
unreferenced object 0xffff888060c22d00 (size 64):
comm "bash", pid 579, jiffies 4295096372 (age 17.752s)
hex dump (first 32 bytes):
01 00 00 00 00 00 00 00 00 e8 d7 41 80 88 ff ff ...........A....
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<00000000b8c1b109>] process_preds+0x243/0x1820
[<000000003972c7f0>] apply_subsystem_event_filter+0x3be/0x932
[<000000009ca32334>] subsystem_filter_write+0x5a/0x90
[<0000000072da2bee>] vfs_write+0xe1/0x240
[<000000004f14f473>] ksys_write+0xb4/0x150
[<00000000a968b4a0>] do_syscall_64+0x6d/0x1e0
[<000000001a189f40>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
unreferenced object 0xffff888041d7e800 (size 512):
comm "bash", pid 579, jiffies 4295096372 (age 17.752s)
hex dump (first 32 bytes):
70 bc 85 97 ff ff ff ff 0a 00 00 00 00 00 00 00 p...............
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<000000001e04af34>] process_preds+0x71a/0x1820
[<000000003972c7f0>] apply_subsystem_event_filter+0x3be/0x932
[<000000009ca32334>] subsystem_filter_write+0x5a/0x90
[<0000000072da2bee>] vfs_write+0xe1/0x240
[<000000004f14f473>] ksys_write+0xb4/0x150
[<00000000a968b4a0>] do_syscall_64+0x6d/0x1e0
[<000000001a189f40>] entry_SYSCALL_64_after_hwframe+0x44/0xa9--- kernel/trace/trace_events_filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_events_filter.c +1 -1
@@ -1662,7 +1662,7 @@ static int process_system_preds(struct tparse_error (pe,FILT_ERR_BAD_SUBSYS_FILTER ,0 );return -EINVAL ; fail_mem: -kfree (filter); +__free_filter (filter);/* If any call succeeded, we still need to sync */ if (!fail)tracepoint_synchronize_unregister ();
Greg Kroah-Hartman
maintainerPATCH 117/191 tracing: Have the histogram compare functions convert to u64 first
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (VMware) <[email protected]>
commit 106f41f5a302cb1f36c7543fae6a05de12e96fa4 upstream.
The compare functions of the histogram code would be specific for the size of the value being compared (byte, short, int, long long). It would reference the value from the array via the type of the compare, but the value was stored in a 64 bit number. This is fine for little endian machines, but for big endian machines, it would end up comparing zeros or all ones (depending on the sign) for anything but 64 bit numbers.
To fix this, first derference the value as a u64 then convert it to the type being compared.
--- kernel/trace/tracing_map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/tracing_map.c +2 -2
@@ -148,8 +148,8 @@ static int tracing_map_cmp_atomic64(void#define DEFINE_TRACING_MAP_CMP_FN (type) \ static int tracing_map_cmp_##type(void *val_a, void *val_b) \ { \ - type a = *(type *)val_a; \ - type b = *(type *)val_b; \ + type a = (type)(*(u64 *)val_a); \ + type b = (type)(*(u64 *)val_b); \ \ return (a > b) ? 1 : ((a < b) ? -1 : 0); \ }
Greg Kroah-Hartman
maintainerPATCH 118/191 tracing: Fix endianness bug in histogram trigger
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
commit fe6e096a5bbf73a142f09c72e7aa2835026eb1a3 upstream.
At least on PA-RISC and s390 synthetic histogram triggers are failing selftests because trace_event_raw_event_synth() always writes a 64 bit values, but the reader expects a field->size sized value. On little endian machines this doesn't hurt, but on big endian this makes the reader always read zero values.
--- kernel/trace/trace_events_hist.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
kernel/trace/trace_events_hist.c +20 -1
@@ -911,7 +911,26 @@ static notrace void trace_event_raw_evenstrscpy (str_field, str_val,STR_VAR_LEN_MAX ); n_u64 +=STR_VAR_LEN_MAX /sizeof (u64); }else { - entry->fields[n_u64] = var_ref_vals[var_ref_idx + i]; +struct synth_field *field = event->fields[i]; +u64 val = var_ref_vals[var_ref_idx + i]; + +switch (field->size) { +case 1 : + *(u8 *)&entry->fields[n_u64] = (u8 )val; +break ; + +case 2 : + *(u16 *)&entry->fields[n_u64] = (u16 )val; +break ; + +case 4 : + *(u32 *)&entry->fields[n_u64] = (u32 )val; +break ; + +default : + entry->fields[n_u64] = val; +break ; + } n_u64++; } }
Greg Kroah-Hartman
maintainerPATCH 119/191 samples/trace_printk: Wait for IRQ work to finish
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
commit 01f36a554e3ef32f9fc4b81a4437cf08fd0e4742 upstream.
trace_printk schedules work via irq_work_queue(), but doesn't wait until it was processed. The kprobe_module.tc testcase does:
:;: "Load module again, which means the event1 should be recorded";:
modprobe trace-printk
grep "event1:" trace
so the grep which checks the trace file might run before the irq work was processed. Fix this by adding a irq_work_sync().
--- samples/trace_printk/trace-printk.c | 1 + 1 file changed, 1 insertion(+)
samples/trace_printk/trace-printk.c +1 -0
@@ -36,6 +36,7 @@ static int __init trace_printk_init(void/* Kick off printing in irq context */ irq_work_queue (&irqwork); +irq_work_sync (&irqwork);trace_printk ("This is a %s that will use trace_bprintk()\n" ,"static string" );
Greg Kroah-Hartman
maintainerPATCH 120/191 io_uring: use current task creds instead of allocating a new one
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
commit 0b8c0ec7eedcd8f9f1a1f238d87f9b512b09e71a upstream.
syzbot reports:
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN CPU: 0 PID: 9217 Comm: io_uring-sq Not tainted 5.4.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:creds_are_invalid kernel/cred.c:792 [inline] RIP: 0010:__validate_creds include/linux/cred.h:187 [inline] RIP: 0010:override_creds+0x9f/0x170 kernel/cred.c:550 Code: ac 25 00 81 fb 64 65 73 43 0f 85 a3 37 00 00 e8 17 ab 25 00 49 8d 7c 24 10 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e 96 00 00 00 41 8b 5c 24 10 bf RSP: 0018:ffff88809c45fda0 EFLAGS: 00010202 RAX: dffffc0000000000 RBX: 0000000043736564 RCX: ffffffff814f3318 RDX: 0000000000000002 RSI: ffffffff814f3329 RDI: 0000000000000010 RBP: ffff88809c45fdb8 R08: ffff8880a3aac240 R09: ffffed1014755849 R10: ffffed1014755848 R11: ffff8880a3aac247 R12: 0000000000000000 R13: ffff888098ab1600 R14: 0000000000000000 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff8880ae800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffd51c40664 CR3: 0000000092641000 CR4: 00000000001406f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: io_sq_thread+0x1c7/0xa20 fs/io_uring.c:3274 kthread+0x361/0x430 kernel/kthread.c:255 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352 Modules linked in: ---[ end trace f2e1a4307fbe2245 ]--- RIP: 0010:creds_are_invalid kernel/cred.c:792 [inline] RIP: 0010:__validate_creds include/linux/cred.h:187 [inline] RIP: 0010:override_creds+0x9f/0x170 kernel/cred.c:550 Code: ac 25 00 81 fb 64 65 73 43 0f 85 a3 37 00 00 e8 17 ab 25 00 49 8d 7c 24 10 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e 96 00 00 00 41 8b 5c 24 10 bf RSP: 0018:ffff88809c45fda0 EFLAGS: 00010202 RAX: dffffc0000000000 RBX: 0000000043736564 RCX: ffffffff814f3318 RDX: 0000000000000002 RSI: ffffffff814f3329 RDI: 0000000000000010 RBP: ffff88809c45fdb8 R08: ffff8880a3aac240 R09: ffffed1014755849 R10: ffffed1014755848 R11: ffff8880a3aac247 R12: 0000000000000000 R13: ffff888098ab1600 R14: 0000000000000000 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff8880ae800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffd51c40664 CR3: 0000000092641000 CR4: 00000000001406f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
which is caused by slab fault injection triggering a failure in prepare_creds(). We don't actually need to create a copy of the creds as we're not modifying it, we just need a reference on the current task creds. This avoids the failure case as well, and propagates the const throughout the stack.
--- fs/io_uring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/io_uring.c +2 -2
@@ -239,7 +239,7 @@ struct io_ring_ctx {struct user_struct *user; -struct cred *creds; +const struct cred *creds;struct completion ctx_done;
@@ -3876,7 +3876,7 @@ static int io_uring_create(unsigned entr ctx->account_mem = account_mem; ctx->user = user; - ctx->creds =prepare_creds (); + ctx->creds =get_current_cred ();if (!ctx->creds) { ret = -ENOMEM ; goto err;
Greg Kroah-Hartman
maintainerPATCH 121/191 mm/gup: fix memory leak in __gup_benchmark_ioctl
In reply to Greg Kroah-HartmanFrom: Navid Emamdoost <[email protected]>
commit a7c46c0c0e3d62f2764cd08b90934cd2aaaf8545 upstream.
In the implementation of __gup_benchmark_ioctl() the allocated pages should be released before returning in case of an invalid cmd. Release pages via kvfree().
--- mm/gup_benchmark.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
mm/gup_benchmark.c +6 -2
@@ -26,6 +26,7 @@ static int __gup_benchmark_ioctl(unsigneunsigned long i, nr_pages, addr, next;int nr;struct page **pages; +int ret =0 ;if (gup->size >ULONG_MAX )return -EINVAL ;
@@ -63,7 +64,9 @@ static int __gup_benchmark_ioctl(unsigne NULL);break ;default : -return -1 ; +kvfree (pages); + ret = -EINVAL ; + goto out; }if (nr <=0 )
@@ -85,7 +88,8 @@ static int __gup_benchmark_ioctl(unsigne gup->put_delta_usec =ktime_us_delta (end_time, start_time);kvfree (pages); -return 0 ; +out: +return ret; } static long gup_benchmark_ioctl(struct file *filep, unsigned int cmd,
Greg Kroah-Hartman
maintainerPATCH 122/191 apparmor: fix aa_xattrs_match() may sleep while holding a RCU lock
In reply to Greg Kroah-HartmanFrom: John Johansen <[email protected]>
commit 8c62ed27a12c00e3db1c9f04bc0f272bdbb06734 upstream.
aa_xattrs_match() is unfortunately calling vfs_getxattr_alloc() from a context protected by an rcu_read_lock. This can not be done as vfs_getxattr_alloc() may sleep regardles of the gfp_t value being passed to it.
Fix this by breaking the rcu_read_lock on the policy search when the xattr match feature is requested and restarting the search if a policy changes occur.
--- security/apparmor/apparmorfs.c | 2 - security/apparmor/domain.c | 80 +++++++++++++++++++++-------------------- security/apparmor/policy.c | 4 +- 3 files changed, 45 insertions(+), 41 deletions(-)
security/apparmor/apparmorfs.c +1 -1
@@ -593,7 +593,7 @@ static __poll_t ns_revision_poll(structvoid __aa_bump_ns_revision (struct aa_ns *ns) { - ns->revision++; +WRITE_ONCE (ns->revision, ns->revision +1 );wake_up_interruptible (&ns->wait); }
security/apparmor/domain.c +42 -38
135 lines not on this page · raw message
security/apparmor/policy.c +2 -2
@@ -1124,8 +1124,8 @@ ssize_t aa_remove_profiles(struct aa_nsif (!name) {/* remove namespace - can only happen if fqname[0] == ':' */ mutex_lock_nested (&ns->parent->lock, ns->level); -__aa_remove_ns (ns);__aa_bump_ns_revision (ns); +__aa_remove_ns (ns);mutex_unlock (&ns->parent->lock); }else {/* remove profile */
@@ -1137,9 +1137,9 @@ ssize_t aa_remove_profiles(struct aa_ns goto fail_ns_lock; } name = profile->base.hname; +__aa_bump_ns_revision (ns);__remove_profile (profile);__aa_labelset_update_subtree (ns); -__aa_bump_ns_revision (ns);mutex_unlock (&ns->lock); }
Greg Kroah-Hartman
maintainerPATCH 123/191 dmaengine: virt-dma: Fix access after free in vchan_complete()
In reply to Greg Kroah-HartmanFrom: Peter Ujfalusi <[email protected]>
commit 24461d9792c2c706092805ff1b067628933441bd upstream.
vchan_vdesc_fini() is freeing up 'vd' so the access to vd->tx_result is via already freed up memory.
Move the vchan_vdesc_fini() after invoking the callback to avoid this.
--- drivers/dma/virt-dma.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/dma/virt-dma.c +1 -2
@@ -104,9 +104,8 @@ static void vchan_complete(unsigned longdmaengine_desc_get_callback (&vd->tx, &cb);list_del (&vd->node); -vchan_vdesc_fini (vd); -dmaengine_desc_callback_invoke (&cb, &vd->tx_result); +vchan_vdesc_fini (vd); } }
Greg Kroah-Hartman
maintainerPATCH 124/191 gen_initramfs_list.sh: fix bad variable name error
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit cc976614f59bd8e45de8ce988a6bcb5de711d994 upstream.
Prior to commit 858805b336be ("kbuild: add $(BASH) to run scripts with bash-extension"), this shell script was almost always run by bash since bash is usually installed on the system by default.
Now, this script is run by sh, which might be a symlink to dash. On such distributions, the following code emits an error:
local dev=`LC_ALL=C ls -l "${location}"`You can reproduce the build error, for example by setting CONFIG_INITRAMFS_SOURCE="/dev".
GEN usr/initramfs_data.cpio.gz
./usr/gen_initramfs_list.sh: 131: local: 1: bad variable name make[1]: *** [usr/Makefile:61: usr/initramfs_data.cpio.gz] Error 2
This is because LC_ALL=C ls -l "${location}" contains spaces. Surrounding it with double-quotes fixes the error.
--- usr/gen_initramfs_list.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
usr/gen_initramfs_list.sh +1 -1
@@ -128,7 +128,7 @@ parse() { str="${ftype} ${name} ${location} ${str}" ;; "nod") - local dev=`LC_ALL=C ls -l "${location}"` + local dev="`LC_ALL=C ls -l "${location}"`" local maj=`field 5 ${dev}` local min=`field 6 ${dev}` maj=${maj%,}
Greg Kroah-Hartman
maintainerPATCH 125/191 ALSA: cs4236: fix error return comparison of an unsigned integer
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
commit d60229d84846a8399257006af9c5444599f64361 upstream.
The return from pnp_irq is an unsigned integer type resource_size_t and hence the error check for a positive non-error code is always going to be true. A check for a non-failure return from pnp_irq should in fact be for (resource_size_t)-1 rather than >= 0.
Addresses-Coverity: ("Unsigned compared against 0")
--- sound/isa/cs423x/cs4236.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/isa/cs423x/cs4236.c +2 -1
@@ -278,7 +278,8 @@ static int snd_cs423x_pnp_init_mpu(int d }else { mpu_port[dev] =pnp_port_start (pdev,0 );if (mpu_irq[dev] >=0 && -pnp_irq_valid (pdev,0 ) &&pnp_irq (pdev,0 ) >=0 ) { +pnp_irq_valid (pdev,0 ) && +pnp_irq (pdev,0 ) != (resource_size_t)-1 ) { mpu_irq[dev] =pnp_irq (pdev,0 ); }else { mpu_irq[dev] =-1 ;/* disable interrupt */
Greg Kroah-Hartman
maintainerPATCH 126/191 ALSA: pcm: Yet another missing check of non-cached buffer type
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 2406ff9b86aa1b77fe1a6d15f37195ac1fdb2a14 upstream.
For non-x86 architectures, SNDRV_DMA_TYPE_DEV_UC should be treated equivalent with SNDRV_DMA_TYPE_DEV, where the default mmap handler still checks only about SNDRV_DMA_TYPE_DEV. Make the check more proper.
Note that all existing users of *_UC buffer types are x86-only, so this doesn't fix any bug, but just for consistency.
--- sound/core/pcm_native.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/core/pcm_native.c +2 -1
@@ -3408,7 +3408,8 @@ int snd_pcm_lib_default_mmap(struct snd_#endif /* CONFIG_GENERIC_ALLOCATOR */ #ifndef CONFIG_X86 /* for avoiding warnings arch/x86/mm/pat.c */ if (IS_ENABLED (CONFIG_HAS_DMA ) && !substream->ops->page && - substream->dma_buffer.dev.type ==SNDRV_DMA_TYPE_DEV ) + (substream->dma_buffer.dev.type ==SNDRV_DMA_TYPE_DEV || + substream->dma_buffer.dev.type ==SNDRV_DMA_TYPE_DEV_UC )) return dma_mmap_coherent(substream->dma_buffer.dev.dev, area, substream->runtime->dma_area,
Greg Kroah-Hartman
maintainerPATCH 127/191 ALSA: firewire-motu: Correct a typo in the clock proc string
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 0929249e3be3bb82ee6cfec0025f4dde952210b3 upstream.
Just fix a typo of "S/PDIF" in the clock name string.
--- sound/firewire/motu/motu-proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/firewire/motu/motu-proc.c +1 -1
@@ -16,7 +16,7 @@ static const char *const clock_names[] = [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_OPT] = "S/PDIF on optical interface", [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_OPT_A] = "S/PDIF on optical interface A", [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_OPT_B] = "S/PDIF on optical interface B", - [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX] = "S/PCIF on coaxial interface", + [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX] = "S/PDIF on coaxial interface", [SND_MOTU_CLOCK_SOURCE_AESEBU_ON_XLR] = "AESEBU on XLR interface", [SND_MOTU_CLOCK_SOURCE_WORD_ON_BNC] = "Word clock on BNC interface", };
Greg Kroah-Hartman
maintainerPATCH 128/191 scsi: lpfc: Fix rpi release when deleting vport
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
commit 97acd0019d5dadd9c0e111c2083c889bfe548f25 upstream.
A prior use-after-free mailbox fix solved it's problem by null'ing a ndlp pointer. However, further testing has shown that this change causes a later state change to occasionally be skipped, which results in a reference count never being decremented thus the rpi is never released, which causes a vport delete to never succeed.
Revise the fix in the prior patch to no longer null the ndlp. Instead the RELEASE_RPI flag is set which will drive the release of the rpi.
Given the new code was added at a deep indentation level, refactor the code block using a new routine that avoids the indentation issues.
--- drivers/scsi/lpfc/lpfc_hbadisc.c | 88 ++++++++++++++++++++++++++------------- drivers/scsi/lpfc/lpfc_sli.c | 2 2 files changed, 61 insertions(+), 29 deletions(-)
drivers/scsi/lpfc/lpfc_hbadisc.c +59 -29
@@ -4844,6 +4844,44 @@ lpfc_nlp_logo_unreg(struct lpfc_hba *phb }/* +* Sets the mailbox completion handler to be used for the +* unreg_rpi command. The handler varies based on the state of +* the port and what will be happening to the rpi next. +*/ +static void +lpfc_set_unreg_login_mbx_cmpl (struct lpfc_hba *phba,struct lpfc_vport *vport, +struct lpfc_nodelist *ndlp,LPFC_MBOXQ_t *mbox) +{ +unsigned long iflags; + +if (ndlp->nlp_flag &NLP_ISSUE_LOGO ) { + mbox->ctx_ndlp = ndlp; + mbox->mbox_cmpl = lpfc_nlp_logo_unreg; + + }else if (phba->sli_rev ==LPFC_SLI_REV4 && + (!(vport->load_flag &FC_UNLOADING )) && + (bf_get (lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >= +LPFC_SLI_INTF_IF_TYPE_2 ) && + (kref_read (&ndlp->kref) >0 )) { + mbox->ctx_ndlp =lpfc_nlp_get (ndlp); + mbox->mbox_cmpl = lpfc_sli4_unreg_rpi_cmpl_clr; + }else { +if (vport->load_flag &FC_UNLOADING ) { +if (phba->sli_rev ==LPFC_SLI_REV4 ) { +spin_lock_irqsave (&vport->phba->ndlp_lock, + iflags); + ndlp->nlp_flag |=NLP_RELEASE_RPI ; +spin_unlock_irqrestore (&vport->phba->ndlp_lock, + iflags); + } +lpfc_nlp_get (ndlp); + } + mbox->ctx_ndlp = ndlp; + mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; + } +} + +/* * Free rpi associated with LPFC_NODELIST entry. * This routine is called from lpfc_freenode(), when we are removing * a LPFC_NODELIST entry. It is also called if the driver initiates a
@@ -4893,33 +4931,12 @@ lpfc_unreg_rpi(struct lpfc_vport *vport,lpfc_unreg_login (phba, vport->vpi, rpi, mbox); mbox->vport = vport; -if (ndlp->nlp_flag &NLP_ISSUE_LOGO ) { - mbox->ctx_ndlp = ndlp; - mbox->mbox_cmpl = lpfc_nlp_logo_unreg; - }else { -if (phba->sli_rev ==LPFC_SLI_REV4 && - (!(vport->load_flag &FC_UNLOADING )) && - (bf_get (lpfc_sli_intf_if_type, - &phba->sli4_hba.sli_intf) >= -LPFC_SLI_INTF_IF_TYPE_2 ) && - (kref_read (&ndlp->kref) >0 )) { - mbox->ctx_ndlp =lpfc_nlp_get (ndlp); - mbox->mbox_cmpl = - lpfc_sli4_unreg_rpi_cmpl_clr; -/* -* accept PLOGIs after unreg_rpi_cmpl -*/ - acc_plogi =0 ; - }else if (vport->load_flag &FC_UNLOADING ) { - mbox->ctx_ndlp =NULL ; - mbox->mbox_cmpl = - lpfc_sli_def_mbox_cmpl; - }else { - mbox->ctx_ndlp = ndlp; - mbox->mbox_cmpl = - lpfc_sli_def_mbox_cmpl; - } - } +lpfc_set_unreg_login_mbx_cmpl (phba, vport, ndlp, mbox); +if (mbox->mbox_cmpl == lpfc_sli4_unreg_rpi_cmpl_clr) +/* +* accept PLOGIs after unreg_rpi_cmpl +*/ + acc_plogi =0 ;if (((ndlp->nlp_DID & Fabric_DID_MASK) != Fabric_DID_MASK) && (!(vport->fc_flag &FC_OFFLINE_MODE )))
@@ -5060,6 +5077,7 @@ lpfc_cleanup_node(struct lpfc_vport *vpostruct lpfc_hba *phba = vport->phba;LPFC_MBOXQ_t *mb, *nextmb;struct lpfc_dmabuf *mp; +unsigned long iflags;/* Cleanup node for NPort <nlp_DID> */ lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
@@ -5141,8 +5159,20 @@ lpfc_cleanup_node(struct lpfc_vport *vpolpfc_cleanup_vports_rrqs (vport, ndlp);if (phba->sli_rev ==LPFC_SLI_REV4 ) ndlp->nlp_flag |=NLP_RELEASE_RPI ; -lpfc_unreg_rpi (vport, ndlp); - +if (!lpfc_unreg_rpi (vport, ndlp)) { +/* Clean up unregistered and non freed rpis */ +if ((ndlp->nlp_flag &NLP_RELEASE_RPI ) && + !(ndlp->nlp_rpi ==LPFC_RPI_ALLOC_ERROR )) { +lpfc_sli4_free_rpi (vport->phba, + ndlp->nlp_rpi); +spin_lock_irqsave (&vport->phba->ndlp_lock, + iflags); + ndlp->nlp_flag &= ~NLP_RELEASE_RPI ; + ndlp->nlp_rpi =LPFC_RPI_ALLOC_ERROR ; +spin_unlock_irqrestore (&vport->phba->ndlp_lock, + iflags); + } + }return 0 ; }
drivers/scsi/lpfc/lpfc_sli.c +2 -0
@@ -2526,6 +2526,8 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba * }else {__lpfc_sli_rpi_release (vport, ndlp); } +if (vport->load_flag &FC_UNLOADING ) +lpfc_nlp_put (ndlp); pmb->ctx_ndlp =NULL ; } }
Greg Kroah-Hartman
maintainerPATCH 129/191 exit: panic before exit_mm() on global init exit
In reply to Greg Kroah-HartmanFrom: chenqiwu <[email protected]>
commit 43cf75d96409a20ef06b756877a2e72b10a026fc upstream.
Currently, when global init and all threads in its thread-group have exited we panic via:do_exit()
-> exit_notify()
-> forget_original_parent()
-> find_child_reaper()
This makes it hard to extract a useable coredump for global init from a kernel crashdump because by the time we panic exit_mm() will have already released global init's mm.
This patch moves the panic futher up before exit_mm() is called. As was the case previously, we only panic when global init and all its threads in the thread-group have exited.
--- kernel/exit.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
kernel/exit.c +8 -4
@@ -517,10 +517,6 @@ static struct task_struct *find_child_re }write_unlock_irq (&tasklist_lock); -if (unlikely (pid_ns == &init_pid_ns)) { -panic ("Attempted to kill init! exitcode=0x%08x\n" , - father->signal->group_exit_code ?: father->exit_code); - }list_for_each_entry_safe (p, n, dead, ptrace_entry) {list_del_init (&p->ptrace_entry);
@@ -766,6 +762,14 @@ void __noreturn do_exit(long code)acct_update_integrals (tsk); group_dead =atomic_dec_and_test (&tsk->signal->live);if (group_dead) { +/* +* If the last thread of global init has exited, panic +* immediately to get a useable coredump. +*/ +if (unlikely (is_global_init (tsk))) +panic ("Attempted to kill init! exitcode=0x%08x\n" , + tsk->signal->group_exit_code ?: (int )code); +#ifdef CONFIG_POSIX_TIMERS hrtimer_cancel (&tsk->signal->real_timer);exit_itimers (tsk->signal);
Greg Kroah-Hartman
maintainerPATCH 130/191 arm64: Revert support for execute-only user mappings
In reply to Greg Kroah-HartmanFrom: Catalin Marinas <[email protected]>
commit 24cecc37746393432d994c0dbc251fb9ac7c5d72 upstream.
The ARMv8 64-bit architecture supports execute-only user permissions by clearing the PTE_USER and PTE_UXN bits, practically making it a mostly privileged mapping but from which user running at EL0 can still execute.
The downside, however, is that the kernel at EL1 inadvertently reading such mapping would not trip over the PAN (privileged access never) protection.
Revert the relevant bits from commit cab15ce604e5 ("arm64: Introduce execute-only page access permissions") so that PROT_EXEC implies PROT_READ (and therefore PTE_USER) until the architecture gains proper support for execute-only user mappings.
--- arch/arm64/include/asm/pgtable-prot.h | 5 ++--- arch/arm64/include/asm/pgtable.h | 10 +++------- arch/arm64/mm/fault.c | 2 +- mm/mmap.c | 6 ------ 4 files changed, 6 insertions(+), 17 deletions(-)
arch/arm64/include/asm/pgtable-prot.h +2 -3
@@ -85,13 +85,12 @@#define PAGE_SHARED_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN | PTE_WRITE)#define PAGE_READONLY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN | PTE_UXN)#define PAGE_READONLY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN) -#define PAGE_EXECONLY __pgprot(_PAGE_DEFAULT | PTE_RDONLY | PTE_NG | PTE_PXN)#define __P000 PAGE_NONE#define __P001 PAGE_READONLY#define __P010 PAGE_READONLY#define __P011 PAGE_READONLY -#define __P100 PAGE_EXECONLY +#define __P100 PAGE_READONLY_EXEC#define __P101 PAGE_READONLY_EXEC#define __P110 PAGE_READONLY_EXEC#define __P111 PAGE_READONLY_EXEC
@@ -100,7 +99,7 @@#define __S001 PAGE_READONLY#define __S010 PAGE_SHARED#define __S011 PAGE_SHARED -#define __S100 PAGE_EXECONLY +#define __S100 PAGE_READONLY_EXEC#define __S101 PAGE_READONLY_EXEC#define __S110 PAGE_SHARED_EXEC#define __S111 PAGE_SHARED_EXEC
arch/arm64/include/asm/pgtable.h +3 -7
@@ -96,12 +96,8 @@ extern unsigned long empty_zero_page[PAG#define pte_dirty (pte) (pte_sw_dirty(pte) || pte_hw_dirty(pte))#define pte_valid (pte) (!!(pte_val(pte) & PTE_VALID)) -/* -* Execute-only user mappings do not have the PTE_USER bit set. All valid -* kernel mappings have the PTE_UXN bit set. -*/ #define pte_valid_not_user (pte) \ - ((pte_val(pte) & (PTE_VALID | PTE_USER | PTE_UXN)) == (PTE_VALID | PTE_UXN)) + ((pte_val(pte) & (PTE_VALID | PTE_USER)) == PTE_VALID)#define pte_valid_young (pte) \ ((pte_val(pte) & (PTE_VALID | PTE_AF)) == (PTE_VALID | PTE_AF))#define pte_valid_user (pte) \
@@ -117,8 +113,8 @@ extern unsigned long empty_zero_page[PAG/* * p??_access_permitted() is true for valid user mappings (subject to the -* write permission check) other than user execute-only which do not have the -* PTE_USER bit set. PROT_NONE mappings do not have the PTE_VALID bit set. +* write permission check). PROT_NONE mappings do not have the PTE_VALID bit +* set. */ #define pte_access_permitted (pte, write) \ (pte_valid_user(pte) && (!(write) || pte_write(pte)))
arch/arm64/mm/fault.c +1 -1
@@ -454,7 +454,7 @@ static int __kprobes do_page_fault(unsigconst struct fault_info *inf;struct mm_struct *mm = current->mm;vm_fault_t fault, major =0 ; -unsigned long vm_flags =VM_READ |VM_WRITE ; +unsigned long vm_flags =VM_READ |VM_WRITE |VM_EXEC ;unsigned int mm_flags =FAULT_FLAG_ALLOW_RETRY |FAULT_FLAG_KILLABLE ;if (kprobe_page_fault (regs, esr))
mm/mmap.c +0 -6
@@ -90,12 +90,6 @@ static void unmap_region(struct mm_struc* MAP_PRIVATE r: (no) no r: (yes) yes r: (no) yes r: (no) yes * w: (no) no w: (no) no w: (copy) copy w: (no) no * x: (no) no x: (no) yes x: (no) yes x: (yes) yes -* -* On arm64, PROT_EXEC has the following behaviour for both MAP_SHARED and -* MAP_PRIVATE: -* r: (no) no -* w: (no) no -* x: (yes) yes */ pgprot_t protection_map[16 ]__ro_after_init = { __P000, __P001, __P010, __P011, __P100, __P101, __P110, __P111,
Greg Kroah-Hartman
maintainerPATCH 131/191 ftrace: Avoid potential division by zero in function profiler
In reply to Greg Kroah-HartmanFrom: Wen Yang <[email protected]>
commit e31f7939c1c27faa5d0e3f14519eaf7c89e8a69d upstream.
The ftrace_profile->counter is unsigned long and do_div truncates it to 32 bits, which means it can test non-zero and be truncated to zero for division. Fix this issue by using div64_ul() instead.
--- kernel/trace/ftrace.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/trace/ftrace.c +3 -3
@@ -524,8 +524,7 @@ static int function_stat_show(struct seq }#ifdef CONFIG_FUNCTION_GRAPH_TRACER - avg = rec->time; -do_div (avg, rec->counter); + avg =div64_ul (rec->time, rec->counter);if (tracing_thresh && (avg < tracing_thresh)) goto out;#endif
@@ -551,7 +550,8 @@ static int function_stat_show(struct seq* Divide only 1000 for ns^2 -> us^2 conversion. * trace_print_graph_duration will divide 1000 again. */ -do_div (stddev, rec->counter * (rec->counter -1 ) *1000 ); + stddev =div64_ul (stddev, + rec->counter * (rec->counter -1 ) *1000 ); }trace_seq_init (&s);
Greg Kroah-Hartman
maintainerPATCH 132/191 spi: spi-fsl-dspi: Fix 16-bit word order in 32-bit XSPI mode
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
commit ca59d5a51690d5b9340343dc36792a252e9414ae upstream.
When used in Extended SPI mode on LS1021A, the DSPI controller wants to have the least significant 16-bit word written first to the TX FIFO.
In fact, the LS1021A reference manual says:
33.5.2.4.2 Draining the TX FIFO
When Extended SPI Mode (DSPIx_MCR[XSPI]) is enabled, if the frame size of SPI Data to be transmitted is more than 16 bits, then it causes two Data entries to be popped from TX FIFO simultaneously which are transferred to the shift register. The first of the two popped entries forms the 16 least significant bits of the SPI frame to be transmitted.
So given the following TX buffer:
+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+ | 0x0 | 0x1 | 0x2 | 0x3 | 0x4 | 0x5 | 0x6 | 0x7 | 0x8 | 0x9 | 0xa | 0xb | +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+ | 32-bit word 1 | 32-bit word 2 | 32-bit word 3 | +-----------------------+-----------------------+-----------------------+
The correct way that a little-endian system should transmit it on the wire when bits_per_word is 32 is:
0x030201000x070605040x0b0a0908
But it is actually transmitted as following, as seen with a scope:
0x010003020x050407060x09080b0a
It appears that this patch has been submitted at least once before:
https://lkml.org/lkml/2018/9/21/286
but in that case Chuanhua Han did not manage to explain the problem clearly enough and the patch did not get merged, leaving XSPI mode broken.
--- drivers/spi/spi-fsl-dspi.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/spi/spi-fsl-dspi.c +4 -11
@@ -583,21 +583,14 @@ static void dspi_tcfq_write(struct fsl_d dspi->tx_cmd |=SPI_PUSHR_CMD_CTCNT ;if (dspi->devtype_data->xspi_mode && dspi->bits_per_word >16 ) { -/* Write two TX FIFO entries first, and then the corresponding -* CMD FIFO entry. +/* Write the CMD FIFO entry first, and then the two +* corresponding TX FIFO entries. */ u32 data =dspi_pop_tx (dspi); -if (dspi->cur_chip->ctar_val &SPI_CTAR_LSBFE ) { -/* LSB */ -tx_fifo_write (dspi, data &0xFFFF ); -tx_fifo_write (dspi, data >>16 ); - }else { -/* MSB */ -tx_fifo_write (dspi, data >>16 ); -tx_fifo_write (dspi, data &0xFFFF ); - }cmd_fifo_write (dspi); +tx_fifo_write (dspi, data &0xFFFF ); +tx_fifo_write (dspi, data >>16 ); }else {/* Write one entry to both TX FIFO and CMD FIFO * simultaneously.
Greg Kroah-Hartman
maintainerPATCH 133/191 drm/msm: include linux/sched/task.h
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit 70082a52f96a45650dfc3d8cdcd2c42bdac9f6f0 upstream.
Without this header file, compile-testing may run into a missing declaration:
drivers/gpu/drm/msm/msm_gpu.c:444:4: error: implicit declaration of function 'put_task_struct' [-Werror,-Wimplicit-function-declaration]
--- drivers/gpu/drm/msm/msm_gpu.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/msm/msm_gpu.c +1 -0
@@ -16,6 +16,7 @@#include <linux/pm_opp.h> #include <linux/devfreq.h> #include <linux/devcoredump.h> +#include <linux/sched/task.h> /* * Power Management:
Greg Kroah-Hartman
maintainerPATCH 134/191 PM / devfreq: Check NULL governor in available_governors_show
In reply to Greg Kroah-HartmanFrom: Leonard Crestez <[email protected]>
commit d68adc8f85cd757bd33c8d7b2660ad6f16f7f3dc upstream.
The governor is initialized after sysfs attributes become visible so in theory the governor field can be NULL here.
--- drivers/devfreq/devfreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/devfreq/devfreq.c +1 -1
@@ -1196,7 +1196,7 @@ static ssize_t available_governors_show(* The devfreq with immutable governor (e.g., passive) shows * only own governor. */ -if (df->governor->immutable) { +if (df->governor && df->governor->immutable) { count =scnprintf (&buf[count],DEVFREQ_NAME_LEN ,"%s " , df->governor_name);/*
Greg Kroah-Hartman
maintainerPATCH 135/191 sunrpc: fix crash when cache_head become valid before update
In reply to Greg Kroah-HartmanFrom: Pavel Tikhomirov <[email protected]>
commit 5fcaf6982d1167f1cd9b264704f6d1ef4c505d54 upstream.
I was investigating a crash in our Virtuozzo7 kernel which happened in in svcauth_unix_set_client. I found out that we access m_client field in ip_map structure, which was received from sunrpc_cache_lookup (we have a bit older kernel, now the code is in sunrpc_cache_add_entry), and these field looks uninitialized (m_client == 0x74 don't look like a pointer) but in the cache_head in flags we see 0x1 which is CACHE_VALID.
It looks like the problem appeared from our previous fix to sunrpc (1):
commit 4ecd55ea0742 ("sunrpc: fix cache_head leak due to queued request")
And we've also found a patch already fixing our patch (2):
commit d58431eacb22 ("sunrpc: don't mark uninitialised items as VALID.")
Though the crash is eliminated, I think the core of the problem is not completely fixed:
Neil in the patch (2) makes cache_head CACHE_NEGATIVE, before cache_fresh_locked which was added in (1) to fix crash. These way cache_is_valid won't say the cache is valid anymore and in svcauth_unix_set_client the function cache_check will return error instead of 0, and we don't count entry as initialized.
But it looks like we need to remove cache_fresh_locked completely in sunrpc_cache_lookup:
In (1) we've only wanted to make cache_fresh_unlocked->cache_dequeue so that cache_requests with no readers also release corresponding cache_head, to fix their leak. We with Vasily were not sure if cache_fresh_locked and cache_fresh_unlocked should be used in pair or not, so we've guessed to use them in pair.
Now we see that we don't want the CACHE_VALID bit set here by cache_fresh_locked, as "valid" means "initialized" and there is no initialization in sunrpc_cache_add_entry. Both expiry_time and last_refresh are not used in cache_fresh_unlocked code-path and also not required for the initial fix.
So to conclude cache_fresh_locked was called by mistake, and we can just safely remove it instead of crutching it with CACHE_NEGATIVE. It looks ideologically better for me. Hope I don't miss something here.
Here is our crash backtrace:
[13108726.326291] BUG: unable to handle kernel NULL pointer dereference at 0000000000000074 [13108726.326365] IP: [<ffffffffc01f79eb>] svcauth_unix_set_client+0x2ab/0x520 [sunrpc] [13108726.326448] PGD 0 [13108726.326468] Oops: 0002 [#1] SMP [13108726.326497] Modules linked in: nbd isofs xfs loop kpatch_cumulative_81_0_r1(O) xt_physdev nfnetlink_queue bluetooth rfkill ip6table_nat nf_nat_ipv6 ip_vs_wrr ip_vs_wlc ip_vs_sh nf_conntrack_netlink ip_vs_sed ip_vs_pe_sip nf_conntrack_sip ip_vs_nq ip_vs_lc ip_vs_lblcr ip_vs_lblc ip_vs_ftp ip_vs_dh nf_nat_ftp nf_conntrack_ftp iptable_raw xt_recent nf_log_ipv6 xt_hl ip6t_rt nf_log_ipv4 nf_log_common xt_LOG xt_limit xt_TCPMSS xt_tcpmss vxlan ip6_udp_tunnel udp_tunnel xt_statistic xt_NFLOG nfnetlink_log dummy xt_mark xt_REDIRECT nf_nat_redirect raw_diag udp_diag tcp_diag inet_diag netlink_diag af_packet_diag unix_diag rpcsec_gss_krb5 xt_addrtype ip6t_rpfilter ipt_REJECT nf_reject_ipv4 ip6t_REJECT nf_reject_ipv6 ebtable_nat ebtable_broute nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_mangle ip6table_raw nfsv4 [13108726.327173] dns_resolver cls_u32 binfmt_misc arptable_filter arp_tables ip6table_filter ip6_tables devlink fuse_kio_pcs ipt_MASQUERADE nf_nat_masquerade_ipv4 xt_nat iptable_nat nf_nat_ipv4 xt_comment nf_conntrack_ipv4 nf_defrag_ipv4 xt_wdog_tmo xt_multiport bonding xt_set xt_conntrack iptable_filter iptable_mangle kpatch(O) ebtable_filter ebt_among ebtables ip_set_hash_ip ip_set nfnetlink vfat fat skx_edac intel_powerclamp coretemp intel_rapl iosf_mbi kvm_intel kvm irqbypass fuse pcspkr ses enclosure joydev sg mei_me hpwdt hpilo lpc_ich mei ipmi_si shpchp ipmi_devintf ipmi_msghandler xt_ipvs acpi_power_meter ip_vs_rr nfsv3 nfsd auth_rpcgss nfs_acl nfs lockd grace fscache nf_nat cls_fw sch_htb sch_cbq sch_sfq ip_vs em_u32 nf_conntrack tun br_netfilter veth overlay ip6_vzprivnet ip6_vznetstat ip_vznetstat [13108726.327817] ip_vzprivnet vziolimit vzevent vzlist vzstat vznetstat vznetdev vzmon vzdev bridge pio_kaio pio_nfs pio_direct pfmt_raw pfmt_ploop1 ploop ip_tables ext4 mbcache jbd2 sd_mod crc_t10dif crct10dif_generic mgag200 i2c_algo_bit drm_kms_helper scsi_transport_iscsi 8021q syscopyarea sysfillrect garp sysimgblt fb_sys_fops mrp stp ttm llc bnx2x crct10dif_pclmul crct10dif_common crc32_pclmul crc32c_intel drm dm_multipath ghash_clmulni_intel uas aesni_intel lrw gf128mul glue_helper ablk_helper cryptd tg3 smartpqi scsi_transport_sas mdio libcrc32c i2c_core usb_storage ptp pps_core wmi sunrpc dm_mirror dm_region_hash dm_log dm_mod [last unloaded: kpatch_cumulative_82_0_r1] [13108726.328403] CPU: 35 PID: 63742 Comm: nfsd ve: 51332 Kdump: loaded Tainted: G W O ------------ 3.10.0-862.20.2.vz7.73.29 #1 73.29 [13108726.328491] Hardware name: HPE ProLiant DL360 Gen10/ProLiant DL360 Gen10, BIOS U32 10/02/2018 [13108726.328554] task: ffffa0a6a41b1160 ti: ffffa0c2a74bc000 task.ti: ffffa0c2a74bc000 [13108726.328610] RIP: 0010:[<ffffffffc01f79eb>] [<ffffffffc01f79eb>] svcauth_unix_set_client+0x2ab/0x520 [sunrpc] [13108726.328706] RSP: 0018:ffffa0c2a74bfd80 EFLAGS: 00010246 [13108726.328750] RAX: 0000000000000001 RBX: ffffa0a6183ae000 RCX: 0000000000000000 [13108726.328811] RDX: 0000000000000074 RSI: 0000000000000286 RDI: ffffa0c2a74bfcf0 [13108726.328864] RBP: ffffa0c2a74bfe00 R08: ffffa0bab8c22960 R09: 0000000000000001 [13108726.328916] R10: 0000000000000001 R11: 0000000000000001 R12: ffffa0a32aa7f000 [13108726.328969] R13: ffffa0a6183afac0 R14: ffffa0c233d88d00 R15: ffffa0c2a74bfdb4 [13108726.329022] FS: 0000000000000000(0000) GS:ffffa0e17f9c0000(0000) knlGS:0000000000000000 [13108726.329081] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [13108726.332311] CR2: 0000000000000074 CR3: 00000026a1b28000 CR4: 00000000007607e0 [13108726.334606] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [13108726.336754] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [13108726.338908] PKRU: 00000000 [13108726.341047] Call Trace: [13108726.343074] [<ffffffff8a2c78b4>] ? groups_alloc+0x34/0x110 [13108726.344837] [<ffffffffc01f5eb4>] svc_set_client+0x24/0x30 [sunrpc] [13108726.346631] [<ffffffffc01f2ac1>] svc_process_common+0x241/0x710 [sunrpc] [13108726.348332] [<ffffffffc01f3093>] svc_process+0x103/0x190 [sunrpc] [13108726.350016] [<ffffffffc07d605f>] nfsd+0xdf/0x150 [nfsd] [13108726.351735] [<ffffffffc07d5f80>] ? nfsd_destroy+0x80/0x80 [nfsd] [13108726.353459] [<ffffffff8a2bf741>] kthread+0xd1/0xe0 [13108726.355195] [<ffffffff8a2bf670>] ? create_kthread+0x60/0x60 [13108726.356896] [<ffffffff8a9556dd>] ret_from_fork_nospec_begin+0x7/0x21 [13108726.358577] [<ffffffff8a2bf670>] ? create_kthread+0x60/0x60 [13108726.360240] Code: 4c 8b 45 98 0f 8e 2e 01 00 00 83 f8 fe 0f 84 76 fe ff ff 85 c0 0f 85 2b 01 00 00 49 8b 50 40 b8 01 00 00 00 48 89 93 d0 1a 00 00 <f0> 0f c1 02 83 c0 01 83 f8 01 0f 8e 53 02 00 00 49 8b 44 24 38 [13108726.363769] RIP [<ffffffffc01f79eb>] svcauth_unix_set_client+0x2ab/0x520 [sunrpc] [13108726.365530] RSP <ffffa0c2a74bfd80> [13108726.367179] CR2: 0000000000000074
--- net/sunrpc/cache.c | 6 ------ 1 file changed, 6 deletions(-)
net/sunrpc/cache.c +0 -6
@@ -53,9 +53,6 @@ static void cache_init(struct cache_head h->last_refresh = now; } -static inline int cache_is_valid (struct cache_head *h); -static void cache_fresh_locked (struct cache_head *head,time_t expiry, -struct cache_detail *detail);static void cache_fresh_unlocked (struct cache_head *head,struct cache_detail *detail);
@@ -105,9 +102,6 @@ static struct cache_head *sunrpc_cache_aif (cache_is_expired (detail, tmp)) {hlist_del_init_rcu (&tmp->cache_list); detail->entries --; -if (cache_is_valid (tmp) == -EAGAIN ) -set_bit (CACHE_NEGATIVE , &tmp->flags); -cache_fresh_locked (tmp,0 , detail); freeme = tmp;break ; }
Greg Kroah-Hartman
maintainerPATCH 136/191 arm64: dts: qcom: msm8998-clamshell: Remove retention idle state
In reply to Greg Kroah-HartmanFrom: Jeffrey Hugo <[email protected]>
commit b40dd23f9a8987c8336df0a00e33f52b1f3f19ad upstream.
The retention idle state does not appear to be supported by the firmware present on the msm8998 laptops since the state is advertised as disabled in ACPI, and attempting to enable the state in DT is observed to result in boot hangs. Therefore, remove the state from use to address the observed issues.
--- arch/arm64/boot/dts/qcom/msm8998-clamshell.dtsi | 37 ++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
arch/arm64/boot/dts/qcom/msm8998-clamshell.dtsi +37 -0
@@ -23,6 +23,43 @@ }; }; +/* + * The laptop FW does not appear to support the retention state as it is + * not advertised as enabled in ACPI, and enabling it in DT can cause boot + * hangs. + */ +&CPU0 { + cpu-idle-states = <&LITTLE_CPU_SLEEP_1>; +}; + +&CPU1 { + cpu-idle-states = <&LITTLE_CPU_SLEEP_1>; +}; + +&CPU2 { + cpu-idle-states = <&LITTLE_CPU_SLEEP_1>; +}; + +&CPU3 { + cpu-idle-states = <&LITTLE_CPU_SLEEP_1>; +}; + +&CPU4 { + cpu-idle-states = <&BIG_CPU_SLEEP_1>; +}; + +&CPU5 { + cpu-idle-states = <&BIG_CPU_SLEEP_1>; +}; + +&CPU6 { + cpu-idle-states = <&BIG_CPU_SLEEP_1>; +}; + +&CPU7 { + cpu-idle-states = <&BIG_CPU_SLEEP_1>; +}; + &qusb2phy { status = "okay";
Greg Kroah-Hartman
maintainerPATCH 137/191 nfsd4: fix up replay_matches_cache()
In reply to Greg Kroah-HartmanFrom: Scott Mayhew <[email protected]>
commit 6e73e92b155c868ff7fce9d108839668caf1d9be upstream.
When running an nfs stress test, I see quite a few cached replies that don't match up with the actual request. The first comment in replay_matches_cache() makes sense, but the code doesn't seem to match... fix it.
This isn't exactly a bugfix, as the server isn't required to catch every case of a false retry. So, we may as well do this, but if this is fixing a problem then that suggests there's a client bug.
--- fs/nfsd/nfs4state.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
fs/nfsd/nfs4state.c +10 -5
@@ -3548,12 +3548,17 @@ static bool replay_matches_cache(struct (bool)seq->cachethis)return false;/* -* If there's an error than the reply can have fewer ops than -* the call. But if we cached a reply with *more* ops than the -* call you're sending us now, then this new call is clearly not -* really a replay of the old one: +* If there's an error then the reply can have fewer ops than +* the call. */ -if (slot->sl_opcnt < argp->opcnt) +if (slot->sl_opcnt < argp->opcnt && !slot->sl_status) +return false; +/* +* But if we cached a reply with *more* ops than the call you're +* sending us now, then this new call is clearly not really a +* replay of the old one: +*/ +if (slot->sl_opcnt > argp->opcnt)return false;/* This is the only check explicitly called by spec: */ if (!same_creds (&rqstp->rq_cred, &slot->sl_cred))
Greg Kroah-Hartman
maintainerPATCH 138/191 powerpc: Chunk calls to flush_dcache_range in arch_*_memory
In reply to Greg Kroah-HartmanFrom: Alastair D'Silva <[email protected]>
commit 076265907cf9633bbef861c7c2a1c26a8209f283 upstream.
When presented with large amounts of memory being hotplugged (in my test case, ~890GB), the call to flush_dcache_range takes a while (~50 seconds), triggering RCU stalls.
This patch breaks up the call into 1GB chunks, calling cond_resched() inbetween to allow the scheduler to run.
--- arch/powerpc/mm/mem.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-)
arch/powerpc/mm/mem.c +25 -2
@@ -104,6 +104,27 @@ int __weak remove_section_mapping(unsignreturn -ENODEV ; } +#define FLUSH_CHUNK_SIZE SZ_1G +/** +* flush_dcache_range_chunked(): Write any modified data cache blocks out to +* memory and invalidate them, in chunks of up to FLUSH_CHUNK_SIZE +* Does not invalidate the corresponding instruction cache blocks. +* +* @start: the start address +* @stop: the stop address (exclusive) +* @chunk: the max size of the chunks +*/ +static void flush_dcache_range_chunked (unsigned long start,unsigned long stop, +unsigned long chunk) +{ +unsigned long i; + +for (i = start; i < stop; i += chunk) { +flush_dcache_range (i,min (stop, start + chunk)); +cond_resched (); + } +} +int __ref arch_add_memory (int nid,u64 start,u64 size,struct mhp_restrictions *restrictions) {
@@ -120,7 +141,8 @@ int __ref arch_add_memory(int nid, u64 s start, start + size, rc);return -EFAULT ; } -flush_dcache_range (start, start + size); + +flush_dcache_range_chunked (start, start + size,FLUSH_CHUNK_SIZE );return __add_pages (nid, start_pfn, nr_pages, restrictions); }
@@ -136,7 +158,8 @@ void __ref arch_remove_memory(int nid, u/* Remove htab bolted mappings for this section of memory */ start = (unsigned long )__va (start); -flush_dcache_range (start, start + size); +flush_dcache_range_chunked (start, start + size,FLUSH_CHUNK_SIZE ); + ret =remove_section_mapping (start, start + size);WARN_ON_ONCE (ret);
Greg Kroah-Hartman
maintainerPATCH 139/191 HID: i2c-hid: Reset ALPS touchpads on resume
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
commit fd70466d37bf3fe0118d18c56ddde85b428f86cf upstream.
Commit 52cf93e63ee6 ("HID: i2c-hid: Don't reset device upon system resume") fixes many touchpads and touchscreens, however ALPS touchpads start to trigger IRQ storm after system resume.
Since it's total silence from ALPS, let's bring the old behavior back to ALPS touchpads.
--- drivers/hid/i2c-hid/i2c-hid-core.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/hid/i2c-hid/i2c-hid-core.c +11 -1
@@ -48,6 +48,7 @@#define I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV BIT(0)#define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET BIT(1)#define I2C_HID_QUIRK_BOGUS_IRQ BIT(4) +#define I2C_HID_QUIRK_RESET_ON_RESUME BIT(5)/* flags */ #define I2C_HID_STARTED 0
@@ -174,6 +175,8 @@ static const struct i2c_hid_quirks { I2C_HID_QUIRK_NO_IRQ_AFTER_RESET }, {USB_VENDOR_ID_ELAN ,HID_ANY_ID , I2C_HID_QUIRK_BOGUS_IRQ }, + { USB_VENDOR_ID_ALPS_JP, HID_ANY_ID, + I2C_HID_QUIRK_RESET_ON_RESUME }, { 0, 0 } };
@@ -1214,8 +1217,15 @@ static int i2c_hid_resume(struct device* solves "incomplete reports" on Raydium devices 2386:3118 and * 2386:4B33 and fixes various SIS touchscreens no longer sending * data after a suspend/resume. +* +* However some ALPS touchpads generate IRQ storm without reset, so +* let's still reset them here. */ - ret =i2c_hid_set_power (client,I2C_HID_PWR_ON ); +if (ihid->quirks &I2C_HID_QUIRK_RESET_ON_RESUME ) + ret =i2c_hid_hwreset (client); +else + ret =i2c_hid_set_power (client,I2C_HID_PWR_ON ); +if (ret)return ret;
Greg Kroah-Hartman
maintainerPATCH 140/191 net/sched: annotate lockless accesses to qdisc->empty
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
commit 90b2be27bb0e56483f335cc10fb59ec66882b949 upstream.
KCSAN reported the following race [1]
BUG: KCSAN: data-race in __dev_queue_xmit / net_tx_action
read to 0xffff8880ba403508 of 1 bytes by task 21814 on cpu 1:
__dev_xmit_skb net/core/dev.c:3389 [inline] __dev_queue_xmit+0x9db/0x1b40 net/core/dev.c:3761 dev_queue_xmit+0x21/0x30 net/core/dev.c:3825 neigh_hh_output include/net/neighbour.h:500 [inline] neigh_output include/net/neighbour.h:509 [inline] ip6_finish_output2+0x873/0xec0 net/ipv6/ip6_output.c:116 __ip6_finish_output net/ipv6/ip6_output.c:142 [inline] __ip6_finish_output+0x2d7/0x330 net/ipv6/ip6_output.c:127 ip6_finish_output+0x41/0x160 net/ipv6/ip6_output.c:152 NF_HOOK_COND include/linux/netfilter.h:294 [inline] ip6_output+0xf2/0x280 net/ipv6/ip6_output.c:175 dst_output include/net/dst.h:436 [inline] ip6_local_out+0x74/0x90 net/ipv6/output_core.c:179 ip6_send_skb+0x53/0x110 net/ipv6/ip6_output.c:1795 udp_v6_send_skb.isra.0+0x3ec/0xa70 net/ipv6/udp.c:1173 udpv6_sendmsg+0x1906/0x1c20 net/ipv6/udp.c:1471 inet6_sendmsg+0x6d/0x90 net/ipv6/af_inet6.c:576 sock_sendmsg_nosec net/socket.c:637 [inline] sock_sendmsg+0x9f/0xc0 net/socket.c:657 ___sys_sendmsg+0x2b7/0x5d0 net/socket.c:2311 __sys_sendmmsg+0x123/0x350 net/socket.c:2413 __do_sys_sendmmsg net/socket.c:2442 [inline] __se_sys_sendmmsg net/socket.c:2439 [inline] __x64_sys_sendmmsg+0x64/0x80 net/socket.c:2439 do_syscall_64+0xcc/0x370 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9
write to 0xffff8880ba403508 of 1 bytes by interrupt on cpu 0:
qdisc_run_begin include/net/sch_generic.h:160 [inline] qdisc_run include/net/pkt_sched.h:120 [inline] net_tx_action+0x2b1/0x6c0 net/core/dev.c:4551 __do_softirq+0x115/0x33f kernel/softirq.c:292 do_softirq_own_stack+0x2a/0x40 arch/x86/entry/entry_64.S:1082 do_softirq.part.0+0x6b/0x80 kernel/softirq.c:337 do_softirq kernel/softirq.c:329 [inline] __local_bh_enable_ip+0x76/0x80 kernel/softirq.c:189 local_bh_enable include/linux/bottom_half.h:32 [inline] rcu_read_unlock_bh include/linux/rcupdate.h:688 [inline] ip6_finish_output2+0x7bb/0xec0 net/ipv6/ip6_output.c:117 __ip6_finish_output net/ipv6/ip6_output.c:142 [inline] __ip6_finish_output+0x2d7/0x330 net/ipv6/ip6_output.c:127 ip6_finish_output+0x41/0x160 net/ipv6/ip6_output.c:152 NF_HOOK_COND include/linux/netfilter.h:294 [inline] ip6_output+0xf2/0x280 net/ipv6/ip6_output.c:175 dst_output include/net/dst.h:436 [inline] ip6_local_out+0x74/0x90 net/ipv6/output_core.c:179 ip6_send_skb+0x53/0x110 net/ipv6/ip6_output.c:1795 udp_v6_send_skb.isra.0+0x3ec/0xa70 net/ipv6/udp.c:1173 udpv6_sendmsg+0x1906/0x1c20 net/ipv6/udp.c:1471 inet6_sendmsg+0x6d/0x90 net/ipv6/af_inet6.c:576 sock_sendmsg_nosec net/socket.c:637 [inline] sock_sendmsg+0x9f/0xc0 net/socket.c:657 ___sys_sendmsg+0x2b7/0x5d0 net/socket.c:2311 __sys_sendmmsg+0x123/0x350 net/socket.c:2413 __do_sys_sendmmsg net/socket.c:2442 [inline] __se_sys_sendmmsg net/socket.c:2439 [inline] __x64_sys_sendmmsg+0x64/0x80 net/socket.c:2439 do_syscall_64+0xcc/0x370 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9
Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 21817 Comm: syz-executor.2 Not tainted 5.4.0-rc6+ #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- include/net/sch_generic.h | 6 +++--- net/core/dev.c | 2 +- net/sched/sch_generic.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
include/net/sch_generic.h +3 -3
@@ -149,8 +149,8 @@ static inline bool qdisc_is_percpu_statsstatic inline bool qdisc_is_empty (const struct Qdisc *qdisc) {if (qdisc_is_percpu_stats (qdisc)) -return qdisc->empty; -return !qdisc->q.qlen; +return READ_ONCE (qdisc->empty); +return !READ_ONCE (qdisc->q.qlen); }static inline bool qdisc_run_begin (struct Qdisc *qdisc)
@@ -158,7 +158,7 @@ static inline bool qdisc_run_begin(strucif (qdisc->flags &TCQ_F_NOLOCK ) {if (!spin_trylock (&qdisc->seqlock))return false; - qdisc->empty = false; +WRITE_ONCE (qdisc->empty, false); }else if (qdisc_is_running (qdisc)) {return false; }
net/core/dev.c +1 -1
@@ -3386,7 +3386,7 @@ static inline int __dev_xmit_skb(structqdisc_calculate_pkt_len (skb, q);if (q->flags &TCQ_F_NOLOCK ) { -if ((q->flags &TCQ_F_CAN_BYPASS ) && q->empty && +if ((q->flags &TCQ_F_CAN_BYPASS ) &&READ_ONCE (q->empty) &&qdisc_run_begin (q)) {if (unlikely (test_bit (__QDISC_STATE_DEACTIVATED, &q->state))) {
net/sched/sch_generic.c +1 -1
@@ -657,7 +657,7 @@ static struct sk_buff *pfifo_fast_dequeuif (likely (skb)) {qdisc_update_stats_at_dequeue (qdisc, skb); }else { - qdisc->empty = true; +WRITE_ONCE (qdisc->empty, true); }return skb;
Greg Kroah-Hartman
maintainerPATCH 141/191 kernel/module.c: wakeup processes in module_wq on module unload
In reply to Greg Kroah-HartmanFrom: Konstantin Khorenko <[email protected]>
commit 5d603311615f612320bb77bd2a82553ef1ced5b7 upstream.
Fix the race between load and unload a kernel module.
sys_delete_module()
try_stop_module()
mod->state = _GOING
add_unformed_module()
old = find_module_all() (old->state == _GOING =>
wait_event_interruptible())
During pre-condition finished_loading() rets 0 schedule() (never gets waken up later)
free_module()
mod->state = _UNFORMED
list_del_rcu(&mod->list)
(dels mod from "modules" list)
return
The race above leads to modprobe hanging forever on loading a module.
Error paths on loading module call wake_up_all(&module_wq) after freeing module, so let's do the same on straight module unload.
--- kernel/module.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/module.c +2 -0
@@ -1033,6 +1033,8 @@ SYSCALL_DEFINE2(delete_module, const chastrlcpy (last_unloaded_module, mod->name,sizeof (last_unloaded_module));free_module (mod); +/* someone could wait for the module in add_unformed_module() */ +wake_up_all (&module_wq);return 0 ; out:mutex_unlock (&module_mutex);
Greg Kroah-Hartman
maintainerPATCH 142/191 ACPI: sysfs: Change ACPI_MASKABLE_GPE_MAX to 0x100
In reply to Greg Kroah-HartmanFrom: Yunfeng Ye <[email protected]>
commit a7583e72a5f22470d3e6fd3b6ba912892242339f upstream.
The commit 0f27cff8597d ("ACPI: sysfs: Make ACPI GPE mask kernel parameter cover all GPEs") says:
"Use a bitmap of size 0xFF instead of a u64 for the GPE mask so 256
GPEs can be masked"
But the masking of GPE 0xFF it not supported and the check condition "gpe > ACPI_MASKABLE_GPE_MAX" is not valid because the type of gpe is u8.
So modify the macro ACPI_MASKABLE_GPE_MAX to 0x100, and drop the "gpe > ACPI_MASKABLE_GPE_MAX" check. In addition, update the docs "Format" for acpi_mask_gpe parameter.
--- Documentation/admin-guide/kernel-parameters.txt | 2 +- drivers/acpi/sysfs.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +1 -1
@@ -113,7 +113,7 @@ the GPE dispatcher. This facility can be used to prevent such uncontrolled GPE floodings. - Format: <int> + Format: <byte> acpi_no_auto_serialize [HW,ACPI] Disable auto-serialization of AML methods
drivers/acpi/sysfs.c +3 -3
@@ -819,14 +819,14 @@ end:* interface: * echo unmask > /sys/firmware/acpi/interrupts/gpe00 */ -#define ACPI_MASKABLE_GPE_MAX 0xFF +#define ACPI_MASKABLE_GPE_MAX 0x100 static DECLARE_BITMAP(acpi_masked_gpes_map, ACPI_MASKABLE_GPE_MAX) __initdata;static int __init acpi_gpe_set_masked_gpes (char *val) {u8 gpe; -if (kstrtou8 (val,0 , &gpe) || gpe >ACPI_MASKABLE_GPE_MAX ) +if (kstrtou8 (val,0 , &gpe))return -EINVAL ;set_bit (gpe, acpi_masked_gpes_map);
@@ -838,7 +838,7 @@ void __init acpi_gpe_apply_masked_gpes(v {acpi_handle handle;acpi_status status; -u8 gpe; +u16 gpe;for_each_set_bit (gpe, acpi_masked_gpes_map,ACPI_MASKABLE_GPE_MAX ) { status =acpi_get_gpe_device (gpe, &handle);
Greg Kroah-Hartman
maintainerPATCH 143/191 perf callchain: Fix segfault in thread__resolve_callchain_sample()
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
commit aceb98261ea7d9fe38f9c140c5531f0b13623832 upstream.
Do not dereference 'chain' when it is NULL.
$ perf record -e intel_pt//u -e branch-misses:u uname $ perf report --itrace=l --branch-history perf: Segmentation fault
--- tools/perf/util/machine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/machine.c +1 -1
@@ -2403,7 +2403,7 @@ static int thread__resolve_callchain_sam } check_calls: -if (callchain_param.order !=ORDER_CALLEE ) { +if (chain && callchain_param.order !=ORDER_CALLEE ) { err =find_prev_cpumode (chain, thread, cursor, parent, root_al, &cpumode, chain->nr - first_call);if (err)
Greg Kroah-Hartman
maintainerPATCH 144/191 iommu/vt-d: Remove incorrect PSI capability check
In reply to Greg Kroah-HartmanFrom: Lu Baolu <[email protected]>
commit f81b846dcd9a1e6d120f73970a9a98b7fcaaffba upstream.
The PSI (Page Selective Invalidation) bit in the capability register is only valid for second-level translation. Intel IOMMU supporting scalable mode must support page/address selective IOTLB invalidation for first-level translation. Remove the PSI capability check in SVA cache invalidation code.
--- drivers/iommu/intel-svm.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/iommu/intel-svm.c +1 -5
@@ -104,11 +104,7 @@ static void intel_flush_svm_range_dev (s {struct qi_desc desc; -/* -* Do PASID granu IOTLB invalidation if page selective capability is -* not available. -*/ -if (pages ==-1 || !cap_pgsel_inv (svm->iommu->cap)) { +if (pages ==-1 ) { desc.qw0 =QI_EIOTLB_PASID (svm->pasid) |QI_EIOTLB_DID (sdev->did) | QI_EIOTLB_GRAN(QI_GRAN_NONG_PASID) |
Greg Kroah-Hartman
maintainerPATCH 145/191 of: overlay: add_changeset_property() memory leak
In reply to Greg Kroah-HartmanFrom: Frank Rowand <[email protected]>
commit 637392a8506a3a7dd24ab9094a14f7522adb73b4 upstream.
No changeset entries are created for #address-cells and #size-cells properties, but the duplicated properties are never freed. This results in a memory leak which is detected by kmemleak:
unreferenced object 0x85887180 (size 64):
backtrace:
kmem_cache_alloc_trace+0x1fb/0x1fc
__of_prop_dup+0x25/0x7c
add_changeset_property+0x17f/0x370
build_changeset_next_level+0x29/0x20c
of_overlay_fdt_apply+0x32b/0x6b4
...--- drivers/of/overlay.c | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-)
drivers/of/overlay.c +20 -17
@@ -305,7 +305,6 @@ static int add_changeset_property(struct {struct property *new_prop =NULL , *prop;int ret =0 ; -bool check_for_non_overlay_node = false;if (target->in_livetree) if (!of_prop_cmp(overlay_prop->name, "name") ||
@@ -318,6 +317,25 @@ static int add_changeset_property(structelse prop =NULL ; +if (prop) { +if (!of_prop_cmp (prop->name,"#address-cells" )) { +if (!of_prop_val_eq (prop, overlay_prop)) { +pr_err ("ERROR: changing value of #address-cells is not allowed in %pOF\n" , + target->np); + ret = -EINVAL ; + } +return ret; + + }else if (!of_prop_cmp (prop->name,"#size-cells" )) { +if (!of_prop_val_eq (prop, overlay_prop)) { +pr_err ("ERROR: changing value of #size-cells is not allowed in %pOF\n" , + target->np); + ret = -EINVAL ; + } +return ret; + } + } +if (is_symbols_prop) {if (prop)return -EINVAL ;
@@ -330,33 +348,18 @@ static int add_changeset_property(structreturn -ENOMEM ;if (!prop) { - check_for_non_overlay_node = true;if (!target->in_livetree) { new_prop->next = target->np->deadprops; target->np->deadprops = new_prop; } ret =of_changeset_add_property (&ovcs->cset, target->np, new_prop); - }else if (!of_prop_cmp (prop->name,"#address-cells" )) { -if (!of_prop_val_eq (prop, new_prop)) { -pr_err ("ERROR: changing value of #address-cells is not allowed in %pOF\n" , - target->np); - ret = -EINVAL ; - } - }else if (!of_prop_cmp (prop->name,"#size-cells" )) { -if (!of_prop_val_eq (prop, new_prop)) { -pr_err ("ERROR: changing value of #size-cells is not allowed in %pOF\n" , - target->np); - ret = -EINVAL ; - } }else { - check_for_non_overlay_node = true; ret =of_changeset_update_property (&ovcs->cset, target->np, new_prop); } -if (check_for_non_overlay_node && - !of_node_check_flag (target->np,OF_OVERLAY )) +if (!of_node_check_flag (target->np,OF_OVERLAY ))pr_err ("WARNING: memory leak will occur if overlay removed, property: %pOF/%s\n" , target->np, new_prop->name);
Greg Kroah-Hartman
maintainerPATCH 146/191 cifs: Fix potential softlockups while refreshing DFS cache
In reply to Greg Kroah-HartmanFrom: Paulo Alcantara (SUSE) <[email protected]>
commit 84a1f5b1cc6fd7f6cd99fc5630c36f631b19fa60 upstream.
We used to skip reconnects on all SMB2_IOCTL commands due to SMB3+ FSCTL_VALIDATE_NEGOTIATE_INFO - which made sense since we're still establishing a SMB session.
However, when refresh_cache_worker() calls smb2_get_dfs_refer() and we're under reconnect, SMB2_ioctl() will not be able to get a proper status error (e.g. -EHOSTDOWN in case we failed to reconnect) but an -EAGAIN from cifs_send_recv() thus looping forever in refresh_cache_worker().
--- fs/cifs/smb2pdu.c | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-)
fs/cifs/smb2pdu.c +29 -12
@@ -252,7 +252,7 @@ smb2_reconnect(__le16 smb2_command, struif (tcon ==NULL )return 0 ; -if (smb2_command ==SMB2_TREE_CONNECT || smb2_command ==SMB2_IOCTL ) +if (smb2_command ==SMB2_TREE_CONNECT )return 0 ;if (tcon->tidStatus == CifsExiting) {
@@ -426,16 +426,9 @@ fill_small_buf(__le16 smb2_command, stru* SMB information in the SMB header. If the return code is zero, this * function must have filled in request_buf pointer. */ -static int -smb2_plain_req_init (__le16 smb2_command,struct cifs_tcon *tcon, -void **request_buf,unsigned int *total_len) +static int __smb2_plain_req_init (__le16 smb2_command,struct cifs_tcon *tcon, +void **request_buf,unsigned int *total_len) { -int rc; - - rc =smb2_reconnect (smb2_command, tcon); -if (rc) -return rc; -/* BB eventually switch this to SMB2 specific small buf size */ if (smb2_command ==SMB2_SET_INFO ) *request_buf =cifs_buf_get ();
@@ -456,7 +449,31 @@ smb2_plain_req_init(__le16 smb2_command,cifs_stats_inc (&tcon->num_smbs_sent); } -return rc; +return 0 ; +} + +static int smb2_plain_req_init (__le16 smb2_command,struct cifs_tcon *tcon, +void **request_buf,unsigned int *total_len) +{ +int rc; + + rc =smb2_reconnect (smb2_command, tcon); +if (rc) +return rc; + +return __smb2_plain_req_init (smb2_command, tcon, request_buf, + total_len); +} + +static int smb2_ioctl_req_init (u32 opcode,struct cifs_tcon *tcon, +void **request_buf,unsigned int *total_len) +{ +/* Skip reconnect only for FSCTL_VALIDATE_NEGOTIATE_INFO IOCTLs */ +if (opcode ==FSCTL_VALIDATE_NEGOTIATE_INFO ) { +return __smb2_plain_req_init (SMB2_IOCTL , tcon, request_buf, + total_len); + } +return smb2_plain_req_init (SMB2_IOCTL , tcon, request_buf, total_len); }/* For explanation of negotiate contexts see MS-SMB2 section 2.2.3.1 */
@@ -2661,7 +2678,7 @@ SMB2_ioctl_init(struct cifs_tcon *tcon,int rc;char *in_data_buf; - rc =smb2_plain_req_init (SMB2_IOCTL , tcon, (void **) &req, &total_len); + rc =smb2_ioctl_req_init (opcode, tcon, (void **) &req, &total_len);if (rc)return rc;
Greg Kroah-Hartman
maintainerPATCH 147/191 firmware: arm_scmi: Avoid double free in error flow
In reply to Greg Kroah-HartmanFrom: Wen Yang <[email protected]>
commit 8305e90a894f82c278c17e51a28459deee78b263 upstream.
If device_register() fails, both put_device() and kfree() are called, ending with a double free of the scmi_dev.
Calling kfree() is needed only when a failure happens between the allocation of the scmi_dev and its registration, so move it to there and remove it from the error flow.
--- drivers/firmware/arm_scmi/bus.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/firmware/arm_scmi/bus.c +4 -4
@@ -135,8 +135,10 @@ scmi_device_create(struct device_node *nreturn NULL ; id =ida_simple_get (&scmi_bus_id,1 ,0 ,GFP_KERNEL ); -if (id <0 ) - goto free_mem; +if (id <0 ) { +kfree (scmi_dev); +return NULL ; + } scmi_dev->id = id; scmi_dev->protocol_id = protocol;
@@ -154,8 +156,6 @@ scmi_device_create(struct device_node *n put_dev:put_device (&scmi_dev->dev);ida_simple_remove (&scmi_bus_id, id); -free_mem: -kfree (scmi_dev);return NULL ; }
Greg Kroah-Hartman
maintainerPATCH 148/191 xfs: dont check for AG deadlock for realtime files in bunmapi
In reply to Greg Kroah-HartmanFrom: Omar Sandoval <[email protected]>
commit 69ffe5960df16938bccfe1b65382af0b3de51265 upstream.
Commit 5b094d6dac04 ("xfs: fix multi-AG deadlock in xfs_bunmapi") added a check in __xfs_bunmapi() to stop early if we would touch multiple AGs in the wrong order. However, this check isn't applicable for realtime files. In most cases, it just makes us do unnecessary commits. However, without the fix from the previous commit ("xfs: fix realtime file data space leak"), if the last and second-to-last extents also happen to have different "AG numbers", then the break actually causes __xfs_bunmapi() to return without making any progress, which sends xfs_itruncate_extents_flags() into an infinite loop.
--- fs/xfs/libxfs/xfs_bmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/libxfs/xfs_bmap.c +1 -1
@@ -5300,7 +5300,7 @@ __xfs_bunmapi(* Make sure we don't touch multiple AGF headers out of order * in a single transaction, as that could cause AB-BA deadlocks. */ -if (!wasdel) { +if (!wasdel && !isrt) { agno =XFS_FSB_TO_AGNO (mp, del.br_startblock);if (prev_agno !=NULLAGNUMBER && prev_agno > agno)break ;
Greg Kroah-Hartman
maintainerPATCH 149/191 platform/x86: pmc_atom: Add Siemens CONNECT X300 to critclk_systems DMI table
In reply to Greg Kroah-HartmanFrom: Michael Haener <[email protected]>
commit e8796c6c69d129420ee94a1906b18d86b84644d4 upstream.
The CONNECT X300 uses the PMC clock for on-board components and gets stuck during boot if the clock is disabled. Therefore, add this device to the critical systems list.
Tested on CONNECT X300.
--- drivers/platform/x86/pmc_atom.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/platform/x86/pmc_atom.c +8 -0
@@ -429,6 +429,14 @@ static const struct dmi_system_id critcl DMI_MATCH(DMI_PRODUCT_VERSION, "6AV7882-0"), }, }, + { + .ident = "CONNECT X300", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "SIEMENS AG"), + DMI_MATCH(DMI_PRODUCT_VERSION, "A5E45074588"), + }, + }, + {/*sentinel*/ } };
Greg Kroah-Hartman
maintainerPATCH 150/191 netfilter: nf_queue: enqueue skbs with NULL dst
In reply to Greg Kroah-HartmanFrom: Marco Oliverio <[email protected]>
commit 0b9173f4688dfa7c5d723426be1d979c24ce3d51 upstream.
Bridge packets that are forwarded have skb->dst == NULL and get dropped by the check introduced by b60a77386b1d4868f72f6353d35dabe5fbe981f2 (net: make skb_dst_force return true when dst is refcounted).
To fix this we check skb_dst() before skb_dst_force(), so we don't drop skb packet with dst == NULL. This holds also for skb at the PRE_ROUTING hook so we remove the second check.
--- net/netfilter/nf_queue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_queue.c +1 -1
@@ -189,7 +189,7 @@ static int __nf_queue(struct sk_buff *sk goto err; } -if (!skb_dst_force (skb) && state->hook !=NF_INET_PRE_ROUTING ) { +if (skb_dst (skb) && !skb_dst_force (skb)) { status = -ENETDOWN ; goto err; }
Greg Kroah-Hartman
maintainerPATCH 151/191 net, sysctl: Fix compiler warning when only cBPF is present
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
commit 1148f9adbe71415836a18a36c1b4ece999ab0973 upstream.
proc_dointvec_minmax_bpf_restricted() has been firstly introduced in commit 2e4a30983b0f ("bpf: restrict access to core bpf sysctls") under CONFIG_HAVE_EBPF_JIT. Then, this ifdef has been removed in ede95a63b5e8 ("bpf: add bpf_jit_limit knob to restrict unpriv allocations"), because a new sysctl, bpf_jit_limit, made use of it. Finally, this parameter has become long instead of integer with fdadd04931c2 ("bpf: fix bpf_jit_limit knob for PAGE_SIZE >= 64K") and thus, a new proc_dolongvec_minmax_bpf_restricted() has been added.
With this last change, we got back to that proc_dointvec_minmax_bpf_restricted() is used only under CONFIG_HAVE_EBPF_JIT, but the corresponding ifdef has not been brought back.
So, in configurations like CONFIG_BPF_JIT=y && CONFIG_HAVE_EBPF_JIT=n since v4.20 we have:
CC net/core/sysctl_net_core.onet/core/sysctl_net_core.c:292:1: warning: ‘proc_dointvec_minmax_bpf_restricted’ defined but not used [-Wunused-function]
292 | proc_dointvec_minmax_bpf_restricted(struct ctl_table *table, int write,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Suppress this by guarding it with CONFIG_HAVE_EBPF_JIT again.
--- net/core/sysctl_net_core.c | 2 ++ 1 file changed, 2 insertions(+)
net/core/sysctl_net_core.c +2 -0
@@ -288,6 +288,7 @@ static int proc_dointvec_minmax_bpf_enabreturn ret; } +# ifdef CONFIG_HAVE_EBPF_JIT static int proc_dointvec_minmax_bpf_restricted(struct ctl_table *table, int write, void __user *buffer, size_t *lenp,
@@ -298,6 +299,7 @@ proc_dointvec_minmax_bpf_restricted(strureturn proc_dointvec_minmax (table, write, buffer, lenp, ppos); } +# endif /* CONFIG_HAVE_EBPF_JIT */ static int proc_dolongvec_minmax_bpf_restricted(struct ctl_table *table, int write,
Greg Kroah-Hartman
maintainerPATCH 152/191 watchdog: tqmx86_wdt: Fix build error
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
commit 9a6c274ac1c4346f5384f2290caeb42dc674c471 upstream.
If TQMX86_WDT is y and WATCHDOG_CORE is m, building fails:
drivers/watchdog/tqmx86_wdt.o: In function `tqmx86_wdt_probe':
tqmx86_wdt.c:(.text+0x46e): undefined reference to watchdog_init_timeout' tqmx86_wdt.c:(.text+0x4e0): undefined reference to devm_watchdog_register_device'
Select WATCHDOG_CORE to fix this.
--- drivers/watchdog/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/watchdog/Kconfig +1 -0
@@ -1444,6 +1444,7 @@ config SMSC37B787_WDT config TQMX86_WDT tristate "TQ-Systems TQMX86 Watchdog Timer" depends on X86 + select WATCHDOG_CORE help This is the driver for the hardware watchdog timer in the TQMX86 IO controller found on some of their ComExpress Modules.
Greg Kroah-Hartman
maintainerPATCH 153/191 regulator: axp20x: Fix axp20x_set_ramp_delay
In reply to Greg Kroah-HartmanFrom: Axel Lin <[email protected]>
commit 71dd2fe5dec171b34b71603a81bb46c24c498fde upstream.
Current code set incorrect bits when set ramp_delay for AXP20X_DCDC2, fix it.
--- drivers/regulator/axp20x-regulator.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/regulator/axp20x-regulator.c +6 -3
@@ -413,10 +413,13 @@ static int axp20x_set_ramp_delay(structint i;for (i =0 ; i < rate_count; i++) { -if (ramp <= slew_rates[i]) - cfg =AXP20X_DCDC2_LDO3_V_RAMP_LDO3_RATE (i); -else +if (ramp > slew_rates[i])break ; + +if (id ==AXP20X_DCDC2 ) + cfg =AXP20X_DCDC2_LDO3_V_RAMP_DCDC2_RATE (i); +else + cfg =AXP20X_DCDC2_LDO3_V_RAMP_LDO3_RATE (i); }if (cfg ==0xff ) {
Greg Kroah-Hartman
maintainerPATCH 154/191 regulator: bd70528: Remove .set_ramp_delay for bd70528_ldo_ops
In reply to Greg Kroah-HartmanFrom: Axel Lin <[email protected]>
commit 6f1ff76154b8b36033efcbf6453a71a3d28f52cd upstream.
The .set_ramp_delay should be for bd70528_buck_ops only. Setting .set_ramp_delay for for bd70528_ldo_ops causes problem because BD70528_MASK_BUCK_RAMP (0x10) overlaps with BD70528_MASK_LDO_VOLT (0x1f). So setting ramp_delay for LDOs may change the voltage output, fix it.
--- drivers/regulator/bd70528-regulator.c | 1 - 1 file changed, 1 deletion(-)
drivers/regulator/bd70528-regulator.c +0 -1
@@ -101,7 +101,6 @@ static const struct regulator_ops bd7052 .set_voltage_sel = regulator_set_voltage_sel_regmap, .get_voltage_sel = regulator_get_voltage_sel_regmap, .set_voltage_time_sel = regulator_set_voltage_time_sel, - .set_ramp_delay = bd70528_set_ramp_delay, };static const struct regulator_ops bd70528_led_ops = {
Greg Kroah-Hartman
maintainerPATCH 155/191 spi: uniphier: Fix FIFO threshold
In reply to Greg Kroah-HartmanFrom: Kunihiko Hayashi <[email protected]>
commit 9cd34efbd3012171c102910ce17ee632a3cccb44 upstream.
Rx threshold means the value to inform the receiver when the number of words in Rx FIFO is equal to or more than the value. Similarly, Tx threshold means the value to inform the sender when the number of words in Tx FIFO is equal to or less than the value. The controller triggers the driver to start the transfer.
In case of Rx, the driver wants to detect that the specified number of words N are in Rx FIFO, so the value of Rx threshold should be N. In case of Tx, the driver wants to detect that the same number of spaces as Rx are in Tx FIFO, so the value of Tx threshold should be (FIFO size - N).
For example, in order for the driver to receive at least 3 words from Rx FIFO, set 3 to Rx threshold.
+-+-+-+-+-+-+-+-+ | | | | | |*|*|*| +-+-+-+-+-+-+-+-+
In order for the driver to send at least 3 words to Tx FIFO, because it needs at least 3 spaces, set 8(FIFO size) - 3 = 5 to Tx threshold.
+-+-+-+-+-+-+-+-+ |*|*|*|*|*| | | | +-+-+-+-+-+-+-+-+
This adds new function uniphier_spi_set_fifo_threshold() to set threshold value to the register.
And more, FIFO counts by 'words', so this renames 'fill_bytes' with 'fill_words', and fixes the calculation using bytes_per_words.
--- drivers/spi/spi-uniphier.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-)
drivers/spi/spi-uniphier.c +19 -12
@@ -290,25 +290,32 @@ static void uniphier_spi_recv(struct uni } } -static void uniphier_spi_fill_tx_fifo (struct uniphier_spi_priv *priv) +static void uniphier_spi_set_fifo_threshold (struct uniphier_spi_priv *priv, +unsigned int threshold) { -unsigned int fifo_threshold, fill_bytes;u32 val; - fifo_threshold =DIV_ROUND_UP (priv->rx_bytes, -bytes_per_word (priv->bits_per_word)); - fifo_threshold =min (fifo_threshold,SSI_FIFO_DEPTH ); - - fill_bytes = fifo_threshold - (priv->rx_bytes - priv->tx_bytes); - -/* set fifo threshold */ val =readl (priv->base +SSI_FC ); val &= ~(SSI_FC_TXFTH_MASK |SSI_FC_RXFTH_MASK ); - val |=FIELD_PREP (SSI_FC_TXFTH_MASK , fifo_threshold); - val |=FIELD_PREP (SSI_FC_RXFTH_MASK , fifo_threshold); + val |=FIELD_PREP (SSI_FC_TXFTH_MASK ,SSI_FIFO_DEPTH - threshold); + val |=FIELD_PREP (SSI_FC_RXFTH_MASK , threshold);writel (val, priv->base +SSI_FC ); +} + +static void uniphier_spi_fill_tx_fifo (struct uniphier_spi_priv *priv) +{ +unsigned int fifo_threshold, fill_words; +unsigned int bpw =bytes_per_word (priv->bits_per_word); + + fifo_threshold =DIV_ROUND_UP (priv->rx_bytes, bpw); + fifo_threshold =min (fifo_threshold,SSI_FIFO_DEPTH ); + +uniphier_spi_set_fifo_threshold (priv, fifo_threshold); + + fill_words = fifo_threshold - +DIV_ROUND_UP (priv->rx_bytes - priv->tx_bytes, bpw); -while (fill_bytes--) +while (fill_words--)uniphier_spi_send (priv); }
Greg Kroah-Hartman
maintainerPATCH 156/191 regulator: axp20x: Fix AXP22x ELDO2 regulator enable bitmask
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
commit f40ddaa059fdfb472e3aeb733c6220d8e0633a47 upstream.
A copy-paste error was introduced when bitmasks were converted to macros, incorrectly setting the enable bitmask for ELDO2 to the one for ELDO1 for the AXP22x units.
Fix it by using the correct macro.
On affected boards, ELDO1 and/or ELDO2 are used to power the camera, which is currently unsupported.
--- drivers/regulator/axp20x-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/axp20x-regulator.c +1 -1
@@ -608,7 +608,7 @@ static const struct regulator_desc axp22 AXP22X_PWR_OUT_CTRL2, AXP22X_PWR_OUT_ELDO1_MASK),AXP_DESC (AXP22X ,ELDO2 ,"eldo2" ,"eldoin" ,700 ,3300 ,100 ,AXP22X_ELDO2_V_OUT ,AXP22X_ELDO2_V_OUT_MASK , -AXP22X_PWR_OUT_CTRL2 ,AXP22X_PWR_OUT_ELDO1_MASK ), +AXP22X_PWR_OUT_CTRL2 ,AXP22X_PWR_OUT_ELDO2_MASK ),AXP_DESC (AXP22X ,ELDO3 ,"eldo3" ,"eldoin" ,700 ,3300 ,100 ,AXP22X_ELDO3_V_OUT ,AXP22X_ELDO3_V_OUT_MASK , AXP22X_PWR_OUT_CTRL2, AXP22X_PWR_OUT_ELDO3_MASK),
Greg Kroah-Hartman
maintainerPATCH 157/191 powerpc/mm: Mark get_slice_psize() & slice_addr_is_low() as notrace
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
commit 91a063c956084fb21cf2523bce6892514e3f1799 upstream.
These slice routines are called from the SLB miss handler, which can lead to warnings from the IRQ code, because we have not reconciled the IRQ state properly:
WARNING: CPU: 72 PID: 30150 at arch/powerpc/kernel/irq.c:258 arch_local_irq_restore.part.0+0xcc/0x100
Modules linked in:
CPU: 72 PID: 30150 Comm: ftracetest Not tainted 5.5.0-rc2-gcc9x-g7e0165b2f1a9 #1
NIP: c00000000001d83c LR: c00000000029ab90 CTR: c00000000026cf90
REGS: c0000007eee3b960 TRAP: 0700 Not tainted (5.5.0-rc2-gcc9x-g7e0165b2f1a9)
MSR: 8000000000021033 <SF,ME,IR,DR,RI,LE> CR: 22242844 XER: 20000000
CFAR: c00000000001d780 IRQMASK: 0
...
NIP arch_local_irq_restore.part.0+0xcc/0x100
LR trace_graph_entry+0x270/0x340
Call Trace:
trace_graph_entry+0x254/0x340 (unreliable)
function_graph_enter+0xe4/0x1a0
prepare_ftrace_return+0xa0/0x130
ftrace_graph_caller+0x44/0x94 # (get_slice_psize())
slb_allocate_user+0x7c/0x100
do_slb_fault+0xf8/0x300
instruction_access_slb_common+0x140/0x180--- arch/powerpc/mm/slice.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/mm/slice.c +2 -2
@@ -50,7 +50,7 @@ static void slice_print_mask(const char#endif -static inline bool slice_addr_is_low (unsigned long addr) +static inline notrace bool slice_addr_is_low(unsigned long addr) {u64 tmp = (u64 )addr;
@@ -659,7 +659,7 @@ unsigned long arch_get_unmapped_area_top mm_ctx_user_psize(¤t->mm->context), 1); } -unsigned int get_slice_psize (struct mm_struct *mm,unsigned long addr) +unsigned int notrace get_slice_psize(struct mm_struct *mm, unsigned long addr) {unsigned char *psizes;int index, mask_index;
Greg Kroah-Hartman
maintainerPATCH 158/191 Bluetooth: btusb: fix PM leak in error case of setup
In reply to Greg Kroah-HartmanFrom: Oliver Neukum <[email protected]>
commit 3d44a6fd0775e6215e836423e27f8eedf8c871ea upstream.
If setup() fails a reference for runtime PM has already been taken. Proper use of the error handling in btusb_open()is needed. You cannot just return.
--- drivers/bluetooth/btusb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/bluetooth/btusb.c +2 -1
@@ -1200,7 +1200,7 @@ static int btusb_open(struct hci_dev *hdif (data->setup_on_usb) { err = data->setup_on_usb (hdev);if (err <0 ) -return err; + goto setup_fail; } data->intf->needs_remote_wakeup =1 ;
@@ -1239,6 +1239,7 @@ done: failed:clear_bit (BTUSB_INTR_RUNNING , &data->flags); +setup_fail:usb_autopm_put_interface (data->intf);return err; }
Greg Kroah-Hartman
maintainerPATCH 159/191 Bluetooth: delete a stray unlock
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit df66499a1fab340c167250a5743931dc50d5f0fa upstream.
We used to take a lock in amp_physical_cfm() but then we moved it to the caller function. Unfortunately the unlock on this error path was overlooked so it leads to a double unlock.
--- net/bluetooth/l2cap_core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
net/bluetooth/l2cap_core.c +1 -3
@@ -4936,10 +4936,8 @@ void __l2cap_physical_cfm(struct l2cap_cBT_DBG ("chan %p, result %d, local_amp_id %d, remote_amp_id %d" , chan, result, local_amp_id, remote_amp_id); -if (chan->state ==BT_DISCONN || chan->state ==BT_CLOSED ) { -l2cap_chan_unlock (chan); +if (chan->state ==BT_DISCONN || chan->state ==BT_CLOSED )return ; - }if (chan->state !=BT_CONNECTED ) {l2cap_do_create (chan, result, local_amp_id, remote_amp_id);