5.10.240-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainercover 5.10.240-rc1 review
This is the start of the stable review cycle for the 5.10.240 release. There are 208 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, 17 Jul 2025 13:07:32 +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.10.240-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.10.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.10.240-rc1
Borislav Petkov <[email protected]>
x86/process: Move the buffer clearing before MONITOR
Borislav Petkov <[email protected]>
KVM: SVM: Advertise TSA CPUID bits to guests
Borislav Petkov <[email protected]>
KVM: x86: add support for CPUID leaf 0x80000021
Borislav Petkov <[email protected]>
x86/bugs: Add a Transient Scheduler Attacks mitigation
Borislav Petkov <[email protected]>
x86/bugs: Rename MDS machinery to something more generic
Jann Horn <[email protected]>
x86/mm: Disable hugetlb page table sharing on 32-bit
Dongli Zhang <[email protected]>
vhost-scsi: protect vq->log_used with vq->mutex
Hans de Goede <[email protected]>
Input: atkbd - do not skip atkbd_deactivate() when skipping ATKBD_CMD_GETID
Chia-Lin Kao (AceLan) <[email protected]>
HID: quirks: Add quirk for 2 Chicony Electronics HP 5MP Cameras
Zhang Heng <[email protected]>
HID: Add IGNORE quirk for SMARTLINKTECHNOLOGY
Nicolas Pitre <[email protected]>
vt: add missing notification when switching back to text mode
Xiaowei Li <[email protected]>
net: usb: qmi_wwan: add SIMCom 8230C composition
Tiwei Bie <[email protected]>
um: vector: Reduce stack usage in vector_eth_configure()
Thomas Fourier <[email protected]>
atm: idt77252: Add missing `dma_map_error()`
Somnath Kotur <[email protected]>
bnxt_en: Set DMA unmap len correctly for XDP_REDIRECT
Shravya KN <[email protected]>
bnxt_en: Fix DCB ETS validation
Alok Tiwari <[email protected]>
net: ll_temac: Fix missing tx_pending check in ethtools_set_ringparam()
Sean Nyekjaer <[email protected]>
can: m_can: m_can_handle_lost_msg(): downgrade msg lost in rx message to debug level
Oleksij Rempel <[email protected]>
net: phy: microchip: limit 100M workaround to link-down events on LAN88xx
Kito Xu <[email protected]>
net: appletalk: Fix device refcount leak in atrtr_create()
Wang Jinchao <[email protected]>
md/raid1: Fix stack memory use after return in raid1_reshape
Daniil Dulov <[email protected]>
wifi: zd1211rw: Fix potential NULL pointer dereference in zd_mac_tx_to_dev()
Christian König <[email protected]>
dma-buf: fix timeout handling in dma_resv_wait_timeout v2
Nilton Perim Neto <[email protected]>
Input: xpad - support Acer NGR 200 Controller
Vicki Pfau <[email protected]>
Input: xpad - add VID for Turtle Beach controllers
Matt Reynolds <[email protected]>
Input: xpad - add support for Amazon Game Controller
Jakub Kicinski <[email protected]>
netlink: make sure we allow at least one dump skb
Kuniyuki Iwashima <[email protected]>
netlink: Fix rmem check in netlink_broadcast_deliver().
Uwe Kleine-König <[email protected]>
pwm: mediatek: Ensure to disable clocks in error path
Alexandre Belloni <[email protected]>
rtc: lib_test: add MODULE_LICENSE
Thomas Fourier <[email protected]>
ethernet: atl1: Add missing DMA mapping error checks and count errors
Rafael J. Wysocki <[email protected]>
Revert "ACPI: battery: negate current when discharging"
Kuen-Han Tsai <[email protected]>
usb: gadget: u_serial: Fix race condition in TTY wakeup
Matthew Brost <[email protected]>
drm/sched: Increment job count before swapping tail spsc queue
Bartosz Golaszewski <[email protected]>
pinctrl: qcom: msm: mark certain pins as invalid for interrupts
JP Kobryn <[email protected]>
x86/mce: Make sure CMCI banks are cleared during shutdown on Intel
Yazen Ghannam <[email protected]>
x86/mce: Don't remove sysfs if thresholding sysfs init fails
Yazen Ghannam <[email protected]>
x86/mce/amd: Fix threshold limit reset
Peter Zijlstra <[email protected]>
x86/its: FineIBT-paranoid vs ITS
Eric Biggers <[email protected]>
x86/its: Fix build errors when CONFIG_MODULES=n
Peter Zijlstra <[email protected]>
x86/its: Use dynamic thunks for indirect branches
Thomas Gleixner <[email protected]>
x86/modules: Set VM_FLUSH_RESET_PERMS in module_alloc()
Pawan Gupta <[email protected]>
x86/its: Add "vmexit" option to skip mitigation on some CPUs
Pawan Gupta <[email protected]>
x86/its: Enable Indirect Target Selection mitigation
Pawan Gupta <[email protected]>
x86/its: Fix undefined reference to cpu_wants_rethunk_at()
Pawan Gupta <[email protected]>
x86/its: Add support for ITS-safe return thunk
Josh Poimboeuf <[email protected]>
x86/alternatives: Remove faulty optimization
Borislav Petkov (AMD) <[email protected]>
x86/alternative: Optimize returns patching
Pawan Gupta <[email protected]>
x86/its: Add support for ITS-safe indirect thunk
Peter Zijlstra <[email protected]>
x86/alternatives: Teach text_poke_bp() to patch Jcc.d32 instructions
Peter Zijlstra <[email protected]>
x86/alternatives: Introduce int3_emulate_jcc()
Pawan Gupta <[email protected]>
x86/its: Enumerate Indirect Target Selection (ITS) bug
Daniel Sneddon <[email protected]>
x86/bhi: Define SPEC_CTRL_BHI_DIS_S
Pawan Gupta <[email protected]>
Documentation: x86/bugs/its: Add ITS documentation
David Howells <[email protected]>
rxrpc: Fix oops due to non-existence of prealloc backlog struct
Oleg Nesterov <[email protected]>
fs/proc: do_task_stat: use __for_each_thread()
Victor Nogueira <[email protected]>
net/sched: Abort __tc_modify_qdisc if parent class does not exist
Yue Haibing <[email protected]>
atm: clip: Fix NULL pointer dereference in vcc_sendmsg()
Kuniyuki Iwashima <[email protected]>
atm: clip: Fix infinite recursive call of clip_push().
Kuniyuki Iwashima <[email protected]>
atm: clip: Fix memory leak of struct clip_vcc.
Kuniyuki Iwashima <[email protected]>
atm: clip: Fix potential null-ptr-deref in to_atmarpd().
Oleksij Rempel <[email protected]>
net: phy: smsc: Fix link failure in forced mode with Auto-MDIX
Oleksij Rempel <[email protected]>
net: phy: smsc: Fix Auto-MDIX configuration when disabled by strap
Michal Luczaj <[email protected]>
vsock: Fix IOCTL_VM_SOCKETS_GET_LOCAL_CID to check also transport_local
Michal Luczaj <[email protected]>
vsock: Fix transport_* TOCTOU
Andra Paraschiv <[email protected]>
af_vsock: Assign the vsock transport considering the vsock address flags
Andra Paraschiv <[email protected]>
af_vsock: Set VMADDR_FLAG_TO_HOST flag on the receive path
Andra Paraschiv <[email protected]>
vm_sockets: Add VMADDR_FLAG_TO_HOST vsock flag
Andra Paraschiv <[email protected]>
vm_sockets: Add flags field in the vsock address data structure
Michal Luczaj <[email protected]>
vsock: Fix transport_{g2h,h2g} TOCTOU
Kuniyuki Iwashima <[email protected]>
tipc: Fix use-after-free in tipc_conn_close().
Kuniyuki Iwashima <[email protected]>
netlink: Fix wraparounds of sk->sk_rmem_alloc.
Al Viro <[email protected]>
fix proc_sys_compare() handling of in-lookup dentries
Peter Zijlstra <[email protected]>
perf: Revert to requiring CAP_SYS_ADMIN for uprobes
Shengjiu Wang <[email protected]>
ASoC: fsl_asrc: use internal measured ratio for non-ideal ratio mode
Kaustabh Chakraborty <[email protected]>
drm/exynos: exynos7_drm_decon: add vblank check in IRQ handling
Nathan Chancellor <[email protected]>
staging: rtl8723bs: Avoid memset() in aes_cipher() and aes_decipher()
Ricardo Ribalda <[email protected]>
media: uvcvideo: Rollback non processed entities on error
Ricardo Ribalda <[email protected]>
media: uvcvideo: Send control events for partial succeeds
Ricardo Ribalda <[email protected]>
media: uvcvideo: Return the number of processed controls
Seiji Nishikawa <[email protected]>
ACPI: PAD: fix crash in exit_round_robin()
Andrei Kuchynski <[email protected]>
usb: typec: displayport: Fix potential deadlock
Oliver Neukum <[email protected]>
Logitech C-270 even more broken
Mathias Nyman <[email protected]>
xhci: dbc: Flush queued requests before stopping dbc
Łukasz Bartosik <[email protected]>
xhci: dbctty: disable ECHO flag by default
Fushuai Wang <[email protected]>
dpaa2-eth: fix xdp_rxq_info leak
Ioana Ciornei <[email protected]>
net: dpaa2-eth: rearrange variable in dpaa2_eth_get_ethtool_stats
Radu Bulie <[email protected]>
dpaa2-eth: Update SINGLE_STEP register access
Radu Bulie <[email protected]>
dpaa2-eth: Update dpni_get_single_step_cfg command
Ioana Ciornei <[email protected]>
dpaa2-eth: rename dpaa2_eth_xdp_release_buf into dpaa2_eth_recycle_buf
Filipe Manana <[email protected]>
btrfs: use btrfs_record_snapshot_destroy() during rmdir
Filipe Manana <[email protected]>
btrfs: propagate last_unlink_trans earlier when doing a rmdir
Trond Myklebust <[email protected]>
NFSv4/flexfiles: Fix handling of NFS level errors in I/O
Tigran Mkrtchyan <[email protected]>
flexfiles/pNFS: update stats on NFS4ERR_DELAY for v4.1 DSes
Patrisious Haddad <[email protected]>
RDMA/mlx5: Fix vport loopback for MPV device
Maíra Canal <[email protected]>
drm/v3d: Disable interrupts before resetting the GPU
Sergey Senozhatsky <[email protected]>
mtk-sd: reset host->mrq on prepare_data() error
Masami Hiramatsu (Google) <[email protected]>
mtk-sd: Prevent memory corruption from DMA map failure
Yue Hu <[email protected]>
mmc: mediatek: use data instead of mrq parameter from msdc_{un}prepare_data()
Manivannan Sadhasivam <[email protected]>
regulator: gpio: Fix the out-of-bounds access to drvdata::gpiods
Uladzislau Rezki (Sony) <[email protected]>
rcu: Return early if callback is not specified
Rafael J. Wysocki <[email protected]>
ACPICA: Refuse to evaluate a method if arguments are missing
Johannes Berg <[email protected]>
wifi: ath6kl: remove WARN on bad firmware input
Johannes Berg <[email protected]>
wifi: mac80211: drop invalid source address OCB frames
Maurizio Lombardi <[email protected]>
scsi: target: Fix NULL pointer dereference in core_scsi3_decode_spec_i_port()
Madhavan Srinivasan <[email protected]>
powerpc: Fix struct termio related ioctl macros
Johannes Berg <[email protected]>
ata: pata_cs5536: fix build on 32-bit UML
Takashi Iwai <[email protected]>
ALSA: sb: Force to disable DMAs once when DMA mode is changed
Lion Ackermann <[email protected]>
net/sched: Always pass notifications when child class becomes empty
Thomas Fourier <[email protected]>
nui: Fix dma_mapping_error() check
Kohei Enju <[email protected]>
rose: fix dangling neighbour pointers in rose_rt_device_down()
Gustavo A. R. Silva <[email protected]>
net: rose: Fix fall-through warnings for Clang
Alok Tiwari <[email protected]>
enic: fix incorrect MTU comparison in enic_change_mtu()
Raju Rangoju <[email protected]>
amd-xgbe: align CL37 AN sequence as per databook
Dan Carpenter <[email protected]>
lib: test_objagg: Set error message in check_expect_hints_stats()
Janusz Krzysztofik <[email protected]>
drm/i915/gt: Fix timeline left held on VMA alloc error
Dan Carpenter <[email protected]>
drm/i915/selftests: Change mock_request() to return error pointers
James Clark <[email protected]>
spi: spi-fsl-dspi: Clear completion counter before initiating transfer
Marek Szyprowski <[email protected]>
drm/exynos: fimd: Guard display clock control with runtime PM calls
Filipe Manana <[email protected]>
btrfs: fix missing error handling when searching for inode refs during log replay
Patrisious Haddad <[email protected]>
RDMA/mlx5: Fix CC counters query for MPV
Bart Van Assche <[email protected]>
scsi: ufs: core: Fix spelling of a sysfs attribute name
Thomas Fourier <[email protected]>
scsi: qla4xxx: Fix missing DMA mapping error in qla4xxx_alloc_pdu()
Thomas Fourier <[email protected]>
scsi: qla2xxx: Fix DMA mapping test in qla24xx_get_port_database()
Benjamin Coddington <[email protected]>
NFSv4/pNFS: Fix a race to wake on NFS_LAYOUT_DRAIN
Kuniyuki Iwashima <[email protected]>
nfs: Clean up /proc/net/rpc/nfs when nfs_fs_proc_net_init() fails.
Mark Zhang <[email protected]>
RDMA/mlx5: Initialize obj_event->obj_sub_list before xa_insert
David Thompson <[email protected]>
platform/mellanox: mlxbf-tmfifo: fix vring_desc.len assignment
Masami Hiramatsu (Google) <[email protected]>
mtk-sd: Fix a pagefault in dma_unmap_sg() for not prepared data
RD Babiera <[email protected]>
usb: typec: altmodes/displayport: do not index invalid pin_assignments
Ulf Hansson <[email protected]>
Revert "mmc: sdhci: Disable SD card clock before changing parameters"
Victor Shih <[email protected]>
mmc: sdhci: Add a helper function for dump register in dynamic debug mode
HarshaVardhana S A <[email protected]>
vsock/vmci: Clear the vmci transport packet properly when initializing it
Mateusz Jończyk <[email protected]>
rtc: cmos: use spin_lock_irqsave in cmos_interrupt
Dev Jain <[email protected]>
arm64: Restrict pagetable teardown to avoid false warning
Brett A C Sheffield (Librecast) <[email protected]>
Revert "ipv6: save dontfrag in cork"
Nathan Chancellor <[email protected]>
s390: Add '-std=gnu11' to decompressor and purgatory CFLAGS
Dexuan Cui <[email protected]>
PCI: hv: Do not set PCI_COMMAND_MEMORY to reduce VM boot time
Aradhya Bhatia <[email protected]>
drm/bridge: cdns-dsi: Wait for Clk and Data Lanes to be ready
Aradhya Bhatia <[email protected]>
drm/bridge: cdns-dsi: Check return value when getting default PHY config
Aradhya Bhatia <[email protected]>
drm/bridge: cdns-dsi: Fix connecting to next bridge
Aradhya Bhatia <[email protected]>
drm/bridge: cdns-dsi: Fix the clock variable for mode_valid()
Jay Cornwall <[email protected]>
drm/amdkfd: Fix race in GWS queue scheduling
Thomas Zimmermann <[email protected]>
drm/udl: Unregister device before cleaning up on disconnect
Qiu-ji Chen <[email protected]>
drm/tegra: Fix a possible null pointer dereference
Thierry Reding <[email protected]>
drm/tegra: Assign plane type before registration
Qasim Ijaz <[email protected]>
HID: wacom: fix kobject reference count leak
Qasim Ijaz <[email protected]>
HID: wacom: fix memory leak on sysfs attribute creation failure
Qasim Ijaz <[email protected]>
HID: wacom: fix memory leak on kobject creation failure
Mark Harmstone <[email protected]>
btrfs: update superblock's device bytes_used when dropping chunk
Heinz Mauelshagen <[email protected]>
dm-raid: fix variable in journal device check
Frédéric Danis <[email protected]>
Bluetooth: L2CAP: Fix L2CAP MTU negotiation
Yao Zi <[email protected]>
dt-bindings: serial: 8250: Make clocks and clock-frequency exclusive
Kuniyuki Iwashima <[email protected]>
atm: Release atm_dev_mutex after removing procfs in atm_dev_deregister().
Simon Horman <[email protected]>
net: enetc: Correct endianness handling in _enetc_rd_reg64
Tiwei Bie <[email protected]>
um: ubd: Add missing error check in start_io_thread()
Stefano Garzarella <[email protected]>
vsock/uapi: fix linux/vm_sockets.h userspace compilation errors
Lachlan Hodges <[email protected]>
wifi: mac80211: fix beacon interval calculation overflow
Yuan Chen <[email protected]>
libbpf: Fix null pointer dereference in btf_dump__free on allocation failure
Al Viro <[email protected]>
attach_recursive_mnt(): do not lock the covering tree when sliding something under it
Youngjun Lee <[email protected]>
ALSA: usb-audio: Fix out-of-bounds read in snd_usb_get_audioformat_uac3()
Eric Dumazet <[email protected]>
atm: clip: prevent NULL deref in clip_push()
Wolfram Sang <[email protected]>
i2c: robotfuzz-osif: disable zero-length read messages
Wolfram Sang <[email protected]>
i2c: tiny-usb: disable zero-length read messages
Eric Dumazet <[email protected]>
net_sched: sch_sfq: reject invalid perturb period
Niklas Cassel <[email protected]>
PCI: cadence-ep: Correct PBA offset in .set_msix() callback
Long Li <[email protected]>
uio_hv_generic: Align ring size to system page
Saurabh Sengar <[email protected]>
uio_hv_generic: Query the ringbuffer size for device
Saurabh Sengar <[email protected]>
Drivers: hv: vmbus: Add utility function for querying ring size
Vitaly Kuznetsov <[email protected]>
Drivers: hv: Rename 'alloced' to 'allocated'
Haiyang Zhang <[email protected]>
Drivers: hv: vmbus: Fix duplicate CPU assignments within a device
Alexandru Ardelean <[email protected]>
uio: uio_hv_generic: use devm_kzalloc() for private data alloc
Shin'ichiro Kawasaki <[email protected]>
RDMA/iwcm: Fix use-after-free of work objects after cm_id destruction
Weihang Li <[email protected]>
RDMA/core: Use refcount_t instead of atomic_t on refcount of iwcm_id_private
Chao Yu <[email protected]>
f2fs: don't over-report free space or inodes in statvfs
Brett Werling <[email protected]>
can: tcan4x5x: fix power regulator retrieval during probe
Marek Szyprowski <[email protected]>
media: omap3isp: use sgtable-based scatterlist wrappers
Vasiliy Kovalev <[email protected]>
jfs: validate AG parameters in dbMount() to prevent crashes
Dave Kleikamp <[email protected]>
fs/jfs: consolidate sanity checking in dbMount
Amit Sunil Dhamne <[email protected]>
usb: typec: tcpm/tcpci_maxim: Fix bounds check in process_rx()
Junlin Yang <[email protected]>
usb: typec: tcpci_maxim: add terminating newlines to logging
Junlin Yang <[email protected]>
usb: typec: tcpci_maxim: remove redundant assignment
Badhri Jagan Sridharan <[email protected]>
usb: typec: tcpci_maxim: Fix uninitialized return variable
Wupeng Ma <[email protected]>
VMCI: fix race between vmci_host_setup_notify and vmci_ctx_unset_notify
George Kennedy <[email protected]>
VMCI: check context->notify_page after call to get_user_pages_fast() to avoid GPF
Dave Penkler <[email protected]>
usb: usbtmc: Fix read_stb function and get_stb ioctl
Dave Penkler <[email protected]>
USB: usbtmc: Add USBTMC_IOCTL_GET_STB
Dave Penkler <[email protected]>
USB: usbtmc: Fix reading stale status byte
Kees Cook <[email protected]>
ovl: Check for NULL d_inode() in ovl_dentry_upper()
Dmitry Kandybka <[email protected]>
ceph: fix possible integer overflow in ceph_zero_objects()
Vijendar Mukunda <[email protected]>
ALSA: hda: Add new pci id for AMD GPU display HD audio controller
Cezary Rojewski <[email protected]>
ALSA: hda: Ignore unsol events for cards being shut down
Jos Wang <[email protected]>
usb: typec: displayport: Receive DP Status Update NAK request exit dp altmode
Robert Hodaszi <[email protected]>
usb: cdc-wdm: avoid setting WDM_READ for ZLP-s
Andy Shevchenko <[email protected]>
usb: Add checks for snprintf() calls in usb_alloc_dev()
Chance Yang <[email protected]>
usb: common: usb-conn-gpio: use a unique name for usb connector device
Chen Yufeng <[email protected]>
usb: potential integer overflow in usbg_make_tpg()
Sami Tolvanen <[email protected]>
um: Add cmpxchg8b_emu and checksum functions to asm-prototypes.h
Jonathan Cameron <[email protected]>
iio: pressure: zpa2326: Use aligned_s64 for the timestamp
Linggang Zeng <[email protected]>
bcache: fix NULL pointer in cache_set_flush()
Yu Kuai <[email protected]>
md/md-bitmap: fix dm-raid max_write_behind setting
Thomas Gessler <[email protected]>
dmaengine: xilinx_dma: Set dma_device directions
Alexis Czezar Torreno <[email protected]>
hwmon: (pmbus/max34440) Fix support for max34451
Sven Schwermer <[email protected]>
leds: multicolor: Fix intensity setting while SW blinking
Krzysztof Kozlowski <[email protected]>
mfd: max14577: Fix wakeup source leaks on device unbind
Peng Fan <[email protected]>
mailbox: Not protect module_put with spin_lock_irqsave
Olga Kornievskaia <[email protected]>
NFSv4.2: fix listxattr to return selinux security label
Pali Rohár <[email protected]>
cifs: Fix cifs_query_path_info() for Windows NT servers
-------------
Diffstat:
Documentation/ABI/testing/sysfs-devices-system-cpu | 2 + Documentation/ABI/testing/sysfs-driver-ufs | 2 +- Documentation/admin-guide/hw-vuln/index.rst | 1 + .../hw-vuln/indirect-target-selection.rst | 156 +++++++++++ .../hw-vuln/processor_mmio_stale_data.rst | 4 +- Documentation/admin-guide/kernel-parameters.txt | 28 ++ Documentation/devicetree/bindings/serial/8250.yaml | 2 +- Makefile | 4 +- arch/arm64/mm/mmu.c | 3 +- arch/powerpc/include/uapi/asm/ioctls.h | 8 +- arch/s390/Makefile | 2 +- arch/s390/purgatory/Makefile | 2 +- arch/um/drivers/ubd_user.c | 2 +- arch/um/drivers/vector_kern.c | 42 +-- arch/um/include/asm/asm-prototypes.h | 5 + arch/x86/Kconfig | 22 +- arch/x86/entry/entry.S | 8 +- arch/x86/include/asm/alternative.h | 26 ++ arch/x86/include/asm/cpu.h | 13 + arch/x86/include/asm/cpufeature.h | 5 +- arch/x86/include/asm/cpufeatures.h | 14 +- arch/x86/include/asm/disabled-features.h | 2 +- arch/x86/include/asm/irqflags.h | 4 +- arch/x86/include/asm/msr-index.h | 13 +- arch/x86/include/asm/mwait.h | 19 +- arch/x86/include/asm/nospec-branch.h | 50 ++-- arch/x86/include/asm/required-features.h | 2 +- arch/x86/include/asm/text-patching.h | 31 +++ arch/x86/kernel/alternative.c | 308 ++++++++++++++++++++- arch/x86/kernel/cpu/amd.c | 58 ++++ arch/x86/kernel/cpu/bugs.c | 272 +++++++++++++++++- arch/x86/kernel/cpu/common.c | 77 +++++- arch/x86/kernel/cpu/mce/amd.c | 15 +- arch/x86/kernel/cpu/mce/core.c | 8 +- arch/x86/kernel/cpu/mce/intel.c | 1 + arch/x86/kernel/cpu/scattered.c | 1 + arch/x86/kernel/ftrace.c | 4 +- arch/x86/kernel/kprobes/core.c | 39 +-- arch/x86/kernel/module.c | 14 +- arch/x86/kernel/process.c | 15 +- arch/x86/kernel/static_call.c | 2 +- arch/x86/kernel/vmlinux.lds.S | 8 + arch/x86/kvm/cpuid.c | 31 ++- arch/x86/kvm/cpuid.h | 1 + arch/x86/kvm/svm/vmenter.S | 3 + arch/x86/kvm/vmx/vmx.c | 2 +- arch/x86/kvm/x86.c | 4 +- arch/x86/lib/retpoline.S | 39 +++ arch/x86/net/bpf_jit_comp.c | 8 +- arch/x86/um/asm/checksum.h | 3 + drivers/acpi/acpi_pad.c | 7 +- drivers/acpi/acpica/dsmethod.c | 7 + drivers/acpi/battery.c | 19 +- drivers/ata/pata_cs5536.c | 2 +- drivers/atm/idt77252.c | 5 + drivers/base/cpu.c | 10 + drivers/dma-buf/dma-resv.c | 2 +- drivers/dma/xilinx/xilinx_dma.c | 2 + drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c | 2 +- drivers/gpu/drm/bridge/cdns-dsi.c | 27 +- drivers/gpu/drm/exynos/exynos7_drm_decon.c | 4 + drivers/gpu/drm/exynos/exynos_drm_fimd.c | 12 + drivers/gpu/drm/i915/gt/intel_ring_submission.c | 3 +- drivers/gpu/drm/i915/selftests/i915_request.c | 20 +- drivers/gpu/drm/i915/selftests/mock_request.c | 2 +- drivers/gpu/drm/tegra/dc.c | 17 +- drivers/gpu/drm/tegra/hub.c | 4 +- drivers/gpu/drm/tegra/hub.h | 3 +- drivers/gpu/drm/udl/udl_drv.c | 2 +- drivers/gpu/drm/v3d/v3d_drv.h | 7 + drivers/gpu/drm/v3d/v3d_gem.c | 2 + drivers/gpu/drm/v3d/v3d_irq.c | 38 ++- drivers/hid/hid-ids.h | 5 + drivers/hid/hid-quirks.c | 3 + drivers/hid/wacom_sys.c | 6 +- drivers/hv/channel_mgmt.c | 121 +++++--- drivers/hv/hyperv_vmbus.h | 19 +- drivers/hv/vmbus_drv.c | 2 +- drivers/hwmon/pmbus/max34440.c | 48 +++- drivers/i2c/busses/i2c-robotfuzz-osif.c | 6 + drivers/i2c/busses/i2c-tiny-usb.c | 6 + drivers/iio/pressure/zpa2326.c | 2 +- drivers/infiniband/core/iwcm.c | 38 +-- drivers/infiniband/core/iwcm.h | 2 +- drivers/infiniband/hw/mlx5/counters.c | 2 +- drivers/infiniband/hw/mlx5/devx.c | 2 +- drivers/infiniband/hw/mlx5/main.c | 33 +++ drivers/input/joystick/xpad.c | 5 + drivers/input/keyboard/atkbd.c | 3 +- drivers/leds/led-class-multicolor.c | 3 +- drivers/mailbox/mailbox.c | 2 +- drivers/md/bcache/super.c | 7 +- drivers/md/dm-raid.c | 2 +- drivers/md/md-bitmap.c | 2 +- drivers/md/raid1.c | 1 + drivers/media/platform/omap3isp/ispccdc.c | 8 +- drivers/media/platform/omap3isp/ispstat.c | 6 +- drivers/media/usb/uvc/uvc_ctrl.c | 61 ++-- drivers/mfd/max14577.c | 1 + drivers/misc/vmw_vmci/vmci_host.c | 9 +- drivers/mmc/host/mtk-sd.c | 39 ++- drivers/mmc/host/sdhci.c | 9 +- drivers/mmc/host/sdhci.h | 16 ++ drivers/net/can/m_can/m_can.c | 2 +- drivers/net/can/m_can/tcan4x5x.c | 9 +- drivers/net/ethernet/amd/xgbe/xgbe-common.h | 2 + drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 9 + drivers/net/ethernet/amd/xgbe/xgbe.h | 4 +- drivers/net/ethernet/atheros/atlx/atl1.c | 78 ++++-- drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c | 2 + drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 2 +- drivers/net/ethernet/cisco/enic/enic_main.c | 4 +- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 141 ++++++++-- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h | 20 +- .../net/ethernet/freescale/dpaa2/dpaa2-ethtool.c | 18 +- drivers/net/ethernet/freescale/dpaa2/dpni-cmd.h | 6 +- drivers/net/ethernet/freescale/dpaa2/dpni.c | 2 + drivers/net/ethernet/freescale/dpaa2/dpni.h | 6 + drivers/net/ethernet/freescale/enetc/enetc_hw.h | 2 +- drivers/net/ethernet/sun/niu.c | 31 ++- drivers/net/ethernet/sun/niu.h | 4 + drivers/net/ethernet/xilinx/ll_temac_main.c | 2 +- drivers/net/phy/microchip.c | 2 +- drivers/net/phy/smsc.c | 28 +- drivers/net/usb/qmi_wwan.c | 1 + drivers/net/wireless/ath/ath6kl/bmi.c | 4 +- drivers/net/wireless/zydas/zd1211rw/zd_mac.c | 6 +- drivers/pci/controller/cadence/pcie-cadence-ep.c | 5 +- drivers/pci/controller/pci-hyperv.c | 17 +- drivers/pinctrl/qcom/pinctrl-msm.c | 20 ++ drivers/platform/mellanox/mlxbf-tmfifo.c | 3 +- drivers/pwm/pwm-mediatek.c | 15 +- drivers/regulator/gpio-regulator.c | 4 +- drivers/rtc/lib_test.c | 2 + drivers/rtc/rtc-cmos.c | 10 +- drivers/scsi/qla2xxx/qla_mbx.c | 2 +- drivers/scsi/qla4xxx/ql4_os.c | 2 + drivers/scsi/ufs/ufs-sysfs.c | 4 +- drivers/spi/spi-fsl-dspi.c | 11 +- drivers/staging/rtl8723bs/core/rtw_security.c | 46 +-- drivers/target/target_core_pr.c | 4 +- drivers/tty/vt/vt.c | 1 + drivers/uio/uio_hv_generic.c | 18 +- drivers/usb/class/cdc-wdm.c | 23 +- drivers/usb/class/usbtmc.c | 53 ++-- drivers/usb/common/usb-conn-gpio.c | 25 +- drivers/usb/core/quirks.c | 3 +- drivers/usb/core/usb.c | 14 +- drivers/usb/gadget/function/f_tcm.c | 4 +- drivers/usb/gadget/function/u_serial.c | 6 +- drivers/usb/host/xhci-dbgcap.c | 4 + drivers/usb/host/xhci-dbgtty.c | 1 + drivers/usb/typec/altmodes/displayport.c | 5 +- drivers/usb/typec/tcpm/tcpci_maxim.c | 20 +- drivers/vhost/scsi.c | 7 +- fs/btrfs/inode.c | 36 +-- fs/btrfs/tree-log.c | 4 +- fs/btrfs/volumes.c | 6 + fs/ceph/file.c | 2 +- fs/cifs/misc.c | 8 + fs/f2fs/super.c | 30 +- fs/jfs/jfs_dmap.c | 41 +-- fs/namespace.c | 8 +- fs/nfs/flexfilelayout/flexfilelayout.c | 121 +++++--- fs/nfs/inode.c | 17 +- fs/nfs/nfs4proc.c | 12 +- fs/nfs/pnfs.c | 4 +- fs/overlayfs/util.c | 4 +- fs/proc/array.c | 6 +- fs/proc/inode.c | 2 +- fs/proc/proc_sysctl.c | 18 +- include/drm/spsc_queue.h | 4 +- include/linux/cpu.h | 3 + include/linux/hyperv.h | 2 + include/linux/ipv6.h | 1 - include/linux/module.h | 5 + include/linux/usb/typec_dp.h | 1 + include/uapi/linux/usb/tmc.h | 2 + include/uapi/linux/vm_sockets.h | 30 +- kernel/events/core.c | 2 +- kernel/rcu/tree.c | 4 + lib/test_objagg.c | 4 +- net/appletalk/ddp.c | 1 + net/atm/clip.c | 75 +++-- net/atm/resources.c | 3 +- net/bluetooth/l2cap_core.c | 9 +- net/ipv6/ip6_output.c | 9 +- net/mac80211/rx.c | 4 + net/mac80211/util.c | 2 +- net/netlink/af_netlink.c | 90 +++--- net/rose/rose_route.c | 15 +- net/rxrpc/call_accept.c | 3 + net/sched/sch_api.c | 42 +-- net/sched/sch_sfq.c | 10 +- net/tipc/topsrv.c | 2 + net/vmw_vsock/af_vsock.c | 78 +++++- net/vmw_vsock/vmci_transport.c | 4 +- sound/isa/sb/sb16_main.c | 4 + sound/pci/hda/hda_bind.c | 2 +- sound/pci/hda/hda_intel.c | 3 + sound/soc/fsl/fsl_asrc.c | 3 +- sound/usb/stream.c | 2 + tools/lib/bpf/btf_dump.c | 3 + 203 files changed, 2697 insertions(+), 809 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/208 cifs: Fix cifs_query_path_info() for Windows NT servers
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pali Rohár <[email protected]>
[ Upstream commit a3e771afbb3bce91c8296828304903e7348003fe ]
For TRANS2 QUERY_PATH_INFO request when the path does not exist, the Windows NT SMB server returns error response STATUS_OBJECT_NAME_NOT_FOUND or ERRDOS/ERRbadfile without the SMBFLG_RESPONSE flag set. Similarly it returns STATUS_DELETE_PENDING when the file is being deleted. And looks like that any error response from TRANS2 QUERY_PATH_INFO does not have SMBFLG_RESPONSE flag set.
So relax check in check_smb_hdr() for detecting if the packet is response for this special case.
This change fixes stat() operation against Windows NT SMB servers and also all operations which depends on -ENOENT result from stat like creat() or mkdir().
--- fs/cifs/misc.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/cifs/misc.c +8 -0
@@ -310,6 +310,14 @@ check_smb_hdr(struct smb_hdr *smb)if (smb->Command ==SMB_COM_LOCKING_ANDX )return 0 ; +/* +* Windows NT server returns error resposne (e.g. STATUS_DELETE_PENDING +* or STATUS_OBJECT_NAME_NOT_FOUND or ERRDOS/ERRbadfile or any other) +* for some TRANS2 requests without the RESPONSE flag set in header. +*/ +if (smb->Command ==SMB_COM_TRANSACTION2 && smb->Status.CifsError !=0 ) +return 0 ; +cifs_dbg (VFS ,"Server sent request, not response. mid=%u\n" ,get_mid (smb));return 1 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 2/208 NFSv4.2: fix listxattr to return selinux security label
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olga Kornievskaia <[email protected]>
[ Upstream commit 243fea134633ba3d64aceb4c16129c59541ea2c6 ]
Currently, when NFS is queried for all the labels present on the file via a command example "getfattr -d -m . /mnt/testfile", it does not return the security label. Yet when asked specifically for the label (getfattr -n security.selinux) it will be returned. Include the security label when all attributes are queried.
--- fs/nfs/nfs4proc.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +10 -2
@@ -10378,7 +10378,7 @@ const struct nfs4_minor_version_ops *nfs_v4_minor_ops[] = {static ssize_t nfs4_listxattr (struct dentry *dentry,char *list,size_t size) { -ssize_t error, error2, error3; +ssize_t error, error2, error3, error4;size_t left = size; error =generic_listxattr (dentry, list, left);
@@ -10401,8 +10401,16 @@ static ssize_t nfs4_listxattr(struct dentry *dentry, char *list, size_t size) error3 =nfs4_listxattr_nfs4_user (d_inode (dentry), list, left);if (error3 <0 )return error3; +if (list) { + list += error3; + left -= error3; + } + + error4 =security_inode_listsecurity (d_inode (dentry), list, left); +if (error4 <0 ) +return error4; - error += error2 + error3; + error += error2 + error3 + error4;if (size && error > size)return -ERANGE ;return error;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 3/208 mailbox: Not protect module_put with spin_lock_irqsave
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit dddbd233e67e792bb0a3f9694a4707e6be29b2c6 ]
&chan->lock is not supposed to protect 'chan->mbox'. And in __mbox_bind_client, try_module_get is also not protected by &chan->lock. So move module_put out of the lock protected region.
--- drivers/mailbox/mailbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mailbox/mailbox.c +1 -1
@@ -459,8 +459,8 @@ void mbox_free_channel(struct mbox_chan *chan)if (chan->txdone_method ==TXDONE_BY_ACK ) chan->txdone_method =TXDONE_BY_POLL ; -module_put (chan->mbox->dev->driver->owner);spin_unlock_irqrestore (&chan->lock, flags); +module_put (chan->mbox->dev->driver->owner); }EXPORT_SYMBOL_GPL (mbox_free_channel);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 4/208 mfd: max14577: Fix wakeup source leaks on device unbind
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit d905d06e64b0eb3da43af6186c132f5282197998 ]
Device can be unbound, so driver must also release memory for the wakeup source.
--- drivers/mfd/max14577.c | 1 + 1 file changed, 1 insertion(+)
drivers/mfd/max14577.c +1 -0
@@ -467,6 +467,7 @@ static int max14577_i2c_remove(struct i2c_client *i2c) {struct max14577 *max14577 =i2c_get_clientdata (i2c); +device_init_wakeup (max14577->dev, false);mfd_remove_devices (max14577->dev);regmap_del_irq_chip (max14577->irq, max14577->irq_data);if (max14577->dev_type ==MAXIM_DEVICE_TYPE_MAX77836 )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 5/208 leds: multicolor: Fix intensity setting while SW blinking
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Schwermer <[email protected]>
[ Upstream commit e35ca991a777ef513040cbb36bc8245a031a2633 ]
When writing to the multi_intensity file, don't unconditionally call led_set_brightness. By only doing this if blinking is inactive we prevent blinking from stopping if the blinking is in its off phase while the file is written.
Instead, if blinking is active, the changed intensity values are applied upon the next blink. This is consistent with changing the brightness on monochrome LEDs with active blinking.
--- drivers/leds/led-class-multicolor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/leds/led-class-multicolor.c +2 -1
@@ -59,7 +59,8 @@ static ssize_t multi_intensity_store(struct device *dev,for (i =0 ; i < mcled_cdev->num_colors; i++) mcled_cdev->subled_info[i].intensity = intensity_value[i]; -led_set_brightness (led_cdev, led_cdev->brightness); +if (!test_bit (LED_BLINK_SW , &led_cdev->work_flags)) +led_set_brightness (led_cdev, led_cdev->brightness); ret = size; err_out:mutex_unlock (&led_cdev->led_access);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 6/208 hwmon: (pmbus/max34440) Fix support for max34451
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexis Czezar Torreno <[email protected]>
[ Upstream commit 19932f844f3f51646f762f3eac4744ec3a405064 ]
The max344** family has an issue with some PMBUS address being switched. This includes max34451 however version MAX34451-NA6 and later has this issue fixed and this commit supports that update.
--- drivers/hwmon/pmbus/max34440.c | 48 +++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 4 deletions(-)
drivers/hwmon/pmbus/max34440.c +44 -4
@@ -34,16 +34,21 @@ enum chips { max34440, max34441, max34446, max34451, max34460, max34461 };/* * The whole max344* family have IOUT_OC_WARN_LIMIT and IOUT_OC_FAULT_LIMIT * swapped from the standard pmbus spec addresses. +* For max34451, version MAX34451ETNA6+ and later has this issue fixed. */ #define MAX34440_IOUT_OC_WARN_LIMIT 0x46#define MAX34440_IOUT_OC_FAULT_LIMIT 0x4A +#define MAX34451ETNA6_MFR_REV 0x0012 +#define MAX34451_MFR_CHANNEL_CONFIG 0xe4#define MAX34451_MFR_CHANNEL_CONFIG_SEL_MASK 0x3fstruct max34440_data {int id;struct pmbus_driver_info info; +u8 iout_oc_warn_limit; +u8 iout_oc_fault_limit; };#define to_max34440_data (x) container_of(x, struct max34440_data, info)
@@ -60,11 +65,11 @@ static int max34440_read_word_data(struct i2c_client *client, int page,switch (reg) {case PMBUS_IOUT_OC_FAULT_LIMIT : ret =pmbus_read_word_data (client, page, phase, -MAX34440_IOUT_OC_FAULT_LIMIT ); + data->iout_oc_fault_limit);break ;case PMBUS_IOUT_OC_WARN_LIMIT : ret =pmbus_read_word_data (client, page, phase, -MAX34440_IOUT_OC_WARN_LIMIT ); + data->iout_oc_warn_limit);break ;case PMBUS_VIRT_READ_VOUT_MIN : ret = pmbus_read_word_data(client, page, phase,
@@ -133,11 +138,11 @@ static int max34440_write_word_data(struct i2c_client *client, int page,switch (reg) {case PMBUS_IOUT_OC_FAULT_LIMIT : - ret =pmbus_write_word_data (client, page,MAX34440_IOUT_OC_FAULT_LIMIT , + ret =pmbus_write_word_data (client, page, data->iout_oc_fault_limit, word);break ;case PMBUS_IOUT_OC_WARN_LIMIT : - ret =pmbus_write_word_data (client, page,MAX34440_IOUT_OC_WARN_LIMIT , + ret =pmbus_write_word_data (client, page, data->iout_oc_warn_limit, word);break ;case PMBUS_VIRT_RESET_POUT_HISTORY :
@@ -235,6 +240,25 @@ static int max34451_set_supported_funcs(struct i2c_client *client,*/ int page, rv; +bool max34451_na6 = false; + + rv =i2c_smbus_read_word_data (client,PMBUS_MFR_REVISION ); +if (rv <0 ) +return rv; + +if (rv >=MAX34451ETNA6_MFR_REV ) { + max34451_na6 = true; + data->info.format[PSC_VOLTAGE_IN ] = direct; + data->info.format[PSC_CURRENT_IN ] = direct; + data->info.m[PSC_VOLTAGE_IN ] =1 ; + data->info.b[PSC_VOLTAGE_IN ] =0 ; + data->info.R[PSC_VOLTAGE_IN ] =3 ; + data->info.m[PSC_CURRENT_IN ] =1 ; + data->info.b[PSC_CURRENT_IN ] =0 ; + data->info.R[PSC_CURRENT_IN ] =2 ; + data->iout_oc_fault_limit =PMBUS_IOUT_OC_FAULT_LIMIT ; + data->iout_oc_warn_limit =PMBUS_IOUT_OC_WARN_LIMIT ; + }for (page =0 ; page <16 ; page++) { rv =i2c_smbus_write_byte_data (client,PMBUS_PAGE , page);
@@ -251,16 +275,30 @@ static int max34451_set_supported_funcs(struct i2c_client *client,case 0x20 : data->info.func[page] =PMBUS_HAVE_VOUT |PMBUS_HAVE_STATUS_VOUT ; + +if (max34451_na6) + data->info.func[page] |=PMBUS_HAVE_VIN | +PMBUS_HAVE_STATUS_INPUT ;break ;case 0x21 : data->info.func[page] =PMBUS_HAVE_VOUT ; + +if (max34451_na6) + data->info.func[page] |=PMBUS_HAVE_VIN ;break ;case 0x22 : data->info.func[page] =PMBUS_HAVE_IOUT |PMBUS_HAVE_STATUS_IOUT ; + +if (max34451_na6) + data->info.func[page] |=PMBUS_HAVE_IIN | +PMBUS_HAVE_STATUS_INPUT ;break ;case 0x23 : data->info.func[page] =PMBUS_HAVE_IOUT ; + +if (max34451_na6) + data->info.func[page] |=PMBUS_HAVE_IIN ;break ;default :break ;
@@ -494,6 +532,8 @@ static int max34440_probe(struct i2c_client *client)return -ENOMEM ; data->id =i2c_match_id (max34440_id, client)->driver_data; data->info = max34440_info[data->id]; + data->iout_oc_fault_limit =MAX34440_IOUT_OC_FAULT_LIMIT ; + data->iout_oc_warn_limit =MAX34440_IOUT_OC_WARN_LIMIT ;if (data->id == max34451) { rv =max34451_set_supported_funcs (client, data);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 7/208 dmaengine: xilinx_dma: Set dma_device directions
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gessler <[email protected]>
[ Upstream commit 7e01511443c30a55a5ae78d3debd46d4d872517e ]
Coalesce the direction bits from the enabled TX and/or RX channels into the directions bit mask of dma_device. Without this mask set, dma_get_slave_caps() in the DMAEngine fails, which prevents the driver from being used with an IIO DMAEngine buffer.
--- drivers/dma/xilinx/xilinx_dma.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/dma/xilinx/xilinx_dma.c +2 -0
@@ -2844,6 +2844,8 @@ static int xilinx_dma_chan_probe(struct xilinx_dma_device *xdev,return -EINVAL ; } + xdev->common.directions |= chan->direction; +/* Request the interrupt */ chan->irq =irq_of_parse_and_map (node, chan->tdest); err = request_irq(chan->irq, xdev->dma_config->irq_handler,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 8/208 md/md-bitmap: fix dm-raid max_write_behind setting
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
[ Upstream commit 2afe17794cfed5f80295b1b9facd66e6f65e5002 ]
It's supposed to be COUNTER_MAX / 2, not COUNTER_MAX.
--- drivers/md/md-bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/md-bitmap.c +1 -1
@@ -546,7 +546,7 @@ static int md_bitmap_new_disk_sb(struct bitmap *bitmap)* is a good choice? We choose COUNTER_MAX / 2 arbitrarily. */ write_behind = bitmap->mddev->bitmap_info.max_write_behind; -if (write_behind >COUNTER_MAX ) +if (write_behind >COUNTER_MAX /2 ) write_behind =COUNTER_MAX /2 ; sb->write_behind =cpu_to_le32 (write_behind); bitmap->mddev->bitmap_info.max_write_behind = write_behind;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 9/208 bcache: fix NULL pointer in cache_set_flush()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linggang Zeng <[email protected]>
[ Upstream commit 1e46ed947ec658f89f1a910d880cd05e42d3763e ]
1. LINE#1794 - LINE#1887 is some codes about function of bch_cache_set_alloc().
2. LINE#2078 - LINE#2142 is some codes about function of register_cache_set().
3. register_cache_set() will call bch_cache_set_alloc() in LINE#2098.
1794 struct cache_set *bch_cache_set_alloc(struct cache_sb *sb) 1795 {
...
1860 if (!(c->devices = kcalloc(c->nr_uuids, sizeof(void *), GFP_KERNEL)) ||
1861 mempool_init_slab_pool(&c->search, 32, bch_search_cache) ||
1862 mempool_init_kmalloc_pool(&c->bio_meta, 2,
1863 sizeof(struct bbio) + sizeof(struct bio_vec) *
1864 bucket_pages(c)) ||
1865 mempool_init_kmalloc_pool(&c->fill_iter, 1, iter_size) ||
1866 bioset_init(&c->bio_split, 4, offsetof(struct bbio, bio),
1867 BIOSET_NEED_BVECS|BIOSET_NEED_RESCUER) ||
1868 !(c->uuids = alloc_bucket_pages(GFP_KERNEL, c)) ||
1869 !(c->moving_gc_wq = alloc_workqueue("bcache_gc",
1870 WQ_MEM_RECLAIM, 0)) ||
1871 bch_journal_alloc(c) ||
1872 bch_btree_cache_alloc(c) ||
1873 bch_open_buckets_alloc(c) ||
1874 bch_bset_sort_state_init(&c->sort, ilog2(c->btree_pages)))
1875 goto err;
^^^^^^^^
1876
...
1883 return c;
1884 err:
1885 bch_cache_set_unregister(c);
^^^^^^^^^^^^^^^^^^^^^^^^^^^
1886 return NULL;
1887 }
...
2078 static const char *register_cache_set(struct cache *ca)
2079 {
...
2098 c = bch_cache_set_alloc(&ca->sb);
2099 if (!c)
2100 return err;
^^^^^^^^^^
...
2128 ca->set = c;
2129 ca->set->cache[ca->sb.nr_this_dev] = ca;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...
2138 return NULL;
2139 err:
2140 bch_cache_set_unregister(c);
2141 return err;
2142 }
(1) If LINE#1860 - LINE#1874 is true, then do 'goto err'(LINE#1875) and
call bch_cache_set_unregister()(LINE#1885).
(2) As (1) return NULL(LINE#1886), LINE#2098 - LINE#2100 would return.
(3) As (2) has returned, LINE#2128 - LINE#2129 would do *not* give the
value to c->cache[], it means that c->cache[] is NULL.LINE#1624 - LINE#1665 is some codes about function of cache_set_flush(). As (1), in LINE#1885 callbch_cache_set_unregister()
---> bch_cache_set_stop()
---> closure_queue()
-.-> cache_set_flush() (as below LINE#1624) 1624 static void cache_set_flush(struct closure *cl) 1625 {
...
1654 for_each_cache(ca, c, i)
1655 if (ca->alloc_thread)
^^
1656 kthread_stop(ca->alloc_thread);
...
1665 }
(4) In LINE#1655 ca is NULL(see (3)) in cache_set_flush() then the kernel crash occurred as below:
[ 846.712887] bcache: register_cache() error drbd6: cannot allocate memory [ 846.713242] bcache: register_bcache() error : failed to register device [ 846.713336] bcache: cache_set_free() Cache set 2f84bdc1-498a-4f2f-98a7-01946bf54287 unregistered [ 846.713768] BUG: unable to handle kernel NULL pointer dereference at 00000000000009f8 [ 846.714790] PGD 0 P4D 0 [ 846.715129] Oops: 0000 [#1] SMP PTI [ 846.715472] CPU: 19 PID: 5057 Comm: kworker/19:16 Kdump: loaded Tainted: G OE --------- - - 4.18.0-147.5.1.el8_1.5es.3.x86_64 #1 [ 846.716082] Hardware name: ESPAN GI-25212/X11DPL-i, BIOS 2.1 06/15/2018 [ 846.716451] Workqueue: events cache_set_flush [bcache] [ 846.716808] RIP: 0010:cache_set_flush+0xc9/0x1b0 [bcache] [ 846.717155] Code: 00 4c 89 a5 b0 03 00 00 48 8b 85 68 f6 ff ff a8 08 0f 84 88 00 00 00 31 db 66 83 bd 3c f7 ff ff 00 48 8b 85 48 ff ff ff 74 28 <48> 8b b8 f8 09 00 00 48 85 ff 74 05 e8 b6 58 a2 e1 0f b7 95 3c f7 [ 846.718026] RSP: 0018:ffffb56dcf85fe70 EFLAGS: 00010202 [ 846.718372] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 [ 846.718725] RDX: 0000000000000001 RSI: 0000000040000001 RDI: 0000000000000000 [ 846.719076] RBP: ffffa0ccc0f20df8 R08: ffffa0ce1fedb118 R09: 000073746e657665 [ 846.719428] R10: 8080808080808080 R11: 0000000000000000 R12: ffffa0ce1fee8700 [ 846.719779] R13: ffffa0ccc0f211a8 R14: ffffa0cd1b902840 R15: ffffa0ccc0f20e00 [ 846.720132] FS: 0000000000000000(0000) GS:ffffa0ce1fec0000(0000) knlGS:0000000000000000 [ 846.720726] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 846.721073] CR2: 00000000000009f8 CR3: 00000008ba00a005 CR4: 00000000007606e0 [ 846.721426] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 846.721778] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 846.722131] PKRU: 55555554 [ 846.722467] Call Trace: [ 846.722814] process_one_work+0x1a7/0x3b0 [ 846.723157] worker_thread+0x30/0x390 [ 846.723501] ? create_worker+0x1a0/0x1a0 [ 846.723844] kthread+0x112/0x130 [ 846.724184] ? kthread_flush_work_fn+0x10/0x10 [ 846.724535] ret_from_fork+0x35/0x40
Now, check whether that ca is NULL in LINE#1655 to fix the issue.
--- drivers/md/bcache/super.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/md/bcache/super.c +6 -1
@@ -1765,7 +1765,12 @@ static void cache_set_flush(struct closure *cl)mutex_unlock (&b->write_lock); } -if (ca->alloc_thread) +/* +* If the register_cache_set() call to bch_cache_set_alloc() failed, +* ca has not been assigned a value and return error. +* So we need check ca is not NULL during bch_cache_set_unregister(). +*/ +if (ca && ca->alloc_thread)kthread_stop (ca->alloc_thread);if (c->journal.cur) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 10/208 iio: pressure: zpa2326: Use aligned_s64 for the timestamp
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Cameron <[email protected]>
[ Upstream commit 886a446b76afddfad307488e95e87f23a08ffd51 ]
On x86_32 s64 fields are only 32-bit aligned. Hence force the alignment of the field and padding in the structure by using aligned_s64 instead.
--- drivers/iio/pressure/zpa2326.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/pressure/zpa2326.c +1 -1
@@ -582,7 +582,7 @@ static int zpa2326_fill_sample_buffer(struct iio_dev *indio_dev,struct {u32 pressure;u16 temperature; -u64 timestamp; +aligned_s64 timestamp; } sample;int err;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 11/208 um: Add cmpxchg8b_emu and checksum functions to asm-prototypes.h
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sami Tolvanen <[email protected]>
[ Upstream commit 674d03f6bd6b0f8327f1a4920ff5893557facfbd ]
With CONFIG_GENDWARFKSYMS, um builds fail due to missing prototypes in asm/asm-prototypes.h. Add declarations for cmpxchg8b_emu and the exported checksum functions, including csum_partial_copy_generic as it's also exported.
--- arch/um/include/asm/asm-prototypes.h | 5 +++++ arch/x86/um/asm/checksum.h | 3 +++ 2 files changed, 8 insertions(+)
arch/um/include/asm/asm-prototypes.h +5 -0
@@ -1 +1,6 @@#include <asm-generic/asm-prototypes.h> +#include <asm/checksum.h> + +#ifdef CONFIG_UML_X86 +extern void cmpxchg8b_emu (void ); +#endif
arch/x86/um/asm/checksum.h +3 -0
@@ -20,6 +20,9 @@*/ extern __wsum csum_partial (const void *buff,int len,__wsum sum); +/* Do not call this directly. Declared for export type visibility. */ +extern __visible __wsum csum_partial_copy_generic(const void *src, void *dst, int len); +/** * csum_fold - Fold and invert a 32bit checksum. * sum: 32bit unfolded sum
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 12/208 usb: potential integer overflow in usbg_make_tpg()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Yufeng <[email protected]>
[ Upstream commit 153874010354d050f62f8ae25cbb960c17633dc5 ]
The variable tpgt in usbg_make_tpg() is defined as unsigned long and is assigned to tpgt->tport_tpgt, which is defined as u16. This may cause an integer overflow when tpgt is greater than USHRT_MAX (65535). I haven't tried to trigger it myself, but it is possible to trigger it by calling usbg_make_tpg() with a large value for tpgt.
I modified the type of tpgt to match tpgt->tport_tpgt and adjusted the relevant code accordingly.
This patch is similar to commit 59c816c1f24d ("vhost/scsi: potential memory corruption").
--- drivers/usb/gadget/function/f_tcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/f_tcm.c +2 -2
@@ -1325,14 +1325,14 @@ static struct se_portal_group *usbg_make_tpg(struct se_wwn *wwn, struct usbg_tport *tport = container_of(wwn, struct usbg_tport, tport_wwn);struct usbg_tpg *tpg; -unsigned long tpgt; +u16 tpgt;int ret;struct f_tcm_opts *opts;unsigned i;if (strstr (name,"tpgt_" ) != name)return ERR_PTR (-EINVAL ); -if (kstrtoul (name +5 ,0 , &tpgt) || tpgt >UINT_MAX ) +if (kstrtou16 (name +5 ,0 , &tpgt))return ERR_PTR (-EINVAL ); ret = -ENODEV ;mutex_lock (&tpg_instances_lock);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 13/208 usb: common: usb-conn-gpio: use a unique name for usb connector device
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chance Yang <[email protected]>
[ Upstream commit d4e5b10c55627e2f3fc9e5b337a28b4e2f02a55e ]
The current implementation of the usb-conn-gpio driver uses a fixed "usb-charger" name for all USB connector devices. This causes conflicts in the power supply subsystem when multiple USB connectors are present, as duplicate names are not allowed.
Use IDA to manage unique IDs for naming usb connectors (e.g., usb-charger-0, usb-charger-1).
--- drivers/usb/common/usb-conn-gpio.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)
drivers/usb/common/usb-conn-gpio.c +22 -3
@@ -20,6 +20,9 @@#include <linux/power_supply.h> #include <linux/regulator/consumer.h> #include <linux/usb/role.h> +#include <linux/idr.h> + +static DEFINE_IDA (usb_conn_ida);#define USB_GPIO_DEB_MS 20/* ms */ #define USB_GPIO_DEB_US ((USB_GPIO_DEB_MS) * 1000)/* us */
@@ -29,6 +32,7 @@struct usb_conn_info {struct device *dev; +int conn_id;/* store the IDA-allocated ID */ struct usb_role_switch *role_sw;enum usb_role last_role;struct regulator *vbus;
@@ -160,7 +164,17 @@ static int usb_conn_psy_register(struct usb_conn_info *info) .of_node = dev->of_node, }; - desc->name ="usb-charger" ; + info->conn_id =ida_alloc (&usb_conn_ida,GFP_KERNEL ); +if (info->conn_id <0 ) +return info->conn_id; + + desc->name =devm_kasprintf (dev,GFP_KERNEL ,"usb-charger-%d" , + info->conn_id); +if (!desc->name) { +ida_free (&usb_conn_ida, info->conn_id); +return -ENOMEM ; + } + desc->properties = usb_charger_properties; desc->num_properties =ARRAY_SIZE (usb_charger_properties); desc->get_property = usb_charger_get_property;
@@ -168,8 +182,10 @@ static int usb_conn_psy_register(struct usb_conn_info *info) cfg.drv_data = info; info->charger =devm_power_supply_register (dev, desc, &cfg); -if (IS_ERR (info->charger)) -dev_err (dev,"Unable to register charger\n" ); +if (IS_ERR (info->charger)) { +dev_err (dev,"Unable to register charger %d\n" , info->conn_id); +ida_free (&usb_conn_ida, info->conn_id); + }return PTR_ERR_OR_ZERO (info->charger); }
@@ -296,6 +312,9 @@ static int usb_conn_remove(struct platform_device *pdev)cancel_delayed_work_sync (&info->dw_det); +if (info->charger) +ida_free (&usb_conn_ida, info->conn_id); +if (info->last_role ==USB_ROLE_HOST && info->vbus)regulator_disable (info->vbus);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 14/208 usb: Add checks for snprintf() calls in usb_alloc_dev()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 82fe5107fa3d21d6c3fba091c9dbc50495588630 ]
When creating a device path in the driver the snprintf() takes up to 16 characters long argument along with the additional up to 12 characters for the signed integer (as it can't see the actual limits) and tries to pack this into 16 bytes array. GCC complains about that when build with make W=1:
drivers/usb/core/usb.c:705:25: note: ‘snprintf’ output between 3 and 28 bytes into a destination of size 16
Since everything works until now, let's just check for the potential buffer overflow and bail out. It is most likely a never happen situation, but at least it makes GCC happy.
--- drivers/usb/core/usb.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/usb/core/usb.c +10 -4
@@ -704,15 +704,16 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent,dev_set_name (&dev->dev,"usb%d" , bus->busnum); root_hub =1 ; }else { +int n; +/* match any labeling on the hubs; it's one-based */ if (parent->devpath[0 ] =='0' ) { -snprintf (dev->devpath,sizeof dev->devpath, -"%d" , port1); + n =snprintf (dev->devpath,sizeof (dev->devpath),"%d" , port1);/* Root ports are not counted in route string */ dev->route =0 ; }else { -snprintf (dev->devpath,sizeof dev->devpath, -"%s.%d" , parent->devpath, port1); + n =snprintf (dev->devpath,sizeof (dev->devpath),"%s.%d" , + parent->devpath, port1);/* Route string assumes hubs have less than 16 ports */ if (port1 <15 ) dev->route = parent->route +
@@ -721,6 +722,11 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent, dev->route = parent->route + (15 << ((parent->level -1 )*4 )); } +if (n >=sizeof (dev->devpath)) { +usb_put_hcd (bus_to_hcd (bus)); +usb_put_dev (dev); +return NULL ; + } dev->dev.parent = &parent->dev;dev_set_name (&dev->dev,"%d-%s" , bus->busnum, dev->devpath);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 15/208 usb: cdc-wdm: avoid setting WDM_READ for ZLP-s
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robert Hodaszi <[email protected]>
[ Upstream commit 387602d8a75574fafb451b7a8215e78dfd67ee63 ]
Don't set WDM_READ flag in wdm_in_callback() for ZLP-s, otherwise when userspace tries to poll for available data, it might - incorrectly - believe there is something available, and when it tries to non-blocking read it, it might get stuck in the read loop.
For example this is what glib does for non-blocking read (briefly):
1. poll()
2. if poll returns with non-zero, starts a read data loop:
a. loop on poll() (EINTR disabled)
b. if revents was set, reads data
I. if read returns with EINTR or EAGAIN, goto 2.a. II. otherwise return with data
So if ZLP sets WDM_READ (#1), we expect data, and try to read it (#2). But as that was a ZLP, and we are doing non-blocking read, wdm_read() returns with EAGAIN (#2.b.I), so loop again, and try to read again (#2.a.).
With glib, we might stuck in this loop forever, as EINTR is disabled (#2.a).
--- drivers/usb/class/cdc-wdm.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-)
drivers/usb/class/cdc-wdm.c +9 -14
@@ -89,7 +89,6 @@ struct wdm_device {u16 wMaxCommand;u16 wMaxPacketSize;__le16 inum; -int reslength;int length;int read;int count;
@@ -201,6 +200,11 @@ static void wdm_in_callback(struct urb *urb)if (desc->rerr ==0 && status != -EPIPE ) desc->rerr = status; +if (length ==0 ) { +dev_dbg (&desc->intf->dev,"received ZLP\n" ); + goto skip_zlp; + } +if (length + desc->length > desc->wMaxCommand) {/* The buffer would overflow */ set_bit (WDM_OVERFLOW , &desc->flags);
@@ -209,18 +213,18 @@ static void wdm_in_callback(struct urb *urb)if (!test_bit (WDM_OVERFLOW , &desc->flags)) {memmove (desc->ubuf + desc->length, desc->inbuf, length); desc->length += length; - desc->reslength = length; } } skip_error:if (desc->rerr) {/* -* Since there was an error, userspace may decide to not read -* any data after poll'ing. +* If there was a ZLP or an error, userspace may decide to not +* read any data after poll'ing. * We should respond to further attempts from the device to send * data, so that we can get unstuck. */ +skip_zlp:schedule_work (&desc->service_outs_intr); }else {set_bit (WDM_READ , &desc->flags);
@@ -571,15 +575,6 @@ static ssize_t wdm_read goto retry; } -if (!desc->reslength) {/* zero length read */ -dev_dbg (&desc->intf->dev,"zero length - clearing WDM_READ\n" ); -clear_bit (WDM_READ , &desc->flags); - rv =service_outstanding_interrupt (desc); -spin_unlock_irq (&desc->iuspin); -if (rv <0 ) - goto err; - goto retry; - } cntr = desc->length;spin_unlock_irq (&desc->iuspin); }
@@ -839,7 +834,7 @@ static void service_interrupt_work(struct work_struct *work)spin_lock_irq (&desc->iuspin);service_outstanding_interrupt (desc); -if (!desc->resp_count) { +if (!desc->resp_count && (desc->length || desc->rerr)) {set_bit (WDM_READ , &desc->flags);wake_up (&desc->wait); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 16/208 usb: typec: displayport: Receive DP Status Update NAK request exit dp altmode
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jos Wang <[email protected]>
[ Upstream commit b4b38ffb38c91afd4dc387608db26f6fc34ed40b ]
Although some Type-C DRD devices that do not support the DP Sink function (such as Huawei Mate 40Pro), the Source Port initiates Enter Mode CMD, but the device responds to Enter Mode ACK, the Source port then initiates DP Status Update CMD, and the device responds to DP Status Update NAK.
As PD2.0 spec ("6.4.4.3.4 Enter Mode Command"),A DR_Swap Message Shall Not be sent during Modal Operation between the Port Partners. At this time, the source port initiates DR_Swap message through the "echo device > /sys/class/typec/port0/data_role" command to switch the data role from host to device. The device will initiate a Hard Reset for recovery, resulting in the failure of data role swap.
Therefore, when DP Status Update NAK is received, Exit Mode CMD is initiated to exit the currently entered DP altmode.
--- drivers/usb/typec/altmodes/displayport.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/typec/altmodes/displayport.c +4 -0
@@ -304,6 +304,10 @@ static int dp_altmode_vdm(struct typec_altmode *alt,break ;case CMDT_RSP_NAK :switch (cmd) { +case DP_CMD_STATUS_UPDATE : +if (typec_altmode_exit (alt)) +dev_err (&dp->alt->dev,"Exit Mode Failed!\n" ); +break ;case DP_CMD_CONFIGURE : dp->data.conf =0 ; ret =dp_altmode_configured (dp);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 17/208 ALSA: hda: Ignore unsol events for cards being shut down
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit 3f100f524e75586537e337b34d18c8d604b398e7 ]
For the classic snd_hda_intel driver, codec->card and bus->card point to the exact same thing. When snd_card_diconnect() fires, bus->shutdown is set thanks to azx_dev_disconnect(). card->shutdown is already set when that happens but both provide basically the same functionality.
For the DSP snd_soc_avs driver where multiple codecs are located on multiple cards, bus->shutdown 'shortcut' is not sufficient. One codec card may be unregistered while other codecs are still operational. Proper check in form of card->shutdown must be used to verify whether the codec's card is being shut down.
--- sound/pci/hda/hda_bind.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/hda_bind.c +1 -1
@@ -44,7 +44,7 @@ static void hda_codec_unsol_event(struct hdac_device *dev, unsigned int ev) struct hda_codec *codec = container_of(dev, struct hda_codec, core);/* ignore unsol events during shutdown */ -if (codec->bus->shutdown) +if (codec->card->shutdown || codec->bus->shutdown)return ;/* ignore unsol events during system suspend/resume */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 18/208 ALSA: hda: Add new pci id for AMD GPU display HD audio controller
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vijendar Mukunda <[email protected]>
[ Upstream commit ab72bfce7647522e01a181e3600c3d14ff5c143e ]
Add new pci id for AMD GPU display HD audio controller(device id- 0xab40).
--- sound/pci/hda/hda_intel.c | 3 +++ 1 file changed, 3 insertions(+)
sound/pci/hda/hda_intel.c +3 -0
@@ -2793,6 +2793,9 @@ static const struct pci_device_id azx_ids[] = { { PCI_DEVICE(0x1002, 0xab38), .driver_data =AZX_DRIVER_ATIHDMI_NS |AZX_DCAPS_PRESET_ATI_HDMI_NS | AZX_DCAPS_PM_RUNTIME }, + { PCI_VDEVICE(ATI, 0xab40), + .driver_data =AZX_DRIVER_ATIHDMI_NS |AZX_DCAPS_PRESET_ATI_HDMI_NS | + AZX_DCAPS_PM_RUNTIME }, /* GLENFLY */ { PCI_DEVICE(PCI_VENDOR_ID_GLENFLY, PCI_ANY_ID), .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 19/208 ceph: fix possible integer overflow in ceph_zero_objects()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Kandybka <[email protected]>
[ Upstream commit 0abd87942e0c93964e93224836944712feba1d91 ]
In 'ceph_zero_objects', promote 'object_size' to 'u64' to avoid possible integer overflow.
Compile tested only.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- fs/ceph/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/file.c +1 -1
@@ -2034,7 +2034,7 @@ static int ceph_zero_objects(struct inode *inode, loff_t offset, loff_t length)s32 stripe_unit = ci->i_layout.stripe_unit;s32 stripe_count = ci->i_layout.stripe_count;s32 object_size = ci->i_layout.object_size; -u64 object_set_size = object_size * stripe_count; +u64 object_set_size = (u64 ) object_size * stripe_count;u64 nearly, t;/* round offset up to next period boundary */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 20/208 ovl: Check for NULL d_inode() in ovl_dentry_upper()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit 8a39f1c870e9d6fbac5638f3a42a6a6363829c49 ]
In ovl_path_type() and ovl_is_metacopy_dentry() GCC notices that it is possible for OVL_E() to return NULL (which implies that d_inode(dentry) may be NULL). This would result in out of bounds reads via container_of(), seen with GCC 15's -Warray-bounds -fdiagnostics-details. For example:
In file included from arch/x86/include/generated/asm/rwonce.h:1,
from include/linux/compiler.h:339, from include/linux/export.h:5,
from include/linux/linkage.h:7,
from include/linux/fs.h:5,
from fs/overlayfs/util.c:7:
In function 'ovl_upperdentry_dereference',
inlined from 'ovl_dentry_upper' at ../fs/overlayfs/util.c:305:9,
inlined from 'ovl_path_type' at ../fs/overlayfs/util.c:216:6:
include/asm-generic/rwonce.h:44:26: error: array subscript 0 is outside array bounds of 'struct inode[7486503276667837]' [-Werror=array-bounds=]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
fs/overlayfs/ovl_entry.h:195:16: note: in expansion of macro 'READ_ONCE'
195 | return READ_ONCE(oi->__upperdentry);
| ^~~~~~~~~ 'ovl_path_type': event 1
185 | return inode ? OVL_I(inode)->oe : NULL;
'ovl_path_type': event 2
Avoid this by allowing ovl_dentry_upper() to return NULL if d_inode() is NULL, as that means the problematic dereferencing can never be reached. Note that this fixes the over-eager compiler warning in an effort to being able to enable -Warray-bounds globally. There is no known behavioral bug here.
--- fs/overlayfs/util.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/overlayfs/util.c +3 -1
@@ -211,7 +211,9 @@ enum ovl_path_type ovl_path_real(struct dentry *dentry, struct path *path)struct dentry *ovl_dentry_upper (struct dentry *dentry) { -return ovl_upperdentry_dereference (OVL_I (d_inode (dentry))); +struct inode *inode =d_inode (dentry); + +return inode ?ovl_upperdentry_dereference (OVL_I (inode)) :NULL ; }struct dentry *ovl_dentry_lower (struct dentry *dentry)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 21/208 USB: usbtmc: Fix reading stale status byte
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Penkler <[email protected]>
[ Upstream commit 3c1037e2b6a94898f81ed1a68bea146a9db750a5 ]
The ioctl USBTMC488_IOCTL_READ_STB either returns a cached status byte (STB) sent by the device due to a service request (SRQ) condition or the STB obtained from a query to the device with a READ_STATUS_BYTE control message.
When the query is interrupted by an SRQ message on the interrupt pipe, the ioctl still returns the requested STB while the STB of the out-of-band SRQ message is cached for the next call of this ioctl. However the cached SRQ STB represents a state that was previous to the last returned STB. Furthermore the cached SRQ STB can be stale and not reflect the current state of the device.
The fixed ioctl now always reads the STB from the device and if the associated file descriptor has the srq_asserted bit set it ors in the RQS bit to the returned STB and clears the srq_asserted bit conformant to subclass USB488 devices.
Stable-dep-of: acb3dac2805d ("usb: usbtmc: Fix read_stb function and get_stb ioctl")
--- drivers/usb/class/usbtmc.c | 46 +++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 21 deletions(-)
drivers/usb/class/usbtmc.c +25 -21
@@ -475,15 +475,12 @@ static int usbtmc_ioctl_abort_bulk_out(struct usbtmc_device_data *data)return usbtmc_ioctl_abort_bulk_out_tag (data, data->bTag_last_write); } -static int usbtmc488_ioctl_read_stb (struct usbtmc_file_data *file_data, -void __user *arg) +static int usbtmc_get_stb (struct usbtmc_file_data *file_data,__u8 *stb) {struct usbtmc_device_data *data = file_data->data;struct device *dev = &data->intf->dev; -int srq_asserted =0 ;u8 *buffer;u8 tag; -__u8 stb;int rv;long wait_rv;unsigned long expire;
@@ -491,19 +488,6 @@ static int usbtmc488_ioctl_read_stb(struct usbtmc_file_data *file_data,dev_dbg (dev,"Enter ioctl_read_stb iin_ep_present: %d\n" , data->iin_ep_present); -spin_lock_irq (&data->dev_lock); - srq_asserted =atomic_xchg (&file_data->srq_asserted, srq_asserted); -if (srq_asserted) { -/* a STB with SRQ is already received */ - stb = file_data->srq_byte; -spin_unlock_irq (&data->dev_lock); - rv =put_user (stb, (__u8 __user *)arg); -dev_dbg (dev,"stb:0x%02x with srq received %d\n" , - (unsigned int )stb, rv); -return rv; - } -spin_unlock_irq (&data->dev_lock); - buffer =kmalloc (8 ,GFP_KERNEL );if (!buffer)return -ENOMEM ;
@@ -552,13 +536,12 @@ static int usbtmc488_ioctl_read_stb(struct usbtmc_file_data *file_data, data->iin_bTag, tag); } - stb = data->bNotify2; + *stb = data->bNotify2; }else { - stb = buffer[2 ]; + *stb = buffer[2 ]; } - rv =put_user (stb, (__u8 __user *)arg); -dev_dbg (dev,"stb:0x%02x received %d\n" , (unsigned int )stb, rv); +dev_dbg (dev,"stb:0x%02x received %d\n" , (unsigned int )*stb, rv); rv =0 ;
@@ -573,6 +556,27 @@ static int usbtmc488_ioctl_read_stb(struct usbtmc_file_data *file_data,return rv; } +static int usbtmc488_ioctl_read_stb (struct usbtmc_file_data *file_data, +void __user *arg) +{ +int srq_asserted =0 ; +__u8 stb; +int rv; + + rv =usbtmc_get_stb (file_data, &stb); + +if (rv >0 ) { + srq_asserted =atomic_xchg (&file_data->srq_asserted, + srq_asserted); +if (srq_asserted) + stb |=0x40 ;/* Set RQS bit */ + + rv =put_user (stb, (__u8 __user *)arg); + } +return rv; + +} +static int usbtmc488_ioctl_wait_srq (struct usbtmc_file_data *file_data,__u32 __user *arg) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 22/208 USB: usbtmc: Add USBTMC_IOCTL_GET_STB
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Penkler <[email protected]>
[ Upstream commit c9784e23c1020e63d6dba5e10ca8bf3d8b85c19c ]
This new ioctl reads the status byte (STB) from the device and returns the STB unmodified to the application. The srq_asserted bit is not taken into account and not changed.
This ioctl is useful to support non USBTMC-488 compliant devices.
Stable-dep-of: acb3dac2805d ("usb: usbtmc: Fix read_stb function and get_stb ioctl")
--- drivers/usb/class/usbtmc.c | 6 ++++++ include/uapi/linux/usb/tmc.h | 2 ++ 2 files changed, 8 insertions(+)
drivers/usb/class/usbtmc.c +6 -0
@@ -2173,6 +2173,12 @@ static long usbtmc_ioctl(struct file *file, unsigned int cmd, unsigned long arg) file_data->auto_abort = !!tmp_byte;break ; +case USBTMC_IOCTL_GET_STB : + retval =usbtmc_get_stb (file_data, &tmp_byte); +if (retval >0 ) + retval =put_user (tmp_byte, (__u8 __user *)arg); +break ; +case USBTMC_IOCTL_CANCEL_IO : retval =usbtmc_ioctl_cancel_io (file_data);break ;
include/uapi/linux/usb/tmc.h +2 -0
@@ -102,6 +102,8 @@ struct usbtmc_message {#define USBTMC_IOCTL_MSG_IN_ATTR _IOR(USBTMC_IOC_NR, 24, __u8)#define USBTMC_IOCTL_AUTO_ABORT _IOW(USBTMC_IOC_NR, 25, __u8) +#define USBTMC_IOCTL_GET_STB _IOR(USBTMC_IOC_NR, 26, __u8) +/* Cancel and cleanup asynchronous calls */ #define USBTMC_IOCTL_CANCEL_IO _IO(USBTMC_IOC_NR, 35)#define USBTMC_IOCTL_CLEANUP_IO _IO(USBTMC_IOC_NR, 36)
Signature · 1 line
2.39.5
RE: [PATCH 5.10 022/208] USB: usbtmc: Add USBTMC_IOCTL_GET_STB
Greg,
I got the series
[PATCH 5.4 015/148] USB: usbtmc: Fix reading stale status byte [PATCH 5.4 016/148] USB: usbtmc: Add USBTMC_IOCTL_GET_STB [PATCH 5.10 021/208] USB: usbtmc: Fix reading stale status byte [PATCH 5.10 022/208] USB: usbtmc: Add USBTMC_IOCTL_GET_STB
And I assume we should add the other two commits as well to complete the series:
USB: usbtmc: Add separate USBTMC_IOCTL_GET_SRQ_STB (commit d1d9defdc6d582119d29f5d88f810b72bb1837fa)
USB: usbtmc: Bump USBTMC_API_VERSION value (commit 614b388c34265948fbb3c5803ad72aa1898f2f93)
Then USBTMC API Version is consistent with added ioctls.
@Dave: What do you think. Can you check this?
Guido
Quoted 73 lines
-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Tuesday, July 15, 2025 3:12 PM
To: [email protected]
Cc: Greg Kroah-Hartman <[email protected]>; [email protected]; Jian-Wei Wu <[email protected]>; Kiener Guido (14DS1) <[email protected]>; Dave Penkler <[email protected]>; Sasha Levin <[email protected]>
Subject: *EXT* [PATCH 5.10 022/208] USB: usbtmc: AddUSBTMC_IOCTL_GET_STB5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Penkler <[email protected]>
[ Upstream commit
c9784e23c1020e63d6dba5e10ca8bf3d8b85c19c]This new ioctl reads the status byte (STB) from the device and returns the STB unmodified to the application. The
srq_assertedbit is not taken into account and not changed.This ioctl is useful to support non USBTMC-488 compliant devices.
Tested-by Jian-Wei Wu <[email protected]>Reviewed-by Guido Kiener <[email protected]>Signed-off-by Dave Penkler <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Stable-dep-of:
acb3dac2805d("usb: usbtmc: Fixread_stbfunction andget_stbioctl")Signed-off-by Sasha Levin <[email protected]>--- drivers/usb/class/usbtmc.c | 6 ++++++ include/uapi/linux/usb/tmc.h | 2 ++ 2 files changed, 8 insertions(+)drivers/usb/class/usbtmc.c index renamed from drivers/usb/class/usbtmc.c +0
-0
bfd99d461f813..093040ea7e065100644drivers/usb/class/usbtmc.c +6
-0@@ -2173,6 +2173,12 @@ static long usbtmc_ioctl(struct file *file, unsigned int cmd, unsigned long arg) file_data->auto_abort = !!tmp_byte;break ; +case USBTMC_IOCTL_GET_STB : + retval =usbtmc_get_stb (file_data, &tmp_byte); +if (retval >0 ) + retval =put_user (tmp_byte, (__u8 __user *)arg); +break ; +case USBTMC_IOCTL_CANCEL_IO : retval =usbtmc_ioctl_cancel_io (file_data);drivers/usb/class/usbtmc.c +0
-0break ;include/uapi/linux/usb/tmc.h index renamed from include/uapi/linux/usb/tmc.h +0
-0
fdd4d88a7b95d..1e7878fe591f4100644include/uapi/linux/usb/tmc.h +2
-0@@ -102,6 +102,8 @@ struct usbtmc_message {#define USBTMC_IOCTL_MSG_IN_ATTR _IOR(USBTMC_IOC_NR, 24, __u8)#define USBTMC_IOCTL_AUTO_ABORT _IOW(USBTMC_IOC_NR, 25, __u8) +#define USBTMC_IOCTL_GET_STB _IOR(USBTMC_IOC_NR, 26, __u8) +/* Cancel and cleanup asynchronous calls */ #define USBTMC_IOCTL_CANCEL_IO _IO(USBTMC_IOC_NR, 35)#define
USBTMC_IOCTL_CLEANUP_IO_IO(USBTMC_IOC_NR, 36)
--
2.39.5
Greg Kroah-Hartman
maintainerRe: [PATCH 5.10 022/208] USB: usbtmc: Add USBTMC_IOCTL_GET_STB
Quoted 5 lines · Guido Kiener
Greg,
I got the series
[PATCH 5.4 015/148] USB: usbtmc: Fix reading stale status byte [PATCH 5.4 016/148] USB: usbtmc: AddUSBTMC_IOCTL_GET_STB
Odd, that second one shoudn't be there, right?
Quoted 2 lines
[PATCH 5.10 021/208] USB: usbtmc: Fix reading stale status byte [PATCH 5.10 022/208] USB: usbtmc: Add
USBTMC_IOCTL_GET_STB
Same here?
Quoted 3 lines
And I assume we should add the other two commits as well to complete the series:
USB: usbtmc: Add separateUSBTMC_IOCTL_GET_SRQ_STB(commitd1d9defdc6d582119d29f5d88f810b72bb1837fa)
USB: usbtmc: BumpUSBTMC_API_VERSIONvalue (commit614b388c34265948fbb3c5803ad72aa1898f2f93)
Nope, I didn't, maybe I should just drop both of the above ones, as it doesn't make much sense to have only the one, right?
thanks,
greg k-h
Re: [PATCH 5.10 022/208] USB: usbtmc: Add USBTMC_IOCTL_GET_STB
Quoted 5 lines
Quoted 3 lines
I got the series
[PATCH 5.4 015/148] USB: usbtmc: Fix reading stale status byte [PATCH 5.4 016/148] USB: usbtmc: AddUSBTMC_IOCTL_GET_STBOdd, that second one shoudn't be there, right?
Yes, there is no need to add both patches.
5.4.295 is ok and uses old implementation of usbtmc488_ioctl_read_stb I assume, there is no need to add [PATCH 5.4 015/148] and [PATCH 5.4 016/148]
Quoted 4 lines
Quoted 2 lines
[PATCH 5.10 021/208] USB: usbtmc: Fix reading stale status byte [PATCH 5.10 022/208] USB: usbtmc: Add
USBTMC_IOCTL_GET_STBSame here?
Yes, same here.
Quoted 8 lines
Quoted 5 lines
And I assume we should add the other two commits as well to complete the series:
USB: usbtmc: Add separateUSBTMC_IOCTL_GET_SRQ_STB(commitd1d9defdc6d582119d29f5d88f810b72bb1837fa)
USB: usbtmc: BumpUSBTMC_API_VERSIONvalue (commit614b388c34265948fbb3c5803ad72aa1898f2f93)Nope, I didn't, maybe I should just drop both of the above ones, as it doesn't make much sense to have only the one, right?
The patch "USB: usbtmc: Fix reading stale status byte" is not required in 5.4 and 5.10, too. The new behavior to read the status byte in old and new manner was introduced in 5.12. Sorry, I can not verify my current findings, since I do not have test systems for it. To be sure we should wait for a comment from Dave. He did the last patches.
Guido
RE: [PATCH 5.10 022/208] USB: usbtmc: Add USBTMC_IOCTL_GET_STB
Update see below:
Quoted 6 lines
Quoted 4 lines
I got the series
[PATCH 5.4 015/148] USB: usbtmc: Fix reading stale status byte [PATCH
5.4 016/148] USB: usbtmc: AddUSBTMC_IOCTL_GET_STBOdd, that second one shoudn't be there, right?
Yes, there is no need to add both patches.
5.4.295 is ok and uses old implementation of usbtmc488_ioctl_read_stb I assume, there is no need to add [PATCH 5.4 015/148] and [PATCH 5.4 016/148]
Quoted 5 lines
Quoted 3 lines
[PATCH 5.10 021/208] USB: usbtmc: Fix reading stale status byte [PATCH
5.10 022/208] USB: usbtmc: AddUSBTMC_IOCTL_GET_STBSame here?
Yes, same here.
Quoted 8 lines
Quoted 5 lines
And I assume we should add the other two commits as well to complete the series:
USB: usbtmc: Add separateUSBTMC_IOCTL_GET_SRQ_STB(commitd1d9defdc6d582119d29f5d88f810b72bb1837fa)
USB: usbtmc: BumpUSBTMC_API_VERSIONvalue (commit614b388c34265948fbb3c5803ad72aa1898f2f93)Nope, I didn't, maybe I should just drop both of the above ones, as it doesn't make much sense to have only the one, right?
The patch "USB: usbtmc: Fix reading stale status byte" is not required in 5.4 and 5.10, too. The new behavior to read the status byte in old and new manner was introduced in 5.12. Sorry, I can not verify my current findings, since I do not have test systems for it. To be sure we should wait for a comment from Dave. He did the last patches.
Update:
Now I see a problem in the patch-5.4.295:
@@ -556,6 +560,8 @@ static int usbtmc488_ioctl_read_stb(struct usbtmc_file_data *file_data,
rv = put_user(stb, (__u8 __user *)arg);
dev_dbg(dev, "stb:0x%02x received %d\n", (unsigned int)stb, rv);
+ rv = 0;
+
exit:
/* bump interrupt bTag */
data->iin_bTag += 1;
We should not set rev = 0, since
case USBTMC488_IOCTL_READ_STB: retval = usbtmc488_ioctl_read_stb(file_data, (void __user *)arg);
will return 0 instead of 1 (the amount of returned bytes).
Same issue in patch-5.10.239.
Guido
Greg Kroah-Hartman
maintainerRe: [PATCH 5.10 022/208] USB: usbtmc: Add USBTMC_IOCTL_GET_STB
Quoted 11 lines · Guido Kiener
Update see below:
Quoted 6 lines
Quoted 4 lines
I got the series
[PATCH 5.4 015/148] USB: usbtmc: Fix reading stale status byte [PATCH
5.4 016/148] USB: usbtmc: AddUSBTMC_IOCTL_GET_STBOdd, that second one shoudn't be there, right?
Yes, there is no need to add both patches.
5.4.295 is ok and uses old implementation ofusbtmc488_ioctl_read_stbI assume, there is no need to add [PATCH 5.4 015/148] and [PATCH 5.4 016/148]
Ok, will drop all of these, thanks.
greg k-h
Re: [PATCH 5.10 022/208] USB: usbtmc: Add USBTMC_IOCTL_GET_STB
Quoted 8 lines · Greg Kroah-Hartman
Quoted 7 lines · Guido Kiener
Update see below:
Quoted 5 lines
Quoted 4 lines
I got the series
[PATCH 5.4 015/148] USB: usbtmc: Fix reading stale status byte [PATCH
5.4 016/148] USB: usbtmc: AddUSBTMC_IOCTL_GET_STB
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Odd, that second one shoudn't be there, right?
Yes, there is no need to add both patches.
5.4.295 is ok and uses old implementation ofusbtmc488_ioctl_read_stbI assume, there is no need to add [PATCH 5.4 015/148] and [PATCH 5.4 016/148]Ok, will drop all of these, thanks.
Yes, this is OK.
-dave
Greg Kroah-Hartman
maintainerPATCH 23/208 usb: usbtmc: Fix read_stb function and get_stb ioctl
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Penkler <[email protected]>
[ Upstream commit acb3dac2805d3342ded7dbbd164add32bbfdf21c ]
The usbtmc488_ioctl_read_stb function relied on a positive return from usbtmc_get_stb to reset the srq condition in the driver. The USBTMC_IOCTL_GET_STB case tested for a positive return to return the stb to the user.
Commit: <cac01bd178d6> ("usb: usbtmc: Fix erroneous get_stb ioctl error returns") changed the return value of usbtmc_get_stb to 0 on success instead of returning the value of usb_control_msg which is positive in the normal case. This change caused the function usbtmc488_ioctl_read_stb and the USBTMC_IOCTL_GET_STB ioctl to no longer function correctly.
Change the test in usbtmc488_ioctl_read_stb to test for failure first and return the failure code immediately.
Change the test for the USBTMC_IOCTL_GET_STB ioctl to test for 0 instead of a positive value.
--- drivers/usb/class/usbtmc.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/usb/class/usbtmc.c +9 -8
@@ -565,14 +565,15 @@ static int usbtmc488_ioctl_read_stb(struct usbtmc_file_data *file_data, rv =usbtmc_get_stb (file_data, &stb); -if (rv >0 ) { - srq_asserted =atomic_xchg (&file_data->srq_asserted, - srq_asserted); -if (srq_asserted) - stb |=0x40 ;/* Set RQS bit */ +if (rv <0 ) +return rv; + + srq_asserted =atomic_xchg (&file_data->srq_asserted, srq_asserted); +if (srq_asserted) + stb |=0x40 ;/* Set RQS bit */ + + rv =put_user (stb, (__u8 __user *)arg); - rv =put_user (stb, (__u8 __user *)arg); - }return rv; }
@@ -2175,7 +2176,7 @@ static long usbtmc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)case USBTMC_IOCTL_GET_STB : retval =usbtmc_get_stb (file_data, &tmp_byte); -if (retval >0 ) +if (!retval) retval =put_user (tmp_byte, (__u8 __user *)arg);break ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 24/208 VMCI: check context->notify_page after call to get_user_pages_fast() to avoid GPF
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: George Kennedy <[email protected]>
[ Upstream commit 1a726cb47fd204109c767409fa9ca15a96328f14 ]
The call to get_user_pages_fast() in vmci_host_setup_notify() can return NULL context->notify_page causing a GPF. To avoid GPF check if context->notify_page == NULL and return error if so.
general protection fault, probably for non-canonical address
0xe0009d1000000060: 0000 [#1] PREEMPT SMP KASAN NOPTI
KASAN: maybe wild-memory-access in range [0x0005088000000300-
0x0005088000000307]
CPU: 2 PID: 26180 Comm: repro_34802241 Not tainted 6.1.0-rc4 #1
Hardware name: Red Hat KVM, BIOS 1.15.0-2.module+el8.6.0 04/01/2014
RIP: 0010:vmci_ctx_check_signal_notify+0x91/0xe0
Call Trace:
<TASK>
vmci_host_unlocked_ioctl+0x362/0x1f40
__x64_sys_ioctl+0x1a1/0x230
do_syscall_64+0x3a/0x90
entry_SYSCALL_64_after_hwframe+0x63/0xcdStable-dep-of: 1bd6406fb5f3 ("VMCI: fix race between vmci_host_setup_notify and vmci_ctx_unset_notify")
--- drivers/misc/vmw_vmci/vmci_host.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/misc/vmw_vmci/vmci_host.c +2 -0
@@ -248,6 +248,8 @@ static int vmci_host_setup_notify(struct vmci_ctx *context, context->notify_page =NULL ;return VMCI_ERROR_GENERIC ; } +if (context->notify_page ==NULL ) +return VMCI_ERROR_UNAVAILABLE ;/* * Map the locked page and set up notify pointer.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 25/208 VMCI: fix race between vmci_host_setup_notify and vmci_ctx_unset_notify
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wupeng Ma <[email protected]>
[ Upstream commit 1bd6406fb5f36c2bb1e96e27d4c3e9f4d09edde4 ]
During our test, it is found that a warning can be trigger in try_grab_folio as follow:
------------[ cut here ]------------ WARNING: CPU: 0 PID: 1678 at mm/gup.c:147 try_grab_folio+0x106/0x130 Modules linked in: CPU: 0 UID: 0 PID: 1678 Comm: syz.3.31 Not tainted 6.15.0-rc5 #163 PREEMPT(undef) RIP: 0010:try_grab_folio+0x106/0x130 Call Trace: <TASK> follow_huge_pmd+0x240/0x8e0 follow_pmd_mask.constprop.0.isra.0+0x40b/0x5c0 follow_pud_mask.constprop.0.isra.0+0x14a/0x170 follow_page_mask+0x1c2/0x1f0 __get_user_pages+0x176/0x950 __gup_longterm_locked+0x15b/0x1060 ? gup_fast+0x120/0x1f0 gup_fast_fallback+0x17e/0x230 get_user_pages_fast+0x5f/0x80 vmci_host_unlocked_ioctl+0x21c/0xf80 RIP: 0033:0x54d2cd ---[ end trace 0000000000000000 ]---
Digging into the source, context->notify_page may init by get_user_pages_fast and can be seen in vmci_ctx_unset_notify which will try to put_page. However get_user_pages_fast is not finished here and lead to following try_grab_folio warning. The race condition is shown as follow:
cpu0 cpu1vmci_host_do_set_notifyvmci_host_setup_notifyget_user_pages_fast(uva, 1, FOLL_WRITE, &context->notify_page); lockless_pages_from_mmgup_pgd_rangegup_huge_pmd // update &context->notify_page
vmci_host_do_set_notify vmci_ctx_unset_notify notify_page = context->notify_page; if (notify_page) put_page(notify_page); // page is freed
__gup_longterm_locked__get_user_pagesfollow_trans_huge_pmdtry_grab_folio // warn here
To slove this, use local variable page to make notify_page can be seen after finish get_user_pages_fast.
--- drivers/misc/vmw_vmci/vmci_host.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/misc/vmw_vmci/vmci_host.c +5 -6
@@ -227,6 +227,7 @@ static int drv_cp_harray_to_user(void __user *user_buf_uva,static int vmci_host_setup_notify (struct vmci_ctx *context,unsigned long uva) { +struct page *page;int retval;if (context->notify_page) {
@@ -243,13 +244,11 @@ static int vmci_host_setup_notify(struct vmci_ctx *context,/* * Lock physical page backing a given user VA. */ - retval =get_user_pages_fast (uva,1 ,FOLL_WRITE , &context->notify_page); -if (retval !=1 ) { - context->notify_page =NULL ; + retval =get_user_pages_fast (uva,1 ,FOLL_WRITE , &page); +if (retval !=1 )return VMCI_ERROR_GENERIC ; - } -if (context->notify_page ==NULL ) -return VMCI_ERROR_UNAVAILABLE ; + + context->notify_page = page;/* * Map the locked page and set up notify pointer.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 26/208 usb: typec: tcpci_maxim: Fix uninitialized return variable
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Badhri Jagan Sridharan <[email protected]>
[ Upstream commit 7695cae24b29edd2dbd3b3a77a7264cd6d9ca67a ]
New smatch warnings:drivers/usb/typec/tcpm/tcpci_maxim.c:324 max_tcpci_irq() error: uninitialized symbol 'irq_return'. drivers/usb/typec/tcpm/tcpci_maxim.c:407 max_tcpci_probe() warn: passing zero to 'PTR_ERR'
The change fixes the above warnings by initializing irq_return and replacing IS_ERR_OR_NULL with IS_ERR.
Stable-dep-of: 0736299d090f ("usb: typec: tcpm/tcpci_maxim: Fix bounds check in process_rx()")
--- drivers/usb/typec/tcpm/tcpci_maxim.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/typec/tcpm/tcpci_maxim.c +2 -2
@@ -344,7 +344,7 @@ static irqreturn_t max_tcpci_irq(int irq, void *dev_id) {struct max_tcpci_chip *chip = dev_id;u16 status; -irqreturn_t irq_return; +irqreturn_t irq_return =IRQ_HANDLED ;int ret;if (!chip->port)
@@ -444,7 +444,7 @@ static int max_tcpci_probe(struct i2c_client *client, const struct i2c_device_idmax_tcpci_init_regs (chip); chip->tcpci =tcpci_register_port (chip->dev, &chip->data); -if (IS_ERR_OR_NULL (chip->tcpci)) { +if (IS_ERR (chip->tcpci)) {dev_err (&client->dev,"TCPCI port registration failed" ); ret =PTR_ERR (chip->tcpci);return PTR_ERR (chip->tcpci);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 27/208 usb: typec: tcpci_maxim: remove redundant assignment
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junlin Yang <[email protected]>
[ Upstream commit a63b53e19bdffd9338fab4536e8bc422ea812b4d ]
PTR_ERR(chip->tcpci) has been used as a return value, it is not necessary to assign it to ret, so remove it.
Stable-dep-of: 0736299d090f ("usb: typec: tcpm/tcpci_maxim: Fix bounds check in process_rx()")
--- drivers/usb/typec/tcpm/tcpci_maxim.c | 1 - 1 file changed, 1 deletion(-)
drivers/usb/typec/tcpm/tcpci_maxim.c +0 -1
@@ -446,7 +446,6 @@ static int max_tcpci_probe(struct i2c_client *client, const struct i2c_device_id chip->tcpci =tcpci_register_port (chip->dev, &chip->data);if (IS_ERR (chip->tcpci)) {dev_err (&client->dev,"TCPCI port registration failed" ); - ret =PTR_ERR (chip->tcpci);return PTR_ERR (chip->tcpci); } chip->port =tcpci_get_tcpm_port (chip->tcpci);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 28/208 usb: typec: tcpci_maxim: add terminating newlines to logging
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junlin Yang <[email protected]>
[ Upstream commit 7cbcd008e104d16849e5054e69f0a3d55eaeb664 ]
Add terminating '\n' to the formats where missed.
Stable-dep-of: 0736299d090f ("usb: typec: tcpm/tcpci_maxim: Fix bounds check in process_rx()")
--- drivers/usb/typec/tcpm/tcpci_maxim.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/usb/typec/tcpm/tcpci_maxim.c +6 -6
@@ -151,7 +151,7 @@ static void process_rx(struct max_tcpci_chip *chip, u16 status)*/ ret =regmap_raw_read (chip->data.regmap,TCPC_RX_BYTE_CNT , rx_buf,2 );if (ret <0 ) { -dev_err (chip->dev,"TCPC_RX_BYTE_CNT read failed ret:%d" , ret); +dev_err (chip->dev,"TCPC_RX_BYTE_CNT read failed ret:%d\n" , ret);return ; }
@@ -160,13 +160,13 @@ static void process_rx(struct max_tcpci_chip *chip, u16 status)if (count ==0 || frame_type !=TCPC_RX_BUF_FRAME_TYPE_SOP ) {max_tcpci_write16 (chip,TCPC_ALERT ,TCPC_ALERT_RX_STATUS ); -dev_err (chip->dev,"%s" , count ==0 ?"error: count is 0" : +dev_err (chip->dev,"%s\n" , count ==0 ?"error: count is 0" :"error frame_type is not SOP" );return ; }if (count >sizeof (struct pd_message ) || count +1 >TCPC_RECEIVE_BUFFER_LEN ) { -dev_err (chip->dev,"Invalid TCPC_RX_BYTE_CNT %d" , count); +dev_err (chip->dev,"Invalid TCPC_RX_BYTE_CNT %d\n" , count);return ; }
@@ -177,7 +177,7 @@ static void process_rx(struct max_tcpci_chip *chip, u16 status) count +=1 ; ret =regmap_raw_read (chip->data.regmap,TCPC_RX_BYTE_CNT , rx_buf, count);if (ret <0 ) { -dev_err (chip->dev,"Error: TCPC_RX_BYTE_CNT read failed: %d" , ret); +dev_err (chip->dev,"Error: TCPC_RX_BYTE_CNT read failed: %d\n" , ret);return ; }
@@ -311,7 +311,7 @@ static irqreturn_t _max_tcpci_irq(struct max_tcpci_chip *chip, u16 status)return ret;if (reg_status &TCPC_SINK_FAST_ROLE_SWAP ) { -dev_info (chip->dev,"FRS Signal" ); +dev_info (chip->dev,"FRS Signal\n" );tcpm_sink_frs (chip->port); } }
@@ -445,7 +445,7 @@ static int max_tcpci_probe(struct i2c_client *client, const struct i2c_device_idmax_tcpci_init_regs (chip); chip->tcpci =tcpci_register_port (chip->dev, &chip->data);if (IS_ERR (chip->tcpci)) { -dev_err (&client->dev,"TCPCI port registration failed" ); +dev_err (&client->dev,"TCPCI port registration failed\n" );return PTR_ERR (chip->tcpci); } chip->port =tcpci_get_tcpm_port (chip->tcpci);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 29/208 usb: typec: tcpm/tcpci_maxim: Fix bounds check in process_rx()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amit Sunil Dhamne <[email protected]>
[ Upstream commit 0736299d090f5c6a1032678705c4bc0a9511a3db ]
Register read of TCPC_RX_BYTE_CNT returns the total size consisting of:
PD message (pending read) size + 1 Byte for Frame Type (SOP*)
This is validated against the max PD message (struct pd_message) size without accounting for the extra byte for the frame type. Note that the struct pd_message does not contain a field for the frame_type. This results in false negatives when the "PD message (pending read)" is equal to the max PD message size.
--- drivers/usb/typec/tcpm/tcpci_maxim.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/typec/tcpm/tcpci_maxim.c +2 -1
@@ -165,7 +165,8 @@ static void process_rx(struct max_tcpci_chip *chip, u16 status)return ; } -if (count >sizeof (struct pd_message ) || count +1 >TCPC_RECEIVE_BUFFER_LEN ) { +if (count >sizeof (struct pd_message ) +1 || + count +1 >TCPC_RECEIVE_BUFFER_LEN ) {dev_err (chip->dev,"Invalid TCPC_RX_BYTE_CNT %d\n" , count);return ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 30/208 fs/jfs: consolidate sanity checking in dbMount
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Kleikamp <[email protected]>
[ Upstream commit 0d250b1c52484d489e31df2cf9118b7c4bd49d31 ]
Sanity checks have been added to dbMount as individual if clauses with identical error handling. Move these all into one clause.
Stable-dep-of: 37bfb464ddca ("jfs: validate AG parameters in dbMount() to prevent crashes")
--- fs/jfs/jfs_dmap.c | 37 +++++++++---------------------------- 1 file changed, 9 insertions(+), 28 deletions(-)
fs/jfs/jfs_dmap.c +9 -28
@@ -178,45 +178,26 @@ int dbMount(struct inode *ipbmap) dbmp_le = (struct dbmap_disk *) mp->data; bmp->db_mapsize =le64_to_cpu (dbmp_le->dn_mapsize); bmp->db_nfree =le64_to_cpu (dbmp_le->dn_nfree); - bmp->db_l2nbperpage =le32_to_cpu (dbmp_le->dn_l2nbperpage); -if (bmp->db_l2nbperpage >L2PSIZE -L2MINBLOCKSIZE || - bmp->db_l2nbperpage <0 ) { - err = -EINVAL ; - goto err_release_metapage; - } - bmp->db_numag =le32_to_cpu (dbmp_le->dn_numag); -if (!bmp->db_numag || bmp->db_numag >MAXAG ) { - err = -EINVAL ; - goto err_release_metapage; - } - bmp->db_maxlevel =le32_to_cpu (dbmp_le->dn_maxlevel); bmp->db_maxag =le32_to_cpu (dbmp_le->dn_maxag); bmp->db_agpref =le32_to_cpu (dbmp_le->dn_agpref); -if (bmp->db_maxag >=MAXAG || bmp->db_maxag <0 || - bmp->db_agpref >=MAXAG || bmp->db_agpref <0 ) { - err = -EINVAL ; - goto err_release_metapage; - } - bmp->db_aglevel =le32_to_cpu (dbmp_le->dn_aglevel); bmp->db_agheight =le32_to_cpu (dbmp_le->dn_agheight); bmp->db_agwidth =le32_to_cpu (dbmp_le->dn_agwidth); -if (!bmp->db_agwidth) { - err = -EINVAL ; - goto err_release_metapage; - } bmp->db_agstart =le32_to_cpu (dbmp_le->dn_agstart); bmp->db_agl2size =le32_to_cpu (dbmp_le->dn_agl2size); -if (bmp->db_agl2size >L2MAXL2SIZE -L2MAXAG || - bmp->db_agl2size <0 ) { - err = -EINVAL ; - goto err_release_metapage; - } -if (((bmp->db_mapsize -1 ) >> bmp->db_agl2size) >MAXAG ) { +if ((bmp->db_l2nbperpage >L2PSIZE -L2MINBLOCKSIZE ) || + (bmp->db_l2nbperpage <0 ) || + !bmp->db_numag || (bmp->db_numag >MAXAG ) || + (bmp->db_maxag >=MAXAG ) || (bmp->db_maxag <0 ) || + (bmp->db_agpref >=MAXAG ) || (bmp->db_agpref <0 ) || + !bmp->db_agwidth || + (bmp->db_agl2size >L2MAXL2SIZE -L2MAXAG ) || + (bmp->db_agl2size <0 ) || + ((bmp->db_mapsize -1 ) >> bmp->db_agl2size) >MAXAG ) { err = -EINVAL ; goto err_release_metapage; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 31/208 jfs: validate AG parameters in dbMount() to prevent crashes
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasiliy Kovalev <[email protected]>
[ Upstream commit 37bfb464ddca87f203071b5bd562cd91ddc0b40a ]
Validate db_agheight, db_agwidth, and db_agstart in dbMount to catch corrupted metadata early and avoid undefined behavior in dbAllocAG. Limits are derived from L2LPERCTL, LPERCTL/MAXAG, and CTLTREESIZE:
- agheight: 0 to L2LPERCTL/2 (0 to 5) ensures shift (L2LPERCTL - 2*agheight) >= 0.
- agwidth: 1 to min(LPERCTL/MAXAG, 2^(L2LPERCTL - 2*agheight)) ensures agperlev >= 1.
- Ranges: 1-8 (agheight 0-3), 1-4 (agheight 4), 1 (agheight 5).
- LPERCTL/MAXAG = 1024/128 = 8 limits leaves per AG;
2^(10 - 2*agheight) prevents division to 0.- agstart: 0 to CTLTREESIZE-1 - agwidth*(MAXAG-1) keeps ti within stree (size 1365).
- Ranges: 0-1237 (agwidth 1), 0-348 (agwidth 8).
UBSAN: shift-out-of-bounds in fs/jfs/jfs_dmap.c:1400:9 shift exponent -335544310 is negative CPU: 0 UID: 0 PID: 5822 Comm: syz-executor130 Not tainted 6.14.0-rc5-syzkaller #0 Hardware name: Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 ubsan_epilogue lib/ubsan.c:231 [inline] __ubsan_handle_shift_out_of_bounds+0x3c8/0x420 lib/ubsan.c:468 dbAllocAG+0x1087/0x10b0 fs/jfs/jfs_dmap.c:1400 dbDiscardAG+0x352/0xa20 fs/jfs/jfs_dmap.c:1613 jfs_ioc_trim+0x45a/0x6b0 fs/jfs/jfs_discard.c:105 jfs_ioctl+0x2cd/0x3e0 fs/jfs/ioctl.c:131 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:906 [inline] __se_sys_ioctl+0xf5/0x170 fs/ioctl.c:892 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- fs/jfs/jfs_dmap.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/jfs/jfs_dmap.c +5 -1
@@ -194,7 +194,11 @@ int dbMount(struct inode *ipbmap) !bmp->db_numag || (bmp->db_numag >MAXAG ) || (bmp->db_maxag >=MAXAG ) || (bmp->db_maxag <0 ) || (bmp->db_agpref >=MAXAG ) || (bmp->db_agpref <0 ) || - !bmp->db_agwidth || + (bmp->db_agheight <0 ) || (bmp->db_agheight > (L2LPERCTL >>1 )) || + (bmp->db_agwidth <1 ) || (bmp->db_agwidth > (LPERCTL /MAXAG )) || + (bmp->db_agwidth > (1 << (L2LPERCTL - (bmp->db_agheight <<1 )))) || + (bmp->db_agstart <0 ) || + (bmp->db_agstart > (CTLTREESIZE -1 - bmp->db_agwidth * (MAXAG -1 ))) || (bmp->db_agl2size >L2MAXL2SIZE -L2MAXAG ) || (bmp->db_agl2size <0 ) || ((bmp->db_mapsize - 1) >> bmp->db_agl2size) > MAXAG) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 32/208 media: omap3isp: use sgtable-based scatterlist wrappers
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Szyprowski <[email protected]>
[ Upstream commit 3de572fe2189a4a0bd80295e1f478401e739498e ]
Use common wrappers operating directly on the struct sg_table objects to fix incorrect use of scatterlists sync calls. dma_sync_sg_for_*() functions have to be called with the number of elements originally passed to dma_map_sg_*() function, not the one returned in sgtable's nents.
--- drivers/media/platform/omap3isp/ispccdc.c | 8 ++++---- drivers/media/platform/omap3isp/ispstat.c | 6 ++---- 2 files changed, 6 insertions(+), 8 deletions(-)
drivers/media/platform/omap3isp/ispccdc.c +4 -4
@@ -446,8 +446,8 @@ static int ccdc_lsc_config(struct isp_ccdc_device *ccdc,if (ret <0 ) goto done; -dma_sync_sg_for_cpu (isp->dev, req->table.sgt.sgl, - req->table.sgt.nents,DMA_TO_DEVICE ); +dma_sync_sgtable_for_cpu (isp->dev, &req->table.sgt, +DMA_TO_DEVICE );if (copy_from_user (req->table.addr, config->lsc, req->config.size)) {
@@ -455,8 +455,8 @@ static int ccdc_lsc_config(struct isp_ccdc_device *ccdc, goto done; } -dma_sync_sg_for_device (isp->dev, req->table.sgt.sgl, - req->table.sgt.nents,DMA_TO_DEVICE ); +dma_sync_sgtable_for_device (isp->dev, &req->table.sgt, +DMA_TO_DEVICE ); }spin_lock_irqsave (&ccdc->lsc.req_lock, flags);
drivers/media/platform/omap3isp/ispstat.c +2 -4
@@ -161,8 +161,7 @@ static void isp_stat_buf_sync_for_device(struct ispstat *stat,if (ISP_STAT_USES_DMAENGINE (stat))return ; -dma_sync_sg_for_device (stat->isp->dev, buf->sgt.sgl, - buf->sgt.nents,DMA_FROM_DEVICE ); +dma_sync_sgtable_for_device (stat->isp->dev, &buf->sgt,DMA_FROM_DEVICE ); } static void isp_stat_buf_sync_for_cpu(struct ispstat *stat,
@@ -171,8 +170,7 @@ static void isp_stat_buf_sync_for_cpu(struct ispstat *stat,if (ISP_STAT_USES_DMAENGINE (stat))return ; -dma_sync_sg_for_cpu (stat->isp->dev, buf->sgt.sgl, - buf->sgt.nents,DMA_FROM_DEVICE ); +dma_sync_sgtable_for_cpu (stat->isp->dev, &buf->sgt,DMA_FROM_DEVICE ); }static void isp_stat_buf_clear (struct ispstat *stat)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 33/208 can: tcan4x5x: fix power regulator retrieval during probe
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brett Werling <[email protected]>
[ Upstream commit db22720545207f734aaa9d9f71637bfc8b0155e0 ]
Fixes the power regulator retrieval in tcan4x5x_can_probe() by ensuring the regulator pointer is not set to NULL in the successful return from devm_regulator_get_optional().
--- drivers/net/can/m_can/tcan4x5x.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/can/m_can/tcan4x5x.c +5 -4
@@ -417,10 +417,11 @@ static int tcan4x5x_can_probe(struct spi_device *spi) } priv->power =devm_regulator_get_optional (&spi->dev,"vsup" ); -if (PTR_ERR (priv->power) == -EPROBE_DEFER ) { - ret = -EPROBE_DEFER ; - goto out_m_can_class_free_dev; - }else { +if (IS_ERR (priv->power)) { +if (PTR_ERR (priv->power) == -EPROBE_DEFER ) { + ret = -EPROBE_DEFER ; + goto out_m_can_class_free_dev; + } priv->power =NULL ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 34/208 f2fs: dont over-report free space or inodes in statvfs
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit a9201960623287927bf5776de3f70fb2fbde7e02 ]
This fixes an analogus bug that was fixed in modern filesystems:
a) xfs in commit 4b8d867ca6e2 ("xfs: don't over-report free space or inodes in statvfs")
b) ext4 in commit f87d3af74193 ("ext4: don't over-report free space or inodes in statvfs")
where statfs can report misleading / incorrect information where project quota is enabled, and the free space is less than the remaining quota.
This commit will resolve a test failure in generic/762 which tests for this bug.
generic/762 - output mismatch (see /share/git/fstests/results//generic/762.out.bad)
# --- tests/generic/762.out 2025-04-15 10:21:53.371067071 +0800 # +++ /share/git/fstests/results//generic/762.out.bad 2025-05-13 16:13:37.000000000 +0800 # @@ -6,8 +6,10 @@ # root blocks2 is in range # dir blocks2 is in range # root bavail2 is in range # -dir bavail2 is in range # +dir bavail2 has value of 1539066 # +dir bavail2 is NOT in range 304734.87 .. 310891.13
# root blocks3 is in range
# ...
# (Run 'diff -u /share/git/fstests/tests/generic/762.out /share/git/fstests/results//generic/762.out.bad' to see the entire diff)
HINT: You _MAY_ be missing kernel fix:
XXXXXXXXXXXXXX xfs: don't over-report free space or inodes in statvfs
--- fs/f2fs/super.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)
fs/f2fs/super.c +18 -12
@@ -1433,26 +1433,32 @@ static int f2fs_statfs_project(struct super_block *sb, limit =min_not_zero (dquot->dq_dqb.dqb_bsoftlimit, dquot->dq_dqb.dqb_bhardlimit); -if (limit) - limit >>= sb->s_blocksize_bits; + limit >>= sb->s_blocksize_bits; + +if (limit) { +uint64_t remaining =0 ; -if (limit && buf->f_blocks > limit) { curblock = (dquot->dq_dqb.dqb_curspace + dquot->dq_dqb.dqb_rsvspace) >> sb->s_blocksize_bits; - buf->f_blocks = limit; - buf->f_bfree = buf->f_bavail = - (buf->f_blocks > curblock) ? - (buf->f_blocks - curblock) :0 ; +if (limit > curblock) + remaining = limit - curblock; + + buf->f_blocks =min (buf->f_blocks, limit); + buf->f_bfree =min (buf->f_bfree, remaining); + buf->f_bavail =min (buf->f_bavail, remaining); } limit =min_not_zero (dquot->dq_dqb.dqb_isoftlimit, dquot->dq_dqb.dqb_ihardlimit); -if (limit && buf->f_files > limit) { - buf->f_files = limit; - buf->f_ffree = - (buf->f_files > dquot->dq_dqb.dqb_curinodes) ? - (buf->f_files - dquot->dq_dqb.dqb_curinodes) :0 ; +if (limit) { +uint64_t remaining =0 ; + +if (limit > dquot->dq_dqb.dqb_curinodes) + remaining = limit - dquot->dq_dqb.dqb_curinodes; + + buf->f_files =min (buf->f_files, limit); + buf->f_ffree =min (buf->f_ffree, remaining); }spin_unlock (&dquot->dq_dqb_lock);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 35/208 RDMA/core: Use refcount_t instead of atomic_t on refcount of iwcm_id_private
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weihang Li <[email protected]>
[ Upstream commit 60dff56d77292062789232f68354f567e1ccf1d2 ]
The refcount_t API will WARN on underflow and overflow of a reference counter, and avoid use-after-free risks.
Stable-dep-of: 6883b680e703 ("RDMA/iwcm: Fix use-after-free of work objects after cm_id destruction")
--- drivers/infiniband/core/iwcm.c | 9 ++++----- drivers/infiniband/core/iwcm.h | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-)
drivers/infiniband/core/iwcm.c +4 -5
@@ -211,8 +211,7 @@ static void free_cm_id(struct iwcm_id_private *cm_id_priv)*/ static int iwcm_deref_id (struct iwcm_id_private *cm_id_priv) { -BUG_ON (atomic_read (&cm_id_priv->refcount)==0 ); -if (atomic_dec_and_test (&cm_id_priv->refcount)) { +if (refcount_dec_and_test (&cm_id_priv->refcount)) {BUG_ON (!list_empty (&cm_id_priv->work_list));free_cm_id (cm_id_priv);return 1 ;
@@ -225,7 +224,7 @@ static void add_ref(struct iw_cm_id *cm_id) {struct iwcm_id_private *cm_id_priv; cm_id_priv = container_of(cm_id, struct iwcm_id_private, id); -atomic_inc (&cm_id_priv->refcount); +refcount_inc (&cm_id_priv->refcount); }static void rem_ref (struct iw_cm_id *cm_id)
@@ -257,7 +256,7 @@ struct iw_cm_id *iw_create_cm_id(struct ib_device *device, cm_id_priv->id.add_ref = add_ref; cm_id_priv->id.rem_ref = rem_ref;spin_lock_init (&cm_id_priv->lock); -atomic_set (&cm_id_priv->refcount,1 ); +refcount_set (&cm_id_priv->refcount,1 );init_waitqueue_head (&cm_id_priv->connect_wait);init_completion (&cm_id_priv->destroy_comp);INIT_LIST_HEAD (&cm_id_priv->work_list);
@@ -1097,7 +1096,7 @@ static int cm_event_handler(struct iw_cm_id *cm_id, } } -atomic_inc (&cm_id_priv->refcount); +refcount_inc (&cm_id_priv->refcount);if (list_empty (&cm_id_priv->work_list)) {list_add_tail (&work->list, &cm_id_priv->work_list);queue_work (iwcm_wq, &work->work);
drivers/infiniband/core/iwcm.h +1 -1
@@ -52,7 +52,7 @@ struct iwcm_id_private {wait_queue_head_t connect_wait;struct list_head work_list;spinlock_t lock; -atomic_t refcount; +refcount_t refcount;struct list_head work_free_list; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 36/208 RDMA/iwcm: Fix use-after-free of work objects after cm_id destruction
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shin'ichiro Kawasaki <[email protected]>
[ Upstream commit 6883b680e703c6b2efddb4e7a8d891ce1803d06b ]
The commit 59c68ac31e15 ("iw_cm: free cm_id resources on the last deref") simplified cm_id resource management by freeing cm_id once all references to the cm_id were removed. The references are removed either upon completion of iw_cm event handlers or when the application destroys the cm_id. This commit introduced the use-after-free condition where cm_id_private object could still be in use by event handler works during the destruction of cm_id. The commit aee2424246f9 ("RDMA/iwcm: Fix a use-after-free related to destroying CM IDs") addressed this use-after- free by flushing all pending works at the cm_id destruction.
However, still another use-after-free possibility remained. It happens with the work objects allocated for each cm_id_priv within alloc_work_entries() during cm_id creation, and subsequently freed in dealloc_work_entries() once all references to the cm_id are removed. If the cm_id's last reference is decremented in the event handler work, the work object for the work itself gets removed, and causes the use- after-free BUG below:
BUG: KASAN: slab-use-after-free in __pwq_activate_work+0x1ff/0x250 Read of size 8 at addr ffff88811f9cf800 by task kworker/u16:1/147091 CPU: 2 UID: 0 PID: 147091 Comm: kworker/u16:1 Not tainted 6.15.0-rc2+ #27 PREEMPT(voluntary) Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-3.fc41 04/01/2014 Workqueue: 0x0 (iw_cm_wq) Call Trace: <TASK> dump_stack_lvl+0x6a/0x90 print_report+0x174/0x554 ? __virt_addr_valid+0x208/0x430 ? __pwq_activate_work+0x1ff/0x250 kasan_report+0xae/0x170 ? __pwq_activate_work+0x1ff/0x250 __pwq_activate_work+0x1ff/0x250 pwq_dec_nr_in_flight+0x8c5/0xfb0 process_one_work+0xc11/0x1460 ? __pfx_process_one_work+0x10/0x10 ? assign_work+0x16c/0x240 worker_thread+0x5ef/0xfd0 ? __pfx_worker_thread+0x10/0x10 kthread+0x3b0/0x770 ? __pfx_kthread+0x10/0x10 ? rcu_is_watching+0x11/0xb0 ? _raw_spin_unlock_irq+0x24/0x50 ? rcu_is_watching+0x11/0xb0 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x30/0x70 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1a/0x30 </TASK> Allocated by task 147416: kasan_save_stack+0x2c/0x50 kasan_save_track+0x10/0x30 __kasan_kmalloc+0xa6/0xb0 alloc_work_entries+0xa9/0x260 [iw_cm] iw_cm_connect+0x23/0x4a0 [iw_cm] rdma_connect_locked+0xbfd/0x1920 [rdma_cm] nvme_rdma_cm_handler+0x8e5/0x1b60 [nvme_rdma] cma_cm_event_handler+0xae/0x320 [rdma_cm] cma_work_handler+0x106/0x1b0 [rdma_cm] process_one_work+0x84f/0x1460 worker_thread+0x5ef/0xfd0 kthread+0x3b0/0x770 ret_from_fork+0x30/0x70 ret_from_fork_asm+0x1a/0x30 Freed by task 147091: kasan_save_stack+0x2c/0x50 kasan_save_track+0x10/0x30 kasan_save_free_info+0x37/0x60 __kasan_slab_free+0x4b/0x70 kfree+0x13a/0x4b0 dealloc_work_entries+0x125/0x1f0 [iw_cm] iwcm_deref_id+0x6f/0xa0 [iw_cm] cm_work_handler+0x136/0x1ba0 [iw_cm] process_one_work+0x84f/0x1460 worker_thread+0x5ef/0xfd0 kthread+0x3b0/0x770 ret_from_fork+0x30/0x70 ret_from_fork_asm+0x1a/0x30 Last potentially related work creation: kasan_save_stack+0x2c/0x50 kasan_record_aux_stack+0xa3/0xb0 __queue_work+0x2ff/0x1390 queue_work_on+0x67/0xc0 cm_event_handler+0x46a/0x820 [iw_cm] siw_cm_upcall+0x330/0x650 [siw] siw_cm_work_handler+0x6b9/0x2b20 [siw] process_one_work+0x84f/0x1460 worker_thread+0x5ef/0xfd0 kthread+0x3b0/0x770 ret_from_fork+0x30/0x70 ret_from_fork_asm+0x1a/0x30
This BUG is reproducible by repeating the blktests test case nvme/061 for the rdma transport and the siw driver.
To avoid the use-after-free of cm_id_private work objects, ensure that the last reference to the cm_id is decremented not in the event handler works, but in the cm_id destruction context. For that purpose, move iwcm_deref_id() call from destroy_cm_id() to the callers of destroy_cm_id(). In iw_destroy_cm_id(), call iwcm_deref_id() after flushing the pending works.
During the fix work, I noticed that iw_destroy_cm_id() is called from cm_work_handler() and process_event() context. However, the comment of iw_destroy_cm_id() notes that the function "cannot be called by the event thread". Drop the false comment.
--- drivers/infiniband/core/iwcm.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-)
drivers/infiniband/core/iwcm.c +15 -14
@@ -367,12 +367,9 @@ EXPORT_SYMBOL(iw_cm_disconnect);/* * CM_ID <-- DESTROYING * -* Clean up all resources associated with the connection and release -* the initial reference taken by iw_create_cm_id. -* -* Returns true if and only if the last cm_id_priv reference has been dropped. +* Clean up all resources associated with the connection. */ -static bool destroy_cm_id (struct iw_cm_id *cm_id) +static void destroy_cm_id (struct iw_cm_id *cm_id) {struct iwcm_id_private *cm_id_priv;struct ib_qp *qp;
@@ -441,20 +438,22 @@ static bool destroy_cm_id(struct iw_cm_id *cm_id)iwpm_remove_mapinfo (&cm_id->local_addr, &cm_id->m_local_addr);iwpm_remove_mapping (&cm_id->local_addr,RDMA_NL_IWCM ); } - -return iwcm_deref_id (cm_id_priv); }/* -* This function is only called by the application thread and cannot -* be called by the event thread. The function will wait for all -* references to be released on the cm_id and then kfree the cm_id -* object. +* Destroy cm_id. If the cm_id still has other references, wait for all +* references to be released on the cm_id and then release the initial +* reference taken by iw_create_cm_id. */ void iw_destroy_cm_id (struct iw_cm_id *cm_id) { -if (!destroy_cm_id (cm_id)) +struct iwcm_id_private *cm_id_priv; + + cm_id_priv = container_of(cm_id, struct iwcm_id_private, id); +destroy_cm_id (cm_id); +if (refcount_read (&cm_id_priv->refcount) >1 )flush_workqueue (iwcm_wq); +iwcm_deref_id (cm_id_priv); }EXPORT_SYMBOL (iw_destroy_cm_id);
@@ -1037,8 +1036,10 @@ static void cm_work_handler(struct work_struct *_work)if (!test_bit (IWCM_F_DROP_EVENTS , &cm_id_priv->flags)) { ret =process_event (cm_id_priv, &levent); -if (ret) -WARN_ON_ONCE (destroy_cm_id (&cm_id_priv->id)); +if (ret) { +destroy_cm_id (&cm_id_priv->id); +WARN_ON_ONCE (iwcm_deref_id (cm_id_priv)); + } }else pr_debug ("dropping event %d\n" , levent.event);if (iwcm_deref_id (cm_id_priv))
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 37/208 uio: uio_hv_generic: use devm_kzalloc() for private data alloc
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandru Ardelean <[email protected]>
[ Upstream commit 74e71964b1a9ffd34fa4b6ec8f2fa13e7cf0ac7a ]
This is a minor cleanup for the management of the private object of this driver. The allocation can be tied to the life-time of the hv_device object.
This cleans up a bit the exit & error paths, since the object doesn't need to be explicitly free'd anymore.
Stable-dep-of: 0315fef2aff9 ("uio_hv_generic: Align ring size to system page")
--- drivers/uio/uio_hv_generic.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/uio/uio_hv_generic.c +2 -6
@@ -256,14 +256,14 @@ hv_uio_probe(struct hv_device *dev,return -ENOTSUPP ; } - pdata =kzalloc (sizeof (*pdata),GFP_KERNEL ); + pdata =devm_kzalloc (&dev->device,sizeof (*pdata),GFP_KERNEL );if (!pdata)return -ENOMEM ; ret =vmbus_alloc_ring (channel,HV_RING_SIZE *PAGE_SIZE ,HV_RING_SIZE *PAGE_SIZE );if (ret) - goto fail; +return ret;set_channel_read_mode (channel,HV_CALL_ISR );
@@ -360,8 +360,6 @@ hv_uio_probe(struct hv_device *dev, fail_close:hv_uio_cleanup (dev, pdata); -fail: -kfree (pdata);return ret; }
@@ -377,10 +375,8 @@ hv_uio_remove(struct hv_device *dev)sysfs_remove_bin_file (&dev->channel->kobj, &ring_buffer_bin_attr);uio_unregister_device (&pdata->info);hv_uio_cleanup (dev, pdata); -hv_set_drvdata (dev,NULL );vmbus_free_ring (dev->channel); -kfree (pdata);return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 38/208 Drivers: hv: vmbus: Fix duplicate CPU assignments within a device
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haiyang Zhang <[email protected]>
[ Upstream commit 7c9ff3deeee61b253715dcf968a6307af148c9b2 ]
The vmbus module uses a rotational algorithm to assign target CPUs to a device's channels. Depending on the timing of different device's channel offers, different channels of a device may be assigned to the same CPU.
For example on a VM with 2 CPUs, if NIC A and B's channels are offered in the following order, NIC A will have both channels on CPU0, and NIC B will have both channels on CPU1 -- see below. This kind of assignment causes RSS load that is spreading across different channels to end up on the same CPU.
Timing of channel offers:
NIC A channel 0
NIC B channel 0
NIC A channel 1
NIC B channel 1
VMBUS ID 14: Class_ID = {f8615163-df3e-46c5-913f-f2d2f965ed0e} - Synthetic network adapter
Device_ID = {cab064cd-1f31-47d5-a8b4-9d57e320cccd}
Sysfs path: /sys/bus/vmbus/devices/cab064cd-1f31-47d5-a8b4-9d57e320cccd
Rel_ID=14, target_cpu=0
Rel_ID=17, target_cpu=0VMBUS ID 16: Class_ID = {f8615163-df3e-46c5-913f-f2d2f965ed0e} - Synthetic network adapter
Device_ID = {244225ca-743e-4020-a17d-d7baa13d6cea}
Sysfs path: /sys/bus/vmbus/devices/244225ca-743e-4020-a17d-d7baa13d6cea
Rel_ID=16, target_cpu=1
Rel_ID=18, target_cpu=1Update the vmbus CPU assignment algorithm to avoid duplicate CPU assignments within a device.
The new algorithm iterates num_online_cpus + 1 times.
The existing rotational algorithm to find "next NUMA & CPU" is still here. But if the resulting CPU is already used by the same device, it will try the next CPU.
In the last iteration, it assigns the channel to the next available CPU like the existing algorithm. This is not normally expected, because during device probe, we limit the number of channels of a device to be <= number of online CPUs.
Stable-dep-of: 0315fef2aff9 ("uio_hv_generic: Align ring size to system page")
--- drivers/hv/channel_mgmt.c | 96 ++++++++++++++++++++++++++------------- 1 file changed, 64 insertions(+), 32 deletions(-)
drivers/hv/channel_mgmt.c +64 -32
@@ -579,6 +579,17 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)*/ mutex_lock (&vmbus_connection.channel_mutex); +list_for_each_entry (channel, &vmbus_connection.chn_list, listentry) { +if (guid_equal (&channel->offermsg.offer.if_type, + &newchannel->offermsg.offer.if_type) && +guid_equal (&channel->offermsg.offer.if_instance, + &newchannel->offermsg.offer.if_instance)) { + fnew = false; + newchannel->primary_channel = channel; +break ; + } + } +init_vp_index (newchannel);/* Remember the channels that should be cleaned up upon suspend. */
@@ -591,16 +602,6 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)*/ atomic_dec (&vmbus_connection.offer_in_progress); -list_for_each_entry (channel, &vmbus_connection.chn_list, listentry) { -if (guid_equal (&channel->offermsg.offer.if_type, - &newchannel->offermsg.offer.if_type) && -guid_equal (&channel->offermsg.offer.if_instance, - &newchannel->offermsg.offer.if_instance)) { - fnew = false; -break ; - } - } -if (fnew) {list_add_tail (&newchannel->listentry, &vmbus_connection.chn_list);
@@ -622,7 +623,6 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)/* * Process the sub-channel. */ - newchannel->primary_channel = channel;list_add_tail (&newchannel->sc_list, &channel->sc_list); }
@@ -658,6 +658,30 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)queue_work (wq, &newchannel->add_channel_work); } +/* +* Check if CPUs used by other channels of the same device. +* It should only be called by init_vp_index(). +*/ +static bool hv_cpuself_used (u32 cpu,struct vmbus_channel *chn) +{ +struct vmbus_channel *primary = chn->primary_channel; +struct vmbus_channel *sc; + +lockdep_assert_held (&vmbus_connection.channel_mutex); + +if (!primary) +return false; + +if (primary->target_cpu == cpu) +return true; + +list_for_each_entry (sc, &primary->sc_list, sc_list) +if (sc != chn && sc->target_cpu == cpu) +return true; + +return false; +} +/* * We use this state to statically distribute the channel interrupt load. */
@@ -677,6 +701,7 @@ static int next_numa_node_id;static void init_vp_index (struct vmbus_channel *channel) {bool perf_chn =hv_is_perf_channel (channel); +u32 i, ncpu =num_online_cpus ();cpumask_var_t available_mask;struct cpumask *alloced_mask;u32 target_cpu;
@@ -699,31 +724,38 @@ static void init_vp_index(struct vmbus_channel *channel)return ; } -while (true) { - numa_node = next_numa_node_id++; -if (numa_node == nr_node_ids) { - next_numa_node_id =0 ; -continue ; +for (i =1 ; i <= ncpu +1 ; i++) { +while (true) { + numa_node = next_numa_node_id++; +if (numa_node == nr_node_ids) { + next_numa_node_id =0 ; +continue ; + } +if (cpumask_empty (cpumask_of_node (numa_node))) +continue ; +break ; } -if (cpumask_empty (cpumask_of_node (numa_node))) -continue ; -break ; - } - alloced_mask = &hv_context.hv_numa_map[numa_node]; + alloced_mask = &hv_context.hv_numa_map[numa_node]; -if (cpumask_weight (alloced_mask) == -cpumask_weight (cpumask_of_node (numa_node))) { -/* -* We have cycled through all the CPUs in the node; -* reset the alloced map. -*/ -cpumask_clear (alloced_mask); - } +if (cpumask_weight (alloced_mask) == +cpumask_weight (cpumask_of_node (numa_node))) { +/* +* We have cycled through all the CPUs in the node; +* reset the alloced map. +*/ +cpumask_clear (alloced_mask); + } -cpumask_xor (available_mask, alloced_mask,cpumask_of_node (numa_node)); +cpumask_xor (available_mask, alloced_mask, +cpumask_of_node (numa_node)); - target_cpu =cpumask_first (available_mask); -cpumask_set_cpu (target_cpu, alloced_mask); + target_cpu =cpumask_first (available_mask); +cpumask_set_cpu (target_cpu, alloced_mask); + +if (channel->offermsg.offer.sub_channel_index >= ncpu || + i > ncpu || !hv_cpuself_used (target_cpu, channel)) +break ; + } channel->target_cpu = target_cpu;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 39/208 Drivers: hv: Rename alloced to allocated
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vitaly Kuznetsov <[email protected]>
[ Upstream commit de96e8a09889b35dd8d1cb6d19ef2bb123b05be1 ]
'Alloced' is not a real word and only saves us two letters, let's use 'allocated' instead.
No functional change intended.
Stable-dep-of: 0315fef2aff9 ("uio_hv_generic: Align ring size to system page")
--- drivers/hv/channel_mgmt.c | 18 +++++++++--------- drivers/hv/hyperv_vmbus.h | 14 +++++++------- drivers/hv/vmbus_drv.c | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-)
drivers/hv/channel_mgmt.c +9 -9
@@ -429,7 +429,7 @@ void hv_process_channel_removal(struct vmbus_channel *channel)* init_vp_index() can (re-)use the CPU. */ if (hv_is_perf_channel (channel)) -hv_clear_alloced_cpu (channel->target_cpu); +hv_clear_allocated_cpu (channel->target_cpu);/* * Upon suspend, an in-use hv_sock channel is marked as "rescinded" and
@@ -703,7 +703,7 @@ static void init_vp_index(struct vmbus_channel *channel)bool perf_chn =hv_is_perf_channel (channel);u32 i, ncpu =num_online_cpus ();cpumask_var_t available_mask; -struct cpumask *alloced_mask; +struct cpumask *allocated_mask;u32 target_cpu;int numa_node;
@@ -720,7 +720,7 @@ static void init_vp_index(struct vmbus_channel *channel)*/ channel->target_cpu =VMBUS_CONNECT_CPU ;if (perf_chn) -hv_set_alloced_cpu (VMBUS_CONNECT_CPU ); +hv_set_allocated_cpu (VMBUS_CONNECT_CPU );return ; }
@@ -735,22 +735,22 @@ static void init_vp_index(struct vmbus_channel *channel)continue ;break ; } - alloced_mask = &hv_context.hv_numa_map[numa_node]; + allocated_mask = &hv_context.hv_numa_map[numa_node]; -if (cpumask_weight (alloced_mask) == +if (cpumask_weight (allocated_mask) ==cpumask_weight (cpumask_of_node (numa_node))) {/* * We have cycled through all the CPUs in the node; -* reset the alloced map. +* reset the allocated map. */ -cpumask_clear (alloced_mask); +cpumask_clear (allocated_mask); } -cpumask_xor (available_mask, alloced_mask, +cpumask_xor (available_mask, allocated_mask,cpumask_of_node (numa_node)); target_cpu =cpumask_first (available_mask); -cpumask_set_cpu (target_cpu, alloced_mask); +cpumask_set_cpu (target_cpu, allocated_mask);if (channel->offermsg.offer.sub_channel_index >= ncpu || i > ncpu || !hv_cpuself_used (target_cpu, channel))
drivers/hv/hyperv_vmbus.h +7 -7
@@ -406,7 +406,7 @@ static inline bool hv_is_perf_channel(struct vmbus_channel *channel)return vmbus_devs[channel->device_id].perf_device; } -static inline bool hv_is_alloced_cpu (unsigned int cpu) +static inline bool hv_is_allocated_cpu (unsigned int cpu) {struct vmbus_channel *channel, *sc;
@@ -428,23 +428,23 @@ static inline bool hv_is_alloced_cpu(unsigned int cpu)return false; } -static inline void hv_set_alloced_cpu (unsigned int cpu) +static inline void hv_set_allocated_cpu (unsigned int cpu) {cpumask_set_cpu (cpu, &hv_context.hv_numa_map[cpu_to_node (cpu)]); } -static inline void hv_clear_alloced_cpu (unsigned int cpu) +static inline void hv_clear_allocated_cpu (unsigned int cpu) { -if (hv_is_alloced_cpu (cpu)) +if (hv_is_allocated_cpu (cpu))return ;cpumask_clear_cpu (cpu, &hv_context.hv_numa_map[cpu_to_node (cpu)]); } -static inline void hv_update_alloced_cpus (unsigned int old_cpu, +static inline void hv_update_allocated_cpus (unsigned int old_cpu,unsigned int new_cpu) { -hv_set_alloced_cpu (new_cpu); -hv_clear_alloced_cpu (old_cpu); +hv_set_allocated_cpu (new_cpu); +hv_clear_allocated_cpu (old_cpu); }#ifdef CONFIG_HYPERV_TESTING
drivers/hv/vmbus_drv.c +1 -1
@@ -1790,7 +1790,7 @@ static ssize_t target_cpu_store(struct vmbus_channel *channel,/* See init_vp_index(). */ if (hv_is_perf_channel (channel)) -hv_update_alloced_cpus (origin_cpu, target_cpu); +hv_update_allocated_cpus (origin_cpu, target_cpu);/* Currently set only for storvsc channels. */ if (channel->change_target_cpu_callback) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 40/208 Drivers: hv: vmbus: Add utility function for querying ring size
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Saurabh Sengar <[email protected]>
[ Upstream commit e8c4bd6c6e6b7e7b416c42806981c2a81370001e ]
Add a function to query for the preferred ring buffer size of VMBus device. This will allow the drivers (eg. UIO) to allocate the most optimized ring buffer size for devices.
Stable-dep-of: 0315fef2aff9 ("uio_hv_generic: Align ring size to system page")
--- drivers/hv/channel_mgmt.c | 15 ++++++++++++--- drivers/hv/hyperv_vmbus.h | 5 +++++ include/linux/hyperv.h | 2 ++ 3 files changed, 19 insertions(+), 3 deletions(-)
drivers/hv/channel_mgmt.c +12 -3
@@ -106,7 +106,9 @@ const struct vmbus_device vmbus_devs[] = { },/* File copy */ - { .dev_type = HV_FCOPY, +/* fcopy always uses 16KB ring buffer size and is working well for last many years */ + { .pref_ring_size = 0x4000, + .dev_type =HV_FCOPY ,HV_FCOPY_GUID , .perf_device = false, },
@@ -123,11 +125,18 @@ const struct vmbus_device vmbus_devs[] = { .perf_device = false, }, -/* Unknown GUID */ - { .dev_type = HV_UNKNOWN, +/* +* Unknown GUID +* 64 KB ring buffer + 4 KB header should be sufficient size for any Hyper-V device apart +* from HV_NIC and HV_SCSI. This case avoid the fallback for unknown devices to allocate +* much bigger (2 MB) of ring size. +*/ + { .pref_ring_size = 0x11000, + .dev_type = HV_UNKNOWN, .perf_device = false, }, }; +EXPORT_SYMBOL_GPL (vmbus_devs); static const struct { guid_t guid;
drivers/hv/hyperv_vmbus.h +5 -0
@@ -406,6 +406,11 @@ static inline bool hv_is_perf_channel(struct vmbus_channel *channel)return vmbus_devs[channel->device_id].perf_device; } +static inline size_t hv_dev_ring_size (struct vmbus_channel *channel) +{ +return vmbus_devs[channel->device_id].pref_ring_size; +} +static inline bool hv_is_allocated_cpu (unsigned int cpu) {struct vmbus_channel *channel, *sc;
include/linux/hyperv.h +2 -0
@@ -802,6 +802,8 @@ struct vmbus_requestor {#define VMBUS_RQST_ID_NO_RESPONSE (U64_MAX - 2)struct vmbus_device { +/* preferred ring buffer size in KB, 0 means no preferred size for this device */ +size_t pref_ring_size;u16 dev_type;guid_t guid;bool perf_device;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 41/208 uio_hv_generic: Query the ringbuffer size for device
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Saurabh Sengar <[email protected]>
[ Upstream commit e566ed5b64177a0c07b677568f623ed31d23406d ]
Query the ring buffer size from pre defined table per device and use that value for allocating the ring buffer for that device. Keep the size as current default which is 2 MB if the device doesn't have any preferred ring size.
Stable-dep-of: 0315fef2aff9 ("uio_hv_generic: Align ring size to system page")
--- drivers/uio/uio_hv_generic.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/uio/uio_hv_generic.c +5 -2
@@ -249,6 +249,7 @@ hv_uio_probe(struct hv_device *dev,struct hv_uio_private_data *pdata;void *ring_buffer;int ret; +size_t ring_size =hv_dev_ring_size (channel);/* Communicating with host has to be via shared memory not hypercall */ if (!channel->offermsg.monitor_allocated) {
@@ -256,12 +257,14 @@ hv_uio_probe(struct hv_device *dev,return -ENOTSUPP ; } +if (!ring_size) + ring_size =HV_RING_SIZE *PAGE_SIZE ; + pdata =devm_kzalloc (&dev->device,sizeof (*pdata),GFP_KERNEL );if (!pdata)return -ENOMEM ; - ret =vmbus_alloc_ring (channel,HV_RING_SIZE *PAGE_SIZE , -HV_RING_SIZE *PAGE_SIZE ); + ret =vmbus_alloc_ring (channel, ring_size, ring_size);if (ret)return ret;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 42/208 uio_hv_generic: Align ring size to system page
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Long Li <[email protected]>
[ Upstream commit 0315fef2aff9f251ddef8a4b53db9187429c3553 ]
Following the ring header, the ring data should align to system page boundary. Adjust the size if necessary.
Message-ID: <[email protected]>
--- drivers/uio/uio_hv_generic.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/uio/uio_hv_generic.c +3 -0
@@ -260,6 +260,9 @@ hv_uio_probe(struct hv_device *dev,if (!ring_size) ring_size =HV_RING_SIZE *PAGE_SIZE ; +/* Adjust ring size if necessary to have it page aligned */ + ring_size =VMBUS_RING_SIZE (ring_size); + pdata =devm_kzalloc (&dev->device,sizeof (*pdata),GFP_KERNEL );if (!pdata)return -ENOMEM ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 43/208 PCI: cadence-ep: Correct PBA offset in .set_msix() callback
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <[email protected]>
[ Upstream commit c8bcb01352a86bc5592403904109c22b66bd916e ]
While cdns_pcie_ep_set_msix() writes the Table Size field correctly (N-1), the calculation of the PBA offset is wrong because it calculates space for (N-1) entries instead of N.
This results in the following QEMU error when using PCI passthrough on a device which relies on the PCI endpoint subsystem:
failed to add PCI capability 0x11[0x50]@0xb0: table & pba overlap, or they don't fit in BARs, or don't align
Fix the calculation of PBA offset in the MSI-X capability.
[bhelgaas: more specific subject and commit log]
--- drivers/pci/controller/cadence/pcie-cadence-ep.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/pci/controller/cadence/pcie-cadence-ep.c +3 -2
@@ -253,11 +253,12 @@ static int cdns_pcie_ep_set_msix(struct pci_epc *epc, u8 fn, u16 interrupts,struct cdns_pcie *pcie = &ep->pcie;u32 cap =CDNS_PCIE_EP_FUNC_MSIX_CAP_OFFSET ;u32 val, reg; +u16 actual_interrupts = interrupts +1 ; reg = cap +PCI_MSIX_FLAGS ; val =cdns_pcie_ep_fn_readw (pcie, fn, reg); val &= ~PCI_MSIX_FLAGS_QSIZE ; - val |= interrupts; + val |= interrupts;/* 0's based value */ cdns_pcie_ep_fn_writew (pcie, fn, reg, val);/* Set MSIX BAR and offset */
@@ -267,7 +268,7 @@ static int cdns_pcie_ep_set_msix(struct pci_epc *epc, u8 fn, u16 interrupts,/* Set PBA BAR and offset. BAR must match MSIX BAR */ reg = cap +PCI_MSIX_PBA ; - val = (offset + (interrupts *PCI_MSIX_ENTRY_SIZE )) | bir; + val = (offset + (actual_interrupts *PCI_MSIX_ENTRY_SIZE )) | bir;cdns_pcie_ep_fn_writel (pcie, fn, reg, val);return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 44/208 net_sched: sch_sfq: reject invalid perturb period
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 7ca52541c05c832d32b112274f81a985101f9ba8 ]
Gerrard Tai reported that SFQ perturb_period has no range check yet, and this can be used to trigger a race condition fixed in a separate patch.
We want to make sure ctl->perturb_period * HZ will not overflow and is positive.
Tested:
tc qd add dev lo root sfq perturb -10 # negative value : error
Error: sch_sfq: invalid perturb period.
tc qd add dev lo root sfq perturb 1000000000 # too big : error
Error: sch_sfq: invalid perturb period.
tc qd add dev lo root sfq perturb 2000000 # acceptable value
tc -s -d qd sh dev lo
qdisc sfq 8005: root refcnt 2 limit 127p quantum 64Kb depth 127 flows 128 divisor 1024 perturb 2000000sec
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
--- net/sched/sch_sfq.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
net/sched/sch_sfq.c +8 -2
@@ -653,6 +653,14 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt,NL_SET_ERR_MSG_MOD (extack,"invalid quantum" );return -EINVAL ; } + +if (ctl->perturb_period <0 || + ctl->perturb_period >INT_MAX /HZ ) { +NL_SET_ERR_MSG_MOD (extack,"invalid perturb period" ); +return -EINVAL ; + } + perturb_period = ctl->perturb_period *HZ ; +if (ctl_v1 && !red_check_params (ctl_v1->qth_min, ctl_v1->qth_max, ctl_v1->Wlog, ctl_v1->Scell_log,NULL ))return -EINVAL ;
@@ -669,14 +677,12 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt, headdrop = q->headdrop; maxdepth = q->maxdepth; maxflows = q->maxflows; - perturb_period = q->perturb_period; quantum = q->quantum; flags = q->flags;/* update and validate configuration */ if (ctl->quantum) quantum = ctl->quantum; - perturb_period = ctl->perturb_period *HZ ;if (ctl->flows) maxflows =min_t (u32, ctl->flows,SFQ_MAX_FLOWS );if (ctl->divisor) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 45/208 i2c: tiny-usb: disable zero-length read messages
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
commit cbdb25ccf7566eee0c2b945e35cb98baf9ed0aa6 upstream.
This driver passes the length of an i2c_msg directly to usb_control_msg(). If the message is now a read and of length 0, it violates the USB protocol and a warning will be printed. Enable the I2C_AQ_NO_ZERO_LEN_READ quirk for this adapter thus forbidding 0-length read messages altogether.
--- drivers/i2c/busses/i2c-tiny-usb.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/i2c/busses/i2c-tiny-usb.c +6 -0
@@ -140,6 +140,11 @@ out:return ret; } +/* prevent invalid 0-length usb_control_msg */ +static const struct i2c_adapter_quirks usb_quirks = { + .flags =I2C_AQ_NO_ZERO_LEN_READ , +}; +/* This is the actual algorithm we define */ static const struct i2c_algorithm usb_algorithm = { .master_xfer = usb_xfer,
@@ -244,6 +249,7 @@ static int i2c_tiny_usb_probe(struct usb/* setup i2c adapter description */ dev->adapter.owner =THIS_MODULE ; dev->adapter.class =I2C_CLASS_HWMON ; + dev->adapter.quirks = &usb_quirks; dev->adapter.algo = &usb_algorithm; dev->adapter.algo_data = dev; snprintf(dev->adapter.name, sizeof(dev->adapter.name),
Greg Kroah-Hartman
maintainerPATCH 46/208 i2c: robotfuzz-osif: disable zero-length read messages
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
commit 56ad91c1aa9c18064348edf69308080b03c9dc48 upstream.
This driver passes the length of an i2c_msg directly to usb_control_msg(). If the message is now a read and of length 0, it violates the USB protocol and a warning will be printed. Enable the I2C_AQ_NO_ZERO_LEN_READ quirk for this adapter thus forbidding 0-length read messages altogether.
--- drivers/i2c/busses/i2c-robotfuzz-osif.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/i2c/busses/i2c-robotfuzz-osif.c +6 -0
@@ -111,6 +111,11 @@ static u32 osif_func(struct i2c_adapterreturn I2C_FUNC_I2C |I2C_FUNC_SMBUS_EMUL ; } +/* prevent invalid 0-length usb_control_msg */ +static const struct i2c_adapter_quirks osif_quirks = { + .flags =I2C_AQ_NO_ZERO_LEN_READ , +}; +static const struct i2c_algorithm osif_algorithm = { .master_xfer = osif_xfer, .functionality = osif_func,
@@ -143,6 +148,7 @@ static int osif_probe(struct usb_interfa priv->adapter.owner =THIS_MODULE ; priv->adapter.class =I2C_CLASS_HWMON ; + priv->adapter.quirks = &osif_quirks; priv->adapter.algo = &osif_algorithm; priv->adapter.algo_data = priv; snprintf(priv->adapter.name, sizeof(priv->adapter.name),
Greg Kroah-Hartman
maintainerPATCH 47/208 atm: clip: prevent NULL deref in clip_push()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit b993ea46b3b601915ceaaf3c802adf11e7d6bac6 ]
Blamed commit missed that vcc_destroy_socket() calls clip_push() with a NULL skb.
If clip_devs is NULL, clip_push() then crashes when reading skb->truesize.
--- net/atm/clip.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
net/atm/clip.c +5 -6
@@ -193,12 +193,6 @@ static void clip_push(struct atm_vcc *vcc, struct sk_buff *skb)pr_debug ("\n" ); -if (!clip_devs) { -atm_return (vcc, skb->truesize); -kfree_skb (skb); -return ; - } -if (!skb) {pr_debug ("removing VCC %p\n" , clip_vcc);if (clip_vcc->entry)
@@ -208,6 +202,11 @@ static void clip_push(struct atm_vcc *vcc, struct sk_buff *skb)return ; }atm_return (vcc, skb->truesize); +if (!clip_devs) { +kfree_skb (skb); +return ; + } + skb->dev = clip_vcc->entry ? clip_vcc->entry->neigh->dev : clip_devs;/* clip_vcc->entry == NULL if we don't have an IP address yet */ if (!skb->dev) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 48/208 ALSA: usb-audio: Fix out-of-bounds read in snd_usb_get_audioformat_uac3()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Youngjun Lee <[email protected]>
[ Upstream commit fb4e2a6e8f28a3c0ad382e363aeb9cd822007b8a ]
In snd_usb_get_audioformat_uac3(), the length value returned from snd_usb_ctl_msg() is used directly for memory allocation without validation. This length is controlled by the USB device.
The allocated buffer is cast to a uac3_cluster_header_descriptor and its fields are accessed without verifying that the buffer is large enough. If the device returns a smaller than expected length, this leads to an out-of-bounds read.
Add a length check to ensure the buffer is large enough for uac3_cluster_header_descriptor.
--- sound/usb/stream.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/stream.c +2 -0
@@ -983,6 +983,8 @@ snd_usb_get_audioformat_uac3(struct snd_usb_audio *chip,* and request Cluster Descriptor */ wLength =le16_to_cpu (hc_header.wLength); +if (wLength <sizeof (cluster)) +return NULL ; cluster =kzalloc (wLength,GFP_KERNEL );if (!cluster)return ERR_PTR (-ENOMEM );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 49/208 attach_recursive_mnt(): do not lock the covering tree when sliding something under it
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit ce7df19686530920f2f6b636e71ce5eb1d9303ef ]
If we are propagating across the userns boundary, we need to lock the mounts added there. However, in case when something has already been mounted there and we end up sliding a new tree under that, the stuff that had been there before should not get locked.
IOW, lock_mnt_tree() should be called before we reparent the preexisting tree on top of what we are adding.
--- fs/namespace.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/namespace.c +4 -4
@@ -2186,14 +2186,14 @@ static int attach_recursive_mnt(struct mount *source_mnt,hlist_for_each_entry_safe (child, n, &tree_list, mnt_hash) {struct mount *q;hlist_del_init (&child->mnt_hash); - q =__lookup_mnt (&child->mnt_parent->mnt, - child->mnt_mountpoint); -if (q) -mnt_change_mountpoint (child, smp, q);/* Notice when we are propagating across user namespaces */ if (child->mnt_parent->mnt_ns->user_ns != user_ns)lock_mnt_tree (child); child->mnt.mnt_flags &= ~MNT_LOCKED ; + q =__lookup_mnt (&child->mnt_parent->mnt, + child->mnt_mountpoint); +if (q) +mnt_change_mountpoint (child, smp, q);commit_tree (child); }put_mountpoint (smp);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 50/208 libbpf: Fix null pointer dereference in btf_dump__free on allocation failure
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Chen <[email protected]>
[ Upstream commit aa485e8789d56a4573f7c8d000a182b749eaa64d ]
When btf_dump__new() fails to allocate memory for the internal hashmap (btf_dump->type_names), it returns an error code. However, the cleanup function btf_dump__free() does not check if btf_dump->type_names is NULL before attempting to free it. This leads to a null pointer dereference when btf_dump__free() is called on a btf_dump object.
--- tools/lib/bpf/btf_dump.c | 3 +++ 1 file changed, 3 insertions(+)
tools/lib/bpf/btf_dump.c +3 -0
@@ -193,6 +193,9 @@ static void btf_dump_free_names(struct hashmap *map)size_t bkt;struct hashmap_entry *cur; +if (!map) +return ; +hashmap__for_each_entry (map, cur, bkt)free ((void *)cur->key);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 51/208 wifi: mac80211: fix beacon interval calculation overflow
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lachlan Hodges <[email protected]>
[ Upstream commit 7a3750ff0f2e8fee338a9c168f429f6c37f0e820 ]
As we are converting from TU to usecs, a beacon interval of 100*1024 usecs will lead to integer wrapping. To fix change to use a u32.
--- net/mac80211/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/util.c +1 -1
@@ -4242,7 +4242,7 @@ void ieee80211_recalc_dtim(struct ieee80211_local *local, {u64 tsf =drv_get_tsf (local, sdata);u64 dtim_count =0 ; -u16 beacon_int = sdata->vif.bss_conf.beacon_int *1024 ; +u32 beacon_int = sdata->vif.bss_conf.beacon_int *1024 ;u8 dtim_period = sdata->vif.bss_conf.dtim_period;struct ps_data *ps;u8 bcns_from_dtim;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 52/208 vsock/uapi: fix linux/vm_sockets.h userspace compilation errors
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefano Garzarella <[email protected]>
[ Upstream commit 22bbc1dcd0d6785fb390c41f0dd5b5e218d23bdd ]
If a userspace application just include <linux/vm_sockets.h> will fail to build with the following errors:
/usr/include/linux/vm_sockets.h:182:39: error: invalid application of ‘sizeof’ to incomplete type ‘struct sockaddr’
182 | unsigned char svm_zero[sizeof(struct sockaddr) -
| ^~~~~~
/usr/include/linux/vm_sockets.h:183:39: error: ‘sa_family_t’ undeclared here (not in a function)
183 | sizeof(sa_family_t) -
|
Include <sys/socket.h> for userspace (guarded by ifndef __KERNEL__) where struct sockaddr and sa_family_t are defined.
We already do something similar in <linux/mptcp.h> and <linux/if.h>.
--- include/uapi/linux/vm_sockets.h | 4 ++++ 1 file changed, 4 insertions(+)
include/uapi/linux/vm_sockets.h +4 -0
@@ -17,6 +17,10 @@#ifndef _UAPI_VM_SOCKETS_H#define _UAPI_VM_SOCKETS_H +#ifndef __KERNEL__ +#include <sys/socket.h> /* for struct sockaddr and sa_family_t */ +#endif +#include <linux/socket.h> /* Option name for STREAM socket buffer size. Use as the option name in
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 53/208 um: ubd: Add missing error check in start_io_thread()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiwei Bie <[email protected]>
[ Upstream commit c55c7a85e02a7bfee20a3ffebdff7cbeb41613ef ]
The subsequent call to os_set_fd_block() overwrites the previous return value. OR the two return values together to fix it.
--- arch/um/drivers/ubd_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/drivers/ubd_user.c +1 -1
@@ -41,7 +41,7 @@ int start_io_thread(unsigned long sp, int *fd_out) *fd_out = fds[1 ]; err =os_set_fd_block (*fd_out,0 ); - err =os_set_fd_block (kernel_fd,0 ); + err |=os_set_fd_block (kernel_fd,0 );if (err) {printk ("start_io_thread - failed to set nonblocking I/O.\n" ); goto out_close;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 54/208 net: enetc: Correct endianness handling in _enetc_rd_reg64
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Simon Horman <[email protected]>
[ Upstream commit 7b515f35a911fdc31fbde6531828dcd6ae9803d3 ]
enetc_hw.h provides two versions of _enetc_rd_reg64. One which simply calls ioread64() when available.
And another that composes the 64-bit result from ioread32() calls.
In the second case the code appears to assume that each ioread32() call returns a little-endian value. However both the shift and logical or used to compose the return value would not work correctly on big endian systems if this were the case. Moreover, this is inconsistent with the first case where the return value of ioread64() is assumed to be in host byte order.
It appears that the correct approach is for both versions to treat the return value of ioread*() functions as being in host byte order. And this patch corrects the ioread32()-based version to do so.
This is a bug but would only manifest on big endian systems that make use of the ioread32-based implementation of _enetc_rd_reg64. While all in-tree users of this driver are little endian and make use of the ioread64-based implementation of _enetc_rd_reg64. Thus, no in-tree user of this driver is affected by this bug.
Flagged by Sparse.
Compile tested only.
--- drivers/net/ethernet/freescale/enetc/enetc_hw.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/enetc/enetc_hw.h +1 -1
@@ -444,7 +444,7 @@ static inline u64 _enetc_rd_reg64(void __iomem *reg) tmp = ioread32(reg + 4); }while (high != tmp); -return le64_to_cpu ((__le64 )high <<32 | low); +return (u64 )high <<32 | low; }#endif
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 55/208 atm: Release atm_dev_mutex after removing procfs in atm_dev_deregister().
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit a433791aeaea6e84df709e0b9584b9bbe040cd1c ]
syzbot reported a warning below during atm_dev_register(). [0]
Before creating a new device and procfs/sysfs for it, atm_dev_register() looks up a duplicated device by __atm_dev_lookup(). These operations are done under atm_dev_mutex.
However, when removing a device in atm_dev_deregister(), it releases the mutex just after removing the device from the list that __atm_dev_lookup() iterates over.
So, there will be a small race window where the device does not exist on the device list but procfs/sysfs are still not removed, triggering the splat.
Let's hold the mutex until procfs/sysfs are removed in atm_dev_deregister().
[0]:proc_dir_entry 'atm/atmtcp:0' already registered
WARNING: CPU: 0 PID: 5919 at fs/proc/generic.c:377 proc_register+0x455/0x5f0 fs/proc/generic.c:377 Modules linked in: CPU: 0 UID: 0 PID: 5919 Comm: syz-executor284 Not tainted 6.16.0-rc2-syzkaller-00047-g52da431bf03b #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 RIP: 0010:proc_register+0x455/0x5f0 fs/proc/generic.c:377 Code: 48 89 f9 48 c1 e9 03 80 3c 01 00 0f 85 a2 01 00 00 48 8b 44 24 10 48 c7 c7 20 c0 c2 8b 48 8b b0 d8 00 00 00 e8 0c 02 1c ff 90 <0f> 0b 90 90 48 c7 c7 80 f2 82 8e e8 0b de 23 09 48 8b 4c 24 28 48 RSP: 0018:ffffc9000466fa30 EFLAGS: 00010282 RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff817ae248 RDX: ffff888026280000 RSI: ffffffff817ae255 RDI: 0000000000000001 RBP: ffff8880232bed48 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000001 R12: ffff888076ed2140 R13: dffffc0000000000 R14: ffff888078a61340 R15: ffffed100edda444 FS: 00007f38b3b0c6c0(0000) GS:ffff888124753000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f38b3bdf953 CR3: 0000000076d58000 CR4: 00000000003526f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> proc_create_data+0xbe/0x110 fs/proc/generic.c:585 atm_proc_dev_register+0x112/0x1e0 net/atm/proc.c:361 atm_dev_register+0x46d/0x890 net/atm/resources.c:113 atmtcp_create+0x77/0x210 drivers/atm/atmtcp.c:369 atmtcp_attach drivers/atm/atmtcp.c:403 [inline] atmtcp_ioctl+0x2f9/0xd60 drivers/atm/atmtcp.c:464 do_vcc_ioctl+0x12c/0x930 net/atm/ioctl.c:159 sock_do_ioctl+0x115/0x280 net/socket.c:1190 sock_ioctl+0x227/0x6b0 net/socket.c:1311 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:907 [inline] __se_sys_ioctl fs/ioctl.c:893 [inline] __x64_sys_ioctl+0x18b/0x210 fs/ioctl.c:893 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f38b3b74459 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 51 18 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f38b3b0c198 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f38b3bfe318 RCX: 00007f38b3b74459 RDX: 0000000000000000 RSI: 0000000000006180 RDI: 0000000000000005 RBP: 00007f38b3bfe310 R08: 65732f636f72702f R09: 65732f636f72702f R10: 65732f636f72702f R11: 0000000000000246 R12: 00007f38b3bcb0ac R13: 00007f38b3b0c1a0 R14: 0000200000000200 R15: 00007f38b3bcb03b </TASK>
--- net/atm/resources.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/atm/resources.c +1 -2
@@ -148,11 +148,10 @@ void atm_dev_deregister(struct atm_dev **/ mutex_lock (&atm_dev_mutex);list_del (&dev->dev_list); -mutex_unlock (&atm_dev_mutex); -atm_dev_release_vccs (dev);atm_unregister_sysfs (dev);atm_proc_dev_deregister (dev); +mutex_unlock (&atm_dev_mutex);atm_dev_put (dev); }
Greg Kroah-Hartman
maintainerPATCH 56/208 dt-bindings: serial: 8250: Make clocks and clock-frequency exclusive
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yao Zi <[email protected]>
commit 09812134071b3941fb81def30b61ed36d3a5dfb5 upstream.
The 8250 binding before converting to json-schema states,
- clock-frequency : the input clock frequency for the UART
or
- clocks phandle to refer to the clk used as per Documentation/devicetree
for clock-related properties, where "or" indicates these properties shouldn't exist at the same time.
Additionally, the behavior of Linux's driver is strange when both clocks and clock-frequency are specified: it ignores clocks and obtains the frequency from clock-frequency, left the specified clocks unclaimed. It may even be disabled, which is undesired most of the time.
But "anyOf" doesn't prevent these two properties from coexisting, as it considers the object valid as long as there's at LEAST one match.
Let's switch to "oneOf" and disallows the other property if one exists, precisely matching the original binding and avoiding future confusion on the driver's behavior.
--- Documentation/devicetree/bindings/serial/8250.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/serial/8250.yaml +1 -1
@@ -39,7 +39,7 @@ allOf: - ns16550 - ns16550a then: - anyOf: + oneOf: - required: [ clock-frequency ] - required: [ clocks ]
Greg Kroah-Hartman
maintainerPATCH 57/208 Bluetooth: L2CAP: Fix L2CAP MTU negotiation
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frédéric Danis <[email protected]>
commit 042bb9603c44620dce98717a2d23235ca57a00d7 upstream.
OBEX download from iPhone is currently slow due to small packet size used to transfer data which doesn't follow the MTU negotiated during L2CAP connection, i.e. 672 bytes instead of 32767:
< ACL Data TX: Handle 11 flags 0x00 dlen 12
L2CAP: Connection Request (0x02) ident 18 len 4
PSM: 4103 (0x1007)
Source CID: 72Quoted 1 line
ACL Data RX: Handle 11 flags
0x02dlen 16
L2CAP: Connection Response (0x03) ident 18 len 8
Destination CID: 14608
Source CID: 72
Result: Connection successful (0x0000)
Status: No further information available (0x0000)
< ACL Data TX: Handle 11 flags 0x00 dlen 27
L2CAP: Configure Request (0x04) ident 20 len 19
Destination CID: 14608
Flags: 0x0000
Option: Maximum Transmission Unit (0x01) [mandatory]
MTU: 32767
Option: Retransmission and Flow Control (0x04) [mandatory]
Mode: Enhanced Retransmission (0x03)
TX window size: 63
Max transmit: 3
Retransmission timeout: 2000
Monitor timeout: 12000
Maximum PDU size: 1009Quoted 1 line
ACL Data RX: Handle 11 flags
0x02dlen 26
L2CAP: Configure Request (0x04) ident 72 len 18
Destination CID: 72
Flags: 0x0000
Option: Retransmission and Flow Control (0x04) [mandatory]
Mode: Enhanced Retransmission (0x03)
TX window size: 32
Max transmit: 255
Retransmission timeout: 0
Monitor timeout: 0
Maximum PDU size: 65527
Option: Frame Check Sequence (0x05) [mandatory]
FCS: 16-bit FCS (0x01)
< ACL Data TX: Handle 11 flags 0x00 dlen 29
L2CAP: Configure Response (0x05) ident 72 len 21
Source CID: 14608
Flags: 0x0000
Result: Success (0x0000)
Option: Maximum Transmission Unit (0x01) [mandatory]
MTU: 672
Option: Retransmission and Flow Control (0x04) [mandatory]
Mode: Enhanced Retransmission (0x03)
TX window size: 32
Max transmit: 255
Retransmission timeout: 2000
Monitor timeout: 12000
Maximum PDU size: 1009Quoted 1 line
ACL Data RX: Handle 11 flags
0x02dlen 32
L2CAP: Configure Response (0x05) ident 20 len 24
Source CID: 72
Flags: 0x0000
Result: Success (0x0000)
Option: Maximum Transmission Unit (0x01) [mandatory]
MTU: 32767
Option: Retransmission and Flow Control (0x04) [mandatory]
Mode: Enhanced Retransmission (0x03)
TX window size: 63
Max transmit: 3
Retransmission timeout: 2000
Monitor timeout: 12000
Maximum PDU size: 1009
Option: Frame Check Sequence (0x05) [mandatory]
FCS: 16-bit FCS (0x01)...
Quoted 1 line
ACL Data RX: Handle 11 flags
0x02dlen 680
Channel: 72 len 676 ctrl 0x0202 [PSM 4103 mode Enhanced Retransmission (0x03)] {chan 8}
I-frame: Unsegmented TxSeq 1 ReqSeq 2
< ACL Data TX: Handle 11 flags 0x00 dlen 13
Channel: 14608 len 9 ctrl 0x0204 [PSM 4103 mode Enhanced Retransmission (0x03)] {chan 8}
I-frame: Unsegmented TxSeq 2 ReqSeq 2
Quoted 1 line
ACL Data RX: Handle 11 flags
0x02dlen 680
Channel: 72 len 676 ctrl 0x0304 [PSM 4103 mode Enhanced Retransmission (0x03)] {chan 8}
I-frame: Unsegmented TxSeq 2 ReqSeq 3
The MTUs are negotiated for each direction. In this traces 32767 for iPhone->localhost and no MTU for localhost->iPhone, which based on '4.4 L2CAP_CONFIGURATION_REQ' (Core specification v5.4, Vol. 3, Part A):
The only parameters that should be included in the L2CAP_CONFIGURATION_REQ packet are those that require different values than the default or previously agreed values.
...
Any missing configuration parameters are assumed to have their most recently explicitly or implicitly accepted values.
and '5.1 Maximum transmission unit (MTU)':
If the remote device sends a positive L2CAP_CONFIGURATION_RSP packet it should include the actual MTU to be used on this channel for traffic flowing into the local device.
...
The default value is 672 octets.
is set by BlueZ to 672 bytes.
It seems that the iPhone used the lowest negotiated value to transfer data to the localhost instead of the negotiated one for the incoming direction.
This could be fixed by using the MTU negotiated for the other direction, if exists, in the L2CAP_CONFIGURATION_RSP. This allows to use segmented packets as in the following traces:
< ACL Data TX: Handle 11 flags 0x00 dlen 12
L2CAP: Connection Request (0x02) ident 22 len 4
PSM: 4103 (0x1007)
Source CID: 72
< ACL Data TX: Handle 11 flags 0x00 dlen 27
L2CAP: Configure Request (0x04) ident 24 len 19
Destination CID: 2832
Flags: 0x0000
Option: Maximum Transmission Unit (0x01) [mandatory]
MTU: 32767
Option: Retransmission and Flow Control (0x04) [mandatory]
Mode: Enhanced Retransmission (0x03)
TX window size: 63
Max transmit: 3
Retransmission timeout: 2000
Monitor timeout: 12000
Maximum PDU size: 1009Quoted 1 line
ACL Data RX: Handle 11 flags
0x02dlen 26
L2CAP: Configure Request (0x04) ident 15 len 18
Destination CID: 72
Flags: 0x0000
Option: Retransmission and Flow Control (0x04) [mandatory]
Mode: Enhanced Retransmission (0x03)
TX window size: 32
Max transmit: 255
Retransmission timeout: 0
Monitor timeout: 0
Maximum PDU size: 65527
Option: Frame Check Sequence (0x05) [mandatory]
FCS: 16-bit FCS (0x01)
< ACL Data TX: Handle 11 flags 0x00 dlen 29
L2CAP: Configure Response (0x05) ident 15 len 21
Source CID: 2832
Flags: 0x0000
Result: Success (0x0000)
Option: Maximum Transmission Unit (0x01) [mandatory]
MTU: 32767
Option: Retransmission and Flow Control (0x04) [mandatory]
Mode: Enhanced Retransmission (0x03)
TX window size: 32
Max transmit: 255
Retransmission timeout: 2000
Monitor timeout: 12000
Maximum PDU size: 1009Quoted 1 line
ACL Data RX: Handle 11 flags
0x02dlen 32
L2CAP: Configure Response (0x05) ident 24 len 24
Source CID: 72
Flags: 0x0000
Result: Success (0x0000)
Option: Maximum Transmission Unit (0x01) [mandatory]
MTU: 32767
Option: Retransmission and Flow Control (0x04) [mandatory]
Mode: Enhanced Retransmission (0x03)
TX window size: 63
Max transmit: 3
Retransmission timeout: 2000
Monitor timeout: 12000
Maximum PDU size: 1009
Option: Frame Check Sequence (0x05) [mandatory]
FCS: 16-bit FCS (0x01)...
Quoted 1 line
ACL Data RX: Handle 11 flags
0x02dlen 1009
Channel: 72 len 1005 ctrl 0x4202 [PSM 4103 mode Enhanced Retransmission (0x03)] {chan 8}
I-frame: Start (len 21884) TxSeq 1 ReqSeq 2Quoted 1 line
ACL Data RX: Handle 11 flags
0x02dlen 1009
Channel: 72 len 1005 ctrl 0xc204 [PSM 4103 mode Enhanced Retransmission (0x03)] {chan 8}
I-frame: Continuation TxSeq 2 ReqSeq 2
This has been tested with kernel 5.4 and BlueZ 5.77.
--- net/bluetooth/l2cap_core.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
net/bluetooth/l2cap_core.c +8 -1
@@ -3571,7 +3571,7 @@ static int l2cap_parse_conf_req(struct lstruct l2cap_conf_rfc rfc = { .mode =L2CAP_MODE_BASIC };struct l2cap_conf_efs efs;u8 remote_efs =0 ; -u16 mtu =L2CAP_DEFAULT_MTU ; +u16 mtu =0 ;u16 result =L2CAP_CONF_SUCCESS ;u16 size;
@@ -3682,6 +3682,13 @@ done:/* Configure output options and let the other side know * which ones we don't like. */ +/* If MTU is not provided in configure request, use the most recently +* explicitly or implicitly accepted value for the other direction, +* or the default value. +*/ +if (mtu ==0 ) + mtu = chan->imtu ? chan->imtu :L2CAP_DEFAULT_MTU ; +if (mtu <L2CAP_DEFAULT_MIN_MTU ) result =L2CAP_CONF_UNACCEPT ;else {
Greg Kroah-Hartman
maintainerPATCH 58/208 dm-raid: fix variable in journal device check
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heinz Mauelshagen <[email protected]>
commit db53805156f1e0aa6d059c0d3f9ac660d4ef3eb4 upstream.
Replace "rdev" with correct loop variable name "r".
--- drivers/md/dm-raid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-raid.c +1 -1
@@ -2381,7 +2381,7 @@ static int super_init_validation(struct*/ sb_retrieve_failed_devices (sb, failed_devices);rdev_for_each (r, mddev) { -if (test_bit (Journal, &rdev->flags) || +if (test_bit (Journal, &r->flags) || !r->sb_page)continue ; sb2 =page_address (r->sb_page);
Greg Kroah-Hartman
maintainerPATCH 59/208 btrfs: update superblocks device bytes_used when dropping chunk
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Harmstone <[email protected]>
commit ae4477f937569d097ca5dbce92a89ba384b49bc6 upstream.
Each superblock contains a copy of the device item for that device. In a transaction which drops a chunk but doesn't create any new ones, we were correctly updating the device item in the chunk tree but not copying over the new bytes_used value to the superblock.
This can be seen by doing the following:
# dd if=/dev/zero of=test bs=4096 count=2621440 # mkfs.btrfs test # mount test /root/temp
# cd /root/temp
# for i in {00..10}; do dd if=/dev/zero of=$i bs=4096 count=32768; done
# sync
# rm *
# sync
# btrfs balance start -dusage=0 .
# sync# cd # umount /root/temp # btrfs check test
For btrfs-check to detect this, you will also need my patch at
https://github.com/kdave/btrfs-progs/pull/991.
Change btrfs_remove_dev_extents() so that it adds the devices to the fs_info->post_commit_list if they're not there already. This causes btrfs_commit_device_sizes() to be called, which updates the bytes_used value in the superblock.
--- fs/btrfs/volumes.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/btrfs/volumes.c +6 -0
@@ -3101,6 +3101,12 @@ int btrfs_remove_chunk(struct btrfs_tran device->bytes_used - dev_extent_len);atomic64_add (dev_extent_len, &fs_info->free_chunk_space);btrfs_clear_space_info_full (fs_info); + +if (list_empty (&device->post_commit_list)) { +list_add_tail (&device->post_commit_list, + &trans->transaction->dev_update_list); + } +mutex_unlock (&fs_info->chunk_mutex); }
Greg Kroah-Hartman
maintainerPATCH 60/208 HID: wacom: fix memory leak on kobject creation failure
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qasim Ijaz <[email protected]>
commit 5ae416c5b1e2e816aee7b3fc8347adf70afabb4c upstream.
During wacom_initialize_remotes() a fifo buffer is allocated with kfifo_alloc() and later a cleanup action is registered during devm_add_action_or_reset() to clean it up.
However if the code fails to create a kobject and register it with sysfs the code simply returns -ENOMEM before the cleanup action is registered leading to a memory leak.
Fix this by ensuring the fifo is freed when the kobject creation and registration process fails.
--- drivers/hid/wacom_sys.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hid/wacom_sys.c +3 -1
@@ -2020,8 +2020,10 @@ static int wacom_initialize_remotes(stru remote->remote_dir =kobject_create_and_add ("wacom_remote" , &wacom->hdev->dev.kobj); -if (!remote->remote_dir) +if (!remote->remote_dir) { +kfifo_free (&remote->remote_fifo);return -ENOMEM ; + } error =sysfs_create_files (remote->remote_dir, remote_unpair_attrs);
Greg Kroah-Hartman
maintainerPATCH 61/208 HID: wacom: fix memory leak on sysfs attribute creation failure
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qasim Ijaz <[email protected]>
commit 1a19ae437ca5d5c7d9ec2678946fb339b1c706bf upstream.
When sysfs_create_files() fails during wacom_initialize_remotes() the fifo buffer is not freed leading to a memory leak.
Fix this by calling kfifo_free() before returning.
--- drivers/hid/wacom_sys.c | 1 + 1 file changed, 1 insertion(+)
drivers/hid/wacom_sys.c +1 -0
@@ -2030,6 +2030,7 @@ static int wacom_initialize_remotes(struif (error) {hid_err (wacom->hdev,"cannot create sysfs group err: %d\n" , error); +kfifo_free (&remote->remote_fifo);return error; }
Greg Kroah-Hartman
maintainerPATCH 62/208 HID: wacom: fix kobject reference count leak
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qasim Ijaz <[email protected]>
commit 85a720f4337f0ddf1603c8b75a8f1ffbbe022ef9 upstream.
When sysfs_create_files() fails in wacom_initialize_remotes() the error is returned and the cleanup action will not have been registered yet.
As a result the kobject???s refcount is never dropped, so the kobject can never be freed leading to a reference leak.
Fix this by calling kobject_put() before returning.
--- drivers/hid/wacom_sys.c | 1 + 1 file changed, 1 insertion(+)
drivers/hid/wacom_sys.c +1 -0
@@ -2031,6 +2031,7 @@ static int wacom_initialize_remotes(struhid_err (wacom->hdev,"cannot create sysfs group err: %d\n" , error);kfifo_free (&remote->remote_fifo); +kobject_put (remote->remote_dir);return error; }
Greg Kroah-Hartman
maintainerPATCH 63/208 drm/tegra: Assign plane type before registration
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thierry Reding <[email protected]>
commit 9ff4fdf4f44b69237c0afc1d3a8dac916ce66f3e upstream.
Changes to a plane's type after it has been registered aren't propagated to userspace automatically. This could possibly be achieved by updating the property, but since we can already determine which type this should be before the registration, passing in the right type from the start is a much better solution.
--- drivers/gpu/drm/tegra/dc.c | 12 ++++++++---- drivers/gpu/drm/tegra/hub.c | 4 ++-- drivers/gpu/drm/tegra/hub.h | 3 ++- 3 files changed, 12 insertions(+), 7 deletions(-)
drivers/gpu/drm/tegra/dc.c +8 -4
@@ -1134,10 +1134,16 @@ static struct drm_plane *tegra_dc_add_shif (wgrp->dc == dc->pipe) {for (j =0 ; j < wgrp->num_windows; j++) {unsigned int index = wgrp->windows[j]; +enum drm_plane_type type; + +if (primary) + type =DRM_PLANE_TYPE_OVERLAY ; +else + type =DRM_PLANE_TYPE_PRIMARY ; plane =tegra_shared_plane_create (drm, dc, wgrp->index, - index); + index, type);if (IS_ERR (plane))return plane;
@@ -1145,10 +1151,8 @@ static struct drm_plane *tegra_dc_add_sh* Choose the first shared plane owned by this * head as the primary plane. */ -if (!primary) { - plane->type =DRM_PLANE_TYPE_PRIMARY ; +if (!primary) primary = plane; - } } } }
drivers/gpu/drm/tegra/hub.c +2 -2
@@ -551,9 +551,9 @@ static const struct drm_plane_helper_funstruct drm_plane *tegra_shared_plane_create (struct drm_device *drm,struct tegra_dc *dc,unsigned int wgrp, -unsigned int index) +unsigned int index, +enum drm_plane_type type) { -enum drm_plane_type type =DRM_PLANE_TYPE_OVERLAY ;struct tegra_drm *tegra = drm->dev_private;struct tegra_display_hub *hub = tegra->hub;/* planes can be assigned to arbitrary CRTCs */
drivers/gpu/drm/tegra/hub.h +2 -1
@@ -81,7 +81,8 @@ void tegra_display_hub_cleanup(struct testruct drm_plane *tegra_shared_plane_create (struct drm_device *drm,struct tegra_dc *dc,unsigned int wgrp, -unsigned int index); +unsigned int index, +enum drm_plane_type type);int tegra_display_hub_atomic_check (struct drm_device *drm,struct drm_atomic_state *state);
Greg Kroah-Hartman
maintainerPATCH 64/208 drm/tegra: Fix a possible null pointer dereference
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qiu-ji Chen <[email protected]>
commit 780351a5f61416ed2ba1199cc57e4a076fca644d upstream.
In tegra_crtc_reset(), new memory is allocated with kzalloc(), but no check is performed. Before calling __drm_atomic_helper_crtc_reset, state should be checked to prevent possible null pointer dereference.
--- drivers/gpu/drm/tegra/dc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/tegra/dc.c +4 -1
@@ -1206,7 +1206,10 @@ static void tegra_crtc_reset(struct drm_if (crtc->state)tegra_crtc_atomic_destroy_state (crtc, crtc->state); -__drm_atomic_helper_crtc_reset (crtc, &state->base); +if (state) +__drm_atomic_helper_crtc_reset (crtc, &state->base); +else +__drm_atomic_helper_crtc_reset (crtc,NULL ); } static struct drm_crtc_state *
Greg Kroah-Hartman
maintainerPATCH 65/208 drm/udl: Unregister device before cleaning up on disconnect
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
commit ff9cb6d2035c586ea7c8f1754d4409eec7a2d26d upstream.
Disconnecting a DisplayLink device results in the following kernel error messages
[ 93.041748] [drm:udl_urb_completion [udl]] *ERROR* udl_urb_completion - nonzero write bulk status received: -115 [ 93.055299] [drm:udl_submit_urb [udl]] *ERROR* usb_submit_urb error fffffffe [ 93.065363] [drm:udl_urb_completion [udl]] *ERROR* udl_urb_completion - nonzero write bulk status received: -115 [ 93.078207] [drm:udl_submit_urb [udl]] *ERROR* usb_submit_urb error fffffffe
coming from KMS poll helpers. Shutting down poll helpers runs them one final time when the USB device is already gone.
Run drm_dev_unplug() first in udl's USB disconnect handler. Udl's polling code already handles disconnects gracefully if the device has been marked as unplugged.
--- drivers/gpu/drm/udl/udl_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/udl/udl_drv.c +1 -1
@@ -115,9 +115,9 @@ static void udl_usb_disconnect(struct us {struct drm_device *dev =usb_get_intfdata (interface); +drm_dev_unplug (dev);drm_kms_helper_poll_fini (dev);udl_drop_usb (dev); -drm_dev_unplug (dev); }/*
Greg Kroah-Hartman
maintainerPATCH 66/208 drm/amdkfd: Fix race in GWS queue scheduling
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jay Cornwall <[email protected]>
commit cfb05257ae168a0496c7637e1d9e3ab8a25cbffe upstream.
q->gws is not updated atomically with qpd->mapped_gws_queue. If a runlist is created between pqm_set_gws and update_queue it will contain a queue which uses GWS in a process with no GWS allocated. This will result in a scheduler hang.
Use q->properties.is_gws which is changed while holding the DQM lock.
--- drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c +1 -1
@@ -156,7 +156,7 @@ static int pm_map_queues_v9(struct packe packet->bitfields2.engine_sel = engine_sel__mes_map_queues__compute_vi; - packet->bitfields2.gws_control_queue = q->gws ?1 :0 ; + packet->bitfields2.gws_control_queue = q->properties.is_gws ?1 :0 ; packet->bitfields2.extended_engine_sel = extended_engine_sel__mes_map_queues__legacy_engine_sel; packet->bitfields2.queue_type =
Greg Kroah-Hartman
maintainerPATCH 67/208 drm/bridge: cdns-dsi: Fix the clock variable for mode_valid()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aradhya Bhatia <[email protected]>
commit 132bdcec399be6ae947582249a134b38cf56731c upstream.
The crtc_* mode parameters do not get generated (duplicated in this case) from the regular parameters before the mode validation phase begins.
The rest of the code conditionally uses the crtc_* parameters only during the bridge enable phase, but sticks to the regular parameters for mode validation. In this singular instance, however, the driver tries to use the crtc_clock parameter even during the mode validation, causing the validation to fail.
Allow the D-Phy config checks to use mode->clock instead of mode->crtc_clock during mode_valid checks, like everywhere else in the driver.
--- drivers/gpu/drm/bridge/cdns-dsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/cdns-dsi.c +2 -1
@@ -608,13 +608,14 @@ static int cdns_dsi_check_conf(struct cdstruct phy_configure_opts_mipi_dphy *phy_cfg = &output->phy_opts.mipi_dphy;unsigned long dsi_hss_hsa_hse_hbp;unsigned int nlanes = output->dev->lanes; +int mode_clock = (mode_valid_check ? mode->clock : mode->crtc_clock);int ret; ret =cdns_dsi_mode2cfg (dsi, mode, dsi_cfg, mode_valid_check);if (ret)return ret; -phy_mipi_dphy_get_default_config (mode->crtc_clock *1000 , +phy_mipi_dphy_get_default_config (mode_clock *1000 ,mipi_dsi_pixel_format_to_bpp (output->dev->format), nlanes, phy_cfg);
Greg Kroah-Hartman
maintainerPATCH 68/208 drm/bridge: cdns-dsi: Fix connecting to next bridge
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aradhya Bhatia <[email protected]>
commit 688eb4d465484bc2a3471a6a6f06f833b58c7867 upstream.
Fix the OF node pointer passed to the of_drm_find_bridge() call to find the next bridge in the display chain.
The code to find the next panel (and create its panel-bridge) works fine, but to find the next (non-panel) bridge does not.
To find the next bridge in the pipeline, we need to pass "np" - the OF node pointer of the next entity in the devicetree chain. Passing "of_node" to of_drm_find_bridge (which is what the code does currently) will fetch the bridge for the cdns-dsi which is not what's required.
Fix that.
--- drivers/gpu/drm/bridge/cdns-dsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/cdns-dsi.c +1 -1
@@ -961,7 +961,7 @@ static int cdns_dsi_attach(struct mipi_d bridge =drm_panel_bridge_add_typed (panel,DRM_MODE_CONNECTOR_DSI ); }else { - bridge =of_drm_find_bridge (dev->dev.of_node); + bridge =of_drm_find_bridge (np);if (!bridge) bridge =ERR_PTR (-EINVAL ); }
Greg Kroah-Hartman
maintainerPATCH 69/208 drm/bridge: cdns-dsi: Check return value when getting default PHY config
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aradhya Bhatia <[email protected]>
commit c6a7ef0d4856b9629df390e9935d7fd67fe39f81 upstream.
Check for the return value of the phy_mipi_dphy_get_default_config() call, and in case of an error, return back the same.
--- drivers/gpu/drm/bridge/cdns-dsi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/bridge/cdns-dsi.c +5 -3
@@ -615,9 +615,11 @@ static int cdns_dsi_check_conf(struct cdif (ret)return ret; -phy_mipi_dphy_get_default_config (mode_clock *1000 , -mipi_dsi_pixel_format_to_bpp (output->dev->format), - nlanes, phy_cfg); + ret =phy_mipi_dphy_get_default_config (mode_clock *1000 , +mipi_dsi_pixel_format_to_bpp (output->dev->format), + nlanes, phy_cfg); +if (ret) +return ret; ret =cdns_dsi_adjust_phy_config (dsi, dsi_cfg, phy_cfg, mode, mode_valid_check);if (ret)
Greg Kroah-Hartman
maintainerPATCH 70/208 drm/bridge: cdns-dsi: Wait for Clk and Data Lanes to be ready
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aradhya Bhatia <[email protected]>
commit 47c03e6660e96cbba0239125b1d4a9db3c724b1d upstream.
Once the DSI Link and DSI Phy are initialized, the code needs to wait for Clk and Data Lanes to be ready, before continuing configuration. This is in accordance with the DSI Start-up procedure, found in the Technical Reference Manual of Texas Instrument's J721E SoC[0] which houses this DSI TX controller.
If the previous bridge (or crtc/encoder) are configured pre-maturely, the input signal FIFO gets corrupt. This introduces a color-shift on the display.
Allow the driver to wait for the clk and data lanes to get ready during DSI enable.
[0]: See section 12.6.5.7.3 "Start-up Procedure" in J721E SoC TRM
TRM Link: http://www.ti.com/lit/pdf/spruil1
--- drivers/gpu/drm/bridge/cdns-dsi.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/cdns-dsi.c +15 -1
@@ -789,8 +789,9 @@ static void cdns_dsi_bridge_enable(strucstruct phy_configure_opts_mipi_dphy *phy_cfg = &output->phy_opts.mipi_dphy;unsigned long tx_byte_period;struct cdns_dsi_cfg dsi_cfg; -u32 tmp, reg_wakeup, div; +u32 tmp, reg_wakeup, div, status;int nlanes; +int i;if (WARN_ON (pm_runtime_get_sync (dsi->base.dev) <0 ))return ;
@@ -803,6 +804,19 @@ static void cdns_dsi_bridge_enable(struccdns_dsi_hs_init (dsi);cdns_dsi_init_link (dsi); +/* +* Now that the DSI Link and DSI Phy are initialized, +* wait for the CLK and Data Lanes to be ready. +*/ + tmp =CLK_LANE_RDY ; +for (i =0 ; i < nlanes; i++) + tmp |=DATA_LANE_RDY (i); + +if (readl_poll_timeout (dsi->regs +MCTL_MAIN_STS , status, + (tmp == (status & tmp)),100 ,500000 )) +dev_err (dsi->base.dev, +"Timed Out: DSI-DPhy Clock and Data Lanes not ready.\n" ); +writel (HBP_LEN (dsi_cfg.hbp) |HSA_LEN (dsi_cfg.hsa), dsi->regs +VID_HSIZE1 ); writel(HFP_LEN(dsi_cfg.hfp) | HACT_LEN(dsi_cfg.hact),
Greg Kroah-Hartman
maintainerPATCH 71/208 PCI: hv: Do not set PCI_COMMAND_MEMORY to reduce VM boot time
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dexuan Cui <[email protected]>
commit 23e118a48acf7be223e57d98e98da8ac5a4071ac upstream.
Currently when the pci-hyperv driver finishes probing and initializing the PCI device, it sets the PCI_COMMAND_MEMORY bit; later when the PCI device is registered to the core PCI subsystem, the core PCI driver's BAR detection and initialization code toggles the bit multiple times, and each toggling of the bit causes the hypervisor to unmap/map the virtual BARs from/to the physical BARs, which can be slow if the BAR sizes are huge, e.g., a Linux VM with 14 GPU devices has to spend more than 3 minutes on BAR detection and initialization, causing a long boot time.
Reduce the boot time by not setting the PCI_COMMAND_MEMORY bit when we register the PCI device (there is no need to have it set in the first place). The bit stays off till the PCI device driver calls pci_enable_device(). With this change, the boot time of such a 14-GPU VM is reduced by almost 3 minutes.
--- drivers/pci/controller/pci-hyperv.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/pci/controller/pci-hyperv.c +11 -6
@@ -1820,12 +1820,17 @@ static void prepopulate_bars(struct hv_p } }if (high_size <=1 && low_size <=1 ) { -/* Set the memory enable bit. */ -_hv_pcifront_read_config (hpdev,PCI_COMMAND ,2 , - &command); - command |=PCI_COMMAND_MEMORY ; -_hv_pcifront_write_config (hpdev,PCI_COMMAND ,2 , - command); +/* +* No need to set the PCI_COMMAND_MEMORY bit as +* the core PCI driver doesn't require the bit +* to be pre-set. Actually here we intentionally +* keep the bit off so that the PCI BAR probing +* in the core PCI driver doesn't cause Hyper-V +* to unnecessarily unmap/map the virtual BARs +* from/to the physical BARs multiple times. +* This reduces the VM boot time significantly +* if the BAR sizes are huge. +*/ break ; } }
Greg Kroah-Hartman
maintainerPATCH 72/208 s390: Add -std=gnu11 to decompressor and purgatory CFLAGS
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit 3b8b80e993766dc96d1a1c01c62f5d15fafc79b9 upstream.
GCC changed the default C standard dialect from gnu17 to gnu23, which should not have impacted the kernel because it explicitly requests the gnu11 standard in the main Makefile. However, there are certain places in the s390 code that use their own CFLAGS without a '-std=' value, which break with this dialect change because of the kernel's own definitions of bool, false, and true conflicting with the C23 reserved keywords.
include/linux/stddef.h:11:9: error: cannot use keyword 'false' as enumeration constant
11 | false = 0,
| ^~~~~
include/linux/stddef.h:11:9: note: 'false' is a keyword with '-std=c23' onwards
include/linux/types.h:35:33: error: 'bool' cannot be defined via 'typedef'
35 | typedef _Bool bool;
| ^~~~ include/linux/types.h:35:33: note: 'bool' is a keyword with '-std=c23' onwards
Add '-std=gnu11' to the decompressor and purgatory CFLAGS to eliminate these errors and make the C standard version of these areas match the rest of the kernel.
--- arch/s390/Makefile | 2 +- arch/s390/purgatory/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/s390/Makefile +1 -1
@@ -23,7 +23,7 @@ endif aflags_dwarf := -Wa,-gdwarf-2 KBUILD_AFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -D__ASSEMBLY__ KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf)) -KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 +KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 -std=gnu11 KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables
arch/s390/purgatory/Makefile +1 -1
@@ -20,7 +20,7 @@ GCOV_PROFILE := n UBSAN_SANITIZE := n KASAN_SANITIZE := n -KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes +KBUILD_CFLAGS := -std=gnu11 -fno-strict-aliasing -Wall -Wstrict-prototypes KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding KBUILD_CFLAGS += -c -MD -Os -m64 -msoft-float -fno-common
Greg Kroah-Hartman
maintainerPATCH 73/208 Revert "ipv6: save dontfrag in cork"
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brett A C Sheffield (Librecast) <[email protected]>
This reverts commit 29533d1a54b8de5aaf8c4aa6790dc67d5c14fba5 which is commit a18dfa9925b9ef6107ea3aa5814ca3c704d34a8a upstream.
A regression was introduced when backporting this to the stable kernels without applying previous commits in this series.
When sending IPv6 UDP packets larger than MTU, EMSGSIZE was returned instead of fragmenting the packets as expected.
As there is no compelling reason for this commit to be present in the stable kernels it should be reverted.
--- include/linux/ipv6.h | 1 - net/ipv6/ip6_output.c | 9 ++++----- 2 files changed, 4 insertions(+), 6 deletions(-)
include/linux/ipv6.h +0 -1
@@ -189,7 +189,6 @@ struct inet6_cork {struct ipv6_txoptions *opt;u8 hop_limit;u8 tclass; - u8 dontfrag:1; };/**
net/ipv6/ip6_output.c +4 -5
@@ -1416,7 +1416,6 @@ static int ip6_setup_cork(struct sock *s cork->fl.u.ip6 = *fl6; v6_cork->hop_limit = ipc6->hlimit; v6_cork->tclass = ipc6->tclass; - v6_cork->dontfrag = ipc6->dontfrag;if (rt->dst.flags &DST_XFRM_TUNNEL ) mtu = np->pmtudisc >=IPV6_PMTUDISC_PROBE ?READ_ONCE (rt->dst.dev->mtu) :dst_mtu (&rt->dst);
@@ -1451,7 +1450,7 @@ static int __ip6_append_data(struct sockint getfrag (void *from,char *to,int offset,int len,int odd,struct sk_buff *skb), void *from, size_t length, int transhdrlen, - unsigned int flags) + unsigned int flags, struct ipcm6_cookie *ipc6) { struct sk_buff *skb, *skb_prev = NULL;unsigned int maxfraglen, fragheaderlen, mtu, orig_mtu, pmtu;
@@ -1508,7 +1507,7 @@ static int __ip6_append_data(struct sockif (headersize + transhdrlen > mtu) goto emsgsize; -if (cork->length + length > mtu - headersize && v6_cork->dontfrag && +if (cork->length + length > mtu - headersize && ipc6->dontfrag && (sk->sk_protocol ==IPPROTO_UDP || sk->sk_protocol ==IPPROTO_RAW )) { ipv6_local_rxpmtu(sk, fl6, mtu - headersize +
@@ -1826,7 +1825,7 @@ int ip6_append_data(struct sock *sk,return __ip6_append_data (sk, fl6, &sk->sk_write_queue, &inet->cork.base, &np->cork,sk_page_frag (sk), getfrag, - from, length, transhdrlen, flags); + from, length, transhdrlen, flags, ipc6); }EXPORT_SYMBOL_GPL (ip6_append_data);
@@ -2021,7 +2020,7 @@ struct sk_buff *ip6_make_skb(struct sock err =__ip6_append_data (sk, fl6, &queue, &cork->base, &v6_cork, ¤t->task_frag, getfrag, from, length + exthdrlen, transhdrlen + exthdrlen, - flags); + flags, ipc6);if (err) {__ip6_flush_pending_frames (sk, &queue, cork, &v6_cork);return ERR_PTR (err);
Greg Kroah-Hartman
maintainerPATCH 74/208 arm64: Restrict pagetable teardown to avoid false warning
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dev Jain <[email protected]>
commit 650768c512faba8070bf4cfbb28c95eb5cd203f3 upstream.
Commit 9c006972c3fe ("arm64: mmu: drop pXd_present() checks from pXd_free_pYd_table()") removes the pxd_present() checks because the caller checks pxd_present(). But, in case of vmap_try_huge_pud(), the caller only checks pud_present(); pud_free_pmd_page() recurses on each pmd through pmd_free_pte_page(), wherein the pmd may be none. Thus it is possible to hit a warning in the latter, since pmd_none => !pmd_table(). Thus, add a pmd_present() check in pud_free_pmd_page().
This problem was found by code inspection.
--- arch/arm64/mm/mmu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/mm/mmu.c +2 -1
@@ -1459,7 +1459,8 @@ int pud_free_pmd_page(pud_t *pudp, unsig next = addr; end = addr +PUD_SIZE ;do { -pmd_free_pte_page (pmdp, next); +if (pmd_present (READ_ONCE (*pmdp))) +pmd_free_pte_page (pmdp, next); }while (pmdp++, next +=PMD_SIZE , next != end);pud_clear (pudp);
Greg Kroah-Hartman
maintainerPATCH 75/208 rtc: cmos: use spin_lock_irqsave in cmos_interrupt
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mateusz Jończyk <[email protected]>
commit 00a39d8652ff9088de07a6fe6e9e1893452fe0dd upstream.
cmos_interrupt() can be called in a non-interrupt context, such as in an ACPI event handler (which runs in an interrupt thread). Therefore, usage of spin_lock(&rtc_lock) is insecure. Use spin_lock_irqsave() / spin_unlock_irqrestore() instead.
Before a misguided
commit 6950d046eb6e ("rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ") the cmos_interrupt() function used spin_lock_irqsave(). That commit
changed it to spin_lock() and broke locking, which was partially fixed in commit 13be2efc390a ("rtc: cmos: Disable irq around direct invocation of cmos_interrupt()")
That second commit did not take account of the ACPI fixed event handler pathway, however. It introduced local_irq_disable() workarounds in cmos_check_wkalrm(), which can cause problems on PREEMPT_RT kernels and are now unnecessary.
Add an explicit comment so that this change will not be reverted by mistake.
--- drivers/rtc/rtc-cmos.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/rtc/rtc-cmos.c +6 -4
@@ -704,8 +704,12 @@ static irqreturn_t cmos_interrupt(int ir {u8 irqstat;u8 rtc_control; +unsigned long flags; -spin_lock (&rtc_lock); +/* We cannot use spin_lock() here, as cmos_interrupt() is also called +* in a non-irq context. +*/ +spin_lock_irqsave (&rtc_lock, flags);/* When the HPET interrupt handler calls us, the interrupt * status is passed as arg1 instead of the irq number. But
@@ -739,7 +743,7 @@ static irqreturn_t cmos_interrupt(int irhpet_mask_rtc_irq_bit (RTC_AIE );CMOS_READ (RTC_INTR_FLAGS ); } -spin_unlock (&rtc_lock); +spin_unlock_irqrestore (&rtc_lock, flags);if (is_intr (irqstat)) {rtc_update_irq (p,1 , irqstat);
@@ -1289,9 +1293,7 @@ static void cmos_check_wkalrm(struct dev* ACK the rtc irq here */ if (t_now >= cmos->alarm_expires &&cmos_use_acpi_alarm ()) { -local_irq_disable ();cmos_interrupt (0 , (void *)cmos->rtc); -local_irq_enable ();return ; }
Greg Kroah-Hartman
maintainerPATCH 76/208 vsock/vmci: Clear the vmci transport packet properly when initializing it
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: HarshaVardhana S A <[email protected]>
commit 223e2288f4b8c262a864e2c03964ffac91744cd5 upstream.
In vmci_transport_packet_init memset the vmci_transport_packet before populating the fields to avoid any uninitialised data being left in the structure.
--- net/vmw_vsock/vmci_transport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/vmw_vsock/vmci_transport.c +2 -2
@@ -119,6 +119,8 @@ vmci_transport_packet_init(struct vmci_tu16 proto, struct vmci_handle handle) { + memset(pkt, 0, sizeof(*pkt)); +/* We register the stream control handler as an any cid handle so we * must always send from a source address of VMADDR_CID_ANY */
@@ -131,8 +133,6 @@ vmci_transport_packet_init(struct vmci_t pkt->type = type; pkt->src_port = src->svm_port; pkt->dst_port = dst->svm_port; -memset (&pkt->proto,0 ,sizeof (pkt->proto)); -memset (&pkt->_reserved2,0 ,sizeof (pkt->_reserved2));switch (pkt->type) {case VMCI_TRANSPORT_PACKET_TYPE_INVALID :
Greg Kroah-Hartman
maintainerPATCH 77/208 mmc: sdhci: Add a helper function for dump register in dynamic debug mode
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Victor Shih <[email protected]>
commit 2881ba9af073faa8ee7408a8d1e0575e50eb3f6c upstream.
Add a helper function for dump register in dynamic debug mode.
--- drivers/mmc/host/sdhci.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/mmc/host/sdhci.h +16 -0
@@ -813,4 +813,20 @@ void sdhci_switch_external_dma(struct sdvoid sdhci_set_data_timeout_irq (struct sdhci_host *host,bool enable);void __sdhci_set_timeout (struct sdhci_host *host,struct mmc_command *cmd); +#if defined(CONFIG_DYNAMIC_DEBUG ) || \ + (defined(CONFIG_DYNAMIC_DEBUG_CORE ) && defined(DYNAMIC_DEBUG_MODULE )) +#define SDHCI_DBG_ANYWAY 0 +#elif defined(DEBUG ) +#define SDHCI_DBG_ANYWAY 1 +#else +#define SDHCI_DBG_ANYWAY 0 +#endif + +#define sdhci_dbg_dumpregs (host, fmt) \ +do { \ + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ + if (DYNAMIC_DEBUG_BRANCH(descriptor) || SDHCI_DBG_ANYWAY) \ + sdhci_dumpregs(host); \ +} while (0) +#endif /* __SDHCI_HW_H */
Greg Kroah-Hartman
maintainerPATCH 78/208 Revert "mmc: sdhci: Disable SD card clock before changing parameters"
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ulf Hansson <[email protected]>
commit dcc3bcfc5b50c625b475dcc25d167b6b947a6637 upstream.
It has turned out the trying to strictly conform to the SDHCI specification is causing problems. Let's revert and start over.
This reverts commit fb3bbc46c94f261b6156ee863c1b06c84cf157dc.
--- drivers/mmc/host/sdhci.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/mmc/host/sdhci.c +2 -7
@@ -2010,15 +2010,10 @@ void sdhci_set_clock(struct sdhci_host * host->mmc->actual_clock =0 ; - clk =sdhci_readw (host,SDHCI_CLOCK_CONTROL ); -if (clk &SDHCI_CLOCK_CARD_EN ) -sdhci_writew (host, clk & ~SDHCI_CLOCK_CARD_EN , -SDHCI_CLOCK_CONTROL ); +sdhci_writew (host,0 ,SDHCI_CLOCK_CONTROL ); -if (clock ==0 ) { -sdhci_writew (host,0 ,SDHCI_CLOCK_CONTROL ); +if (clock ==0 )return ; - } clk =sdhci_calc_clk (host, clock, &host->mmc->actual_clock);sdhci_enable_clk (host, clk);
Greg Kroah-Hartman
maintainerPATCH 79/208 usb: typec: altmodes/displayport: do not index invalid pin_assignments
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: RD Babiera <[email protected]>
commit af4db5a35a4ef7a68046883bfd12468007db38f1 upstream.
A poorly implemented DisplayPort Alt Mode port partner can indicate that its pin assignment capabilities are greater than the maximum value, DP_PIN_ASSIGN_F. In this case, calls to pin_assignment_show will cause a BRK exception due to an out of bounds array access.
Prevent for loop in pin_assignment_show from accessing invalid values in pin_assignments by adding DP_PIN_ASSIGN_MAX value in typec_dp.h and using i < DP_PIN_ASSIGN_MAX as a loop condition.
--- drivers/usb/typec/altmodes/displayport.c | 2 +- include/linux/usb/typec_dp.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/usb/typec/altmodes/displayport.c +1 -1
@@ -509,7 +509,7 @@ static ssize_t pin_assignment_show(struc assignments =get_current_pin_assignments (dp); -for (i =0 ; assignments; assignments >>=1 , i++) { +for (i =0 ; assignments && i <DP_PIN_ASSIGN_MAX ; assignments >>=1 , i++) {if (assignments &1 ) {if (i == cur) len += sprintf(buf + len, "[%s] ",
include/linux/usb/typec_dp.h +1 -0
@@ -56,6 +56,7 @@ enum {DP_PIN_ASSIGN_D ,DP_PIN_ASSIGN_E ,DP_PIN_ASSIGN_F ,/* Not supported after v1.0b */ + DP_PIN_ASSIGN_MAX, };/* DisplayPort alt mode specific commands */
Greg Kroah-Hartman
maintainerPATCH 80/208 mtk-sd: Fix a pagefault in dma_unmap_sg() for not prepared data
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <[email protected]>
commit 539d80575b810c7a5987c7ac8915e3bc99c03695 upstream.
When swiotlb buffer is full, the dma_map_sg() returns 0 to msdc_prepare_data(), but it does not check it and sets the MSDC_PREPARE_FLAG.
swiotlb_tbl_map_single() /* prints "swiotlb buffer is full" */
<-swiotlb_map()
<-dma_direct_map_page()
<-dma_direct_map_sg()
<-__dma_map_sg_attrs()
<-dma_map_sg_attrs()
<-dma_map_sg() /* returns 0 (pages mapped) */
<-msdc_prepare_data()Then, the msdc_unprepare_data() checks MSDC_PREPARE_FLAG and calls dma_unmap_sg() with unmapped pages. It causes a page fault.
To fix this problem, Do not set MSDC_PREPARE_FLAG if dma_map_sg() fails because this is not prepared.
--- drivers/mmc/host/mtk-sd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/mtk-sd.c +2 -1
@@ -713,9 +713,10 @@ static void msdc_prepare_data(struct msdstruct mmc_data *data = mrq->data;if (!(data->host_cookie &MSDC_PREPARE_FLAG )) { - data->host_cookie |=MSDC_PREPARE_FLAG ; data->sg_count =dma_map_sg (host->dev, data->sg, data->sg_len,mmc_get_dma_dir (data)); +if (data->sg_count) + data->host_cookie |=MSDC_PREPARE_FLAG ; } }
Greg Kroah-Hartman
maintainerPATCH 81/208 platform/mellanox: mlxbf-tmfifo: fix vring_desc.len assignment
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Thompson <[email protected]>
[ Upstream commit 109f4d29dade8ae5b4ac6325af9d1bc24b4230f8 ]
Fix warnings reported by sparse, related to incorrect type:drivers/platform/mellanox/mlxbf-tmfifo.c:284:38: warning: incorrect type in assignment (different base types)drivers/platform/mellanox/mlxbf-tmfifo.c:284:38: expected restricted __virtio32 [usertype] lendrivers/platform/mellanox/mlxbf-tmfifo.c:284:38: got unsigned long
--- drivers/platform/mellanox/mlxbf-tmfifo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/platform/mellanox/mlxbf-tmfifo.c +2 -1
@@ -253,7 +253,8 @@ static int mlxbf_tmfifo_alloc_vrings(struct mlxbf_tmfifo *fifo, vring->align =SMP_CACHE_BYTES ; vring->index = i; vring->vdev_id = tm_vdev->vdev.id.device; - vring->drop_desc.len =VRING_DROP_DESC_MAX_LEN ; + vring->drop_desc.len =cpu_to_virtio32 (&tm_vdev->vdev, +VRING_DROP_DESC_MAX_LEN ); dev = &tm_vdev->vdev.dev; size =vring_size (vring->num, vring->align);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 82/208 RDMA/mlx5: Initialize obj_event->obj_sub_list before xa_insert
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Zhang <[email protected]>
[ Upstream commit 8edab8a72d67742f87e9dc2e2b0cdfddda5dc29a ]
The obj_event may be loaded immediately after inserted, then if the list_head is not initialized then we may get a poisonous pointer. This fixes the crash below:
mlx5_core 0000:03:00.0: MLX5E: StrdRq(1) RqSz(8) StrdSz(2048) RxCqeCmprss(0 enhanced) mlx5_core.sf mlx5_core.sf.4: firmware version: 32.38.3056
mlx5_core 0000:03:00.0 en3f0pf0sf2002: renamed from eth0
mlx5_core.sf mlx5_core.sf.4: Rate limit: 127 rates are supported, range: 0Mbps to 195312Mbps
IPv6: ADDRCONF(NETDEV_CHANGE): en3f0pf0sf2002: link becomes ready
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000060 Mem abort info: ESR = 0x96000006 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 Data abort info: ISV = 0, ISS = 0x00000006 CM = 0, WnR = 0 user pgtable: 4k pages, 48-bit VAs, pgdp=00000007760fb000 [0000000000000060] pgd=000000076f6d7003, p4d=000000076f6d7003, pud=0000000777841003, pmd=0000000000000000 Internal error: Oops: 96000006 [#1] SMP Modules linked in: ipmb_host(OE) act_mirred(E) cls_flower(E) sch_ingress(E) mptcp_diag(E) udp_diag(E) raw_diag(E) unix_diag(E) tcp_diag(E) inet_diag(E) binfmt_misc(E) bonding(OE) rdma_ucm(OE) rdma_cm(OE) iw_cm(OE) ib_ipoib(OE) ib_cm(OE) isofs(E) cdrom(E) mst_pciconf(OE) ib_umad(OE) mlx5_ib(OE) ipmb_dev_int(OE) mlx5_core(OE) kpatch_15237886(OEK) mlxdevm(OE) auxiliary(OE) ib_uverbs(OE) ib_core(OE) psample(E) mlxfw(OE) tls(E) sunrpc(E) vfat(E) fat(E) crct10dif_ce(E) ghash_ce(E) sha1_ce(E) sbsa_gwdt(E) virtio_console(E) ext4(E) mbcache(E) jbd2(E) xfs(E) libcrc32c(E) mmc_block(E) virtio_net(E) net_failover(E) failover(E) sha2_ce(E) sha256_arm64(E) nvme(OE) nvme_core(OE) gpio_mlxbf3(OE) mlx_compat(OE) mlxbf_pmc(OE) i2c_mlxbf(OE) sdhci_of_dwcmshc(OE) pinctrl_mlxbf3(OE) mlxbf_pka(OE) gpio_generic(E) i2c_core(E) mmc_core(E) mlxbf_gige(OE) vitesse(E) pwr_mlxbf(OE) mlxbf_tmfifo(OE) micrel(E) mlxbf_bootctl(OE) virtio_ring(E) virtio(E) ipmi_devintf(E) ipmi_msghandler(E) [last unloaded: mst_pci] CPU: 11 PID: 20913 Comm: rte-worker-11 Kdump: loaded Tainted: G OE K 5.10.134-13.1.an8.aarch64 #1 Hardware name: https://www.mellanox.com BlueField-3 SmartNIC Main Card/BlueField-3 SmartNIC Main Card, BIOS 4.2.2.12968 Oct 26 2023 pstate: a0400089 (NzCv daIf +PAN -UAO -TCO BTYPE=--) pc : dispatch_event_fd+0x68/0x300 [mlx5_ib] lr : devx_event_notifier+0xcc/0x228 [mlx5_ib] sp : ffff80001005bcf0 x29: ffff80001005bcf0 x28: 0000000000000001 x27: ffff244e0740a1d8 x26: ffff244e0740a1d0 x25: ffffda56beff5ae0 x24: ffffda56bf911618 x23: ffff244e0596a480 x22: ffff244e0596a480 x21: ffff244d8312ad90 x20: ffff244e0596a480 x19: fffffffffffffff0 x18: 0000000000000000 x17: 0000000000000000 x16: ffffda56be66d620 x15: 0000000000000000 x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000 x11: 0000000000000040 x10: ffffda56bfcafb50 x9 : ffffda5655c25f2c x8 : 0000000000000010 x7 : 0000000000000000 x6 : ffff24545a2e24b8 x5 : 0000000000000003 x4 : ffff80001005bd28 x3 : 0000000000000000 x2 : 0000000000000000 x1 : ffff244e0596a480 x0 : ffff244d8312ad90 Call trace: dispatch_event_fd+0x68/0x300 [mlx5_ib] devx_event_notifier+0xcc/0x228 [mlx5_ib] atomic_notifier_call_chain+0x58/0x80 mlx5_eq_async_int+0x148/0x2b0 [mlx5_core] atomic_notifier_call_chain+0x58/0x80 irq_int_handler+0x20/0x30 [mlx5_core] __handle_irq_event_percpu+0x60/0x220 handle_irq_event_percpu+0x3c/0x90 handle_irq_event+0x58/0x158 handle_fasteoi_irq+0xfc/0x188 generic_handle_irq+0x34/0x48 ...
--- drivers/infiniband/hw/mlx5/devx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/devx.c +1 -1
@@ -1809,6 +1809,7 @@ subscribe_event_xa_alloc(struct mlx5_devx_event_table *devx_event_table,/* Level1 is valid for future use, no need to free */ return -ENOMEM ; +INIT_LIST_HEAD (&obj_event->obj_sub_list); err = xa_insert(&event->object_ids, key_level2, obj_event,
@@ -1817,7 +1818,6 @@ subscribe_event_xa_alloc(struct mlx5_devx_event_table *devx_event_table,kfree (obj_event);return err; } -INIT_LIST_HEAD (&obj_event->obj_sub_list); }return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 83/208 nfs: Clean up /proc/net/rpc/nfs when nfs_fs_proc_net_init() fails.
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit e8d6f3ab59468e230f3253efe5cb63efa35289f7 ]
syzbot reported a warning below [1] following a fault injection in nfs_fs_proc_net_init(). [0]
When nfs_fs_proc_net_init() fails, /proc/net/rpc/nfs is not removed.
Later, rpc_proc_exit() tries to remove /proc/net/rpc, and the warning is logged as the directory is not empty.
Let's handle the error of nfs_fs_proc_net_init() properly.
[0]:FAULT_INJECTION: forcing a failure.
name failslab, interval 1, probability 0, space 0, times 0
CPU: 1 UID: 0 PID: 6120 Comm: syz.2.27 Not tainted 6.16.0-rc1-syzkaller-00010-g2c4a1f3fe03e #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Call Trace: <TASK> dump_stack_lvl (lib/dump_stack.c:123) should_fail_ex (lib/fault-inject.c:73 lib/fault-inject.c:174) should_failslab (mm/failslab.c:46) kmem_cache_alloc_noprof (mm/slub.c:4178 mm/slub.c:4204) __proc_create (fs/proc/generic.c:427) proc_create_reg (fs/proc/generic.c:554) proc_create_net_data (fs/proc/proc_net.c:120) nfs_fs_proc_net_init (fs/nfs/client.c:1409) nfs_net_init (fs/nfs/inode.c:2600) ops_init (net/core/net_namespace.c:138) setup_net (net/core/net_namespace.c:443) copy_net_ns (net/core/net_namespace.c:576) create_new_namespaces (kernel/nsproxy.c:110) unshare_nsproxy_namespaces (kernel/nsproxy.c:218 (discriminator 4)) ksys_unshare (kernel/fork.c:3123) __x64_sys_unshare (kernel/fork.c:3190) do_syscall_64 (arch/x86/entry/syscall_64.c:63 arch/x86/entry/syscall_64.c:94) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130) </TASK>
[1]:remove_proc_entry: removing non-empty directory 'net/rpc', leaking at least 'nfs'
WARNING: CPU: 1 PID: 6120 at fs/proc/generic.c:727 remove_proc_entry+0x45e/0x530 fs/proc/generic.c:727 Modules linked in: CPU: 1 UID: 0 PID: 6120 Comm: syz.2.27 Not tainted 6.16.0-rc1-syzkaller-00010-g2c4a1f3fe03e #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 RIP: 0010:remove_proc_entry+0x45e/0x530 fs/proc/generic.c:727 Code: 3c 02 00 0f 85 85 00 00 00 48 8b 93 d8 00 00 00 4d 89 f0 4c 89 e9 48 c7 c6 40 ba a2 8b 48 c7 c7 60 b9 a2 8b e8 33 81 1d ff 90 <0f> 0b 90 90 e9 5f fe ff ff e8 04 69 5e ff 90 48 b8 00 00 00 00 00 RSP: 0018:ffffc90003637b08 EFLAGS: 00010282 RAX: 0000000000000000 RBX: ffff88805f534140 RCX: ffffffff817a92c8 RDX: ffff88807da99e00 RSI: ffffffff817a92d5 RDI: 0000000000000001 RBP: ffff888033431ac0 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000001 R12: ffff888033431a00 R13: ffff888033431ae4 R14: ffff888033184724 R15: dffffc0000000000 FS: 0000555580328500(0000) GS:ffff888124a62000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f71733743e0 CR3: 000000007f618000 CR4: 00000000003526f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> sunrpc_exit_net+0x46/0x90 net/sunrpc/sunrpc_syms.c:76 ops_exit_list net/core/net_namespace.c:200 [inline] ops_undo_list+0x2eb/0xab0 net/core/net_namespace.c:253 setup_net+0x2e1/0x510 net/core/net_namespace.c:457 copy_net_ns+0x2a6/0x5f0 net/core/net_namespace.c:574 create_new_namespaces+0x3ea/0xa90 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0xc0/0x1f0 kernel/nsproxy.c:218 ksys_unshare+0x45b/0xa40 kernel/fork.c:3121 __do_sys_unshare kernel/fork.c:3192 [inline] __se_sys_unshare kernel/fork.c:3190 [inline] __x64_sys_unshare+0x31/0x40 kernel/fork.c:3190 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x490 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fa1a6b8e929 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fff3a090368 EFLAGS: 00000246 ORIG_RAX: 0000000000000110 RAX: ffffffffffffffda RBX: 00007fa1a6db5fa0 RCX: 00007fa1a6b8e929 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000040000080 RBP: 00007fa1a6c10b39 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fa1a6db5fa0 R14: 00007fa1a6db5fa0 R15: 0000000000000001 </TASK>
--- fs/nfs/inode.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
fs/nfs/inode.c +14 -3
@@ -2227,15 +2227,26 @@ EXPORT_SYMBOL_GPL(nfs_net_id);static int nfs_net_init (struct net *net) {struct nfs_net *nn =net_generic (net, nfs_net_id); +int err;nfs_clients_init (net);if (!rpc_proc_register (net, &nn->rpcstats)) { -nfs_clients_exit (net); -return -ENOMEM ; + err = -ENOMEM ; + goto err_proc_rpc; } -return nfs_fs_proc_net_init (net); + err =nfs_fs_proc_net_init (net); +if (err) + goto err_proc_nfs; + +return 0 ; + +err_proc_nfs: +rpc_proc_unregister (net,"nfs" ); +err_proc_rpc: +nfs_clients_exit (net); +return err; }static void nfs_net_exit (struct net *net)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 84/208 NFSv4/pNFS: Fix a race to wake on NFS_LAYOUT_DRAIN
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Coddington <[email protected]>
[ Upstream commit c01776287414ca43412d1319d2877cbad65444ac ]
We found a few different systems hung up in writeback waiting on the same page lock, and one task waiting on the NFS_LAYOUT_DRAIN bit in pnfs_update_layout(), however the pnfs_layout_hdr's plh_outstanding count was zero.
It seems most likely that this is another race between the waiter and waker similar to commit ed0172af5d6f ("SUNRPC: Fix a race to wake a sync task"). Fix it up by applying the advised barrier.
--- fs/nfs/pnfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nfs/pnfs.c +3 -1
@@ -1934,8 +1934,10 @@ static void nfs_layoutget_begin(struct pnfs_layout_hdr *lo)static void nfs_layoutget_end (struct pnfs_layout_hdr *lo) {if (atomic_dec_and_test (&lo->plh_outstanding) && -test_and_clear_bit (NFS_LAYOUT_DRAIN , &lo->plh_flags)) +test_and_clear_bit (NFS_LAYOUT_DRAIN , &lo->plh_flags)) { +smp_mb__after_atomic ();wake_up_bit (&lo->plh_flags,NFS_LAYOUT_DRAIN ); + } }static bool pnfs_is_first_layoutget (struct pnfs_layout_hdr *lo)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 85/208 scsi: qla2xxx: Fix DMA mapping test in qla24xx_get_port_database()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <[email protected]>
[ Upstream commit c3b214719a87735d4f67333a8ef3c0e31a34837c ]
dma_map_XXX() functions return as error values DMA_MAPPING_ERROR which is often ~0. The error value should be tested with dma_mapping_error() like it was done in qla26xx_dport_diagnostics().
--- drivers/scsi/qla2xxx/qla_mbx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_mbx.c +1 -1
@@ -2097,7 +2097,7 @@ qla24xx_get_port_database(scsi_qla_host_t *vha, u16 nport_handle, pdb_dma =dma_map_single (&vha->hw->pdev->dev, pdb,sizeof (*pdb),DMA_FROM_DEVICE ); -if (!pdb_dma) { +if (dma_mapping_error (&vha->hw->pdev->dev, pdb_dma)) {ql_log (ql_log_warn, vha,0x1116 ,"Failed to map dma buffer.\n" );return QLA_MEMORY_ALLOC_FAILED ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 86/208 scsi: qla4xxx: Fix missing DMA mapping error in qla4xxx_alloc_pdu()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <[email protected]>
[ Upstream commit 00f452a1b084efbe8dcb60a29860527944a002a1 ]
dma_map_XXX() can fail and should be tested for errors with dma_mapping_error().
--- drivers/scsi/qla4xxx/ql4_os.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/qla4xxx/ql4_os.c +2 -0
@@ -3425,6 +3425,8 @@ static int qla4xxx_alloc_pdu(struct iscsi_task *task, uint8_t opcode) task_data->data_dma =dma_map_single (&ha->pdev->dev, task->data, task->data_count,DMA_TO_DEVICE ); +if (dma_mapping_error (&ha->pdev->dev, task_data->data_dma)) +return -ENOMEM ; } DEBUG2(ql4_printk(KERN_INFO, ha, "%s: MaxRecvLen %u, iscsi hrd %d\n",
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 87/208 scsi: ufs: core: Fix spelling of a sysfs attribute name
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
[ Upstream commit 021f243627ead17eb6500170256d3d9be787dad8 ]
Change "resourse" into "resource" in the name of a sysfs attribute.
--- Documentation/ABI/testing/sysfs-driver-ufs | 2 +- drivers/scsi/ufs/ufs-sysfs.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
Documentation/ABI/testing/sysfs-driver-ufs +1 -1
@@ -655,7 +655,7 @@ Description: This file shows the thin provisioning type. This is one of The file is read only. -What: /sys/class/scsi_device/*/device/unit_descriptor/physical_memory_resourse_count +What: /sys/class/scsi_device/*/device/unit_descriptor/physical_memory_resource_count Date: February 2018 Contact: Stanislav Nijnikov <[email protected]> Description: This file shows the total physical memory resources. This is
drivers/scsi/ufs/ufs-sysfs.c +2 -2
@@ -806,7 +806,7 @@ UFS_UNIT_DESC_PARAM(logical_block_size, _LOGICAL_BLK_SIZE, 1);UFS_UNIT_DESC_PARAM (logical_block_count, _LOGICAL_BLK_COUNT,8 );UFS_UNIT_DESC_PARAM (erase_block_size, _ERASE_BLK_SIZE,4 );UFS_UNIT_DESC_PARAM (provisioning_type, _PROVISIONING_TYPE,1 ); -UFS_UNIT_DESC_PARAM (physical_memory_resourse_count, _PHY_MEM_RSRC_CNT,8 ); +UFS_UNIT_DESC_PARAM (physical_memory_resource_count, _PHY_MEM_RSRC_CNT,8 );UFS_UNIT_DESC_PARAM (context_capabilities, _CTX_CAPABILITIES,2 );UFS_UNIT_DESC_PARAM (large_unit_granularity, _LARGE_UNIT_SIZE_M1,1 );UFS_UNIT_DESC_PARAM (wb_buf_alloc_units, _WB_BUF_ALLOC_UNITS,4 );
@@ -823,7 +823,7 @@ static struct attribute *ufs_sysfs_unit_descriptor[] = { &dev_attr_logical_block_count.attr, &dev_attr_erase_block_size.attr, &dev_attr_provisioning_type.attr, - &dev_attr_physical_memory_resourse_count.attr, + &dev_attr_physical_memory_resource_count.attr, &dev_attr_context_capabilities.attr, &dev_attr_large_unit_granularity.attr, &dev_attr_wb_buf_alloc_units.attr,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 88/208 RDMA/mlx5: Fix CC counters query for MPV
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Patrisious Haddad <[email protected]>
[ Upstream commit acd245b1e33fc4b9d0f2e3372021d632f7ee0652 ]
In case, CC counters are querying for the second port use the correct core device for the query instead of always using the master core device.
--- drivers/infiniband/hw/mlx5/counters.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/counters.c +1 -1
@@ -279,7 +279,7 @@ static int mlx5_ib_get_hw_stats(struct ib_device *ibdev,*/ goto done; } - ret = mlx5_lag_query_cong_counters(dev->mdev, + ret = mlx5_lag_query_cong_counters(mdev, stats->value + cnts->num_q_counters, cnts->num_cong_counters,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 89/208 btrfs: fix missing error handling when searching for inode refs during log replay
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit 6561a40ceced9082f50c374a22d5966cf9fc5f5c ]
During log replay, at __add_inode_ref(), when we are searching for inode ref keys we totally ignore if btrfs_search_slot() returns an error. This may make a log replay succeed when there was an actual error and leave some metadata inconsistency in a subvolume tree. Fix this by checking if an error was returned from btrfs_search_slot() and if so, return it to the caller.
--- fs/btrfs/tree-log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/btrfs/tree-log.c +3 -1
@@ -1005,7 +1005,9 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans, search_key.type =BTRFS_INODE_REF_KEY ; search_key.offset = parent_objectid; ret =btrfs_search_slot (NULL , root, &search_key, path,0 ,0 ); -if (ret ==0 ) { +if (ret <0 ) { +return ret; + }else if (ret ==0 ) {struct btrfs_inode_ref *victim_ref;unsigned long ptr;unsigned long ptr_end;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 90/208 drm/exynos: fimd: Guard display clock control with runtime PM calls
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Szyprowski <[email protected]>
[ Upstream commit 5d91394f236167ac624b823820faf4aa928b889e ]
Commit c9b1150a68d9 ("drm/atomic-helper: Re-order bridge chain pre-enable and post-disable") changed the call sequence to the CRTC enable/disable and bridge pre_enable/post_disable methods, so those bridge methods are now called when CRTC is not yet enabled.
This causes a lockup observed on Samsung Peach-Pit/Pi Chromebooks. The source of this lockup is a call to fimd_dp_clock_enable() function, when FIMD device is not yet runtime resumed. It worked before the mentioned commit only because the CRTC implemented by the FIMD driver was always enabled what guaranteed the FIMD device to be runtime resumed.
This patch adds runtime PM guards to the fimd_dp_clock_enable() function to enable its proper operation also when the CRTC implemented by FIMD is not yet enabled.
--- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +12 -0
@@ -182,6 +182,7 @@ struct fimd_context {u32 i80ifcon;bool i80_if;bool suspended; +bool dp_clk_enabled;wait_queue_head_t wait_vsync_queue;atomic_t wait_vsync_event;atomic_t win_updated;
@@ -1003,7 +1004,18 @@ static void fimd_dp_clock_enable(struct exynos_drm_clk *clk, bool enable) struct fimd_context *ctx = container_of(clk, struct fimd_context, dp_clk);u32 val = enable ?DP_MIE_CLK_DP_ENABLE :DP_MIE_CLK_DISABLE ; + +if (enable == ctx->dp_clk_enabled) +return ; + +if (enable) +pm_runtime_resume_and_get (ctx->dev); + + ctx->dp_clk_enabled = enable;writel (val, ctx->regs +DP_MIE_CLKCON ); + +if (!enable) +pm_runtime_put (ctx->dev); }static const struct exynos_drm_crtc_ops fimd_crtc_ops = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 91/208 spi: spi-fsl-dspi: Clear completion counter before initiating transfer
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Clark <[email protected]>
[ Upstream commit fa60c094c19b97e103d653f528f8d9c178b6a5f5 ]
In target mode, extra interrupts can be received between the end of a transfer and halting the module if the host continues sending more data. If the interrupt from this occurs after the reinit_completion() then the completion counter is left at a non-zero value. The next unrelated transfer initiated by userspace will then complete immediately without waiting for the interrupt or writing to the RX buffer.
Fix it by resetting the counter before the transfer so that lingering values are cleared. This is done after clearing the FIFOs and the status register but before the transfer is initiated, so no interrupts should be received at this point resulting in other race conditions.
--- drivers/spi/spi-fsl-dspi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/spi/spi-fsl-dspi.c +10 -1
@@ -964,11 +964,20 @@ static int dspi_transfer_one_message(struct spi_controller *ctlr,if (dspi->devtype_data->trans_mode ==DSPI_DMA_MODE ) { status =dspi_dma_xfer (dspi); }else { +/* +* Reinitialize the completion before transferring data +* to avoid the case where it might remain in the done +* state due to a spurious interrupt from a previous +* transfer. This could falsely signal that the current +* transfer has completed. +*/ +if (dspi->irq) +reinit_completion (&dspi->xfer_done); +dspi_fifo_write (dspi);if (dspi->irq) {wait_for_completion (&dspi->xfer_done); -reinit_completion (&dspi->xfer_done); }else { do { status = dspi_poll(dspi);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 92/208 drm/i915/selftests: Change mock_request() to return error pointers
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit caa7c7a76b78ce41d347003f84975125383e6b59 ]
There was an error pointer vs NULL bug in __igt_breadcrumbs_smoketest(). The __mock_request_alloc() function implements the smoketest->request_alloc() function pointer. It was supposed to return error pointers, but it propogates the NULL return from mock_request() so in the event of a failure, it would lead to a NULL pointer dereference.
To fix this, change the mock_request() function to return error pointers and update all the callers to expect that.
--- drivers/gpu/drm/i915/selftests/i915_request.c | 20 +++++++++---------- drivers/gpu/drm/i915/selftests/mock_request.c | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/selftests/i915_request.c +10 -10
@@ -71,8 +71,8 @@ static int igt_add_request(void *arg)/* Basic preliminary test to create a request and let it loose! */ request =mock_request (rcs0 (i915)->kernel_context,HZ /10 ); -if (!request) -return -ENOMEM ; +if (IS_ERR (request)) +return PTR_ERR (request);i915_request_add (request);
@@ -89,8 +89,8 @@ static int igt_wait_request(void *arg)/* Submit a request, then wait upon it */ request =mock_request (rcs0 (i915)->kernel_context,T ); -if (!request) -return -ENOMEM ; +if (IS_ERR (request)) +return PTR_ERR (request);i915_request_get (request);
@@ -158,8 +158,8 @@ static int igt_fence_wait(void *arg)/* Submit a request, treat it as a fence and wait upon it */ request =mock_request (rcs0 (i915)->kernel_context,T ); -if (!request) -return -ENOMEM ; +if (IS_ERR (request)) +return PTR_ERR (request);if (dma_fence_wait_timeout (&request->fence, false,T ) != -ETIME ) {pr_err ("fence wait success before submit (expected timeout)!\n" );
@@ -213,8 +213,8 @@ static int igt_request_rewind(void *arg)GEM_BUG_ON (IS_ERR (ce)); request =mock_request (ce,2 *HZ );intel_context_put (ce); -if (!request) { - err = -ENOMEM ; +if (IS_ERR (request)) { + err =PTR_ERR (request); goto err_context_0; }
@@ -227,8 +227,8 @@ static int igt_request_rewind(void *arg)GEM_BUG_ON (IS_ERR (ce)); vip =mock_request (ce,0 );intel_context_put (ce); -if (!vip) { - err = -ENOMEM ; +if (IS_ERR (vip)) { + err =PTR_ERR (vip); goto err_context_1; }
drivers/gpu/drm/i915/selftests/mock_request.c +1 -1
@@ -35,7 +35,7 @@ mock_request(struct intel_context *ce, unsigned long delay)/* NB the i915->requests slab cache is enlarged to fit mock_request */ request =intel_context_create_request (ce);if (IS_ERR (request)) -return NULL ; +return request; request->mock.delay = delay;return request;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 93/208 drm/i915/gt: Fix timeline left held on VMA alloc error
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Janusz Krzysztofik <[email protected]>
[ Upstream commit a5aa7bc1fca78c7fa127d9e33aa94a0c9066c1d6 ]
The following error has been reported sporadically by CI when a test unbinds the i915 driver on a ring submission platform:
<4> [239.330153] ------------[ cut here ]------------
<4> [239.330166] i915 0000:00:02.0: [drm] drm_WARN_ON(dev_priv->mm.shrink_count)
<4> [239.330196] WARNING: CPU: 1 PID: 18570 at drivers/gpu/drm/i915/i915_gem.c:1309 i915_gem_cleanup_early+0x13e/0x150 [i915]
...
<4> [239.330640] RIP: 0010:i915_gem_cleanup_early+0x13e/0x150 [i915]
...
<4> [239.330942] Call Trace:
<4> [239.330944] <TASK> <4> [239.330949] i915_driver_late_release+0x2b/0xa0 [i915] <4> [239.331202] i915_driver_release+0x86/0xa0 [i915] <4> [239.331482] devm_drm_dev_init_release+0x61/0x90 <4> [239.331494] devm_action_release+0x15/0x30 <4> [239.331504] release_nodes+0x3d/0x120 <4> [239.331517] devres_release_all+0x96/0xd0 <4> [239.331533] device_unbind_cleanup+0x12/0x80 <4> [239.331543] device_release_driver_internal+0x23a/0x280 <4> [239.331550] ? bus_find_device+0xa5/0xe0 <4> [239.331563] device_driver_detach+0x14/0x20
...
<4> [357.719679] ---[ end trace 0000000000000000 ]---
If the test also unloads the i915 module then that's followed with:
<3> [357.787478] =============================================================================
<3> [357.788006] BUG i915_vma (Tainted: G U W N ): Objects remaining on __kmem_cache_shutdown()
<3> [357.788031] ----------------------------------------------------------------------------- <3> [357.788204] Object 0xffff888109e7f480 @offset=29824
<3> [357.788670] Allocated in i915_vma_instance+0xee/0xc10 [i915] age=292729 cpu=4 pid=2244
<4> [357.788994] i915_vma_instance+0xee/0xc10 [i915] <4> [357.789290] init_status_page+0x7b/0x420 [i915] <4> [357.789532] intel_engines_init+0x1d8/0x980 [i915] <4> [357.789772] intel_gt_init+0x175/0x450 [i915] <4> [357.790014] i915_gem_init+0x113/0x340 [i915] <4> [357.790281] i915_driver_probe+0x847/0xed0 [i915] <4> [357.790504] i915_pci_probe+0xe6/0x220 [i915]
...
Closer analysis of CI results history has revealed a dependency of the error on a few IGT tests, namely:
- igt@api_intel_allocator@fork-simple-stress-signal,
- igt@api_intel_allocator@two-level-inception-interruptible,
- igt@gem_linear_blits@interruptible,
- igt@prime_mmap_coherency@ioctl-errors,
which invisibly trigger the issue, then exhibited with first driver unbind attempt.
All of the above tests perform actions which are actively interrupted with signals. Further debugging has allowed to narrow that scope down to DRM_IOCTL_I915_GEM_EXECBUFFER2, and ring_context_alloc(), specific to ring submission, in particular.
If successful then that function, or its execlists or GuC submission equivalent, is supposed to be called only once per GEM context engine, followed by raise of a flag that prevents the function from being called again. The function is expected to unwind its internal errors itself, so it may be safely called once more after it returns an error.
In case of ring submission, the function first gets a reference to the engine's legacy timeline and then allocates a VMA. If the VMA allocation fails, e.g. when i915_vma_instance() called from inside is interrupted with a signal, then ring_context_alloc() fails, leaving the timeline held referenced. On next I915_GEM_EXECBUFFER2 IOCTL, another reference to the timeline is got, and only that last one is put on successful completion. As a consequence, the legacy timeline, with its underlying engine status page's VMA object, is still held and not released on driver unbind.
Get the legacy timeline only after successful allocation of the context engine's VMA.
v2: Add a note on other submission methods (Krzysztof Karas):
Both execlists and GuC submission use lrc_alloc() which seems free from a similar issue.
--- drivers/gpu/drm/i915/gt/intel_ring_submission.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/intel_ring_submission.c +2 -1
@@ -576,7 +576,6 @@ static int ring_context_alloc(struct intel_context *ce)/* One ringbuffer to rule them all */ GEM_BUG_ON (!engine->legacy.ring); ce->ring = engine->legacy.ring; - ce->timeline =intel_timeline_get (engine->legacy.timeline);GEM_BUG_ON (ce->state);if (engine->context_size) {
@@ -591,6 +590,8 @@ static int ring_context_alloc(struct intel_context *ce)__set_bit (CONTEXT_VALID_BIT , &ce->flags); } + ce->timeline =intel_timeline_get (engine->legacy.timeline); +return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 94/208 lib: test_objagg: Set error message in check_expect_hints_stats()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit e6ed134a4ef592fe1fd0cafac9683813b3c8f3e8 ]
Smatch complains that the error message isn't set in the caller:
lib/test_objagg.c:923 test_hints_case2()
error: uninitialized symbol 'errmsg'.
This static checker warning only showed up after a recent refactoring but the bug dates back to when the code was originally added. This likely doesn't affect anything in real life.
--- lib/test_objagg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
lib/test_objagg.c +3 -1
@@ -899,8 +899,10 @@ static int check_expect_hints_stats(struct objagg_hints *objagg_hints,int err; stats =objagg_hints_stats_get (objagg_hints); -if (IS_ERR (stats)) +if (IS_ERR (stats)) { + *errmsg ="objagg_hints_stats_get() failed." ;return PTR_ERR (stats); + } err =__check_expect_stats (stats, expect_stats, errmsg);objagg_stats_put (stats);return err;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 95/208 amd-xgbe: align CL37 AN sequence as per databook
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Raju Rangoju <[email protected]>
[ Upstream commit 42fd432fe6d320323215ebdf4de4d0d7e56e6792 ]
Update the Clause 37 Auto-Negotiation implementation to properly align with the PCS hardware specifications:
- Fix incorrect bit settings in Link Status and Link Duplex fields
- Implement missing sequence steps 2 and 7
These changes ensure CL37 auto-negotiation protocol follows the exact sequence patterns as specified in the hardware databook.
--- drivers/net/ethernet/amd/xgbe/xgbe-common.h | 2 ++ drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 9 +++++++++ drivers/net/ethernet/amd/xgbe/xgbe.h | 4 ++-- 3 files changed, 13 insertions(+), 2 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-common.h +2 -0
@@ -1355,6 +1355,8 @@#define MDIO_VEND2_CTRL1_SS13 BIT(13)#endif +#define XGBE_VEND2_MAC_AUTO_SW BIT(9) +/* MDIO mask values */ #define XGBE_AN_CL73_INT_CMPLT BIT(0)#define XGBE_AN_CL73_INC_LINK BIT(1)
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +9 -0
@@ -363,6 +363,10 @@ static void xgbe_an37_set(struct xgbe_prv_data *pdata, bool enable, reg |=MDIO_VEND2_CTRL1_AN_RESTART ;XMDIO_WRITE (pdata,MDIO_MMD_VEND2 ,MDIO_CTRL1 , reg); + + reg =XMDIO_READ (pdata,MDIO_MMD_VEND2 ,MDIO_PCS_DIG_CTRL ); + reg |=XGBE_VEND2_MAC_AUTO_SW ; +XMDIO_WRITE (pdata,MDIO_MMD_VEND2 ,MDIO_PCS_DIG_CTRL , reg); }static void xgbe_an37_restart (struct xgbe_prv_data *pdata)
@@ -991,6 +995,11 @@ static void xgbe_an37_init(struct xgbe_prv_data *pdata)netif_dbg (pdata, link, pdata->netdev,"CL37 AN (%s) initialized\n" , (pdata->an_mode ==XGBE_AN_MODE_CL37 ) ?"BaseX" :"SGMII" ); + + reg =XMDIO_READ (pdata,MDIO_MMD_AN ,MDIO_CTRL1 ); + reg &= ~MDIO_AN_CTRL1_ENABLE ; +XMDIO_WRITE (pdata,MDIO_MMD_AN ,MDIO_CTRL1 , reg); + }static void xgbe_an73_init (struct xgbe_prv_data *pdata)
drivers/net/ethernet/amd/xgbe/xgbe.h +2 -2
@@ -291,11 +291,11 @@#define XGBE_LINK_TIMEOUT 5#define XGBE_KR_TRAINING_WAIT_ITER 50 -#define XGBE_SGMII_AN_LINK_STATUS BIT(1) +#define XGBE_SGMII_AN_LINK_DUPLEX BIT(1)#define XGBE_SGMII_AN_LINK_SPEED (BIT(2) | BIT(3))#define XGBE_SGMII_AN_LINK_SPEED_100 0x04#define XGBE_SGMII_AN_LINK_SPEED_1000 0x08 -#define XGBE_SGMII_AN_LINK_DUPLEX BIT(4) +#define XGBE_SGMII_AN_LINK_STATUS BIT(4)/* ECC correctable error notification window (seconds) */ #define XGBE_ECC_LIMIT 60
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 96/208 enic: fix incorrect MTU comparison in enic_change_mtu()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alok Tiwari <[email protected]>
[ Upstream commit aaf2b2480375099c022a82023e1cd772bf1c6a5d ]
The comparison in enic_change_mtu() incorrectly used the current netdev->mtu instead of the new new_mtu value when warning about an MTU exceeding the port MTU. This could suppress valid warnings or issue incorrect ones.
Fix the condition and log to properly reflect the new_mtu.
--- drivers/net/ethernet/cisco/enic/enic_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/cisco/enic/enic_main.c +2 -2
@@ -2058,10 +2058,10 @@ static int enic_change_mtu(struct net_device *netdev, int new_mtu)if (enic_is_dynamic (enic) ||enic_is_sriov_vf (enic))return -EOPNOTSUPP ; -if (netdev->mtu > enic->port_mtu) +if (new_mtu > enic->port_mtu)netdev_warn (netdev,"interface MTU (%d) set higher than port MTU (%d)\n" , - netdev->mtu, enic->port_mtu); + new_mtu, enic->port_mtu);return _enic_change_mtu (netdev, new_mtu); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 97/208 net: rose: Fix fall-through warnings for Clang
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo A. R. Silva <[email protected]>
[ Upstream commit 90d181ca488f466904ea59dd5c836f766b69c71b ]
In preparation to enable -Wimplicit-fallthrough for Clang, fix multiple warnings by explicitly adding multiple break statements instead of letting the code fall through to the next case.
Stable-dep-of: 34a500caf48c ("rose: fix dangling neighbour pointers in rose_rt_device_down()")
--- net/rose/rose_route.c | 2 ++ 1 file changed, 2 insertions(+)
net/rose/rose_route.c +2 -0
@@ -347,6 +347,7 @@ static int rose_del_node(struct rose_route_struct *rose_route,case 1 : rose_node->neighbour[1 ] = rose_node->neighbour[2 ]; +break ;case 2 :break ; }
@@ -508,6 +509,7 @@ void rose_rt_device_down(struct net_device *dev) fallthrough;case 1 : t->neighbour[1 ] = t->neighbour[2 ]; +break ;case 2 :break ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 98/208 rose: fix dangling neighbour pointers in rose_rt_device_down()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kohei Enju <[email protected]>
[ Upstream commit 34a500caf48c47d5171f4aa1f237da39b07c6157 ]
There are two bugs in rose_rt_device_down() that can cause use-after-free:
1. The loop bound t->count is modified within the loop, which can cause the loop to terminate early and miss some entries.
2. When removing an entry from the neighbour array, the subsequent entries are moved up to fill the gap, but the loop index i is still incremented, causing the next entry to be skipped.
For example, if a node has three neighbours (A, A, B) with count=3 and A is being removed, the second A is not checked.
i=0: (A, A, B) -> (A, B) with count=2
^ checked
i=1: (A, B) -> (A, B) with count=2
^ checked (B, not A!)
i=2: (doesn't occur because i < count is false)
This leaves the second A in the array with count=2, but the rose_neigh structure has been freed. Code that accesses these entries assumes that the first count entries are valid pointers, causing a use-after-free when it accesses the dangling pointer.
Fix both issues by iterating over the array in reverse order with a fixed loop bound. This ensures that all entries are examined and that the removal of an entry doesn't affect subsequent iterations.
--- net/rose/rose_route.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
net/rose/rose_route.c +4 -11
@@ -497,22 +497,15 @@ void rose_rt_device_down(struct net_device *dev) t = rose_node; rose_node = rose_node->next; -for (i =0 ; i < t->count; i++) { +for (i = t->count -1 ; i >=0 ; i--) {if (t->neighbour[i] != s)continue ; t->count--; -switch (i) { -case 0 : - t->neighbour[0 ] = t->neighbour[1 ]; - fallthrough; -case 1 : - t->neighbour[1 ] = t->neighbour[2 ]; -break ; -case 2 : -break ; - } +memmove (&t->neighbour[i], &t->neighbour[i +1 ], +sizeof (t->neighbour[0 ]) * + (t->count - i)); }if (t->count <=0 )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 99/208 nui: Fix dma_mapping_error() check
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <[email protected]>
[ Upstream commit 561aa0e22b70a5e7246b73d62a824b3aef3fc375 ]
dma_map_XXX() functions return values DMA_MAPPING_ERROR as error values which is often ~0. The error value should be tested with dma_mapping_error().
This patch creates a new function in niu_ops to test if the mapping failed. The test is fixed in niu_rbr_add_page(), added in niu_start_xmit() and the successfully mapped pages are unmaped upon error.
--- drivers/net/ethernet/sun/niu.c | 31 ++++++++++++++++++++++++++++++- drivers/net/ethernet/sun/niu.h | 4 ++++ 2 files changed, 34 insertions(+), 1 deletion(-)
drivers/net/ethernet/sun/niu.c +30 -1
@@ -3317,7 +3317,7 @@ static int niu_rbr_add_page(struct niu *np, struct rx_ring_info *rp, addr = np->ops->map_page (np->device, page,0 ,PAGE_SIZE ,DMA_FROM_DEVICE ); -if (!addr) { +if (np->ops->mapping_error (np->device, addr)) {__free_page (page);return -ENOMEM ; }
@@ -6654,6 +6654,8 @@ static netdev_tx_t niu_start_xmit(struct sk_buff *skb, len =skb_headlen (skb); mapping = np->ops->map_single (np->device, skb->data, len,DMA_TO_DEVICE ); +if (np->ops->mapping_error (np->device, mapping)) + goto out_drop; prod = rp->prod;
@@ -6695,6 +6697,8 @@ static netdev_tx_t niu_start_xmit(struct sk_buff *skb, mapping = np->ops->map_page (np->device,skb_frag_page (frag),skb_frag_off (frag), len,DMA_TO_DEVICE ); +if (np->ops->mapping_error (np->device, mapping)) + goto out_unmap; rp->tx_buffs[prod].skb =NULL ; rp->tx_buffs[prod].mapping = mapping;
@@ -6719,6 +6723,19 @@ static netdev_tx_t niu_start_xmit(struct sk_buff *skb, out:return NETDEV_TX_OK ; +out_unmap: +while (i--) { +const skb_frag_t *frag; + + prod =PREVIOUS_TX (rp, prod); + frag = &skb_shinfo (skb)->frags[i]; + np->ops->unmap_page (np->device, rp->tx_buffs[prod].mapping, +skb_frag_size (frag),DMA_TO_DEVICE ); + } + + np->ops->unmap_single (np->device, rp->tx_buffs[rp->prod].mapping, +skb_headlen (skb),DMA_TO_DEVICE ); + out_drop: rp->tx_errors++;kfree_skb (skb);
@@ -9612,6 +9629,11 @@ static void niu_pci_unmap_single(struct device *dev, u64 dma_address,dma_unmap_single (dev, dma_address, size, direction); } +static int niu_pci_mapping_error (struct device *dev,u64 addr) +{ +return dma_mapping_error (dev, addr); +} +static const struct niu_ops niu_pci_ops = { .alloc_coherent = niu_pci_alloc_coherent, .free_coherent = niu_pci_free_coherent,
@@ -9619,6 +9641,7 @@ static const struct niu_ops niu_pci_ops = { .unmap_page = niu_pci_unmap_page, .map_single = niu_pci_map_single, .unmap_single = niu_pci_unmap_single, + .mapping_error = niu_pci_mapping_error, };static void niu_driver_version (void )
@@ -9993,6 +10016,11 @@ static void niu_phys_unmap_single(struct device *dev, u64 dma_address,/* Nothing to do. */ } +static int niu_phys_mapping_error (struct device *dev,u64 dma_address) +{ +return false; +} +static const struct niu_ops niu_phys_ops = { .alloc_coherent = niu_phys_alloc_coherent, .free_coherent = niu_phys_free_coherent,
@@ -10000,6 +10028,7 @@ static const struct niu_ops niu_phys_ops = { .unmap_page = niu_phys_unmap_page, .map_single = niu_phys_map_single, .unmap_single = niu_phys_unmap_single, + .mapping_error = niu_phys_mapping_error, };static int niu_of_probe (struct platform_device *op)
drivers/net/ethernet/sun/niu.h +4 -0
@@ -2879,6 +2879,9 @@ struct tx_ring_info {#define NEXT_TX (tp, index) \ (((index) + 1) < (tp)->pending ? ((index) + 1) : 0) +#define PREVIOUS_TX (tp, index) \ + (((index) - 1) >= 0 ? ((index) - 1) : (((tp)->pending) - 1)) +static inline u32 niu_tx_avail (struct tx_ring_info *tp) { return (tp->pending -
@@ -3140,6 +3143,7 @@ struct niu_ops { enum dma_data_direction direction);void (*unmap_single)(struct device *dev,u64 dma_address,size_t size,enum dma_data_direction direction); +int (*mapping_error)(struct device *dev,u64 dma_address); };struct niu_link_config {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 100/208 net/sched: Always pass notifications when child class becomes empty
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lion Ackermann <[email protected]>
[ Upstream commit 103406b38c600fec1fe375a77b27d87e314aea09 ]
Certain classful qdiscs may invoke their classes' dequeue handler on an enqueue operation. This may unexpectedly empty the child qdisc and thus make an in-flight class passive via qlen_notify(). Most qdiscs do not expect such behaviour at this point in time and may re-activate the class eventually anyways which will lead to a use-after-free.
The referenced fix commit attempted to fix this behavior for the HFSC case by moving the backlog accounting around, though this turned out to be incomplete since the parent's parent may run into the issue too. The following reproducer demonstrates this use-after-free:
tc qdisc add dev lo root handle 1: drr
tc filter add dev lo parent 1: basic classid 1:1
tc class add dev lo parent 1: classid 1:1 drr
tc qdisc add dev lo parent 1:1 handle 2: hfsc def 1 tc class add dev lo parent 2: classid 2:1 hfsc rt m1 8 d 1 m2 0 tc qdisc add dev lo parent 2:1 handle 3: netem
tc qdisc add dev lo parent 3:1 handle 4: blackhole
echo 1 | socat -u STDIN UDP4-DATAGRAM:127.0.0.1:8888 tc class delete dev lo classid 1:1
echo 1 | socat -u STDIN UDP4-DATAGRAM:127.0.0.1:8888
Since backlog accounting issues leading to a use-after-frees on stale class pointers is a recurring pattern at this point, this patch takes a different approach. Instead of trying to fix the accounting, the patch ensures that qdisc_tree_reduce_backlog always calls qlen_notify when the child qdisc is empty. This solves the problem because deletion of qdiscs always involves a call to qdisc_reset() and / or qdisc_purge_queue() which ultimately resets its qlen to 0 thus causing the following qdisc_tree_reduce_backlog() to report to the parent. Note that this may call qlen_notify on passive classes multiple times. This is not a problem after the recent patch series that made all the classful qdiscs qlen_notify() handlers idempotent.
--- net/sched/sch_api.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-)
net/sched/sch_api.c +5 -14
@@ -768,15 +768,12 @@ static u32 qdisc_alloc_handle(struct net_device *dev)void qdisc_tree_reduce_backlog (struct Qdisc *sch,int n,int len) { -bool qdisc_is_offloaded = sch->flags &TCQ_F_OFFLOADED ;const struct Qdisc_class_ops *cops;unsigned long cl;u32 parentid;bool notify;int drops; -if (n ==0 && len ==0 ) -return ; drops =max_t (int, n,0 );rcu_read_lock ();while ((parentid = sch->parent)) {
@@ -785,17 +782,8 @@ void qdisc_tree_reduce_backlog(struct Qdisc *sch, int n, int len)if (sch->flags &TCQ_F_NOPARENT )break ; -/* Notify parent qdisc only if child qdisc becomes empty. -* -* If child was empty even before update then backlog -* counter is screwed and we skip notification because -* parent class is already passive. -* -* If the original child was offloaded then it is allowed -* to be seem as empty, so the parent is notified anyway. -*/ - notify = !sch->q.qlen && !WARN_ON_ONCE (!n && - !qdisc_is_offloaded); +/* Notify parent qdisc only if child qdisc becomes empty. */ + notify = !sch->q.qlen;/* TODO: perform the search on a per txq basis */ sch =qdisc_lookup (qdisc_dev (sch),TC_H_MAJ (parentid));if (sch ==NULL ) {
@@ -804,6 +792,9 @@ void qdisc_tree_reduce_backlog(struct Qdisc *sch, int n, int len) } cops = sch->ops->cl_ops;if (notify && cops->qlen_notify) { +/* Note that qlen_notify must be idempotent as it may get called +* multiple times. +*/ cl = cops->find (sch, parentid); cops->qlen_notify (sch, cl); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 101/208 ALSA: sb: Force to disable DMAs once when DMA mode is changed
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 4c267ae2ef349639b4d9ebf00dd28586a82fdbe6 ]
When the DMA mode is changed on the (still real!) SB AWE32 after playing a stream and closing, the previous DMA setup was still silently kept, and it can confuse the hardware, resulting in the unexpected noises. As a workaround, enforce the disablement of DMA setups when the DMA setup is changed by the kcontrol.
https://bugzilla.kernel.org/show_bug.cgi?id=218185
--- sound/isa/sb/sb16_main.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/isa/sb/sb16_main.c +4 -0
@@ -710,6 +710,10 @@ static int snd_sb16_dma_control_put(struct snd_kcontrol *kcontrol, struct snd_ct change = nval != oval;snd_sb16_set_dma_mode (chip, nval);spin_unlock_irqrestore (&chip->reg_lock, flags); +if (change) { +snd_dma_disable (chip->dma8); +snd_dma_disable (chip->dma16); + }return change; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 102/208 ata: pata_cs5536: fix build on 32-bit UML
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
[ Upstream commit fe5b391fc56f77cf3c22a9dd4f0ce20db0e3533f ]
On 32-bit ARCH=um, CONFIG_X86_32 is still defined, so it doesn't indicate building on real X86 machines. There's no MSR on UML though, so add a check for CONFIG_X86.
--- drivers/ata/pata_cs5536.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/pata_cs5536.c +1 -1
@@ -27,7 +27,7 @@#include <scsi/scsi_host.h> #include <linux/dmi.h> -#ifdef CONFIG_X86_32 +#if defined(CONFIG_X86 ) && defined(CONFIG_X86_32 )#include <asm/msr.h> static int use_msr;module_param_named (msr, use_msr, int,0644 );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 103/208 powerpc: Fix struct termio related ioctl macros
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Madhavan Srinivasan <[email protected]>
[ Upstream commit ab107276607af90b13a5994997e19b7b9731e251 ]
Since termio interface is now obsolete, include/uapi/asm/ioctls.h has some constant macros referring to "struct termio", this caused build failure at userspace.
In file included from /usr/include/asm/ioctl.h:12,
from /usr/include/asm/ioctls.h:5,
from tst-ioctls.c:3:tst-ioctls.c: In function 'get_TCGETA':
tst-ioctls.c:12:10: error: invalid application of 'sizeof' to incomplete type 'struct termio'
12 | return TCGETA;
| ^~~~~~Even though termios.h provides "struct termio", trying to juggle definitions around to make it compile could introduce regressions. So better to open code it.
--- arch/powerpc/include/uapi/asm/ioctls.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/powerpc/include/uapi/asm/ioctls.h +4 -4
@@ -23,10 +23,10 @@#define TCSETSW _IOW('t', 21, struct termios)#define TCSETSF _IOW('t', 22, struct termios) -#define TCGETA _IOR('t', 23, struct termio) -#define TCSETA _IOW('t', 24, struct termio) -#define TCSETAW _IOW('t', 25, struct termio) -#define TCSETAF _IOW('t', 28, struct termio) +#define TCGETA 0x40147417/* _IOR('t', 23, struct termio) */ +#define TCSETA 0x80147418/* _IOW('t', 24, struct termio) */ +#define TCSETAW 0x80147419/* _IOW('t', 25, struct termio) */ +#define TCSETAF 0x8014741c/* _IOW('t', 28, struct termio) */ #define TCSBRK _IO('t', 29)#define TCXONC _IO('t', 30)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 104/208 scsi: target: Fix NULL pointer dereference in core_scsi3_decode_spec_i_port()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maurizio Lombardi <[email protected]>
[ Upstream commit d8ab68bdb294b09a761e967dad374f2965e1913f ]
The function core_scsi3_decode_spec_i_port(), in its error code path, unconditionally calls core_scsi3_lunacl_undepend_item() passing the dest_se_deve pointer, which may be NULL.
This can lead to a NULL pointer dereference if dest_se_deve remains unset.
SPC-3 PR SPEC_I_PT: Unable to locate dest_tpg
Unable to handle kernel paging request at virtual address dfff800000000012 Call trace: core_scsi3_lunacl_undepend_item+0x2c/0xf0 [target_core_mod] (P) core_scsi3_decode_spec_i_port+0x120c/0x1c30 [target_core_mod] core_scsi3_emulate_pro_register+0x6b8/0xcd8 [target_core_mod] target_scsi3_emulate_pr_out+0x56c/0x840 [target_core_mod]
Fix this by adding a NULL check before callingcore_scsi3_lunacl_undepend_item()
--- drivers/target/target_core_pr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/target/target_core_pr.c +3 -1
@@ -1858,7 +1858,9 @@ core_scsi3_decode_spec_i_port( }kmem_cache_free (t10_pr_reg_cache, dest_pr_reg); -core_scsi3_lunacl_undepend_item (dest_se_deve); + +if (dest_se_deve) +core_scsi3_lunacl_undepend_item (dest_se_deve);if (is_local)continue ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 105/208 wifi: mac80211: drop invalid source address OCB frames
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
[ Upstream commit d1b1a5eb27c4948e8811cf4dbb05aaf3eb10700c ]
In OCB, don't accept frames from invalid source addresses (and in particular don't try to create stations for them), drop the frames instead.
--- net/mac80211/rx.c | 4 ++++ 1 file changed, 4 insertions(+)
net/mac80211/rx.c +4 -0
@@ -4097,6 +4097,10 @@ static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx)if (!multicast && !ether_addr_equal (sdata->dev->dev_addr, hdr->addr1))return false; +/* reject invalid/our STA address */ +if (!is_valid_ether_addr (hdr->addr2) || +ether_addr_equal (sdata->dev->dev_addr, hdr->addr2)) +return false;if (!rx->sta) {int rate_idx;if (status->encoding !=RX_ENC_LEGACY )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 106/208 wifi: ath6kl: remove WARN on bad firmware input
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
[ Upstream commit e7417421d89358da071fd2930f91e67c7128fbff ]
If the firmware gives bad input, that's nothing to do with the driver's stack at this point etc., so the WARN_ON() doesn't add any value. Additionally, this is one of the top syzbot reports now. Just print a message, and as an added bonus, print the sizes too.
--- drivers/net/wireless/ath/ath6kl/bmi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath6kl/bmi.c +3 -1
@@ -87,7 +87,9 @@ int ath6kl_bmi_get_target_info(struct ath6kl *ar,* We need to do some backwards compatibility to make this work. */ if (le32_to_cpu (targ_info->byte_count) !=sizeof (*targ_info)) { -WARN_ON (1 ); +ath6kl_err ("mismatched byte count %d vs. expected %zd\n" , +le32_to_cpu (targ_info->byte_count), +sizeof (*targ_info));return -EINVAL ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 107/208 ACPICA: Refuse to evaluate a method if arguments are missing
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
[ Upstream commit 6fcab2791543924d438e7fa49276d0998b0a069f ]
As reported in [1], a platform firmware update that increased the number of method parameters and forgot to update a least one of its callers, caused ACPICA to crash due to use-after-free.
Since this a result of a clear AML issue that arguably cannot be fixed up by the interpreter (it cannot produce missing data out of thin air), address it by making ACPICA refuse to evaluate a method if the caller attempts to pass fewer arguments than expected to it.
--- drivers/acpi/acpica/dsmethod.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/acpi/acpica/dsmethod.c +7 -0
@@ -483,6 +483,13 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,return_ACPI_STATUS (AE_NULL_OBJECT ); } +if (this_walk_state->num_operands < obj_desc->method.param_count) { +ACPI_ERROR ((AE_INFO ,"Missing argument for method [%4.4s]" , +acpi_ut_get_node_name (method_node))); + +return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG ); + } +/* Init for new method, possibly wait on method mutex */ status =
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 108/208 rcu: Return early if callback is not specified
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uladzislau Rezki (Sony) <[email protected]>
[ Upstream commit 33b6a1f155d627f5bd80c7485c598ce45428f74f ]
Currently the call_rcu() API does not check whether a callback pointer is NULL. If NULL is passed, rcu_core() will try to invoke it, resulting in NULL pointer dereference and a kernel crash.
To prevent this and improve debuggability, this patch adds a check for NULL and emits a kernel stack trace to help identify a faulty caller.
--- kernel/rcu/tree.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/rcu/tree.c +4 -0
@@ -2959,6 +2959,10 @@ __call_rcu(struct rcu_head *head, rcu_callback_t func)/* Misaligned rcu_head! */ WARN_ON_ONCE ((unsigned long )head & (sizeof (void *) -1 )); +/* Avoid NULL dereference if callback is NULL. */ +if (WARN_ON_ONCE (!func)) +return ; +if (debug_rcu_head_queue (head)) {/* * Probable double call_rcu(), so leak the callback.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 109/208 regulator: gpio: Fix the out-of-bounds access to drvdata::gpiods
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit c9764fd88bc744592b0604ccb6b6fc1a5f76b4e3 ]
drvdata::gpiods is supposed to hold an array of 'gpio_desc' pointers. But the memory is allocated for only one pointer. This will lead to out-of-bounds access later in the code if 'config::ngpios' is > 1. So fix the code to allocate enough memory to hold 'config::ngpios' of GPIO descriptors.
While at it, also move the check for memory allocation failure to be below the allocation to make it more readable.
--- drivers/regulator/gpio-regulator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/regulator/gpio-regulator.c +2 -2
@@ -257,8 +257,8 @@ static int gpio_regulator_probe(struct platform_device *pdev)return -ENOMEM ; } - drvdata->gpiods =devm_kzalloc (dev,sizeof (struct gpio_desc *), -GFP_KERNEL ); + drvdata->gpiods =devm_kcalloc (dev, config->ngpios, +sizeof (struct gpio_desc *),GFP_KERNEL );if (!drvdata->gpiods)return -ENOMEM ;for (i =0 ; i < config->ngpios; i++) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 110/208 mmc: mediatek: use data instead of mrq parameter from msdc_{un}prepare_data()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yue Hu <[email protected]>
[ Upstream commit 151071351bb6f3d1861e99a22c4cebadf81911a0 ]
We already have 'mrq->data' before calling these two functions, no need to find it again via 'mrq->data' internally. Also remove local data variable accordingly.
Stable-dep-of: f5de469990f1 ("mtk-sd: Prevent memory corruption from DMA map failure")
--- drivers/mmc/host/mtk-sd.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
drivers/mmc/host/mtk-sd.c +8 -12
@@ -708,10 +708,8 @@ static inline void msdc_dma_setup(struct msdc_host *host, struct msdc_dma *dma,writel (lower_32_bits (dma->gpd_addr), host->base +MSDC_DMA_SA ); } -static void msdc_prepare_data (struct msdc_host *host,struct mmc_request *mrq) +static void msdc_prepare_data (struct msdc_host *host,struct mmc_data *data) { -struct mmc_data *data = mrq->data; -if (!(data->host_cookie &MSDC_PREPARE_FLAG )) { data->sg_count =dma_map_sg (host->dev, data->sg, data->sg_len,mmc_get_dma_dir (data));
@@ -720,10 +718,8 @@ static void msdc_prepare_data(struct msdc_host *host, struct mmc_request *mrq) } } -static void msdc_unprepare_data (struct msdc_host *host,struct mmc_request *mrq) +static void msdc_unprepare_data (struct msdc_host *host,struct mmc_data *data) { -struct mmc_data *data = mrq->data; -if (data->host_cookie &MSDC_ASYNC_FLAG )return ;
@@ -1116,7 +1112,7 @@ static void msdc_request_done(struct msdc_host *host, struct mmc_request *mrq)msdc_track_cmd_data (host, mrq->cmd, mrq->data);if (mrq->data) -msdc_unprepare_data (host, mrq); +msdc_unprepare_data (host, mrq->data);if (host->error)msdc_reset_hw (host);mmc_request_done (mmc_from_priv (host), mrq);
@@ -1287,7 +1283,7 @@ static void msdc_ops_request(struct mmc_host *mmc, struct mmc_request *mrq) host->mrq = mrq;if (mrq->data) -msdc_prepare_data (host, mrq); +msdc_prepare_data (host, mrq->data);/* if SBC is required, we have HW option and SW option. * if HW option is enabled, and SBC does not have "special" flags,
@@ -1308,7 +1304,7 @@ static void msdc_pre_req(struct mmc_host *mmc, struct mmc_request *mrq)if (!data)return ; -msdc_prepare_data (host, mrq); +msdc_prepare_data (host, data); data->host_cookie |=MSDC_ASYNC_FLAG ; }
@@ -1316,14 +1312,14 @@ static void msdc_post_req(struct mmc_host *mmc, struct mmc_request *mrq, int err) {struct msdc_host *host =mmc_priv (mmc); -struct mmc_data *data; +struct mmc_data *data = mrq->data; - data = mrq->data;if (!data)return ; +if (data->host_cookie) { data->host_cookie &= ~MSDC_ASYNC_FLAG ; -msdc_unprepare_data (host, mrq); +msdc_unprepare_data (host, data); } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 111/208 mtk-sd: Prevent memory corruption from DMA map failure
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <[email protected]>
[ Upstream commit f5de469990f19569627ea0dd56536ff5a13beaa3 ]
If msdc_prepare_data() fails to map the DMA region, the request is not prepared for data receiving, but msdc_start_data() proceeds the DMA with previous setting.
Since this will lead a memory corruption, we have to stop the request operation soon after the msdc_prepare_data() fails to prepare it.
--- drivers/mmc/host/mtk-sd.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/mmc/host/mtk-sd.c +16 -1
@@ -718,6 +718,11 @@ static void msdc_prepare_data(struct msdc_host *host, struct mmc_data *data) } } +static bool msdc_data_prepared (struct mmc_data *data) +{ +return data->host_cookie &MSDC_PREPARE_FLAG ; +} +static void msdc_unprepare_data (struct msdc_host *host,struct mmc_data *data) {if (data->host_cookie &MSDC_ASYNC_FLAG )
@@ -1282,8 +1287,18 @@ static void msdc_ops_request(struct mmc_host *mmc, struct mmc_request *mrq)WARN_ON (host->mrq); host->mrq = mrq; -if (mrq->data) +if (mrq->data) {msdc_prepare_data (host, mrq->data); +if (!msdc_data_prepared (mrq->data)) { +/* +* Failed to prepare DMA area, fail fast before +* starting any commands. +*/ + mrq->cmd->error = -ENOSPC ; +mmc_request_done (mmc_from_priv (host), mrq); +return ; + } + }/* if SBC is required, we have HW option and SW option. * if HW option is enabled, and SBC does not have "special" flags,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 112/208 mtk-sd: reset host->mrq on prepare_data() error
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Senozhatsky <[email protected]>
[ Upstream commit ec54c0a20709ed6e56f40a8d59eee725c31a916b ]
Do not leave host with dangling ->mrq pointer if we hit the msdc_prepare_data() error out path.
--- drivers/mmc/host/mtk-sd.c | 1 + 1 file changed, 1 insertion(+)
drivers/mmc/host/mtk-sd.c +1 -0
@@ -1290,6 +1290,7 @@ static void msdc_ops_request(struct mmc_host *mmc, struct mmc_request *mrq)if (mrq->data) {msdc_prepare_data (host, mrq->data);if (!msdc_data_prepared (mrq->data)) { + host->mrq =NULL ;/* * Failed to prepare DMA area, fail fast before * starting any commands.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 113/208 drm/v3d: Disable interrupts before resetting the GPU
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maíra Canal <[email protected]>
[ Upstream commit 226862f50a7a88e4e4de9abbf36c64d19acd6fd0 ]
Currently, an interrupt can be triggered during a GPU reset, which can lead to GPU hangs and NULL pointer dereference in an interrupt context as shown in the following trace:
[ 314.035040] Unable to handle kernel NULL pointer dereference at virtual address 00000000000000c0 [ 314.043822] Mem abort info: [ 314.046606] ESR = 0x0000000096000005 [ 314.050347] EC = 0x25: DABT (current EL), IL = 32 bits [ 314.055651] SET = 0, FnV = 0 [ 314.058695] EA = 0, S1PTW = 0 [ 314.061826] FSC = 0x05: level 1 translation fault [ 314.066694] Data abort info: [ 314.069564] ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000 [ 314.075039] CM = 0, WnR = 0, TnD = 0, TagAccess = 0 [ 314.080080] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 [ 314.085382] user pgtable: 4k pages, 39-bit VAs, pgdp=0000000102728000 [ 314.091814] [00000000000000c0] pgd=0000000000000000, p4d=0000000000000000, pud=0000000000000000 [ 314.100511] Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP [ 314.106770] Modules linked in: v3d i2c_brcmstb vc4 snd_soc_hdmi_codec gpu_sched drm_shmem_helper drm_display_helper cec drm_dma_helper drm_kms_helper drm drm_panel_orientation_quirks snd_soc_core snd_compress snd_pcm_dmaengine snd_pcm snd_timer snd backlight [ 314.129654] CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 6.12.25+rpt-rpi-v8 #1 Debian 1:6.12.25-1+rpt1 [ 314.139388] Hardware name: Raspberry Pi 4 Model B Rev 1.4 (DT) [ 314.145211] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 314.152165] pc : v3d_irq+0xec/0x2e0 [v3d] [ 314.156187] lr : v3d_irq+0xe0/0x2e0 [v3d] [ 314.160198] sp : ffffffc080003ea0 [ 314.163502] x29: ffffffc080003ea0 x28: ffffffec1f184980 x27: 021202b000000000 [ 314.170633] x26: ffffffec1f17f630 x25: ffffff8101372000 x24: ffffffec1f17d9f0 [ 314.177764] x23: 000000000000002a x22: 000000000000002a x21: ffffff8103252000 [ 314.184895] x20: 0000000000000001 x19: 00000000deadbeef x18: 0000000000000000 [ 314.192026] x17: ffffff94e51d2000 x16: ffffffec1dac3cb0 x15: c306000000000000 [ 314.199156] x14: 0000000000000000 x13: b2fc982e03cc5168 x12: 0000000000000001 [ 314.206286] x11: ffffff8103f8bcc0 x10: ffffffec1f196868 x9 : ffffffec1dac3874 [ 314.213416] x8 : 0000000000000000 x7 : 0000000000042a3a x6 : ffffff810017a180 [ 314.220547] x5 : ffffffec1ebad400 x4 : ffffffec1ebad320 x3 : 00000000000bebeb [ 314.227677] x2 : 0000000000000000 x1 : 0000000000000000 x0 : 0000000000000000 [ 314.234807] Call trace: [ 314.237243] v3d_irq+0xec/0x2e0 [v3d] [ 314.240906] __handle_irq_event_percpu+0x58/0x218 [ 314.245609] handle_irq_event+0x54/0xb8 [ 314.249439] handle_fasteoi_irq+0xac/0x240 [ 314.253527] handle_irq_desc+0x48/0x68 [ 314.257269] generic_handle_domain_irq+0x24/0x38 [ 314.261879] gic_handle_irq+0x48/0xd8 [ 314.265533] call_on_irq_stack+0x24/0x58 [ 314.269448] do_interrupt_handler+0x88/0x98 [ 314.273624] el1_interrupt+0x34/0x68 [ 314.277193] el1h_64_irq_handler+0x18/0x28 [ 314.281281] el1h_64_irq+0x64/0x68 [ 314.284673] default_idle_call+0x3c/0x168 [ 314.288675] do_idle+0x1fc/0x230 [ 314.291895] cpu_startup_entry+0x3c/0x50 [ 314.295810] rest_init+0xe4/0xf0 [ 314.299030] start_kernel+0x5e8/0x790 [ 314.302684] __primary_switched+0x80/0x90 [ 314.306691] Code: 940029eb 360ffc13 f9442ea0 52800001 (f9406017) [ 314.312775] ---[ end trace 0000000000000000 ]--- [ 314.317384] Kernel panic - not syncing: Oops: Fatal exception in interrupt [ 314.324249] SMP: stopping secondary CPUs [ 314.328167] Kernel Offset: 0x2b9da00000 from 0xffffffc080000000 [ 314.334076] PHYS_OFFSET: 0x0 [ 314.336946] CPU features: 0x08,00002013,c0200000,0200421b [ 314.342337] Memory Limit: none [ 314.345382] ---[ end Kernel panic - not syncing: Oops: Fatal exception in interrupt ]---
Before resetting the GPU, it's necessary to disable all interrupts and deal with any interrupt handler still in-flight. Otherwise, the GPU might reset with jobs still running, or yet, an interrupt could be handled during the reset.
--- drivers/gpu/drm/v3d/v3d_drv.h | 7 +++++++ drivers/gpu/drm/v3d/v3d_gem.c | 2 ++ drivers/gpu/drm/v3d/v3d_irq.c | 38 ++++++++++++++++++++++++++--------- 3 files changed, 37 insertions(+), 10 deletions(-)
drivers/gpu/drm/v3d/v3d_drv.h +7 -0
@@ -37,6 +37,12 @@ struct v3d_queue_state {u64 emit_seqno; }; +enum v3d_irq { +V3D_CORE_IRQ , +V3D_HUB_IRQ , +V3D_MAX_IRQS , +}; +struct v3d_dev {struct drm_device drm;
@@ -46,6 +52,7 @@ struct v3d_dev {int ver;bool single_irq_line; +int irq[V3D_MAX_IRQS ];void __iomem *hub_regs;void __iomem *core_regs[3 ];void __iomem *bridge_regs;
drivers/gpu/drm/v3d/v3d_gem.c +2 -0
@@ -120,6 +120,8 @@ v3d_reset(struct v3d_dev *v3d)if (false)v3d_idle_axi (v3d,0 ); +v3d_irq_disable (v3d); +v3d_idle_gca (v3d);v3d_reset_v3d (v3d);
drivers/gpu/drm/v3d/v3d_irq.c +28 -10
@@ -218,7 +218,7 @@ v3d_hub_irq(int irq, void *arg)int v3d_irq_init (struct v3d_dev *v3d) { -int irq1, ret, core; +int irq, ret, core;INIT_WORK (&v3d->overflow_mem_work, v3d_overflow_mem_work);
@@ -229,17 +229,24 @@ v3d_irq_init(struct v3d_dev *v3d)V3D_CORE_WRITE (core,V3D_CTL_INT_CLR ,V3D_CORE_IRQS );V3D_WRITE (V3D_HUB_INT_CLR ,V3D_HUB_IRQS ); - irq1 =platform_get_irq (v3d_to_pdev (v3d),1 ); -if (irq1 == -EPROBE_DEFER ) -return irq1; -if (irq1 >0 ) { - ret =devm_request_irq (v3d->drm.dev, irq1, + irq =platform_get_irq (v3d_to_pdev (v3d),1 ); +if (irq == -EPROBE_DEFER ) +return irq; +if (irq >0 ) { + v3d->irq[V3D_CORE_IRQ ] = irq; + + ret =devm_request_irq (v3d->drm.dev, v3d->irq[V3D_CORE_IRQ ], v3d_irq,IRQF_SHARED ,"v3d_core0" , v3d);if (ret) goto fail; - ret =devm_request_irq (v3d->drm.dev, -platform_get_irq (v3d_to_pdev (v3d),0 ), + + irq =platform_get_irq (v3d_to_pdev (v3d),0 ); +if (irq <0 ) +return irq; + v3d->irq[V3D_HUB_IRQ ] = irq; + + ret =devm_request_irq (v3d->drm.dev, v3d->irq[V3D_HUB_IRQ ], v3d_hub_irq,IRQF_SHARED ,"v3d_hub" , v3d);if (ret)
@@ -247,8 +254,12 @@ v3d_irq_init(struct v3d_dev *v3d) }else { v3d->single_irq_line = true; - ret =devm_request_irq (v3d->drm.dev, -platform_get_irq (v3d_to_pdev (v3d),0 ), + irq =platform_get_irq (v3d_to_pdev (v3d),0 ); +if (irq <0 ) +return irq; + v3d->irq[V3D_CORE_IRQ ] = irq; + + ret =devm_request_irq (v3d->drm.dev, v3d->irq[V3D_CORE_IRQ ], v3d_irq,IRQF_SHARED ,"v3d" , v3d);if (ret)
@@ -283,12 +294,19 @@ void v3d_irq_disable(struct v3d_dev *v3d) {int core; +int i;/* Disable all interrupts. */ for (core =0 ; core < v3d->cores; core++)V3D_CORE_WRITE (core,V3D_CTL_INT_MSK_SET , ~0 );V3D_WRITE (V3D_HUB_INT_MSK_SET , ~0 ); +/* Finish any interrupt handler still in flight. */ +for (i =0 ; i <V3D_MAX_IRQS ; i++) { +if (v3d->irq[i]) +synchronize_irq (v3d->irq[i]); + } +/* Clear any pending interrupts we might have left. */ for (core =0 ; core < v3d->cores; core++)V3D_CORE_WRITE (core,V3D_CTL_INT_CLR ,V3D_CORE_IRQS );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 114/208 RDMA/mlx5: Fix vport loopback for MPV device
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Patrisious Haddad <[email protected]>
[ Upstream commit a9a9e68954f29b1e197663f76289db4879fd51bb ]
Always enable vport loopback for both MPV devices on driver start.
Previously in some cases related to MPV RoCE, packets weren't correctly executing loopback check at vport in FW, since it was disabled. Due to complexity of identifying such cases for MPV always enable vport loopback for both GVMIs when binding the slave to the master port.
--- drivers/infiniband/hw/mlx5/main.c | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
drivers/infiniband/hw/mlx5/main.c +33 -0
@@ -1667,6 +1667,33 @@ static void deallocate_uars(struct mlx5_ib_dev *dev,mlx5_cmd_free_uar (dev->mdev, bfregi->sys_pages[i]); } +static int mlx5_ib_enable_lb_mp (struct mlx5_core_dev *master, +struct mlx5_core_dev *slave) +{ +int err; + + err =mlx5_nic_vport_update_local_lb (master, true); +if (err) +return err; + + err =mlx5_nic_vport_update_local_lb (slave, true); +if (err) + goto out; + +return 0 ; + +out: +mlx5_nic_vport_update_local_lb (master, false); +return err; +} + +static void mlx5_ib_disable_lb_mp (struct mlx5_core_dev *master, +struct mlx5_core_dev *slave) +{ +mlx5_nic_vport_update_local_lb (slave, false); +mlx5_nic_vport_update_local_lb (master, false); +} +int mlx5_ib_enable_lb (struct mlx5_ib_dev *dev,bool td,bool qp) {int err =0 ;
@@ -3424,6 +3451,8 @@ static void mlx5_ib_unbind_slave_port(struct mlx5_ib_dev *ibdev,lockdep_assert_held (&mlx5_ib_multiport_mutex); +mlx5_ib_disable_lb_mp (ibdev->mdev, mpi->mdev); +mlx5_ib_cleanup_cong_debugfs (ibdev, port_num);spin_lock (&port->mp.mpi_lock);
@@ -3512,6 +3541,10 @@ static bool mlx5_ib_bind_slave_port(struct mlx5_ib_dev *ibdev,mlx5_ib_init_cong_debugfs (ibdev, port_num); + err =mlx5_ib_enable_lb_mp (ibdev->mdev, mpi->mdev); +if (err) + goto unbind; +return true; unbind:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 115/208 flexfiles/pNFS: update stats on NFS4ERR_DELAY for v4.1 DSes
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tigran Mkrtchyan <[email protected]>
[ Upstream commit e3e3775392f3f0f3e3044f8c162bf47858e01759 ]
On NFS4ERR_DELAY nfs slient updates its stats, but misses for flexfiles v4.1 DSes.
Stable-dep-of: 38074de35b01 ("NFSv4/flexfiles: Fix handling of NFS level errors in I/O")
--- fs/nfs/flexfilelayout/flexfilelayout.c | 2 ++ 1 file changed, 2 insertions(+)
fs/nfs/flexfilelayout/flexfilelayout.c +2 -0
@@ -1127,6 +1127,8 @@ static int ff_layout_async_handle_error_v4(struct rpc_task *task,nfs4_schedule_session_recovery (clp->cl_session, task->tk_status);break ;case -NFS4ERR_DELAY : +nfs_inc_stats (lseg->pls_layout->plh_inode,NFSIOS_DELAY ); + fallthrough;case -NFS4ERR_GRACE :rpc_delay (task,FF_LAYOUT_POLL_RETRY_MAX );break ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 116/208 NFSv4/flexfiles: Fix handling of NFS level errors in I/O
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
[ Upstream commit 38074de35b015df5623f524d6f2b49a0cd395c40 ]
Allow the flexfiles error handling to recognise NFS level errors (as opposed to RPC level errors) and handle them separately. The main motivator is the NFSERR_PERM errors that get returned if the NFS client connects to the data server through a port number that is lower than 1024. In that case, the client should disconnect and retry a READ on a different data server, or it should retry a WRITE after reconnecting.
--- fs/nfs/flexfilelayout/flexfilelayout.c | 119 ++++++++++++++++++------- 1 file changed, 85 insertions(+), 34 deletions(-)
fs/nfs/flexfilelayout/flexfilelayout.c +85 -34
@@ -1103,6 +1103,7 @@ static void ff_layout_reset_read(struct nfs_pgio_header *hdr) } static int ff_layout_async_handle_error_v4(struct rpc_task *task, + u32 op_status, struct nfs4_state *state, struct nfs_client *clp, struct pnfs_layout_segment *lseg,
@@ -1113,34 +1114,42 @@ static int ff_layout_async_handle_error_v4(struct rpc_task *task,struct nfs4_deviceid_node *devid =FF_LAYOUT_DEVID_NODE (lseg, idx);struct nfs4_slot_table *tbl = &clp->cl_session->fc_slot_table; -switch (task->tk_status) { -case -NFS4ERR_BADSESSION : -case -NFS4ERR_BADSLOT : -case -NFS4ERR_BAD_HIGH_SLOT : -case -NFS4ERR_DEADSESSION : -case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION : -case -NFS4ERR_SEQ_FALSE_RETRY : -case -NFS4ERR_SEQ_MISORDERED : +switch (op_status) { +case NFS4_OK : +case NFS4ERR_NXIO : +break ; +case NFSERR_PERM : +if (!task->tk_xprt) +break ; +xprt_force_disconnect (task->tk_xprt); + goto out_retry; +case NFS4ERR_BADSESSION : +case NFS4ERR_BADSLOT : +case NFS4ERR_BAD_HIGH_SLOT : +case NFS4ERR_DEADSESSION : +case NFS4ERR_CONN_NOT_BOUND_TO_SESSION : +case NFS4ERR_SEQ_FALSE_RETRY : +case NFS4ERR_SEQ_MISORDERED :dprintk ("%s ERROR %d, Reset session. Exchangeid " "flags 0x%x\n" , __func__, task->tk_status, clp->cl_exchange_flags);nfs4_schedule_session_recovery (clp->cl_session, task->tk_status); -break ; -case -NFS4ERR_DELAY : + goto out_retry; +case NFS4ERR_DELAY :nfs_inc_stats (lseg->pls_layout->plh_inode,NFSIOS_DELAY ); fallthrough; -case -NFS4ERR_GRACE : +case NFS4ERR_GRACE :rpc_delay (task,FF_LAYOUT_POLL_RETRY_MAX ); -break ; -case -NFS4ERR_RETRY_UNCACHED_REP : -break ; + goto out_retry; +case NFS4ERR_RETRY_UNCACHED_REP : + goto out_retry;/* Invalidate Layout errors */ -case -NFS4ERR_PNFS_NO_LAYOUT : -case -ESTALE :/* mapped NFS4ERR_STALE */ -case -EBADHANDLE :/* mapped NFS4ERR_BADHANDLE */ -case -EISDIR :/* mapped NFS4ERR_ISDIR */ -case -NFS4ERR_FHEXPIRED : -case -NFS4ERR_WRONG_TYPE : +case NFS4ERR_PNFS_NO_LAYOUT : +case NFS4ERR_STALE : +case NFS4ERR_BADHANDLE : +case NFS4ERR_ISDIR : +case NFS4ERR_FHEXPIRED : +case NFS4ERR_WRONG_TYPE :dprintk ("%s Invalid layout error %d\n" , __func__, task->tk_status);/*
@@ -1153,6 +1162,11 @@ static int ff_layout_async_handle_error_v4(struct rpc_task *task,pnfs_destroy_layout (NFS_I (inode));rpc_wake_up (&tbl->slot_tbl_waitq); goto reset; +default : +break ; + } + +switch (task->tk_status) {/* RPC connection errors */ case -ECONNREFUSED :case -EHOSTDOWN :
@@ -1166,26 +1180,56 @@ static int ff_layout_async_handle_error_v4(struct rpc_task *task,nfs4_delete_deviceid (devid->ld, devid->nfs_client, &devid->deviceid);rpc_wake_up (&tbl->slot_tbl_waitq); - fallthrough; +break ;default : -if (ff_layout_avoid_mds_available_ds (lseg)) -return -NFS4ERR_RESET_TO_PNFS ; -reset: -dprintk ("%s Retry through MDS. Error %d\n" , __func__, - task->tk_status); -return -NFS4ERR_RESET_TO_MDS ; +break ; } + +if (ff_layout_avoid_mds_available_ds (lseg)) +return -NFS4ERR_RESET_TO_PNFS ; +reset: +dprintk ("%s Retry through MDS. Error %d\n" , __func__, + task->tk_status); +return -NFS4ERR_RESET_TO_MDS ; + +out_retry: task->tk_status =0 ;return -EAGAIN ; }/* Retry all errors through either pNFS or MDS except for -EJUKEBOX */ static int ff_layout_async_handle_error_v3 (struct rpc_task *task, +u32 op_status, +struct nfs_client *clp,struct pnfs_layout_segment *lseg,u32 idx) {struct nfs4_deviceid_node *devid =FF_LAYOUT_DEVID_NODE (lseg, idx); +switch (op_status) { +case NFS_OK : +case NFSERR_NXIO : +break ; +case NFSERR_PERM : +if (!task->tk_xprt) +break ; +xprt_force_disconnect (task->tk_xprt); + goto out_retry; +case NFSERR_ACCES : +case NFSERR_BADHANDLE : +case NFSERR_FBIG : +case NFSERR_IO : +case NFSERR_NOSPC : +case NFSERR_ROFS : +case NFSERR_STALE : + goto out_reset_to_pnfs; +case NFSERR_JUKEBOX : +nfs_inc_stats (lseg->pls_layout->plh_inode,NFSIOS_DELAY ); + goto out_retry; +default : +break ; + } +switch (task->tk_status) {/* File access problems. Don't mark the device as unavailable */ case -EACCES :
@@ -1204,6 +1248,7 @@ static int ff_layout_async_handle_error_v3(struct rpc_task *task,nfs4_delete_deviceid (devid->ld, devid->nfs_client, &devid->deviceid); } +out_reset_to_pnfs:/* FIXME: Need to prevent infinite looping here. */ return -NFS4ERR_RESET_TO_PNFS ; out_retry:
@@ -1214,6 +1259,7 @@ static int ff_layout_async_handle_error_v3(struct rpc_task *task, } static int ff_layout_async_handle_error(struct rpc_task *task, + u32 op_status, struct nfs4_state *state, struct nfs_client *clp, struct pnfs_layout_segment *lseg,
@@ -1232,10 +1278,11 @@ static int ff_layout_async_handle_error(struct rpc_task *task,switch (vers) {case 3 : -return ff_layout_async_handle_error_v3 (task, lseg, idx); -case 4 : -return ff_layout_async_handle_error_v4 (task, state, clp, +return ff_layout_async_handle_error_v3 (task, op_status, clp, lseg, idx); +case 4 : +return ff_layout_async_handle_error_v4 (task, op_status, state, + clp, lseg, idx);default :/* should never happen */ WARN_ON_ONCE (1 );
@@ -1286,6 +1333,7 @@ static void ff_layout_io_track_ds_error(struct pnfs_layout_segment *lseg,switch (status) {case NFS4ERR_DELAY :case NFS4ERR_GRACE : +case NFS4ERR_PERM :break ;case NFS4ERR_NXIO :ff_layout_mark_ds_unreachable (lseg, idx);
@@ -1318,7 +1366,8 @@ static int ff_layout_read_done_cb(struct rpc_task *task,trace_ff_layout_read_error (hdr); } - err =ff_layout_async_handle_error (task, hdr->args.context->state, + err =ff_layout_async_handle_error (task, hdr->res.op_status, + hdr->args.context->state, hdr->ds_clp, hdr->lseg, hdr->pgio_mirror_idx);
@@ -1483,7 +1532,8 @@ static int ff_layout_write_done_cb(struct rpc_task *task,trace_ff_layout_write_error (hdr); } - err =ff_layout_async_handle_error (task, hdr->args.context->state, + err =ff_layout_async_handle_error (task, hdr->res.op_status, + hdr->args.context->state, hdr->ds_clp, hdr->lseg, hdr->pgio_mirror_idx);
@@ -1529,8 +1579,9 @@ static int ff_layout_commit_done_cb(struct rpc_task *task,trace_ff_layout_commit_error (data); } - err =ff_layout_async_handle_error (task,NULL , data->ds_clp, - data->lseg, data->ds_commit_index); + err =ff_layout_async_handle_error (task, data->res.op_status, +NULL , data->ds_clp, data->lseg, + data->ds_commit_index);trace_nfs4_pnfs_commit_ds (data, err);switch (err) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 117/208 btrfs: propagate last_unlink_trans earlier when doing a rmdir
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit c466e33e729a0ee017d10d919cba18f503853c60 ]
In case the removed directory had a snapshot that was deleted, we are propagating its inode's last_unlink_trans to the parent directory after we removed the entry from the parent directory. This leaves a small race window where someone can log the parent directory after we removed the entry and before we updated last_unlink_trans, and as a result if we ever try to replay such a log tree, we will fail since we will attempt to remove a snapshot during log replay, which is currently not possible and results in the log replay (and mount) to fail. This is the type of failure described in commit 1ec9a1ae1e30 ("Btrfs: fix unreplayable log after snapshot delete + parent dir fsync").
So fix this by propagating the last_unlink_trans to the parent directory before we remove the entry from it.
--- fs/btrfs/inode.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
fs/btrfs/inode.c +18 -18
@@ -4150,7 +4150,6 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry)int err =0 ;struct btrfs_root *root =BTRFS_I (dir)->root;struct btrfs_trans_handle *trans; -u64 last_unlink_trans;if (inode->i_size >BTRFS_EMPTY_DIR_SIZE )return -ENOTEMPTY ;
@@ -4161,6 +4160,23 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry)if (IS_ERR (trans))return PTR_ERR (trans); +/* +* Propagate the last_unlink_trans value of the deleted dir to its +* parent directory. This is to prevent an unrecoverable log tree in the +* case we do something like this: +* 1) create dir foo +* 2) create snapshot under dir foo +* 3) delete the snapshot +* 4) rmdir foo +* 5) mkdir foo +* 6) fsync foo or some file inside foo +* +* This is because we can't unlink other roots when replaying the dir +* deletes for directory foo. +*/ +if (BTRFS_I (inode)->last_unlink_trans >= trans->transid) +BTRFS_I (dir)->last_unlink_trans =BTRFS_I (inode)->last_unlink_trans; +if (unlikely (btrfs_ino (BTRFS_I (inode)) ==BTRFS_EMPTY_SUBVOL_DIR_OBJECTID )) { err =btrfs_unlink_subvol (trans, dir, dentry); goto out;
@@ -4170,28 +4186,12 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry)if (err) goto out; - last_unlink_trans =BTRFS_I (inode)->last_unlink_trans; -/* now the directory is empty */ err =btrfs_unlink_inode (trans, root,BTRFS_I (dir),BTRFS_I (d_inode (dentry)), dentry->d_name.name, dentry->d_name.len); -if (!err) { +if (!err)btrfs_i_size_write (BTRFS_I (inode),0 ); -/* -* Propagate the last_unlink_trans value of the deleted dir to -* its parent directory. This is to prevent an unrecoverable -* log tree in the case we do something like this: -* 1) create dir foo -* 2) create snapshot under dir foo -* 3) delete the snapshot -* 4) rmdir foo -* 5) mkdir foo -* 6) fsync foo or some file inside foo -*/ -if (last_unlink_trans >= trans->transid) -BTRFS_I (dir)->last_unlink_trans = last_unlink_trans; - } out:btrfs_end_transaction (trans);btrfs_btree_balance_dirty (root->fs_info);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 118/208 btrfs: use btrfs_record_snapshot_destroy() during rmdir
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit 157501b0469969fc1ba53add5049575aadd79d80 ]
We are setting the parent directory's last_unlink_trans directly which may result in a concurrent task starting to log the directory not see the update and therefore can log the directory after we removed a child directory which had a snapshot within instead of falling back to a transaction commit. Replaying such a log tree would result in a mount failure since we can't currently delete snapshots (and subvolumes) during log replay. This is the type of failure described in commit 1ec9a1ae1e30 ("Btrfs: fix unreplayable log after snapshot delete + parent dir fsync").
Fix this by using btrfs_record_snapshot_destroy() which updates the last_unlink_trans field while holding the inode's log_mutex lock.
--- fs/btrfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/inode.c +1 -1
@@ -4175,7 +4175,7 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry)* deletes for directory foo. */ if (BTRFS_I (inode)->last_unlink_trans >= trans->transid) -BTRFS_I (dir)->last_unlink_trans =BTRFS_I (inode)->last_unlink_trans; +btrfs_record_snapshot_destroy (trans,BTRFS_I (dir));if (unlikely (btrfs_ino (BTRFS_I (inode)) ==BTRFS_EMPTY_SUBVOL_DIR_OBJECTID )) { err =btrfs_unlink_subvol (trans, dir, dentry);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 119/208 dpaa2-eth: rename dpaa2_eth_xdp_release_buf into dpaa2_eth_recycle_buf
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ioana Ciornei <[email protected]>
[ Upstream commit 28d137cc8c0bd2c9501b8eb0855b631289c7b4a3 ]
Rename the dpaa2_eth_xdp_release_buf function into dpaa2_eth_recycle_buf since in the next patches we'll be using the same recycle mechanism for the normal stack path beside for XDP_DROP.
Also, rename the array which holds the buffers to be recycled so that it does not have any reference to XDP.
Stable-dep-of: 2def09ead4ad ("dpaa2-eth: fix xdp_rxq_info leak")
--- .../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 26 +++++++++---------- .../net/ethernet/freescale/dpaa2/dpaa2-eth.h | 6 +++-- 2 files changed, 17 insertions(+), 15 deletions(-)
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +13 -13
@@ -223,31 +223,31 @@ static void dpaa2_eth_free_bufs(struct dpaa2_eth_priv *priv, u64 *buf_array, } } -static void dpaa2_eth_xdp_release_buf (struct dpaa2_eth_priv *priv, -struct dpaa2_eth_channel *ch, -dma_addr_t addr) +static void dpaa2_eth_recycle_buf (struct dpaa2_eth_priv *priv, +struct dpaa2_eth_channel *ch, +dma_addr_t addr) {int retries =0 ;int err; - ch->xdp.drop_bufs[ch->xdp.drop_cnt++] = addr; -if (ch->xdp.drop_cnt <DPAA2_ETH_BUFS_PER_CMD ) + ch->recycled_bufs[ch->recycled_bufs_cnt++] = addr; +if (ch->recycled_bufs_cnt <DPAA2_ETH_BUFS_PER_CMD )return ;while ((err =dpaa2_io_service_release (ch->dpio, priv->bpid, - ch->xdp.drop_bufs, - ch->xdp.drop_cnt)) == -EBUSY ) { + ch->recycled_bufs, + ch->recycled_bufs_cnt)) == -EBUSY ) {if (retries++ >=DPAA2_ETH_SWP_BUSY_RETRIES )break ;cpu_relax (); }if (err) { -dpaa2_eth_free_bufs (priv, ch->xdp.drop_bufs, ch->xdp.drop_cnt); - ch->buf_count -= ch->xdp.drop_cnt; +dpaa2_eth_free_bufs (priv, ch->recycled_bufs, ch->recycled_bufs_cnt); + ch->buf_count -= ch->recycled_bufs_cnt; } - ch->xdp.drop_cnt =0 ; + ch->recycled_bufs_cnt =0 ; } static int dpaa2_eth_xdp_flush(struct dpaa2_eth_priv *priv,
@@ -300,7 +300,7 @@ static void dpaa2_eth_xdp_tx_flush(struct dpaa2_eth_priv *priv, ch->stats.xdp_tx++; }for (i = enqueued; i < fq->xdp_tx_fds.num; i++) { -dpaa2_eth_xdp_release_buf (priv, ch,dpaa2_fd_get_addr (&fds[i])); +dpaa2_eth_recycle_buf (priv, ch,dpaa2_fd_get_addr (&fds[i])); percpu_stats->tx_errors++; ch->stats.xdp_tx_err++; }
@@ -386,7 +386,7 @@ static u32 dpaa2_eth_run_xdp(struct dpaa2_eth_priv *priv,trace_xdp_exception (priv->net_dev, xdp_prog, xdp_act); fallthrough;case XDP_DROP : -dpaa2_eth_xdp_release_buf (priv, ch, addr); +dpaa2_eth_recycle_buf (priv, ch, addr); ch->stats.xdp_drop++;break ;case XDP_REDIRECT :
@@ -407,7 +407,7 @@ static u32 dpaa2_eth_run_xdp(struct dpaa2_eth_priv *priv,free_pages ((unsigned long )vaddr,0 ); }else { ch->buf_count++; -dpaa2_eth_xdp_release_buf (priv, ch, addr); +dpaa2_eth_recycle_buf (priv, ch, addr); } ch->stats.xdp_drop++; }else {
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h +4 -2
@@ -438,8 +438,6 @@ struct dpaa2_eth_fq {struct dpaa2_eth_ch_xdp {struct bpf_prog *prog; -u64 drop_bufs[DPAA2_ETH_BUFS_PER_CMD ]; -int drop_cnt;unsigned int res; };
@@ -457,6 +455,10 @@ struct dpaa2_eth_channel {struct dpaa2_eth_ch_xdp xdp;struct xdp_rxq_info xdp_rxq;struct list_head *rx_list; + +/* Buffers to be recycled back in the buffer pool */ +u64 recycled_bufs[DPAA2_ETH_BUFS_PER_CMD ]; +int recycled_bufs_cnt; };struct dpaa2_eth_dist_fields {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 120/208 dpaa2-eth: Update dpni_get_single_step_cfg command
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Radu Bulie <[email protected]>
[ Upstream commit 9572594ecf027a2b1828e42c26fb55cbd3219708 ]
dpni_get_single_step_cfg is an MC firmware command used for retrieving the contents of SINGLE_STEP 1588 register available in a DPMAC.
This patch adds a new version of this command that returns as an extra argument the physical base address of the aforementioned register. The address will be used to directly modify the contents of the SINGLE_STEP register instead of invoking the MC command dpni_set_single_step_cgf. The former approach introduced huge delays on the TX datapath when one step PTP events were transmitted. This led to low throughput and high latencies observed in the PTP correction field.
Stable-dep-of: 2def09ead4ad ("dpaa2-eth: fix xdp_rxq_info leak")
--- drivers/net/ethernet/freescale/dpaa2/dpni-cmd.h | 6 +++++- drivers/net/ethernet/freescale/dpaa2/dpni.c | 2 ++ drivers/net/ethernet/freescale/dpaa2/dpni.h | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-)
drivers/net/ethernet/freescale/dpaa2/dpni-cmd.h +5 -1
@@ -94,7 +94,7 @@#define DPNI_CMDID_GET_LINK_CFG DPNI_CMD(0x278)#define DPNI_CMDID_SET_SINGLE_STEP_CFG DPNI_CMD(0x279) -#define DPNI_CMDID_GET_SINGLE_STEP_CFG DPNI_CMD(0x27a) +#define DPNI_CMDID_GET_SINGLE_STEP_CFG DPNI_CMD_V2(0x27a)/* Macros for accessing command fields smaller than 1byte */ #define DPNI_MASK (field) \
@@ -654,12 +654,16 @@ struct dpni_cmd_single_step_cfg {__le16 flags;__le16 offset;__le32 peer_delay; +__le32 ptp_onestep_reg_base; + __le32 pad0; };struct dpni_rsp_single_step_cfg {__le16 flags;__le16 offset;__le32 peer_delay; +__le32 ptp_onestep_reg_base; +__le32 pad0; };#endif /* _FSL_DPNI_CMD_H */
drivers/net/ethernet/freescale/dpaa2/dpni.c +2 -0
@@ -2037,6 +2037,8 @@ int dpni_get_single_step_cfg(struct fsl_mc_io *mc_io, ptp_cfg->ch_update =dpni_get_field (le16_to_cpu (rsp_params->flags),PTP_CH_UPDATE ) ?1 :0 ; ptp_cfg->peer_delay =le32_to_cpu (rsp_params->peer_delay); + ptp_cfg->ptp_onestep_reg_base = +le32_to_cpu (rsp_params->ptp_onestep_reg_base);return err; }
drivers/net/ethernet/freescale/dpaa2/dpni.h +6 -0
@@ -1096,12 +1096,18 @@ int dpni_set_tx_shaping(struct fsl_mc_io *mc_io,* @peer_delay: For peer-to-peer transparent clocks add this value to the * correction field in addition to the transient time update. * The value expresses nanoseconds. +* @ptp_onestep_reg_base: 1588 SINGLE_STEP register base address. This address +* is used to update directly the register contents. +* User has to create an address mapping for it. +* +* */ struct dpni_single_step_cfg {u8 en;u8 ch_update;u16 offset;u32 peer_delay; +u32 ptp_onestep_reg_base; }; int dpni_set_single_step_cfg(struct fsl_mc_io *mc_io,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 121/208 dpaa2-eth: Update SINGLE_STEP register access
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Radu Bulie <[email protected]>
[ Upstream commit c4680c978567328a696fd2400bbf58a36cff95d1 ]
DPAA2 MAC supports 1588 one step timestamping.
If this option is enabled then for each transmitted PTP event packet, the 1588 SINGLE_STEP register is accessed to modify the following fields:
-offset of the correction field inside the PTP packet -UDP checksum update bit, in case the PTP event packet has
UDP encapsulation
These values can change any time, because there may be multiple PTP clients connected, that receive various 1588 frame types:
- L2 only frame
- UDP / Ipv4
- UDP / Ipv6
- other
The current implementation uses dpni_set_single_step_cfg to update the SINLGE_STEP register.
Using an MC command on the Tx datapath for each transmitted 1588 message introduces high delays, leading to low throughput and consequently to a small number of supported PTP clients. Besides these, the nanosecond correction field from the PTP packet will contain the high delay from the driver which together with the originTimestamp will render timestamp values that are unacceptable in a GM clock implementation.
This patch updates the Tx datapath for 1588 messages when single step timestamp is enabled and provides direct access to SINGLE_STEP register, eliminating the overhead caused by the dpni_set_single_step_cfg MC command. MC version >= 10.32 implements this functionality. If the MC version does not have support for returning the single step register base address, the driver will use dpni_set_single_step_cfg command for updates operations.
All the delay introduced by dpni_set_single_step_cfg function will be eliminated (if MC version has support for returning the base address of the single step register), improving the egress driver performance for PTP packets when single step timestamping is enabled.
Before these changes the maximum throughput for 1588 messages with single step hardware timestamp enabled was around 2000pps. After the updates the throughput increased up to 32.82 Mbps / 46631.02 pps.
Stable-dep-of: 2def09ead4ad ("dpaa2-eth: fix xdp_rxq_info leak")
--- .../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 89 +++++++++++++++++-- .../net/ethernet/freescale/dpaa2/dpaa2-eth.h | 14 ++- 2 files changed, 93 insertions(+), 10 deletions(-)
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +81 -8
@@ -34,6 +34,75 @@ MODULE_DESCRIPTION("Freescale DPAA2 Ethernet Driver");struct ptp_qoriq *dpaa2_ptp;EXPORT_SYMBOL (dpaa2_ptp); +static void dpaa2_eth_detect_features (struct dpaa2_eth_priv *priv) +{ + priv->features =0 ; + +if (dpaa2_eth_cmp_dpni_ver (priv,DPNI_PTP_ONESTEP_VER_MAJOR , +DPNI_PTP_ONESTEP_VER_MINOR ) >=0 ) + priv->features |=DPAA2_ETH_FEATURE_ONESTEP_CFG_DIRECT ; +} + +static void dpaa2_update_ptp_onestep_indirect (struct dpaa2_eth_priv *priv, +u32 offset,u8 udp) +{ +struct dpni_single_step_cfg cfg; + + cfg.en =1 ; + cfg.ch_update = udp; + cfg.offset = offset; + cfg.peer_delay =0 ; + +if (dpni_set_single_step_cfg (priv->mc_io,0 , priv->mc_token, &cfg)) +WARN_ONCE (1 ,"Failed to set single step register" ); +} + +static void dpaa2_update_ptp_onestep_direct (struct dpaa2_eth_priv *priv, +u32 offset,u8 udp) +{ +u32 val =0 ; + + val =DPAA2_PTP_SINGLE_STEP_ENABLE | +DPAA2_PTP_SINGLE_CORRECTION_OFF (offset); + +if (udp) + val |=DPAA2_PTP_SINGLE_STEP_CH ; + +if (priv->onestep_reg_base) +writel (val, priv->onestep_reg_base); +} + +static void dpaa2_ptp_onestep_reg_update_method (struct dpaa2_eth_priv *priv) +{ +struct device *dev = priv->net_dev->dev.parent; +struct dpni_single_step_cfg ptp_cfg; + + priv->dpaa2_set_onestep_params_cb = dpaa2_update_ptp_onestep_indirect; + +if (!(priv->features &DPAA2_ETH_FEATURE_ONESTEP_CFG_DIRECT )) +return ; + +if (dpni_get_single_step_cfg (priv->mc_io,0 , + priv->mc_token, &ptp_cfg)) { +dev_err (dev,"dpni_get_single_step_cfg cannot retrieve onestep reg, falling back to indirect update\n" ); +return ; + } + +if (!ptp_cfg.ptp_onestep_reg_base) { +dev_err (dev,"1588 onestep reg not available, falling back to indirect update\n" ); +return ; + } + + priv->onestep_reg_base =ioremap (ptp_cfg.ptp_onestep_reg_base, +sizeof (u32)); +if (!priv->onestep_reg_base) { +dev_err (dev,"1588 onestep reg cannot be mapped, falling back to indirect update\n" ); +return ; + } + + priv->dpaa2_set_onestep_params_cb = dpaa2_update_ptp_onestep_direct; +} +static void *dpaa2_iova_to_virt (struct iommu_domain *domain,dma_addr_t iova_addr) {
@@ -668,7 +737,6 @@ static void dpaa2_eth_enable_tx_tstamp(struct dpaa2_eth_priv *priv, struct sk_buff *skb) {struct ptp_tstamp origin_timestamp; -struct dpni_single_step_cfg cfg;u8 msgtype, twostep, udp;struct dpaa2_faead *faead;struct dpaa2_fas *fas;
@@ -722,14 +790,12 @@ static void dpaa2_eth_enable_tx_tstamp(struct dpaa2_eth_priv *priv,htonl (origin_timestamp.sec_lsb); *(__be32 *)(data + offset2 +6 ) =htonl (origin_timestamp.nsec); - cfg.en =1 ; - cfg.ch_update = udp; - cfg.offset = offset1; - cfg.peer_delay =0 ; +if (priv->ptp_correction_off == offset1) +return ; + + priv->dpaa2_set_onestep_params_cb (priv, offset1, udp); + priv->ptp_correction_off = offset1; -if (dpni_set_single_step_cfg (priv->mc_io,0 , priv->mc_token, - &cfg)) -WARN_ONCE (1 ,"Failed to set single step register" ); } }
@@ -2112,6 +2178,9 @@ static int dpaa2_eth_ts_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) config.rx_filter =HWTSTAMP_FILTER_ALL ; } +if (priv->tx_tstamp_type ==HWTSTAMP_TX_ONESTEP_SYNC ) +dpaa2_ptp_onestep_reg_update_method (priv); +return copy_to_user (rq->ifr_data, &config,sizeof (config)) ? -EFAULT :0 ; }
@@ -4009,6 +4078,8 @@ static int dpaa2_eth_netdev_init(struct net_device *net_dev)return err; } +dpaa2_eth_detect_features (priv); +/* Capabilities listing */ supported |=IFF_LIVE_ADDR_CHANGE ;
@@ -4433,6 +4504,8 @@ static int dpaa2_eth_remove(struct fsl_mc_device *ls_dev)dpaa2_eth_free_dpbp (priv);dpaa2_eth_free_dpio (priv);dpaa2_eth_free_dpni (priv); +if (priv->onestep_reg_base) +iounmap (priv->onestep_reg_base);fsl_mc_portal_free (priv->mc_io);
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h +12 -2
@@ -504,12 +504,15 @@ struct dpaa2_eth_priv {u8 num_channels;struct dpaa2_eth_channel *channel[DPAA2_ETH_MAX_DPCONS ];struct dpaa2_eth_sgt_cache __percpu *sgt_cache; - +unsigned long features;struct dpni_attr dpni_attrs;u16 dpni_ver_major;u16 dpni_ver_minor;u16 tx_data_offset; - +void __iomem *onestep_reg_base; +u8 ptp_correction_off; +void (*dpaa2_set_onestep_params_cb)(struct dpaa2_eth_priv *priv, +u32 offset,u8 udp);struct fsl_mc_device *dpbp_dev;u16 rx_buf_size;u16 bpid;
@@ -647,6 +650,13 @@ enum dpaa2_eth_rx_dist {#define DPAA2_ETH_DIST_L4DST BIT(8)#define DPAA2_ETH_DIST_ALL (~0ULL) +#define DPNI_PTP_ONESTEP_VER_MAJOR 8 +#define DPNI_PTP_ONESTEP_VER_MINOR 2 +#define DPAA2_ETH_FEATURE_ONESTEP_CFG_DIRECT BIT(0) +#define DPAA2_PTP_SINGLE_STEP_ENABLE BIT(31) +#define DPAA2_PTP_SINGLE_STEP_CH BIT(7) +#define DPAA2_PTP_SINGLE_CORRECTION_OFF (v) ((v) << 8) +#define DPNI_PAUSE_VER_MAJOR 7#define DPNI_PAUSE_VER_MINOR 13#define dpaa2_eth_has_pause_support (priv) \
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 122/208 net: dpaa2-eth: rearrange variable in dpaa2_eth_get_ethtool_stats
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ioana Ciornei <[email protected]>
[ Upstream commit 3313206827678f6f036eca601a51f6c4524b559a ]
Rearrange the variables in the dpaa2_eth_get_ethtool_stats() function so that we adhere to the reverse Christmas tree rule.
Also, in the next patch we are adding more variables and I didn't know where to place them with the current ordering.
Stable-dep-of: 2def09ead4ad ("dpaa2-eth: fix xdp_rxq_info leak")
--- .../ethernet/freescale/dpaa2/dpaa2-ethtool.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c +8 -10
@@ -225,17 +225,8 @@ static void dpaa2_eth_get_ethtool_stats(struct net_device *net_dev,struct ethtool_stats *stats, u64 *data) { - int i = 0; -int j, k, err; -int num_cnt; -union dpni_statistics dpni_stats; -u32 fcnt, bcnt; -u32 fcnt_rx_total =0 , fcnt_tx_total =0 ; -u32 bcnt_rx_total =0 , bcnt_tx_total =0 ; -u32 buf_cnt; struct dpaa2_eth_priv *priv = netdev_priv(net_dev); -struct dpaa2_eth_drv_stats *extras; -struct dpaa2_eth_ch_stats *ch_stats; +union dpni_statistics dpni_stats; int dpni_stats_page_size[DPNI_STATISTICS_CNT] = { sizeof(dpni_stats.page_0), sizeof(dpni_stats.page_1),
@@ -245,6 +236,13 @@ static void dpaa2_eth_get_ethtool_stats(struct net_device *net_dev,sizeof (dpni_stats.page_5), sizeof(dpni_stats.page_6), }; +u32 fcnt_rx_total =0 , fcnt_tx_total =0 ; +u32 bcnt_rx_total =0 , bcnt_tx_total =0 ; +struct dpaa2_eth_ch_stats *ch_stats; +struct dpaa2_eth_drv_stats *extras; +int j, k, err, num_cnt, i =0 ; +u32 fcnt, bcnt; +u32 buf_cnt;memset (data,0 ,sizeof (u64) * (DPAA2_ETH_NUM_STATS +DPAA2_ETH_NUM_EXTRA_STATS ));
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 123/208 dpaa2-eth: fix xdp_rxq_info leak
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fushuai Wang <[email protected]>
[ Upstream commit 2def09ead4ad5907988b655d1e1454003aaf8297 ]
The driver registered xdp_rxq_info structures via xdp_rxq_info_reg() but failed to properly unregister them in error paths and during removal.
--- .../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +24 -2
@@ -3425,6 +3425,7 @@ static int dpaa2_eth_setup_rx_flow(struct dpaa2_eth_priv *priv, MEM_TYPE_PAGE_ORDER0, NULL);if (err) {dev_err (dev,"xdp_rxq_info_reg_mem_model failed\n" ); +xdp_rxq_info_unreg (&fq->channel->xdp_rxq);return err; }
@@ -3917,17 +3918,25 @@ static int dpaa2_eth_bind_dpni(struct dpaa2_eth_priv *priv)return -EINVAL ; }if (err) -return err; + goto out; } err =dpni_get_qdid (priv->mc_io,0 , priv->mc_token,DPNI_QUEUE_TX , &priv->tx_qdid);if (err) {dev_err (dev,"dpni_get_qdid() failed\n" ); -return err; + goto out; }return 0 ; + +out: +while (i--) { +if (priv->fq[i].type ==DPAA2_RX_FQ && +xdp_rxq_info_is_reg (&priv->fq[i].channel->xdp_rxq)) +xdp_rxq_info_unreg (&priv->fq[i].channel->xdp_rxq); + } +return err; }/* Allocate rings for storing incoming frame descriptors */
@@ -4264,6 +4273,17 @@ static void dpaa2_eth_del_ch_napi(struct dpaa2_eth_priv *priv) } } +static void dpaa2_eth_free_rx_xdp_rxq (struct dpaa2_eth_priv *priv) +{ +int i; + +for (i =0 ; i < priv->num_fqs; i++) { +if (priv->fq[i].type ==DPAA2_RX_FQ && +xdp_rxq_info_is_reg (&priv->fq[i].channel->xdp_rxq)) +xdp_rxq_info_unreg (&priv->fq[i].channel->xdp_rxq); + } +} +static int dpaa2_eth_probe (struct fsl_mc_device *dpni_dev) {struct device *dev;
@@ -4450,6 +4470,7 @@ static int dpaa2_eth_probe(struct fsl_mc_device *dpni_dev)free_percpu (priv->percpu_stats); err_alloc_percpu_stats:dpaa2_eth_del_ch_napi (priv); +dpaa2_eth_free_rx_xdp_rxq (priv); err_bind:dpaa2_eth_free_dpbp (priv); err_dpbp_setup:
@@ -4501,6 +4522,7 @@ static int dpaa2_eth_remove(struct fsl_mc_device *ls_dev)free_percpu (priv->percpu_extras);dpaa2_eth_del_ch_napi (priv); +dpaa2_eth_free_rx_xdp_rxq (priv);dpaa2_eth_free_dpbp (priv);dpaa2_eth_free_dpio (priv);dpaa2_eth_free_dpni (priv);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 124/208 xhci: dbctty: disable ECHO flag by default
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Łukasz Bartosik <[email protected]>
commit 2b857d69a5e116150639a0c6c39c86cc329939ee upstream.
When /dev/ttyDBC0 device is created then by default ECHO flag is set for the terminal device. However if data arrives from a peer before application using /dev/ttyDBC0 applies its set of terminal flags then the arriving data will be echoed which might not be desired behavior.
--- drivers/usb/host/xhci-dbgtty.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/host/xhci-dbgtty.c +1 -0
@@ -529,6 +529,7 @@ static int dbc_tty_init(void) dbc_tty_driver->type =TTY_DRIVER_TYPE_SERIAL ; dbc_tty_driver->subtype =SERIAL_TYPE_NORMAL ; dbc_tty_driver->init_termios = tty_std_termios; + dbc_tty_driver->init_termios.c_lflag &= ~ECHO ; dbc_tty_driver->init_termios.c_cflag =B9600 |CS8 |CREAD |HUPCL |CLOCAL ; dbc_tty_driver->init_termios.c_ispeed =9600 ;
Greg Kroah-Hartman
maintainerPATCH 125/208 xhci: dbc: Flush queued requests before stopping dbc
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
commit efe3e3ae5a66cb38ef29c909e951b4039044bae9 upstream.
Flush dbc requests when dbc is stopped and transfer rings are freed. Failure to flush them lead to leaking memory and dbc completing odd requests after resuming from suspend, leading to error messages such as:
[ 95.344392] xhci_hcd 0000:00:0d.0: no matched request
--- drivers/usb/host/xhci-dbgcap.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/host/xhci-dbgcap.c +4 -0
@@ -639,6 +639,10 @@ static void xhci_dbc_stop(struct xhci_dbcase DS_DISABLED :return ;case DS_CONFIGURED : +spin_lock (&dbc->lock); +xhci_dbc_flush_requests (dbc); +spin_unlock (&dbc->lock); +if (dbc->driver->disconnect) dbc->driver->disconnect (dbc);break ;
Greg Kroah-Hartman
maintainerPATCH 126/208 Logitech C-270 even more broken
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit cee4392a57e14a799fbdee193bc4c0de65b29521 upstream.
Some varieties of this device don't work withRESET_RESUME alone.
--- drivers/usb/core/quirks.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/core/quirks.c +2 -1
@@ -224,7 +224,8 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x046a, 0x0023), .driver_info = USB_QUIRK_RESET_RESUME }, /* Logitech HD Webcam C270 */ - { USB_DEVICE(0x046d, 0x0825), .driver_info = USB_QUIRK_RESET_RESUME }, + { USB_DEVICE(0x046d, 0x0825), .driver_info = USB_QUIRK_RESET_RESUME | + USB_QUIRK_NO_LPM}, /* Logitech HD Pro Webcams C920, C920-C, C922, C925e and C930e */ { USB_DEVICE(0x046d, 0x082d), .driver_info = USB_QUIRK_DELAY_INIT },
Greg Kroah-Hartman
maintainerPATCH 127/208 usb: typec: displayport: Fix potential deadlock
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrei Kuchynski <[email protected]>
commit 099cf1fbb8afc3771f408109f62bdec66f85160e upstream.
The deadlock can occur due to a recursive lock acquisition of cros_typec_altmode_data::mutex.
The call chain is as follows:
1. cros_typec_altmode_work() acquires the mutex
2. typec_altmode_vdm() -> dp_altmode_vdm() ->
3. typec_altmode_exit() -> cros_typec_altmode_exit()
4. cros_typec_altmode_exit() attempts to acquire the mutex again
To prevent this, defer the typec_altmode_exit() call by scheduling it rather than calling it directly from within the mutex-protected context.
--- drivers/usb/typec/altmodes/displayport.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/typec/altmodes/displayport.c +1 -2
@@ -305,8 +305,7 @@ static int dp_altmode_vdm(struct typec_acase CMDT_RSP_NAK :switch (cmd) {case DP_CMD_STATUS_UPDATE : -if (typec_altmode_exit (alt)) -dev_err (&dp->alt->dev,"Exit Mode Failed!\n" ); + dp->state =DP_STATE_EXIT ;break ;case DP_CMD_CONFIGURE : dp->data.conf =0 ;
Greg Kroah-Hartman
maintainerPATCH 128/208 ACPI: PAD: fix crash in exit_round_robin()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seiji Nishikawa <[email protected]>
commit 0a2ed70a549e61c5181bad5db418d223b68ae932 upstream.
The kernel occasionally crashes in cpumask_clear_cpu(), which is called within exit_round_robin(), because when executing clear_bit(nr, addr) with nr set to 0xffffffff, the address calculation may cause misalignment within the memory, leading to access to an invalid memory address.
----------
BUG: unable to handle kernel paging request at ffffffffe0740618
...
CPU: 3 PID: 2919323 Comm: acpi_pad/14 Kdump: loaded Tainted: G OE X --------- - - 4.18.0-425.19.2.el8_7.x86_64 #1
...
RIP: 0010:power_saving_thread+0x313/0x411 [acpi_pad]
Code: 89 cd 48 89 d3 eb d1 48 c7 c7 55 70 72 c0 e8 64 86 b0 e4 c6 05 0d a1 02 00 01 e9 bc fd ff ff 45 89 e4 42 8b 04 a5 20 82 72 c0 <f0> 48 0f b3 05 f4 9c 01 00 42 c7 04 a5 20 82 72 c0 ff ff ff ff 31
RSP: 0018:ff72a5d51fa77ec8 EFLAGS: 00010202
RAX: 00000000ffffffff RBX: ff462981e5d8cb80 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000246 RDI: 0000000000000246
RBP: ff46297556959d80 R08: 0000000000000382 R09: ff46297c8d0f38d8
R10: 0000000000000000 R11: 0000000000000001 R12: 000000000000000e
R13: 0000000000000000 R14: ffffffffffffffff R15: 000000000000000e
FS: 0000000000000000(0000) GS:ff46297a800c0000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffe0740618 CR3: 0000007e20410004 CR4: 0000000000771ee0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
Call Trace:
? acpi_pad_add+0x120/0x120 [acpi_pad]
kthread+0x10b/0x130
? set_kthread_struct+0x50/0x50
ret_from_fork+0x1f/0x40
...CR2: ffffffffe0740618
crash> dis -lr ffffffffc0726923
...
/usr/src/debug/kernel-4.18.0-425.19.2.el8_7/linux-4.18.0-425.19.2.el8_7.x86_64/./include/linux/cpumask.h: 1140xffffffffc0726918 <power_saving_thread+776>: mov %r12d,%r12d/usr/src/debug/kernel-4.18.0-425.19.2.el8_7/linux-4.18.0-425.19.2.el8_7.x86_64/./include/linux/cpumask.h: 3250xffffffffc072691b <power_saving_thread+779>: mov -0x3f8d7de0(,%r12,4),%eax/usr/src/debug/kernel-4.18.0-425.19.2.el8_7/linux-4.18.0-425.19.2.el8_7.x86_64/./arch/x86/include/asm/bitops.h: 800xffffffffc0726923 <power_saving_thread+787>: lock btr %rax,0x19cf4(%rip) # 0xffffffffc0740620 <pad_busy_cpus_bits>
crash> px tsk_in_cpu[14]
$66 = 0xffffffff
crash> px 0xffffffffc072692c+0x19cf4
$99 = 0xffffffffc0740620
crash> sym 0xffffffffc0740620 ffffffffc0740620 (b) pad_busy_cpus_bits [acpi_pad]
crash> px pad_busy_cpus_bits[0]
$42 = 0xfffc0
----------
To fix this, ensure that tsk_in_cpu[tsk_index] != -1 before calling cpumask_clear_cpu() in exit_round_robin(), just as it is done in round_robin_cpu().
--- drivers/acpi/acpi_pad.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/acpi/acpi_pad.c +5 -2
@@ -128,8 +128,11 @@ static void round_robin_cpu(unsigned intstatic void exit_round_robin (unsigned int tsk_index) {struct cpumask *pad_busy_cpus =to_cpumask (pad_busy_cpus_bits); -cpumask_clear_cpu (tsk_in_cpu[tsk_index], pad_busy_cpus); - tsk_in_cpu[tsk_index] =-1 ; + +if (tsk_in_cpu[tsk_index] !=-1 ) { +cpumask_clear_cpu (tsk_in_cpu[tsk_index], pad_busy_cpus); + tsk_in_cpu[tsk_index] =-1 ; + } }static unsigned int idle_pct =5 ;/* percentage */
Greg Kroah-Hartman
maintainerPATCH 129/208 media: uvcvideo: Return the number of processed controls
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
commit ba4fafb02ad6a4eb2e00f861893b5db42ba54369 upstream.
If we let know our callers that we have not done anything, they will be able to optimize their decisions.
Message-ID: <[email protected]>
--- drivers/media/usb/uvc/uvc_ctrl.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_ctrl.c +10 -1
@@ -1560,11 +1560,16 @@ int uvc_ctrl_begin(struct uvc_video_chaireturn mutex_lock_interruptible (&chain->ctrl_mutex) ? -ERESTARTSYS :0 ; } +/* +* Returns the number of uvc controls that have been correctly set, or a +* negative number if there has been an error. +*/ static int uvc_ctrl_commit_entity (struct uvc_device *dev,struct uvc_fh *handle,struct uvc_entity *entity,int rollback) { +unsigned int processed_ctrls =0 ;struct uvc_control *ctrl;unsigned int i;int ret;
@@ -1598,6 +1603,9 @@ static int uvc_ctrl_commit_entity(structelse ret =0 ; +if (!ret) + processed_ctrls++; +if (rollback || ret <0 ) memcpy(uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT), uvc_ctrl_data(ctrl, UVC_CTRL_DATA_BACKUP),
@@ -1613,7 +1621,7 @@ static int uvc_ctrl_commit_entity(structuvc_ctrl_set_handle (handle, ctrl, handle); } -return 0 ; +return processed_ctrls; } int __uvc_ctrl_commit(struct uvc_fh *handle, int rollback,
@@ -1634,6 +1642,7 @@ int __uvc_ctrl_commit(struct uvc_fh *hanif (!rollback)uvc_ctrl_send_events (handle, xctrls, xctrls_count); + ret =0 ; done:mutex_unlock (&chain->ctrl_mutex);return ret;
Greg Kroah-Hartman
maintainerPATCH 130/208 media: uvcvideo: Send control events for partial succeeds
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
commit 5c791467aea6277430da5f089b9b6c2a9d8a4af7 upstream.
Today, when we are applying a change to entities A, B. If A succeeds and B fails the events for A are not sent.
This change changes the code so the events for A are send right after they happen.
Message-ID: <[email protected]>
--- drivers/media/usb/uvc/uvc_ctrl.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/media/usb/uvc/uvc_ctrl.c +9 -3
@@ -1429,7 +1429,9 @@ static bool uvc_ctrl_xctrls_has_control( }static void uvc_ctrl_send_events (struct uvc_fh *handle, -const struct v4l2_ext_control *xctrls,unsigned int xctrls_count) +struct uvc_entity *entity, +const struct v4l2_ext_control *xctrls, +unsigned int xctrls_count) {struct uvc_control_mapping *mapping;struct uvc_control *ctrl;
@@ -1440,6 +1442,9 @@ static void uvc_ctrl_send_events(structu32 changes =V4L2_EVENT_CTRL_CH_VALUE ; ctrl =uvc_find_control (handle->chain, xctrls[i].id, &mapping); +if (ctrl->entity != entity) +continue ; +if (ctrl->info.flags &UVC_CTRL_FLAG_ASYNCHRONOUS )/* Notification will be sent from an Interrupt event. */ continue ;
@@ -1638,10 +1643,11 @@ int __uvc_ctrl_commit(struct uvc_fh *han rollback);if (ret <0 ) goto done; +else if (ret >0 && !rollback) +uvc_ctrl_send_events (handle, entity, xctrls, + xctrls_count); } -if (!rollback) -uvc_ctrl_send_events (handle, xctrls, xctrls_count); ret =0 ; done:mutex_unlock (&chain->ctrl_mutex);
Greg Kroah-Hartman
maintainerPATCH 131/208 media: uvcvideo: Rollback non processed entities on error
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
commit a70705d3c020d0d5c3ab6a5cc93e011ac35e7d48 upstream.
If we fail to commit an entity, we need to restore the UVC_CTRL_DATA_BACKUP for the other uncommitted entities. Otherwise the control cache and the device would be out of sync.
Message-ID: <[email protected]>
--- drivers/media/usb/uvc/uvc_ctrl.c | 42 ++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 14 deletions(-)
drivers/media/usb/uvc/uvc_ctrl.c +28 -14
@@ -1577,7 +1577,7 @@ static int uvc_ctrl_commit_entity(structunsigned int processed_ctrls =0 ;struct uvc_control *ctrl;unsigned int i; -int ret; +int ret =0 ;if (entity ==NULL )return 0 ;
@@ -1605,8 +1605,6 @@ static int uvc_ctrl_commit_entity(struct dev->intfnum, ctrl->info.selector,uvc_ctrl_data (ctrl,UVC_CTRL_DATA_CURRENT ), ctrl->info.size); - else - ret =0 ;if (!ret) processed_ctrls++;
@@ -1618,14 +1616,22 @@ static int uvc_ctrl_commit_entity(struct ctrl->dirty =0 ; -if (ret <0 ) -return ret; - -if (!rollback && handle && +if (!rollback && handle && !ret && ctrl->info.flags &UVC_CTRL_FLAG_ASYNCHRONOUS )uvc_ctrl_set_handle (handle, ctrl, handle); + +if (ret <0 && !rollback) { +/* +* If we fail to set a control, we need to rollback +* the next ones. +*/ + rollback =1 ; + } } +if (ret) +return ret; +return processed_ctrls; }
@@ -1635,23 +1641,31 @@ int __uvc_ctrl_commit(struct uvc_fh *han {struct uvc_video_chain *chain = handle->chain;struct uvc_entity *entity; -int ret =0 ; +int ret_out =0 ; +int ret;/* Find the control. */ list_for_each_entry (entity, &chain->entities, chain) { ret =uvc_ctrl_commit_entity (chain->dev, handle, entity, rollback); -if (ret <0 ) - goto done; -else if (ret >0 && !rollback) +if (ret <0 ) { +/* +* When we fail to commit an entity, we need to +* restore the UVC_CTRL_DATA_BACKUP for all the +* controls in the other entities, otherwise our cache +* and the hardware will be out of sync. +*/ + rollback =1 ; + + ret_out = ret; + }else if (ret >0 && !rollback) {uvc_ctrl_send_events (handle, entity, xctrls, xctrls_count); + } } - ret =0 ; -done:mutex_unlock (&chain->ctrl_mutex); -return ret; +return ret_out; } int uvc_ctrl_get(struct uvc_video_chain *chain,
Greg Kroah-Hartman
maintainerPATCH 132/208 staging: rtl8723bs: Avoid memset() in aes_cipher() and aes_decipher()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit a55bc4ffc06d8c965a7d6f0a01ed0ed41380df28 upstream.
After commit 6f110a5e4f99 ("Disable SLUB_TINY for build testing"), which causes CONFIG_KASAN to be enabled in allmodconfig again, arm64 allmodconfig builds with older versions of clang (15 through 17) show an instance of -Wframe-larger-than (which breaks the build with CONFIG_WERROR=y):
drivers/staging/rtl8723bs/core/rtw_security.c:1287:5: error: stack frame size (2208) exceeds limit (2048) in 'rtw_aes_decrypt' [-Werror,-Wframe-larger-than]
1287 | u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
| ^
This comes from aes_decipher() being inlined in rtw_aes_decrypt(). Running the same build with CONFIG_FRAME_WARN=128 shows aes_cipher() also uses a decent amount of stack, just under the limit of 2048:
drivers/staging/rtl8723bs/core/rtw_security.c:864:19: warning: stack frame size (1952) exceeds limit (128) in 'aes_cipher' [-Wframe-larger-than]
864 | static signed int aes_cipher(u8 *key, uint hdrlen,
| ^
-Rpass-analysis=stack-frame-layout only shows one large structure on the stack, which is the ctx variable inlined from aes128k128d(). A good number of the other variables come from the additional checks of fortified string routines, which are present in memset(), which both aes_cipher() and aes_decipher() use to initialize some temporary buffers. In this case, since the size is known at compile time, these additional checks should not result in any code generation changes but allmodconfig has several sanitizers enabled, which may make it harder for the compiler to eliminate the compile time checks and the variables that come about from them.
The memset() calls are just initializing these buffers to zero, so use '= {}' instead, which is used all over the kernel and does the exact same thing as memset() without the fortify checks, which drops the stack usage of these functions by a few hundred kilobytes.
drivers/staging/rtl8723bs/core/rtw_security.c:864:19: warning: stack frame size (1584) exceeds limit (128) in 'aes_cipher' [-Wframe-larger-than]
864 | static signed int aes_cipher(u8 *key, uint hdrlen,
| ^
drivers/staging/rtl8723bs/core/rtw_security.c:1271:5: warning: stack frame size (1456) exceeds limit (128) in 'rtw_aes_decrypt' [-Wframe-larger-than]
1271 | u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
| ^
--- drivers/staging/rtl8723bs/core/rtw_security.c | 46 +++++++------------------- 1 file changed, 14 insertions(+), 32 deletions(-)
drivers/staging/rtl8723bs/core/rtw_security.c +14 -32
@@ -1299,30 +1299,21 @@ static sint aes_cipher(u8 *key, uint hdr num_blocks, payload_index;u8 pn_vector[6 ]; -u8 mic_iv[16 ]; -u8 mic_header1[16 ]; -u8 mic_header2[16 ]; -u8 ctr_preload[16 ]; +u8 mic_iv[16 ] = {}; +u8 mic_header1[16 ] = {}; +u8 mic_header2[16 ] = {}; +u8 ctr_preload[16 ] = {};/* Intermediate Buffers */ -u8 chain_buffer[16 ]; -u8 aes_out[16 ]; -u8 padded_buffer[16 ]; +u8 chain_buffer[16 ] = {}; +u8 aes_out[16 ] = {}; +u8 padded_buffer[16 ] = {};u8 mic[8 ];uint frtype =GetFrameType (pframe);uint frsubtype =GetFrameSubType (pframe); frsubtype = frsubtype>>4 ; - -memset ((void *)mic_iv,0 ,16 ); -memset ((void *)mic_header1,0 ,16 ); -memset ((void *)mic_header2,0 ,16 ); -memset ((void *)ctr_preload,0 ,16 ); -memset ((void *)chain_buffer,0 ,16 ); -memset ((void *)aes_out,0 ,16 ); -memset ((void *)padded_buffer,0 ,16 ); -if ((hdrlen ==WLAN_HDR_A3_LEN ) || (hdrlen ==WLAN_HDR_A3_QOS_LEN )) a4_exists =0 ;else
@@ -1540,15 +1531,15 @@ static sint aes_decipher(u8 *key, uint h num_blocks, payload_index;sint res = _SUCCESS;u8 pn_vector[6 ]; -u8 mic_iv[16 ]; -u8 mic_header1[16 ]; -u8 mic_header2[16 ]; -u8 ctr_preload[16 ]; +u8 mic_iv[16 ] = {}; +u8 mic_header1[16 ] = {}; +u8 mic_header2[16 ] = {}; +u8 ctr_preload[16 ] = {};/* Intermediate Buffers */ -u8 chain_buffer[16 ]; -u8 aes_out[16 ]; -u8 padded_buffer[16 ]; +u8 chain_buffer[16 ] = {}; +u8 aes_out[16 ] = {}; +u8 padded_buffer[16 ] = {};u8 mic[8 ];
@@ -1557,15 +1548,6 @@ static sint aes_decipher(u8 *key, uint h frsubtype = frsubtype>>4 ; - -memset ((void *)mic_iv,0 ,16 ); -memset ((void *)mic_header1,0 ,16 ); -memset ((void *)mic_header2,0 ,16 ); -memset ((void *)ctr_preload,0 ,16 ); -memset ((void *)chain_buffer,0 ,16 ); -memset ((void *)aes_out,0 ,16 ); -memset ((void *)padded_buffer,0 ,16 ); -/* start to decrypt the payload */ num_blocks = (plen-8 ) /16 ;/* plen including LLC, payload_length and mic) */
Greg Kroah-Hartman
maintainerPATCH 133/208 drm/exynos: exynos7_drm_decon: add vblank check in IRQ handling
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kaustabh Chakraborty <[email protected]>
commit b846350aa272de99bf6fecfa6b08e64ebfb13173 upstream.
If there's support for another console device (such as a TTY serial), the kernel occasionally panics during boot. The panic message and a relevant snippet of the call stack is as follows:
Unable to handle kernel NULL pointer dereference at virtual address 000000000000000
Call trace:
drm_crtc_handle_vblank+0x10/0x30 (P)
decon_irq_handler+0x88/0xb4
[...]Otherwise, the panics don't happen. This indicates that it's some sort of race condition.
Add a check to validate if the drm device can handle vblanks before calling drm_crtc_handle_vblank() to avoid this.
--- drivers/gpu/drm/exynos/exynos7_drm_decon.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/exynos/exynos7_drm_decon.c +4 -0
@@ -595,6 +595,10 @@ static irqreturn_t decon_irq_handler(intif (!ctx->drm_dev) goto out; +/* check if crtc and vblank have been initialized properly */ +if (!drm_dev_has_vblank (ctx->drm_dev)) + goto out; +if (!ctx->i80_if) {drm_crtc_handle_vblank (&ctx->crtc->base);
Greg Kroah-Hartman
maintainerPATCH 134/208 ASoC: fsl_asrc: use internal measured ratio for non-ideal ratio mode
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shengjiu Wang <[email protected]>
[ Upstream commit cbe876121633dadb2b0ce52711985328638e9aab ]
When USRC=0, there is underrun issue for the non-ideal ratio mode; according to the reference mannual, the internal measured ratio can be used with USRC=1 and IDRC=0.
--- sound/soc/fsl/fsl_asrc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/fsl/fsl_asrc.c +2 -1
@@ -513,7 +513,8 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair, bool use_ideal_rate)regmap_update_bits (asrc->regmap,REG_ASRCTR ,ASRCTR_ATSi_MASK (index),ASRCTR_ATS (index));regmap_update_bits (asrc->regmap,REG_ASRCTR , -ASRCTR_USRi_MASK (index),0 ); +ASRCTR_IDRi_MASK (index) |ASRCTR_USRi_MASK (index), +ASRCTR_USR (index));/* Set the input and output clock sources */ regmap_update_bits(asrc->regmap, REG_ASRCSR,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 135/208 perf: Revert to requiring CAP_SYS_ADMIN for uprobes
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit ba677dbe77af5ffe6204e0f3f547f3ba059c6302 ]
Jann reports that uprobes can be used destructively when used in the middle of an instruction. The kernel only verifies there is a valid instruction at the requested offset, but due to variable instruction length cannot determine if this is an instruction as seen by the intended execution stream.
Additionally, Mark Rutland notes that on architectures that mix data in the text segment (like arm64), a similar things can be done if the data word is 'mistaken' for an instruction.
As such, require CAP_SYS_ADMIN for uprobes.
--- kernel/events/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/events/core.c +1 -1
@@ -9823,7 +9823,7 @@ static int perf_uprobe_event_init(struct perf_event *event)if (event->attr.type != perf_uprobe.type)return -ENOENT ; -if (!perfmon_capable ()) +if (!capable (CAP_SYS_ADMIN ))return -EACCES ;/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 136/208 fix proc_sys_compare() handling of in-lookup dentries
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit b969f9614885c20f903e1d1f9445611daf161d6d ]
There's one case where ->d_compare() can be called for an in-lookup dentry; usually that's nothing special from ->d_compare() point of view, but... proc_sys_compare() is weird.
The thing is, /proc/sys subdirectories can look differently for different processes. Up to and including having the same name resolve to different dentries - all of them hashed.
The way it's done is ->d_compare() refusing to admit a match unless this dentry is supposed to be visible to this caller. The information needed to discriminate between them is stored in inode; it is set during proc_sys_lookup() and until it's done d_splice_alias() we really can't tell who should that dentry be visible for.
Normally there's no negative dentries in /proc/sys; we can run into a dying dentry in RCU dcache lookup, but those can be safely rejected.
However, ->d_compare() is also called for in-lookup dentries, before they get positive - or hashed, for that matter. In case of match we will wait until dentry leaves in-lookup state and repeat ->d_compare() afterwards. In other words, the right behaviour is to treat the name match as sufficient for in-lookup dentries; if dentry is not for us, we'll see that when we recheck once proc_sys_lookup() is done with it.
While we are at it, fix the misspelled READ_ONCE and WRITE_ONCE there.
--- fs/proc/inode.c | 2 +- fs/proc/proc_sysctl.c | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-)
fs/proc/inode.c +1 -1
@@ -54,7 +54,7 @@ static void proc_evict_inode(struct inode *inode) head = ei->sysctl;if (head) { -RCU_INIT_POINTER (ei->sysctl,NULL ); +WRITE_ONCE (ei->sysctl,NULL );proc_sys_evict_inode (inode, head); } }
fs/proc/proc_sysctl.c +11 -7
@@ -909,17 +909,21 @@ static int proc_sys_compare(const struct dentry *dentry,struct ctl_table_header *head;struct inode *inode; -/* Although proc doesn't have negative dentries, rcu-walk means -* that inode here can be NULL */ -/* AV: can it, indeed? */ - inode =d_inode_rcu (dentry); -if (!inode) -return 1 ;if (name->len != len)return 1 ;if (memcmp (name->name, str, len))return 1 ; - head =rcu_dereference (PROC_I (inode)->sysctl); + +// false positive is fine here - we'll recheck anyway +if (d_in_lookup (dentry)) +return 0 ; + + inode =d_inode_rcu (dentry); +// we just might have run into dentry in the middle of __dentry_kill() +if (!inode) +return 1 ; + + head =READ_ONCE (PROC_I (inode)->sysctl);return !head || !sysctl_is_seen (head); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 137/208 netlink: Fix wraparounds of sk->sk_rmem_alloc.
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit ae8f160e7eb24240a2a79fc4c815c6a0d4ee16cc ]
Netlink has this pattern in some places
if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf) atomic_add(skb->truesize, &sk->sk_rmem_alloc);
, which has the same problem fixed by commit 5a465a0da13e ("udp:
Fix multiple wraparounds of sk->sk_rmem_alloc.").
For example, if we set INT_MAX to SO_RCVBUFFORCE, the condition is always false as the two operands are of int.
Then, a single socket can eat as many skb as possible until OOM happens, and we can see multiple wraparounds of sk->sk_rmem_alloc.
Let's fix it by using atomic_add_return() and comparing the two variables as unsigned int.
Before:
[root@fedora ~]# ss -f netlink
Recv-Q Send-Q Local Address:Port Peer Address:Port
-1668710080 0 rtnl:nl_wraparound/293 *
After:
[root@fedora ~]# ss -f netlink
Recv-Q Send-Q Local Address:Port Peer Address:Port
2147483072 0 rtnl:nl_wraparound/290 *
^
`--- INT_MAX - 576
--- net/netlink/af_netlink.c | 81 ++++++++++++++++++++++++---------------- 1 file changed, 49 insertions(+), 32 deletions(-)
net/netlink/af_netlink.c +49 -32
@@ -379,7 +379,6 @@ static void netlink_skb_set_owner_r(struct sk_buff *skb, struct sock *sk)WARN_ON (skb->sk !=NULL ); skb->sk = sk; skb->destructor = netlink_skb_destructor; -atomic_add (skb->truesize, &sk->sk_rmem_alloc);sk_mem_charge (sk, skb->truesize); }
@@ -1207,41 +1206,48 @@ static struct sk_buff *netlink_alloc_large_skb(unsigned int size,int netlink_attachskb (struct sock *sk,struct sk_buff *skb,long *timeo,struct sock *ssk) { +DECLARE_WAITQUEUE (wait, current);struct netlink_sock *nlk; +unsigned int rmem; nlk =nlk_sk (sk); + rmem =atomic_add_return (skb->truesize, &sk->sk_rmem_alloc); -if ((atomic_read (&sk->sk_rmem_alloc) > sk->sk_rcvbuf || -test_bit (NETLINK_S_CONGESTED , &nlk->state))) { -DECLARE_WAITQUEUE (wait, current); -if (!*timeo) { -if (!ssk ||netlink_is_kernel (ssk)) -netlink_overrun (sk); -sock_put (sk); -kfree_skb (skb); -return -EAGAIN ; - } - -__set_current_state (TASK_INTERRUPTIBLE ); -add_wait_queue (&nlk->wait, &wait); +if ((rmem == skb->truesize || rmem <READ_ONCE (sk->sk_rcvbuf)) && + !test_bit (NETLINK_S_CONGESTED , &nlk->state)) { +netlink_skb_set_owner_r (skb, sk); +return 0 ; + } -if ((atomic_read (&sk->sk_rmem_alloc) > sk->sk_rcvbuf || -test_bit (NETLINK_S_CONGESTED , &nlk->state)) && - !sock_flag (sk,SOCK_DEAD )) - *timeo =schedule_timeout (*timeo); +atomic_sub (skb->truesize, &sk->sk_rmem_alloc); -__set_current_state (TASK_RUNNING ); -remove_wait_queue (&nlk->wait, &wait); +if (!*timeo) { +if (!ssk ||netlink_is_kernel (ssk)) +netlink_overrun (sk);sock_put (sk); +kfree_skb (skb); +return -EAGAIN ; + } -if (signal_pending (current)) { -kfree_skb (skb); -return sock_intr_errno (*timeo); - } -return 1 ; +__set_current_state (TASK_INTERRUPTIBLE ); +add_wait_queue (&nlk->wait, &wait); + rmem =atomic_read (&sk->sk_rmem_alloc); + +if (((rmem && rmem + skb->truesize >READ_ONCE (sk->sk_rcvbuf)) || +test_bit (NETLINK_S_CONGESTED , &nlk->state)) && + !sock_flag (sk,SOCK_DEAD )) + *timeo =schedule_timeout (*timeo); + +__set_current_state (TASK_RUNNING ); +remove_wait_queue (&nlk->wait, &wait); +sock_put (sk); + +if (signal_pending (current)) { +kfree_skb (skb); +return sock_intr_errno (*timeo); } -netlink_skb_set_owner_r (skb, sk); -return 0 ; + +return 1 ; }static int __netlink_sendskb (struct sock *sk,struct sk_buff *skb)
@@ -1301,6 +1307,7 @@ static int netlink_unicast_kernel(struct sock *sk, struct sk_buff *skb, ret = -ECONNREFUSED ;if (nlk->netlink_rcv !=NULL ) { ret = skb->len; +atomic_add (skb->truesize, &sk->sk_rmem_alloc);netlink_skb_set_owner_r (skb, sk);NETLINK_CB (skb).sk = ssk;netlink_deliver_tap_kernel (sk, ssk, skb);
@@ -1379,13 +1386,19 @@ EXPORT_SYMBOL_GPL(netlink_strict_get_check);static int netlink_broadcast_deliver (struct sock *sk,struct sk_buff *skb) {struct netlink_sock *nlk =nlk_sk (sk); +unsigned int rmem, rcvbuf; -if (atomic_read (&sk->sk_rmem_alloc) <= sk->sk_rcvbuf && + rmem =atomic_add_return (skb->truesize, &sk->sk_rmem_alloc); + rcvbuf =READ_ONCE (sk->sk_rcvbuf); + +if ((rmem != skb->truesize || rmem <= rcvbuf) && !test_bit (NETLINK_S_CONGESTED , &nlk->state)) {netlink_skb_set_owner_r (skb, sk);__netlink_sendskb (sk, skb); -return atomic_read (&sk->sk_rmem_alloc) > (sk->sk_rcvbuf >>1 ); +return rmem > (rcvbuf >>1 ); } + +atomic_sub (skb->truesize, &sk->sk_rmem_alloc);return -1 ; }
@@ -2202,6 +2215,7 @@ static int netlink_dump(struct sock *sk, bool lock_taken)struct module *module;int err = -ENOBUFS ;int alloc_min_size; +unsigned int rmem;int alloc_size;if (!lock_taken)
@@ -2211,9 +2225,6 @@ static int netlink_dump(struct sock *sk, bool lock_taken) goto errout_skb; } -if (atomic_read (&sk->sk_rmem_alloc) >= sk->sk_rcvbuf) - goto errout_skb; -/* NLMSG_GOODSIZE is small to avoid high order allocations being * required, but it makes sense to _attempt_ a 16K bytes allocation * to reduce number of system calls on dump operations, if user
@@ -2236,6 +2247,12 @@ static int netlink_dump(struct sock *sk, bool lock_taken)if (!skb) goto errout_skb; + rmem =atomic_add_return (skb->truesize, &sk->sk_rmem_alloc); +if (rmem >=READ_ONCE (sk->sk_rcvbuf)) { +atomic_sub (skb->truesize, &sk->sk_rmem_alloc); + goto errout_skb; + } +/* Trim skb to allocated size. User is expected to provide buffer as * large as max(min_dump_alloc, 16KiB (mac_recvmsg_len capped at * netlink_recvmsg())). dump will pack as many smaller messages as
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 138/208 tipc: Fix use-after-free in tipc_conn_close().
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 667eeab4999e981c96b447a4df5f20bdf5c26f13 ]
syzbot reported a null-ptr-deref in tipc_conn_close() during netns dismantle. [0]
tipc_topsrv_stop() iterates tipc_net(net)->topsrv->conn_idr and calls tipc_conn_close() for each tipc_conn.
The problem is that tipc_conn_close() is called after releasing the IDR lock.
At the same time, there might be tipc_conn_recv_work() running and it could call tipc_conn_close() for the same tipc_conn and release its last ->kref.
Once we release the IDR lock in tipc_topsrv_stop(), there is no guarantee that the tipc_conn is alive.
Let's hold the ref before releasing the lock and put the ref after tipc_conn_close() in tipc_topsrv_stop().
[0]:
BUG: KASAN: use-after-free in tipc_conn_close+0x122/0x140 net/tipc/topsrv.c:165
Read of size 8 at addr ffff888099305a08 by task kworker/u4:3/435
CPU: 0 PID: 435 Comm: kworker/u4:3 Not tainted 4.19.204-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: netns cleanup_net
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
kasan_report mm/kasan/report.c:412 [inline]
__asan_report_load8_noabort+0x88/0x90 mm/kasan/report.c:433
tipc_conn_close+0x122/0x140 net/tipc/topsrv.c:165
tipc_topsrv_stop net/tipc/topsrv.c:701 [inline]
tipc_topsrv_exit_net+0x27b/0x5c0 net/tipc/topsrv.c:722
ops_exit_list+0xa5/0x150 net/core/net_namespace.c:153
cleanup_net+0x3b4/0x8b0 net/core/net_namespace.c:553
process_one_work+0x864/0x1570 kernel/workqueue.c:2153
worker_thread+0x64c/0x1130 kernel/workqueue.c:2296
kthread+0x33f/0x460 kernel/kthread.c:259
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415
Allocated by task 23:
kmem_cache_alloc_trace+0x12f/0x380 mm/slab.c:3625
kmalloc include/linux/slab.h:515 [inline]
kzalloc include/linux/slab.h:709 [inline]
tipc_conn_alloc+0x43/0x4f0 net/tipc/topsrv.c:192
tipc_topsrv_accept+0x1b5/0x280 net/tipc/topsrv.c:470
process_one_work+0x864/0x1570 kernel/workqueue.c:2153
worker_thread+0x64c/0x1130 kernel/workqueue.c:2296
kthread+0x33f/0x460 kernel/kthread.c:259
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415
Freed by task 23:
__cache_free mm/slab.c:3503 [inline]
kfree+0xcc/0x210 mm/slab.c:3822
tipc_conn_kref_release net/tipc/topsrv.c:150 [inline]
kref_put include/linux/kref.h:70 [inline]
conn_put+0x2cd/0x3a0 net/tipc/topsrv.c:155
process_one_work+0x864/0x1570 kernel/workqueue.c:2153
worker_thread+0x64c/0x1130 kernel/workqueue.c:2296
kthread+0x33f/0x460 kernel/kthread.c:259
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415
The buggy address belongs to the object at ffff888099305a00
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 8 bytes inside of
512-byte region [ffff888099305a00, ffff888099305c00)
The buggy address belongs to the page:
page:ffffea000264c140 count:1 mapcount:0 mapping:ffff88813bff0940 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea00028b6b88 ffffea0002cd2b08 ffff88813bff0940
raw: 0000000000000000 ffff888099305000 0000000100000006 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff888099305900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888099305980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888099305a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888099305a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888099305b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb--- net/tipc/topsrv.c | 2 ++ 1 file changed, 2 insertions(+)
net/tipc/topsrv.c +2 -0
@@ -699,8 +699,10 @@ static void tipc_topsrv_stop(struct net *net)for (id =0 ; srv->idr_in_use; id++) { con =idr_find (&srv->conn_idr, id);if (con) { +conn_get (con);spin_unlock_bh (&srv->idr_lock);tipc_conn_close (con); +conn_put (con);spin_lock_bh (&srv->idr_lock); } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 139/208 vsock: Fix transport_{g2h,h2g} TOCTOU
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Luczaj <[email protected]>
[ Upstream commit 209fd720838aaf1420416494c5505096478156b4 ]
vsock_find_cid() and vsock_dev_do_ioctl() may race with module unload. transport_{g2h,h2g} may become NULL after the NULL check.
Introduce vsock_transport_local_cid() to protect from a potential null-ptr-deref.
KASAN: null-ptr-deref in range [0x0000000000000118-0x000000000000011f] RIP: 0010:vsock_find_cid+0x47/0x90 Call Trace: __vsock_bind+0x4b2/0x720 vsock_bind+0x90/0xe0 __sys_bind+0x14d/0x1e0 __x64_sys_bind+0x6e/0xc0 do_syscall_64+0x92/0x1c0 entry_SYSCALL_64_after_hwframe+0x4b/0x53 KASAN: null-ptr-deref in range [0x0000000000000118-0x000000000000011f] RIP: 0010:vsock_dev_do_ioctl.isra.0+0x58/0xf0 Call Trace: __x64_sys_ioctl+0x12d/0x190 do_syscall_64+0x92/0x1c0 entry_SYSCALL_64_after_hwframe+0x4b/0x53
--- net/vmw_vsock/af_vsock.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
net/vmw_vsock/af_vsock.c +21 -6
@@ -498,9 +498,25 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk) }EXPORT_SYMBOL_GPL (vsock_assign_transport); +/* +* Provide safe access to static transport_{h2g,g2h,dgram,local} callbacks. +* Otherwise we may race with module removal. Do not use on `vsk->transport`. +*/ +static u32 vsock_registered_transport_cid (const struct vsock_transport **transport) +{ +u32 cid =VMADDR_CID_ANY ; + +mutex_lock (&vsock_register_mutex); +if (*transport) + cid = (*transport)->get_local_cid (); +mutex_unlock (&vsock_register_mutex); + +return cid; +} +bool vsock_find_cid (unsigned int cid) { -if (transport_g2h && cid == transport_g2h->get_local_cid ()) +if (cid ==vsock_registered_transport_cid (&transport_g2h))return true;if (transport_h2g && cid ==VMADDR_CID_HOST )
@@ -2124,18 +2140,17 @@ static long vsock_dev_do_ioctl(struct file *filp, unsigned int cmd, void __user *ptr) { u32 __user *p = ptr; -u32 cid =VMADDR_CID_ANY ;int retval =0 ; +u32 cid;switch (cmd) {case IOCTL_VM_SOCKETS_GET_LOCAL_CID :/* To be compatible with the VMCI behavior, we prioritize the * guest CID instead of well-know host CID (VMADDR_CID_HOST). */ -if (transport_g2h) - cid = transport_g2h->get_local_cid (); -else if (transport_h2g) - cid = transport_h2g->get_local_cid (); + cid =vsock_registered_transport_cid (&transport_g2h); +if (cid ==VMADDR_CID_ANY ) + cid =vsock_registered_transport_cid (&transport_h2g);if (put_user (cid, p) !=0 ) retval = -EFAULT ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 140/208 vm_sockets: Add flags field in the vsock address data structure
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andra Paraschiv <[email protected]>
[ Upstream commit dc8eeef73b63ed8988224ba6b5ed19a615163a7f ]
vsock enables communication between virtual machines and the host they are running on. With the multi transport support (guest->host and host->guest), nested VMs can also use vsock channels for communication.
In addition to this, by default, all the vsock packets are forwarded to the host, if no host->guest transport is loaded. This behavior can be implicitly used for enabling vsock communication between sibling VMs.
Add a flags field in the vsock address data structure that can be used to explicitly mark the vsock connection as being targeted for a certain type of communication. This way, can distinguish between different use cases such as nested VMs and sibling VMs.
This field can be set when initializing the vsock address variable used for the connect() call.
Changelog
v3 -> v4
* Update the size of "svm_flags" field to be 1 byte instead of 2 bytes.
v2 -> v3
* Add "svm_flags" as a new field, not reusing "svm_reserved1".
v1 -> v2
* Update the field name to "svm_flags".
* Split the current patch in 2 patches.
Stable-dep-of: 687aa0c5581b ("vsock: Fix transport_* TOCTOU")
--- include/uapi/linux/vm_sockets.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
include/uapi/linux/vm_sockets.h +5 -1
@@ -22,6 +22,7 @@#endif #include <linux/socket.h> +#include <linux/types.h> /* Option name for STREAM socket buffer size. Use as the option name in * setsockopt(3) or getsockopt(3) to set or get an unsigned long long that
@@ -152,10 +153,13 @@ struct sockaddr_vm {unsigned short svm_reserved1;unsigned int svm_port;unsigned int svm_cid; +__u8 svm_flags;unsigned char svm_zero[sizeof (struct sockaddr ) -sizeof (sa_family_t) -sizeof (unsigned short ) - -sizeof (unsigned int ) -sizeof (unsigned int )]; +sizeof (unsigned int ) - +sizeof (unsigned int ) - +sizeof (__u8)]; };#define IOCTL_VM_SOCKETS_GET_LOCAL_CID _IO(7, 0xb9)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 141/208 vm_sockets: Add VMADDR_FLAG_TO_HOST vsock flag
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andra Paraschiv <[email protected]>
[ Upstream commit caaf95e0f23f9ed240b02251aab0f6fdb652b33d ]
Add VMADDR_FLAG_TO_HOST vsock flag that is used to setup a vsock connection where all the packets are forwarded to the host.
Then, using this type of vsock channel, vsock communication between sibling VMs can be built on top of it.
Changelog
v3 -> v4
* Update the "VMADDR_FLAG_TO_HOST" value, as the size of the field has been updated to 1 byte.
v2 -> v3
* Update comments to mention when the flag is set in the connect and listen paths.
v1 -> v2
* New patch in v2, it was split from the first patch in the series.
* Remove the default value for the vsock flags field.
* Update the naming for the vsock flag to "VMADDR_FLAG_TO_HOST".
Stable-dep-of: 687aa0c5581b ("vsock: Fix transport_* TOCTOU")
--- include/uapi/linux/vm_sockets.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
include/uapi/linux/vm_sockets.h +20 -0
@@ -119,6 +119,26 @@#define VMADDR_CID_HOST 2 +/* The current default use case for the vsock channel is the following: +* local vsock communication between guest and host and nested VMs setup. +* In addition to this, implicitly, the vsock packets are forwarded to the host +* if no host->guest vsock transport is set. +* +* Set this flag value in the sockaddr_vm corresponding field if the vsock +* packets need to be always forwarded to the host. Using this behavior, +* vsock communication between sibling VMs can be setup. +* +* This way can explicitly distinguish between vsock channels created for +* different use cases, such as nested VMs (or local communication between +* guest and host) and sibling VMs. +* +* The flag can be set in the connect logic in the user space application flow. +* In the listen logic (from kernel space) the flag is set on the remote peer +* address. This happens for an incoming connection when it is routed from the +* host and comes from the guest (local CID and remote CID > VMADDR_CID_HOST). +*/ +#define VMADDR_FLAG_TO_HOST 0x01 +/* Invalid vSockets version. */ #define VM_SOCKETS_INVALID_VERSION -1U
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 142/208 af_vsock: Set VMADDR_FLAG_TO_HOST flag on the receive path
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andra Paraschiv <[email protected]>
[ Upstream commit 1b5f2ab98e7f99f1a83960b17c5596012a7c5e88 ]
The vsock flags can be set during the connect() setup logic, when initializing the vsock address data structure variable. Then the vsock transport is assigned, also considering this flags field.
The vsock transport is also assigned on the (listen) receive path. The flags field needs to be set considering the use case.
Set the value of the vsock flags of the remote address to the one targeted for packets forwarding to the host, if the following conditions are met:
* The source CID of the packet is higher than VMADDR_CID_HOST.
* The destination CID of the packet is higher than VMADDR_CID_HOST.
Changelog
v3 -> v4
* No changes.
v2 -> v3
* No changes.
v1 -> v2
* Set the vsock flag on the receive path in the vsock transport assignment logic.
* Use bitwise operator for the vsock flag setup.
* Use the updated "VMADDR_FLAG_TO_HOST" flag naming.
Stable-dep-of: 687aa0c5581b ("vsock: Fix transport_* TOCTOU")
--- net/vmw_vsock/af_vsock.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
net/vmw_vsock/af_vsock.c +12 -0
@@ -441,6 +441,18 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk)unsigned int remote_cid = vsk->remote_addr.svm_cid;int ret; +/* If the packet is coming with the source and destination CIDs higher +* than VMADDR_CID_HOST, then a vsock channel where all the packets are +* forwarded to the host should be established. Then the host will +* need to forward the packets to the guest. +* +* The flag is set on the (listen) receive path (psk is not NULL). On +* the connect path the flag can be set by the user space application. +*/ +if (psk && vsk->local_addr.svm_cid >VMADDR_CID_HOST && + vsk->remote_addr.svm_cid >VMADDR_CID_HOST ) + vsk->remote_addr.svm_flags |=VMADDR_FLAG_TO_HOST ; +switch (sk->sk_type) {case SOCK_DGRAM : new_transport = transport_dgram;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 143/208 af_vsock: Assign the vsock transport considering the vsock address flags
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andra Paraschiv <[email protected]>
[ Upstream commit 7f816984f439dfe24da25032254cb10512900346 ]
The vsock flags field can be set in the connect path (user space app) and the (listen) receive path (kernel space logic).
When the vsock transport is assigned, the remote CID is used to distinguish between types of connection.
Use the vsock flags value (in addition to the CID) from the remote address to decide which vsock transport to assign. For the sibling VMs use case, all the vsock packets need to be forwarded to the host, so always assign the guest->host transport if the VMADDR_FLAG_TO_HOST flag is set. For the other use cases, the vsock transport assignment logic is not changed.
Changelog
v3 -> v4
* Update the "remote_flags" local variable type to reflect the change of the "svm_flags" field to be 1 byte in size.
v2 -> v3
* Update bitwise check logic to not compare result to the flag value.
v1 -> v2
* Use bitwise operator to check the vsock flag.
* Use the updated "VMADDR_FLAG_TO_HOST" flag naming.
* Merge the checks for the g2h transport assignment in one "if" block.
Stable-dep-of: 687aa0c5581b ("vsock: Fix transport_* TOCTOU")
--- net/vmw_vsock/af_vsock.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
net/vmw_vsock/af_vsock.c +7 -2
@@ -431,7 +431,8 @@ static void vsock_deassign_transport(struct vsock_sock *vsk)* The vsk->remote_addr is used to decide which transport to use: * - remote CID == VMADDR_CID_LOCAL or g2h->local_cid or VMADDR_CID_HOST if * g2h is not loaded, will use local transport; -* - remote CID <= VMADDR_CID_HOST will use guest->host transport; +* - remote CID <= VMADDR_CID_HOST or h2g is not loaded or remote flags field +* includes VMADDR_FLAG_TO_HOST flag value, will use guest->host transport; * - remote CID > VMADDR_CID_HOST will use host->guest transport; */ int vsock_assign_transport (struct vsock_sock *vsk,struct vsock_sock *psk)
@@ -439,6 +440,7 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk)const struct vsock_transport *new_transport;struct sock *sk =sk_vsock (vsk);unsigned int remote_cid = vsk->remote_addr.svm_cid; +__u8 remote_flags;int ret;/* If the packet is coming with the source and destination CIDs higher
@@ -453,6 +455,8 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk) vsk->remote_addr.svm_cid > VMADDR_CID_HOST) vsk->remote_addr.svm_flags |= VMADDR_FLAG_TO_HOST; + remote_flags = vsk->remote_addr.svm_flags; +switch (sk->sk_type) {case SOCK_DGRAM : new_transport = transport_dgram;
@@ -460,7 +464,8 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk)case SOCK_STREAM :if (vsock_use_local_transport (remote_cid)) new_transport = transport_local; -else if (remote_cid <=VMADDR_CID_HOST || !transport_h2g) +else if (remote_cid <=VMADDR_CID_HOST || !transport_h2g || + (remote_flags &VMADDR_FLAG_TO_HOST )) new_transport = transport_g2h;else new_transport = transport_h2g;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 144/208 vsock: Fix transport_* TOCTOU
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Luczaj <[email protected]>
[ Upstream commit 687aa0c5581b8d4aa87fd92973e4ee576b550cdf ]
Transport assignment may race with module unload. Protect new_transport from becoming a stale pointer.
This also takes care of an insecure call in vsock_use_local_transport(); add a lockdep assert.
BUG: unable to handle page fault for address: fffffbfff8056000 Oops: Oops: 0000 [#1] SMP KASAN RIP: 0010:vsock_assign_transport+0x366/0x600 Call Trace: vsock_connect+0x59c/0xc40 __sys_connect+0xe8/0x100 __x64_sys_connect+0x6e/0xc0 do_syscall_64+0x92/0x1c0 entry_SYSCALL_64_after_hwframe+0x4b/0x53
--- net/vmw_vsock/af_vsock.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-)
net/vmw_vsock/af_vsock.c +23 -5
@@ -400,6 +400,8 @@ EXPORT_SYMBOL_GPL(vsock_enqueue_accept);static bool vsock_use_local_transport (unsigned int remote_cid) { +lockdep_assert_held (&vsock_register_mutex); +if (!transport_local)return false;
@@ -457,6 +459,8 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk) remote_flags = vsk->remote_addr.svm_flags; +mutex_lock (&vsock_register_mutex); +switch (sk->sk_type) {case SOCK_DGRAM : new_transport = transport_dgram;
@@ -471,12 +475,15 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk) new_transport = transport_h2g;break ;default : -return -ESOCKTNOSUPPORT ; + ret = -ESOCKTNOSUPPORT ; + goto err; }if (vsk->transport) { -if (vsk->transport == new_transport) -return 0 ; +if (vsk->transport == new_transport) { + ret =0 ; + goto err; + }/* transport->release() must be called with sock lock acquired. * This path can only be taken during vsock_stream_connect(),
@@ -500,8 +507,16 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk)/* We increase the module refcnt to prevent the transport unloading * while there are open sockets assigned to it. */ -if (!new_transport || !try_module_get (new_transport->module)) -return -ENODEV ; +if (!new_transport || !try_module_get (new_transport->module)) { + ret = -ENODEV ; + goto err; + } + +/* It's safe to release the mutex after a successful try_module_get(). +* Whichever transport `new_transport` points at, it won't go away until +* the last module_put() below or in vsock_deassign_transport(). +*/ +mutex_unlock (&vsock_register_mutex); ret = new_transport->init (vsk, psk);if (ret) {
@@ -512,6 +527,9 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk) vsk->transport = new_transport;return 0 ; +err: +mutex_unlock (&vsock_register_mutex); +return ret; }EXPORT_SYMBOL_GPL (vsock_assign_transport);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 145/208 vsock: Fix IOCTL_VM_SOCKETS_GET_LOCAL_CID to check also `transport_local`
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Luczaj <[email protected]>
[ Upstream commit 1e7d9df379a04ccd0c2f82f39fbb69d482e864cc ]
Support returning VMADDR_CID_LOCAL in case no other vsock transport is available.
--- net/vmw_vsock/af_vsock.c | 2 ++ 1 file changed, 2 insertions(+)
net/vmw_vsock/af_vsock.c +2 -0
@@ -2186,6 +2186,8 @@ static long vsock_dev_do_ioctl(struct file *filp, cid =vsock_registered_transport_cid (&transport_g2h);if (cid ==VMADDR_CID_ANY ) cid =vsock_registered_transport_cid (&transport_h2g); +if (cid ==VMADDR_CID_ANY ) + cid =vsock_registered_transport_cid (&transport_local);if (put_user (cid, p) !=0 ) retval = -EFAULT ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 146/208 net: phy: smsc: Fix Auto-MDIX configuration when disabled by strap
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleksij Rempel <[email protected]>
[ Upstream commit a141af8eb2272ab0f677a7f2653874840bc9b214 ]
Correct the Auto-MDIX configuration to ensure userspace settings are respected when the feature is disabled by the AUTOMDIX_EN hardware strap.
The LAN9500 PHY allows its default MDI-X mode to be configured via a hardware strap. If this strap sets the default to "MDI-X off", the driver was previously unable to enable Auto-MDIX from userspace.
When handling the ETH_TP_MDI_AUTO case, the driver would set the SPECIAL_CTRL_STS_AMDIX_ENABLE_ bit but neglected to set the required SPECIAL_CTRL_STS_OVRRD_AMDIX_ bit. Without the override flag, the PHY falls back to its hardware strap default, ignoring the software request.
This patch corrects the behavior by also setting the override bit when enabling Auto-MDIX. This ensures that the userspace configuration takes precedence over the hardware strap, allowing Auto-MDIX to be enabled correctly in all scenarios.
--- drivers/net/phy/smsc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/phy/smsc.c +2 -1
@@ -132,7 +132,8 @@ static int lan87xx_config_aneg(struct phy_device *phydev)SPECIAL_CTRL_STS_AMDIX_STATE_ ;break ;case ETH_TP_MDI_AUTO : - val =SPECIAL_CTRL_STS_AMDIX_ENABLE_ ; + val =SPECIAL_CTRL_STS_OVRRD_AMDIX_ | +SPECIAL_CTRL_STS_AMDIX_ENABLE_ ;break ;default :return genphy_config_aneg (phydev);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 147/208 net: phy: smsc: Fix link failure in forced mode with Auto-MDIX
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleksij Rempel <[email protected]>
[ Upstream commit 9dfe110cc0f6ef42af8e81ce52aef34a647d0b8a ]
Force a fixed MDI-X mode when auto-negotiation is disabled to prevent link instability.
When forcing the link speed and duplex on a LAN9500 PHY (e.g., with ethtool -s eth0 autoneg off ...) while leaving MDI-X control in auto mode, the PHY fails to establish a stable link. This occurs because the PHY's Auto-MDIX algorithm is not designed to operate when auto-negotiation is disabled. In this state, the PHY continuously toggles the TX/RX signal pairs, which prevents the link partner from synchronizing.
This patch resolves the issue by detecting when auto-negotiation is disabled. If the MDI-X control mode is set to 'auto', the driver now forces a specific, stable mode (ETH_TP_MDI) to prevent the pair toggling. This choice of a fixed MDI mode mirrors the behavior the hardware would exhibit if the AUTOMDIX_EN strap were configured for a fixed MDI connection.
--- drivers/net/phy/smsc.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)
drivers/net/phy/smsc.c +22 -3
@@ -120,10 +120,29 @@ static int lan911x_config_init(struct phy_device *phydev)static int lan87xx_config_aneg (struct phy_device *phydev) { -int rc; +u8 mdix_ctrl;int val; +int rc; + +/* When auto-negotiation is disabled (forced mode), the PHY's +* Auto-MDIX will continue toggling the TX/RX pairs. +* +* To establish a stable link, we must select a fixed MDI mode. +* If the user has not specified a fixed MDI mode (i.e., mdix_ctrl is +* 'auto'), we default to ETH_TP_MDI. This choice of a ETH_TP_MDI mode +* mirrors the behavior the hardware would exhibit if the AUTOMDIX_EN +* strap were configured for a fixed MDI connection. +*/ +if (phydev->autoneg ==AUTONEG_DISABLE ) { +if (phydev->mdix_ctrl ==ETH_TP_MDI_AUTO ) + mdix_ctrl =ETH_TP_MDI ; +else + mdix_ctrl = phydev->mdix_ctrl; + }else { + mdix_ctrl = phydev->mdix_ctrl; + } -switch (phydev->mdix_ctrl) { +switch (mdix_ctrl) {case ETH_TP_MDI : val =SPECIAL_CTRL_STS_OVRRD_AMDIX_ ;break ;
@@ -149,7 +168,7 @@ static int lan87xx_config_aneg(struct phy_device *phydev) rc |= val;phy_write (phydev,SPECIAL_CTRL_STS , rc); - phydev->mdix = phydev->mdix_ctrl; + phydev->mdix = mdix_ctrl;return genphy_config_aneg (phydev); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 148/208 atm: clip: Fix potential null-ptr-deref in to_atmarpd().
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 706cc36477139c1616a9b2b96610a8bb520b7119 ]
atmarpd is protected by RTNL since commit f3a0592b37b8 ("[ATM]: clip causes unregister hang").
However, it is not enough because to_atmarpd() is called without RTNL, especially clip_neigh_solicit() / neigh_ops->solicit() is unsleepable.
Also, there is no RTNL dependency around atmarpd.
Let's use a private mutex and RCU to protect access to atmarpd in to_atmarpd().
--- net/atm/clip.c | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-)
net/atm/clip.c +29 -15
@@ -45,7 +45,8 @@#include <net/atmclip.h> static struct net_device *clip_devs; -static struct atm_vcc *atmarpd; +static struct atm_vcc __rcu *atmarpd; +static DEFINE_MUTEX (atmarpd_lock);static struct timer_list idle_timer;static const struct neigh_ops clip_neigh_ops;
@@ -53,24 +54,35 @@ static int to_atmarpd(enum atmarp_ctrl_type type, int itf, __be32 ip) {struct sock *sk;struct atmarp_ctrl *ctrl; +struct atm_vcc *vcc;struct sk_buff *skb; +int err =0 ;pr_debug ("(%d)\n" , type); -if (!atmarpd) -return -EUNATCH ; + +rcu_read_lock (); + vcc =rcu_dereference (atmarpd); +if (!vcc) { + err = -EUNATCH ; + goto unlock; + } skb =alloc_skb (sizeof (struct atmarp_ctrl ),GFP_ATOMIC ); -if (!skb) -return -ENOMEM ; +if (!skb) { + err = -ENOMEM ; + goto unlock; + } ctrl =skb_put (skb,sizeof (struct atmarp_ctrl )); ctrl->type = type; ctrl->itf_num = itf; ctrl->ip = ip; -atm_force_charge (atmarpd, skb->truesize); +atm_force_charge (vcc, skb->truesize); - sk =sk_atm (atmarpd); + sk =sk_atm (vcc);skb_queue_tail (&sk->sk_receive_queue, skb); sk->sk_data_ready (sk); -return 0 ; +unlock: +rcu_read_unlock (); +return err; }static void link_vcc (struct clip_vcc *clip_vcc,struct atmarp_entry *entry)
@@ -607,10 +619,12 @@ static void atmarpd_close(struct atm_vcc *vcc) {pr_debug ("\n" ); -rtnl_lock (); - atmarpd =NULL ; +mutex_lock (&atmarpd_lock); +RCU_INIT_POINTER (atmarpd,NULL ); +mutex_unlock (&atmarpd_lock); + +synchronize_rcu ();skb_queue_purge (&sk_atm (vcc)->sk_receive_queue); -rtnl_unlock ();pr_debug ("(done)\n" );module_put (THIS_MODULE );
@@ -631,15 +645,15 @@ static struct atm_dev atmarpd_dev = {static int atm_init_atmarp (struct atm_vcc *vcc) { -rtnl_lock (); +mutex_lock (&atmarpd_lock);if (atmarpd) { -rtnl_unlock (); +mutex_unlock (&atmarpd_lock);return -EADDRINUSE ; }mod_timer (&idle_timer, jiffies +CLIP_CHECK_INTERVAL *HZ ); - atmarpd = vcc; +rcu_assign_pointer (atmarpd, vcc);set_bit (ATM_VF_META , &vcc->flags);set_bit (ATM_VF_READY , &vcc->flags);/* allow replies and avoid getting closed if signaling dies */
@@ -648,7 +662,7 @@ static int atm_init_atmarp(struct atm_vcc *vcc) vcc->push =NULL ; vcc->pop =NULL ;/* crash */ vcc->push_oam =NULL ;/* crash */ -rtnl_unlock (); +mutex_unlock (&atmarpd_lock);return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 149/208 atm: clip: Fix memory leak of struct clip_vcc.
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 62dba28275a9a3104d4e33595c7b3328d4032d8d ]
ioctl(ATMARP_MKIP) allocates struct clip_vcc and set it to vcc->user_back.
The code assumes that vcc_destroy_socket() passes NULL skb to vcc->push() when the socket is close()d, and then clip_push() frees clip_vcc.
However, ioctl(ATMARPD_CTRL) sets NULL to vcc->push() in atm_init_atmarp(), resulting in memory leak.
Let's serialise two ioctl() by lock_sock() and check vcc->push() in atm_init_atmarp() to prevent memleak.
--- net/atm/clip.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/atm/clip.c +8 -0
@@ -645,6 +645,9 @@ static struct atm_dev atmarpd_dev = {static int atm_init_atmarp (struct atm_vcc *vcc) { +if (vcc->push == clip_push) +return -EINVAL ; +mutex_lock (&atmarpd_lock);if (atmarpd) {mutex_unlock (&atmarpd_lock);
@@ -669,6 +672,7 @@ static int atm_init_atmarp(struct atm_vcc *vcc)static int clip_ioctl (struct socket *sock,unsigned int cmd,unsigned long arg) {struct atm_vcc *vcc =ATM_SD (sock); +struct sock *sk = sock->sk;int err =0 ;switch (cmd) {
@@ -689,14 +693,18 @@ static int clip_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) err =clip_create (arg);break ;case ATMARPD_CTRL : +lock_sock (sk); err =atm_init_atmarp (vcc);if (!err) { sock->state =SS_CONNECTED ;__module_get (THIS_MODULE ); } +release_sock (sk);break ;case ATMARP_MKIP : +lock_sock (sk); err =clip_mkip (vcc, arg); +release_sock (sk);break ;case ATMARP_SETENTRY : err =clip_setentry (vcc, (__force __be32 )arg);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 150/208 atm: clip: Fix infinite recursive call of clip_push().
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit c489f3283dbfc0f3c00c312149cae90d27552c45 ]
syzbot reported the splat below. [0]
This happens if we call ioctl(ATMARP_MKIP) more than once.
During the first call, clip_mkip() sets clip_push() to vcc->push(), and the second call copies it to clip_vcc->old_push().
Later, when the socket is close()d, vcc_destroy_socket() passes NULL skb to clip_push(), which calls clip_vcc->old_push(), triggering the infinite recursion.
Let's prevent the second ioctl(ATMARP_MKIP) by checking vcc->user_back, which is allocated by the first call as clip_vcc.
Note also that we use lock_sock() to prevent racy calls.
[0]:
BUG: TASK stack guard page was hit at ffffc9000d66fff8 (stack is ffffc9000d670000..ffffc9000d678000) Oops: stack guard page: 0000 [#1] SMP KASAN NOPTI CPU: 0 UID: 0 PID: 5322 Comm: syz.0.0 Not tainted 6.16.0-rc4-syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 RIP: 0010:clip_push+0x5/0x720 net/atm/clip.c:191 Code: e0 8f aa 8c e8 1c ad 5b fa eb ae 66 2e 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 55 <41> 57 41 56 41 55 41 54 53 48 83 ec 20 48 89 f3 49 89 fd 48 bd 00 RSP: 0018:ffffc9000d670000 EFLAGS: 00010246 RAX: 1ffff1100235a4a5 RBX: ffff888011ad2508 RCX: ffff8880003c0000 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff888037f01000 RBP: dffffc0000000000 R08: ffffffff8fa104f7 R09: 1ffffffff1f4209e R10: dffffc0000000000 R11: ffffffff8a99b300 R12: ffffffff8a99b300 R13: ffff888037f01000 R14: ffff888011ad2500 R15: ffff888037f01578 FS: 000055557ab6d500(0000) GS:ffff88808d250000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffc9000d66fff8 CR3: 0000000043172000 CR4: 0000000000352ef0 Call Trace: <TASK> clip_push+0x6dc/0x720 net/atm/clip.c:200 clip_push+0x6dc/0x720 net/atm/clip.c:200 clip_push+0x6dc/0x720 net/atm/clip.c:200 ... clip_push+0x6dc/0x720 net/atm/clip.c:200 clip_push+0x6dc/0x720 net/atm/clip.c:200 clip_push+0x6dc/0x720 net/atm/clip.c:200 vcc_destroy_socket net/atm/common.c:183 [inline] vcc_release+0x157/0x460 net/atm/common.c:205 __sock_release net/socket.c:647 [inline] sock_close+0xc0/0x240 net/socket.c:1391 __fput+0x449/0xa70 fs/file_table.c:465 task_work_run+0x1d1/0x260 kernel/task_work.c:227 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop+0xec/0x110 kernel/entry/common.c:114 exit_to_user_mode_prepare include/linux/entry-common.h:330 [inline] syscall_exit_to_user_mode_work include/linux/entry-common.h:414 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:449 [inline] do_syscall_64+0x2bd/0x3b0 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7ff31c98e929 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fffb5aa1f78 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4 RAX: 0000000000000000 RBX: 0000000000012747 RCX: 00007ff31c98e929 RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003 RBP: 00007ff31cbb7ba0 R08: 0000000000000001 R09: 0000000db5aa226f R10: 00007ff31c7ff030 R11: 0000000000000246 R12: 00007ff31cbb608c R13: 00007ff31cbb6080 R14: ffffffffffffffff R15: 00007fffb5aa2090 </TASK> Modules linked in:
--- net/atm/clip.c | 2 ++ 1 file changed, 2 insertions(+)
net/atm/clip.c +2 -0
@@ -429,6 +429,8 @@ static int clip_mkip(struct atm_vcc *vcc, int timeout)if (!vcc->push)return -EBADFD ; +if (vcc->user_back) +return -EINVAL ; clip_vcc =kmalloc (sizeof (struct clip_vcc ),GFP_KERNEL );if (!clip_vcc)return -ENOMEM ;
Signature · 1 line
2.39.5