5.15.149-rc1 review
Subsystems (9)
Greg Kroah-Hartman
maintainercover 5.15.149-rc1 review
This is the start of the stable review cycle for the 5.15.149 release. There are 476 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 23 Feb 2024 12:59:02 +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.15.149-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.15.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.15.149-rc1
Thinh Nguyen <[email protected]>
usb: dwc3: gadget: Ignore End Transfer delay on teardown
Tomi Valkeinen <[email protected]>
media: Revert "media: rkisp1: Drop IRQF_SHARED"
Wesley Cheng <[email protected]>
usb: dwc3: gadget: Execute gadget stop after halting the controller
Thinh Nguyen <[email protected]>
usb: dwc3: gadget: Don't delay End Transfer on delayed_status
Peter Suti <[email protected]>
staging: fbtft: core: set smem_len before fb_deferred_io_init call
Kees Cook <[email protected]>
smb3: Replace smb2pdu 1-element arrays with flex-arrays
Konstantin Komarov <[email protected]>
fs/ntfs3: Add null pointer checks
Florian Fainelli <[email protected]>
net: bcmgenet: Fix EEE implementation
Samasth Norway Ananda <[email protected]>
Revert "selftests/bpf: Test tail call counting with bpf2bpf and data on stack"
Konrad Dybcio <[email protected]>
drm/msm/dsi: Enable runtime PM
Douglas Anderson <[email protected]>
PM: runtime: Have devm_pm_runtime_enable() handle pm_runtime_dont_use_autosuspend()
Easwar Hariharan <[email protected]>
arm64: Subscribe Microsoft Azure Cobalt 100 to ARM Neoverse N2 errata
Mikulas Patocka <[email protected]>
dm: limit the number of targets and parameter size area
Ryusuke Konishi <[email protected]>
nilfs2: replace WARN_ONs for invalid DAT metadata block requests
Ryusuke Konishi <[email protected]>
nilfs2: fix potential bug in end_buffer_async_write
Linus Torvalds <[email protected]>
sched/membarrier: reduce the ability to hammer on sys_membarrier
Jozsef Kadlecsik <[email protected]>
netfilter: ipset: Missing gc cancellations fixed
Eric Dumazet <[email protected]>
net: prevent mss overflow in skb_segment()
Davidlohr Bueso <[email protected]>
hrtimer: Ignore slack time for RT tasks in schedule_hrtimeout_range()
Jozsef Kadlecsik <[email protected]>
netfilter: ipset: fix performance regression in swap operation
Carlos Llamas <[email protected]>
scripts/decode_stacktrace.sh: optionally use LLVM utilities
Miguel Ojeda <[email protected]>
scripts: decode_stacktrace: demangle Rust symbols
Schspa Shi <[email protected]>
scripts/decode_stacktrace.sh: support old bash version
Nam Cao <[email protected]>
fbdev: flush deferred IO before closing
Takashi Iwai <[email protected]>
fbdev: Fix incorrect page mapping clearance at fb_deferred_io_release()
Takashi Iwai <[email protected]>
fbdev: Fix invalid page access after closing deferred I/O devices
Thomas Zimmermann <[email protected]>
fbdev: Rename pagelist to pagereflist for deferred I/O
Thomas Zimmermann <[email protected]>
fbdev: Track deferred-I/O pages in pageref struct
Chuansheng Liu <[email protected]>
fbdev: defio: fix the pagelist corruption
Thomas Zimmermann <[email protected]>
fbdev: Don't sort deferred-I/O pages by default
Thomas Zimmermann <[email protected]>
fbdev/defio: Early-out if page is already enlisted
Lino Sanfilippo <[email protected]>
serial: 8250_exar: Set missing rs485_supported flag
Ilpo Järvinen <[email protected]>
serial: 8250_exar: Fill in rs485_supported
Wesley Cheng <[email protected]>
usb: dwc3: gadget: Queue PM runtime idle on disconnect event
Wesley Cheng <[email protected]>
usb: dwc3: gadget: Handle EP0 request dequeuing properly
Wesley Cheng <[email protected]>
usb: dwc3: gadget: Refactor EP0 forced stall/restart into a separate API
Wesley Cheng <[email protected]>
usb: dwc3: gadget: Stall and restart EP0 if host is unresponsive
Wesley Cheng <[email protected]>
usb: dwc3: gadget: Submit endxfer command if delayed during disconnect
Wesley Cheng <[email protected]>
usb: dwc3: gadget: Force sending delayed status during soft disconnect
Mayank Rana <[email protected]>
usb: dwc3: Fix ep0 handling when getting reset while doing control transfer
Thinh Nguyen <[email protected]>
usb: dwc3: gadget: Delay issuing End Transfer
Thinh Nguyen <[email protected]>
usb: dwc3: gadget: Only End Transfer for ep0 data phase
Thinh Nguyen <[email protected]>
usb: dwc3: ep0: Don't prepare beyond Setup stage
Thinh Nguyen <[email protected]>
usb: dwc3: gadget: Wait for ep0 xfers to complete during dequeue
Tianjia Zhang <[email protected]>
crypto: lib/mpi - Fix unexpected pointer access in mpi_ec_init
David Lin <[email protected]>
wifi: mwifiex: fix uninitialized firmware_stat
Sjoerd Simons <[email protected]>
bus: moxtet: Add spi device table
David Lin <[email protected]>
wifi: mwifiex: add extra delay for firmware ready
Lukas Wunner <[email protected]>
wifi: mwifiex: Support SD8978 chipset
Andrejs Cainikovs <[email protected]>
mwifiex: Select firmware based on strapping
Christian König <[email protected]>
dma-buf: add dma_fence_timestamp helper
Kuniyuki Iwashima <[email protected]>
af_unix: Fix task hung while purging oob_skb in GC.
Steven Rostedt (Google) <[email protected]>
tracing: Inform kmemleak of saved_cmdlines allocation
Konrad Dybcio <[email protected]>
pmdomain: core: Move the unused cleanup to a _sync initcall
Oleksij Rempel <[email protected]>
can: j1939: Fix UAF in j1939_sk_match_filter during setsockopt(SO_J1939_FILTER)
Ziqi Zhao <[email protected]>
can: j1939: prevent deadlock by changing j1939_socks_lock to rwlock
Nuno Sa <[email protected]>
of: property: fix typo in io-channels
Prakash Sangappa <[email protected]>
mm: hugetlb pages should not be reserved by shmat() if SHM_NORESERVE
Rishabh Dave <[email protected]>
ceph: prevent use-after-free in encode_cap_msg()
Sinthu Raja <[email protected]>
net: ethernet: ti: cpsw_new: enable mac_managed_pm to fix mdio
Alexandra Winter <[email protected]>
s390/qeth: Fix potential loss of L3-IP@ in case of network issues
Sinthu Raja <[email protected]>
net: ethernet: ti: cpsw: enable mac_managed_pm to fix mdio
Marc Zyngier <[email protected]>
irqchip/gic-v3-its: Fix GICv4.1 VPE affinity update
Doug Berger <[email protected]>
irqchip/irq-brcmstb-l2: Add write memory barrier before exit
Johannes Berg <[email protected]>
wifi: mac80211: reload info pointer in ieee80211_tx_dequeue()
Daniel de Villiers <[email protected]>
nfp: flower: prevent re-adding mac index for bonded port
Daniel Basilio <[email protected]>
nfp: use correct macro for LengthSelect in BAR config
Kim Phillips <[email protected]>
crypto: ccp - Fix null pointer dereference in __sev_platform_shutdown_locked
Ryusuke Konishi <[email protected]>
nilfs2: fix hang in nilfs_lookup_dirty_data_buffers()
Ryusuke Konishi <[email protected]>
nilfs2: fix data corruption in dsync block recovery for small block sizes
bo liu <[email protected]>
ALSA: hda/conexant: Add quirk for SWS JS201D
Alexander Stein <[email protected]>
mmc: slot-gpio: Allow non-sleeping GPIO ro
Steve Wahl <[email protected]>
x86/mm/ident_map: Use gbpages only where full GB page should be mapped.
Aleksander Mazur <[email protected]>
x86/Kconfig: Transmeta Crusoe is CPU family 5, not 6
Naveen N Rao <[email protected]>
powerpc/64: Set task pt_regs->link to the LR value on scv entry
Hugo Villeneuve <[email protected]>
serial: max310x: fail probe if clock crystal is unstable
Hugo Villeneuve <[email protected]>
serial: max310x: improve crystal stable clock detection
Hugo Villeneuve <[email protected]>
serial: max310x: set default value when reading clock ready bit
Vincent Donnefort <[email protected]>
ring-buffer: Clean ring_buffer_poll_wait() error return
Souradeep Chakrabarti <[email protected]>
hv_netvsc: Fix race condition between netvsc_probe and netvsc_remove
Philip Yang <[email protected]>
drm/prime: Support page array >= 4GB
Sean Young <[email protected]>
media: rc: bpf attach/detach requires write permission
Mario Limonciello <[email protected]>
iio: accel: bma400: Fix a compilation problem
Dinghao Liu <[email protected]>
iio: core: fix memleak in iio_device_register_sysfs
zhili.liu <[email protected]>
iio: magnetometer: rm3100: add boundary check for the value read from RM3100_REG_TMRC
David Schiller <[email protected]>
staging: iio: ad5933: fix type mismatch regression
Steven Rostedt (Google) <[email protected]>
tracing: Fix wasted memory in saved_cmdlines logic
Baokun Li <[email protected]>
ext4: fix double-free of blocks due to wrong extents moved_len
Ekansh Gupta <[email protected]>
misc: fastrpc: Mark all sessions as invalid in cb_remove
Carlos Llamas <[email protected]>
binder: signal epoll threads of self-work
Vitaly Rodionov <[email protected]>
ALSA: hda/cs8409: Suppress vmaster control for Dolphin models
Krzysztof Kozlowski <[email protected]>
ASoC: codecs: wcd938x: handle deferred probe
Edson Juliano Drosdeck <[email protected]>
ALSA: hda/realtek: Enable headset mic on Vaio VJFE-ADL
Jan Beulich <[email protected]>
xen-netback: properly sync TX responses
Nikita Zhandarovich <[email protected]>
net: hsr: remove WARN_ONCE() in send_hsr_supervision_frame()
Fedor Pchelkin <[email protected]>
nfc: nci: free rx_data_reassembly skb on NCI device cleanup
Nathan Chancellor <[email protected]>
kbuild: Fix changing ELF file type for output of gen_btf for big endian
Takashi Sakamoto <[email protected]>
firewire: core: correct documentation of fw_csr_string() kernel API
Ondrej Mosnacek <[email protected]>
lsm: fix the logic in security_inode_getsecctx()
Mario Limonciello <[email protected]>
Revert "drm/amd: flush any delayed gfxoff on suspend entry"
Lee Duncan <[email protected]>
scsi: Revert "scsi: fcoe: Fix potential deadlock on &fip->ctlr_lock"
Paolo Abeni <[email protected]>
mptcp: fix data re-injection from stale subflow
Radek Krejci <[email protected]>
modpost: trim leading spaces when processing source files list
Jean Delvare <[email protected]>
i2c: i801: Fix block process call transactions
Heiner Kallweit <[email protected]>
i2c: i801: Remove i801_set_block_buffer_mode
Jiangfeng Xiao <[email protected]>
powerpc/kasan: Fix addr error caused by page alignment
Zhipeng Lu <[email protected]>
media: ir_toy: fix a memleak in irtoy_tx
Uttkarsh Aggarwal <[email protected]>
usb: dwc3: gadget: Fix NULL pointer dereference in dwc3_gadget_suspend
yuan linyu <[email protected]>
usb: f_mass_storage: forbid async queue when shutdown happen
Oliver Neukum <[email protected]>
USB: hub: check for alternate port before enabling A_ALT_HNP_SUPPORT
Christian A. Ehrhardt <[email protected]>
usb: ucsi_acpi: Fix command completion handling
Srinivas Pandruvada <[email protected]>
iio: hid-sensor-als: Return 0 for HID_USAGE_SENSOR_TIME_TIMESTAMP
Jason Gerecke <[email protected]>
HID: wacom: Do not register input devices until after hid_hw_start
Tatsunosuke Tobita <[email protected]>
HID: wacom: generic: Avoid reporting a serial of '0' to userspace
Johan Hovold <[email protected]>
HID: i2c-hid-of: fix NULL-deref on failed power up
Luka Guzenko <[email protected]>
ALSA: hda/realtek: Enable Mute LED on HP Laptop 14-fq0xxx
David Senoner <[email protected]>
ALSA: hda/realtek: Fix the external mic not being recognised for Acer Swift 1 SF114-32
Michael Kelley <[email protected]>
scsi: storvsc: Fix ring buffer size calculation
Zach O'Keefe <[email protected]>
mm/writeback: fix possible divide-by-zero in wb_dirty_limits(), again
Masami Hiramatsu (Google) <[email protected]>
tracing/trigger: Fix to return error if failed to alloc snapshot
Samuel Holland <[email protected]>
scs: add CONFIG_MMU dependency for vfree_atomic()
Ivan Vecera <[email protected]>
i40e: Fix waiting for queues of all VSIs to be disabled
Guenter Roeck <[email protected]>
MIPS: Add 'memory' clobber to csum_ipv6_magic() inline assembler
Breno Leitao <[email protected]>
net: sysfs: Fix /sys/class/net/<iface> path for statistics
Alexey Khoroshilov <[email protected]>
ASoC: rt5645: Fix deadlock in rt5645_jack_detect_work()
Uwe Kleine-König <[email protected]>
spi: ppc4xx: Drop write-only variable
Aaron Conole <[email protected]>
net: openvswitch: limit the number of recursions from action sets
Dan Carpenter <[email protected]>
wifi: iwlwifi: Fix some error codes
Christian A. Ehrhardt <[email protected]>
of: unittest: Fix compile in the non-dynamic case
David Sterba <[email protected]>
btrfs: send: return EOPNOTSUPP on unknown flags
Boris Burkov <[email protected]>
btrfs: forbid deleting live subvol qgroup
Qu Wenruo <[email protected]>
btrfs: do not ASSERT() if the newly created subvolume already got read
Boris Burkov <[email protected]>
btrfs: forbid creating subvol qgroups
Pablo Neira Ayuso <[email protected]>
netfilter: nft_set_rbtree: skip end interval element from gc
Furong Xu <[email protected]>
net: stmmac: xgmac: fix a typo of register name in DPP safety handling
Simon Horman <[email protected]>
net: stmmac: xgmac: use #define for string constants
Jiri Wiesner <[email protected]>
clocksource: Skip watchdog check for large watchdog intervals
Prathu Baronia <[email protected]>
vhost: use kzalloc() instead of kmalloc() followed by memset()
Hans de Goede <[email protected]>
Input: atkbd - skip ATKBD_CMD_SETLEDS when skipping ATKBD_CMD_GETID
Werner Sembach <[email protected]>
Input: i8042 - fix strange behavior of touchpad on Clevo NS70PU
Frederic Weisbecker <[email protected]>
hrtimer: Report offline hrtimer enqueue
Prashanth K <[email protected]>
usb: host: xhci-plat: Add support for XHCI_SG_TRB_CACHE_SIZE_QUIRK
Prashanth K <[email protected]>
usb: dwc3: host: Set XHCI_SG_TRB_CACHE_SIZE_QUIRK
Leonard Dallmayr <[email protected]>
USB: serial: cp210x: add ID for IMST iM871A-USB
Puliang Lu <[email protected]>
USB: serial: option: add Fibocom FM101-GL variant
JackBB Wu <[email protected]>
USB: serial: qcserial: add new usb-id for Dell Wireless DW5826e
Julian Sikorski <[email protected]>
ALSA: usb-audio: Add a quirk for Yamaha YIT-W12TX transmitter
Justin Stitt <[email protected]>
drivers: lkdtm: fix clang -Wformat warning
Tejun Heo <[email protected]>
blk-iocost: Fix an UBSAN shift-out-of-bounds warning
Ming Lei <[email protected]>
scsi: core: Move scsi_host_busy() out of host lock if it is for per-command
Dan Carpenter <[email protected]>
fs/ntfs3: Fix an NULL dereference bug
Florian Westphal <[email protected]>
netfilter: nft_set_pipapo: remove scratch_aligned pointer
Florian Westphal <[email protected]>
netfilter: nft_set_pipapo: add helper to release pcpu scratch area
Florian Westphal <[email protected]>
netfilter: nft_set_pipapo: store index in scratch maps
Pablo Neira Ayuso <[email protected]>
netfilter: nft_ct: reject direction for ct id
Srinivasan Shanmugam <[email protected]>
drm/amd/display: Implement bounds check for stream encoder creation in DCN301
Anson Jacob <[email protected]>
drm/amd/display: Fix multiple memory leaks reported by coverity
Pablo Neira Ayuso <[email protected]>
netfilter: nft_compat: restrict match/target protocol to u16
Pablo Neira Ayuso <[email protected]>
netfilter: nft_compat: reject unused compat flag
Eric Dumazet <[email protected]>
ppp_async: limit MRU to 64K
Kuniyuki Iwashima <[email protected]>
af_unix: Call kfree_skb() for dead unix_(sk)->oob_skb in GC.
Shigeru Yoshida <[email protected]>
tipc: Check the bearer type before calling tipc_udp_nl_bearer_add()
David Howells <[email protected]>
rxrpc: Fix response to PING RESPONSE ACKs to a dead call
Eric Dumazet <[email protected]>
inet: read sk->sk_family once in inet_recv_error()
Zhang Rui <[email protected]>
hwmon: (coretemp) Fix bogus core_id to attr name mapping
Zhang Rui <[email protected]>
hwmon: (coretemp) Fix out-of-bounds memory access
Loic Prylli <[email protected]>
hwmon: (aspeed-pwm-tacho) mutex for tach reading
Zhipeng Lu <[email protected]>
octeontx2-pf: Fix a memleak otx2_sq_init
Zhipeng Lu <[email protected]>
atm: idt77252: fix a memleak in open_card_ubr0
Antoine Tenart <[email protected]>
tunnels: fix out of bounds access when building IPv6 PMTU error
Paolo Abeni <[email protected]>
selftests: net: avoid just another constant wait
Paolo Abeni <[email protected]>
selftests: net: cut more slack for gro fwd tests.
Furong Xu <[email protected]>
net: stmmac: xgmac: fix handling of DPP safety error for DMA channels
Kuogee Hsieh <[email protected]>
drm/msm/dp: return correct Colorimetry for DP_TEST_DYNAMIC_RANGE_CEA case
Tony Lindgren <[email protected]>
phy: ti: phy-omap-usb2: Fix NULL pointer dereference for SRP
Frank Li <[email protected]>
dmaengine: fix is_slave_direction() return false when DMA_DEV_TO_DEV
Yoshihiro Shimoda <[email protected]>
phy: renesas: rcar-gen3-usb2: Fix returning wrong error code
Christophe JAILLET <[email protected]>
dmaengine: fsl-qdma: Fix a memory leak related to the queue command DMA
Christophe JAILLET <[email protected]>
dmaengine: fsl-qdma: Fix a memory leak related to the status queue DMA
Jai Luthra <[email protected]>
dmaengine: ti: k3-udma: Report short packet errors
Guanhua Gao <[email protected]>
dmaengine: fsl-dpaa2-qdma: Fix the size of dma pools
Johan Hovold <[email protected]>
ASoC: codecs: lpass-wsa-macro: fix compander volume hack
Zhengchao Shao <[email protected]>
bonding: remove print in bond_verify_device_path
Benjamin Berg <[email protected]>
HID: apple: Add 2021 magic keyboard FN key mapping
Alex Henrie <[email protected]>
HID: apple: Add support for the 2021 Magic Keyboard
Praveen Kaligineedi <[email protected]>
gve: Fix use-after-free vulnerability
Huang Shijie <[email protected]>
arm64: irq: set the correct node for shadow call stack
Breno Leitao <[email protected]>
net: sysfs: Fix /sys/class/net/<iface> path
Paolo Abeni <[email protected]>
selftests: net: fix available tunnels detection
Eric Dumazet <[email protected]>
af_unix: fix lockdep positive in sk_diag_dump_icons()
Zhipeng Lu <[email protected]>
net: ipv4: fix a memleak in ip_setup_cork
Pablo Neira Ayuso <[email protected]>
netfilter: nft_ct: sanitize layer 3 and 4 protocol number in custom expectations
Pablo Neira Ayuso <[email protected]>
netfilter: nf_log: replace BUG_ON by WARN_ON_ONCE when putting logger
Pablo Neira Ayuso <[email protected]>
netfilter: nf_tables: restrict tunnel object to NFPROTO_NETDEV
Linus Lüssing <[email protected]>
bridge: mcast: fix disabled snooping after long uptime
Eric Dumazet <[email protected]>
llc: call sock_orphan() at release time
Helge Deller <[email protected]>
ipv6: Ensure natural alignment of const ipv6 loopback and router addresses
Christophe JAILLET <[email protected]>
ixgbe: Fix an error handling path in ixgbe_read_iosf_sb_reg_x550()
Jedrzej Jagielski <[email protected]>
ixgbe: Refactor overtemp event handling
Jedrzej Jagielski <[email protected]>
ixgbe: Refactor returning internal error codes
Piotr Skajewski <[email protected]>
ixgbe: Remove non-inclusive language
Eric Dumazet <[email protected]>
tcp: add sanity checks to rx zerocopy
Eric Dumazet <[email protected]>
ip6_tunnel: make sure to pull inner header in __ip6_tnl_rcv()
Eric Dumazet <[email protected]>
ip6_tunnel: use dev_sw_netstats_rx_add()
Paolo Abeni <[email protected]>
selftests: net: give more time for GRO aggregation
Ming Lei <[email protected]>
scsi: core: Move scsi_host_busy() out of host lock for waking up EH handler
Su Hui <[email protected]>
scsi: isci: Fix an error code problem in isci_io_request_build()
Stephen Rothwell <[email protected]>
drm: using mul_u32_u32() requires linux/math64.h
Edward Adam Davis <[email protected]>
wifi: cfg80211: fix RCU dereference in __cfg80211_bss_update
Peter Zijlstra <[email protected]>
perf: Fix the nr_addr_filters fix
Srinivasan Shanmugam <[email protected]>
drm/amdkfd: Fix 'node' NULL check in 'svm_range_get_range_boundaries()'
Srinivasan Shanmugam <[email protected]>
drm/amdgpu: Release 'adev->pm.fw' before return in 'amdgpu_device_need_post()'
Srinivasan Shanmugam <[email protected]>
drm/amd/powerplay: Fix kzalloc parameter 'ATOM_Tonga_PPM_Table' in 'get_platform_power_management_table()'
Xiubo Li <[email protected]>
ceph: fix deadlock or deadcode of misusing dget()
Ming Lei <[email protected]>
blk-mq: fix IO hang from sbitmap wakeup race
Zhu Yanjun <[email protected]>
virtio_net: Fix "‘%d’ directive writing between 1 and 11 bytes into a region of size 10" warnings
Felix Kuehling <[email protected]>
drm/amdkfd: Fix lock dependency warning
Ian Rogers <[email protected]>
libsubcmd: Fix memory leak in uniq()
Hans de Goede <[email protected]>
misc: lis3lv02d_i2c: Add missing setting of the reg_ctrl callback
Bjorn Helgaas <[email protected]>
PCI/AER: Decode Requester ID when no error info found
Ilpo Järvinen <[email protected]>
PCI: Fix 64GT/s effective data rate calculation
Max Kellermann <[email protected]>
fs/kernfs/dir: obey S_ISGID
Adrian Reber <[email protected]>
tty: allow TIOCSLCKTRMIOS with CAP_CHECKPOINT_RESTORE
Jo Van Bulck <[email protected]>
selftests/sgx: Fix linker script asserts
Hardik Gajjar <[email protected]>
usb: hub: Replace hardcoded quirk value with BIT() macro
James Clark <[email protected]>
perf cs-etm: Bump minimum OpenCSD version to ensure a bugfix is present
Daniel Stodden <[email protected]>
PCI: switchtec: Fix stdev_release() crash after surprise hot remove
Guilherme G. Piccoli <[email protected]>
PCI: Only override AMD USB controller if required
Xiaowu.ding <[email protected]>
mailbox: arm_mhuv2: Fix a bug for mhuv2_sender_interrupt
Peter Robinson <[email protected]>
mfd: ti_am335x_tscadc: Fix TI SoC dependencies
Oleksandr Tyshchenko <[email protected]>
xen/gntdev: Fix the abuse of underlying struct page in DMA-buf import
Harshit Shah <[email protected]>
i3c: master: cdns: Update maximum prescaler value for i2c clock
Johannes Berg <[email protected]>
um: time-travel: fix time corruption
Nathan Chancellor <[email protected]>
um: net: Fix return type of uml_net_start_xmit()
Benjamin Berg <[email protected]>
um: Don't use vfprintf() for os_info()
Anton Ivanov <[email protected]>
um: Fix naming clash between UML and scheduler
Heiner Kallweit <[email protected]>
leds: trigger: panic: Don't register panic notifier if creating the trigger failed
bo liu <[email protected]>
ALSA: hda/conexant: Fix headset auto detect fail in cx8070 and SN6140
Srinivasan Shanmugam <[email protected]>
drm/amdgpu: Drop 'fence' check in 'to_amdgpu_amdkfd_fence()'
Felix Kuehling <[email protected]>
drm/amdgpu: Let KFD sync with VM fences
Alexander Stein <[email protected]>
clk: imx: clk-imx8qxp: fix LVDS bypass, pixel and phy clocks
Kuan-Wei Chiu <[email protected]>
clk: imx: scu: Fix memory leak in __imx_clk_gpr_scu()
Josip Pavic <[email protected]>
drm/amd/display: make flip_timestamp_in_us a 64-bit variable
Werner Fischer <[email protected]>
watchdog: it87_wdt: Keep WDTCTRL bit 3 unmodified for IT8784/IT8786
Kuan-Wei Chiu <[email protected]>
clk: mmp: pxa168: Fix memory leak in pxa168_clk_init()
Kuan-Wei Chiu <[email protected]>
clk: hi3620: Fix memory leak in hi3620_mmc_clk_init()
Wang, Beyond <[email protected]>
drm/amdgpu: fix ftrace event amdgpu_bo_move always move on same heap
Rob Clark <[email protected]>
drm/msm/dpu: Ratelimit framedone timeout msgs
Kieran Bingham <[email protected]>
media: i2c: imx335: Fix hblank min/max values
Su Hui <[email protected]>
media: ddbridge: fix an error code problem in ddb_probe
Daniel Vacek <[email protected]>
IB/ipoib: Fix mcast list locking
Douglas Anderson <[email protected]>
drm/exynos: Call drm_atomic_helper_shutdown() at shutdown/unbind time
Chao Yu <[email protected]>
f2fs: fix to tag gcing flag on page during block migration
Tomi Valkeinen <[email protected]>
media: rkisp1: Drop IRQF_SHARED
Pierre-Louis Bossart <[email protected]>
ALSA: hda: intel-dspcfg: add filters for ARL-S and ARL
Pierre-Louis Bossart <[email protected]>
ALSA: hda: Intel: add HDA_ARL PCI ID support
Pierre-Louis Bossart <[email protected]>
PCI: add INTEL_HDA_ARL to pci_ids.h
Michael Tretter <[email protected]>
media: rockchip: rga: fix swizzling for RGB formats
Ghanshyam Agrawal <[email protected]>
media: stk1160: Fixed high volume of stk1160_dbg messages
Tomi Valkeinen <[email protected]>
drm/mipi-dsi: Fix detach call without attach
Tomi Valkeinen <[email protected]>
drm/framebuffer: Fix use of uninitialized variable
Tomi Valkeinen <[email protected]>
drm/drm_file: fix use of uninitialized variable
Jaegeuk Kim <[email protected]>
f2fs: fix write pointers on zoned device after roll forward
Meenakshikumar Somasundaram <[email protected]>
drm/amd/display: Fix tiled display misalignment
Jack Wang <[email protected]>
RDMA/IPoIB: Fix error code return in ipoib_mcast_join
Al Viro <[email protected]>
fast_dput(): handle underflows gracefully
Cristian Ciocaltea <[email protected]>
ASoC: doc: Fix undefined SND_SOC_DAPM_NOPM argument
Takashi Iwai <[email protected]>
ALSA: hda: Refer to correct stream index at loops
Chao Yu <[email protected]>
f2fs: fix to check return value of f2fs_reserve_new_block()
Suman Ghosh <[email protected]>
octeontx2-af: Fix max NPC MCAM entry check while validating ref_entry
Andrii Staikov <[email protected]>
i40e: Fix VF disable behavior to block all traffic
Lin Ma <[email protected]>
bridge: cfm: fix enum typo in br_cc_ccm_tx_parse
Frédéric Danis <[email protected]>
Bluetooth: L2CAP: Fix possible multiple reject send
Zijun Hu <[email protected]>
Bluetooth: qca: Set both WIDEBAND_SPEECH and LE_STATES quirks for QCA2066
Benjamin Berg <[email protected]>
wifi: cfg80211: free beacon_ies when overridden from hidden BSS
Su Hui <[email protected]>
wifi: rtlwifi: rtl8723{be,ae}: using calculate_bit_shift()
Alexander Tsoy <[email protected]>
ALSA: usb-audio: Add delay quirk for MOTU M Series 2nd revision
Mingyi Zhang <[email protected]>
libbpf: Fix NULL pointer dereference in bpf_object__collect_prog_relos
Zenm Chen <[email protected]>
wifi: rtl8xxxu: Add additional USB IDs for RTL8192EU devices
Mao Jinlong <[email protected]>
arm64: dts: qcom: msm8998: Fix 'out-ports' is a required property
Mao Jinlong <[email protected]>
arm64: dts: qcom: msm8996: Fix 'in-ports' is a required property
Alex Lyakas <[email protected]>
md: Whenassemble the array, consult the superblock of the freshest device
Christoph Hellwig <[email protected]>
block: prevent an integer overflow in bvec_try_merge_hw_page
Tobias Waldekranz <[email protected]>
net: dsa: mv88e6xxx: Fix mv88e6352_serdes_get_stats error path
Fabio Estevam <[email protected]>
ARM: dts: imx23/28: Fix the DMA controller node name
Fabio Estevam <[email protected]>
ARM: dts: imx23-sansa: Use preferred i2c-gpios properties
Fabio Estevam <[email protected]>
ARM: dts: imx27-apf27dev: Fix LED name
Fabio Estevam <[email protected]>
ARM: dts: imx25/27: Pass timing0
Fabio Estevam <[email protected]>
ARM: dts: imx25: Fix the iim compatible string
Kees Cook <[email protected]>
block/rnbd-srv: Check for unlikely string overflow
Shannon Nelson <[email protected]>
ionic: pass opcode to devcmd_wait
Fabio Estevam <[email protected]>
ARM: dts: imx1: Fix sram node
Fabio Estevam <[email protected]>
ARM: dts: imx27: Fix sram node
Fabio Estevam <[email protected]>
ARM: dts: imx: Use flash@0,0 pattern
Fabio Estevam <[email protected]>
ARM: dts: imx25/27-eukrea: Fix RTC node name
Johan Jonker <[email protected]>
ARM: dts: rockchip: fix rk3036 hdmi ports node
Hou Tao <[email protected]>
bpf: Set uattr->batch.count as zero before batched update or deletion
Hannes Reinecke <[email protected]>
scsi: libfc: Fix up timeout error in fc_fcp_rec_error()
Hannes Reinecke <[email protected]>
scsi: libfc: Don't schedule abort twice
Hou Tao <[email protected]>
bpf: Add map and need_defer parameters to .map_fd_put_ptr()
Minsuk Kang <[email protected]>
wifi: ath9k: Fix potential array-index-out-of-bounds read in ath9k_htc_txstatus()
Alexander Stein <[email protected]>
ARM: dts: imx7s: Fix nand-controller #size-cells
Alexander Stein <[email protected]>
ARM: dts: imx7s: Fix lcdif compatible
Alexander Stein <[email protected]>
ARM: dts: imx7d: Fix coresight funnel ports
ching Huang <[email protected]>
scsi: arcmsr: Support new PCI device IDs 1883 and 1886
Zhengchao Shao <[email protected]>
bonding: return -ENOMEM instead of BUG in alb_upper_dev_walk
Ido Schimmel <[email protected]>
PCI: Add no PM reset quirk for NVIDIA Spectrum devices
Justin Tee <[email protected]>
scsi: lpfc: Fix possible file string name overflow when updating firmware
Yafang Shao <[email protected]>
selftests/bpf: Fix issues in setup_classid_environment()
Yonghong Song <[email protected]>
selftests/bpf: Fix pyperf180 compilation failure with clang18
Andrii Nakryiko <[email protected]>
selftests/bpf: satisfy compiler by having explicit return in btf test
Shiji Yang <[email protected]>
wifi: rt2x00: restart beacon queue when hardware reset
Baokun Li <[email protected]>
ext4: avoid online resizing failures due to oversized flex bg
Baokun Li <[email protected]>
ext4: remove unnecessary check from alloc_flex_gd()
Baokun Li <[email protected]>
ext4: unify the type of flexbg_size to unsigned int
Ye Bin <[email protected]>
ext4: fix inconsistent between segment fstrim and full fstrim
Gabriel Krisman Bertazi <[email protected]>
ecryptfs: Reject casefold directory inodes
Anna Schumaker <[email protected]>
SUNRPC: Fix a suspicious RCU usage warning
Heiko Carstens <[email protected]>
KVM: s390: fix setting of fpc register
Heiko Carstens <[email protected]>
s390/ptrace: handle setting of fpc register correctly
Arnd Bergmann <[email protected]>
arch: consolidate arch_irq_work_raise prototypes
Edward Adam Davis <[email protected]>
jfs: fix array-index-out-of-bounds in diNewExt
Oleg Nesterov <[email protected]>
rxrpc_find_service_conn_rcu: fix the usage of read_seqbegin_or_lock()
Oleg Nesterov <[email protected]>
afs: fix the usage of read_seqbegin_or_lock() in afs_find_server*()
Oleg Nesterov <[email protected]>
afs: fix the usage of read_seqbegin_or_lock() in afs_lookup_volume_rcu()
Thomas Bourgoin <[email protected]>
crypto: stm32/crc32 - fix parsing list of devices
Bharat Bhushan <[email protected]>
crypto: octeontx2 - Fix cptvf driver cleanup
Weichen Chen <[email protected]>
pstore/ram: Fix crash when setting number of cpus to an odd number
Edward Adam Davis <[email protected]>
jfs: fix uaf in jfs_evict_inode
Manas Ghandat <[email protected]>
jfs: fix array-index-out-of-bounds in dbAdjTree
Manas Ghandat <[email protected]>
jfs: fix slab-out-of-bounds Read in dtSearch
Osama Muhammad <[email protected]>
UBSAN: array-index-out-of-bounds in dtSplitRoot
Osama Muhammad <[email protected]>
FS:JFS:UBSAN:array-index-out-of-bounds in dbAdjTree
Shuai Xue <[email protected]>
ACPI: APEI: set memory failure flags as MF_ACTION_REQUIRED on synchronous events
Mukesh Ojha <[email protected]>
PM / devfreq: Synchronize devfreq_monitor_[start/stop]
Prarit Bhargava <[email protected]>
ACPI: extlog: fix NULL pointer dereference check
Dmitry Antipov <[email protected]>
PNP: ACPI: fix fortify warning
Yuluo Qiu <[email protected]>
ACPI: video: Add quirk for the Colorful X15 AT 23 Laptop
Chris Riches <[email protected]>
audit: Send netlink ACK before setting connection in auditd_set
Rui Zhang <[email protected]>
regulator: core: Only increment use_count when enable_count changes
Andrzej Hajda <[email protected]>
debugobjects: Stop accessing objects after releasing hash bucket lock
Greg KH <[email protected]>
perf/core: Fix narrow startup race when creating the perf nr_addr_filters sysfs file
Zhiquan Li <[email protected]>
x86/mce: Mark fatal MCE's page as poison to avoid panic in the kdump kernel
Naveen N Rao <[email protected]>
powerpc/lib: Validate size for vector operations
Stephen Rothwell <[email protected]>
powerpc: pmd_move_must_withdraw() is only needed for CONFIG_TRANSPARENT_HUGEPAGE
Jun'ichi Nomura <[email protected]>
x86/boot: Ignore NMIs during very early boot
Michael Ellerman <[email protected]>
powerpc/64s: Fix CONFIG_NUMA=n build due to create_section_mapping()
Michael Ellerman <[email protected]>
powerpc/mm: Fix build failures due to arch_reserved_kernel_pages()
Michael Ellerman <[email protected]>
powerpc: Fix build error due to is_valid_bugaddr()
Mark Rutland <[email protected]>
drivers/perf: pmuv3: don't expose SW_INCR event in sysfs
Huang Shijie <[email protected]>
arm64: irq: set the correct node for VMAP stack
Kunwu Chan <[email protected]>
powerpc/mm: Fix null-pointer dereference in pgtable_cache_add
Richard Palethorpe <[email protected]>
x86/entry/ia32: Ensure s32 is sign extended to s64
Tim Chen <[email protected]>
tick/sched: Preserve number of idle sleeps across CPU hotplug events
Xi Ruoyao <[email protected]>
mips: Call lose_fpu(0) before initializing fcr31 in mips_set_personality_nan
Kamal Dasu <[email protected]>
spi: bcm-qspi: fix SFDP BFPT read by usig mspi read
Li Lingfeng <[email protected]>
block: Move checking GENHD_FL_NO_PART to bdev_add_partition()
Wenhua Lin <[email protected]>
gpio: eic-sprd: Clear interrupt after set the interrupt type
Fedor Pchelkin <[email protected]>
drm/exynos: gsc: minor fix for loop iteration in gsc_runtime_resume
Arnd Bergmann <[email protected]>
drm/exynos: fix accidental on-stack copy of exynos_drm_plane
Markus Niebel <[email protected]>
drm: panel-simple: add missing bus flags for Tianma tm070jvhg[30/33]
Rafael J. Wysocki <[email protected]>
cpufreq: intel_pstate: Refine computation of P-state for given frequency
Rafael J. Wysocki <[email protected]>
cpufreq: intel_pstate: Drop redundant intel_pstate_get_hwp_cap() call
Lin Ma <[email protected]>
ksmbd: fix global oob in ksmbd_nl_policy
Chuck Lever <[email protected]>
NFSD: Add documenting comment for nfsd4_release_lockowner()
Chuck Lever <[email protected]>
NFSD: Modernize nfsd4_release_lockowner()
Josef Bacik <[email protected]>
btrfs: add definition for EXTENT_TREE_V2
Christian Marangi <[email protected]>
PM / devfreq: Fix buffer overflow in trans_stat_show
Charan Teja Kalla <[email protected]>
mm/sparsemem: fix race in accessing memory_section->usage
Rolf Eike Beer <[email protected]>
mm: use __pfn_to_section() instead of open coding it
Zheng Wang <[email protected]>
media: mtk-jpeg: Fix use after free bug due to error path handling in mtk_jpeg_dec_device_run
Johan Hovold <[email protected]>
ARM: dts: qcom: sdx55: fix USB SS wakeup
Johan Hovold <[email protected]>
ARM: dts: qcom: sdx55: fix USB DP/DM HS PHY interrupts
Johan Hovold <[email protected]>
ARM: dts: qcom: sdx55: fix pdc '#interrupt-cells'
Paul Cercueil <[email protected]>
ARM: dts: samsung: exynos4210-i9100: Unconditionally enable LDO12
Johan Hovold <[email protected]>
ARM: dts: qcom: sdx55: fix USB wakeup interrupt types
Lukas Schauer <[email protected]>
pipe: wakeup wr_wait after setting max_usage
Max Kellermann <[email protected]>
fs/pipe: move check to pipe_has_watch_queue()
Krishna chaitanya chundru <[email protected]>
bus: mhi: host: Add alignment check for event ring read pointer
Manivannan Sadhasivam <[email protected]>
bus: mhi: host: Rename "struct mhi_tre" to "struct mhi_ring_element"
Rafael J. Wysocki <[email protected]>
PM: sleep: Fix possible deadlocks in core system-wide PM code
Li zeming <[email protected]>
PM: core: Remove unnecessary (void *) conversions
Dan Carpenter <[email protected]>
drm/bridge: nxp-ptn3460: simplify some error checking
Tomi Valkeinen <[email protected]>
drm/tidss: Fix atomic_flush check
Dan Carpenter <[email protected]>
drm/bridge: nxp-ptn3460: fix i2c_master_send() error checking
Ville Syrjälä <[email protected]>
drm: Don't unref the same fb many times by mistake due to deadlock handling
Mario Limonciello <[email protected]>
gpiolib: acpi: Ignore touchpad wakeup on GPD G1619-04
Dave Chinner <[email protected]>
xfs: read only mounts with fsopen mount API are busted
Cristian Marussi <[email protected]>
firmware: arm_scmi: Check mailbox/SMT channel for consistency
Florian Westphal <[email protected]>
netfilter: nf_tables: reject QUEUE/DROP verdict parameters
Pablo Neira Ayuso <[email protected]>
netfilter: nft_chain_filter: handle NETDEV_UNREGISTER for inet/ingress basechain
Michael Kelley <[email protected]>
hv_netvsc: Calculate correct ring size when PAGE_SIZE is not 4 Kbytes
Emmanuel Grumbach <[email protected]>
wifi: iwlwifi: fix a memory corruption
Bernd Edlinger <[email protected]>
exec: Fix error handling in begin_new_exec()
Ilya Dryomov <[email protected]>
rbd: don't move requests to the running list on errors
Omar Sandoval <[email protected]>
btrfs: don't abort filesystem when attempting to snapshot deleted subvolume
Qu Wenruo <[email protected]>
btrfs: defrag: reject unknown flags of btrfs_ioctl_defrag_range_args
David Sterba <[email protected]>
btrfs: don't warn if discard range is not aligned to sector
Chung-Chiang Cheng <[email protected]>
btrfs: tree-checker: fix inline ref size in error messages
Fedor Pchelkin <[email protected]>
btrfs: ref-verify: free ref cache before clearing mount opt
Omar Sandoval <[email protected]>
btrfs: avoid copying BTRFS_ROOT_SUBVOL_DEAD flag to snapshot of subvolume being deleted
Filipe Manana <[email protected]>
btrfs: fix race between reading a directory and adding entries to it
Filipe Manana <[email protected]>
btrfs: refresh dir last index during a rewinddir(3) call
Filipe Manana <[email protected]>
btrfs: set last dir index to the current last index when opening dir
Filipe Manana <[email protected]>
btrfs: fix infinite directory reads
Shenwei Wang <[email protected]>
net: fec: fix the unhandled context fault from smmu
Zhipeng Lu <[email protected]>
fjes: fix memleaks in fjes_hw_setup
Jakub Kicinski <[email protected]>
selftests: netdevsim: fix the udp_tunnel_nic test
Jenishkumar Maheshbhai Patel <[email protected]>
net: mvpp2: clear BM pool before initialization
Bernd Edlinger <[email protected]>
net: stmmac: Wait a bit for the reset to take effect
Pablo Neira Ayuso <[email protected]>
netfilter: nf_tables: validate NFPROTO_* family
Florian Westphal <[email protected]>
netfilter: nf_tables: restrict anonymous set and map names to 16 bytes
Florian Westphal <[email protected]>
netfilter: nft_limit: reject configurations that cause integer overflow
Kees Cook <[email protected]>
overflow: Allow mixed type arguments
Dinghao Liu <[email protected]>
net/mlx5e: fix a potential double-free in fs_any_create_groups
Zhipeng Lu <[email protected]>
net/mlx5e: fix a double-free in arfs_create_groups
Yevgeny Kliteynik <[email protected]>
net/mlx5: DR, Can't go to uplink vport on RX rule
Shun Hao <[email protected]>
net/mlx5: DR, Align mlx5dv_dr API vport action with FW behavior
Yevgeny Kliteynik <[email protected]>
net/mlx5: DR, Replace local WIRE_PORT macro with the existing MLX5_VPORT_UPLINK
Yevgeny Kliteynik <[email protected]>
net/mlx5: DR, Use the right GVMI number for drop action
Zhengchao Shao <[email protected]>
ipv6: init the accept_queue's spinlocks in inet6_create
Zhengchao Shao <[email protected]>
netlink: fix potential sleeping issue in mqueue_flush_file
Salvatore Dipietro <[email protected]>
tcp: Add memory barrier to tcp_push()
David Howells <[email protected]>
afs: Hide silly-rename files from userspace
Petr Pavlu <[email protected]>
tracing: Ensure visibility when inserting an element into tracing_map
Sharath Srinivasan <[email protected]>
net/rds: Fix UBSAN: array-index-out-of-bounds in rds_cmsg_recv
Kuniyuki Iwashima <[email protected]>
llc: Drop support for ETH_P_TR_802_2.
Eric Dumazet <[email protected]>
llc: make llc_ui_sendmsg() more robust against bonding changes
Lin Ma <[email protected]>
vlan: skip nested type that is not IFLA_VLAN_QOS_MAPPING
Michael Chan <[email protected]>
bnxt_en: Wait for FLR to complete during probe
Zhengchao Shao <[email protected]>
tcp: make sure init the accept_queue's spinlocks once
Wen Gu <[email protected]>
net/smc: fix illegal rmb_desc access in SMC-D connection dump
Namjae Jeon <[email protected]>
ksmbd: Add missing set_freezable() for freezable kthread
Namjae Jeon <[email protected]>
ksmbd: send lease break notification on FILE_RENAME_INFORMATION
Namjae Jeon <[email protected]>
ksmbd: don't increment epoch if current state and request state are same
Namjae Jeon <[email protected]>
ksmbd: fix potential circular locking issue in smb2_set_ea()
Namjae Jeon <[email protected]>
ksmbd: set v2 lease version on lease upgrade
Al Viro <[email protected]>
rename(): fix the locking of subdirectories
Zhihao Cheng <[email protected]>
ubifs: ubifs_symlink: Fix memleak of inode->i_link in error path
Dave Airlie <[email protected]>
nouveau/vmm: don't set addr on the fail path to avoid warning
Mario Limonciello <[email protected]>
rtc: Adjust failure return code for cmos_set_alarm()
Andy Shevchenko <[email protected]>
mmc: mmc_spi: remove custom DMA mapped buffers
Avri Altman <[email protected]>
mmc: core: Use mrq.sbc in close-ended ffu
Vegard Nossum <[email protected]>
scripts/get_abi: fix source path leak
Alfred Piccioni <[email protected]>
lsm: new security_file_ioctl_compat() hook
Johan Hovold <[email protected]>
arm64: dts: qcom: sdm845: fix USB DP/DM HS PHY interrupts
Johan Hovold <[email protected]>
arm64: dts: qcom: sm8150: fix USB wakeup interrupt types
Johan Hovold <[email protected]>
arm64: dts: qcom: sdm845: fix USB wakeup interrupt types
Johan Hovold <[email protected]>
arm64: dts: qcom: sc7180: fix USB wakeup interrupt types
Rafael J. Wysocki <[email protected]>
async: Introduce async_schedule_dev_nocall()
Rafael J. Wysocki <[email protected]>
async: Split async_schedule_node_domain()
Helge Deller <[email protected]>
parisc/firmware: Fix F-extend for PDC addresses
Bhaumik Bhatt <[email protected]>
bus: mhi: host: Add spinlock to protect WP access when queueing TREs
Qiang Yu <[email protected]>
bus: mhi: host: Drop chan lock before queuing buffers
Serge Semin <[email protected]>
mips: Fix max_mapnr being uninitialized on early stages
Bingbu Cao <[email protected]>
media: ov9734: Enable runtime PM before registering async sub-device
Xiaolei Wang <[email protected]>
rpmsg: virtio: Free driver_override when rpmsg_remove()
Bingbu Cao <[email protected]>
media: imx355: Enable runtime PM before registering async sub-device
Herbert Xu <[email protected]>
crypto: s390/aes - Fix buffer overread in CTR mode
Herbert Xu <[email protected]>
hwrng: core - Fix page fault dead lock on mmap-ed hwrng
Hongchen Zhang <[email protected]>
PM: hibernate: Enforce ordering during image compression/decompression
Herbert Xu <[email protected]>
crypto: api - Disallow identical driver names
David Disseldorp <[email protected]>
btrfs: sysfs: validate scrub_speed_max value
Suraj Jitindar Singh <[email protected]>
ext4: allow for the last group to be marked as trimmed
Jonathan Cameron <[email protected]>
iio:adc:ad7091r: Move exports into IIO_AD7091R namespace.
Bart Van Assche <[email protected]>
scsi: ufs: core: Remove the ufshcd_hba_exit() call from ufshcd_async_scan()
Bart Van Assche <[email protected]>
scsi: ufs: core: Simplify power management during async scan
Amelie Delaunay <[email protected]>
dmaengine: fix NULL pointer in channel unregistration function
Marcelo Schmitt <[email protected]>
iio: adc: ad7091r: Enable internal vref if external vref is not supplied
Marcelo Schmitt <[email protected]>
iio: adc: ad7091r: Allow users to configure device events
Marcelo Schmitt <[email protected]>
iio: adc: ad7091r: Set alert bit in config register
Namjae Jeon <[email protected]>
ksmbd: only v2 leases handle the directory
Namjae Jeon <[email protected]>
ksmbd: fix UAF issue in ksmbd_tcp_new_connection()
Namjae Jeon <[email protected]>
ksmbd: validate mech token in session setup
Namjae Jeon <[email protected]>
ksmbd: don't allow O_TRUNC open on read-only share
Fedor Pchelkin <[email protected]>
ksmbd: free ppace array on error in parse_dacl
-------------
Diffstat:
Documentation/ABI/testing/sysfs-class-devfreq | 3 + Documentation/ABI/testing/sysfs-class-net-queues | 22 +-- .../ABI/testing/sysfs-class-net-statistics | 48 ++--- Documentation/arm64/silicon-errata.rst | 7 + .../bindings/net/wireless/marvell-8xxx.txt | 4 +- Documentation/filesystems/directory-locking.rst | 29 +-- Documentation/filesystems/locking.rst | 5 +- Documentation/filesystems/porting.rst | 18 ++ Documentation/sound/soc/dapm.rst | 2 +- Makefile | 4 +- arch/Kconfig | 1 + arch/arm/boot/dts/exynos4210-i9100.dts | 8 + arch/arm/boot/dts/imx1-ads.dts | 2 +- arch/arm/boot/dts/imx1-apf9328.dts | 2 +- arch/arm/boot/dts/imx1.dtsi | 5 +- arch/arm/boot/dts/imx23-sansa.dts | 12 +- arch/arm/boot/dts/imx23.dtsi | 2 +- arch/arm/boot/dts/imx25-eukrea-cpuimx25.dtsi | 2 +- .../imx25-eukrea-mbimxsd25-baseboard-cmo-qvga.dts | 2 +- .../imx25-eukrea-mbimxsd25-baseboard-dvi-svga.dts | 2 +- .../imx25-eukrea-mbimxsd25-baseboard-dvi-vga.dts | 2 +- arch/arm/boot/dts/imx25-pdk.dts | 2 +- arch/arm/boot/dts/imx25.dtsi | 2 +- arch/arm/boot/dts/imx27-apf27dev.dts | 4 +- arch/arm/boot/dts/imx27-eukrea-cpuimx27.dtsi | 4 +- .../boot/dts/imx27-eukrea-mbimxsd27-baseboard.dts | 2 +- arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts | 2 +- arch/arm/boot/dts/imx27-phytec-phycore-rdk.dts | 2 +- arch/arm/boot/dts/imx27-phytec-phycore-som.dtsi | 2 +- arch/arm/boot/dts/imx27.dtsi | 3 + arch/arm/boot/dts/imx28.dtsi | 2 +- arch/arm/boot/dts/imx7d.dtsi | 3 - arch/arm/boot/dts/imx7s.dtsi | 10 +- arch/arm/boot/dts/qcom-sdx55.dtsi | 10 +- arch/arm/boot/dts/rk3036.dtsi | 14 +- arch/arm64/boot/dts/qcom/msm8996.dtsi | 21 +++ arch/arm64/boot/dts/qcom/msm8998.dtsi | 32 ++-- arch/arm64/boot/dts/qcom/sc7180.dtsi | 4 +- arch/arm64/boot/dts/qcom/sdm845.dtsi | 16 +- arch/arm64/boot/dts/qcom/sm8150.dtsi | 8 +- arch/arm64/include/asm/cputype.h | 4 + arch/arm64/include/asm/irq_work.h | 2 - arch/arm64/kernel/cpu_errata.c | 3 + arch/arm64/kernel/irq.c | 7 +- arch/arm64/kernel/perf_event.c | 6 +- arch/csky/include/asm/irq_work.h | 2 +- arch/mips/include/asm/checksum.h | 3 +- arch/mips/kernel/elf.c | 6 + arch/mips/mm/init.c | 12 +- arch/parisc/kernel/firmware.c | 4 +- arch/powerpc/include/asm/irq_work.h | 1 - arch/powerpc/include/asm/mmu.h | 4 + arch/powerpc/include/asm/mmzone.h | 8 - arch/powerpc/kernel/interrupt_64.S | 4 +- arch/powerpc/kernel/traps.c | 2 + arch/powerpc/lib/sstep.c | 10 + arch/powerpc/mm/book3s64/pgtable.c | 2 + arch/powerpc/mm/init-common.c | 5 +- arch/powerpc/mm/kasan/kasan_init_32.c | 1 + arch/powerpc/mm/mmu_decl.h | 5 + arch/riscv/include/asm/irq_work.h | 2 +- arch/s390/crypto/aes_s390.c | 4 +- arch/s390/crypto/paes_s390.c | 4 +- arch/s390/include/asm/irq_work.h | 2 - arch/s390/kernel/ptrace.c | 6 +- arch/s390/kvm/kvm-s390.c | 5 - arch/um/drivers/net_kern.c | 2 +- arch/um/include/shared/kern_util.h | 2 +- arch/um/kernel/process.c | 2 +- arch/um/kernel/time.c | 32 +++- arch/um/os-Linux/helper.c | 6 +- arch/um/os-Linux/util.c | 19 +- arch/x86/Kconfig.cpu | 2 +- arch/x86/boot/compressed/ident_map_64.c | 5 + arch/x86/boot/compressed/idt_64.c | 1 + arch/x86/boot/compressed/idt_handlers_64.S | 1 + arch/x86/boot/compressed/misc.h | 1 + arch/x86/include/asm/irq_work.h | 1 - arch/x86/include/asm/syscall_wrapper.h | 25 ++- arch/x86/kernel/cpu/mce/core.c | 16 ++ arch/x86/mm/ident_map.c | 23 ++- block/bio.c | 2 +- block/blk-iocost.c | 7 + block/blk-mq.c | 16 ++ block/ioctl.c | 2 - block/partitions/core.c | 5 + crypto/algapi.c | 1 + drivers/acpi/acpi_extlog.c | 5 +- drivers/acpi/acpi_video.c | 9 + drivers/acpi/apei/ghes.c | 29 ++- drivers/android/binder.c | 10 + drivers/atm/idt77252.c | 2 + drivers/base/arch_numa.c | 2 +- drivers/base/power/domain.c | 2 +- drivers/base/power/main.c | 160 ++++++++-------- drivers/base/power/runtime.c | 5 + drivers/block/rbd.c | 22 ++- drivers/block/rnbd/rnbd-srv.c | 19 +- drivers/bluetooth/hci_qca.c | 1 + drivers/bus/mhi/host/init.c | 6 +- drivers/bus/mhi/host/internal.h | 2 +- drivers/bus/mhi/host/main.c | 49 +++-- drivers/bus/moxtet.c | 7 + drivers/char/hw_random/core.c | 36 ++-- drivers/clk/hisilicon/clk-hi3620.c | 4 +- drivers/clk/imx/clk-imx8qxp.c | 24 ++- drivers/clk/imx/clk-scu.c | 4 +- drivers/clk/mmp/clk-of-pxa168.c | 3 + drivers/cpufreq/intel_pstate.c | 67 ++++--- drivers/crypto/ccp/sev-dev.c | 10 +- drivers/crypto/marvell/octeontx2/otx2_cptlf.c | 6 +- drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c | 3 + drivers/crypto/stm32/stm32-crc32.c | 2 +- drivers/devfreq/devfreq.c | 83 ++++++--- drivers/dma-buf/dma-fence-unwrap.c | 176 ++++++++++++++++++ drivers/dma-buf/sync_file.c | 9 +- drivers/dma/dmaengine.c | 3 + drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c | 10 +- drivers/dma/fsl-qdma.c | 27 +-- drivers/dma/ti/k3-udma.c | 10 +- drivers/firewire/core-device.c | 7 +- drivers/firmware/arm_scmi/common.h | 1 + drivers/firmware/arm_scmi/mailbox.c | 14 ++ drivers/firmware/arm_scmi/shmem.c | 6 + drivers/gpio/gpio-eic-sprd.c | 32 +++- drivers/gpio/gpiolib-acpi.c | 14 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 9 +- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 13 +- drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 5 +- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 36 ++-- drivers/gpu/drm/amd/display/dc/core/dc.c | 4 + drivers/gpu/drm/amd/display/dc/dc_hw_types.h | 2 +- .../gpu/drm/amd/display/dc/dcn30/dcn30_resource.c | 6 +- .../drm/amd/display/dc/dcn301/dcn301_resource.c | 6 +- .../drm/amd/display/dc/dcn302/dcn302_resource.c | 6 +- .../gpu/drm/amd/display/dc/dcn31/dcn31_resource.c | 6 +- .../amd/pm/powerplay/hwmgr/process_pptables_v1_0.c | 2 +- drivers/gpu/drm/bridge/nxp-ptn3460.c | 6 +- drivers/gpu/drm/drm_fb_helper.c | 11 +- drivers/gpu/drm/drm_file.c | 2 +- drivers/gpu/drm/drm_framebuffer.c | 2 +- drivers/gpu/drm/drm_mipi_dsi.c | 17 +- drivers/gpu/drm/drm_plane.c | 1 + drivers/gpu/drm/drm_prime.c | 2 +- drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 4 +- drivers/gpu/drm/exynos/exynos_drm_drv.c | 11 ++ drivers/gpu/drm/exynos/exynos_drm_fimd.c | 4 +- drivers/gpu/drm/exynos/exynos_drm_gsc.c | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 5 +- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 1 + drivers/gpu/drm/msm/dp/dp_link.c | 12 +- drivers/gpu/drm/msm/dp/dp_reg.h | 3 + drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 4 + drivers/gpu/drm/nouveau/nouveau_vmm.c | 3 + drivers/gpu/drm/panel/panel-simple.c | 2 + drivers/gpu/drm/scheduler/sched_main.c | 3 +- drivers/gpu/drm/tidss/tidss_crtc.c | 10 +- drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 8 +- drivers/hid/hid-apple.c | 33 +++- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-picolcd_fb.c | 2 +- drivers/hid/hid-quirks.c | 1 + drivers/hid/i2c-hid/i2c-hid-of.c | 1 + drivers/hid/wacom_sys.c | 63 +++++-- drivers/hid/wacom_wac.c | 9 +- drivers/hwmon/aspeed-pwm-tacho.c | 7 + drivers/hwmon/coretemp.c | 40 ++-- drivers/i2c/busses/i2c-i801.c | 19 +- drivers/i3c/master/i3c-master-cdns.c | 7 +- drivers/iio/accel/Kconfig | 2 + drivers/iio/adc/ad7091r-base.c | 173 ++++++++++++++++- drivers/iio/adc/ad7091r-base.h | 8 + drivers/iio/adc/ad7091r5.c | 29 +-- drivers/iio/industrialio-core.c | 5 +- drivers/iio/light/hid-sensor-als.c | 1 + drivers/iio/magnetometer/rm3100-core.c | 10 +- drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 7 +- drivers/input/keyboard/atkbd.c | 13 +- drivers/input/serio/i8042-acpipnpio.h | 6 + drivers/irqchip/irq-brcmstb-l2.c | 5 +- drivers/irqchip/irq-gic-v3-its.c | 22 ++- drivers/leds/trigger/ledtrig-panic.c | 5 +- drivers/mailbox/arm_mhuv2.c | 3 +- drivers/md/dm-core.h | 2 + drivers/md/dm-ioctl.c | 3 +- drivers/md/dm-table.c | 9 +- drivers/md/md.c | 54 +++++- drivers/media/i2c/imx335.c | 4 +- drivers/media/i2c/imx355.c | 12 +- drivers/media/i2c/ov9734.c | 19 +- drivers/media/pci/ddbridge/ddbridge-main.c | 2 +- drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 6 +- drivers/media/platform/rockchip/rga/rga.c | 15 +- drivers/media/rc/bpf-lirc.c | 6 +- drivers/media/rc/ir_toy.c | 2 + drivers/media/rc/lirc_dev.c | 5 +- drivers/media/rc/rc-core-priv.h | 2 +- drivers/media/usb/stk1160/stk1160-video.c | 5 +- drivers/mfd/Kconfig | 1 + drivers/misc/fastrpc.c | 2 +- drivers/misc/lis3lv02d/lis3lv02d_i2c.c | 1 + drivers/misc/lkdtm/bugs.c | 2 +- drivers/mmc/core/block.c | 46 ++++- drivers/mmc/core/slot-gpio.c | 6 +- drivers/mmc/host/mmc_spi.c | 186 +------------------ drivers/net/bonding/bond_alb.c | 3 +- drivers/net/dsa/mv88e6xxx/chip.h | 4 +- drivers/net/dsa/mv88e6xxx/serdes.c | 8 +- drivers/net/dsa/mv88e6xxx/serdes.h | 8 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 5 + drivers/net/ethernet/broadcom/genet/bcmgenet.c | 22 +-- drivers/net/ethernet/broadcom/genet/bcmgenet.h | 3 + drivers/net/ethernet/broadcom/genet/bcmmii.c | 6 + drivers/net/ethernet/freescale/fec_main.c | 2 + drivers/net/ethernet/google/gve/gve_tx_dqo.c | 5 +- drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 32 ++++ drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 1 + drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c | 36 ++-- drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c | 61 +++--- drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | 177 +++++++++--------- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 44 ++--- drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.c | 34 ++-- drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h | 1 - drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 105 +++++------ drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 51 +----- drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c | 44 ++--- drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 149 +++++++-------- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 27 ++- .../net/ethernet/marvell/octeontx2/af/rvu_npc.c | 13 +- .../ethernet/marvell/octeontx2/nic/otx2_common.c | 14 +- .../mellanox/mlx5/core/en/fs_tt_redirect.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c | 26 +-- .../mellanox/mlx5/core/steering/dr_action.c | 19 +- .../mellanox/mlx5/core/steering/dr_domain.c | 2 +- .../ethernet/mellanox/mlx5/core/steering/dr_rule.c | 4 +- .../mellanox/mlx5/core/steering/dr_types.h | 7 +- .../ethernet/netronome/nfp/flower/tunnel_conf.c | 2 +- .../ethernet/netronome/nfp/nfpcore/nfp6000_pcie.c | 6 +- drivers/net/ethernet/pensando/ionic/ionic_dev.c | 1 + drivers/net/ethernet/pensando/ionic/ionic_dev.h | 1 + drivers/net/ethernet/pensando/ionic/ionic_main.c | 2 +- drivers/net/ethernet/stmicro/stmmac/common.h | 1 + drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 3 + .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 58 +++++- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 + drivers/net/ethernet/ti/cpsw.c | 2 + drivers/net/ethernet/ti/cpsw_new.c | 3 + drivers/net/fjes/fjes_hw.c | 37 +++- drivers/net/hyperv/netvsc.c | 5 +- drivers/net/hyperv/netvsc_drv.c | 4 +- drivers/net/ppp/ppp_async.c | 4 + drivers/net/virtio_net.c | 9 +- drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 5 +- drivers/net/wireless/intel/iwlwifi/fw/acpi.c | 12 +- drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c | 2 +- drivers/net/wireless/marvell/mwifiex/Kconfig | 5 +- drivers/net/wireless/marvell/mwifiex/sdio.c | 67 ++++++- drivers/net/wireless/marvell/mwifiex/sdio.h | 8 + drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 3 + drivers/net/wireless/ralink/rt2x00/rt2x00mac.c | 11 ++ .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 12 ++ .../net/wireless/realtek/rtlwifi/rtl8723ae/phy.c | 6 +- .../net/wireless/realtek/rtlwifi/rtl8723be/phy.c | 4 +- drivers/net/xen-netback/netback.c | 100 +++++----- drivers/of/property.c | 2 +- drivers/of/unittest.c | 12 +- drivers/pci/pci.h | 2 +- drivers/pci/pcie/aer.c | 9 +- drivers/pci/quirks.c | 24 ++- drivers/pci/switch/switchtec.c | 25 ++- drivers/phy/renesas/phy-rcar-gen3-usb2.c | 4 - drivers/phy/ti/phy-omap-usb2.c | 4 +- drivers/pnp/pnpacpi/rsparser.c | 12 +- drivers/regulator/core.c | 52 +++--- drivers/rpmsg/virtio_rpmsg_bus.c | 1 + drivers/rtc/rtc-cmos.c | 4 +- drivers/s390/net/qeth_l3_main.c | 9 +- drivers/scsi/arcmsr/arcmsr.h | 4 + drivers/scsi/arcmsr/arcmsr_hba.c | 6 + drivers/scsi/fcoe/fcoe_ctlr.c | 20 +- drivers/scsi/isci/request.c | 2 +- drivers/scsi/libfc/fc_fcp.c | 18 +- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_init.c | 4 +- drivers/scsi/scsi_error.c | 9 +- drivers/scsi/scsi_lib.c | 4 +- drivers/scsi/scsi_priv.h | 2 +- drivers/scsi/storvsc_drv.c | 12 +- drivers/scsi/ufs/ufshcd.c | 14 +- drivers/spi/spi-bcm-qspi.c | 4 +- drivers/spi/spi-ppc4xx.c | 5 - drivers/staging/fbtft/fbtft-core.c | 14 +- drivers/staging/iio/impedance-analyzer/ad5933.c | 2 +- drivers/tty/serial/8250/8250_exar.c | 13 ++ drivers/tty/serial/max310x.c | 33 +++- drivers/tty/tty_ioctl.c | 4 +- drivers/usb/core/hub.c | 34 ++-- drivers/usb/dwc3/core.h | 1 + drivers/usb/dwc3/ep0.c | 27 ++- drivers/usb/dwc3/gadget.c | 162 +++++++++++++--- drivers/usb/dwc3/gadget.h | 3 + drivers/usb/dwc3/host.c | 4 +- drivers/usb/gadget/function/f_mass_storage.c | 20 +- drivers/usb/host/xhci-plat.c | 3 + drivers/usb/serial/cp210x.c | 1 + drivers/usb/serial/option.c | 1 + drivers/usb/serial/qcserial.c | 2 + drivers/usb/typec/ucsi/ucsi_acpi.c | 17 +- drivers/vhost/vhost.c | 5 +- drivers/video/fbdev/broadsheetfb.c | 14 +- drivers/video/fbdev/core/fb_defio.c | 168 +++++++++++++---- drivers/video/fbdev/core/fbmem.c | 4 + drivers/video/fbdev/hecubafb.c | 3 +- drivers/video/fbdev/hyperv_fb.c | 8 +- drivers/video/fbdev/metronomefb.c | 14 +- drivers/video/fbdev/sh_mobile_lcdcfb.c | 20 +- drivers/video/fbdev/smscufx.c | 9 +- drivers/video/fbdev/ssd1307fb.c | 3 +- drivers/video/fbdev/udlfb.c | 10 +- drivers/video/fbdev/xen-fbfront.c | 8 +- drivers/watchdog/it87_wdt.c | 14 +- drivers/xen/gntdev-dmabuf.c | 54 +++--- fs/afs/callback.c | 3 +- fs/afs/dir.c | 8 + fs/afs/server.c | 7 +- fs/btrfs/ctree.h | 22 +++ fs/btrfs/delayed-inode.c | 5 +- fs/btrfs/delayed-inode.h | 1 + fs/btrfs/disk-io.c | 13 +- fs/btrfs/extent-tree.c | 3 +- fs/btrfs/inode.c | 172 ++++++++++------- fs/btrfs/ioctl.c | 12 ++ fs/btrfs/qgroup.c | 14 ++ fs/btrfs/ref-verify.c | 6 +- fs/btrfs/send.c | 2 +- fs/btrfs/sysfs.c | 9 +- fs/btrfs/tree-checker.c | 2 +- fs/ceph/caps.c | 12 +- fs/cifs/smb2misc.c | 2 +- fs/cifs/smb2ops.c | 14 +- fs/cifs/smb2pdu.c | 13 +- fs/cifs/smb2pdu.h | 42 +++-- fs/dcache.c | 7 +- fs/ecryptfs/inode.c | 8 + fs/exec.c | 3 + fs/ext4/mballoc.c | 26 ++- fs/ext4/move_extent.c | 6 +- fs/ext4/resize.c | 37 ++-- fs/f2fs/compress.c | 4 +- fs/f2fs/file.c | 2 + fs/f2fs/recovery.c | 25 ++- fs/hugetlbfs/inode.c | 13 +- fs/ioctl.c | 3 +- fs/jfs/jfs_dmap.c | 57 +++--- fs/jfs/jfs_dtree.c | 7 +- fs/jfs/jfs_imap.c | 3 + fs/jfs/jfs_mount.c | 6 +- fs/kernfs/dir.c | 12 ++ fs/ksmbd/asn1.c | 5 + fs/ksmbd/connection.c | 7 +- fs/ksmbd/connection.h | 2 +- fs/ksmbd/ksmbd_netlink.h | 3 +- fs/ksmbd/oplock.c | 22 ++- fs/ksmbd/smb2pdu.c | 53 +++--- fs/ksmbd/smbacl.c | 11 +- fs/ksmbd/transport_ipc.c | 4 +- fs/ksmbd/transport_rdma.c | 11 +- fs/ksmbd/transport_tcp.c | 13 +- fs/namei.c | 60 +++--- fs/nfsd/nfs4state.c | 61 +++--- fs/nilfs2/dat.c | 27 ++- fs/nilfs2/file.c | 8 +- fs/nilfs2/recovery.c | 7 +- fs/nilfs2/segment.c | 8 +- fs/ntfs3/fsntfs.c | 16 +- fs/ntfs3/index.c | 3 +- fs/ntfs3/ntfs_fs.h | 2 +- fs/pipe.c | 19 +- fs/pstore/ram.c | 1 + fs/ubifs/dir.c | 2 + fs/xfs/xfs_super.c | 27 ++- include/asm-generic/numa.h | 2 + include/drm/drm_color_mgmt.h | 1 + include/drm/drm_fb_helper.h | 3 +- include/drm/drm_mipi_dsi.h | 2 + include/linux/async.h | 2 + include/linux/bpf.h | 6 +- include/linux/dma-fence.h | 19 ++ include/linux/dmaengine.h | 3 +- include/linux/fb.h | 18 +- include/linux/hrtimer.h | 4 +- include/linux/irq_work.h | 3 + include/linux/lsm_hook_defs.h | 2 + include/linux/mmc/sdio_ids.h | 1 + include/linux/mmzone.h | 18 +- include/linux/netfilter/ipset/ip_set.h | 4 + include/linux/overflow.h | 72 ++++---- include/linux/pci_ids.h | 1 + include/linux/pipe_fs_i.h | 16 ++ include/linux/pm_runtime.h | 4 + include/linux/security.h | 9 + include/linux/syscalls.h | 1 + include/net/af_unix.h | 20 +- include/net/inet_connection_sock.h | 8 + include/net/llc_pdu.h | 6 +- include/net/netfilter/nf_tables.h | 2 + include/uapi/linux/btrfs.h | 4 + include/uapi/linux/netfilter/nf_tables.h | 2 + kernel/async.c | 85 ++++++--- kernel/audit.c | 31 +++- kernel/bpf/arraymap.c | 12 +- kernel/bpf/hashtab.c | 6 +- kernel/bpf/map_in_map.c | 2 +- kernel/bpf/map_in_map.h | 2 +- kernel/bpf/syscall.c | 6 + kernel/events/core.c | 38 ++-- kernel/power/swap.c | 38 ++-- kernel/sched/membarrier.c | 9 + kernel/time/clocksource.c | 25 ++- kernel/time/hrtimer.c | 17 +- kernel/time/tick-sched.c | 5 + kernel/trace/ring_buffer.c | 2 +- kernel/trace/trace.c | 78 ++++---- kernel/trace/trace_events_trigger.c | 6 +- kernel/trace/tracing_map.c | 7 +- lib/debugobjects.c | 204 ++++++++------------- lib/mpi/ec.c | 3 + mm/page-writeback.c | 2 +- mm/sparse.c | 17 +- net/8021q/vlan_netlink.c | 4 + net/bluetooth/l2cap_core.c | 3 +- net/bridge/br_cfm_netlink.c | 2 +- net/bridge/br_multicast.c | 20 +- net/bridge/br_private.h | 4 +- net/can/j1939/j1939-priv.h | 3 +- net/can/j1939/main.c | 2 +- net/can/j1939/socket.c | 46 +++-- net/core/request_sock.c | 3 - net/core/skbuff.c | 3 +- net/hsr/hsr_device.c | 4 +- net/ipv4/af_inet.c | 9 +- net/ipv4/inet_connection_sock.c | 4 + net/ipv4/ip_output.c | 12 +- net/ipv4/ip_tunnel_core.c | 2 +- net/ipv4/tcp.c | 13 +- net/ipv6/addrconf_core.c | 21 ++- net/ipv6/af_inet6.c | 3 + net/ipv6/ip6_tunnel.c | 28 ++- net/llc/af_llc.c | 26 ++- net/llc/llc_core.c | 7 - net/mac80211/tx.c | 3 +- net/mptcp/protocol.c | 3 - net/netfilter/ipset/ip_set_bitmap_gen.h | 14 +- net/netfilter/ipset/ip_set_core.c | 39 +++- net/netfilter/ipset/ip_set_hash_gen.h | 19 +- net/netfilter/ipset/ip_set_list_set.c | 13 +- net/netfilter/nf_log.c | 7 +- net/netfilter/nf_tables_api.c | 34 ++-- net/netfilter/nft_chain_filter.c | 11 +- net/netfilter/nft_compat.c | 23 ++- net/netfilter/nft_ct.c | 27 +++ net/netfilter/nft_flow_offload.c | 5 + net/netfilter/nft_limit.c | 23 ++- net/netfilter/nft_nat.c | 5 + net/netfilter/nft_rt.c | 5 + net/netfilter/nft_set_pipapo.c | 108 +++++------ net/netfilter/nft_set_pipapo.h | 18 +- net/netfilter/nft_set_pipapo_avx2.c | 17 +- net/netfilter/nft_set_rbtree.c | 6 +- net/netfilter/nft_socket.c | 5 + net/netfilter/nft_synproxy.c | 7 +- net/netfilter/nft_tproxy.c | 5 + net/netfilter/nft_tunnel.c | 1 + net/netfilter/nft_xfrm.c | 5 + net/netlink/af_netlink.c | 2 +- net/nfc/nci/core.c | 4 + net/openvswitch/flow_netlink.c | 49 +++-- net/rds/af_rds.c | 2 +- net/rxrpc/conn_event.c | 8 + net/rxrpc/conn_service.c | 3 +- net/smc/smc_diag.c | 2 +- net/sunrpc/xprtmultipath.c | 17 +- net/tipc/bearer.c | 6 + net/unix/af_unix.c | 14 +- net/unix/diag.c | 2 +- net/unix/garbage.c | 12 ++ net/wireless/scan.c | 4 + scripts/decode_stacktrace.sh | 60 +++++- scripts/get_abi.pl | 2 +- scripts/link-vmlinux.sh | 9 +- scripts/mod/sumversion.c | 7 +- security/security.c | 32 +++- security/selinux/hooks.c | 28 +++ security/smack/smack_lsm.c | 1 + security/tomoyo/tomoyo.c | 1 + sound/hda/hdac_stream.c | 9 +- sound/hda/intel-dsp-config.c | 10 + sound/pci/hda/hda_intel.c | 2 + sound/pci/hda/patch_conexant.c | 133 +++++++++++++- sound/pci/hda/patch_cs8409.c | 1 + sound/pci/hda/patch_realtek.c | 3 + sound/soc/codecs/lpass-wsa-macro.c | 7 - sound/soc/codecs/rt5645.c | 1 + sound/soc/codecs/wcd938x.c | 2 +- sound/usb/quirks.c | 4 + tools/build/feature/test-libopencsd.c | 4 +- tools/lib/bpf/libbpf.c | 2 + tools/lib/subcmd/help.c | 18 +- tools/testing/selftests/bpf/cgroup_helpers.c | 18 +- tools/testing/selftests/bpf/prog_tests/btf.c | 1 + tools/testing/selftests/bpf/prog_tests/tailcalls.c | 55 ------ tools/testing/selftests/bpf/progs/pyperf180.c | 22 +++ .../selftests/bpf/progs/tailcall_bpf2bpf6.c | 42 ----- .../drivers/net/netdevsim/udp_tunnel_nic.sh | 9 + tools/testing/selftests/net/pmtu.sh | 34 ++-- tools/testing/selftests/net/setup_veth.sh | 2 +- tools/testing/selftests/net/udpgro_fwd.sh | 14 +- tools/testing/selftests/net/udpgso_bench_rx.c | 2 +- tools/testing/selftests/sgx/test_encl.lds | 6 +- 527 files changed, 5153 insertions(+), 2726 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/476 ksmbd: free ppace array on error in parse_dacl
5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
[ Upstream commit 8cf9bedfc3c47d24bb0de386f808f925dc52863e ]
The ppace array is not freed if one of the init_acl_state() calls inside parse_dacl() fails. At the moment the function may fail only due to the memory allocation errors so it's highly unlikely in this case but nevertheless a fix is needed.
Move ppace allocation after the init_acl_state() calls with proper error handling.
Found by Linux Verification Center (linuxtesting.org).
--- fs/ksmbd/smbacl.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
fs/ksmbd/smbacl.c +7 -4
@@ -399,10 +399,6 @@ static void parse_dacl(struct user_namespace *user_ns,if (num_aces >ULONG_MAX /sizeof (struct smb_ace *))return ; - ppace =kmalloc_array (num_aces,sizeof (struct smb_ace *),GFP_KERNEL ); -if (!ppace) -return ; - ret =init_acl_state (&acl_state, num_aces);if (ret)return ;
@@ -412,6 +408,13 @@ static void parse_dacl(struct user_namespace *user_ns,return ; } + ppace =kmalloc_array (num_aces,sizeof (struct smb_ace *),GFP_KERNEL ); +if (!ppace) { +free_acl_state (&default_acl_state); +free_acl_state (&acl_state); +return ; + } +/* * reset rwx permissions for user/group/other. * Also, if num_aces is 0 i.e. DACL has no ACEs,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 2/476 ksmbd: dont allow O_TRUNC open on read-only share
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit d592a9158a112d419f341f035d18d02f8d232def ]
When file is changed using notepad on read-only share(read_only = yes in ksmbd.conf), There is a problem where existing data is truncated. notepad in windows try to O_TRUNC open(FILE_OVERWRITE_IF) and all data in file is truncated. This patch don't allow O_TRUNC open on read-only share and add KSMBD_TREE_CONN_FLAG_WRITABLE check in smb2_set_info().
--- fs/ksmbd/smb2pdu.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-)
fs/ksmbd/smb2pdu.c +9 -14
@@ -2968,7 +2968,7 @@ int smb2_open(struct ksmbd_work *work) &may_flags);if (!test_tree_conn_flag (tcon,KSMBD_TREE_CONN_FLAG_WRITABLE )) { -if (open_flags &O_CREAT ) { +if (open_flags & (O_CREAT |O_TRUNC )) {ksmbd_debug (SMB ,"User does not have write permission\n" ); rc = -EACCES ;
@@ -5945,12 +5945,6 @@ static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp, }case FILE_RENAME_INFORMATION : { -if (!test_tree_conn_flag (work->tcon,KSMBD_TREE_CONN_FLAG_WRITABLE )) { -ksmbd_debug (SMB , -"User does not have write permission\n" ); -return -EACCES ; - } -if (buf_len <sizeof (struct smb2_file_rename_info ))return -EINVAL ;
@@ -5970,12 +5964,6 @@ static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp, }case FILE_DISPOSITION_INFORMATION : { -if (!test_tree_conn_flag (work->tcon,KSMBD_TREE_CONN_FLAG_WRITABLE )) { -ksmbd_debug (SMB , -"User does not have write permission\n" ); -return -EACCES ; - } -if (buf_len <sizeof (struct smb2_file_disposition_info ))return -EINVAL ;
@@ -6037,7 +6025,7 @@ int smb2_set_info(struct ksmbd_work *work) {struct smb2_set_info_req *req;struct smb2_set_info_rsp *rsp; -struct ksmbd_file *fp; +struct ksmbd_file *fp =NULL ;int rc =0 ;unsigned int id =KSMBD_NO_FID , pid =KSMBD_NO_FID ;
@@ -6057,6 +6045,13 @@ int smb2_set_info(struct ksmbd_work *work) rsp =smb2_get_msg (work->response_buf); } +if (!test_tree_conn_flag (work->tcon,KSMBD_TREE_CONN_FLAG_WRITABLE )) { +ksmbd_debug (SMB ,"User does not have write permission\n" ); +pr_err ("User does not have write permission\n" ); + rc = -EACCES ; + goto err_out; + } +if (!has_file_id (id)) { id = req->VolatileFileId; pid = req->PersistentFileId;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 3/476 ksmbd: validate mech token in session setup
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit 92e470163d96df8db6c4fa0f484e4a229edb903d ]
If client send invalid mech token in session setup request, ksmbd validate and make the error if it is invalid.
--- fs/ksmbd/asn1.c | 5 +++++ fs/ksmbd/connection.h | 1 + fs/ksmbd/smb2pdu.c | 22 +++++++++++++++++----- 3 files changed, 23 insertions(+), 5 deletions(-)
fs/ksmbd/asn1.c +5 -0
@@ -214,10 +214,15 @@ static int ksmbd_neg_token_alloc(void *context, size_t hdrlen, {struct ksmbd_conn *conn = context; +if (!vlen) +return -EINVAL ; + conn->mechToken =kmemdup_nul (value, vlen,GFP_KERNEL );if (!conn->mechToken)return -ENOMEM ; + conn->mechTokenLen = (unsigned int )vlen; +return 0 ; }
fs/ksmbd/connection.h +1 -0
@@ -88,6 +88,7 @@ struct ksmbd_conn {__u16 dialect;char *mechToken; +unsigned int mechTokenLen;struct ksmbd_conn_ops *conn_ops;
fs/ksmbd/smb2pdu.c +17 -5
@@ -1414,7 +1414,10 @@ static struct ksmbd_user *session_user(struct ksmbd_conn *conn,char *name;unsigned int name_off, name_len, secbuf_len; - secbuf_len =le16_to_cpu (req->SecurityBufferLength); +if (conn->use_spnego && conn->mechToken) + secbuf_len = conn->mechTokenLen; +else + secbuf_len =le16_to_cpu (req->SecurityBufferLength);if (secbuf_len <sizeof (struct authenticate_message )) {ksmbd_debug (SMB ,"blob len %d too small\n" , secbuf_len);return NULL ;
@@ -1505,7 +1508,10 @@ static int ntlm_authenticate(struct ksmbd_work *work,struct authenticate_message *authblob; authblob =user_authblob (conn, req); - sz =le16_to_cpu (req->SecurityBufferLength); +if (conn->use_spnego && conn->mechToken) + sz = conn->mechTokenLen; +else + sz =le16_to_cpu (req->SecurityBufferLength); rc =ksmbd_decode_ntlmssp_auth_blob (authblob, sz, conn, sess);if (rc) {set_user_flag (sess->user,KSMBD_USER_FLAG_BAD_PASSWORD );
@@ -1778,8 +1784,7 @@ int smb2_sess_setup(struct ksmbd_work *work) negblob_off =le16_to_cpu (req->SecurityBufferOffset); negblob_len =le16_to_cpu (req->SecurityBufferLength); -if (negblob_off < offsetof(struct smb2_sess_setup_req , Buffer) || - negblob_len < offsetof(struct negotiate_message , NegotiateFlags)) { +if (negblob_off < offsetof(struct smb2_sess_setup_req , Buffer)) { rc = -EINVAL ; goto out_err; }
@@ -1788,8 +1793,15 @@ int smb2_sess_setup(struct ksmbd_work *work) negblob_off);if (decode_negotiation_token (conn, negblob, negblob_len) ==0 ) { -if (conn->mechToken) +if (conn->mechToken) { negblob = (struct negotiate_message *)conn->mechToken; + negblob_len = conn->mechTokenLen; + } + } + +if (negblob_len < offsetof(struct negotiate_message , NegotiateFlags)) { + rc = -EINVAL ; + goto out_err; }if (server_conf.auth_mechs & conn->auth_mechs) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 4/476 ksmbd: fix UAF issue in ksmbd_tcp_new_connection()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit 38d20c62903d669693a1869aa68c4dd5674e2544 ]
The race is between the handling of a new TCP connection and its disconnection. It leads to UAF on struct tcp_transport in ksmbd_tcp_new_connection() function.
--- fs/ksmbd/connection.c | 6 ------ fs/ksmbd/connection.h | 1 - fs/ksmbd/transport_rdma.c | 11 ++++++----- fs/ksmbd/transport_tcp.c | 13 +++++++------ 4 files changed, 13 insertions(+), 18 deletions(-)
fs/ksmbd/connection.c +0 -6
@@ -415,13 +415,7 @@ static void stop_sessions(void) again:down_read (&conn_list_lock);list_for_each_entry (conn, &conn_list, conns_list) { -struct task_struct *task; - t = conn->transport; - task = t->handler; -if (task) -ksmbd_debug (CONN ,"Stop session handler %s/%d\n" , - task->comm,task_pid_nr (task));ksmbd_conn_set_exiting (conn);if (t->ops->shutdown) {up_read (&conn_list_lock);
fs/ksmbd/connection.h +0 -1
@@ -135,7 +135,6 @@ struct ksmbd_transport_ops {struct ksmbd_transport {struct ksmbd_conn *conn;struct ksmbd_transport_ops *ops; -struct task_struct *handler; };#define KSMBD_TCP_RECV_TIMEOUT (7 * HZ)
fs/ksmbd/transport_rdma.c +6 -5
@@ -2039,6 +2039,7 @@ static bool rdma_frwr_is_supported(struct ib_device_attr *attrs)static int smb_direct_handle_connect_request (struct rdma_cm_id *new_cm_id) {struct smb_direct_transport *t; +struct task_struct *handler;int ret;if (!rdma_frwr_is_supported (&new_cm_id->device->attrs)) {
@@ -2056,11 +2057,11 @@ static int smb_direct_handle_connect_request(struct rdma_cm_id *new_cm_id)if (ret) goto out_err; -KSMBD_TRANS (t)->handler =kthread_run (ksmbd_conn_handler_loop, -KSMBD_TRANS (t)->conn,"ksmbd:r%u" , - smb_direct_port); -if (IS_ERR (KSMBD_TRANS (t)->handler)) { - ret =PTR_ERR (KSMBD_TRANS (t)->handler); + handler =kthread_run (ksmbd_conn_handler_loop, +KSMBD_TRANS (t)->conn,"ksmbd:r%u" , + smb_direct_port); +if (IS_ERR (handler)) { + ret =PTR_ERR (handler);pr_err ("Can't start thread\n" ); goto out_err; }
fs/ksmbd/transport_tcp.c +7 -6
@@ -185,6 +185,7 @@ static int ksmbd_tcp_new_connection(struct socket *client_sk)struct sockaddr *csin;int rc =0 ;struct tcp_transport *t; +struct task_struct *handler; t =alloc_transport (client_sk);if (!t) {
@@ -199,13 +200,13 @@ static int ksmbd_tcp_new_connection(struct socket *client_sk) goto out_error; } -KSMBD_TRANS (t)->handler =kthread_run (ksmbd_conn_handler_loop, -KSMBD_TRANS (t)->conn, -"ksmbd:%u" , -ksmbd_tcp_get_port (csin)); -if (IS_ERR (KSMBD_TRANS (t)->handler)) { + handler =kthread_run (ksmbd_conn_handler_loop, +KSMBD_TRANS (t)->conn, +"ksmbd:%u" , +ksmbd_tcp_get_port (csin)); +if (IS_ERR (handler)) {pr_err ("cannot start conn thread\n" ); - rc =PTR_ERR (KSMBD_TRANS (t)->handler); + rc =PTR_ERR (handler);free_transport (t); }return rc;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 5/476 ksmbd: only v2 leases handle the directory
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit 77bebd186442a7d703b796784db7495129cc3e70 ]
When smb2 leases is disable, ksmbd can send oplock break notification and cause wait oplock break ack timeout. It may appear like hang when accessing a directory. This patch make only v2 leases handle the directory.
--- fs/ksmbd/oplock.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/ksmbd/oplock.c +6 -0
@@ -1191,6 +1191,12 @@ int smb_grant_oplock(struct ksmbd_work *work, int req_op_level, u64 pid,bool prev_op_has_lease;__le32 prev_op_state =0 ; +/* Only v2 leases handle the directory */ +if (S_ISDIR (file_inode (fp->filp)->i_mode)) { +if (!lctx || lctx->version !=2 ) +return 0 ; + } + opinfo =alloc_opinfo (work, pid, tid);if (!opinfo)return -ENOMEM ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 6/476 iio: adc: ad7091r: Set alert bit in config register
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcelo Schmitt <[email protected]>
[ Upstream commit 149694f5e79b0c7a36ceb76e7c0d590db8f151c1 ]
The ad7091r-base driver sets up an interrupt handler for firing events when inputs are either above or below a certain threshold. However, for the interrupt signal to come from the device it must be configured to enable the ALERT/BUSY/GPO pin to be used as ALERT, which was not being done until now.
Enable interrupt signals on the ALERT/BUSY/GPO pin by setting the proper bit in the configuration register.
Stable-dep-of: 020e71c7ffc2 ("iio: adc: ad7091r: Allow users to configure device events")
--- drivers/iio/adc/ad7091r-base.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/iio/adc/ad7091r-base.c +6 -0
@@ -28,6 +28,7 @@#define AD7091R_REG_RESULT_CONV_RESULT (x) ((x) & 0xfff)/* AD7091R_REG_CONF */ +#define AD7091R_REG_CONF_ALERT_EN BIT(4)#define AD7091R_REG_CONF_AUTO BIT(8)#define AD7091R_REG_CONF_CMD BIT(10)
@@ -232,6 +233,11 @@ int ad7091r_probe(struct device *dev, const char *name, iio_dev->channels = chip_info->channels;if (irq) { + ret =regmap_update_bits (st->map,AD7091R_REG_CONF , +AD7091R_REG_CONF_ALERT_EN ,BIT (4 )); +if (ret) +return ret; + ret =devm_request_threaded_irq (dev, irq,NULL , ad7091r_event_handler,IRQF_TRIGGER_FALLING |IRQF_ONESHOT , name, iio_dev);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 7/476 iio: adc: ad7091r: Allow users to configure device events
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcelo Schmitt <[email protected]>
[ Upstream commit 020e71c7ffc25dfe29ed9be6c2d39af7bd7f661f ]
AD7091R-5 devices are supported by the ad7091r-5 driver together with the ad7091r-base driver. Those drivers declared iio events for notifying user space when ADC readings fall bellow the thresholds of low limit registers or above the values set in high limit registers. However, to configure iio events and their thresholds, a set of callback functions must be implemented and those were not present until now. The consequence of trying to configure ad7091r-5 events without the proper callback functions was a null pointer dereference in the kernel because the pointers to the callback functions were not set.
Implement event configuration callbacks allowing users to read/write event thresholds and enable/disable event generation.
Since the event spec structs are generic to AD7091R devices, also move those from the ad7091r-5 driver the base driver so they can be reused when support for ad7091r-2/-4/-8 be added.
--- drivers/iio/adc/ad7091r-base.c | 156 +++++++++++++++++++++++++++++++++ drivers/iio/adc/ad7091r-base.h | 6 ++ drivers/iio/adc/ad7091r5.c | 28 +----- 3 files changed, 166 insertions(+), 24 deletions(-)
drivers/iio/adc/ad7091r-base.c +156 -0
@@ -6,6 +6,7 @@*/ #include <linux/bitops.h> +#include <linux/bitfield.h> #include <linux/iio/events.h> #include <linux/iio/iio.h> #include <linux/interrupt.h>
@@ -50,6 +51,27 @@ struct ad7091r_state {struct mutex lock;/*lock to prevent concurent reads */ }; +const struct iio_event_spec ad7091r_events[] = { + { + .type =IIO_EV_TYPE_THRESH , + .dir =IIO_EV_DIR_RISING , + .mask_separate =BIT (IIO_EV_INFO_VALUE ) | +BIT (IIO_EV_INFO_ENABLE ), + }, + { + .type =IIO_EV_TYPE_THRESH , + .dir =IIO_EV_DIR_FALLING , + .mask_separate =BIT (IIO_EV_INFO_VALUE ) | +BIT (IIO_EV_INFO_ENABLE ), + }, + { + .type =IIO_EV_TYPE_THRESH , + .dir =IIO_EV_DIR_EITHER , + .mask_separate =BIT (IIO_EV_INFO_HYSTERESIS ), + }, +}; +EXPORT_SYMBOL_NS_GPL (ad7091r_events,IIO_AD7091R ); +static int ad7091r_set_mode (struct ad7091r_state *st,enum ad7091r_mode mode) {int ret, conf;
@@ -169,8 +191,142 @@ static int ad7091r_read_raw(struct iio_dev *iio_dev,return ret; } +static int ad7091r_read_event_config (struct iio_dev *indio_dev, +const struct iio_chan_spec *chan, +enum iio_event_type type, +enum iio_event_direction dir) +{ +struct ad7091r_state *st =iio_priv (indio_dev); +int val, ret; + +switch (dir) { +case IIO_EV_DIR_RISING : + ret =regmap_read (st->map, +AD7091R_REG_CH_HIGH_LIMIT (chan->channel), + &val); +if (ret) +return ret; +return val !=AD7091R_HIGH_LIMIT ; +case IIO_EV_DIR_FALLING : + ret =regmap_read (st->map, +AD7091R_REG_CH_LOW_LIMIT (chan->channel), + &val); +if (ret) +return ret; +return val !=AD7091R_LOW_LIMIT ; +default : +return -EINVAL ; + } +} + +static int ad7091r_write_event_config (struct iio_dev *indio_dev, +const struct iio_chan_spec *chan, +enum iio_event_type type, +enum iio_event_direction dir,int state) +{ +struct ad7091r_state *st =iio_priv (indio_dev); + +if (state) { +return regmap_set_bits (st->map,AD7091R_REG_CONF , +AD7091R_REG_CONF_ALERT_EN ); + }else { +/* +* Set thresholds either to 0 or to 2^12 - 1 as appropriate to +* prevent alerts and thus disable event generation. +*/ +switch (dir) { +case IIO_EV_DIR_RISING : +return regmap_write (st->map, +AD7091R_REG_CH_HIGH_LIMIT (chan->channel), +AD7091R_HIGH_LIMIT ); +case IIO_EV_DIR_FALLING : +return regmap_write (st->map, +AD7091R_REG_CH_LOW_LIMIT (chan->channel), +AD7091R_LOW_LIMIT ); +default : +return -EINVAL ; + } + } +} + +static int ad7091r_read_event_value (struct iio_dev *indio_dev, +const struct iio_chan_spec *chan, +enum iio_event_type type, +enum iio_event_direction dir, +enum iio_event_info info,int *val,int *val2) +{ +struct ad7091r_state *st =iio_priv (indio_dev); +int ret; + +switch (info) { +case IIO_EV_INFO_VALUE : +switch (dir) { +case IIO_EV_DIR_RISING : + ret =regmap_read (st->map, +AD7091R_REG_CH_HIGH_LIMIT (chan->channel), + val); +if (ret) +return ret; +return IIO_VAL_INT ; +case IIO_EV_DIR_FALLING : + ret =regmap_read (st->map, +AD7091R_REG_CH_LOW_LIMIT (chan->channel), + val); +if (ret) +return ret; +return IIO_VAL_INT ; +default : +return -EINVAL ; + } +case IIO_EV_INFO_HYSTERESIS : + ret =regmap_read (st->map, +AD7091R_REG_CH_HYSTERESIS (chan->channel), + val); +if (ret) +return ret; +return IIO_VAL_INT ; +default : +return -EINVAL ; + } +} + +static int ad7091r_write_event_value (struct iio_dev *indio_dev, +const struct iio_chan_spec *chan, +enum iio_event_type type, +enum iio_event_direction dir, +enum iio_event_info info,int val,int val2) +{ +struct ad7091r_state *st =iio_priv (indio_dev); + +switch (info) { +case IIO_EV_INFO_VALUE : +switch (dir) { +case IIO_EV_DIR_RISING : +return regmap_write (st->map, +AD7091R_REG_CH_HIGH_LIMIT (chan->channel), + val); +case IIO_EV_DIR_FALLING : +return regmap_write (st->map, +AD7091R_REG_CH_LOW_LIMIT (chan->channel), + val); +default : +return -EINVAL ; + } +case IIO_EV_INFO_HYSTERESIS : +return regmap_write (st->map, +AD7091R_REG_CH_HYSTERESIS (chan->channel), + val); +default : +return -EINVAL ; + } +} +static const struct iio_info ad7091r_info = { .read_raw = ad7091r_read_raw, + .read_event_config = &ad7091r_read_event_config, + .write_event_config = &ad7091r_write_event_config, + .read_event_value = &ad7091r_read_event_value, + .write_event_value = &ad7091r_write_event_value, };static irqreturn_t ad7091r_event_handler (int irq,void *private)
drivers/iio/adc/ad7091r-base.h +6 -0
@@ -8,6 +8,10 @@#ifndef __DRIVERS_IIO_ADC_AD7091R_BASE_H__#define __DRIVERS_IIO_ADC_AD7091R_BASE_H__ +/* AD7091R_REG_CH_LIMIT */ +#define AD7091R_HIGH_LIMIT 0xFFF +#define AD7091R_LOW_LIMIT 0x0 +struct device ;struct ad7091r_state ;
@@ -17,6 +21,8 @@ struct ad7091r_chip_info {unsigned int vref_mV; }; +extern const struct iio_event_spec ad7091r_events[3 ]; +extern const struct regmap_config ad7091r_regmap_config; int ad7091r_probe(struct device *dev, const char *name,
drivers/iio/adc/ad7091r5.c +4 -24
@@ -12,26 +12,6 @@#include "ad7091r-base.h" -static const struct iio_event_spec ad7091r5_events[] = { - { - .type =IIO_EV_TYPE_THRESH , - .dir =IIO_EV_DIR_RISING , - .mask_separate =BIT (IIO_EV_INFO_VALUE ) | -BIT (IIO_EV_INFO_ENABLE ), - }, - { - .type =IIO_EV_TYPE_THRESH , - .dir =IIO_EV_DIR_FALLING , - .mask_separate =BIT (IIO_EV_INFO_VALUE ) | -BIT (IIO_EV_INFO_ENABLE ), - }, - { - .type =IIO_EV_TYPE_THRESH , - .dir =IIO_EV_DIR_EITHER , - .mask_separate =BIT (IIO_EV_INFO_HYSTERESIS ), - }, -}; -#define AD7091R_CHANNEL (idx, bits, ev, num_ev) { \ .type = IIO_VOLTAGE, \ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
@@ -44,10 +24,10 @@ static const struct iio_event_spec ad7091r5_events[] = { .scan_type.realbits = bits, \ }static const struct iio_chan_spec ad7091r5_channels_irq[] = { -AD7091R_CHANNEL (0 ,12 , ad7091r5_events,ARRAY_SIZE (ad7091r5_events)), -AD7091R_CHANNEL (1 ,12 , ad7091r5_events,ARRAY_SIZE (ad7091r5_events)), -AD7091R_CHANNEL (2 ,12 , ad7091r5_events,ARRAY_SIZE (ad7091r5_events)), -AD7091R_CHANNEL (3 ,12 , ad7091r5_events,ARRAY_SIZE (ad7091r5_events)), +AD7091R_CHANNEL (0 ,12 , ad7091r_events,ARRAY_SIZE (ad7091r_events)), +AD7091R_CHANNEL (1 ,12 , ad7091r_events,ARRAY_SIZE (ad7091r_events)), +AD7091R_CHANNEL (2 ,12 , ad7091r_events,ARRAY_SIZE (ad7091r_events)), +AD7091R_CHANNEL (3 ,12 , ad7091r_events,ARRAY_SIZE (ad7091r_events)), };static const struct iio_chan_spec ad7091r5_channels_noirq[] = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 8/476 iio: adc: ad7091r: Enable internal vref if external vref is not supplied
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcelo Schmitt <[email protected]>
[ Upstream commit e71c5c89bcb165a02df35325aa13d1ee40112401 ]
The ADC needs a voltage reference to work correctly.
Users can provide an external voltage reference or use the chip internal reference to operate the ADC.
The availability of an in chip reference for the ADC saves the user from having to supply an external voltage reference, which makes the external reference an optional property as described in the device tree documentation.
Though, to use the internal reference, it must be enabled by writing to the configuration register.
Enable AD7091R internal voltage reference if no external vref is supplied.
--- drivers/iio/adc/ad7091r-base.c | 7 +++++++ drivers/iio/adc/ad7091r-base.h | 2 ++ 2 files changed, 9 insertions(+)
drivers/iio/adc/ad7091r-base.c +7 -0
@@ -405,7 +405,14 @@ int ad7091r_probe(struct device *dev, const char *name,if (IS_ERR (st->vref)) {if (PTR_ERR (st->vref) == -EPROBE_DEFER )return -EPROBE_DEFER ; + st->vref =NULL ; +/* Enable internal vref */ + ret =regmap_set_bits (st->map,AD7091R_REG_CONF , +AD7091R_REG_CONF_INT_VREF ); +if (ret) +return dev_err_probe (st->dev, ret, +"Error on enable internal reference\n" ); }else { ret =regulator_enable (st->vref);if (ret)
drivers/iio/adc/ad7091r-base.h +2 -0
@@ -8,6 +8,8 @@#ifndef __DRIVERS_IIO_ADC_AD7091R_BASE_H__#define __DRIVERS_IIO_ADC_AD7091R_BASE_H__ +#define AD7091R_REG_CONF_INT_VREF BIT(0) +/* AD7091R_REG_CH_LIMIT */ #define AD7091R_HIGH_LIMIT 0xFFF#define AD7091R_LOW_LIMIT 0x0
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 9/476 dmaengine: fix NULL pointer in channel unregistration function
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amelie Delaunay <[email protected]>
[ Upstream commit f5c24d94512f1b288262beda4d3dcb9629222fc7 ]
__dma_async_device_channel_register() can fail. In case of failure, chan->local is freed (with free_percpu()), and chan->local is nullified. When dma_async_device_unregister() is called (because of managed API or intentionally by DMA controller driver), channels are unconditionally unregistered, leading to this NULL pointer:
[ 1.318693] Unable to handle kernel NULL pointer dereference at virtual address 00000000000000d0 [...] [ 1.484499] Call trace: [ 1.486930] device_del+0x40/0x394 [ 1.490314] device_unregister+0x20/0x7c [ 1.494220] __dma_async_device_channel_unregister+0x68/0xc0
Look at dma_async_device_register() function error path, channel device unregistration is done only if chan->local is not NULL.
Then add the same condition at the beginning of __dma_async_device_channel_unregister() function, to avoid NULL pointer issue whatever the API used to reach this function.
--- drivers/dma/dmaengine.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/dma/dmaengine.c +3 -0
@@ -1108,6 +1108,9 @@ EXPORT_SYMBOL_GPL(dma_async_device_channel_register);static void __dma_async_device_channel_unregister (struct dma_device *device,struct dma_chan *chan) { +if (chan->local ==NULL ) +return ; +WARN_ONCE (!device->device_release && chan->client_count,"%s called while %d clients hold a reference\n" , __func__, chan->client_count);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 10/476 scsi: ufs: core: Simplify power management during async scan
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
[ Upstream commit daf7795406bf307997366f694888bd317ae5b5fa ]
ufshcd_init() calls pm_runtime_get_sync() before it calls async_schedule(). ufshcd_async_scan() calls pm_runtime_put_sync() directly or indirectly from ufshcd_add_lus(). Simplify ufshcd_async_scan() by always calling pm_runtime_put_sync() from ufshcd_async_scan().
Stable-dep-of: ee36710912b2 ("scsi: ufs: core: Remove the ufshcd_hba_exit() call from ufshcd_async_scan()")
--- drivers/scsi/ufs/ufshcd.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/scsi/ufs/ufshcd.c +3 -4
@@ -7896,7 +7896,6 @@ static int ufshcd_add_lus(struct ufs_hba *hba)ufs_bsg_probe (hba);ufshpb_init (hba);scsi_scan_host (hba->host); -pm_runtime_put_sync (hba->dev); out:return ret;
@@ -8018,15 +8017,15 @@ static void ufshcd_async_scan(void *data, async_cookie_t cookie)/* Probe and add UFS logical units */ ret =ufshcd_add_lus (hba); + out: +pm_runtime_put_sync (hba->dev);/* * If we failed to initialize the device or the device is not * present, turn off the power/clocks etc. */ -if (ret) { -pm_runtime_put_sync (hba->dev); +if (ret)ufshcd_hba_exit (hba); - } }static const struct attribute_group *ufshcd_driver_groups[] = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 11/476 scsi: ufs: core: Remove the ufshcd_hba_exit() call from ufshcd_async_scan()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
[ Upstream commit ee36710912b2075c417100a8acc642c9c6496501 ]
Calling ufshcd_hba_exit() from a function that is called asynchronously from ufshcd_init() is wrong because this triggers multiple race conditions. Instead of calling ufshcd_hba_exit(), log an error message.
--- drivers/scsi/ufs/ufshcd.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/scsi/ufs/ufshcd.c +2 -5
@@ -8020,12 +8020,9 @@ static void ufshcd_async_scan(void *data, async_cookie_t cookie) out:pm_runtime_put_sync (hba->dev); -/* -* If we failed to initialize the device or the device is not -* present, turn off the power/clocks etc. -*/ +if (ret) -ufshcd_hba_exit (hba); +dev_err (hba->dev,"%s failed: %d\n" , __func__, ret); }static const struct attribute_group *ufshcd_driver_groups[] = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 12/476 iio:adc:ad7091r: Move exports into IIO_AD7091R namespace.
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Cameron <[email protected]>
commit 8a0080af84d3fb2423f0b3b55eff666f545eb097 upstream.
In order to avoid unnecessary pollution of the global symbol namespace move the core/library functions into a specific namespace and import that into the various specific device drivers that use them.
For more information see https://lwn.net/Articles/760045/
An alternative here would be to conclude that we are unlikely to see support for the other ad7091r parts in the near future and just merge the two modules into one supporting just the i2c -5 variant.
--- drivers/iio/adc/ad7091r-base.c | 4 ++-- drivers/iio/adc/ad7091r5.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/iio/adc/ad7091r-base.c +2 -2
@@ -429,7 +429,7 @@ int ad7091r_probe(struct device *dev, coreturn devm_iio_device_register (dev, iio_dev); } -EXPORT_SYMBOL_GPL (ad7091r_probe); +EXPORT_SYMBOL_NS_GPL (ad7091r_probe,IIO_AD7091R );static bool ad7091r_writeable_reg (struct device *dev,unsigned int reg) {
@@ -459,7 +459,7 @@ const struct regmap_config ad7091r_regma .writeable_reg = ad7091r_writeable_reg, .volatile_reg = ad7091r_volatile_reg, }; -EXPORT_SYMBOL_GPL (ad7091r_regmap_config); +EXPORT_SYMBOL_NS_GPL (ad7091r_regmap_config,IIO_AD7091R );MODULE_AUTHOR ("Beniamin Bia <[email protected]>" );MODULE_DESCRIPTION ("Analog Devices AD7091Rx multi-channel converters" );
drivers/iio/adc/ad7091r5.c +1 -0
@@ -91,3 +91,4 @@ module_i2c_driver(ad7091r5_driver);MODULE_AUTHOR ("Beniamin Bia <[email protected]>" );MODULE_DESCRIPTION ("Analog Devices AD7091R5 multi-channel ADC driver" );MODULE_LICENSE ("GPL v2" ); +MODULE_IMPORT_NS (IIO_AD7091R );
Greg Kroah-Hartman
maintainerPATCH 13/476 ext4: allow for the last group to be marked as trimmed
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suraj Jitindar Singh <[email protected]>
commit 7c784d624819acbeefb0018bac89e632467cca5a upstream.
The ext4 filesystem tracks the trim status of blocks at the group level. When an entire group has been trimmed then it is marked as such and subsequent trim invocations with the same minimum trim size will not be attempted on that group unless it is marked as able to be trimmed again such as when a block is freed.
Currently the last group can't be marked as trimmed due to incorrect logic in ext4_last_grp_cluster(). ext4_last_grp_cluster() is supposed to return the zero based index of the last cluster in a group. This is then used by ext4_try_to_trim_range() to determine if the trim operation spans the entire group and as such if the trim status of the group should be recorded.
ext4_last_grp_cluster() takes a 0 based group index, thus the valid values for grp are 0..(ext4_get_groups_count - 1). Any group index less than (ext4_get_groups_count - 1) is not the last group and must have EXT4_CLUSTERS_PER_GROUP(sb) clusters. For the last group we need to calculate the number of clusters based on the number of blocks in the group. Finally subtract 1 from the number of clusters as zero based indexing is expected. Rearrange the function slightly to make it clear what we are calculating and returning.
Reproducer:
// Create file system where the last group has fewer blocks than // blocks per group
$ mkfs.ext4 -b 4096 -g 8192 /dev/nvme0n1 8191 $ mount /dev/nvme0n1 /mnt
Before Patch:
$ fstrim -v /mnt /mnt: 25.9 MiB (27156480 bytes) trimmed // Group not marked as trimmed so second invocation still discards blocks $ fstrim -v /mnt /mnt: 25.9 MiB (27156480 bytes) trimmed
After Patch:
fstrim -v /mnt
/mnt: 25.9 MiB (27156480 bytes) trimmed
// Group marked as trimmed so second invocation DOESN'T discard any blocks fstrim -v /mnt
/mnt: 0 B (0 bytes) trimmed
--- fs/ext4/mballoc.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
fs/ext4/mballoc.c +10 -5
@@ -6434,11 +6434,16 @@ __acquires(bitlock)static ext4_grpblk_t ext4_last_grp_cluster (struct super_block *sb,ext4_group_t grp) { -if (grp <ext4_get_groups_count (sb)) -return EXT4_CLUSTERS_PER_GROUP (sb) -1 ; -return (ext4_blocks_count (EXT4_SB (sb)->s_es) - -ext4_group_first_block_no (sb, grp) -1 ) >> -EXT4_CLUSTER_BITS (sb); +unsigned long nr_clusters_in_group; + +if (grp < (ext4_get_groups_count (sb) -1 )) + nr_clusters_in_group =EXT4_CLUSTERS_PER_GROUP (sb); +else + nr_clusters_in_group = (ext4_blocks_count (EXT4_SB (sb)->s_es) - +ext4_group_first_block_no (sb, grp)) + >>EXT4_CLUSTER_BITS (sb); + +return nr_clusters_in_group -1 ; }static bool ext4_trim_interrupted (void )
Greg Kroah-Hartman
maintainerPATCH 14/476 btrfs: sysfs: validate scrub_speed_max value
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Disseldorp <[email protected]>
commit 2b0122aaa800b021e36027d7f29e206f87c761d6 upstream.
The value set as scrub_speed_max accepts size with suffixes (k/m/g/t/p/e) but we should still validate it for trailing characters, similar to what we do with chunk_size_store.
--- fs/btrfs/sysfs.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/btrfs/sysfs.c +4 -0
@@ -1523,6 +1523,10 @@ static ssize_t btrfs_devinfo_scrub_speedunsigned long long limit; limit =memparse (buf, &endptr); +/* There could be trailing '\n', also catch any typos after the value. */ + endptr =skip_spaces (endptr); +if (*endptr !=0 ) +return -EINVAL ;WRITE_ONCE (device->scrub_speed_max, limit);return len; }
Greg Kroah-Hartman
maintainerPATCH 15/476 crypto: api - Disallow identical driver names
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
commit 27016f75f5ed47e2d8e0ca75a8ff1f40bc1a5e27 upstream.
Disallow registration of two algorithms with identical driver names.
--- crypto/algapi.c | 1 + 1 file changed, 1 insertion(+)
crypto/algapi.c +1 -0
@@ -258,6 +258,7 @@ static struct crypto_larval *__crypto_re }if (!strcmp (q->cra_driver_name, alg->cra_name) || + !strcmp (q->cra_driver_name, alg->cra_driver_name) || !strcmp (q->cra_name, alg->cra_driver_name)) goto err; }
Greg Kroah-Hartman
maintainerPATCH 16/476 PM: hibernate: Enforce ordering during image compression/decompression
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongchen Zhang <[email protected]>
commit 71cd7e80cfde548959952eac7063aeaea1f2e1c6 upstream.
An S4 (suspend to disk) test on the LoongArch 3A6000 platform sometimes fails with the following error messaged in the dmesg log:
Invalid LZO compressed length
That happens because when compressing/decompressing the image, the synchronization between the control thread and the compress/decompress/crc thread is based on a relaxed ordering interface, which is unreliable, and the following situation may occur:
CPU 0 CPU 1save_image_lzo lzo_compress_threadfn
atomic_set(&d->stop, 1);
atomic_read(&data[thr].stop)
data[thr].cmp = data[thr].cmp_len;
WRITE data[thr].cmp_len
Then CPU0 gets a stale cmp_len and writes it to disk. During resume from S4, wrong cmp_len is loaded.
To maintain data consistency between the two threads, use the acquire/release variants of atomic set and read operations.
--- kernel/power/swap.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-)
kernel/power/swap.c +19 -19
@@ -603,11 +603,11 @@ static int crc32_threadfn(void *data)unsigned i;while (1 ) { -wait_event (d->go,atomic_read (&d->ready) || +wait_event (d->go,atomic_read_acquire (&d->ready) ||kthread_should_stop ());if (kthread_should_stop ()) { d->thr =NULL ; -atomic_set (&d->stop,1 ); +atomic_set_release (&d->stop,1 );wake_up (&d->done);break ; }
@@ -616,7 +616,7 @@ static int crc32_threadfn(void *data)for (i =0 ; i < d->run_threads; i++) *d->crc32 =crc32_le (*d->crc32, d->unc[i], *d->unc_len[i]); -atomic_set (&d->stop,1 ); +atomic_set_release (&d->stop,1 );wake_up (&d->done); }return 0 ;
@@ -646,12 +646,12 @@ static int lzo_compress_threadfn(void *dstruct cmp_data *d = data;while (1 ) { -wait_event (d->go,atomic_read (&d->ready) || +wait_event (d->go,atomic_read_acquire (&d->ready) ||kthread_should_stop ());if (kthread_should_stop ()) { d->thr =NULL ; d->ret =-1 ; -atomic_set (&d->stop,1 ); +atomic_set_release (&d->stop,1 );wake_up (&d->done);break ; }
@@ -660,7 +660,7 @@ static int lzo_compress_threadfn(void *d d->ret =lzo1x_1_compress (d->unc, d->unc_len, d->cmp +LZO_HEADER , &d->cmp_len, d->wrk); -atomic_set (&d->stop,1 ); +atomic_set_release (&d->stop,1 );wake_up (&d->done); }return 0 ;
@@ -798,7 +798,7 @@ static int save_image_lzo(struct swap_ma data[thr].unc_len = off; -atomic_set (&data[thr].ready,1 ); +atomic_set_release (&data[thr].ready,1 );wake_up (&data[thr].go); }
@@ -806,12 +806,12 @@ static int save_image_lzo(struct swap_mabreak ; crc->run_threads = thr; -atomic_set (&crc->ready,1 ); +atomic_set_release (&crc->ready,1 );wake_up (&crc->go);for (run_threads = thr, thr =0 ; thr < run_threads; thr++) {wait_event (data[thr].done, -atomic_read (&data[thr].stop)); +atomic_read_acquire (&data[thr].stop));atomic_set (&data[thr].stop,0 ); ret = data[thr].ret;
@@ -850,7 +850,7 @@ static int save_image_lzo(struct swap_ma } } -wait_event (crc->done,atomic_read (&crc->stop)); +wait_event (crc->done,atomic_read_acquire (&crc->stop));atomic_set (&crc->stop,0 ); }
@@ -1132,12 +1132,12 @@ static int lzo_decompress_threadfn(voidstruct dec_data *d = data;while (1 ) { -wait_event (d->go,atomic_read (&d->ready) || +wait_event (d->go,atomic_read_acquire (&d->ready) ||kthread_should_stop ());if (kthread_should_stop ()) { d->thr =NULL ; d->ret =-1 ; -atomic_set (&d->stop,1 ); +atomic_set_release (&d->stop,1 );wake_up (&d->done);break ; }
@@ -1150,7 +1150,7 @@ static int lzo_decompress_threadfn(voidflush_icache_range ((unsigned long )d->unc, (unsigned long )d->unc + d->unc_len); -atomic_set (&d->stop,1 ); +atomic_set_release (&d->stop,1 );wake_up (&d->done); }return 0 ;
@@ -1338,7 +1338,7 @@ static int load_image_lzo(struct swap_ma }if (crc->run_threads) { -wait_event (crc->done,atomic_read (&crc->stop)); +wait_event (crc->done,atomic_read_acquire (&crc->stop));atomic_set (&crc->stop,0 ); crc->run_threads =0 ; }
@@ -1374,7 +1374,7 @@ static int load_image_lzo(struct swap_ma pg =0 ; } -atomic_set (&data[thr].ready,1 ); +atomic_set_release (&data[thr].ready,1 );wake_up (&data[thr].go); }
@@ -1393,7 +1393,7 @@ static int load_image_lzo(struct swap_mafor (run_threads = thr, thr =0 ; thr < run_threads; thr++) {wait_event (data[thr].done, -atomic_read (&data[thr].stop)); +atomic_read_acquire (&data[thr].stop));atomic_set (&data[thr].stop,0 ); ret = data[thr].ret;
@@ -1424,7 +1424,7 @@ static int load_image_lzo(struct swap_ma ret =snapshot_write_next (snapshot);if (ret <=0 ) { crc->run_threads = thr +1 ; -atomic_set (&crc->ready,1 ); +atomic_set_release (&crc->ready,1 );wake_up (&crc->go); goto out_finish; }
@@ -1432,13 +1432,13 @@ static int load_image_lzo(struct swap_ma } crc->run_threads = thr; -atomic_set (&crc->ready,1 ); +atomic_set_release (&crc->ready,1 );wake_up (&crc->go); } out_finish:if (crc->run_threads) { -wait_event (crc->done,atomic_read (&crc->stop)); +wait_event (crc->done,atomic_read_acquire (&crc->stop));atomic_set (&crc->stop,0 ); } stop =ktime_get ();
Greg Kroah-Hartman
maintainerPATCH 17/476 hwrng: core - Fix page fault dead lock on mmap-ed hwrng
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
commit 78aafb3884f6bc6636efcc1760c891c8500b9922 upstream.
There is a dead-lock in the hwrng device read path. This triggers when the user reads from /dev/hwrng into memory also mmap-ed from /dev/hwrng. The resulting page fault triggers a recursive read which then dead-locks.
Fix this by using a stack buffer when calling copy_to_user.
--- drivers/char/hw_random/core.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-)
drivers/char/hw_random/core.c +21 -13
@@ -24,10 +24,13 @@#include <linux/random.h> #include <linux/sched.h> #include <linux/slab.h> +#include <linux/string.h> #include <linux/uaccess.h> #define RNG_MODULE_NAME "hw_random" +#define RNG_BUFFER_SIZE (SMP_CACHE_BYTES < 32 ? 32 : SMP_CACHE_BYTES) +static struct hwrng *current_rng;/* the current rng has been explicitly chosen by user via sysfs */ static int cur_rng_set_by_user;
@@ -59,7 +62,7 @@ static inline int rng_get_data(struct hwstatic size_t rng_buffer_size (void ) { -return SMP_CACHE_BYTES <32 ?32 :SMP_CACHE_BYTES ; +return RNG_BUFFER_SIZE ; }static void add_early_randomness (struct hwrng *rng)
@@ -206,6 +209,7 @@ static inline int rng_get_data(struct hwstatic ssize_t rng_dev_read (struct file *filp,char __user *buf,size_t size,loff_t *offp) { +u8 buffer[RNG_BUFFER_SIZE ];ssize_t ret =0 ;int err =0 ;int bytes_read, len;
@@ -233,34 +237,37 @@ static ssize_t rng_dev_read(struct fileif (bytes_read <0 ) { err = bytes_read; goto out_unlock_reading; + }else if (bytes_read ==0 && + (filp->f_flags &O_NONBLOCK )) { + err = -EAGAIN ; + goto out_unlock_reading; } + data_avail = bytes_read; } -if (!data_avail) { -if (filp->f_flags &O_NONBLOCK ) { - err = -EAGAIN ; - goto out_unlock_reading; - } - }else { - len = data_avail; + len = data_avail; +if (len) {if (len > size) len = size; data_avail -= len; -if (copy_to_user (buf + ret, rng_buffer + data_avail, - len)) { +memcpy (buffer, rng_buffer + data_avail, len); + } +mutex_unlock (&reading_mutex); +put_rng (rng); + +if (len) { +if (copy_to_user (buf + ret, buffer, len)) { err = -EFAULT ; - goto out_unlock_reading; + goto out; } size -= len; ret += len; } -mutex_unlock (&reading_mutex); -put_rng (rng);if (need_resched ())schedule_timeout_interruptible (1 );
@@ -271,6 +278,7 @@ static ssize_t rng_dev_read(struct file } } out: +memzero_explicit (buffer,sizeof (buffer));return ret ? : err; out_unlock_reading:
Greg Kroah-Hartman
maintainerPATCH 18/476 crypto: s390/aes - Fix buffer overread in CTR mode
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
commit d07f951903fa9922c375b8ab1ce81b18a0034e3b upstream.
When processing the last block, the s390 ctr code will always read a whole block, even if there isn't a whole block of data left. Fix this by using the actual length left and copy it into a buffer first for processing.
--- arch/s390/crypto/aes_s390.c | 4 +++- arch/s390/crypto/paes_s390.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
arch/s390/crypto/aes_s390.c +3 -1
@@ -601,7 +601,9 @@ static int ctr_aes_crypt(struct skcipher* final block may be < AES_BLOCK_SIZE, copy only nbytes */ if (nbytes) { -cpacf_kmctr (sctx->fc, sctx->key, buf, walk.src.virt.addr, +memset (buf,0 ,AES_BLOCK_SIZE ); +memcpy (buf, walk.src.virt.addr, nbytes); +cpacf_kmctr (sctx->fc, sctx->key, buf, buf,AES_BLOCK_SIZE , walk.iv);memcpy (walk.dst.virt.addr, buf, nbytes);crypto_inc (walk.iv,AES_BLOCK_SIZE );
arch/s390/crypto/paes_s390.c +3 -1
@@ -688,9 +688,11 @@ static int ctr_paes_crypt(struct skciphe* final block may be < AES_BLOCK_SIZE, copy only nbytes */ if (nbytes) { +memset (buf,0 ,AES_BLOCK_SIZE ); +memcpy (buf, walk.src.virt.addr, nbytes);while (1 ) {if (cpacf_kmctr (ctx->fc, ¶m, buf, - walk.src.virt.addr,AES_BLOCK_SIZE , + buf,AES_BLOCK_SIZE , walk.iv) ==AES_BLOCK_SIZE )break ;if (__paes_convert_key (ctx))
Greg Kroah-Hartman
maintainerPATCH 19/476 media: imx355: Enable runtime PM before registering async sub-device
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bingbu Cao <[email protected]>
commit efa5fe19c0a9199f49e36e1f5242ed5c88da617d upstream.
As the sensor device maybe accessible right after its async sub-device is registered, such as ipu-bridge will try to power up sensor by sensor's client device's runtime PM from the async notifier callback, if runtime PM is not enabled, it will fail.
So runtime PM should be ready before its async sub-device is registered and accessible by others.
--- drivers/media/i2c/imx355.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/media/i2c/imx355.c +7 -5
@@ -1784,10 +1784,6 @@ static int imx355_probe(struct i2c_clien goto error_handler_free; } - ret =v4l2_async_register_subdev_sensor (&imx355->sd); -if (ret <0 ) - goto error_media_entity; -/* * Device is already turned on by i2c-core with ACPI domain PM. * Enable runtime PM and turn off the device.
@@ -1796,9 +1792,15 @@ static int imx355_probe(struct i2c_clienpm_runtime_enable (&client->dev);pm_runtime_idle (&client->dev); + ret =v4l2_async_register_subdev_sensor (&imx355->sd); +if (ret <0 ) + goto error_media_entity_runtime_pm; +return 0 ; -error_media_entity: +error_media_entity_runtime_pm: +pm_runtime_disable (&client->dev); +pm_runtime_set_suspended (&client->dev);media_entity_cleanup (&imx355->sd.entity); error_handler_free:
Greg Kroah-Hartman
maintainerPATCH 20/476 rpmsg: virtio: Free driver_override when rpmsg_remove()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiaolei Wang <[email protected]>
commit d5362c37e1f8a40096452fc201c30e705750e687 upstream.
Free driver_override when rpmsg_remove(), otherwise the following memory leak will occur:
unreferenced object 0xffff0000d55d7080 (size 128):
comm "kworker/u8:2", pid 56, jiffies 4294893188 (age 214.272s) hex dump (first 32 bytes):
72 70 6d 73 67 5f 6e 73 00 00 00 00 00 00 00 00 rpmsg_ns........
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<000000009c94c9c1>] __kmem_cache_alloc_node+0x1f8/0x320
[<000000002300d89b>] __kmalloc_node_track_caller+0x44/0x70
[<00000000228a60c3>] kstrndup+0x4c/0x90
[<0000000077158695>] driver_set_override+0xd0/0x164
[<000000003e9c4ea5>] rpmsg_register_device_override+0x98/0x170
[<000000001c0c89a8>] rpmsg_ns_register_device+0x24/0x30
[<000000008bbf8fa2>] rpmsg_probe+0x2e0/0x3ec
[<00000000e65a68df>] virtio_dev_probe+0x1c0/0x280
[<00000000443331cc>] really_probe+0xbc/0x2dc
[<00000000391064b1>] __driver_probe_device+0x78/0xe0
[<00000000a41c9a5b>] driver_probe_device+0xd8/0x160
[<000000009c3bd5df>] __device_attach_driver+0xb8/0x140
[<0000000043cd7614>] bus_for_each_drv+0x7c/0xd4
[<000000003b929a36>] __device_attach+0x9c/0x19c
[<00000000a94e0ba8>] device_initial_probe+0x14/0x20
[<000000003c999637>] bus_probe_device+0xa0/0xac--- drivers/rpmsg/virtio_rpmsg_bus.c | 1 + 1 file changed, 1 insertion(+)
drivers/rpmsg/virtio_rpmsg_bus.c +1 -0
@@ -377,6 +377,7 @@ static void virtio_rpmsg_release_device(struct rpmsg_device *rpdev =to_rpmsg_device (dev);struct virtio_rpmsg_channel *vch =to_virtio_rpmsg_channel (rpdev); +kfree (rpdev->driver_override);kfree (vch); }
Greg Kroah-Hartman
maintainerPATCH 21/476 media: ov9734: Enable runtime PM before registering async sub-device
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bingbu Cao <[email protected]>
commit e242e9c144050ed120cf666642ba96b7c4462a4c upstream.
As the sensor device maybe accessible right after its async sub-device is registered, such as ipu-bridge will try to power up sensor by sensor's client device's runtime PM from the async notifier callback, if runtime PM is not enabled, it will fail.
So runtime PM should be ready before its async sub-device is registered and accessible by others.
--- drivers/media/i2c/ov9734.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/media/i2c/ov9734.c +11 -8
@@ -939,6 +939,7 @@ static int ov9734_remove(struct i2c_cliemedia_entity_cleanup (&sd->entity);v4l2_ctrl_handler_free (sd->ctrl_handler);pm_runtime_disable (&client->dev); +pm_runtime_set_suspended (&client->dev);mutex_destroy (&ov9734->mutex);return 0 ;
@@ -986,13 +987,6 @@ static int ov9734_probe(struct i2c_clien goto probe_error_v4l2_ctrl_handler_free; } - ret =v4l2_async_register_subdev_sensor (&ov9734->sd); -if (ret <0 ) { -dev_err (&client->dev,"failed to register V4L2 subdev: %d" , - ret); - goto probe_error_media_entity_cleanup; - } -/* * Device is already turned on by i2c-core with ACPI domain PM. * Enable runtime PM and turn off the device.
@@ -1001,9 +995,18 @@ static int ov9734_probe(struct i2c_clienpm_runtime_enable (&client->dev);pm_runtime_idle (&client->dev); + ret =v4l2_async_register_subdev_sensor (&ov9734->sd); +if (ret <0 ) { +dev_err (&client->dev,"failed to register V4L2 subdev: %d" , + ret); + goto probe_error_media_entity_cleanup_pm; + } +return 0 ; -probe_error_media_entity_cleanup: +probe_error_media_entity_cleanup_pm: +pm_runtime_disable (&client->dev); +pm_runtime_set_suspended (&client->dev);media_entity_cleanup (&ov9734->sd.entity); probe_error_v4l2_ctrl_handler_free:
Greg Kroah-Hartman
maintainerPATCH 22/476 mips: Fix max_mapnr being uninitialized on early stages
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Serge Semin <[email protected]>
commit e1a9ae45736989c972a8d1c151bc390678ae6205 upstream.
max_mapnr variable is utilized in the pfn_valid() method in order to determine the upper PFN space boundary. Having it uninitialized effectively makes any PFN passed to that method invalid. That in its turn causes the kernel mm-subsystem occasion malfunctions even after the max_mapnr variable is actually properly updated. For instance, pfn_valid() is called in the init_unavailable_range() method in the framework of the calls-chain on MIPS:setup_arch()
+-> paging_init()
+-> free_area_init()
+-> memmap_init()
+-> memmap_init_zone_range()
+-> init_unavailable_range()Since pfn_valid() always returns "false" value before max_mapnr is initialized in the mem_init() method, any flatmem page-holes will be left in the poisoned/uninitialized state including the IO-memory pages. Thus any further attempts to map/remap the IO-memory by using MMU may fail. In particular it happened in my case on attempt to map the SRAM region. The kernel bootup procedure just crashed on the unhandled unaligned access bug raised in the __update_cache() method:
Quoted 11 lines
Unhandled kernel unaligned access[#1]:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.7.0-rc1-XXX-dirty #2056 ... Call Trace: [<8011ef9c>] __update_cache+0x88/0x1bc [<80385944>] ioremap_page_range+0x110/0x2a4 [<80126948>] ioremap_prot+0x17c/0x1f4 [<80711b80>] __devm_ioremap+0x8c/0x120 [<80711e0c>] __devm_ioremap_resource+0xf4/0x218 [<808bf244>] sram_probe+0x4f4/0x930 [<80889d20>] platform_probe+0x68/0xec
Quoted 1 line
...
Let's fix the problem by initializing the max_mapnr variable as soon as the required data is available. In particular it can be done right in the paging_init() method before free_area_init() is called since all the PFN zone boundaries have already been calculated by that time.
--- arch/mips/mm/init.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
arch/mips/mm/init.c +5 -7
@@ -417,7 +417,12 @@ void __init paging_init(void) (highend_pfn - max_low_pfn) << (PAGE_SHIFT - 10)); max_zone_pfns[ZONE_HIGHMEM] = max_low_pfn; } + + max_mapnr = highend_pfn ? highend_pfn : max_low_pfn; +#else + max_mapnr = max_low_pfn;#endif + high_memory = (void *)__va (max_low_pfn <<PAGE_SHIFT );free_area_init (max_zone_pfns); }
@@ -453,13 +458,6 @@ void __init mem_init(void)*/ BUILD_BUG_ON (IS_ENABLED (CONFIG_32BIT ) && (_PFN_SHIFT >PAGE_SHIFT )); -#ifdef CONFIG_HIGHMEM - max_mapnr = highend_pfn ? highend_pfn : max_low_pfn; -#else - max_mapnr = max_low_pfn; -#endif - high_memory = (void *)__va (max_low_pfn <<PAGE_SHIFT ); -maar_init ();memblock_free_all ();setup_zero_pages ();/* Setup zeroed pages. */
Greg Kroah-Hartman
maintainerPATCH 23/476 bus: mhi: host: Drop chan lock before queuing buffers
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qiang Yu <[email protected]>
commit 01bd694ac2f682fb8017e16148b928482bc8fa4b upstream.
Ensure read and write locks for the channel are not taken in succession by dropping the read lock from parse_xfer_event() such that a callback given to client can potentially queue buffers and acquire the write lock in that process. Any queueing of buffers should be done without channel read lock acquired as it can result in multiple locks and a soft lockup.
--- drivers/bus/mhi/host/main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/bus/mhi/host/main.c +4 -0
@@ -633,6 +633,8 @@ static int parse_xfer_event(struct mhi_cmhi_del_ring_element (mhi_cntrl, tre_ring); local_rp = tre_ring->rp; +read_unlock_bh (&mhi_chan->lock); +/* notify client */ mhi_chan->xfer_cb (mhi_chan->mhi_dev, &result);
@@ -658,6 +660,8 @@ static int parse_xfer_event(struct mhi_ckfree (buf_info->cb_buf); } } + +read_lock_bh (&mhi_chan->lock); }break ; }/* CC_EOT */
Greg Kroah-Hartman
maintainerPATCH 24/476 bus: mhi: host: Add spinlock to protect WP access when queueing TREs
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bhaumik Bhatt <[email protected]>
commit b89b6a863dd53bc70d8e52d50f9cfaef8ef5e9c9 upstream.
Protect WP accesses such that multiple threads queueing buffers for incoming data do not race.
Meanwhile, if CONFIG_TRACE_IRQFLAGS is enabled, irq will be enabled once __local_bh_enable_ip is called as part of write_unlock_bh. Hence, let's take irqsave lock after TRE is generated to avoid running write_unlock_bh when irqsave lock is held.
--- drivers/bus/mhi/host/main.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
drivers/bus/mhi/host/main.c +13 -9
@@ -1114,17 +1114,15 @@ static int mhi_queue(struct mhi_device *if (unlikely (MHI_PM_IN_ERROR_STATE (mhi_cntrl->pm_state)))return -EIO ; -read_lock_irqsave (&mhi_cntrl->pm_lock, flags); - ret =mhi_is_ring_full (mhi_cntrl, tre_ring); -if (unlikely (ret)) { - ret = -EAGAIN ; - goto exit_unlock; - } +if (unlikely (ret)) +return -EAGAIN ; ret =mhi_gen_tre (mhi_cntrl, mhi_chan, buf_info, mflags);if (unlikely (ret)) - goto exit_unlock; +return ret; + +read_lock_irqsave (&mhi_cntrl->pm_lock, flags);/* Packet is queued, take a usage ref to exit M3 if necessary * for host->device buffer, balanced put is done on buffer completion
@@ -1144,7 +1142,6 @@ static int mhi_queue(struct mhi_device *if (dir ==DMA_FROM_DEVICE ) mhi_cntrl->runtime_put (mhi_cntrl); -exit_unlock:read_unlock_irqrestore (&mhi_cntrl->pm_lock, flags);return ret;
@@ -1196,6 +1193,9 @@ int mhi_gen_tre(struct mhi_controller *mint eot, eob, chain, bei;int ret; +/* Protect accesses for reading and incrementing WP */ +write_lock_bh (&mhi_chan->lock); + buf_ring = &mhi_chan->buf_ring; tre_ring = &mhi_chan->tre_ring;
@@ -1213,8 +1213,10 @@ int mhi_gen_tre(struct mhi_controller *mif (!info->pre_mapped) { ret = mhi_cntrl->map_single (mhi_cntrl, buf_info); -if (ret) +if (ret) { +write_unlock_bh (&mhi_chan->lock);return ret; + } } eob = !!(flags &MHI_EOB );
@@ -1231,6 +1233,8 @@ int mhi_gen_tre(struct mhi_controller *mmhi_add_ring_element (mhi_cntrl, tre_ring);mhi_add_ring_element (mhi_cntrl, buf_ring); +write_unlock_bh (&mhi_chan->lock); +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 25/476 parisc/firmware: Fix F-extend for PDC addresses
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit 735ae74f73e55c191d48689bd11ff4a06ea0508f upstream.
When running with narrow firmware (64-bit kernel using a 32-bit firmware), extend PDC addresses into the 0xfffffff0.00000000 region instead of the 0xf0f0f0f0.00000000 region.
This fixes the power button on the C3700 machine in qemu (64-bit CPU with 32-bit firmware), and my assumption is that the previous code was really never used (because most 64-bit machines have a 64-bit firmware), or it just worked on very old machines because they may only decode 40-bit of virtual addresses.
--- arch/parisc/kernel/firmware.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/parisc/kernel/firmware.c +2 -2
@@ -123,10 +123,10 @@ static unsigned long f_extend(unsigned l#ifdef CONFIG_64BIT if (unlikely (parisc_narrow_firmware)) {if ((address &0xff000000 ) ==0xf0000000 ) -return 0xf0f0f0f000000000UL | (u32 )address; +return (0xfffffff0UL <<32 ) | (u32 )address;if ((address &0xf0000000 ) ==0xf0000000 ) -return 0xffffffff00000000UL | (u32 )address; +return (0xffffffffUL <<32 ) | (u32 )address; }#endif return address;
Greg Kroah-Hartman
maintainerPATCH 26/476 async: Split async_schedule_node_domain()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
commit 6aa09a5bccd8e224d917afdb4c278fc66aacde4d upstream.
In preparation for subsequent changes, split async_schedule_node_domain() in two pieces so as to allow the bottom part of it to be called from a somewhat different code path.
No functional impact.
--- kernel/async.c | 56 ++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 22 deletions(-)
kernel/async.c +34 -22
@@ -145,6 +145,39 @@ static void async_run_entry_fn(struct wowake_up (&async_done); } +static async_cookie_t __async_schedule_node_domain (async_func_t func, +void *data,int node, +struct async_domain *domain, +struct async_entry *entry) +{ +async_cookie_t newcookie; +unsigned long flags; + +INIT_LIST_HEAD (&entry->domain_list); +INIT_LIST_HEAD (&entry->global_list); +INIT_WORK (&entry->work, async_run_entry_fn); + entry->func = func; + entry->data = data; + entry->domain = domain; + +spin_lock_irqsave (&async_lock, flags); + +/* allocate cookie and queue */ + newcookie = entry->cookie = next_cookie++; + +list_add_tail (&entry->domain_list, &domain->pending); +if (domain->registered) +list_add_tail (&entry->global_list, &async_global_pending); + +atomic_inc (&entry_count); +spin_unlock_irqrestore (&async_lock, flags); + +/* schedule for execution */ +queue_work_node (node, system_unbound_wq, &entry->work); + +return newcookie; +} +/** * async_schedule_node_domain - NUMA specific version of async_schedule_domain * @func: function to execute asynchronously
@@ -186,29 +219,8 @@ async_cookie_t async_schedule_node_domaifunc (data, newcookie);return newcookie; } -INIT_LIST_HEAD (&entry->domain_list); -INIT_LIST_HEAD (&entry->global_list); -INIT_WORK (&entry->work, async_run_entry_fn); - entry->func = func; - entry->data = data; - entry->domain = domain; - -spin_lock_irqsave (&async_lock, flags); -/* allocate cookie and queue */ - newcookie = entry->cookie = next_cookie++; - -list_add_tail (&entry->domain_list, &domain->pending); -if (domain->registered) -list_add_tail (&entry->global_list, &async_global_pending); - -atomic_inc (&entry_count); -spin_unlock_irqrestore (&async_lock, flags); - -/* schedule for execution */ -queue_work_node (node, system_unbound_wq, &entry->work); - -return newcookie; +return __async_schedule_node_domain (func, data, node, domain, entry); }EXPORT_SYMBOL_GPL (async_schedule_node_domain);
Greg Kroah-Hartman
maintainerPATCH 27/476 async: Introduce async_schedule_dev_nocall()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
commit 7d4b5d7a37bdd63a5a3371b988744b060d5bb86f upstream.
In preparation for subsequent changes, introduce a specialized variant of async_schedule_dev() that will not invoke the argument function synchronously when it cannot be scheduled for asynchronous execution.
The new function, async_schedule_dev_nocall(), will be used for fixing possible deadlocks in the system-wide power management core code.
--- include/linux/async.h | 2 ++ kernel/async.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+)
include/linux/async.h +2 -0
@@ -90,6 +90,8 @@ async_schedule_dev(async_func_t func, streturn async_schedule_node (func, dev,dev_to_node (dev)); } +bool async_schedule_dev_nocall (async_func_t func,struct device *dev); +/** * async_schedule_dev_domain - A device specific version of async_schedule_domain * @func: function to execute asynchronously
kernel/async.c +29 -0
@@ -244,6 +244,35 @@ async_cookie_t async_schedule_node(asyncEXPORT_SYMBOL_GPL (async_schedule_node);/** +* async_schedule_dev_nocall - A simplified variant of async_schedule_dev() +* @func: function to execute asynchronously +* @dev: device argument to be passed to function +* +* @dev is used as both the argument for the function and to provide NUMA +* context for where to run the function. +* +* If the asynchronous execution of @func is scheduled successfully, return +* true. Otherwise, do nothing and return false, unlike async_schedule_dev() +* that will run the function synchronously then. +*/ +bool async_schedule_dev_nocall (async_func_t func,struct device *dev) +{ +struct async_entry *entry; + + entry =kzalloc (sizeof (struct async_entry ),GFP_KERNEL ); + +/* Give up if there is no memory or too much work. */ +if (!entry ||atomic_read (&entry_count) >MAX_WORK ) { +kfree (entry); +return false; + } + +__async_schedule_node_domain (func, dev,dev_to_node (dev), + &async_dfl_domain, entry); +return true; +} + +/** * async_synchronize_full - synchronize all asynchronous function calls * * This function waits until all asynchronous function calls have been done.
Greg Kroah-Hartman
maintainerPATCH 28/476 arm64: dts: qcom: sc7180: fix USB wakeup interrupt types
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 9b956999bf725fd62613f719c3178fdbee6e5f47 upstream.
The DP/DM wakeup interrupts are edge triggered and which edge to trigger on depends on use-case and whether a Low speed or Full/High speed device is connected.
--- arch/arm64/boot/dts/qcom/sc7180.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sc7180.dtsi +2 -2
@@ -2774,8 +2774,8 @@ interrupts-extended = <&intc GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>, <&pdc 6 IRQ_TYPE_LEVEL_HIGH>, - <&pdc 8 IRQ_TYPE_LEVEL_HIGH>, - <&pdc 9 IRQ_TYPE_LEVEL_HIGH>; + <&pdc 8 IRQ_TYPE_EDGE_BOTH>, + <&pdc 9 IRQ_TYPE_EDGE_BOTH>; interrupt-names = "hs_phy_irq", "ss_phy_irq", "dm_hs_phy_irq", "dp_hs_phy_irq";
Greg Kroah-Hartman
maintainerPATCH 29/476 arm64: dts: qcom: sdm845: fix USB wakeup interrupt types
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 84ad9ac8d9ca29033d589e79a991866b38e23b85 upstream.
The DP/DM wakeup interrupts are edge triggered and which edge to trigger on depends on use-case and whether a Low speed or Full/High speed device is connected.
--- arch/arm64/boot/dts/qcom/sdm845.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/sdm845.dtsi +4 -4
@@ -3769,8 +3769,8 @@ interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 486 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 488 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 489 IRQ_TYPE_LEVEL_HIGH>; + <GIC_SPI 488 IRQ_TYPE_EDGE_BOTH>, + <GIC_SPI 489 IRQ_TYPE_EDGE_BOTH>; interrupt-names = "hs_phy_irq", "ss_phy_irq", "dm_hs_phy_irq", "dp_hs_phy_irq";
@@ -3817,8 +3817,8 @@ interrupts = <GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 487 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 490 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 491 IRQ_TYPE_LEVEL_HIGH>; + <GIC_SPI 490 IRQ_TYPE_EDGE_BOTH>, + <GIC_SPI 491 IRQ_TYPE_EDGE_BOTH>; interrupt-names = "hs_phy_irq", "ss_phy_irq", "dm_hs_phy_irq", "dp_hs_phy_irq";
Greg Kroah-Hartman
maintainerPATCH 30/476 arm64: dts: qcom: sm8150: fix USB wakeup interrupt types
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 54524b6987d1fffe64cbf3dded1b2fa6b903edf9 upstream.
The DP/DM wakeup interrupts are edge triggered and which edge to trigger on depends on use-case and whether a Low speed or Full/High speed device is connected.
--- arch/arm64/boot/dts/qcom/sm8150.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/sm8150.dtsi +4 -4
@@ -3094,8 +3094,8 @@ interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 486 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 488 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 489 IRQ_TYPE_LEVEL_HIGH>; + <GIC_SPI 488 IRQ_TYPE_EDGE_BOTH>, + <GIC_SPI 489 IRQ_TYPE_EDGE_BOTH>; interrupt-names = "hs_phy_irq", "ss_phy_irq", "dm_hs_phy_irq", "dp_hs_phy_irq";
@@ -3139,8 +3139,8 @@ interrupts = <GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 487 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 490 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 491 IRQ_TYPE_LEVEL_HIGH>; + <GIC_SPI 490 IRQ_TYPE_EDGE_BOTH>, + <GIC_SPI 491 IRQ_TYPE_EDGE_BOTH>; interrupt-names = "hs_phy_irq", "ss_phy_irq", "dm_hs_phy_irq", "dp_hs_phy_irq";
Greg Kroah-Hartman
maintainerPATCH 31/476 arm64: dts: qcom: sdm845: fix USB DP/DM HS PHY interrupts
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 204f9ed4bad6293933179517624143b8f412347c upstream.
The USB DP/DM HS PHY interrupts need to be provided by the PDC interrupt controller in order to be able to wake the system up from low-power states and to be able to detect disconnect events, which requires triggering on falling edges.
A recent commit updated the trigger type but failed to change the interrupt provider as required. This leads to the current Linux driver failing to probe instead of printing an error during suspend and USB wakeup not working as intended.
--- arch/arm64/boot/dts/qcom/sdm845.dtsi | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
arch/arm64/boot/dts/qcom/sdm845.dtsi +8 -8
@@ -3767,10 +3767,10 @@ <&gcc GCC_USB30_PRIM_MASTER_CLK>; assigned-clock-rates = <19200000>, <150000000>; - interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 486 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 488 IRQ_TYPE_EDGE_BOTH>, - <GIC_SPI 489 IRQ_TYPE_EDGE_BOTH>; + interrupts-extended = <&intc GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>, + <&intc GIC_SPI 486 IRQ_TYPE_LEVEL_HIGH>, + <&pdc_intc 8 IRQ_TYPE_EDGE_BOTH>, + <&pdc_intc 9 IRQ_TYPE_EDGE_BOTH>; interrupt-names = "hs_phy_irq", "ss_phy_irq", "dm_hs_phy_irq", "dp_hs_phy_irq";
@@ -3815,10 +3815,10 @@ <&gcc GCC_USB30_SEC_MASTER_CLK>; assigned-clock-rates = <19200000>, <150000000>; - interrupts = <GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 487 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 490 IRQ_TYPE_EDGE_BOTH>, - <GIC_SPI 491 IRQ_TYPE_EDGE_BOTH>; + interrupts-extended = <&intc GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>, + <&intc GIC_SPI 487 IRQ_TYPE_LEVEL_HIGH>, + <&pdc_intc 10 IRQ_TYPE_EDGE_BOTH>, + <&pdc_intc 11 IRQ_TYPE_EDGE_BOTH>; interrupt-names = "hs_phy_irq", "ss_phy_irq", "dm_hs_phy_irq", "dp_hs_phy_irq";
Greg Kroah-Hartman
maintainerPATCH 32/476 lsm: new security_file_ioctl_compat() hook
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alfred Piccioni <[email protected]>
commit f1bb47a31dff6d4b34fb14e99850860ee74bb003 upstream.
Some ioctl commands do not require ioctl permission, but are routed to other permissions such as FILE_GETATTR or FILE_SETATTR. This routing is done by comparing the ioctl cmd to a set of 64-bit flags (FS_IOC_*).
However, if a 32-bit process is running on a 64-bit kernel, it emits 32-bit flags (FS_IOC32_*) for certain ioctl operations. These flags are being checked erroneously, which leads to these ioctl operations being routed to the ioctl permission, rather than the correct file permissions.
This was also noted in a RED-PEN finding from a while back - "/* RED-PEN how should LSM module know it's handling 32bit? */".
This patch introduces a new hook, security_file_ioctl_compat(), that is called from the compat ioctl syscall. All current LSMs have been changed to support this hook.
Reviewing the three places where we are currently using security_file_ioctl(), it appears that only SELinux needs a dedicated compat change; TOMOYO and SMACK appear to be functional without any change.
--- fs/ioctl.c | 3 +-- include/linux/lsm_hook_defs.h | 2 ++ include/linux/security.h | 9 +++++++++ security/security.c | 18 ++++++++++++++++++ security/selinux/hooks.c | 28 ++++++++++++++++++++++++++++ security/smack/smack_lsm.c | 1 + security/tomoyo/tomoyo.c | 1 + 7 files changed, 60 insertions(+), 2 deletions(-)
fs/ioctl.c +1 -2
@@ -920,8 +920,7 @@ COMPAT_SYSCALL_DEFINE3(ioctl, unsigned iif (!f.file)return -EBADF ; -/* RED-PEN how should LSM module know it's handling 32bit? */ - error =security_file_ioctl (f.file, cmd, arg); + error =security_file_ioctl_compat (f.file, cmd, arg);if (error) goto out;
include/linux/lsm_hook_defs.h +2 -0
@@ -165,6 +165,8 @@ LSM_HOOK(int, 0, file_alloc_security, st LSM_HOOK(void, LSM_RET_VOID, file_free_security, struct file *file) LSM_HOOK(int, 0, file_ioctl, struct file *file, unsigned int cmd, unsigned long arg) +LSM_HOOK(int, 0, file_ioctl_compat, struct file *file, unsigned int cmd, + unsigned long arg) LSM_HOOK(int, 0, mmap_addr, unsigned long addr) LSM_HOOK(int, 0, mmap_file, struct file *file, unsigned long reqprot, unsigned long prot, unsigned long flags)
include/linux/security.h +9 -0
@@ -382,6 +382,8 @@ int security_file_permission(struct fileint security_file_alloc (struct file *file);void security_file_free (struct file *file);int security_file_ioctl (struct file *file,unsigned int cmd,unsigned long arg); +int security_file_ioctl_compat (struct file *file,unsigned int cmd, +unsigned long arg);int security_mmap_file (struct file *file,unsigned long prot,unsigned long flags);int security_mmap_addr (unsigned long addr);
@@ -962,6 +964,13 @@ static inline int security_file_ioctl(st {return 0 ; } + +static inline int security_file_ioctl_compat (struct file *file, +unsigned int cmd, +unsigned long arg) +{ +return 0 ; +}static inline int security_mmap_file (struct file *file,unsigned long prot,unsigned long flags)
security/security.c +18 -0
@@ -1556,6 +1556,24 @@ int security_file_ioctl(struct file *fil }EXPORT_SYMBOL_GPL (security_file_ioctl); +/** +* security_file_ioctl_compat() - Check if an ioctl is allowed in compat mode +* @file: associated file +* @cmd: ioctl cmd +* @arg: ioctl arguments +* +* Compat version of security_file_ioctl() that correctly handles 32-bit +* processes running on 64-bit kernels. +* +* Return: Returns 0 if permission is granted. +*/ +int security_file_ioctl_compat (struct file *file,unsigned int cmd, +unsigned long arg) +{ +return call_int_hook (file_ioctl_compat,0 , file, cmd, arg); +} +EXPORT_SYMBOL_GPL (security_file_ioctl_compat); +static inline unsigned long mmap_prot (struct file *file,unsigned long prot) {/*
security/selinux/hooks.c +28 -0
@@ -3810,6 +3810,33 @@ static int selinux_file_ioctl(struct filreturn error; } +static int selinux_file_ioctl_compat (struct file *file,unsigned int cmd, +unsigned long arg) +{ +/* +* If we are in a 64-bit kernel running 32-bit userspace, we need to +* make sure we don't compare 32-bit flags to 64-bit flags. +*/ +switch (cmd) { +case FS_IOC32_GETFLAGS : + cmd =FS_IOC_GETFLAGS ; +break ; +case FS_IOC32_SETFLAGS : + cmd =FS_IOC_SETFLAGS ; +break ; +case FS_IOC32_GETVERSION : + cmd =FS_IOC_GETVERSION ; +break ; +case FS_IOC32_SETVERSION : + cmd =FS_IOC_SETVERSION ; +break ; +default : +break ; + } + +return selinux_file_ioctl (file, cmd, arg); +} +static int default_noexec__ro_after_init ;static int file_map_prot_check (struct file *file,unsigned long prot,int shared)
@@ -7208,6 +7235,7 @@ static struct security_hook_list selinuxLSM_HOOK_INIT (file_permission, selinux_file_permission),LSM_HOOK_INIT (file_alloc_security, selinux_file_alloc_security),LSM_HOOK_INIT (file_ioctl, selinux_file_ioctl), +LSM_HOOK_INIT (file_ioctl_compat, selinux_file_ioctl_compat),LSM_HOOK_INIT (mmap_file, selinux_mmap_file),LSM_HOOK_INIT (mmap_addr, selinux_mmap_addr), LSM_HOOK_INIT(file_mprotect, selinux_file_mprotect),
security/smack/smack_lsm.c +1 -0
@@ -4767,6 +4767,7 @@ static struct security_hook_list smack_hLSM_HOOK_INIT (file_alloc_security, smack_file_alloc_security),LSM_HOOK_INIT (file_ioctl, smack_file_ioctl), +LSM_HOOK_INIT (file_ioctl_compat, smack_file_ioctl),LSM_HOOK_INIT (file_lock, smack_file_lock),LSM_HOOK_INIT (file_fcntl, smack_file_fcntl), LSM_HOOK_INIT(mmap_file, smack_mmap_file),
security/tomoyo/tomoyo.c +1 -0
@@ -546,6 +546,7 @@ static struct security_hook_list tomoyo_LSM_HOOK_INIT (path_rename, tomoyo_path_rename),LSM_HOOK_INIT (inode_getattr, tomoyo_inode_getattr),LSM_HOOK_INIT (file_ioctl, tomoyo_file_ioctl), +LSM_HOOK_INIT (file_ioctl_compat, tomoyo_file_ioctl),LSM_HOOK_INIT (path_chmod, tomoyo_path_chmod),LSM_HOOK_INIT (path_chown, tomoyo_path_chown), LSM_HOOK_INIT(path_chroot, tomoyo_path_chroot),
Greg Kroah-Hartman
maintainerPATCH 33/476 scripts/get_abi: fix source path leak
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vegard Nossum <[email protected]>
commit 5889d6ede53bc17252f79c142387e007224aa554 upstream.
The code currently leaks the absolute path of the ABI files into the rendered documentation.
There exists code to prevent this, but it is not effective when an absolute path is passed, which it is when $srctree is used.
I consider this to be a minimal, stop-gap fix; a better fix would strip off the actual prefix instead of hacking it off with a regex.
--- scripts/get_abi.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/get_abi.pl +1 -1
@@ -75,7 +75,7 @@ sub parse_abi { $name =~ s,.*/,,; my $fn = $file; - $fn =~ s,Documentation/ABI/,,; + $fn =~ s,.*Documentation/ABI/,,; my $nametag = "File $fn"; $data{$nametag}->{what} = "File $name";
Greg Kroah-Hartman
maintainerPATCH 34/476 mmc: core: Use mrq.sbc in close-ended ffu
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avri Altman <[email protected]>
commit 4d0c8d0aef6355660b6775d57ccd5d4ea2e15802 upstream.
Field Firmware Update (ffu) may use close-ended or open ended sequence. Each such sequence is comprised of a write commands enclosed between 2 switch commands - to and from ffu mode. So for the close-ended case, it will be: cmd6->cmd23-cmd25-cmd6.
Some host controllers however, get confused when multi-block rw is sent without sbc, and may generate auto-cmd12 which breaks the ffu sequence. I encountered this issue while testing fwupd (github.com/fwupd/fwupd) on HP Chromebook x2, a qualcomm based QC-7c, code name - strongbad.
Instead of a quirk, or hooking the request function of the msm ops, it would be better to fix the ioctl handling and make it use mrq.sbc instead of issuing SET_BLOCK_COUNT separately.
--- drivers/mmc/core/block.c | 46 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-)
drivers/mmc/core/block.c +43 -3
@@ -399,6 +399,10 @@ struct mmc_blk_ioc_data {struct mmc_ioc_cmd ic;unsigned char *buf;u64 buf_bytes; +unsigned int flags; +#define MMC_BLK_IOC_DROP BIT(0)/* drop this mrq */ +#define MMC_BLK_IOC_SBC BIT(1)/* use mrq.sbc */ +struct mmc_rpmb_data *rpmb; };
@@ -464,7 +468,7 @@ static int mmc_blk_ioctl_copy_to_user(st }static int __mmc_blk_ioctl_cmd (struct mmc_card *card,struct mmc_blk_data *md, -struct mmc_blk_ioc_data *idata) +struct mmc_blk_ioc_data **idatas,int i) {struct mmc_command cmd = {}, sbc = {};struct mmc_data data = {};
@@ -472,10 +476,18 @@ static int __mmc_blk_ioctl_cmd(struct mmstruct scatterlist sg;int err;unsigned int target_part; +struct mmc_blk_ioc_data *idata = idatas[i]; +struct mmc_blk_ioc_data *prev_idata =NULL ;if (!card || !md || !idata)return -EINVAL ; +if (idata->flags &MMC_BLK_IOC_DROP ) +return 0 ; + +if (idata->flags &MMC_BLK_IOC_SBC ) + prev_idata = idatas[i -1 ]; +/* * The RPMB accesses comes in from the character device, so we * need to target these explicitly. Else we just target the
@@ -542,7 +554,7 @@ static int __mmc_blk_ioctl_cmd(struct mmreturn err; } -if (idata->rpmb) { +if (idata->rpmb || prev_idata) { sbc.opcode =MMC_SET_BLOCK_COUNT ;/* * We don't do any blockcount validation because the max size
@@ -550,6 +562,8 @@ static int __mmc_blk_ioctl_cmd(struct mm* 'Reliable Write' bit here. */ sbc.arg = data.blocks | (idata->ic.write_flag &BIT (31 )); +if (prev_idata) + sbc.arg = prev_idata->ic.arg; sbc.flags =MMC_RSP_R1 |MMC_CMD_AC ; mrq.sbc = &sbc; }
@@ -561,6 +575,15 @@ static int __mmc_blk_ioctl_cmd(struct mmmmc_wait_for_req (card->host, &mrq);memcpy (&idata->ic.response, cmd.resp,sizeof (cmd.resp)); +if (prev_idata) { +memcpy (&prev_idata->ic.response, sbc.resp,sizeof (sbc.resp)); +if (sbc.error) { +dev_err (mmc_dev (card->host),"%s: sbc error %d\n" , + __func__, sbc.error); +return sbc.error; + } + } +if (cmd.error) {dev_err (mmc_dev (card->host),"%s: cmd error %d\n" , __func__, cmd.error);
@@ -1030,6 +1053,20 @@ static inline void mmc_blk_reset_success md->reset_done &= ~type; } +static void mmc_blk_check_sbc (struct mmc_queue_req *mq_rq) +{ +struct mmc_blk_ioc_data **idata = mq_rq->drv_op_data; +int i; + +for (i =1 ; i < mq_rq->ioc_count; i++) { +if (idata[i -1 ]->ic.opcode ==MMC_SET_BLOCK_COUNT && +mmc_op_multi (idata[i]->ic.opcode)) { + idata[i -1 ]->flags |=MMC_BLK_IOC_DROP ; + idata[i]->flags |=MMC_BLK_IOC_SBC ; + } + } +} +/* * The non-block commands come back from the block layer after it queued it and * processed it with all other requests and then they get issued in this
@@ -1057,11 +1094,14 @@ static void mmc_blk_issue_drv_op(structif (ret)break ; } + +mmc_blk_check_sbc (mq_rq); + fallthrough;case MMC_DRV_OP_IOCTL_RPMB : idata = mq_rq->drv_op_data;for (i =0 , ret =0 ; i < mq_rq->ioc_count; i++) { - ret =__mmc_blk_ioctl_cmd (card, md, idata[i]); + ret =__mmc_blk_ioctl_cmd (card, md, idata, i);if (ret)break ; }
Greg Kroah-Hartman
maintainerPATCH 35/476 mmc: mmc_spi: remove custom DMA mapped buffers
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
commit 84a6be7db9050dd2601c9870f65eab9a665d2d5d upstream.
There is no need to duplicate what SPI core or individual controller drivers already do, i.e. mapping the buffers for DMA capable transfers.
Note, that the code, besides its redundancy, was buggy: strictly speaking there is no guarantee, while it's true for those which can use this code (see below), that the SPI host controller _is_ the device which does DMA.
Also see the Link tags below.
Additional notes. Currently only two SPI host controller drivers may use premapped (by the user) DMA buffers:
- drivers/spi/spi-au1550.c
- drivers/spi/spi-fsl-spi.c
Both of them have DMA mapping support code. I don't expect that SPI host controller code is worse than what has been done in mmc_spi. Hence I do not expect any regressions here. Otherwise, I'm pretty much sure these regressions have to be fixed in the respective drivers, and not here.
That said, remove all related pieces of DMA mapping code from mmc_spi.
--- drivers/mmc/host/mmc_spi.c | 186 +-------------------------------------------- 1 file changed, 5 insertions(+), 181 deletions(-)
drivers/mmc/host/mmc_spi.c +5 -181
@@ -15,7 +15,7 @@#include <linux/slab.h> #include <linux/module.h> #include <linux/bio.h> -#include <linux/dma-mapping.h> +#include <linux/dma-direction.h> #include <linux/crc7.h> #include <linux/crc-itu-t.h> #include <linux/scatterlist.h>
@@ -119,19 +119,14 @@ struct mmc_spi_host {struct spi_transfer status;struct spi_message readback; -/* underlying DMA-aware controller, or null */ -struct device *dma_dev; -/* buffer used for commands and for message "overhead" */ struct scratch *data; -dma_addr_t data_dma;/* Specs say to write ones most of the time, even when the card * has no need to read its input data; and many cards won't care. * This is our source of those ones. */ void *ones; -dma_addr_t ones_dma; };
@@ -147,11 +142,8 @@ static inline int mmc_cs_off(struct mmc_return spi_setup (host->spi); } -static int -mmc_spi_readbytes (struct mmc_spi_host *host,unsigned len) +static int mmc_spi_readbytes (struct mmc_spi_host *host,unsigned int len) { -int status; -if (len >sizeof (*host->data)) {WARN_ON (1 );return -EIO ;
@@ -159,19 +151,7 @@ mmc_spi_readbytes(struct mmc_spi_host *h host->status.len = len; -if (host->dma_dev) -dma_sync_single_for_device (host->dma_dev, - host->data_dma,sizeof (*host->data), -DMA_FROM_DEVICE ); - - status =spi_sync_locked (host->spi, &host->readback); - -if (host->dma_dev) -dma_sync_single_for_cpu (host->dma_dev, - host->data_dma,sizeof (*host->data), -DMA_FROM_DEVICE ); - -return status; +return spi_sync_locked (host->spi, &host->readback); } static int mmc_spi_skip(struct mmc_spi_host *host, unsigned long timeout,
@@ -506,23 +486,11 @@ mmc_spi_command_send(struct mmc_spi_host t = &host->t;memset (t,0 ,sizeof (*t)); t->tx_buf = t->rx_buf = data->status; - t->tx_dma = t->rx_dma = host->data_dma; t->len = cp - data->status; t->cs_change =1 ;spi_message_add_tail (t, &host->m); -if (host->dma_dev) { - host->m.is_dma_mapped =1 ; -dma_sync_single_for_device (host->dma_dev, - host->data_dma,sizeof (*host->data), -DMA_BIDIRECTIONAL ); - } status =spi_sync_locked (host->spi, &host->m); - -if (host->dma_dev) -dma_sync_single_for_cpu (host->dma_dev, - host->data_dma,sizeof (*host->data), -DMA_BIDIRECTIONAL );if (status <0 ) {dev_dbg (&host->spi->dev," ... write returned %d\n" , status); cmd->error = status;
@@ -540,9 +508,6 @@ mmc_spi_command_send(struct mmc_spi_host* We always provide TX data for data and CRC. The MMC/SD protocol * requires us to write ones; but Linux defaults to writing zeroes; * so we explicitly initialize it to all ones on RX paths. -* -* We also handle DMA mapping, so the underlying SPI controller does -* not need to (re)do it for each message. */ static void mmc_spi_setup_data_message(
@@ -552,11 +517,8 @@ mmc_spi_setup_data_message( {struct spi_transfer *t;struct scratch *scratch = host->data; -dma_addr_t dma = host->data_dma;spi_message_init (&host->m); -if (dma) - host->m.is_dma_mapped =1 ;/* for reads, readblock() skips 0xff bytes before finding * the token; for writes, this transfer issues that token.
@@ -570,8 +532,6 @@ mmc_spi_setup_data_message(else scratch->data_token =SPI_TOKEN_SINGLE ; t->tx_buf = &scratch->data_token; -if (dma) - t->tx_dma = dma + offsetof(struct scratch , data_token);spi_message_add_tail (t, &host->m); }
@@ -581,7 +541,6 @@ mmc_spi_setup_data_message( t = &host->t;memset (t,0 ,sizeof (*t)); t->tx_buf = host->ones; - t->tx_dma = host->ones_dma;/* length and actual buffer info are written later */ spi_message_add_tail (t, &host->m);
@@ -591,14 +550,9 @@ mmc_spi_setup_data_message(if (direction ==DMA_TO_DEVICE ) {/* the actual CRC may get written later */ t->tx_buf = &scratch->crc_val; -if (dma) - t->tx_dma = dma + offsetof(struct scratch , crc_val); }else { t->tx_buf = host->ones; - t->tx_dma = host->ones_dma; t->rx_buf = &scratch->crc_val; -if (dma) - t->rx_dma = dma + offsetof(struct scratch , crc_val); }spi_message_add_tail (t, &host->m);
@@ -621,10 +575,7 @@ mmc_spi_setup_data_message(memset (t,0 ,sizeof (*t)); t->len = (direction ==DMA_TO_DEVICE ) ?sizeof (scratch->status) :1 ; t->tx_buf = host->ones; - t->tx_dma = host->ones_dma; t->rx_buf = scratch->status; -if (dma) - t->rx_dma = dma + offsetof(struct scratch , status); t->cs_change =1 ;spi_message_add_tail (t, &host->m); }
@@ -653,23 +604,13 @@ mmc_spi_writeblock(struct mmc_spi_host *if (host->mmc->use_spi_crc) scratch->crc_val =cpu_to_be16 (crc_itu_t (0 , t->tx_buf, t->len)); -if (host->dma_dev) -dma_sync_single_for_device (host->dma_dev, - host->data_dma,sizeof (*scratch), -DMA_BIDIRECTIONAL ); status =spi_sync_locked (spi, &host->m); -if (status !=0 ) {dev_dbg (&spi->dev,"write error (%d)\n" , status);return status; } -if (host->dma_dev) -dma_sync_single_for_cpu (host->dma_dev, - host->data_dma,sizeof (*scratch), -DMA_BIDIRECTIONAL ); -/* * Get the transmission data-response reply. It must follow * immediately after the data block we transferred. This reply
@@ -718,8 +659,6 @@ mmc_spi_writeblock(struct mmc_spi_host * } t->tx_buf += t->len; -if (host->dma_dev) - t->tx_dma += t->len;/* Return when not busy. If we didn't collect that status yet, * we'll need some more I/O.
@@ -783,30 +722,12 @@ mmc_spi_readblock(struct mmc_spi_host *h } leftover = status <<1 ; -if (host->dma_dev) { -dma_sync_single_for_device (host->dma_dev, - host->data_dma,sizeof (*scratch), -DMA_BIDIRECTIONAL ); -dma_sync_single_for_device (host->dma_dev, - t->rx_dma, t->len, -DMA_FROM_DEVICE ); - } - status =spi_sync_locked (spi, &host->m);if (status <0 ) {dev_dbg (&spi->dev,"read error %d\n" , status);return status; } -if (host->dma_dev) { -dma_sync_single_for_cpu (host->dma_dev, - host->data_dma,sizeof (*scratch), -DMA_BIDIRECTIONAL ); -dma_sync_single_for_cpu (host->dma_dev, - t->rx_dma, t->len, -DMA_FROM_DEVICE ); - } -if (bitshift) {/* Walk through the data and the crc and do * all the magic to get byte-aligned data.
@@ -841,8 +762,6 @@ mmc_spi_readblock(struct mmc_spi_host *h } t->rx_buf += t->len; -if (host->dma_dev) - t->rx_dma += t->len;return 0 ; }
@@ -857,7 +776,6 @@ mmc_spi_data_do(struct mmc_spi_host *hos struct mmc_data *data, u32 blk_size) {struct spi_device *spi = host->spi; -struct device *dma_dev = host->dma_dev;struct spi_transfer *t;enum dma_data_direction direction;struct scatterlist *sg;
@@ -884,31 +802,8 @@ mmc_spi_data_do(struct mmc_spi_host *hos*/ for_each_sg (data->sg, sg, data->sg_len, n_sg) {int status =0 ; -dma_addr_t dma_addr =0 ;void *kmap_addr;unsigned length = sg->length; -enum dma_data_direction dir = direction; - -/* set up dma mapping for controller drivers that might -* use DMA ... though they may fall back to PIO -*/ -if (dma_dev) { -/* never invalidate whole *shared* pages ... */ -if ((sg->offset !=0 || length !=PAGE_SIZE ) - && dir ==DMA_FROM_DEVICE ) - dir =DMA_BIDIRECTIONAL ; - - dma_addr =dma_map_page (dma_dev,sg_page (sg),0 , -PAGE_SIZE , dir); -if (dma_mapping_error (dma_dev, dma_addr)) { - data->error = -EFAULT ; -break ; - } -if (direction ==DMA_TO_DEVICE ) - t->tx_dma = dma_addr + sg->offset; -else - t->rx_dma = dma_addr + sg->offset; - }/* allow pio too; we don't allow highmem */ kmap_addr =kmap (sg_page (sg));
@@ -943,8 +838,6 @@ mmc_spi_data_do(struct mmc_spi_host *hosif (direction ==DMA_FROM_DEVICE )flush_dcache_page (sg_page (sg));kunmap (sg_page (sg)); -if (dma_dev) -dma_unmap_page (dma_dev, dma_addr,PAGE_SIZE , dir);if (status <0 ) { data->error = status;
@@ -981,21 +874,9 @@ mmc_spi_data_do(struct mmc_spi_host *hos scratch->status[0 ] =SPI_TOKEN_STOP_TRAN ; host->early_status.tx_buf = host->early_status.rx_buf; - host->early_status.tx_dma = host->early_status.rx_dma; host->early_status.len = statlen; -if (host->dma_dev) -dma_sync_single_for_device (host->dma_dev, - host->data_dma,sizeof (*scratch), -DMA_BIDIRECTIONAL ); - tmp =spi_sync_locked (spi, &host->m); - -if (host->dma_dev) -dma_sync_single_for_cpu (host->dma_dev, - host->data_dma,sizeof (*scratch), -DMA_BIDIRECTIONAL ); -if (tmp <0 ) {if (!data->error) data->error = tmp;
@@ -1269,52 +1150,6 @@ mmc_spi_detect_irq(int irq, void *mmc)return IRQ_HANDLED ; } -#ifdef CONFIG_HAS_DMA -static int mmc_spi_dma_alloc (struct mmc_spi_host *host) -{ -struct spi_device *spi = host->spi; -struct device *dev; - -if (!spi->master->dev.parent->dma_mask) -return 0 ; - - dev = spi->master->dev.parent; - - host->ones_dma =dma_map_single (dev, host->ones,MMC_SPI_BLOCKSIZE , -DMA_TO_DEVICE ); -if (dma_mapping_error (dev, host->ones_dma)) -return -ENOMEM ; - - host->data_dma =dma_map_single (dev, host->data,sizeof (*host->data), -DMA_BIDIRECTIONAL ); -if (dma_mapping_error (dev, host->data_dma)) { -dma_unmap_single (dev, host->ones_dma,MMC_SPI_BLOCKSIZE , -DMA_TO_DEVICE ); -return -ENOMEM ; - } - -dma_sync_single_for_cpu (dev, host->data_dma,sizeof (*host->data), -DMA_BIDIRECTIONAL ); - - host->dma_dev = dev; -return 0 ; -} - -static void mmc_spi_dma_free (struct mmc_spi_host *host) -{ -if (!host->dma_dev) -return ; - -dma_unmap_single (host->dma_dev, host->ones_dma,MMC_SPI_BLOCKSIZE , -DMA_TO_DEVICE ); -dma_unmap_single (host->dma_dev, host->data_dma,sizeof (*host->data), -DMA_BIDIRECTIONAL ); -} -#else -static inline int mmc_spi_dma_alloc (struct mmc_spi_host *host) {return 0 ; } -static inline void mmc_spi_dma_free (struct mmc_spi_host *host) {} -#endif -static int mmc_spi_probe (struct spi_device *spi) {void *ones;
@@ -1406,24 +1241,17 @@ static int mmc_spi_probe(struct spi_devi host->powerup_msecs =250 ; } -/* preallocate dma buffers */ +/* Preallocate buffers */ host->data =kmalloc (sizeof (*host->data),GFP_KERNEL );if (!host->data) goto fail_nobuf1; - status =mmc_spi_dma_alloc (host); -if (status) - goto fail_dma; -/* setup message for status/busy readback */ spi_message_init (&host->readback); - host->readback.is_dma_mapped = (host->dma_dev !=NULL );spi_message_add_tail (&host->status, &host->readback); host->status.tx_buf = host->ones; - host->status.tx_dma = host->ones_dma; host->status.rx_buf = &host->data->status; - host->status.rx_dma = host->data_dma + offsetof(struct scratch , status); host->status.cs_change =1 ;/* register card detect irq */
@@ -1468,9 +1296,8 @@ static int mmc_spi_probe(struct spi_deviif (!status) has_ro = true; - dev_info(&spi->dev, "SD/MMC host %s%s%s%s%s\n", + dev_info(&spi->dev, "SD/MMC host %s%s%s%s\n", dev_name(&mmc->class_dev), - host->dma_dev ? "" : ", no DMA", has_ro ? "" : ", no WP", (host->pdata && host->pdata->setpower) ? "" : ", no poweroff",
@@ -1481,8 +1308,6 @@ static int mmc_spi_probe(struct spi_devi fail_gpiod_request:mmc_remove_host (mmc); fail_glue_init: -mmc_spi_dma_free (host); -fail_dma:kfree (host->data); fail_nobuf1:mmc_spi_put_pdata (spi);
@@ -1504,7 +1329,6 @@ static int mmc_spi_remove(struct spi_devmmc_remove_host (mmc); -mmc_spi_dma_free (host);kfree (host->data);kfree (host->ones);
Greg Kroah-Hartman
maintainerPATCH 36/476 rtc: Adjust failure return code for cmos_set_alarm()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
commit 1311a8f0d4b23f58bbababa13623aa40b8ad4e0c upstream.
When mc146818_avoid_UIP() fails to return a valid value, this is because UIP didn't clear in the timeout period. Adjust the return code in this case to -ETIMEDOUT.
--- drivers/rtc/rtc-cmos.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/rtc/rtc-cmos.c +2 -2
@@ -292,7 +292,7 @@ static int cmos_read_alarm(struct device/* This not only a rtc_op, but also called directly */ if (!is_valid_irq (cmos->irq)) -return -EIO ; +return -ETIMEDOUT ;/* Basic alarms only support hour, minute, and seconds fields. * Some also support day and month, for alarms up to a year in
@@ -557,7 +557,7 @@ static int cmos_set_alarm(struct device* Use mc146818_avoid_UIP() to avoid this. */ if (!mc146818_avoid_UIP (cmos_set_alarm_callback, &p)) -return -EIO ; +return -ETIMEDOUT ; cmos->alarm_expires =rtc_tm_to_time64 (&t->time);
Greg Kroah-Hartman
maintainerPATCH 37/476 nouveau/vmm: dont set addr on the fail path to avoid warning
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
commit cacea81390fd8c8c85404e5eb2adeb83d87a912e upstream.
nvif_vmm_put gets called if addr is set, but if the allocation fails we don't need to call put, otherwise we get a warning like
[523232.435671] ------------[ cut here ]------------ [523232.435674] WARNING: CPU: 8 PID: 1505697 at drivers/gpu/drm/nouveau/nvif/vmm.c:68 nvif_vmm_put+0x72/0x80 [nouveau] [523232.435795] Modules linked in: uinput rfcomm snd_seq_dummy snd_hrtimer nf_conntrack_netbios_ns nf_conntrack_broadcast nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip_set nf_tables nfnetlink qrtr bnep sunrpc binfmt_misc intel_rapl_msr intel_rapl_common intel_uncore_frequency intel_uncore_frequency_common isst_if_common iwlmvm nfit libnvdimm vfat fat x86_pkg_temp_thermal intel_powerclamp mac80211 snd_soc_avs snd_soc_hda_codec coretemp snd_hda_ext_core snd_soc_core snd_hda_codec_realtek kvm_intel snd_hda_codec_hdmi snd_compress snd_hda_codec_generic ac97_bus snd_pcm_dmaengine snd_hda_intel libarc4 snd_intel_dspcfg snd_intel_sdw_acpi snd_hda_codec kvm iwlwifi snd_hda_core btusb snd_hwdep btrtl snd_seq btintel irqbypass btbcm rapl snd_seq_device eeepc_wmi btmtk intel_cstate iTCO_wdt cfg80211 snd_pcm asus_wmi bluetooth intel_pmc_bxt iTCO_vendor_support snd_timer ledtrig_audio pktcdvd snd mei_me [523232.435828] sparse_keymap intel_uncore i2c_i801 platform_profile wmi_bmof mei pcspkr ioatdma soundcore i2c_smbus rfkill idma64 dca joydev acpi_tad loop zram nouveau drm_ttm_helper ttm video drm_exec drm_gpuvm gpu_sched crct10dif_pclmul i2c_algo_bit nvme crc32_pclmul crc32c_intel drm_display_helper polyval_clmulni nvme_core polyval_generic e1000e mxm_wmi cec ghash_clmulni_intel r8169 sha512_ssse3 nvme_common wmi pinctrl_sunrisepoint uas usb_storage ip6_tables ip_tables fuse [523232.435849] CPU: 8 PID: 1505697 Comm: gnome-shell Tainted: G W 6.6.0-rc7-nvk-uapi+ #12 [523232.435851] Hardware name: System manufacturer System Product Name/ROG STRIX X299-E GAMING II, BIOS 1301 09/24/2021 [523232.435852] RIP: 0010:nvif_vmm_put+0x72/0x80 [nouveau] [523232.435934] Code: 00 00 48 89 e2 be 02 00 00 00 48 c7 04 24 00 00 00 00 48 89 44 24 08 e8 fc bf ff ff 85 c0 75 0a 48 c7 43 08 00 00 00 00 eb b3 <0f> 0b eb f2 e8 f5 c9 b2 e6 0f 1f 44 00 00 90 90 90 90 90 90 90 90 [523232.435936] RSP: 0018:ffffc900077ffbd8 EFLAGS: 00010282 [523232.435937] RAX: 00000000fffffffe RBX: ffffc900077ffc00 RCX: 0000000000000010 [523232.435938] RDX: 0000000000000010 RSI: ffffc900077ffb38 RDI: ffffc900077ffbd8 [523232.435940] RBP: ffff888e1c4f2140 R08: 0000000000000000 R09: 0000000000000000 [523232.435940] R10: 0000000000000000 R11: 0000000000000000 R12: ffff888503811800 [523232.435941] R13: ffffc900077ffca0 R14: ffff888e1c4f2140 R15: ffff88810317e1e0 [523232.435942] FS: 00007f933a769640(0000) GS:ffff88905fa00000(0000) knlGS:0000000000000000 [523232.435943] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [523232.435944] CR2: 00007f930bef7000 CR3: 00000005d0322001 CR4: 00000000003706e0 [523232.435945] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [523232.435946] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [523232.435964] Call Trace: [523232.435965] <TASK> [523232.435966] ? nvif_vmm_put+0x72/0x80 [nouveau] [523232.436051] ? __warn+0x81/0x130 [523232.436055] ? nvif_vmm_put+0x72/0x80 [nouveau] [523232.436138] ? report_bug+0x171/0x1a0 [523232.436142] ? handle_bug+0x3c/0x80 [523232.436144] ? exc_invalid_op+0x17/0x70 [523232.436145] ? asm_exc_invalid_op+0x1a/0x20 [523232.436149] ? nvif_vmm_put+0x72/0x80 [nouveau] [523232.436230] ? nvif_vmm_put+0x64/0x80 [nouveau] [523232.436342] nouveau_vma_del+0x80/0xd0 [nouveau] [523232.436506] nouveau_vma_new+0x1a0/0x210 [nouveau] [523232.436671] nouveau_gem_object_open+0x1d0/0x1f0 [nouveau] [523232.436835] drm_gem_handle_create_tail+0xd1/0x180 [523232.436840] drm_prime_fd_to_handle_ioctl+0x12e/0x200 [523232.436844] ? __pfx_drm_prime_fd_to_handle_ioctl+0x10/0x10 [523232.436847] drm_ioctl_kernel+0xd3/0x180 [523232.436849] drm_ioctl+0x26d/0x4b0 [523232.436851] ? __pfx_drm_prime_fd_to_handle_ioctl+0x10/0x10 [523232.436855] nouveau_drm_ioctl+0x5a/0xb0 [nouveau] [523232.437032] __x64_sys_ioctl+0x94/0xd0 [523232.437036] do_syscall_64+0x5d/0x90 [523232.437040] ? syscall_exit_to_user_mode+0x2b/0x40 [523232.437044] ? do_syscall_64+0x6c/0x90 [523232.437046] entry_SYSCALL_64_after_hwframe+0x6e/0xd8
--- drivers/gpu/drm/nouveau/nouveau_vmm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/nouveau/nouveau_vmm.c +3 -0
@@ -108,6 +108,9 @@ nouveau_vma_new(struct nouveau_bo *nvbo, }else { ret =nvif_vmm_get (&vmm->vmm,PTES , false, mem->mem.page,0 , mem->mem.size, &tmp); +if (ret) + goto done; + vma->addr = tmp.addr; }
Greg Kroah-Hartman
maintainerPATCH 38/476 ubifs: ubifs_symlink: Fix memleak of inode->i_link in error path
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhihao Cheng <[email protected]>
commit 1e022216dcd248326a5bb95609d12a6815bca4e2 upstream.
For error handling path in ubifs_symlink(), inode will be marked as bad first, then iput() is invoked. If inode->i_link is initialized by fscrypt_encrypt_symlink() in encryption scenario, inode->i_link won't be freed by callchain ubifs_free_inode -> fscrypt_free_inode in error handling path, because make_bad_inode() has changed 'inode->i_mode' as 'S_IFREG'.
Following kmemleak is easy to be reproduced by injecting error in ubifs_jnl_update() when doing symlink in encryption scenario:
unreferenced object 0xffff888103da3d98 (size 8):
comm "ln", pid 1692, jiffies 4294914701 (age 12.045s) backtrace:
kmemdup+0x32/0x70 __fscrypt_encrypt_symlink+0xed/0x1c0 ubifs_symlink+0x210/0x300 [ubifs] vfs_symlink+0x216/0x360 do_symlinkat+0x11a/0x190 do_syscall_64+0x3b/0xe0
There are two ways fixing it:
1. Remove make_bad_inode() in error handling path. We can do that because ubifs_evict_inode() will do same processes for good symlink inode and bad symlink inode, for inode->i_nlink checking is before is_bad_inode().
2. Free inode->i_link before marking inode bad.
Method 2 is picked, it has less influence, personally, I think.
--- fs/ubifs/dir.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ubifs/dir.c +2 -0
@@ -1225,6 +1225,8 @@ out_cancel: dir_ui->ui_size = dir->i_size;mutex_unlock (&dir_ui->ui_mutex); out_inode: +/* Free inode->i_link before inode is marked as bad. */ +fscrypt_free_inode (inode);make_bad_inode (inode);iput (inode); out_fname:
Greg Kroah-Hartman
maintainerPATCH 39/476 rename(): fix the locking of subdirectories
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit 22e111ed6c83dcde3037fc81176012721bc34c0b upstream.
We should never lock two subdirectories without having taken
->s_vfs_rename_mutex; inode pointer order or not, the "order" proposed in 28eceeda130f "fs: Lock moved directories" is not transitive, with the usual consequences.
The rationale for locking renamed subdirectory in all cases was
the possibility of race between rename modifying .. in a subdirectory to reflect the new parent and another thread modifying the same subdirectory. For a lot of filesystems that's not a problem, but for some it can lead to trouble (e.g. the case when short directory contents is kept in the inode, but creating a file in it might push it across the size limit and copy its contents into separate data block(s)).
However, we need that only in case when the parent does change -
otherwise ->rename() doesn't need to do anything with .. entry in the first place. Some instances are lazy and do a tautological update anyway, but it's really not hard to avoid.
Amended locking rules for rename():
find the parent(s) of source and target
if source and target have the same parent
lock the common parent
else
lock ->s_vfs_rename_mutex
lock both parents, in ancestor-first order; if neither is an ancestor of another, lock the parent of source first.
find the source and target.
if source and target have the same parent
if operation is an overwriting rename of a subdirectory
lock the target subdirectory
else
if source is a subdirectory
lock the source
if target is a subdirectory
lock the target
lock non-directories involved, in inode pointer order if both source and target are such.
That way we are guaranteed that parents are locked (for obvious reasons), that any renamed non-directory is locked (nfsd relies upon that), that any victim is locked (emptiness check needs that, among other things) and subdirectory that changes parent is locked (needed to protect the update of .. entries). We are also guaranteed that any operation locking more than one directory either takes ->s_vfs_rename_mutex or locks a parent followed by its child.
--- Documentation/filesystems/directory-locking.rst | 29 ++++++----- Documentation/filesystems/locking.rst | 5 +- Documentation/filesystems/porting.rst | 18 +++++++ fs/namei.c | 60 ++++++++++++++---------- 4 files changed, 74 insertions(+), 38 deletions(-)
Documentation/filesystems/directory-locking.rst +15 -14
@@ -22,13 +22,16 @@ exclusive. 3) object removal. Locking rules: caller locks parent, finds victim, locks victim and calls the method. Locks are exclusive. -4) rename() that is _not_ cross-directory. Locking rules: caller locks the -parent and finds source and target. We lock both (provided they exist). If we -need to lock two inodes of different type (dir vs non-dir), we lock directory -first. If we need to lock two inodes of the same type, lock them in inode -pointer order. Then call the method. All locks are exclusive. -NB: we might get away with locking the source (and target in exchange -case) shared. +4) rename() that is _not_ cross-directory. Locking rules: caller locks +the parent and finds source and target. Then we decide which of the +source and target need to be locked. Source needs to be locked if it's a +non-directory; target - if it's a non-directory or about to be removed. +Take the locks that need to be taken, in inode pointer order if need +to take both (that can happen only when both source and target are +non-directories - the source because it wouldn't be locked otherwise +and the target because mixing directory and non-directory is allowed +only with RENAME_EXCHANGE, and that won't be removing the target). +After the locks had been taken, call the method. All locks are exclusive. 5) link creation. Locking rules:
@@ -44,20 +47,17 @@ rules: * lock the filesystem * lock parents in "ancestors first" order. If one is not ancestor of - the other, lock them in inode pointer order. + the other, lock the parent of source first. * find source and target. * if old parent is equal to or is a descendent of target fail with -ENOTEMPTY * if new parent is equal to or is a descendent of source fail with -ELOOP - * Lock both the source and the target provided they exist. If we - need to lock two inodes of different type (dir vs non-dir), we lock - the directory first. If we need to lock two inodes of the same type, - lock them in inode pointer order. + * Lock subdirectories involved (source before target). + * Lock non-directories involved, in inode pointer order. * call the method. -All ->i_rwsem are taken exclusive. Again, we might get away with locking -the source (and target in exchange case) shared. +All ->i_rwsem are taken exclusive. The rules above obviously guarantee that all directories that are going to be read, modified or removed by method will be locked by caller.
@@ -67,6 +67,7 @@ If no directory is its own ancestor, the Proof: +[XXX: will be updated once we are done massaging the lock_rename()] First of all, at any moment we have a linear ordering of the objects - A < B iff (A is an ancestor of B) or (B is not an ancestor of A and ptr(A) < ptr(B)).
Documentation/filesystems/locking.rst +4 -1
@@ -98,7 +98,7 @@ symlink: exclusive mkdir: exclusive unlink: exclusive (both) rmdir: exclusive (both)(see below) -rename: exclusive (all) (see below) +rename: exclusive (both parents, some children) (see below) readlink: no get_link: no setattr: exclusive
@@ -118,6 +118,9 @@ fileattr_set: exclusive Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_rwsem exclusive on victim. cross-directory ->rename() has (per-superblock) ->s_vfs_rename_sem. + ->unlink() and ->rename() have ->i_rwsem exclusive on all non-directories + involved. + ->rename() has ->i_rwsem exclusive on any subdirectory that changes parent. See Documentation/filesystems/directory-locking.rst for more detailed discussion of the locking scheme for directory operations.
Documentation/filesystems/porting.rst +18 -0
@@ -908,3 +908,21 @@ Calling conventions for file_open_root() instead of passing mount and dentry separately. For callers that used to pass <mnt, mnt->mnt_root> pair (i.e. the root of given mount), a new helper is provided - file_open_root_mnt(). In-tree users adjusted. + +--- + +**mandatory** + +If ->rename() update of .. on cross-directory move needs an exclusion with +directory modifications, do *not* lock the subdirectory in question in your +->rename() - it's done by the caller now [that item should've been added in +28eceeda130f "fs: Lock moved directories"]. + +--- + +**mandatory** + +On same-directory ->rename() the (tautological) update of .. is not protected +by any locks; just don't do it if the old parent is the same as the new one. +We really can't lock two subdirectories in same-directory rename - not without +deadlocks.
fs/namei.c +37 -23
97 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 40/476 ksmbd: set v2 lease version on lease upgrade
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit bb05367a66a9990d2c561282f5620bb1dbe40c28 ]
If file opened with v2 lease is upgraded with v1 lease, smb server should response v2 lease create context to client.
This patch fix smb2.lease.v2_epoch2 test failure.
This test case assumes the following scenario:
1. smb2 create with v2 lease(R, LEASE1 key)
2. smb server return smb2 create response with v2 lease context(R,
LEASE1 key, epoch + 1)
3. smb2 create with v1 lease(RH, LEASE1 key)
4. smb server return smb2 create response with v2 lease context(RH,
LEASE1 key, epoch + 2)
i.e. If same client(same lease key) try to open a file that is being opened with v2 lease with v1 lease, smb server should return v2 lease.
--- fs/ksmbd/oplock.c | 1 + 1 file changed, 1 insertion(+)
fs/ksmbd/oplock.c +1 -0
@@ -1036,6 +1036,7 @@ static void copy_lease(struct oplock_inf lease2->duration = lease1->duration; lease2->flags = lease1->flags; lease2->epoch = lease1->epoch++; + lease2->version = lease1->version; }static int add_lease_global_list (struct oplock_info *opinfo)
Greg Kroah-Hartman
maintainerPATCH 41/476 ksmbd: fix potential circular locking issue in smb2_set_ea()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit 6fc0a265e1b932e5e97a038f99e29400a93baad0 ]
smb2_set_ea() can be called in parent inode lock range. So add get_write argument to smb2_set_ea() not to call nested mnt_want_write().
--- fs/ksmbd/smb2pdu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/ksmbd/smb2pdu.c +4 -3
@@ -2323,11 +2323,12 @@ out:* @eabuf: set info command buffer * @buf_len: set info command buffer length * @path: dentry path for get ea +* @get_write: get write access to a mount * * Return: 0 on success, otherwise error */ static int smb2_set_ea (struct smb2_ea_info *eabuf,unsigned int buf_len, -const struct path *path) +const struct path *path,bool get_write) {struct user_namespace *user_ns =mnt_user_ns (path->mnt);char *attr_name =NULL , *value;
@@ -3012,7 +3013,7 @@ int smb2_open(struct ksmbd_work *work) rc =smb2_set_ea (&ea_buf->ea,le32_to_cpu (ea_buf->ccontext.DataLength), - &path); + &path, false);if (rc == -EOPNOTSUPP ) rc =0 ;else if (rc)
@@ -5994,7 +5995,7 @@ static int smb2_set_info_file(struct ksmreturn -EINVAL ;return smb2_set_ea ((struct smb2_ea_info *)req->Buffer, - buf_len, &fp->filp->f_path); + buf_len, &fp->filp->f_path, true); }case FILE_POSITION_INFORMATION : {
Greg Kroah-Hartman
maintainerPATCH 42/476 ksmbd: dont increment epoch if current state and request state are same
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit b6e9a44e99603fe10e1d78901fdd97681a539612 ]
If existing lease state and request state are same, don't increment epoch in create context.
--- fs/ksmbd/oplock.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
fs/ksmbd/oplock.c +6 -3
@@ -105,7 +105,7 @@ static int alloc_lease(struct oplock_inf lease->is_dir = lctx->is_dir;memcpy (lease->parent_lease_key, lctx->parent_lease_key,SMB2_LEASE_KEY_SIZE ); lease->version = lctx->version; - lease->epoch =le16_to_cpu (lctx->epoch); + lease->epoch =le16_to_cpu (lctx->epoch) +1 ;INIT_LIST_HEAD (&opinfo->lease_entry); opinfo->o_lease = lease;
@@ -541,6 +541,9 @@ static struct oplock_info *same_client_hcontinue ; } +if (lctx->req_state != lease->state) + lease->epoch++; +/* upgrading lease */ if ((atomic_read (&ci->op_count) +atomic_read (&ci->sop_count)) ==1 ) {
@@ -1035,7 +1038,7 @@ static void copy_lease(struct oplock_inf SMB2_LEASE_KEY_SIZE); lease2->duration = lease1->duration; lease2->flags = lease1->flags; - lease2->epoch = lease1->epoch++; + lease2->epoch = lease1->epoch; lease2->version = lease1->version; }
@@ -1454,7 +1457,7 @@ void create_lease_buf(u8 *rbuf, struct lmemcpy (buf->lcontext.LeaseKey, lease->lease_key,SMB2_LEASE_KEY_SIZE ); buf->lcontext.LeaseFlags = lease->flags; - buf->lcontext.Epoch =cpu_to_le16 (++lease->epoch); + buf->lcontext.Epoch =cpu_to_le16 (lease->epoch); buf->lcontext.LeaseState = lease->state;memcpy (buf->lcontext.ParentLeaseKey, lease->parent_lease_key,SMB2_LEASE_KEY_SIZE );
Greg Kroah-Hartman
maintainerPATCH 43/476 ksmbd: send lease break notification on FILE_RENAME_INFORMATION
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit 3fc74c65b367476874da5fe6f633398674b78e5a ]
Send lease break notification on FILE_RENAME_INFORMATION request. This patch fix smb2.lease.v2_epoch2 test failure.
--- fs/ksmbd/oplock.c | 12 +++++++----- fs/ksmbd/smb2pdu.c | 1 + 2 files changed, 8 insertions(+), 5 deletions(-)
fs/ksmbd/oplock.c +7 -5
@@ -541,14 +541,12 @@ static struct oplock_info *same_client_hcontinue ; } -if (lctx->req_state != lease->state) - lease->epoch++; -/* upgrading lease */ if ((atomic_read (&ci->op_count) +atomic_read (&ci->sop_count)) ==1 ) {if (lease->state !=SMB2_LEASE_NONE_LE && lease->state == (lctx->req_state & lease->state)) { + lease->epoch++; lease->state |= lctx->req_state;if (lctx->req_state &SMB2_LEASE_WRITE_CACHING_LE )
@@ -559,13 +557,17 @@ static struct oplock_info *same_client_h atomic_read(&ci->sop_count)) > 1) {if (lctx->req_state == (SMB2_LEASE_READ_CACHING_LE | -SMB2_LEASE_HANDLE_CACHING_LE )) +SMB2_LEASE_HANDLE_CACHING_LE )) { + lease->epoch++; lease->state = lctx->req_state; + } }if (lctx->req_state && lease->state == -SMB2_LEASE_NONE_LE ) +SMB2_LEASE_NONE_LE ) { + lease->epoch++;lease_none_upgrade (opinfo, lctx->req_state); + } }read_lock (&ci->m_lock); }
fs/ksmbd/smb2pdu.c +1 -0
@@ -5581,6 +5581,7 @@ static int smb2_rename(struct ksmbd_workif (!file_info->ReplaceIfExists) flags =RENAME_NOREPLACE ; +smb_break_all_levII_oplock (work, fp,0 ); rc =ksmbd_vfs_rename (work, &fp->filp->f_path, new_name, flags); out:kfree (new_name);
Greg Kroah-Hartman
maintainerPATCH 44/476 ksmbd: Add missing set_freezable() for freezable kthread
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
From: Kevin Hao <[email protected]>
[ Upstream commit 8fb7b723924cc9306bc161f45496497aec733904 ]
The kernel thread function ksmbd_conn_handler_loop() invokes the try_to_freeze() in its loop. But all the kernel threads are non-freezable by default. So if we want to make a kernel thread to be freezable, we have to invoke set_freezable() explicitly.
--- fs/ksmbd/connection.c | 1 + 1 file changed, 1 insertion(+)
fs/ksmbd/connection.c +1 -0
@@ -284,6 +284,7 @@ int ksmbd_conn_handler_loop(void *p) goto out; conn->last_active = jiffies; +set_freezable ();while (ksmbd_conn_alive (conn)) {if (try_to_freeze ())continue ;
Greg Kroah-Hartman
maintainerPATCH 45/476 net/smc: fix illegal rmb_desc access in SMC-D connection dump
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wen Gu <[email protected]>
[ Upstream commit dbc153fd3c142909e564bb256da087e13fbf239c ]
A crash was found when dumping SMC-D connections. It can be reproduced by following steps:
- run nginx/wrk test:
smc_run nginx
smc_run wrk -t 16 -c 1000 -d <duration> -H 'Connection: Close' <URL>
- continuously dump SMC-D connections in parallel:
watch -n 1 'smcss -D'
BUG: kernel NULL pointer dereference, address: 0000000000000030 CPU: 2 PID: 7204 Comm: smcss Kdump: loaded Tainted: G E 6.7.0+ #55 RIP: 0010:__smc_diag_dump.constprop.0+0x5e5/0x620 [smc_diag] Call Trace: <TASK> ? __die+0x24/0x70 ? page_fault_oops+0x66/0x150 ? exc_page_fault+0x69/0x140 ? asm_exc_page_fault+0x26/0x30 ? __smc_diag_dump.constprop.0+0x5e5/0x620 [smc_diag] ? __kmalloc_node_track_caller+0x35d/0x430 ? __alloc_skb+0x77/0x170 smc_diag_dump_proto+0xd0/0xf0 [smc_diag] smc_diag_dump+0x26/0x60 [smc_diag] netlink_dump+0x19f/0x320 __netlink_dump_start+0x1dc/0x300 smc_diag_handler_dump+0x6a/0x80 [smc_diag] ? __pfx_smc_diag_dump+0x10/0x10 [smc_diag] sock_diag_rcv_msg+0x121/0x140 ? __pfx_sock_diag_rcv_msg+0x10/0x10 netlink_rcv_skb+0x5a/0x110 sock_diag_rcv+0x28/0x40 netlink_unicast+0x22a/0x330 netlink_sendmsg+0x1f8/0x420 __sock_sendmsg+0xb0/0xc0 ____sys_sendmsg+0x24e/0x300 ? copy_msghdr_from_user+0x62/0x80 ___sys_sendmsg+0x7c/0xd0 ? __do_fault+0x34/0x160 ? do_read_fault+0x5f/0x100 ? do_fault+0xb0/0x110 ? __handle_mm_fault+0x2b0/0x6c0 __sys_sendmsg+0x4d/0x80 do_syscall_64+0x69/0x180 entry_SYSCALL_64_after_hwframe+0x6e/0x76
It is possible that the connection is in process of being established when we dump it. Assumed that the connection has been registered in a link group by smc_conn_create() but the rmb_desc has not yet been initialized by smc_buf_create(), thus causing the illegal access to conn->rmb_desc. So fix it by checking before dump.
--- net/smc/smc_diag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/smc/smc_diag.c +1 -1
@@ -164,7 +164,7 @@ static int __smc_diag_dump(struct sock *sk, struct sk_buff *skb, }if (smc->conn.lgr && smc->conn.lgr->is_smcd && (req->diag_ext & (1 << (SMC_DIAG_DMBINFO -1 ))) && - !list_empty (&smc->conn.lgr->list)) { + !list_empty (&smc->conn.lgr->list) && smc->conn.rmb_desc) {struct smc_connection *conn = &smc->conn;struct smcd_diag_dmbinfo dinfo;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 46/476 tcp: make sure init the accept_queues spinlocks once
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhengchao Shao <[email protected]>
[ Upstream commit 198bc90e0e734e5f98c3d2833e8390cac3df61b2 ]
When I run syz's reproduction C program locally, it causes the following issue:
pvqspinlock: lock 0xffff9d181cd5c660 has corrupted value 0x0!
WARNING: CPU: 19 PID: 21160 at __pv_queued_spin_unlock_slowpath (kernel/locking/qspinlock_paravirt.h:508) Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011 RIP: 0010:__pv_queued_spin_unlock_slowpath (kernel/locking/qspinlock_paravirt.h:508) Code: 73 56 3a ff 90 c3 cc cc cc cc 8b 05 bb 1f 48 01 85 c0 74 05 c3 cc cc cc cc 8b 17 48 89 fe 48 c7 c7 30 20 ce 8f e8 ad 56 42 ff <0f> 0b c3 cc cc cc cc 0f 0b 0f 1f 40 00 90 90 90 90 90 90 90 90 90 RSP: 0018:ffffa8d200604cb8 EFLAGS: 00010282 RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffff9d1ef60e0908 RDX: 00000000ffffffd8 RSI: 0000000000000027 RDI: ffff9d1ef60e0900 RBP: ffff9d181cd5c280 R08: 0000000000000000 R09: 00000000ffff7fff R10: ffffa8d200604b68 R11: ffffffff907dcdc8 R12: 0000000000000000 R13: ffff9d181cd5c660 R14: ffff9d1813a3f330 R15: 0000000000001000 FS: 00007fa110184640(0000) GS:ffff9d1ef60c0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000020000000 CR3: 000000011f65e000 CR4: 00000000000006f0 Call Trace: <IRQ> _raw_spin_unlock (kernel/locking/spinlock.c:186) inet_csk_reqsk_queue_add (net/ipv4/inet_connection_sock.c:1321) inet_csk_complete_hashdance (net/ipv4/inet_connection_sock.c:1358) tcp_check_req (net/ipv4/tcp_minisocks.c:868) tcp_v4_rcv (net/ipv4/tcp_ipv4.c:2260) ip_protocol_deliver_rcu (net/ipv4/ip_input.c:205) ip_local_deliver_finish (net/ipv4/ip_input.c:234) __netif_receive_skb_one_core (net/core/dev.c:5529) process_backlog (./include/linux/rcupdate.h:779) __napi_poll (net/core/dev.c:6533) net_rx_action (net/core/dev.c:6604) __do_softirq (./arch/x86/include/asm/jump_label.h:27) do_softirq (kernel/softirq.c:454 kernel/softirq.c:441) </IRQ> <TASK> __local_bh_enable_ip (kernel/softirq.c:381) __dev_queue_xmit (net/core/dev.c:4374) ip_finish_output2 (./include/net/neighbour.h:540 net/ipv4/ip_output.c:235) __ip_queue_xmit (net/ipv4/ip_output.c:535) __tcp_transmit_skb (net/ipv4/tcp_output.c:1462) tcp_rcv_synsent_state_process (net/ipv4/tcp_input.c:6469) tcp_rcv_state_process (net/ipv4/tcp_input.c:6657) tcp_v4_do_rcv (net/ipv4/tcp_ipv4.c:1929) __release_sock (./include/net/sock.h:1121 net/core/sock.c:2968) release_sock (net/core/sock.c:3536) inet_wait_for_connect (net/ipv4/af_inet.c:609) __inet_stream_connect (net/ipv4/af_inet.c:702) inet_stream_connect (net/ipv4/af_inet.c:748) __sys_connect (./include/linux/file.h:45 net/socket.c:2064) __x64_sys_connect (net/socket.c:2073 net/socket.c:2070 net/socket.c:2070) do_syscall_64 (arch/x86/entry/common.c:51 arch/x86/entry/common.c:82) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:129) RIP: 0033:0x7fa10ff05a3d Code: 5b 41 5c c3 66 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 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 8b 0d ab a3 0e 00 f7 d8 64 89 01 48 RSP: 002b:00007fa110183de8 EFLAGS: 00000202 ORIG_RAX: 000000000000002a RAX: ffffffffffffffda RBX: 0000000020000054 RCX: 00007fa10ff05a3d RDX: 000000000000001c RSI: 0000000020000040 RDI: 0000000000000003 RBP: 00007fa110183e20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000202 R12: 00007fa110184640 R13: 0000000000000000 R14: 00007fa10fe8b060 R15: 00007fff73e23b20 </TASK>
The issue triggering process is analyzed as follows:
Thread A Thread Btcp_v4_rcv //receive ack TCP packet inet_shutdown
tcp_check_req tcp_disconnect //disconnect sock
... tcp_set_state(sk, TCP_CLOSE)
inet_csk_complete_hashdance ...
inet_csk_reqsk_queue_add inet_listen //start listen
spin_lock(&queue->rskq_lock) inet_csk_listen_start
... reqsk_queue_alloc
... spin_lock_init
spin_unlock(&queue->rskq_lock) //warningWhen the socket receives the ACK packet during the three-way handshake, it will hold spinlock. And then the user actively shutdowns the socket and listens to the socket immediately, the spinlock will be initialized. When the socket is going to release the spinlock, a warning is generated. Also the same issue to fastopenq.lock.
Move init spinlock to inet_create and inet_accept to make sure init the accept_queue's spinlocks once.
--- include/net/inet_connection_sock.h | 8 ++++++++ net/core/request_sock.c | 3 --- net/ipv4/af_inet.c | 3 +++ net/ipv4/inet_connection_sock.c | 4 ++++ 4 files changed, 15 insertions(+), 3 deletions(-)
include/net/inet_connection_sock.h +8 -0
@@ -335,4 +335,12 @@ static inline bool inet_csk_has_ulp(struct sock *sk) return inet_sk(sk)->is_icsk && !!inet_csk(sk)->icsk_ulp_ops; } +static inline void inet_init_csk_locks (struct sock *sk) +{ +struct inet_connection_sock *icsk =inet_csk (sk); + +spin_lock_init (&icsk->icsk_accept_queue.rskq_lock); +spin_lock_init (&icsk->icsk_accept_queue.fastopenq.lock); +} +#endif /* _INET_CONNECTION_SOCK_H */
net/core/request_sock.c +0 -3
@@ -33,9 +33,6 @@void reqsk_queue_alloc (struct request_sock_queue *queue) { -spin_lock_init (&queue->rskq_lock); - -spin_lock_init (&queue->fastopenq.lock); queue->fastopenq.rskq_rst_head =NULL ; queue->fastopenq.rskq_rst_tail =NULL ; queue->fastopenq.qlen =0 ;
net/ipv4/af_inet.c +3 -0
@@ -327,6 +327,9 @@ static int inet_create(struct net *net, struct socket *sock, int protocol,if (INET_PROTOSW_REUSE & answer_flags) sk->sk_reuse =SK_CAN_REUSE ; +if (INET_PROTOSW_ICSK & answer_flags) +inet_init_csk_locks (sk); + inet =inet_sk (sk); inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) !=0 ;
net/ipv4/inet_connection_sock.c +4 -0
@@ -545,6 +545,10 @@ struct sock *inet_csk_accept(struct sock *sk, int flags, int *err, bool kern) }if (req)reqsk_put (req); + +if (newsk) +inet_init_csk_locks (newsk); +return newsk; out_err: newsk =NULL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 47/476 bnxt_en: Wait for FLR to complete during probe
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Chan <[email protected]>
[ Upstream commit 3c1069fa42872f95cf3c6fedf80723d391e12d57 ]
The first message to firmware may fail if the device is undergoing FLR. The driver has some recovery logic for this failure scenario but we must wait 100 msec for FLR to complete before proceeding. Otherwise the recovery will always fail.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +5 -0
@@ -11925,6 +11925,11 @@ static int bnxt_fw_init_one_p1(struct bnxt *bp) bp->fw_cap =0 ; rc =bnxt_hwrm_ver_get (bp); +/* FW may be unresponsive after FLR. FLR must complete within 100 msec +* so wait before continuing with recovery. +*/ +if (rc) +msleep (100 );bnxt_try_map_fw_health_reg (bp);if (rc) { rc =bnxt_try_recover_fw (bp);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 48/476 vlan: skip nested type that is not IFLA_VLAN_QOS_MAPPING
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lin Ma <[email protected]>
[ Upstream commit 6c21660fe221a15c789dee2bc2fd95516bc5aeaf ]
In the vlan_changelink function, a loop is used to parse the nested attributes IFLA_VLAN_EGRESS_QOS and IFLA_VLAN_INGRESS_QOS in order to obtain the struct ifla_vlan_qos_mapping. These two nested attributes are checked in the vlan_validate_qos_map function, which calls nla_validate_nested_deprecated with the vlan_map_policy.
However, this deprecated validator applies a LIBERAL strictness, allowing the presence of an attribute with the type IFLA_VLAN_QOS_UNSPEC. Consequently, the loop in vlan_changelink may parse an attribute of type IFLA_VLAN_QOS_UNSPEC and believe it carries a payload of struct ifla_vlan_qos_mapping, which is not necessarily true.
To address this issue and ensure compatibility, this patch introduces two type checks that skip attributes whose type is not IFLA_VLAN_QOS_MAPPING.
--- net/8021q/vlan_netlink.c | 4 ++++ 1 file changed, 4 insertions(+)
net/8021q/vlan_netlink.c +4 -0
@@ -118,12 +118,16 @@ static int vlan_changelink(struct net_device *dev, struct nlattr *tb[], }if (data[IFLA_VLAN_INGRESS_QOS ]) {nla_for_each_nested (attr, data[IFLA_VLAN_INGRESS_QOS ], rem) { +if (nla_type (attr) !=IFLA_VLAN_QOS_MAPPING ) +continue ; m =nla_data (attr);vlan_dev_set_ingress_priority (dev, m->to, m->from); } }if (data[IFLA_VLAN_EGRESS_QOS ]) {nla_for_each_nested (attr, data[IFLA_VLAN_EGRESS_QOS ], rem) { +if (nla_type (attr) !=IFLA_VLAN_QOS_MAPPING ) +continue ; m =nla_data (attr); err =vlan_dev_set_egress_priority (dev, m->from, m->to);if (err)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 49/476 llc: make llc_ui_sendmsg() more robust against bonding changes
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit dad555c816a50c6a6a8a86be1f9177673918c647 ]
syzbot was able to trick llc_ui_sendmsg(), allocating an skb with no headroom, but subsequently trying to push 14 bytes of Ethernet header [1]
Like some others, llc_ui_sendmsg() releases the socket lock before calling sock_alloc_send_skb().
Then it acquires it again, but does not redo all the sanity checks that were performed.
This fix:
- Uses LL_RESERVED_SPACE() to reserve space.
- Check all conditions again after socket lock is held again.
- Do not account Ethernet header for mtu limitation.
[1]
skbuff: skb_under_panic: text:ffff800088baa334 len:1514 put:14 head:ffff0000c9c37000 data:ffff0000c9c36ff2 tail:0x5dc end:0x6c0 dev:bond0
kernel BUG at net/core/skbuff.c:193 !
Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP Modules linked in: CPU: 0 PID: 6875 Comm: syz-executor.0 Not tainted 6.7.0-rc8-syzkaller-00101-g0802e17d9aca-dirty #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023 pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : skb_panic net/core/skbuff.c:189 [inline] pc : skb_under_panic+0x13c/0x140 net/core/skbuff.c:203 lr : skb_panic net/core/skbuff.c:189 [inline] lr : skb_under_panic+0x13c/0x140 net/core/skbuff.c:203
sp : ffff800096f97000
x29: ffff800096f97010 x28: ffff80008cc8d668 x27: dfff800000000000
x26: ffff0000cb970c90 x25: 00000000000005dc x24: ffff0000c9c36ff2
x23: ffff0000c9c37000 x22: 00000000000005ea x21: 00000000000006c0
x20: 000000000000000e x19: ffff800088baa334 x18: 1fffe000368261ce
x17: ffff80008e4ed000 x16: ffff80008a8310f8 x15: 0000000000000001
x14: 1ffff00012df2d58 x13: 0000000000000000 x12: 0000000000000000
x11: 0000000000000001 x10: 0000000000ff0100 x9 : e28a51f1087e8400 x8 : e28a51f1087e8400 x7 : ffff80008028f8d0 x6 : 0000000000000000 x5 : 0000000000000001 x4 : 0000000000000001 x3 : ffff800082b78714 x2 : 0000000000000001 x1 : 0000000100000000 x0 : 0000000000000089
Call trace: skb_panic net/core/skbuff.c:189 [inline] skb_under_panic+0x13c/0x140 net/core/skbuff.c:203 skb_push+0xf0/0x108 net/core/skbuff.c:2451 eth_header+0x44/0x1f8 net/ethernet/eth.c:83 dev_hard_header include/linux/netdevice.h:3188 [inline] llc_mac_hdr_init+0x110/0x17c net/llc/llc_output.c:33 llc_sap_action_send_xid_c+0x170/0x344 net/llc/llc_s_ac.c:85 llc_exec_sap_trans_actions net/llc/llc_sap.c:153 [inline] llc_sap_next_state net/llc/llc_sap.c:182 [inline] llc_sap_state_process+0x1ec/0x774 net/llc/llc_sap.c:209 llc_build_and_send_xid_pkt+0x12c/0x1c0 net/llc/llc_sap.c:270 llc_ui_sendmsg+0x7bc/0xb1c net/llc/af_llc.c:997 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg net/socket.c:745 [inline] sock_sendmsg+0x194/0x274 net/socket.c:767 splice_to_socket+0x7cc/0xd58 fs/splice.c:881 do_splice_from fs/splice.c:933 [inline] direct_splice_actor+0xe4/0x1c0 fs/splice.c:1142 splice_direct_to_actor+0x2a0/0x7e4 fs/splice.c:1088 do_splice_direct+0x20c/0x348 fs/splice.c:1194 do_sendfile+0x4bc/0xc70 fs/read_write.c:1254 __do_sys_sendfile64 fs/read_write.c:1322 [inline] __se_sys_sendfile64 fs/read_write.c:1308 [inline] __arm64_sys_sendfile64+0x160/0x3b4 fs/read_write.c:1308 __invoke_syscall arch/arm64/kernel/syscall.c:37 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:51 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:136 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:155 el0_svc+0x54/0x158 arch/arm64/kernel/entry-common.c:678 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:696 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:595 Code: aa1803e6 aa1903e7 a90023f5 94792f6a (d4210000)
--- net/llc/af_llc.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
net/llc/af_llc.c +16 -8
@@ -926,14 +926,15 @@ static int llc_ui_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,*/ static int llc_ui_sendmsg (struct socket *sock,struct msghdr *msg,size_t len) { + DECLARE_SOCKADDR(struct sockaddr_llc *, addr, msg->msg_name);struct sock *sk = sock->sk;struct llc_sock *llc =llc_sk (sk); - DECLARE_SOCKADDR(struct sockaddr_llc *, addr, msg->msg_name);int flags = msg->msg_flags;int noblock = flags &MSG_DONTWAIT ; +int rc = -EINVAL , copied =0 , hdrlen, hh_len;struct sk_buff *skb =NULL ; +struct net_device *dev;size_t size =0 ; -int rc = -EINVAL , copied =0 , hdrlen;dprintk ("%s: sending from %02X to %02X\n" , __func__, llc->laddr.lsap, llc->daddr.lsap);
@@ -953,22 +954,29 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)if (rc) goto out; } - hdrlen = llc->dev->hard_header_len +llc_ui_header_len (sk, addr); + dev = llc->dev; + hh_len =LL_RESERVED_SPACE (dev); + hdrlen =llc_ui_header_len (sk, addr); size = hdrlen + len; -if (size > llc->dev->mtu) - size = llc->dev->mtu; + size =min_t (size_t, size,READ_ONCE (dev->mtu)); copied = size - hdrlen; rc = -EINVAL ;if (copied <0 ) goto out;release_sock (sk); - skb =sock_alloc_send_skb (sk, size, noblock, &rc); + skb =sock_alloc_send_skb (sk, hh_len + size, noblock, &rc);lock_sock (sk);if (!skb) goto out; - skb->dev = llc->dev; +if (sock_flag (sk,SOCK_ZAPPED ) || + llc->dev != dev || + hdrlen !=llc_ui_header_len (sk, addr) || + hh_len !=LL_RESERVED_SPACE (dev) || + size >READ_ONCE (dev->mtu)) + goto out; + skb->dev = dev; skb->protocol =llc_proto_type (addr->sllc_arphrd); -skb_reserve (skb, hdrlen); +skb_reserve (skb, hh_len + hdrlen); rc =memcpy_from_msg (skb_put (skb, copied), msg, copied);if (rc) goto out;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 50/476 llc: Drop support for ETH_P_TR_802_2.
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit e3f9bed9bee261e3347131764e42aeedf1ffea61 ]
syzbot reported an uninit-value bug below. [0]
llc supports ETH_P_802_2 (0x0004) and used to support ETH_P_TR_802_2 (0x0011), and syzbot abused the latter to trigger the bug.
write$tun(r0, &(0x7f0000000040)={@val={0x0, 0x11}, @val, @mpls={[], @llc={@snap={0xaa, 0x1, ')', "90e5dd"}}}}, 0x16)
llc_conn_handler() initialises local variables {saddr,daddr}.mac based on skb in llc_pdu_decode_sa()/llc_pdu_decode_da() and passes them to __llc_lookup().
However, the initialisation is done only when skb->protocol is htons(ETH_P_802_2), otherwise, __llc_lookup_established() and __llc_lookup_listener() will read garbage.
The missing initialisation existed prior to commit 211ed865108e ("net: delete all instances of special processing for token ring").
It removed the part to kick out the token ring stuff but forgot to close the door allowing ETH_P_TR_802_2 packets to sneak into llc_rcv().
Let's remove llc_tr_packet_type and complete the deprecation.
[0]:
BUG: KMSAN: uninit-value in __llc_lookup_established+0xe9d/0xf90 __llc_lookup_established+0xe9d/0xf90 __llc_lookup net/llc/llc_conn.c:611 [inline] llc_conn_handler+0x4bd/0x1360 net/llc/llc_conn.c:791 llc_rcv+0xfbb/0x14a0 net/llc/llc_input.c:206 __netif_receive_skb_one_core net/core/dev.c:5527 [inline] __netif_receive_skb+0x1a6/0x5a0 net/core/dev.c:5641 netif_receive_skb_internal net/core/dev.c:5727 [inline] netif_receive_skb+0x58/0x660 net/core/dev.c:5786 tun_rx_batched+0x3ee/0x980 drivers/net/tun.c:1555 tun_get_user+0x53af/0x66d0 drivers/net/tun.c:2002 tun_chr_write_iter+0x3af/0x5d0 drivers/net/tun.c:2048 call_write_iter include/linux/fs.h:2020 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x8ef/0x1490 fs/read_write.c:584 ksys_write+0x20f/0x4c0 fs/read_write.c:637 __do_sys_write fs/read_write.c:649 [inline] __se_sys_write fs/read_write.c:646 [inline] __x64_sys_write+0x93/0xd0 fs/read_write.c:646 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x44/0x110 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x63/0x6b
Local variable daddr created at:
llc_conn_handler+0x53/0x1360 net/llc/llc_conn.c:783 llc_rcv+0xfbb/0x14a0 net/llc/llc_input.c:206 CPU: 1 PID: 5004 Comm: syz-executor994 Not tainted 6.6.0-syzkaller-14500-g1c41041124bd #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/09/2023
--- include/net/llc_pdu.h | 6 ++---- net/llc/llc_core.c | 7 ------- 2 files changed, 2 insertions(+), 11 deletions(-)
include/net/llc_pdu.h +2 -4
@@ -262,8 +262,7 @@ static inline void llc_pdu_header_init(struct sk_buff *skb, u8 type,*/ static inline void llc_pdu_decode_sa (struct sk_buff *skb,u8 *sa) { -if (skb->protocol ==htons (ETH_P_802_2 )) -memcpy (sa,eth_hdr (skb)->h_source,ETH_ALEN ); +memcpy (sa,eth_hdr (skb)->h_source,ETH_ALEN ); }/**
@@ -275,8 +274,7 @@ static inline void llc_pdu_decode_sa(struct sk_buff *skb, u8 *sa)*/ static inline void llc_pdu_decode_da (struct sk_buff *skb,u8 *da) { -if (skb->protocol ==htons (ETH_P_802_2 )) -memcpy (da,eth_hdr (skb)->h_dest,ETH_ALEN ); +memcpy (da,eth_hdr (skb)->h_dest,ETH_ALEN ); }/**
net/llc/llc_core.c +0 -7
@@ -135,22 +135,15 @@ static struct packet_type llc_packet_type __read_mostly = { .func = llc_rcv, }; -static struct packet_type llc_tr_packet_type__read_mostly = { - .type =cpu_to_be16 (ETH_P_TR_802_2 ), - .func = llc_rcv, -}; -static int __init llc_init (void ) {dev_add_pack (&llc_packet_type); -dev_add_pack (&llc_tr_packet_type);return 0 ; } static void __exit llc_exit(void) {dev_remove_pack (&llc_packet_type); -dev_remove_pack (&llc_tr_packet_type); }module_init (llc_init);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 51/476 net/rds: Fix UBSAN: array-index-out-of-bounds in rds_cmsg_recv
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sharath Srinivasan <[email protected]>
[ Upstream commit 13e788deb7348cc88df34bed736c3b3b9927ea52 ]
Syzcaller UBSAN crash occurs in rds_cmsg_recv(),
which reads inc->i_rx_lat_trace[j + 1] with index 4 (3 + 1), but with array size of 4 (RDS_RX_MAX_TRACES).
Here 'j' is assigned from rs->rs_rx_trace[i] and in-turn from trace.rx_trace_pos[i] in rds_recv_track_latency(),
with both arrays sized 3 (RDS_MSG_RX_DGRAM_TRACE_MAX). So fix the off-by-one bounds check in rds_recv_track_latency() to prevent a potential crash in rds_cmsg_recv().
Found by syzcaller:
=================================================================
UBSAN: array-index-out-of-bounds in net/rds/recv.c:585:39 index 4 is out of range for type 'u64 [4]' CPU: 1 PID: 8058 Comm: syz-executor228 Not tainted 6.6.0-gd2f51b3516da #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x136/0x150 lib/dump_stack.c:106 ubsan_epilogue lib/ubsan.c:217 [inline] __ubsan_handle_out_of_bounds+0xd5/0x130 lib/ubsan.c:348 rds_cmsg_recv+0x60d/0x700 net/rds/recv.c:585 rds_recvmsg+0x3fb/0x1610 net/rds/recv.c:716 sock_recvmsg_nosec net/socket.c:1044 [inline] sock_recvmsg+0xe2/0x160 net/socket.c:1066 __sys_recvfrom+0x1b6/0x2f0 net/socket.c:2246 __do_sys_recvfrom net/socket.c:2264 [inline] __se_sys_recvfrom net/socket.c:2260 [inline] __x64_sys_recvfrom+0xe0/0x1b0 net/socket.c:2260 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x40/0x110 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x63/0x6b ==================================================================
--- net/rds/af_rds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/rds/af_rds.c +1 -1
@@ -419,7 +419,7 @@ static int rds_recv_track_latency(struct rds_sock *rs, sockptr_t optval, rs->rs_rx_traces = trace.rx_traces;for (i =0 ; i < rs->rs_rx_traces; i++) { -if (trace.rx_trace_pos[i] >RDS_MSG_RX_DGRAM_TRACE_MAX ) { +if (trace.rx_trace_pos[i] >=RDS_MSG_RX_DGRAM_TRACE_MAX ) { rs->rs_rx_traces =0 ;return -EFAULT ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 52/476 tracing: Ensure visibility when inserting an element into tracing_map
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Petr Pavlu <[email protected]>
[ Upstream commit 2b44760609e9eaafc9d234a6883d042fc21132a7 ]
Running the following two commands in parallel on a multi-processor AArch64 machine can sporadically produce an unexpected warning about duplicate histogram entries:
$ while true; do
echo hist:key=id.syscall:val=hitcount > \
/sys/kernel/debug/tracing/events/raw_syscalls/sys_enter/trigger
cat /sys/kernel/debug/tracing/events/raw_syscalls/sys_enter/hist
sleep 0.001
done
$ stress-ng --sysbadaddr $(nproc)The warning looks as follows:
[ 2911.172474] ------------[ cut here ]------------ [ 2911.173111] Duplicates detected: 1 [ 2911.173574] WARNING: CPU: 2 PID: 12247 at kernel/trace/tracing_map.c:983 tracing_map_sort_entries+0x3e0/0x408 [ 2911.174702] Modules linked in: iscsi_ibft(E) iscsi_boot_sysfs(E) rfkill(E) af_packet(E) nls_iso8859_1(E) nls_cp437(E) vfat(E) fat(E) ena(E) tiny_power_button(E) qemu_fw_cfg(E) button(E) fuse(E) efi_pstore(E) ip_tables(E) x_tables(E) xfs(E) libcrc32c(E) aes_ce_blk(E) aes_ce_cipher(E) crct10dif_ce(E) polyval_ce(E) polyval_generic(E) ghash_ce(E) gf128mul(E) sm4_ce_gcm(E) sm4_ce_ccm(E) sm4_ce(E) sm4_ce_cipher(E) sm4(E) sm3_ce(E) sm3(E) sha3_ce(E) sha512_ce(E) sha512_arm64(E) sha2_ce(E) sha256_arm64(E) nvme(E) sha1_ce(E) nvme_core(E) nvme_auth(E) t10_pi(E) sg(E) scsi_mod(E) scsi_common(E) efivarfs(E) [ 2911.174738] Unloaded tainted modules: cppc_cpufreq(E):1 [ 2911.180985] CPU: 2 PID: 12247 Comm: cat Kdump: loaded Tainted: G E 6.7.0-default #2 1b58bbb22c97e4399dc09f92d309344f69c44a01 [ 2911.182398] Hardware name: Amazon EC2 c7g.8xlarge/, BIOS 1.0 11/1/2018 [ 2911.183208] pstate: 61400005 (nZCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--) [ 2911.184038] pc : tracing_map_sort_entries+0x3e0/0x408 [ 2911.184667] lr : tracing_map_sort_entries+0x3e0/0x408 [ 2911.185310] sp : ffff8000a1513900 [ 2911.185750] x29: ffff8000a1513900 x28: ffff0003f272fe80 x27: 0000000000000001 [ 2911.186600] x26: ffff0003f272fe80 x25: 0000000000000030 x24: 0000000000000008 [ 2911.187458] x23: ffff0003c5788000 x22: ffff0003c16710c8 x21: ffff80008017f180 [ 2911.188310] x20: ffff80008017f000 x19: ffff80008017f180 x18: ffffffffffffffff [ 2911.189160] x17: 0000000000000000 x16: 0000000000000000 x15: ffff8000a15134b8 [ 2911.190015] x14: 0000000000000000 x13: 205d373432323154 x12: 5b5d313131333731 [ 2911.190844] x11: 00000000fffeffff x10: 00000000fffeffff x9 : ffffd1b78274a13c [ 2911.191716] x8 : 000000000017ffe8 x7 : c0000000fffeffff x6 : 000000000057ffa8 [ 2911.192554] x5 : ffff0012f6c24ec0 x4 : 0000000000000000 x3 : ffff2e5b72b5d000 [ 2911.193404] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff0003ff254480 [ 2911.194259] Call trace: [ 2911.194626] tracing_map_sort_entries+0x3e0/0x408 [ 2911.195220] hist_show+0x124/0x800 [ 2911.195692] seq_read_iter+0x1d4/0x4e8 [ 2911.196193] seq_read+0xe8/0x138 [ 2911.196638] vfs_read+0xc8/0x300 [ 2911.197078] ksys_read+0x70/0x108 [ 2911.197534] __arm64_sys_read+0x24/0x38 [ 2911.198046] invoke_syscall+0x78/0x108 [ 2911.198553] el0_svc_common.constprop.0+0xd0/0xf8 [ 2911.199157] do_el0_svc+0x28/0x40 [ 2911.199613] el0_svc+0x40/0x178 [ 2911.200048] el0t_64_sync_handler+0x13c/0x158 [ 2911.200621] el0t_64_sync+0x1a8/0x1b0 [ 2911.201115] ---[ end trace 0000000000000000 ]---
The problem appears to be caused by CPU reordering of writes issued from __tracing_map_insert().
The check for the presence of an element with a given key in this function is:
val = READ_ONCE(entry->val);
if (val && keys_match(key, val->key, map->key_size)) ...
The write of a new entry is:
elt = get_free_elt(map);
memcpy(elt->key, key, map->key_size);
entry->val = elt;
The "memcpy(elt->key, key, map->key_size);" and "entry->val = elt;" stores may become visible in the reversed order on another CPU. This second CPU might then incorrectly determine that a new key doesn't match an already present val->key and subsequently insert a new element, resulting in a duplicate.
Fix the problem by adding a write barrier between "memcpy(elt->key, key, map->key_size);" and "entry->val = elt;", and for good measure, also use WRITE_ONCE(entry->val, elt) for publishing the element. The sequence pairs with the mentioned "READ_ONCE(entry->val);" and the "val->key" check which has an address dependency.
The barrier is placed on a path executed when adding an element for a new key. Subsequent updates targeting the same key remain unaffected.
Quoted 1 line
From the user's perspective, the issue was introduced by commit
c193707dde77 ("tracing: Remove code which merges duplicates"), which followed commit cbf4100efb8f ("tracing: Add support to detect and avoid duplicates"). The previous code operated differently; it inherently expected potential races which result in duplicates but merged them later when they occurred.
--- kernel/trace/tracing_map.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/trace/tracing_map.c +6 -1
@@ -574,7 +574,12 @@ __tracing_map_insert(struct tracing_map *map, void *key, bool lookup_only) }memcpy (elt->key, key, map->key_size); - entry->val = elt; +/* +* Ensure the initialization is visible and +* publish the elt. +*/ +smp_wmb (); +WRITE_ONCE (entry->val, elt);atomic64_inc (&map->hits);return entry->val;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 53/476 afs: Hide silly-rename files from userspace
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 57e9d49c54528c49b8bffe6d99d782ea051ea534 ]
There appears to be a race between silly-rename files being created/removed and various userspace tools iterating over the contents of a directory, leading to such errors as:
find: './kernel/.tmp_cpio_dir/include/dt-bindings/reset/.__afs2080': No such file or directory
tar: ./include/linux/greybus/.__afs3C95: File removed before we read it
when building a kernel.
Fix afs_readdir() so that it doesn't return .__afsXXXX silly-rename files to userspace. This doesn't stop them being looked up directly by name as we need to be able to look them up from within the kernel as part of the silly-rename algorithm.
--- fs/afs/dir.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/afs/dir.c +8 -0
@@ -492,6 +492,14 @@ static int afs_dir_iterate_block(struct afs_vnode *dvnode,continue ; } +/* Don't expose silly rename entries to userspace. */ +if (nlen >6 && + dire->u.name[0 ] =='.' && + ctx->actor != afs_lookup_filldir && + ctx->actor != afs_lookup_one_filldir && +memcmp (dire->u.name,".__afs" ,6 ) ==0 ) +continue ; +/* found the next entry */ if (!dir_emit(ctx, dire->u.name, nlen, ntohl(dire->u.vnode),
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 54/476 tcp: Add memory barrier to tcp_push()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Salvatore Dipietro <[email protected]>
[ Upstream commit 7267e8dcad6b2f9fce05a6a06335d7040acbc2b6 ]
On CPUs with weak memory models, reads and updates performed by tcp_push to the sk variables can get reordered leaving the socket throttled when it should not. The tasklet running tcp_wfree() may also not observe the memory updates in time and will skip flushing any packets throttled by tcp_push(), delaying the sending. This can pathologically cause 40ms extra latency due to bad interactions with delayed acks.
Adding a memory barrier in tcp_push removes the bug, similarly to the previous commit bf06200e732d ("tcp: tsq: fix nonagle handling"). smp_mb__after_atomic() is used to not incur in unnecessary overhead on x86 since not affected.
Patch has been tested using an AWS c7g.2xlarge instance with Ubuntu 22.04 and Apache Tomcat 9.0.83 running the basic servlet below:
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class HelloWorldServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
OutputStreamWriter osw = new OutputStreamWriter(response.getOutputStream(),"UTF-8");
String s = "a".repeat(3096);
osw.write(s,0,s.length());
osw.flush();
}
}Load was applied using wrk2 (https://github.com/kinvolk/wrk2) from an AWS c6i.8xlarge instance. Before the patch an additional 40ms latency from P99.99+ values is observed while, with the patch, the extra latency disappears.
No patch and tcp_autocorking=1
./wrk -t32 -c128 -d40s --latency -R10000 http://172.31.60.173:8080/hello/hello
...
50.000% 0.91ms 75.000% 1.13ms 90.000% 1.46ms 99.000% 1.74ms 99.900% 1.89ms 99.990% 41.95ms <<< 40+ ms extra latency 99.999% 48.32ms 100.000% 48.96ms
With patch and tcp_autocorking=1
./wrk -t32 -c128 -d40s --latency -R10000 http://172.31.60.173:8080/hello/hello
...
50.000% 0.90ms 75.000% 1.13ms 90.000% 1.45ms 99.000% 1.72ms 99.900% 1.83ms 99.990% 2.11ms <<< no 40+ ms extra latency 99.999% 2.53ms 100.000% 2.62ms
Patch has been also tested on x86 (m7i.2xlarge instance) which it is not affected by this issue and the patch doesn't introduce any additional delay.
--- net/ipv4/tcp.c | 1 + 1 file changed, 1 insertion(+)
net/ipv4/tcp.c +1 -0
@@ -722,6 +722,7 @@ void tcp_push(struct sock *sk, int flags, int mss_now,if (!test_bit (TSQ_THROTTLED , &sk->sk_tsq_flags)) {NET_INC_STATS (sock_net (sk),LINUX_MIB_TCPAUTOCORKING );set_bit (TSQ_THROTTLED , &sk->sk_tsq_flags); +smp_mb__after_atomic (); }/* It is possible TX completion already happened * before we set TSQ_THROTTLED.
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 55/476 netlink: fix potential sleeping issue in mqueue_flush_file
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhengchao Shao <[email protected]>
[ Upstream commit 234ec0b6034b16869d45128b8cd2dc6ffe596f04 ]
I analyze the potential sleeping issue of the following processes:
Thread A Thread B ... netlink_create //ref = 1 do_mq_notify ... sock = netlink_getsockbyfilp ... //ref = 2 info->notify_sock = sock; ... ... netlink_sendmsg
... skb = netlink_alloc_large_skb //skb->head is vmalloced
... netlink_unicast
... sk = netlink_getsockbyportid //ref = 3
... netlink_sendskb
... __netlink_sendskb
... skb_queue_tail //put skb to sk_receive_queue
... sock_put //ref = 2
... ...
... netlink_release
... deferred_put_nlk_sk //ref = 1mqueue_flush_file
spin_lock
remove_notification
netlink_sendskb
sock_put //ref = 0
sk_free
...
__sk_destruct
netlink_sock_destruct
skb_queue_purge //get skb from sk_receive_queue
...
__skb_queue_purge_reason
kfree_skb_reason
__kfree_skb
...
skb_release_all
skb_release_head_state
netlink_skb_destructor
vfree(skb->head) //sleeping while holding spinlockIn netlink_sendmsg, if the memory pointed to by skb->head is allocated by vmalloc, and is put to sk_receive_queue queue, also the skb is not freed. When the mqueue executes flush, the sleeping bug will occur. Use vfree_atomic instead of vfree in netlink_skb_destructor to solve the issue.
--- net/netlink/af_netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netlink/af_netlink.c +1 -1
@@ -374,7 +374,7 @@ static void netlink_skb_destructor(struct sk_buff *skb)if (is_vmalloc_addr (skb->head)) {if (!skb->cloned || !atomic_dec_return (&(skb_shinfo (skb)->dataref))) -vfree (skb->head); +vfree_atomic (skb->head); skb->head =NULL ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 56/476 ipv6: init the accept_queues spinlocks in inet6_create
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhengchao Shao <[email protected]>
[ Upstream commit 435e202d645c197dcfd39d7372eb2a56529b6640 ]
In commit 198bc90e0e73("tcp: make sure init the accept_queue's spinlocks once"), the spinlocks of accept_queue are initialized only when socket is created in the inet4 scenario. The locks are not initialized when socket is created in the inet6 scenario. The kernel reports the following error:
INFO: trying to register non-static key.
The code is fine but needs lockdep annotation, or maybe
you didn't initialize this object before use?
turning off the locking correctness validator.
Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011 Call Trace: <TASK> dump_stack_lvl (lib/dump_stack.c:107) register_lock_class (kernel/locking/lockdep.c:1289) __lock_acquire (kernel/locking/lockdep.c:5015) lock_acquire.part.0 (kernel/locking/lockdep.c:5756) _raw_spin_lock_bh (kernel/locking/spinlock.c:178) inet_csk_listen_stop (net/ipv4/inet_connection_sock.c:1386) tcp_disconnect (net/ipv4/tcp.c:2981) inet_shutdown (net/ipv4/af_inet.c:935) __sys_shutdown (./include/linux/file.h:32 net/socket.c:2438) __x64_sys_shutdown (net/socket.c:2445) do_syscall_64 (arch/x86/entry/common.c:52) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:129) RIP: 0033:0x7f52ecd05a3d Code: 5b 41 5c c3 66 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 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 8b 0d ab a3 0e 00 f7 d8 64 89 01 48
RSP: 002b:00007f52ecf5dde8 EFLAGS: 00000293 ORIG_RAX: 0000000000000030
RAX: ffffffffffffffda RBX: 00007f52ecf5e640 RCX: 00007f52ecd05a3d
RDX: 00007f52ecc8b188 RSI: 0000000000000000 RDI: 0000000000000004
RBP: 00007f52ecf5de20 R08: 00007ffdae45c69f R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000293 R12: 00007f52ecf5e640
R13: 0000000000000000 R14: 00007f52ecc8b060 R15: 00007ffdae45c6e0
--- net/ipv6/af_inet6.c | 3 +++ 1 file changed, 3 insertions(+)
net/ipv6/af_inet6.c +3 -0
@@ -198,6 +198,9 @@ static int inet6_create(struct net *net, struct socket *sock, int protocol,if (INET_PROTOSW_REUSE & answer_flags) sk->sk_reuse =SK_CAN_REUSE ; +if (INET_PROTOSW_ICSK & answer_flags) +inet_init_csk_locks (sk); + inet =inet_sk (sk); inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) !=0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 57/476 net/mlx5: DR, Use the right GVMI number for drop action
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yevgeny Kliteynik <[email protected]>
[ Upstream commit 5665954293f13642f9c052ead83c1e9d8cff186f ]
When FW provides ICM addresses for drop RX/TX, the provided capability is 64 bits that contain its GVMI as well as the ICM address itself. In case of TX DROP this GVMI is different from the GVMI that the domain is operating on.
This patch fixes the action to use these GVMI IDs, as provided by FW.
--- drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c +1 -0
@@ -579,6 +579,7 @@ int mlx5dr_actions_build_ste_arr(struct mlx5dr_matcher *matcher,switch (action_type) {case DR_ACTION_TYP_DROP : attr.final_icm_addr = nic_dmn->drop_icm_addr; + attr.hit_gvmi = nic_dmn->drop_icm_addr >>48 ;break ;case DR_ACTION_TYP_FT : dest_action = action;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 58/476 net/mlx5: DR, Replace local WIRE_PORT macro with the existing MLX5_VPORT_UPLINK
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yevgeny Kliteynik <[email protected]>
[ Upstream commit 7ae8ac9a582088c85154970982766617c9ebf8dc ]
SW steering defines its own macro for uplink vport number. Replace this macro with an already existing mlx5 macro.
Stable-dep-of: 5b2a2523eeea ("net/mlx5: DR, Can't go to uplink vport on RX rule")
--- .../net/ethernet/mellanox/mlx5/core/steering/dr_action.c | 2 +- .../net/ethernet/mellanox/mlx5/core/steering/dr_domain.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c | 4 ++-- .../net/ethernet/mellanox/mlx5/core/steering/dr_types.h | 7 +++---- 4 files changed, 7 insertions(+), 8 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c +1 -1
@@ -670,7 +670,7 @@ int mlx5dr_actions_build_ste_arr(struct mlx5dr_matcher *matcher, attr.hit_gvmi = action->vport->caps->vhca_gvmi; dest_action = action;if (rx_rule) { -if (action->vport->caps->num ==WIRE_PORT ) { +if (action->vport->caps->num ==MLX5_VPORT_UPLINK ) {mlx5dr_dbg (dmn,"Device doesn't support Loopback on WIRE vport\n" );return -EOPNOTSUPP ; }
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c +1 -1
@@ -171,7 +171,7 @@ static int dr_domain_query_vports(struct mlx5dr_domain *dmn)/* Last vport is the wire port */ wire_vport = &dmn->info.caps.vports_caps[vport]; - wire_vport->num =WIRE_PORT ; + wire_vport->num =MLX5_VPORT_UPLINK ; wire_vport->icm_address_rx = esw_caps->uplink_icm_address_rx; wire_vport->icm_address_tx = esw_caps->uplink_icm_address_tx; wire_vport->vport_gvmi =0 ;
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c +2 -2
@@ -1042,10 +1042,10 @@ static bool dr_rule_skip(enum mlx5dr_domain_type domain,return false;if (mask->misc.source_port) { -if (rx && value->misc.source_port !=WIRE_PORT ) +if (rx && value->misc.source_port !=MLX5_VPORT_UPLINK )return true; -if (!rx && value->misc.source_port ==WIRE_PORT ) +if (!rx && value->misc.source_port ==MLX5_VPORT_UPLINK )return true; }
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +3 -4
@@ -4,7 +4,7 @@#ifndef _DR_TYPES_#define _DR_TYPES_ -#include <linux/mlx5/driver.h> +#include <linux/mlx5/vport.h> #include <linux/refcount.h> #include "fs_core.h" #include "wq.h"
@@ -14,7 +14,6 @@#define DR_RULE_MAX_STES 18#define DR_ACTION_MAX_STES 5 -#define WIRE_PORT 0xFFFF#define DR_STE_SVLAN 0x1#define DR_STE_CVLAN 0x2#define DR_SZ_MATCH_PARAM (MLX5_ST_SZ_DW_MATCH_PARAM * 4)
@@ -1116,10 +1115,10 @@ static inline struct mlx5dr_cmd_vport_cap * mlx5dr_get_vport_cap(struct mlx5dr_cmd_caps *caps, u32 vport) {if (!caps->vports_caps || - (vport >= caps->num_vports && vport !=WIRE_PORT )) + (vport >= caps->num_vports && vport !=MLX5_VPORT_UPLINK ))return NULL ; -if (vport ==WIRE_PORT ) +if (vport ==MLX5_VPORT_UPLINK ) vport = caps->num_vports;return &caps->vports_caps[vport];
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 59/476 net/mlx5: DR, Align mlx5dv_dr API vport action with FW behavior
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shun Hao <[email protected]>
[ Upstream commit aa818fbf8f36e8c6f3e608ea960567906c2d6112 ]
This aligns the behavior with FW when creating an FDB rule with wire vport destination but no source port matching. Until now such rules would fail on internal DR RX rule creation since the source and destination are the wire vport.
The new behavior is the same as done on FW steering, if destination is wire, we will create both TX and RX rules, but the RX packet coming from wire will be dropped due to loopback not supported.
Stable-dep-of: 5b2a2523eeea ("net/mlx5: DR, Can't go to uplink vport on RX rule")
--- .../ethernet/mellanox/mlx5/core/steering/dr_action.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c +3 -9
@@ -669,15 +669,9 @@ int mlx5dr_actions_build_ste_arr(struct mlx5dr_matcher *matcher,case DR_ACTION_TYP_VPORT : attr.hit_gvmi = action->vport->caps->vhca_gvmi; dest_action = action; -if (rx_rule) { -if (action->vport->caps->num ==MLX5_VPORT_UPLINK ) { -mlx5dr_dbg (dmn,"Device doesn't support Loopback on WIRE vport\n" ); -return -EOPNOTSUPP ; - } - attr.final_icm_addr = action->vport->caps->icm_address_rx; - }else { - attr.final_icm_addr = action->vport->caps->icm_address_tx; - } + attr.final_icm_addr = rx_rule ? + action->vport->caps->icm_address_rx : + action->vport->caps->icm_address_tx;break ;case DR_ACTION_TYP_POP_VLAN : if (!rx_rule && !(dmn->ste_ctx->actions_caps &
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 60/476 net/mlx5: DR, Cant go to uplink vport on RX rule
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yevgeny Kliteynik <[email protected]>
[ Upstream commit 5b2a2523eeea5f03d39a9d1ff1bad2e9f8eb98d2 ]
Go-To-Vport action on RX is not allowed when the vport is uplink. In such case, the packet should be dropped.
--- .../mellanox/mlx5/core/steering/dr_action.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c +11 -5
@@ -667,11 +667,17 @@ int mlx5dr_actions_build_ste_arr(struct mlx5dr_matcher *matcher, action->sampler->tx_icm_addr;break ;case DR_ACTION_TYP_VPORT : - attr.hit_gvmi = action->vport->caps->vhca_gvmi; - dest_action = action; - attr.final_icm_addr = rx_rule ? - action->vport->caps->icm_address_rx : - action->vport->caps->icm_address_tx; +if (unlikely (rx_rule && action->vport->caps->num ==MLX5_VPORT_UPLINK )) { +/* can't go to uplink on RX rule - dropping instead */ + attr.final_icm_addr = nic_dmn->drop_icm_addr; + attr.hit_gvmi = nic_dmn->drop_icm_addr >>48 ; + }else { + attr.hit_gvmi = action->vport->caps->vhca_gvmi; + dest_action = action; + attr.final_icm_addr = rx_rule ? + action->vport->caps->icm_address_rx : + action->vport->caps->icm_address_tx; + }break ;case DR_ACTION_TYP_POP_VLAN : if (!rx_rule && !(dmn->ste_ctx->actions_caps &
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 61/476 net/mlx5e: fix a double-free in arfs_create_groups
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhipeng Lu <[email protected]>
[ Upstream commit 3c6d5189246f590e4e1f167991558bdb72a4738b ]
When in allocated by kvzalloc fails, arfs_create_groups will free ft->g and return an error. However, arfs_create_table, the only caller of arfs_create_groups, will hold this error and call to mlx5e_destroy_flow_table, in which the ft->g will be freed again.
--- .../net/ethernet/mellanox/mlx5/core/en_arfs.c | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c +15 -11
@@ -239,11 +239,13 @@ static int arfs_create_groups(struct mlx5e_flow_table *ft, ft->g =kcalloc (MLX5E_ARFS_NUM_GROUPS ,sizeof (*ft->g),GFP_KERNEL ); - in =kvzalloc (inlen,GFP_KERNEL ); -if (!in || !ft->g) { -kfree (ft->g); -kvfree (in); +if (!ft->g)return -ENOMEM ; + + in =kvzalloc (inlen,GFP_KERNEL ); +if (!in) { + err = -ENOMEM ; + goto err_free_g; } mc =MLX5_ADDR_OF (create_flow_group_in, in, match_criteria);
@@ -263,7 +265,7 @@ static int arfs_create_groups(struct mlx5e_flow_table *ft,break ;default : err = -EINVAL ; - goto out; + goto err_free_in; }switch (type) {
@@ -285,7 +287,7 @@ static int arfs_create_groups(struct mlx5e_flow_table *ft,break ;default : err = -EINVAL ; - goto out; + goto err_free_in; }MLX5_SET_CFG (in, match_criteria_enable,MLX5_MATCH_OUTER_HEADERS );
@@ -294,7 +296,7 @@ static int arfs_create_groups(struct mlx5e_flow_table *ft,MLX5_SET_CFG (in, end_flow_index, ix -1 ); ft->g[ft->num_groups] =mlx5_create_flow_group (ft->t, in);if (IS_ERR (ft->g[ft->num_groups])) - goto err; + goto err_clean_group; ft->num_groups++;memset (in,0 , inlen);
@@ -303,18 +305,20 @@ static int arfs_create_groups(struct mlx5e_flow_table *ft,MLX5_SET_CFG (in, end_flow_index, ix -1 ); ft->g[ft->num_groups] =mlx5_create_flow_group (ft->t, in);if (IS_ERR (ft->g[ft->num_groups])) - goto err; + goto err_clean_group; ft->num_groups++;kvfree (in);return 0 ; -err: +err_clean_group: err =PTR_ERR (ft->g[ft->num_groups]); ft->g[ft->num_groups] =NULL ; -out: +err_free_in:kvfree (in); - +err_free_g: +kfree (ft->g); + ft->g =NULL ;return err; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 62/476 net/mlx5e: fix a potential double-free in fs_any_create_groups
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dinghao Liu <[email protected]>
[ Upstream commit aef855df7e1bbd5aa4484851561211500b22707e ]
When kcalloc() for ft->g succeeds but kvzalloc() for in fails, fs_any_create_groups() will free ft->g. However, its caller fs_any_create_table() will free ft->g again through calling mlx5e_destroy_flow_table(), which will lead to a double-free. Fix this by setting ft->g to NULL in fs_any_create_groups().
--- drivers/net/ethernet/mellanox/mlx5/core/en/fs_tt_redirect.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx5/core/en/fs_tt_redirect.c +1 -0
@@ -435,6 +435,7 @@ static int fs_any_create_groups(struct mlx5e_flow_table *ft) in =kvzalloc (inlen,GFP_KERNEL );if (!in || !ft->g) {kfree (ft->g); + ft->g =NULL ;kvfree (in);return -ENOMEM ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 63/476 overflow: Allow mixed type arguments
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
commit d219d2a9a92e39aa92799efe8f2aa21259b6dd82 upstream.
When the check_[op]_overflow() helpers were introduced, all arguments were required to be the same type to make the fallback macros simpler. However, now that the fallback macros have been removed[1], it is fine to allow mixed types, which makes using the helpers much more useful, as they can be used to test for type-based overflows (e.g. adding two large ints but storing into a u8), as would be handy in the drm core[2].
Remove the restriction, and add additional self-tests that exercise some of the mixed-type overflow cases, and double-check for accidental macro side-effects.
[1] https://git.kernel.org/linus/4eb6bd55cfb22ffc20652732340c4962f3ac9a91
[2] https://lore.kernel.org/lkml/[email protected]
[ dropped the test portion of the commit as that doesn't apply to
5.15.y - gregkh]
--- include/linux/overflow.h | 72 ++++++++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 31 deletions(-)
include/linux/overflow.h +41 -31
@@ -51,40 +51,50 @@ static inline bool __must_check __must_creturn unlikely (overflow); } -/* -* For simplicity and code hygiene, the fallback code below insists on -* a, b and *d having the same type (similar to the min() and max() -* macros), whereas gcc's type-generic overflow checkers accept -* different types. Hence we don't just make check_add_overflow an -* alias for __builtin_add_overflow, but add type checks similar to -* below. +/** check_add_overflow() - Calculate addition with overflow checking +* +* @a: first addend +* @b: second addend +* @d: pointer to store sum +* +* Returns 0 on success. +* +* *@d holds the results of the attempted addition, but is not considered +* "safe for use" on a non-zero return value, which indicates that the +* sum has overflowed or been truncated. */ -#define check_add_overflow (a, b, d) __must_check_overflow(({ \ - typeof(a) __a = (a); \ - typeof(b) __b = (b); \ - typeof(d) __d = (d); \ - (void) (&__a == &__b); \ - (void) (&__a == __d); \ - __builtin_add_overflow(__a, __b, __d); \ -})) +#define check_add_overflow (a, b, d) \ + __must_check_overflow(__builtin_add_overflow(a, b, d)) -#define check_sub_overflow (a, b, d) __must_check_overflow(({ \ - typeof(a) __a = (a); \ - typeof(b) __b = (b); \ - typeof(d) __d = (d); \ - (void) (&__a == &__b); \ - (void) (&__a == __d); \ - __builtin_sub_overflow(__a, __b, __d); \ -})) +/** check_sub_overflow() - Calculate subtraction with overflow checking +* +* @a: minuend; value to subtract from +* @b: subtrahend; value to subtract from @a +* @d: pointer to store difference +* +* Returns 0 on success. +* +* *@d holds the results of the attempted subtraction, but is not considered +* "safe for use" on a non-zero return value, which indicates that the +* difference has underflowed or been truncated. +*/ +#define check_sub_overflow (a, b, d) \ + __must_check_overflow(__builtin_sub_overflow(a, b, d)) -#define check_mul_overflow (a, b, d) __must_check_overflow(({ \ - typeof(a) __a = (a); \ - typeof(b) __b = (b); \ - typeof(d) __d = (d); \ - (void) (&__a == &__b); \ - (void) (&__a == __d); \ - __builtin_mul_overflow(__a, __b, __d); \ -})) +/** check_mul_overflow() - Calculate multiplication with overflow checking +* +* @a: first factor +* @b: second factor +* @d: pointer to store product +* +* Returns 0 on success. +* +* *@d holds the results of the attempted multiplication, but is not +* considered "safe for use" on a non-zero return value, which indicates +* that the product has overflowed or been truncated. +*/ +#define check_mul_overflow (a, b, d) \ + __must_check_overflow(__builtin_mul_overflow(a, b, d))/** check_shl_overflow() - Calculate a left-shifted value and check overflow *
Greg Kroah-Hartman
maintainerPATCH 64/476 netfilter: nft_limit: reject configurations that cause integer overflow
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit c9d9eb9c53d37cdebbad56b91e40baf42d5a97aa ]
Reject bogus configs where internal token counter wraps around. This only occurs with very very large requests, such as 17gbyte/s.
Its better to reject this rather than having incorrect ratelimit.
--- net/netfilter/nft_limit.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
net/netfilter/nft_limit.c +16 -7
@@ -58,17 +58,19 @@ static inline bool nft_limit_eval(struct nft_limit_priv *priv, u64 cost)static int nft_limit_init (struct nft_limit_priv *priv,const struct nlattr *const tb[],bool pkts) { +u64 unit, tokens, rate_with_burst;bool invert = false; -u64 unit, tokens;if (tb[NFTA_LIMIT_RATE ] ==NULL || tb[NFTA_LIMIT_UNIT ] ==NULL )return -EINVAL ; priv->rate =be64_to_cpu (nla_get_be64 (tb[NFTA_LIMIT_RATE ])); +if (priv->rate ==0 ) +return -EINVAL ; + unit =be64_to_cpu (nla_get_be64 (tb[NFTA_LIMIT_UNIT ])); - priv->nsecs = unit *NSEC_PER_SEC ; -if (priv->rate ==0 || priv->nsecs < unit) +if (check_mul_overflow (unit,NSEC_PER_SEC , &priv->nsecs))return -EOVERFLOW ;if (tb[NFTA_LIMIT_BURST ])
@@ -77,18 +79,25 @@ static int nft_limit_init(struct nft_limit_priv *priv,if (pkts && priv->burst ==0 ) priv->burst =NFT_LIMIT_PKT_BURST_DEFAULT ; -if (priv->rate + priv->burst < priv->rate) +if (check_add_overflow (priv->rate, priv->burst, &rate_with_burst))return -EOVERFLOW ;if (pkts) { - tokens =div64_u64 (priv->nsecs, priv->rate) * priv->burst; +u64 tmp =div64_u64 (priv->nsecs, priv->rate); + +if (check_mul_overflow (tmp, priv->burst, &tokens)) +return -EOVERFLOW ; }else { +u64 tmp; +/* The token bucket size limits the number of tokens can be * accumulated. tokens_max specifies the bucket size. * tokens_max = unit * (rate + burst) / rate. */ - tokens =div64_u64 (priv->nsecs * (priv->rate + priv->burst), - priv->rate); +if (check_mul_overflow (priv->nsecs, rate_with_burst, &tmp)) +return -EOVERFLOW ; + + tokens =div64_u64 (tmp, priv->rate); }if (tb[NFTA_LIMIT_FLAGS ]) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 65/476 netfilter: nf_tables: restrict anonymous set and map names to 16 bytes
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit b462579b2b86a8f5230543cadd3a4836be27baf7 ]
nftables has two types of sets/maps, one where userspace defines the name, and anonymous sets/maps, where userspace defines a template name.
For the latter, kernel requires presence of exactly one "%d". nftables uses "__set%d" and "__map%d" for this. The kernel will expand the format specifier and replaces it with the smallest unused number.
As-is, userspace could define a template name that allows to move the set name past the 256 bytes upperlimit (post-expansion).
I don't see how this could be a problem, but I would prefer if userspace cannot do this, so add a limit of 16 bytes for the '%d' template name.
16 bytes is the old total upper limit for set names that existed when nf_tables was merged initially.
--- net/netfilter/nf_tables_api.c | 4 ++++ 1 file changed, 4 insertions(+)
net/netfilter/nf_tables_api.c +4 -0
@@ -24,6 +24,7 @@#include <net/sock.h> #define NFT_MODULE_AUTOLOAD_LIMIT (MODULE_NAME_LEN - sizeof("nft-expr-255-")) +#define NFT_SET_MAX_ANONLEN 16unsigned int nf_tables_net_id__read_mostly ;
@@ -4057,6 +4058,9 @@ static int nf_tables_set_alloc_name(struct nft_ctx *ctx, struct nft_set *set,if (p[1 ] !='d' ||strchr (p +2 ,'%' ))return -EINVAL ; +if (strnlen (name,NFT_SET_MAX_ANONLEN ) >=NFT_SET_MAX_ANONLEN ) +return -EINVAL ; + inuse = (unsigned long *)get_zeroed_page (GFP_KERNEL );if (inuse ==NULL )return -ENOMEM ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 66/476 netfilter: nf_tables: validate NFPROTO_* family
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit d0009effa8862c20a13af4cb7475d9771b905693 ]
Several expressions explicitly refer to NF_INET_* hook definitions from expr->ops->validate, however, family is not validated.
Bail out with EOPNOTSUPP in case they are used from unsupported families.
--- net/netfilter/nft_compat.c | 12 ++++++++++++ net/netfilter/nft_flow_offload.c | 5 +++++ net/netfilter/nft_nat.c | 5 +++++ net/netfilter/nft_rt.c | 5 +++++ net/netfilter/nft_socket.c | 5 +++++ net/netfilter/nft_synproxy.c | 7 +++++-- net/netfilter/nft_tproxy.c | 5 +++++ net/netfilter/nft_xfrm.c | 5 +++++ 8 files changed, 47 insertions(+), 2 deletions(-)
net/netfilter/nft_compat.c +12 -0
@@ -349,6 +349,12 @@ static int nft_target_validate(const struct nft_ctx *ctx,unsigned int hook_mask =0 ;int ret; +if (ctx->family !=NFPROTO_IPV4 && + ctx->family !=NFPROTO_IPV6 && + ctx->family !=NFPROTO_BRIDGE && + ctx->family !=NFPROTO_ARP ) +return -EOPNOTSUPP ; +if (nft_is_base_chain (ctx->chain)) {const struct nft_base_chain *basechain =nft_base_chain (ctx->chain);
@@ -592,6 +598,12 @@ static int nft_match_validate(const struct nft_ctx *ctx,unsigned int hook_mask =0 ;int ret; +if (ctx->family !=NFPROTO_IPV4 && + ctx->family !=NFPROTO_IPV6 && + ctx->family !=NFPROTO_BRIDGE && + ctx->family !=NFPROTO_ARP ) +return -EOPNOTSUPP ; +if (nft_is_base_chain (ctx->chain)) {const struct nft_base_chain *basechain =nft_base_chain (ctx->chain);
net/netfilter/nft_flow_offload.c +5 -0
@@ -357,6 +357,11 @@ static int nft_flow_offload_validate(const struct nft_ctx *ctx, {unsigned int hook_mask = (1 <<NF_INET_FORWARD ); +if (ctx->family !=NFPROTO_IPV4 && + ctx->family !=NFPROTO_IPV6 && + ctx->family !=NFPROTO_INET ) +return -EOPNOTSUPP ; +return nft_chain_validate_hooks (ctx->chain, hook_mask); }
net/netfilter/nft_nat.c +5 -0
@@ -142,6 +142,11 @@ static int nft_nat_validate(const struct nft_ctx *ctx,struct nft_nat *priv =nft_expr_priv (expr);int err; +if (ctx->family !=NFPROTO_IPV4 && + ctx->family !=NFPROTO_IPV6 && + ctx->family !=NFPROTO_INET ) +return -EOPNOTSUPP ; + err =nft_chain_validate_dependency (ctx->chain,NFT_CHAIN_T_NAT );if (err <0 )return err;
net/netfilter/nft_rt.c +5 -0
@@ -166,6 +166,11 @@ static int nft_rt_validate(const struct nft_ctx *ctx, const struct nft_expr *expconst struct nft_rt *priv =nft_expr_priv (expr);unsigned int hooks; +if (ctx->family !=NFPROTO_IPV4 && + ctx->family !=NFPROTO_IPV6 && + ctx->family !=NFPROTO_INET ) +return -EOPNOTSUPP ; +switch (priv->key) {case NFT_RT_NEXTHOP4 :case NFT_RT_NEXTHOP6 :
net/netfilter/nft_socket.c +5 -0
@@ -214,6 +214,11 @@ static int nft_socket_validate(const struct nft_ctx *ctx,const struct nft_expr *expr, const struct nft_data **data) { + if (ctx->family != NFPROTO_IPV4 && + ctx->family != NFPROTO_IPV6 && + ctx->family != NFPROTO_INET) + return -EOPNOTSUPP; + return nft_chain_validate_hooks(ctx->chain, (1 << NF_INET_PRE_ROUTING) | (1 << NF_INET_LOCAL_IN) |
net/netfilter/nft_synproxy.c +5 -2
@@ -186,7 +186,6 @@ static int nft_synproxy_do_init(const struct nft_ctx *ctx,break ;#endif case NFPROTO_INET : -case NFPROTO_BRIDGE : err =nf_synproxy_ipv4_init (snet, ctx->net);if (err) goto nf_ct_failure;
@@ -219,7 +218,6 @@ static void nft_synproxy_do_destroy(const struct nft_ctx *ctx)break ;#endif case NFPROTO_INET : -case NFPROTO_BRIDGE :nf_synproxy_ipv4_fini (snet, ctx->net);nf_synproxy_ipv6_fini (snet, ctx->net);break ;
@@ -253,6 +251,11 @@ static int nft_synproxy_validate(const struct nft_ctx *ctx,const struct nft_expr *expr, const struct nft_data **data) { + if (ctx->family != NFPROTO_IPV4 && + ctx->family != NFPROTO_IPV6 && + ctx->family != NFPROTO_INET) + return -EOPNOTSUPP; + return nft_chain_validate_hooks(ctx->chain, (1 << NF_INET_LOCAL_IN) | (1 << NF_INET_FORWARD)); }
net/netfilter/nft_tproxy.c +5 -0
@@ -316,6 +316,11 @@ static int nft_tproxy_validate(const struct nft_ctx *ctx,const struct nft_expr *expr, const struct nft_data **data) { + if (ctx->family != NFPROTO_IPV4 && + ctx->family != NFPROTO_IPV6 && + ctx->family != NFPROTO_INET) + return -EOPNOTSUPP; + return nft_chain_validate_hooks(ctx->chain, 1 << NF_INET_PRE_ROUTING); }
net/netfilter/nft_xfrm.c +5 -0
@@ -233,6 +233,11 @@ static int nft_xfrm_validate(const struct nft_ctx *ctx, const struct nft_expr *econst struct nft_xfrm *priv =nft_expr_priv (expr);unsigned int hooks; +if (ctx->family !=NFPROTO_IPV4 && + ctx->family !=NFPROTO_IPV6 && + ctx->family !=NFPROTO_INET ) +return -EOPNOTSUPP ; +switch (priv->dir) {case XFRM_POLICY_IN : hooks = (1 << NF_INET_FORWARD) |
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 67/476 net: stmmac: Wait a bit for the reset to take effect
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bernd Edlinger <[email protected]>
[ Upstream commit a5f5eee282a0aae80227697e1d9c811b1726d31d ]
otherwise the synopsys_id value may be read out wrong, because the GMAC_VERSION register might still be in reset state, for at least 1 us after the reset is de-asserted.
Add a wait for 10 us before continuing to be on the safe side.
Quoted 1 line
From what have you got that delay value?
Just try and error, with very old linux versions and old gcc versions the synopsys_id was read out correctly most of the time (but not always), with recent linux versions and recnet gcc versions it was read out wrongly most of the time, but again not always.
I don't have access to the VHDL code in question, so I cannot tell why it takes so long to get the correct values, I also do not have more than a few hardware samples, so I cannot tell how long this timeout must be in worst case.
Experimentally I can tell that the register is read several times as zero immediately after the reset is de-asserted, also adding several no-ops is not enough, adding a printk is enough, also udelay(1) seems to be enough but I tried that not very often, and I have not access to many hardware samples to be 100% sure about the necessary delay. And since the udelay here is only executed once per device instance, it seems acceptable to delay the boot for 10 us.
BTW: my hardware's synopsys id is 0x37.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +3 -0
@@ -7096,6 +7096,9 @@ int stmmac_dvr_probe(struct device *device,dev_err (priv->device,"unable to bring out of ahb reset: %pe\n" ,ERR_PTR (ret)); +/* Wait a bit for the reset to take effect */ +udelay (10 ); +/* Init MAC and get the capabilities */ ret =stmmac_hw_init (priv);if (ret)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 68/476 net: mvpp2: clear BM pool before initialization
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jenishkumar Maheshbhai Patel <[email protected]>
[ Upstream commit 9f538b415db862e74b8c5d3abbccfc1b2b6caa38 ]
Register value persist after booting the kernel using kexec which results in kernel panic. Thus clear the BM pool registers before initialisation to fix the issue.
--- .../net/ethernet/marvell/mvpp2/mvpp2_main.c | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +26 -1
@@ -614,12 +614,38 @@ static void mvpp23_bm_set_8pool_mode(struct mvpp2 *priv)mvpp2_write (priv,MVPP22_BM_POOL_BASE_ADDR_HIGH_REG , val); } +/* Cleanup pool before actual initialization in the OS */ +static void mvpp2_bm_pool_cleanup (struct mvpp2 *priv,int pool_id) +{ +unsigned int thread =mvpp2_cpu_to_thread (priv,get_cpu ()); +u32 val; +int i; + +/* Drain the BM from all possible residues left by firmware */ +for (i =0 ; i <MVPP2_BM_POOL_SIZE_MAX ; i++) +mvpp2_thread_read (priv, thread,MVPP2_BM_PHY_ALLOC_REG (pool_id)); + +put_cpu (); + +/* Stop the BM pool */ + val =mvpp2_read (priv,MVPP2_BM_POOL_CTRL_REG (pool_id)); + val |=MVPP2_BM_STOP_MASK ; +mvpp2_write (priv,MVPP2_BM_POOL_CTRL_REG (pool_id), val); +} +static int mvpp2_bm_init (struct device *dev,struct mvpp2 *priv) {enum dma_data_direction dma_dir =DMA_FROM_DEVICE ;int i, err, poolnum =MVPP2_BM_POOLS_NUM ;struct mvpp2_port *port; +if (priv->percpu_pools) + poolnum =mvpp2_get_nrxqs (priv) *2 ; + +/* Clean up the pool state in case it contains stale state */ +for (i =0 ; i < poolnum; i++) +mvpp2_bm_pool_cleanup (priv, i); +if (priv->percpu_pools) {for (i =0 ; i < priv->port_count; i++) { port = priv->port_list[i];
@@ -629,7 +655,6 @@ static int mvpp2_bm_init(struct device *dev, struct mvpp2 *priv) } } - poolnum =mvpp2_get_nrxqs (priv) *2 ;for (i =0 ; i < poolnum; i++) {/* the pool in use */ int pn = i / (poolnum /2 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 69/476 selftests: netdevsim: fix the udp_tunnel_nic test
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 0879020a7817e7ce636372c016b4528f541c9f4d ]
This test is missing a whole bunch of checks for interface renaming and one ifup. Presumably it was only used on a system with renaming disabled and NetworkManager running.
--- .../selftests/drivers/net/netdevsim/udp_tunnel_nic.sh | 9 +++++++++ 1 file changed, 9 insertions(+)
tools/testing/selftests/drivers/net/netdevsim/udp_tunnel_nic.sh +9 -0
@@ -269,6 +269,7 @@ for port in 0 1; do echo 1 > $NSIM_DEV_SYS/new_port fi NSIM_NETDEV=`get_netdev_name old_netdevs` + ifconfig $NSIM_NETDEV up msg="new NIC device created" exp0=( 0 0 0 0 )
@@ -430,6 +431,7 @@ for port in 0 1; do fi echo $port > $NSIM_DEV_SYS/new_port + NSIM_NETDEV=`get_netdev_name old_netdevs` ifconfig $NSIM_NETDEV up overflow_table0 "overflow NIC table"
@@ -487,6 +489,7 @@ for port in 0 1; do fi echo $port > $NSIM_DEV_SYS/new_port + NSIM_NETDEV=`get_netdev_name old_netdevs` ifconfig $NSIM_NETDEV up overflow_table0 "overflow NIC table"
@@ -543,6 +546,7 @@ for port in 0 1; do fi echo $port > $NSIM_DEV_SYS/new_port + NSIM_NETDEV=`get_netdev_name old_netdevs` ifconfig $NSIM_NETDEV up overflow_table0 "destroy NIC"
@@ -572,6 +576,7 @@ for port in 0 1; do fi echo $port > $NSIM_DEV_SYS/new_port + NSIM_NETDEV=`get_netdev_name old_netdevs` ifconfig $NSIM_NETDEV up msg="create VxLANs v6"
@@ -632,6 +637,7 @@ for port in 0 1; do fi echo $port > $NSIM_DEV_SYS/new_port + NSIM_NETDEV=`get_netdev_name old_netdevs` ifconfig $NSIM_NETDEV up echo 110 > $NSIM_DEV_DFS/ports/$port/udp_ports_inject_error
@@ -687,6 +693,7 @@ for port in 0 1; do fi echo $port > $NSIM_DEV_SYS/new_port + NSIM_NETDEV=`get_netdev_name old_netdevs` ifconfig $NSIM_NETDEV up msg="create VxLANs v6"
@@ -746,6 +753,7 @@ for port in 0 1; do fi echo $port > $NSIM_DEV_SYS/new_port + NSIM_NETDEV=`get_netdev_name old_netdevs` ifconfig $NSIM_NETDEV up msg="create VxLANs v6"
@@ -876,6 +884,7 @@ msg="re-add a port" echo 2 > $NSIM_DEV_SYS/del_port echo 2 > $NSIM_DEV_SYS/new_port +NSIM_NETDEV=`get_netdev_name old_netdevs` check_tables msg="replace VxLAN in overflow table"
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 70/476 fjes: fix memleaks in fjes_hw_setup
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhipeng Lu <[email protected]>
[ Upstream commit f6cc4b6a3ae53df425771000e9c9540cce9b7bb1 ]
In fjes_hw_setup, it allocates several memory and delay the deallocation to the fjes_hw_exit in fjes_probe through the following call chain:
fjes_probe
|-> fjes_hw_init
|-> fjes_hw_setup
|-> fjes_hw_exit
However, when fjes_hw_setup fails, fjes_hw_exit won't be called and thus all the resources allocated in fjes_hw_setup will be leaked. In this patch, we free those resources in fjes_hw_setup and prevents such leaks.
--- drivers/net/fjes/fjes_hw.c | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-)
drivers/net/fjes/fjes_hw.c +30 -7
@@ -220,21 +220,25 @@ static int fjes_hw_setup(struct fjes_hw *hw) mem_size =FJES_DEV_REQ_BUF_SIZE (hw->max_epid); hw->hw_info.req_buf =kzalloc (mem_size,GFP_KERNEL ); -if (!(hw->hw_info.req_buf)) -return -ENOMEM ; +if (!(hw->hw_info.req_buf)) { + result = -ENOMEM ; + goto free_ep_info; + } hw->hw_info.req_buf_size = mem_size; mem_size =FJES_DEV_RES_BUF_SIZE (hw->max_epid); hw->hw_info.res_buf =kzalloc (mem_size,GFP_KERNEL ); -if (!(hw->hw_info.res_buf)) -return -ENOMEM ; +if (!(hw->hw_info.res_buf)) { + result = -ENOMEM ; + goto free_req_buf; + } hw->hw_info.res_buf_size = mem_size; result =fjes_hw_alloc_shared_status_region (hw);if (result) -return result; + goto free_res_buf; hw->hw_info.buffer_share_bit =0 ; hw->hw_info.buffer_unshare_reserve_bit =0 ;
@@ -245,11 +249,11 @@ static int fjes_hw_setup(struct fjes_hw *hw) result =fjes_hw_alloc_epbuf (&buf_pair->tx);if (result) -return result; + goto free_epbuf; result =fjes_hw_alloc_epbuf (&buf_pair->rx);if (result) -return result; + goto free_epbuf;spin_lock_irqsave (&hw->rx_status_lock, flags); fjes_hw_setup_epbuf(&buf_pair->tx, mac,
@@ -272,6 +276,25 @@ static int fjes_hw_setup(struct fjes_hw *hw)fjes_hw_init_command_registers (hw, ¶m);return 0 ; + +free_epbuf: +for (epidx =0 ; epidx < hw->max_epid ; epidx++) { +if (epidx == hw->my_epid) +continue ; +fjes_hw_free_epbuf (&hw->ep_shm_info[epidx].tx); +fjes_hw_free_epbuf (&hw->ep_shm_info[epidx].rx); + } +fjes_hw_free_shared_status_region (hw); +free_res_buf: +kfree (hw->hw_info.res_buf); + hw->hw_info.res_buf =NULL ; +free_req_buf: +kfree (hw->hw_info.req_buf); + hw->hw_info.req_buf =NULL ; +free_ep_info: +kfree (hw->ep_shm_info); + hw->ep_shm_info =NULL ; +return result; }static void fjes_hw_cleanup (struct fjes_hw *hw)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 71/476 net: fec: fix the unhandled context fault from smmu
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shenwei Wang <[email protected]>
[ Upstream commit 5e344807735023cd3a67c37a1852b849caa42620 ]
When repeatedly changing the interface link speed using the command below:
ethtool -s eth0 speed 100 duplex full
ethtool -s eth0 speed 1000 duplex full
The following errors may sometimes be reported by the ARM SMMU driver:
[ 5395.035364] fec 5b040000.ethernet eth0: Link is Down [ 5395.039255] arm-smmu 51400000.iommu: Unhandled context fault: fsr=0x402, iova=0x00000000, fsynr=0x100001, cbfrsynra=0x852, cb=2 [ 5398.108460] fec 5b040000.ethernet eth0: Link is Up - 100Mbps/Full -
flow control off
It is identified that the FEC driver does not properly stop the TX queue during the link speed transitions, and this results in the invalid virtual I/O address translations from the SMMU and causes the context faults.
--- drivers/net/ethernet/freescale/fec_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/freescale/fec_main.c +2 -0
@@ -1813,6 +1813,7 @@ static void fec_enet_adjust_link(struct net_device *ndev)/* if any of the above changed restart the FEC */ if (status_change) { +netif_stop_queue (ndev);napi_disable (&fep->napi);netif_tx_lock_bh (ndev);fec_restart (ndev);
@@ -1822,6 +1823,7 @@ static void fec_enet_adjust_link(struct net_device *ndev) } }else {if (fep->link) { +netif_stop_queue (ndev);napi_disable (&fep->napi);netif_tx_lock_bh (ndev);fec_stop (ndev);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 72/476 btrfs: fix infinite directory reads
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 9b378f6ad48cfa195ed868db9123c09ee7ec5ea2 upstream.
The readdir implementation currently processes always up to the last index it finds. This however can result in an infinite loop if the directory has a large number of entries such that they won't all fit in the given buffer passed to the readdir callback, that is, dir_emit() returns a non-zero value. Because in that case readdir() will be called again and if in the meanwhile new directory entries were added and we still can't put all the remaining entries in the buffer, we keep repeating this over and over.
The following C program and test script reproduce the problem:
$ cat /mnt/readdir_prog.c #include <sys/types.h> #include <dirent.h> #include <stdio.h>
int main(int argc, char *argv[])
{
DIR *dir = opendir(".");
struct dirent *dd; while ((dd = readdir(dir))) {
printf("%s\n", dd->d_name);
rename(dd->d_name, "TEMPFILE");
rename("TEMPFILE", dd->d_name);
}
closedir(dir);}
$ gcc -o /mnt/readdir_prog /mnt/readdir_prog.c
$ cat test.sh #!/bin/bash
DEV=/dev/sdi
MNT=/mnt/sdi
mkfs.btrfs -f $DEV &> /dev/null
#mkfs.xfs -f $DEV &> /dev/null
#mkfs.ext4 -F $DEV &> /dev/null
mount $DEV $MNT
mkdir $MNT/testdir
for ((i = 1; i <= 2000; i++)); do
echo -n > $MNT/testdir/file_$i
done
cd $MNT/testdir
/mnt/readdir_prog
cd /mnt
umount $MNT
This behaviour is surprising to applications and it's unlike ext4, xfs, tmpfs, vfat and other filesystems, which always finish. In this case where new entries were added due to renames, some file names may be reported more than once, but this varies according to each filesystem - for example ext4 never reported the same file more than once while xfs reports the first 13 file names twice.
So change our readdir implementation to track the last index number when opendir() is called and then make readdir() never process beyond that index number. This gives the same behaviour as ext4.
--- fs/btrfs/ctree.h | 1 fs/btrfs/delayed-inode.c | 5 + fs/btrfs/delayed-inode.h | 1 fs/btrfs/inode.c | 131 ++++++++++++++++++++++++++++------------------- 4 files changed, 84 insertions(+), 54 deletions(-)
fs/btrfs/ctree.h +1 -0
@@ -1361,6 +1361,7 @@ struct btrfs_drop_extents_args {struct btrfs_file_private {void *filldir_buf; +u64 last_index; };
fs/btrfs/delayed-inode.c +3 -2
@@ -1513,6 +1513,7 @@ int btrfs_inode_delayed_dir_index_count( }bool btrfs_readdir_get_delayed_items (struct inode *inode, +u64 last_index,struct list_head *ins_list,struct list_head *del_list) {
@@ -1532,14 +1533,14 @@ bool btrfs_readdir_get_delayed_items(strmutex_lock (&delayed_node->mutex); item =__btrfs_first_delayed_insertion_item (delayed_node); -while (item) { +while (item && item->key.offset <= last_index) {refcount_inc (&item->refs);list_add_tail (&item->readdir_list, ins_list); item =__btrfs_next_delayed_item (item); } item =__btrfs_first_delayed_deletion_item (delayed_node); -while (item) { +while (item && item->key.offset <= last_index) {refcount_inc (&item->refs);list_add_tail (&item->readdir_list, del_list); item =__btrfs_next_delayed_item (item);
fs/btrfs/delayed-inode.h +1 -0
@@ -123,6 +123,7 @@ void btrfs_destroy_delayed_inodes(struct/* Used for readdir() */ bool btrfs_readdir_get_delayed_items (struct inode *inode, +u64 last_index,struct list_head *ins_list,struct list_head *del_list); void btrfs_readdir_put_delayed_items(struct inode *inode,
fs/btrfs/inode.c +79 -52
165 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 73/476 btrfs: set last dir index to the current last index when opening dir
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 357950361cbc6d54fb68ed878265c647384684ae upstream.
When opening a directory for reading it, we set the last index where we stop iteration to the value in struct btrfs_inode::index_cnt. That value does not match the index of the most recently added directory entry but it's instead the index number that will be assigned the next directory entry.
This means that if after the call to opendir(3) new directory entries are added, a readdir(3) call will return the first new directory entry. This is fine because POSIX says the following [1]:
"If a file is removed from or added to the directory after the most
recent call to opendir() or rewinddir(), whether a subsequent call to readdir() returns an entry for that file is unspecified."
For example for the test script from commit 9b378f6ad48c ("btrfs: fix infinite directory reads"), where we have 2000 files in a directory, ext4 doesn't return any new directory entry after opendir(3), while xfs returns the first 13 new directory entries added after the opendir(3) call.
If we move to a shorter example with an empty directory when opendir(3) is called, and 2 files added to the directory after the opendir(3) call, then readdir(3) on btrfs will return the first file, ext4 and xfs return the 2 files (but in a different order). A test program for this, reported by Ian Johnson, is the following:
#include <dirent.h>
#include <stdio.h>
int main(void) {
DIR *dir = opendir("test"); FILE *file;
file = fopen("test/1", "w");
fwrite("1", 1, 1, file);
fclose(file);
file = fopen("test/2", "w");
fwrite("2", 1, 1, file);
fclose(file);
struct dirent *entry;
while ((entry = readdir(dir))) {
printf("%s\n", entry->d_name);
}
closedir(dir);
return 0;}
To make this less odd, change the behaviour to never return new entries that were added after the opendir(3) call. This is done by setting the last_index field of the struct btrfs_file_private attached to the directory's file handle with a value matching btrfs_inode::index_cnt minus 1, since that value always matches the index of the next new directory entry and not the index of the most recently added entry.
[1] https://pubs.opengroup.org/onlinepubs/007904875/functions/readdir_r.html
--- fs/btrfs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/inode.c +2 -1
@@ -6184,7 +6184,8 @@ static int btrfs_get_dir_last_index(stru } } - *index = dir->index_cnt; +/* index_cnt is the index number of next new entry, so decrement it. */ + *index = dir->index_cnt -1 ;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 74/476 btrfs: refresh dir last index during a rewinddir(3) call
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit e60aa5da14d01fed8411202dbe4adf6c44bd2a57 upstream.
When opening a directory we find what's the index of its last entry and then store it in the directory's file handle private data (struct btrfs_file_private::last_index), so that in the case new directory entries are added to a directory after an opendir(3) call we don't end up in an infinite loop (see commit 9b378f6ad48c ("btrfs: fix infinite directory reads")) when calling readdir(3).
However once rewinddir(3) is called, POSIX states [1] that any new directory entries added after the previous opendir(3) call, must be returned by subsequent calls to readdir(3):
"The rewinddir() function shall reset the position of the directory
stream to which dirp refers to the beginning of the directory. It shall also cause the directory stream to refer to the current state of the corresponding directory, as a call to opendir() would have done."
We currently don't refresh the last_index field of the struct btrfs_file_private associated to the directory, so after a rewinddir(3) we are not returning any new entries added after the opendir(3) call.
Fix this by finding the current last index of the directory when llseek is called against the directory.
This can be reproduced by the following C program provided by Ian Johnson:
#include <dirent.h>
#include <stdio.h>
int main(void) {
DIR *dir = opendir("test"); FILE *file;
file = fopen("test/1", "w");
fwrite("1", 1, 1, file);
fclose(file);
file = fopen("test/2", "w");
fwrite("2", 1, 1, file);
fclose(file);
rewinddir(dir);
struct dirent *entry;
while ((entry = readdir(dir))) {
printf("%s\n", entry->d_name);
}
closedir(dir);
return 0;}
--- fs/btrfs/inode.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
fs/btrfs/inode.c +14 -1
@@ -6222,6 +6222,19 @@ static int btrfs_opendir(struct inode *ireturn 0 ; } +static loff_t btrfs_dir_llseek (struct file *file,loff_t offset,int whence) +{ +struct btrfs_file_private *private = file->private_data; +int ret; + + ret =btrfs_get_dir_last_index (BTRFS_I (file_inode (file)), + &private->last_index); +if (ret) +return ret; + +return generic_file_llseek (file, offset, whence); +} +struct dir_entry {u64 ino;u64 offset;
@@ -11087,7 +11100,7 @@ static const struct inode_operations btr };static const struct file_operations btrfs_dir_file_operations = { - .llseek = generic_file_llseek, + .llseek = btrfs_dir_llseek, .read = generic_read_dir, .iterate_shared = btrfs_real_readdir, .open = btrfs_opendir,
Greg Kroah-Hartman
maintainerPATCH 75/476 btrfs: fix race between reading a directory and adding entries to it
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 8e7f82deb0c0386a03b62e30082574347f8b57d5 upstream.
When opening a directory (opendir(3)) or rewinding it (rewinddir(3)), we are not holding the directory's inode locked, and this can result in later attempting to add two entries to the directory with the same index number, resulting in a transaction abort, with -EEXIST (-17), when inserting the second delayed dir index. This results in a trace like the following:
Sep 11 22:34:59 myhostname kernel: BTRFS error (device dm-3): err add delayed dir index item(name: cockroach-stderr.log) into the insertion tree of the delayed node(root id: 5, inode id: 4539217, errno: -17) Sep 11 22:34:59 myhostname kernel: ------------[ cut here ]------------ Sep 11 22:34:59 myhostname kernel: kernel BUG at fs/btrfs/delayed-inode.c:1504! Sep 11 22:34:59 myhostname kernel: invalid opcode: 0000 [#1] PREEMPT SMP NOPTI Sep 11 22:34:59 myhostname kernel: CPU: 0 PID: 7159 Comm: cockroach Not tainted 6.4.15-200.fc38.x86_64 #1 Sep 11 22:34:59 myhostname kernel: Hardware name: ASUS ESC500 G3/P9D WS, BIOS 2402 06/27/2018 Sep 11 22:34:59 myhostname kernel: RIP: 0010:btrfs_insert_delayed_dir_index+0x1da/0x260 Sep 11 22:34:59 myhostname kernel: Code: eb dd 48 (...) Sep 11 22:34:59 myhostname kernel: RSP: 0000:ffffa9980e0fbb28 EFLAGS: 00010282 Sep 11 22:34:59 myhostname kernel: RAX: 0000000000000000 RBX: ffff8b10b8f4a3c0 RCX: 0000000000000000 Sep 11 22:34:59 myhostname kernel: RDX: 0000000000000000 RSI: ffff8b177ec21540 RDI: ffff8b177ec21540 Sep 11 22:34:59 myhostname kernel: RBP: ffff8b110cf80888 R08: 0000000000000000 R09: ffffa9980e0fb938 Sep 11 22:34:59 myhostname kernel: R10: 0000000000000003 R11: ffffffff86146508 R12: 0000000000000014 Sep 11 22:34:59 myhostname kernel: R13: ffff8b1131ae5b40 R14: ffff8b10b8f4a418 R15: 00000000ffffffef Sep 11 22:34:59 myhostname kernel: FS: 00007fb14a7fe6c0(0000) GS:ffff8b177ec00000(0000) knlGS:0000000000000000 Sep 11 22:34:59 myhostname kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 Sep 11 22:34:59 myhostname kernel: CR2: 000000c00143d000 CR3: 00000001b3b4e002 CR4: 00000000001706f0 Sep 11 22:34:59 myhostname kernel: Call Trace: Sep 11 22:34:59 myhostname kernel: <TASK> Sep 11 22:34:59 myhostname kernel: ? die+0x36/0x90 Sep 11 22:34:59 myhostname kernel: ? do_trap+0xda/0x100 Sep 11 22:34:59 myhostname kernel: ? btrfs_insert_delayed_dir_index+0x1da/0x260 Sep 11 22:34:59 myhostname kernel: ? do_error_trap+0x6a/0x90 Sep 11 22:34:59 myhostname kernel: ? btrfs_insert_delayed_dir_index+0x1da/0x260 Sep 11 22:34:59 myhostname kernel: ? exc_invalid_op+0x50/0x70 Sep 11 22:34:59 myhostname kernel: ? btrfs_insert_delayed_dir_index+0x1da/0x260 Sep 11 22:34:59 myhostname kernel: ? asm_exc_invalid_op+0x1a/0x20 Sep 11 22:34:59 myhostname kernel: ? btrfs_insert_delayed_dir_index+0x1da/0x260 Sep 11 22:34:59 myhostname kernel: ? btrfs_insert_delayed_dir_index+0x1da/0x260 Sep 11 22:34:59 myhostname kernel: btrfs_insert_dir_item+0x200/0x280 Sep 11 22:34:59 myhostname kernel: btrfs_add_link+0xab/0x4f0 Sep 11 22:34:59 myhostname kernel: ? ktime_get_real_ts64+0x47/0xe0 Sep 11 22:34:59 myhostname kernel: btrfs_create_new_inode+0x7cd/0xa80 Sep 11 22:34:59 myhostname kernel: btrfs_symlink+0x190/0x4d0 Sep 11 22:34:59 myhostname kernel: ? schedule+0x5e/0xd0 Sep 11 22:34:59 myhostname kernel: ? __d_lookup+0x7e/0xc0 Sep 11 22:34:59 myhostname kernel: vfs_symlink+0x148/0x1e0 Sep 11 22:34:59 myhostname kernel: do_symlinkat+0x130/0x140 Sep 11 22:34:59 myhostname kernel: __x64_sys_symlinkat+0x3d/0x50 Sep 11 22:34:59 myhostname kernel: do_syscall_64+0x5d/0x90 Sep 11 22:34:59 myhostname kernel: ? syscall_exit_to_user_mode+0x2b/0x40 Sep 11 22:34:59 myhostname kernel: ? do_syscall_64+0x6c/0x90 Sep 11 22:34:59 myhostname kernel: entry_SYSCALL_64_after_hwframe+0x72/0xdc
The race leading to the problem happens like this:
1) Directory inode X is loaded into memory, its ->index_cnt field is initialized to (u64)-1 (at btrfs_alloc_inode());
2) Task A is adding a new file to directory X, holding its vfs inode lock, and calls btrfs_set_inode_index() to get an index number for the entry.
Because the inode's index_cnt field is set to (u64)-1 it calls btrfs_inode_delayed_dir_index_count() which fails because no dir index entries were added yet to the delayed inode and then it calls btrfs_set_inode_index_count(). This functions finds the last dir index key and then sets index_cnt to that index value + 1. It found that the last index key has an offset of 100. However before it assigns a value of 101 to index_cnt...
3) Task B calls opendir(3), ending up at btrfs_opendir(), where the VFS lock for inode X is not taken, so it calls btrfs_get_dir_last_index() and sees index_cnt still with a value of (u64)-1. Because of that it calls btrfs_inode_delayed_dir_index_count() which fails since no dir index entries were added to the delayed inode yet, and then it also calls btrfs_set_inode_index_count(). This also finds that the last index key has an offset of 100, and before it assigns the value 101 to the index_cnt field of inode X...
4) Task A assigns a value of 101 to index_cnt. And then the code flow goes to btrfs_set_inode_index() where it increments index_cnt from 101 to 102. Task A then creates a delayed dir index entry with a sequence number of 101 and adds it to the delayed inode;
5) Task B assigns 101 to the index_cnt field of inode X;
6) At some later point when someone tries to add a new entry to the directory, btrfs_set_inode_index() will return 101 again and shortly after an attempt to add another delayed dir index key with index number 101 will fail with -EEXIST resulting in a transaction abort.
Fix this by locking the inode at btrfs_get_dir_last_index(), which is only only used when opening a directory or attempting to lseek on it.
--- fs/btrfs/inode.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
fs/btrfs/inode.c +7 -4
@@ -6173,21 +6173,24 @@ out:static int btrfs_get_dir_last_index (struct btrfs_inode *dir,u64 *index) { -if (dir->index_cnt == (u64)-1 ) { -int ret; +int ret =0 ; +btrfs_inode_lock (&dir->vfs_inode,0 ); +if (dir->index_cnt == (u64)-1 ) { ret =btrfs_inode_delayed_dir_index_count (dir);if (ret) { ret =btrfs_set_inode_index_count (dir);if (ret) -return ret; + goto out; } }/* index_cnt is the index number of next new entry, so decrement it. */ *index = dir->index_cnt -1 ; +out: +btrfs_inode_unlock (&dir->vfs_inode,0 ); -return 0 ; +return ret; }/*
Greg Kroah-Hartman
maintainerPATCH 76/476 btrfs: avoid copying BTRFS_ROOT_SUBVOL_DEAD flag to snapshot of subvolume being deleted
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Omar Sandoval <[email protected]>
commit 3324d0547861b16cf436d54abba7052e0c8aa9de upstream.
Sweet Tea spotted a race between subvolume deletion and snapshotting that can result in the root item for the snapshot having the BTRFS_ROOT_SUBVOL_DEAD flag set. The race is:
Thread 1 | Thread 2
----------------------------------------------|----------
btrfs_delete_subvolume |
btrfs_set_root_flags(BTRFS_ROOT_SUBVOL_DEAD)|
|btrfs_mksubvol
| down_read(subvol_sem)
| create_snapshot
| ...
| create_pending_snapshot
| copy root item from source
down_write(subvol_sem) |This flag is only checked in send and swap activate, which this would cause to fail mysteriously.
create_snapshot() now checks the root refs to reject a deleted subvolume, so we can fix this by locking subvol_sem earlier so that the BTRFS_ROOT_SUBVOL_DEAD flag and the root refs are updated atomically.
--- fs/btrfs/inode.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
fs/btrfs/inode.c +13 -9
@@ -4501,6 +4501,8 @@ int btrfs_delete_subvolume(struct inodeu64 root_flags;int ret; +down_write (&fs_info->subvol_sem); +/* * Don't allow to delete a subvolume with send in progress. This is * inside the inode lock so the error handling that has to drop the bit
@@ -4512,25 +4514,25 @@ int btrfs_delete_subvolume(struct inodebtrfs_warn (fs_info,"attempt to delete subvolume %llu during send" , dest->root_key.objectid); -return -EPERM ; + ret = -EPERM ; + goto out_up_write; }if (atomic_read (&dest->nr_swapfiles)) {spin_unlock (&dest->root_item_lock);btrfs_warn (fs_info,"attempt to delete subvolume %llu with active swapfile" , root->root_key.objectid); -return -EPERM ; + ret = -EPERM ; + goto out_up_write; } root_flags =btrfs_root_flags (&dest->root_item);btrfs_set_root_flags (&dest->root_item, root_flags |BTRFS_ROOT_SUBVOL_DEAD );spin_unlock (&dest->root_item_lock); -down_write (&fs_info->subvol_sem); - ret =may_destroy_subvol (dest);if (ret) - goto out_up_write; + goto out_undead;btrfs_init_block_rsv (&block_rsv,BTRFS_BLOCK_RSV_TEMP );/*
@@ -4540,7 +4542,7 @@ int btrfs_delete_subvolume(struct inode*/ ret =btrfs_subvolume_reserve_metadata (root, &block_rsv,5 , true);if (ret) - goto out_up_write; + goto out_undead; trans =btrfs_start_transaction (root,0 );if (IS_ERR (trans)) {
@@ -4606,15 +4608,17 @@ out_end_trans: inode->i_flags |=S_DEAD ; out_release:btrfs_subvolume_release_metadata (root, &block_rsv); -out_up_write: -up_write (&fs_info->subvol_sem); +out_undead:if (ret) {spin_lock (&dest->root_item_lock); root_flags =btrfs_root_flags (&dest->root_item);btrfs_set_root_flags (&dest->root_item, root_flags & ~BTRFS_ROOT_SUBVOL_DEAD );spin_unlock (&dest->root_item_lock); - }else { + } +out_up_write: +up_write (&fs_info->subvol_sem); +if (!ret) {d_invalidate (dentry);btrfs_prune_dentries (dest);ASSERT (dest->send_in_progress ==0 );
Greg Kroah-Hartman
maintainerPATCH 77/476 btrfs: ref-verify: free ref cache before clearing mount opt
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
commit f03e274a8b29d1d1c1bbd7f764766cb5ca537ab7 upstream.
As clearing REF_VERIFY mount option indicates there were some errors in a ref-verify process, a ref cache is not relevant anymore and should be freed.
btrfs_free_ref_cache() requires REF_VERIFY option being set so call it just before clearing the mount option.
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- fs/btrfs/ref-verify.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/btrfs/ref-verify.c +4 -2
@@ -883,8 +883,10 @@ int btrfs_ref_tree_mod(struct btrfs_fs_i out_unlock:spin_unlock (&fs_info->ref_verify_lock); out: -if (ret) +if (ret) { +btrfs_free_ref_cache (fs_info);btrfs_clear_opt (fs_info->mount_opt,REF_VERIFY ); + }return ret; }
@@ -1013,8 +1015,8 @@ int btrfs_build_ref_tree(struct btrfs_fs } }if (ret) { -btrfs_clear_opt (fs_info->mount_opt,REF_VERIFY );btrfs_free_ref_cache (fs_info); +btrfs_clear_opt (fs_info->mount_opt,REF_VERIFY ); }btrfs_free_path (path);return ret;
Greg Kroah-Hartman
maintainerPATCH 78/476 btrfs: tree-checker: fix inline ref size in error messages
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chung-Chiang Cheng <[email protected]>
commit f398e70dd69e6ceea71463a5380e6118f219197e upstream.
The error message should accurately reflect the size rather than the type.
--- fs/btrfs/tree-checker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/tree-checker.c +1 -1
@@ -1382,7 +1382,7 @@ static int check_extent_item(struct exteif (unlikely (ptr +btrfs_extent_inline_ref_size (inline_type) > end)) {extent_err (leaf, slot,"inline ref item overflows extent item, ptr %lu iref size %u end %lu" , - ptr, inline_type, end); + ptr,btrfs_extent_inline_ref_size (inline_type), end);return -EUCLEAN ; }
Greg Kroah-Hartman
maintainerPATCH 79/476 btrfs: dont warn if discard range is not aligned to sector
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Sterba <[email protected]>
commit a208b3f132b48e1f94f620024e66fea635925877 upstream.
There's a warning in btrfs_issue_discard() when the range is not aligned to 512 bytes, originally added in 4d89d377bbb0 ("btrfs:btrfs_issue_discard ensure offset/length are aligned to sector boundaries"). We can't do sub-sector writes anyway so the adjustment is the only thing that we can do and the warning is unnecessary.
--- fs/btrfs/extent-tree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/extent-tree.c +2 -1
@@ -1206,7 +1206,8 @@ static int btrfs_issue_discard(struct blu64 bytes_left, end;u64 aligned_start =ALIGN (start,1 <<9 ); -if (WARN_ON (start != aligned_start)) { +/* Adjust the range to be aligned to 512B sectors if necessary. */ +if (start != aligned_start) { len -= aligned_start - start; len =round_down (len,1 <<9 ); start = aligned_start;
Greg Kroah-Hartman
maintainerPATCH 80/476 btrfs: defrag: reject unknown flags of btrfs_ioctl_defrag_range_args
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
commit 173431b274a9a54fc10b273b46e67f46bcf62d2e upstream.
Add extra sanity check for btrfs_ioctl_defrag_range_args::flags.
This is not really to enhance fuzzing tests, but as a preparation for future expansion on btrfs_ioctl_defrag_range_args.
In the future we're going to add new members, allowing more fine tuning for btrfs defrag. Without the -ENONOTSUPP error, there would be no way to detect if the kernel supports those new defrag features.
--- fs/btrfs/ioctl.c | 4 ++++ include/uapi/linux/btrfs.h | 3 +++ 2 files changed, 7 insertions(+)
fs/btrfs/ioctl.c +4 -0
@@ -3183,6 +3183,10 @@ static int btrfs_ioctl_defrag(struct fil ret = -EFAULT ; goto out; } +if (range.flags & ~BTRFS_DEFRAG_RANGE_FLAGS_SUPP ) { + ret = -EOPNOTSUPP ; + goto out; + }/* compression requires us to start the IO */ if ((range.flags &BTRFS_DEFRAG_RANGE_COMPRESS )) { range.flags |=BTRFS_DEFRAG_RANGE_START_IO ;
include/uapi/linux/btrfs.h +3 -0
@@ -578,6 +578,9 @@ struct btrfs_ioctl_clone_range_args {*/ #define BTRFS_DEFRAG_RANGE_COMPRESS 1#define BTRFS_DEFRAG_RANGE_START_IO 2 +#define BTRFS_DEFRAG_RANGE_FLAGS_SUPP (BTRFS_DEFRAG_RANGE_COMPRESS | \ + BTRFS_DEFRAG_RANGE_START_IO) +struct btrfs_ioctl_defrag_range_args {/* start of the defrag operation */ __u64 start;
Greg Kroah-Hartman
maintainerPATCH 81/476 btrfs: dont abort filesystem when attempting to snapshot deleted subvolume
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Omar Sandoval <[email protected]>
commit 7081929ab2572920e94d70be3d332e5c9f97095a upstream.
If the source file descriptor to the snapshot ioctl refers to a deleted subvolume, we get the following abort:
BTRFS: Transaction aborted (error -2)
WARNING: CPU: 0 PID: 833 at fs/btrfs/transaction.c:1875 create_pending_snapshot+0x1040/0x1190 [btrfs] Modules linked in: pata_acpi btrfs ata_piix libata scsi_mod virtio_net blake2b_generic xor net_failover virtio_rng failover scsi_common rng_core raid6_pq libcrc32c CPU: 0 PID: 833 Comm: t_snapshot_dele Not tainted 6.7.0-rc6 #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-1.fc39 04/01/2014 RIP: 0010:create_pending_snapshot+0x1040/0x1190 [btrfs] RSP: 0018:ffffa09c01337af8 EFLAGS: 00010282 RAX: 0000000000000000 RBX: ffff9982053e7c78 RCX: 0000000000000027 RDX: ffff99827dc20848 RSI: 0000000000000001 RDI: ffff99827dc20840 RBP: ffffa09c01337c00 R08: 0000000000000000 R09: ffffa09c01337998 R10: 0000000000000003 R11: ffffffffb96da248 R12: fffffffffffffffe R13: ffff99820535bb28 R14: ffff99820b7bd000 R15: ffff99820381ea80 FS: 00007fe20aadabc0(0000) GS:ffff99827dc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000559a120b502f CR3: 00000000055b6000 CR4: 00000000000006f0 Call Trace: <TASK> ? create_pending_snapshot+0x1040/0x1190 [btrfs] ? __warn+0x81/0x130 ? create_pending_snapshot+0x1040/0x1190 [btrfs] ? report_bug+0x171/0x1a0 ? handle_bug+0x3a/0x70 ? exc_invalid_op+0x17/0x70 ? asm_exc_invalid_op+0x1a/0x20 ? create_pending_snapshot+0x1040/0x1190 [btrfs] ? create_pending_snapshot+0x1040/0x1190 [btrfs] create_pending_snapshots+0x92/0xc0 [btrfs] btrfs_commit_transaction+0x66b/0xf40 [btrfs] btrfs_mksubvol+0x301/0x4d0 [btrfs] btrfs_mksnapshot+0x80/0xb0 [btrfs] __btrfs_ioctl_snap_create+0x1c2/0x1d0 [btrfs] btrfs_ioctl_snap_create_v2+0xc4/0x150 [btrfs] btrfs_ioctl+0x8a6/0x2650 [btrfs] ? kmem_cache_free+0x22/0x340 ? do_sys_openat2+0x97/0xe0 __x64_sys_ioctl+0x97/0xd0 do_syscall_64+0x46/0xf0 entry_SYSCALL_64_after_hwframe+0x6e/0x76 RIP: 0033:0x7fe20abe83af RSP: 002b:00007ffe6eff1360 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 00007fe20abe83af RDX: 00007ffe6eff23c0 RSI: 0000000050009417 RDI: 0000000000000003 RBP: 0000000000000003 R08: 0000000000000000 R09: 00007fe20ad16cd0 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffe6eff13c0 R14: 00007fe20ad45000 R15: 0000559a120b6d58 </TASK> ---[ end trace 0000000000000000 ]--- BTRFS: error (device vdc: state A) in create_pending_snapshot:1875: errno=-2 No such entry BTRFS info (device vdc: state EA): forced readonly BTRFS warning (device vdc: state EA): Skipping commit of aborted transaction. BTRFS: error (device vdc: state EA) in cleanup_transaction:2055: errno=-2 No such entry
This happens because create_pending_snapshot() initializes the new root item as a copy of the source root item. This includes the refs field, which is 0 for a deleted subvolume. The call to btrfs_insert_root() therefore inserts a root with refs == 0. btrfs_get_new_fs_root() then finds the root and returns -ENOENT if refs == 0, which causes create_pending_snapshot() to abort.
Fix it by checking the source root's refs before attempting the snapshot, but after locking subvol_sem to avoid racing with deletion.
--- fs/btrfs/ioctl.c | 3 +++ 1 file changed, 3 insertions(+)
fs/btrfs/ioctl.c +3 -0
@@ -725,6 +725,9 @@ static int create_snapshot(struct btrfs_struct btrfs_trans_handle *trans;int ret; +if (btrfs_root_refs (&root->root_item) ==0 ) +return -ENOENT ; +if (!test_bit (BTRFS_ROOT_SHAREABLE , &root->state))return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 82/476 rbd: dont move requests to the running list on errors
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Dryomov <[email protected]>
commit ded080c86b3f99683774af0441a58fc2e3d60cae upstream.
The running list is supposed to contain requests that are pinning the exclusive lock, i.e. those that must be flushed before exclusive lock is released. When wake_lock_waiters() is called to handle an error, requests on the acquiring list are failed with that error and no flushing takes place. Briefly moving them to the running list is not only pointless but also harmful: if exclusive lock gets acquired before all of their state machines are scheduled and go through rbd_lock_del_request(), we trigger
rbd_assert(list_empty(&rbd_dev->running_list));
in rbd_try_acquire_lock().
--- drivers/block/rbd.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/block/rbd.c +14 -8
@@ -3454,14 +3454,15 @@ static bool rbd_lock_add_request(structstatic void rbd_lock_del_request (struct rbd_img_request *img_req) {struct rbd_device *rbd_dev = img_req->rbd_dev; -bool need_wakeup; +bool need_wakeup = false;lockdep_assert_held (&rbd_dev->lock_rwsem);spin_lock (&rbd_dev->lock_lists_lock); -rbd_assert (!list_empty (&img_req->lock_item)); -list_del_init (&img_req->lock_item); - need_wakeup = (rbd_dev->lock_state ==RBD_LOCK_STATE_RELEASING && -list_empty (&rbd_dev->running_list)); +if (!list_empty (&img_req->lock_item)) { +list_del_init (&img_req->lock_item); + need_wakeup = (rbd_dev->lock_state ==RBD_LOCK_STATE_RELEASING && +list_empty (&rbd_dev->running_list)); + }spin_unlock (&rbd_dev->lock_lists_lock);if (need_wakeup)complete (&rbd_dev->releasing_wait);
@@ -3844,14 +3845,19 @@ static void wake_lock_waiters(struct rbdreturn ; } -list_for_each_entry (img_req, &rbd_dev->acquiring_list, lock_item) { +while (!list_empty (&rbd_dev->acquiring_list)) { + img_req =list_first_entry (&rbd_dev->acquiring_list, + struct rbd_img_request, lock_item);mutex_lock (&img_req->state_mutex);rbd_assert (img_req->state ==RBD_IMG_EXCLUSIVE_LOCK ); +if (!result) +list_move_tail (&img_req->lock_item, + &rbd_dev->running_list); +else +list_del_init (&img_req->lock_item);rbd_img_schedule (img_req, result);mutex_unlock (&img_req->state_mutex); } - -list_splice_tail_init (&rbd_dev->acquiring_list, &rbd_dev->running_list); } static bool locker_equal(const struct ceph_locker *lhs,
Greg Kroah-Hartman
maintainerPATCH 83/476 exec: Fix error handling in begin_new_exec()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bernd Edlinger <[email protected]>
commit 84c39ec57d409e803a9bb6e4e85daf1243e0e80b upstream.
If get_unused_fd_flags() fails, the error handling is incomplete because bprm->cred is already set to NULL, and therefore free_bprm will not unlock the cred_guard_mutex. Note there are two error conditions which end up here, one before and one after bprm->cred is cleared.
--- fs/exec.c | 3 +++ 1 file changed, 3 insertions(+)
fs/exec.c +3 -0
@@ -1410,6 +1410,9 @@ int begin_new_exec(struct linux_binprm * out_unlock:up_write (&me->signal->exec_update_lock); +if (!bprm->cred) +mutex_unlock (&me->signal->cred_guard_mutex); + out:return retval; }
Greg Kroah-Hartman
maintainerPATCH 84/476 wifi: iwlwifi: fix a memory corruption
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
commit cf4a0d840ecc72fcf16198d5e9c505ab7d5a5e4d upstream.
iwl_fw_ini_trigger_tlv::data is a pointer to a __le32, which means that if we copy to iwl_fw_ini_trigger_tlv::data + offset while offset is in bytes, we'll write past the buffer.
--- drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c +1 -1
@@ -836,7 +836,7 @@ static int iwl_dbg_tlv_override_trig_nod node_trig = (void *)node_tlv->data; } -memcpy (node_trig->data + offset, trig->data, trig_data_len); +memcpy ((u8 *)node_trig->data + offset, trig->data, trig_data_len); node_tlv->length =cpu_to_le32 (size);if (policy &IWL_FW_INI_APPLY_POLICY_OVERRIDE_CFG ) {
Greg Kroah-Hartman
maintainerPATCH 85/476 hv_netvsc: Calculate correct ring size when PAGE_SIZE is not 4 Kbytes
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Kelley <[email protected]>
commit 6941f67ad37d5465b75b9ffc498fcf6897a3c00e upstream.
Current code in netvsc_drv_init() incorrectly assumes that PAGE_SIZE is 4 Kbytes, which is wrong on ARM64 with 16K or 64K page size. As a result, the default VMBus ring buffer size on ARM64 with 64K page size is 8 Mbytes instead of the expected 512 Kbytes. While this doesn't break anything, a typical VM with 8 vCPUs and 8 netvsc channels wastes 120 Mbytes (8 channels * 2 ring buffers/channel * 7.5 Mbytes/ring buffer).
Unfortunately, the module parameter specifying the ring buffer size is in units of 4 Kbyte pages. Ideally, it should be in units that are independent of PAGE_SIZE, but backwards compatibility prevents changing that now.
Fix this by having netvsc_drv_init() hardcode 4096 instead of using PAGE_SIZE when calculating the ring buffer size in bytes. Also use the VMBUS_RING_SIZE macro to ensure proper alignment when running with page size larger than 4K.
--- drivers/net/hyperv/netvsc_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/hyperv/netvsc_drv.c +2 -2
@@ -44,7 +44,7 @@static unsigned int ring_size__ro_after_init =128 ;module_param (ring_size, uint,0444 ); -MODULE_PARM_DESC (ring_size,"Ring buffer size (# of pages)" ); +MODULE_PARM_DESC (ring_size,"Ring buffer size (# of 4K pages)" );unsigned int netvsc_ring_bytes__ro_after_init ; static const u32 default_msg = NETIF_MSG_DRV | NETIF_MSG_PROBE |
@@ -2824,7 +2824,7 @@ static int __init netvsc_drv_init(void)pr_info ("Increased ring_size to %u (min allowed)\n" , ring_size); } - netvsc_ring_bytes = ring_size *PAGE_SIZE ; + netvsc_ring_bytes =VMBUS_RING_SIZE (ring_size *4096 );register_netdevice_notifier (&netvsc_netdev_notifier);
Greg Kroah-Hartman
maintainerPATCH 86/476 netfilter: nft_chain_filter: handle NETDEV_UNREGISTER for inet/ingress basechain
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
commit 01acb2e8666a6529697141a6017edbf206921913 upstream.
Remove netdevice from inet/ingress basechain in case NETDEV_UNREGISTER event is reported, otherwise a stale reference to netdevice remains in the hook list.
--- net/netfilter/nft_chain_filter.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
net/netfilter/nft_chain_filter.c +9 -2
@@ -355,9 +355,10 @@ static int nf_tables_netdev_event(struct unsigned long event, void *ptr) { struct net_device *dev = netdev_notifier_info_to_dev(ptr); +struct nft_base_chain *basechain;struct nftables_pernet *nft_net; -struct nft_table *table;struct nft_chain *chain, *nr; +struct nft_table *table;struct nft_ctx ctx = { .net =dev_net (dev), };
@@ -369,7 +370,8 @@ static int nf_tables_netdev_event(struct nft_net =nft_pernet (ctx.net);mutex_lock (&nft_net->commit_mutex);list_for_each_entry (table, &nft_net->tables, list) { -if (table->family !=NFPROTO_NETDEV ) +if (table->family !=NFPROTO_NETDEV && + table->family !=NFPROTO_INET )continue ; ctx.family = table->family;
@@ -378,6 +380,11 @@ static int nf_tables_netdev_event(structif (!nft_is_base_chain (chain))continue ; + basechain =nft_base_chain (chain); +if (table->family ==NFPROTO_INET && + basechain->ops.hooknum !=NF_INET_INGRESS ) +continue ; + ctx.chain = chain;nft_netdev_event (event, dev, &ctx); }
Greg Kroah-Hartman
maintainerPATCH 87/476 netfilter: nf_tables: reject QUEUE/DROP verdict parameters
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
commit f342de4e2f33e0e39165d8639387aa6c19dff660 upstream.
This reverts commit e0abdadcc6e1.
core.c:nf_hook_slow assumes that the upper 16 bits of NF_DROP verdicts contain a valid errno, i.e. -EPERM, -EHOSTUNREACH or similar, or 0.
Due to the reverted commit, its possible to provide a positive value, e.g. NF_ACCEPT (1), which results in use-after-free.
Its not clear to me why this commit was made.
NF_QUEUE is not used by nftables; "queue" rules in nftables will result in use of "nft_queue" expression.
If we later need to allow specifiying errno values from userspace (do not know why), this has to call NF_DROP_GETERR and check that "err <= 0" holds true.
--- net/netfilter/nf_tables_api.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
net/netfilter/nf_tables_api.c +6 -10
@@ -10251,16 +10251,10 @@ static int nft_verdict_init(const struct data->verdict.code =ntohl (nla_get_be32 (tb[NFTA_VERDICT_CODE ]));switch (data->verdict.code) { -default : -switch (data->verdict.code &NF_VERDICT_MASK ) { -case NF_ACCEPT : -case NF_DROP : -case NF_QUEUE : -break ; -default : -return -EINVAL ; - } - fallthrough; +case NF_ACCEPT : +case NF_DROP : +case NF_QUEUE : +break ;case NFT_CONTINUE :case NFT_BREAK :case NFT_RETURN :
@@ -10295,6 +10289,8 @@ static int nft_verdict_init(const struct data->verdict.chain = chain;break ; +default : +return -EINVAL ; } desc->len =sizeof (data->verdict);
Greg Kroah-Hartman
maintainerPATCH 88/476 firmware: arm_scmi: Check mailbox/SMT channel for consistency
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cristian Marussi <[email protected]>
commit 437a310b22244d4e0b78665c3042e5d1c0f45306 upstream.
On reception of a completion interrupt the shared memory area is accessed to retrieve the message header at first and then, if the message sequence number identifies a transaction which is still pending, the related payload is fetched too.
When an SCMI command times out the channel ownership remains with the platform until eventually a late reply is received and, as a consequence, any further transmission attempt remains pending, waiting for the channel to be relinquished by the platform.
Once that late reply is received the channel ownership is given back to the agent and any pending request is then allowed to proceed and overwrite the SMT area of the just delivered late reply; then the wait for the reply to the new request starts.
It has been observed that the spurious IRQ related to the late reply can be wrongly associated with the freshly enqueued request: when that happens the SCMI stack in-flight lookup procedure is fooled by the fact that the message header now present in the SMT area is related to the new pending transaction, even though the real reply has still to arrive.
This race-condition on the A2P channel can be detected by looking at the channel status bits: a genuine reply from the platform will have set the channel free bit before triggering the completion IRQ.
Add a consistency check to validate such condition in the A2P ISR.
--- drivers/firmware/arm_scmi/common.h | 1 + drivers/firmware/arm_scmi/mailbox.c | 14 ++++++++++++++ drivers/firmware/arm_scmi/shmem.c | 6 ++++++ 3 files changed, 21 insertions(+)
drivers/firmware/arm_scmi/common.h +1 -0
@@ -439,6 +439,7 @@ void shmem_fetch_notification(struct scmvoid shmem_clear_channel (struct scmi_shared_mem __iomem *shmem);bool shmem_poll_done (struct scmi_shared_mem __iomem *shmem,struct scmi_xfer *xfer); +bool shmem_channel_free (struct scmi_shared_mem __iomem *shmem);/* declarations for message passing transports */ struct scmi_msg_payld ;
drivers/firmware/arm_scmi/mailbox.c +14 -0
@@ -43,6 +43,20 @@ static void rx_callback(struct mbox_clie {struct scmi_mailbox *smbox =client_to_scmi_mailbox (cl); +/* +* An A2P IRQ is NOT valid when received while the platform still has +* the ownership of the channel, because the platform at first releases +* the SMT channel and then sends the completion interrupt. +* +* This addresses a possible race condition in which a spurious IRQ from +* a previous timed-out reply which arrived late could be wrongly +* associated with the next pending transaction. +*/ +if (cl->knows_txdone && !shmem_channel_free (smbox->shmem)) { +dev_warn (smbox->cinfo->dev,"Ignoring spurious A2P IRQ !\n" ); +return ; + } +scmi_rx_callback (smbox->cinfo,shmem_read_header (smbox->shmem),NULL ); }
drivers/firmware/arm_scmi/shmem.c +6 -0
@@ -99,3 +99,9 @@ bool shmem_poll_done(struct scmi_shared_ (SCMI_SHMEM_CHAN_STAT_CHANNEL_ERROR |SCMI_SHMEM_CHAN_STAT_CHANNEL_FREE ); } + +bool shmem_channel_free (struct scmi_shared_mem __iomem *shmem) +{ +return (ioread32 (&shmem->channel_status) & +SCMI_SHMEM_CHAN_STAT_CHANNEL_FREE ); +}
Greg Kroah-Hartman
maintainerPATCH 89/476 xfs: read only mounts with fsopen mount API are busted
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Chinner <[email protected]>
commit d8d222e09dab84a17bb65dda4b94d01c565f5327 upstream.
Recently xfs/513 started failing on my test machines testing "-o ro,norecovery" mount options. This was being emitted in dmesg:
[ 9906.932724] XFS (pmem0): no-recovery mounts must be read-only.
Turns out, readonly mounts with the fsopen()/fsconfig() mount API have been busted since day zero. It's only taken 5 years for debian unstable to start using this "new" mount API, and shortly after this I noticed xfs/513 had started to fail as per above.
The syscall trace is:
fsopen("xfs", FSOPEN_CLOEXEC) = 3mount_setattr(-1, NULL, 0, NULL, 0) = -1 EINVAL (Invalid argument)
.....fsconfig(3, FSCONFIG_SET_STRING, "source", "/dev/pmem0", 0) = 0 fsconfig(3, FSCONFIG_SET_FLAG, "ro", NULL, 0) = 0fsconfig(3, FSCONFIG_SET_FLAG, "norecovery", NULL, 0) = 0 fsconfig(3, FSCONFIG_CMD_CREATE, NULL, NULL, 0) = -1 EINVAL (Invalid argument)
close(3) = 0
Showing that the actual mount instantiation (FSCONFIG_CMD_CREATE) is what threw out the error.
During mount instantiation, we call xfs_fs_validate_params() which does:
/* No recovery flag requires a read-only mount */
if (xfs_has_norecovery(mp) && !xfs_is_readonly(mp)) {
xfs_warn(mp, "no-recovery mounts must be read-only.");
return -EINVAL;
}and xfs_is_readonly() checks internal mount flags for read only state. This state is set in xfs_init_fs_context() from the context superblock flag state:
/*
* Copy binary VFS mount flags we are interested in.
*/
if (fc->sb_flags & SB_RDONLY)
set_bit(XFS_OPSTATE_READONLY, &mp->m_opstate);With the old mount API, all of the VFS specific superblock flags had already been parsed and set before xfs_init_fs_context() is called, so this all works fine.
However, in the brave new fsopen/fsconfig world, xfs_init_fs_context() is called from fsopen() context, before any VFS superblock have been set or parsed. Hence if we use fsopen(), the internal XFS readonly state is *never set*. Hence anything that depends on xfs_is_readonly() actually returning true for read only mounts is broken if fsopen() has been used to mount the filesystem.
Fix this by moving this internal state initialisation to xfs_fs_fill_super() before we attempt to validate the parameters that have been set prior to the FSCONFIG_CMD_CREATE call being made.
--- fs/xfs/xfs_super.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-)
fs/xfs/xfs_super.c +17 -10
@@ -1436,6 +1436,18 @@ xfs_fs_fill_super( mp->m_super = sb; +/* +* Copy VFS mount flags from the context now that all parameter parsing +* is guaranteed to have been completed by either the old mount API or +* the newer fsopen/fsconfig API. +*/ +if (fc->sb_flags &SB_RDONLY ) +set_bit (XFS_OPSTATE_READONLY , &mp->m_opstate); +if (fc->sb_flags &SB_DIRSYNC ) + mp->m_features |=XFS_FEAT_DIRSYNC ; +if (fc->sb_flags &SB_SYNCHRONOUS ) + mp->m_features |=XFS_FEAT_WSYNC ; + error =xfs_fs_validate_params (mp);if (error) goto out_free_names;
@@ -1910,6 +1922,11 @@ static const struct fs_context_operation .free = xfs_fs_free, }; +/* +* WARNING: do not initialise any parameters in this function that depend on +* mount option parsing having already been performed as this can be called from +* fsopen() before any parameters have been set. +*/ static int xfs_init_fs_context (struct fs_context *fc) {
@@ -1942,16 +1959,6 @@ static int xfs_init_fs_context( mp->m_logbsize =-1 ; mp->m_allocsize_log =16 ;/* 64k */ -/* -* Copy binary VFS mount flags we are interested in. -*/ -if (fc->sb_flags &SB_RDONLY ) -set_bit (XFS_OPSTATE_READONLY , &mp->m_opstate); -if (fc->sb_flags &SB_DIRSYNC ) - mp->m_features |=XFS_FEAT_DIRSYNC ; -if (fc->sb_flags &SB_SYNCHRONOUS ) - mp->m_features |=XFS_FEAT_WSYNC ; - fc->s_fs_info = mp; fc->ops = &xfs_context_ops;
Greg Kroah-Hartman
maintainerPATCH 90/476 gpiolib: acpi: Ignore touchpad wakeup on GPD G1619-04
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
commit 805c74eac8cb306dc69b87b6b066ab4da77ceaf1 upstream.
Spurious wakeups are reported on the GPD G1619-04 which can be absolved by programming the GPIO to ignore wakeups.
--- drivers/gpio/gpiolib-acpi.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/gpio/gpiolib-acpi.c +14 -0
@@ -1572,6 +1572,20 @@ static const struct dmi_system_id gpioli .ignore_wake = "INT33FF:01@0", }, }, + { + /* + * Spurious wakeups from TP_ATTN# pin + * Found in BIOS 0.35 + * https://gitlab.freedesktop.org/drm/amd/-/issues/3073 + */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "GPD"), + DMI_MATCH(DMI_PRODUCT_NAME, "G1619-04"), + }, + .driver_data = &(struct acpi_gpiolib_dmi_quirk) { + .ignore_wake = "PNP0C50:00@8", + }, + }, {} /* Terminating entry */ };
Greg Kroah-Hartman
maintainerPATCH 91/476 drm: Dont unref the same fb many times by mistake due to deadlock handling
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ville Syrjälä <[email protected]>
commit cb4daf271302d71a6b9a7c01bd0b6d76febd8f0c upstream.
If we get a deadlock after the fb lookup in drm_mode_page_flip_ioctl() we proceed to unref the fb and then retry the whole thing from the top. But we forget to reset the fb pointer back to NULL, and so if we then get another error during the retry, before the fb lookup, we proceed the unref the same fb again without having gotten another reference. The end result is that the fb will (eventually) end up being freed while it's still in use.
Reset fb to NULL once we've unreffed it to avoid doing it again until we've done another fb lookup.
This turned out to be pretty easy to hit on a DG2 when doing async flips (and CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y). The first symptom I saw that drm_closefb() simply got stuck in a busy loop while walking the framebuffer list. Fortunately I was able to convince it to oops instead, and from there it was easier to track down the culprit.
--- drivers/gpu/drm/drm_plane.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/drm_plane.c +1 -0
@@ -1378,6 +1378,7 @@ retry: out:if (fb)drm_framebuffer_put (fb); + fb =NULL ;if (plane->old_fb)drm_framebuffer_put (plane->old_fb); plane->old_fb =NULL ;
Greg Kroah-Hartman
maintainerPATCH 92/476 drm/bridge: nxp-ptn3460: fix i2c_master_send() error checking
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 914437992876838662c968cb416f832110fb1093 upstream.
The i2c_master_send/recv() functions return negative error codes or the number of bytes that were able to be sent/received. This code has two problems. 1) Instead of checking if all the bytes were sent or received, it checks that at least one byte was sent or received.
2) If there was a partial send/receive then we should return a negative error code but this code returns success.
--- drivers/gpu/drm/bridge/nxp-ptn3460.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/bridge/nxp-ptn3460.c +5 -5
@@ -56,13 +56,13 @@ static int ptn3460_read_bytes(struct ptn ret =i2c_master_send (ptn_bridge->client, &addr,1 );if (ret <=0 ) {DRM_ERROR ("Failed to send i2c command, ret=%d\n" , ret); -return ret; +return ret ?: -EIO ; } ret =i2c_master_recv (ptn_bridge->client, buf, len); -if (ret <=0 ) { +if (ret != len) {DRM_ERROR ("Failed to recv i2c data, ret=%d\n" , ret); -return ret; +return ret <0 ? ret : -EIO ; }return 0 ;
@@ -78,9 +78,9 @@ static int ptn3460_write_byte(struct ptn buf[1 ] = val; ret =i2c_master_send (ptn_bridge->client, buf,ARRAY_SIZE (buf)); -if (ret <=0 ) { +if (ret !=ARRAY_SIZE (buf)) {DRM_ERROR ("Failed to send i2c command, ret=%d\n" , ret); -return ret; +return ret <0 ? ret : -EIO ; }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 93/476 drm/tidss: Fix atomic_flush check
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomi Valkeinen <[email protected]>
commit 95d4b471953411854f9c80b568da7fcf753f3801 upstream.
tidss_crtc_atomic_flush() checks if the crtc is enabled, and if not, returns immediately as there's no reason to do any register changes.
However, the code checks for 'crtc->state->enable', which does not reflect the actual HW state. We should instead look at the 'crtc->state->active' flag.
This causes the tidss_crtc_atomic_flush() to proceed with the flush even if the active state is false, which then causes us to hit the WARN_ON(!crtc->state->event) check.
Fix this by checking the active flag, and while at it, fix the related debug print which had "active" and "needs modeset" wrong way.
--- drivers/gpu/drm/tidss/tidss_crtc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/tidss/tidss_crtc.c +5 -5
@@ -172,13 +172,13 @@ static void tidss_crtc_atomic_flush(strustruct tidss_device *tidss =to_tidss (ddev);unsigned long flags; -dev_dbg (ddev->dev, -"%s: %s enabled %d, needs modeset %d, event %p\n" , __func__, - crtc->name,drm_atomic_crtc_needs_modeset (crtc->state), - crtc->state->enable, crtc->state->event); +dev_dbg (ddev->dev,"%s: %s is %sactive, %s modeset, event %p\n" , + __func__, crtc->name, crtc->state->active ?"" :"not " , +drm_atomic_crtc_needs_modeset (crtc->state) ?"needs" :"doesn't need" , + crtc->state->event);/* There is nothing to do if CRTC is not going to be enabled. */ -if (!crtc->state->enable) +if (!crtc->state->active)return ;/*
Greg Kroah-Hartman
maintainerPATCH 94/476 drm/bridge: nxp-ptn3460: simplify some error checking
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 28d3d0696688154cc04983f343011d07bf0508e4 upstream.
The i2c_master_send/recv() functions return negative error codes or they return "len" on success. So the error handling here can be written as just normal checks for "if (ret < 0) return ret;". No need to complicate things.
Btw, in this code the "len" parameter can never be zero, but even if it were, then I feel like this would still be the best way to write it.
--- drivers/gpu/drm/bridge/nxp-ptn3460.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/bridge/nxp-ptn3460.c +6 -6
@@ -54,15 +54,15 @@ static int ptn3460_read_bytes(struct ptnint ret; ret =i2c_master_send (ptn_bridge->client, &addr,1 ); -if (ret <=0 ) { +if (ret <0 ) {DRM_ERROR ("Failed to send i2c command, ret=%d\n" , ret); -return ret ?: -EIO ; +return ret; } ret =i2c_master_recv (ptn_bridge->client, buf, len); -if (ret != len) { +if (ret <0 ) {DRM_ERROR ("Failed to recv i2c data, ret=%d\n" , ret); -return ret <0 ? ret : -EIO ; +return ret; }return 0 ;
@@ -78,9 +78,9 @@ static int ptn3460_write_byte(struct ptn buf[1 ] = val; ret =i2c_master_send (ptn_bridge->client, buf,ARRAY_SIZE (buf)); -if (ret !=ARRAY_SIZE (buf)) { +if (ret <0 ) {DRM_ERROR ("Failed to send i2c command, ret=%d\n" , ret); -return ret <0 ? ret : -EIO ; +return ret; }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 95/476 PM: core: Remove unnecessary (void *) conversions
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li zeming <[email protected]>
[ Upstream commit 73d73f5ee7fb0c42ff87091d105bee720a9565f1 ]
Assignments from pointer variables of type (void *) do not require explicit type casts, so remove such type cases from the code in drivers/base/power/main.c where applicable.
Stable-dep-of: 7839d0078e0d ("PM: sleep: Fix possible deadlocks in core system-wide PM code")
--- drivers/base/power/main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/base/power/main.c +6 -6
@@ -680,7 +680,7 @@ static bool dpm_async_fn(struct device *dev, async_func_t func)static void async_resume_noirq (void *data,async_cookie_t cookie) { -struct device *dev = (struct device *)data; +struct device *dev = data;int error; error =device_resume_noirq (dev, pm_transition, true);
@@ -819,7 +819,7 @@ static int device_resume_early(struct device *dev, pm_message_t state, bool asynstatic void async_resume_early (void *data,async_cookie_t cookie) { -struct device *dev = (struct device *)data; +struct device *dev = data;int error; error =device_resume_early (dev, pm_transition, true);
@@ -983,7 +983,7 @@ static int device_resume(struct device *dev, pm_message_t state, bool async)static void async_resume (void *data,async_cookie_t cookie) { -struct device *dev = (struct device *)data; +struct device *dev = data;int error; error =device_resume (dev, pm_transition, true);
@@ -1272,7 +1272,7 @@ static int __device_suspend_noirq(struct device *dev, pm_message_t state, bool astatic void async_suspend_noirq (void *data,async_cookie_t cookie) { -struct device *dev = (struct device *)data; +struct device *dev = data;int error; error =__device_suspend_noirq (dev, pm_transition, true);
@@ -1455,7 +1455,7 @@ static int __device_suspend_late(struct device *dev, pm_message_t state, bool asstatic void async_suspend_late (void *data,async_cookie_t cookie) { -struct device *dev = (struct device *)data; +struct device *dev = data;int error; error =__device_suspend_late (dev, pm_transition, true);
@@ -1731,7 +1731,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)static void async_suspend (void *data,async_cookie_t cookie) { -struct device *dev = (struct device *)data; +struct device *dev = data;int error; error =__device_suspend (dev, pm_transition, true);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 96/476 PM: sleep: Fix possible deadlocks in core system-wide PM code
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
[ Upstream commit 7839d0078e0d5e6cc2fa0b0dfbee71de74f1e557 ]
It is reported that in low-memory situations the system-wide resume core code deadlocks, because async_schedule_dev() executes its argument function synchronously if it cannot allocate memory (and not only in that case) and that function attempts to acquire a mutex that is already held. Executing the argument function synchronously from within dpm_async_fn() may also be problematic for ordering reasons (it may cause a consumer device's resume callback to be invoked before a requisite supplier device's one, for example).
Address this by changing the code in question to use async_schedule_dev_nocall() for scheduling the asynchronous execution of device suspend and resume functions and to directly run them synchronously if async_schedule_dev_nocall() returns false.
--- drivers/base/power/main.c | 148 ++++++++++++++++++-------------------- 1 file changed, 68 insertions(+), 80 deletions(-)
drivers/base/power/main.c +68 -80
@@ -580,7 +580,7 @@ bool dev_pm_skip_resume(struct device *dev) }/** -* device_resume_noirq - Execute a "noirq resume" callback for given device. +* __device_resume_noirq - Execute a "noirq resume" callback for given device. * @dev: Device to handle. * @state: PM transition of the system being carried out. * @async: If true, the device is being resumed asynchronously.
@@ -588,7 +588,7 @@ bool dev_pm_skip_resume(struct device *dev)* The driver of @dev will not receive interrupts while this function is being * executed. */ -static int device_resume_noirq (struct device *dev,pm_message_t state,bool async) +static void __device_resume_noirq (struct device *dev,pm_message_t state,bool async) {pm_callback_t callback =NULL ;const char *info =NULL ;
@@ -656,7 +656,13 @@ static int device_resume_noirq(struct device *dev, pm_message_t state, bool asyn Out:complete_all (&dev->power.completion);TRACE_RESUME (error); -return error; + +if (error) { + suspend_stats.failed_resume_noirq++; +dpm_save_failed_step (SUSPEND_RESUME_NOIRQ ); +dpm_save_failed_dev (dev_name (dev)); +pm_dev_err (dev, state, async ?" async noirq" :" noirq" , error); + } }static bool is_async (struct device *dev)
@@ -669,11 +675,15 @@ static bool dpm_async_fn(struct device *dev, async_func_t func) {reinit_completion (&dev->power.completion); -if (is_async (dev)) { -get_device (dev); -async_schedule_dev (func, dev); +if (!is_async (dev)) +return false; + +get_device (dev); + +if (async_schedule_dev_nocall (func, dev))return true; - } + +put_device (dev);return false; }
@@ -681,15 +691,19 @@ static bool dpm_async_fn(struct device *dev, async_func_t func)static void async_resume_noirq (void *data,async_cookie_t cookie) {struct device *dev = data; -int error; - - error =device_resume_noirq (dev, pm_transition, true); -if (error) -pm_dev_err (dev, pm_transition," async" , error); +__device_resume_noirq (dev, pm_transition, true);put_device (dev); } +static void device_resume_noirq (struct device *dev) +{ +if (dpm_async_fn (dev, async_resume_noirq)) +return ; + +__device_resume_noirq (dev, pm_transition, false); +} +static void dpm_noirq_resume_devices (pm_message_t state) {struct device *dev;
@@ -699,14 +713,6 @@ static void dpm_noirq_resume_devices(pm_message_t state)mutex_lock (&dpm_list_mtx); pm_transition = state; -/* -* Advanced the async threads upfront, -* in case the starting of async threads is -* delayed by non-async resuming devices. -*/ -list_for_each_entry (dev, &dpm_noirq_list, power.entry) -dpm_async_fn (dev, async_resume_noirq); -while (!list_empty (&dpm_noirq_list)) { dev =to_device (dpm_noirq_list.next);get_device (dev);
@@ -714,17 +720,7 @@ static void dpm_noirq_resume_devices(pm_message_t state)mutex_unlock (&dpm_list_mtx); -if (!is_async (dev)) { -int error; - - error =device_resume_noirq (dev, state, false); -if (error) { - suspend_stats.failed_resume_noirq++; -dpm_save_failed_step (SUSPEND_RESUME_NOIRQ ); -dpm_save_failed_dev (dev_name (dev)); -pm_dev_err (dev, state," noirq" , error); - } - } +device_resume_noirq (dev);put_device (dev);
@@ -754,14 +750,14 @@ void dpm_resume_noirq(pm_message_t state) }/** -* device_resume_early - Execute an "early resume" callback for given device. +* __device_resume_early - Execute an "early resume" callback for given device. * @dev: Device to handle. * @state: PM transition of the system being carried out. * @async: If true, the device is being resumed asynchronously. * * Runtime PM is disabled for @dev while this function is being executed. */ -static int device_resume_early (struct device *dev,pm_message_t state,bool async) +static void __device_resume_early (struct device *dev,pm_message_t state,bool async) {pm_callback_t callback =NULL ;const char *info =NULL ;
@@ -814,21 +810,31 @@ static int device_resume_early(struct device *dev, pm_message_t state, bool asynpm_runtime_enable (dev);complete_all (&dev->power.completion); -return error; + +if (error) { + suspend_stats.failed_resume_early++; +dpm_save_failed_step (SUSPEND_RESUME_EARLY ); +dpm_save_failed_dev (dev_name (dev)); +pm_dev_err (dev, state, async ?" async early" :" early" , error); + } }static void async_resume_early (void *data,async_cookie_t cookie) {struct device *dev = data; -int error; - - error =device_resume_early (dev, pm_transition, true); -if (error) -pm_dev_err (dev, pm_transition," async" , error); +__device_resume_early (dev, pm_transition, true);put_device (dev); } +static void device_resume_early (struct device *dev) +{ +if (dpm_async_fn (dev, async_resume_early)) +return ; + +__device_resume_early (dev, pm_transition, false); +} +/** * dpm_resume_early - Execute "early resume" callbacks for all devices. * @state: PM transition of the system being carried out.
@@ -842,14 +848,6 @@ void dpm_resume_early(pm_message_t state)mutex_lock (&dpm_list_mtx); pm_transition = state; -/* -* Advanced the async threads upfront, -* in case the starting of async threads is -* delayed by non-async resuming devices. -*/ -list_for_each_entry (dev, &dpm_late_early_list, power.entry) -dpm_async_fn (dev, async_resume_early); -while (!list_empty (&dpm_late_early_list)) { dev =to_device (dpm_late_early_list.next);get_device (dev);
@@ -857,17 +855,7 @@ void dpm_resume_early(pm_message_t state)mutex_unlock (&dpm_list_mtx); -if (!is_async (dev)) { -int error; - - error =device_resume_early (dev, state, false); -if (error) { - suspend_stats.failed_resume_early++; -dpm_save_failed_step (SUSPEND_RESUME_EARLY ); -dpm_save_failed_dev (dev_name (dev)); -pm_dev_err (dev, state," early" , error); - } - } +device_resume_early (dev);put_device (dev);
@@ -891,12 +879,12 @@ void dpm_resume_start(pm_message_t state)EXPORT_SYMBOL_GPL (dpm_resume_start);/** -* device_resume - Execute "resume" callbacks for given device. +* __device_resume - Execute "resume" callbacks for given device. * @dev: Device to handle. * @state: PM transition of the system being carried out. * @async: If true, the device is being resumed asynchronously. */ -static int device_resume (struct device *dev,pm_message_t state,bool async) +static void __device_resume (struct device *dev,pm_message_t state,bool async) {pm_callback_t callback =NULL ;const char *info =NULL ;
@@ -978,20 +966,30 @@ static int device_resume(struct device *dev, pm_message_t state, bool async)TRACE_RESUME (error); -return error; +if (error) { + suspend_stats.failed_resume++; +dpm_save_failed_step (SUSPEND_RESUME ); +dpm_save_failed_dev (dev_name (dev)); +pm_dev_err (dev, state, async ?" async" :"" , error); + } }static void async_resume (void *data,async_cookie_t cookie) {struct device *dev = data; -int error; - error =device_resume (dev, pm_transition, true); -if (error) -pm_dev_err (dev, pm_transition," async" , error); +__device_resume (dev, pm_transition, true);put_device (dev); } +static void device_resume (struct device *dev) +{ +if (dpm_async_fn (dev, async_resume)) +return ; + +__device_resume (dev, pm_transition, false); +} +/** * dpm_resume - Execute "resume" callbacks for non-sysdev devices. * @state: PM transition of the system being carried out.
@@ -1011,27 +1009,17 @@ void dpm_resume(pm_message_t state) pm_transition = state; async_error =0 ; -list_for_each_entry (dev, &dpm_suspended_list, power.entry) -dpm_async_fn (dev, async_resume); -while (!list_empty (&dpm_suspended_list)) { dev =to_device (dpm_suspended_list.next); +get_device (dev); -if (!is_async (dev)) { -int error; -mutex_unlock (&dpm_list_mtx); +mutex_unlock (&dpm_list_mtx); + +device_resume (dev); - error =device_resume (dev, state, false); -if (error) { - suspend_stats.failed_resume++; -dpm_save_failed_step (SUSPEND_RESUME ); -dpm_save_failed_dev (dev_name (dev)); -pm_dev_err (dev, state,"" , error); - } +mutex_lock (&dpm_list_mtx); -mutex_lock (&dpm_list_mtx); - }if (!list_empty (&dev->power.entry))list_move_tail (&dev->power.entry, &dpm_prepared_list);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 97/476 bus: mhi: host: Rename "struct mhi_tre" to "struct mhi_ring_element"
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 84f5f31f110e5e8cd5581e8efdbf8c369e962eb9 ]
Structure "struct mhi_tre" is representing a generic MHI ring element and not specifically a Transfer Ring Element (TRE). Fix the naming.
Stable-dep-of: eff9704f5332 ("bus: mhi: host: Add alignment check for event ring read pointer")
--- drivers/bus/mhi/host/init.c | 6 +++--- drivers/bus/mhi/host/internal.h | 2 +- drivers/bus/mhi/host/main.c | 20 ++++++++++---------- 3 files changed, 14 insertions(+), 14 deletions(-)
drivers/bus/mhi/host/init.c +3 -3
@@ -338,7 +338,7 @@ int mhi_init_dev_ctxt(struct mhi_controller *mhi_cntrl) er_ctxt->msivec =cpu_to_le32 (mhi_event->irq); mhi_event->db_cfg.db_mode = true; - ring->el_size =sizeof (struct mhi_tre ); + ring->el_size =sizeof (struct mhi_ring_element ); ring->len = ring->el_size * ring->elements; ret =mhi_alloc_aligned_ring (mhi_cntrl, ring, ring->len);if (ret)
@@ -370,7 +370,7 @@ int mhi_init_dev_ctxt(struct mhi_controller *mhi_cntrl)for (i =0 ; i <NR_OF_CMD_RINGS ; i++, mhi_cmd++, cmd_ctxt++) {struct mhi_ring *ring = &mhi_cmd->ring; - ring->el_size =sizeof (struct mhi_tre ); + ring->el_size =sizeof (struct mhi_ring_element ); ring->elements =CMD_EL_PER_RING ; ring->len = ring->el_size * ring->elements; ret =mhi_alloc_aligned_ring (mhi_cntrl, ring, ring->len);
@@ -613,7 +613,7 @@ int mhi_init_chan_ctxt(struct mhi_controller *mhi_cntrl, buf_ring = &mhi_chan->buf_ring; tre_ring = &mhi_chan->tre_ring; - tre_ring->el_size =sizeof (struct mhi_tre ); + tre_ring->el_size =sizeof (struct mhi_ring_element ); tre_ring->len = tre_ring->el_size * tre_ring->elements; chan_ctxt = &mhi_cntrl->mhi_ctxt->chan_ctxt[mhi_chan->chan]; ret =mhi_alloc_aligned_ring (mhi_cntrl, tre_ring, tre_ring->len);
drivers/bus/mhi/host/internal.h +1 -1
@@ -257,7 +257,7 @@ struct mhi_ctxt {dma_addr_t cmd_ctxt_addr; }; -struct mhi_tre { +struct mhi_ring_element {__le64 ptr;__le32 dword[2 ]; };
drivers/bus/mhi/host/main.c +10 -10
@@ -556,7 +556,7 @@ static void mhi_recycle_ev_ring_element(struct mhi_controller *mhi_cntrl, }static int parse_xfer_event (struct mhi_controller *mhi_cntrl, -struct mhi_tre *event, +struct mhi_ring_element *event,struct mhi_chan *mhi_chan) {struct mhi_ring *buf_ring, *tre_ring;
@@ -592,7 +592,7 @@ static int parse_xfer_event(struct mhi_controller *mhi_cntrl,case MHI_EV_CC_EOT : {dma_addr_t ptr =MHI_TRE_GET_EV_PTR (event); -struct mhi_tre *local_rp, *ev_tre; +struct mhi_ring_element *local_rp, *ev_tre;void *dev_rp;struct mhi_buf_info *buf_info;u16 xfer_len;
@@ -695,7 +695,7 @@ static int parse_xfer_event(struct mhi_controller *mhi_cntrl, }static int parse_rsc_event (struct mhi_controller *mhi_cntrl, -struct mhi_tre *event, +struct mhi_ring_element *event,struct mhi_chan *mhi_chan) {struct mhi_ring *buf_ring, *tre_ring;
@@ -759,12 +759,12 @@ static int parse_rsc_event(struct mhi_controller *mhi_cntrl, }static void mhi_process_cmd_completion (struct mhi_controller *mhi_cntrl, -struct mhi_tre *tre) +struct mhi_ring_element *tre) {dma_addr_t ptr =MHI_TRE_GET_EV_PTR (tre);struct mhi_cmd *cmd_ring = &mhi_cntrl->mhi_cmd[PRIMARY_CMD_RING ];struct mhi_ring *mhi_ring = &cmd_ring->ring; -struct mhi_tre *cmd_pkt; +struct mhi_ring_element *cmd_pkt;struct mhi_chan *mhi_chan;u32 chan;
@@ -797,7 +797,7 @@ int mhi_process_ctrl_ev_ring(struct mhi_controller *mhi_cntrl, struct mhi_event *mhi_event, u32 event_quota) { -struct mhi_tre *dev_rp, *local_rp; +struct mhi_ring_element *dev_rp, *local_rp;struct mhi_ring *ev_ring = &mhi_event->ring;struct mhi_event_ctxt *er_ctxt = &mhi_cntrl->mhi_ctxt->er_ctxt[mhi_event->er_index];
@@ -967,7 +967,7 @@ int mhi_process_data_event_ring(struct mhi_controller *mhi_cntrl, struct mhi_event *mhi_event, u32 event_quota) { -struct mhi_tre *dev_rp, *local_rp; +struct mhi_ring_element *dev_rp, *local_rp;struct mhi_ring *ev_ring = &mhi_event->ring;struct mhi_event_ctxt *er_ctxt = &mhi_cntrl->mhi_ctxt->er_ctxt[mhi_event->er_index];
@@ -1188,7 +1188,7 @@ int mhi_gen_tre(struct mhi_controller *mhi_cntrl, struct mhi_chan *mhi_chan, struct mhi_buf_info *info, enum mhi_flags flags) { struct mhi_ring *buf_ring, *tre_ring; -struct mhi_tre *mhi_tre; +struct mhi_ring_element *mhi_tre;struct mhi_buf_info *buf_info;int eot, eob, chain, bei;int ret;
@@ -1266,7 +1266,7 @@ int mhi_send_cmd(struct mhi_controller *mhi_cntrl, struct mhi_chan *mhi_chan, enum mhi_cmd_type cmd) { -struct mhi_tre *cmd_tre =NULL ; +struct mhi_ring_element *cmd_tre =NULL ;struct mhi_cmd *mhi_cmd = &mhi_cntrl->mhi_cmd[PRIMARY_CMD_RING ];struct mhi_ring *ring = &mhi_cmd->ring;struct device *dev = &mhi_cntrl->mhi_dev->dev;
@@ -1524,7 +1524,7 @@ static void mhi_mark_stale_events(struct mhi_controller *mhi_cntrl, int chan) { -struct mhi_tre *dev_rp, *local_rp; +struct mhi_ring_element *dev_rp, *local_rp;struct mhi_ring *ev_ring;struct device *dev = &mhi_cntrl->mhi_dev->dev;unsigned long flags;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 98/476 bus: mhi: host: Add alignment check for event ring read pointer
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krishna chaitanya chundru <[email protected]>
[ Upstream commit eff9704f5332a13b08fbdbe0f84059c9e7051d5f ]
Though we do check the event ring read pointer by "is_valid_ring_ptr" to make sure it is in the buffer range, but there is another risk the pointer may be not aligned. Since we are expecting event ring elements are 128 bits(struct mhi_ring_element) aligned, an unaligned read pointer could lead to multiple issues like DoS or ring buffer memory corruption.
So add a alignment check for event ring read pointer.
--- drivers/bus/mhi/host/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/bus/mhi/host/main.c +2 -1
@@ -267,7 +267,8 @@ static void mhi_del_ring_element(struct mhi_controller *mhi_cntrl,static bool is_valid_ring_ptr (struct mhi_ring *ring,dma_addr_t addr) { -return addr >= ring->iommu_base && addr < ring->iommu_base + ring->len; +return addr >= ring->iommu_base && addr < ring->iommu_base + ring->len && + !(addr & (sizeof (struct mhi_ring_element ) -1 )); }int mhi_destroy_device (struct device *dev,void *data)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 99/476 fs/pipe: move check to pipe_has_watch_queue()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Max Kellermann <[email protected]>
[ Upstream commit b4bd6b4bac8edd61eb8f7b836969d12c0c6af165 ]
This declutters the code by reducing the number of #ifdefs and makes the watch_queue checks simpler. This has no runtime effect; the machine code is identical.
Message-Id: <[email protected]>
Stable-dep-of: e95aada4cb93 ("pipe: wakeup wr_wait after setting max_usage")
--- fs/pipe.c | 12 +++--------- include/linux/pipe_fs_i.h | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 9 deletions(-)
fs/pipe.c +3 -9
@@ -435,12 +435,10 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from) goto out; } -#ifdef CONFIG_WATCH_QUEUE -if (pipe->watch_queue) { +if (pipe_has_watch_queue (pipe)) { ret = -EXDEV ; goto out; } -#endif /* * If it wasn't empty we try to merge new data into
@@ -1319,10 +1317,8 @@ static long pipe_set_size(struct pipe_inode_info *pipe, unsigned long arg)unsigned int nr_slots, size;long ret =0 ; -#ifdef CONFIG_WATCH_QUEUE -if (pipe->watch_queue) +if (pipe_has_watch_queue (pipe))return -EBUSY ; -#endif size =round_pipe_size (arg); nr_slots = size >>PAGE_SHIFT ;
@@ -1374,10 +1370,8 @@ struct pipe_inode_info *get_pipe_info(struct file *file, bool for_splice)if (file->f_op != &pipefifo_fops || !pipe)return NULL ; -#ifdef CONFIG_WATCH_QUEUE -if (for_splice && pipe->watch_queue) +if (for_splice &&pipe_has_watch_queue (pipe))return NULL ; -#endif return pipe; }
include/linux/pipe_fs_i.h +16 -0
@@ -124,6 +124,22 @@ struct pipe_buf_operations {bool (*get)(struct pipe_inode_info *,struct pipe_buffer *); }; +/** +* pipe_has_watch_queue - Check whether the pipe is a watch_queue, +* i.e. it was created with O_NOTIFICATION_PIPE +* @pipe: The pipe to check +* +* Return: true if pipe is a watch queue, false otherwise. +*/ +static inline bool pipe_has_watch_queue (const struct pipe_inode_info *pipe) +{ +#ifdef CONFIG_WATCH_QUEUE +return pipe->watch_queue !=NULL ; +#else +return false; +#endif +} +/** * pipe_empty - Return true if the pipe is empty * @head: The pipe ring head pointer
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 100/476 pipe: wakeup wr_wait after setting max_usage
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Schauer <[email protected]>
[ Upstream commit e95aada4cb93d42e25c30a0ef9eb2923d9711d4a ]
Commit c73be61cede5 ("pipe: Add general notification queue support") a regression was introduced that would lock up resized pipes under certain conditions. See the reproducer in [1].
The commit resizing the pipe ring size was moved to a different function, doing that moved the wakeup for pipe->wr_wait before actually raising pipe->max_usage. If a pipe was full before the resize occured it would result in the wakeup never actually triggering pipe_write.
Set @max_usage and @nr_accounted before waking writers if this isn't a watch queue.
--- fs/pipe.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/pipe.c +5 -2
@@ -1300,6 +1300,11 @@ int pipe_resize_ring(struct pipe_inode_info *pipe, unsigned int nr_slots) pipe->tail = tail; pipe->head = head; +if (!pipe_has_watch_queue (pipe)) { + pipe->max_usage = nr_slots; + pipe->nr_accounted = nr_slots; + } +spin_unlock_irq (&pipe->rd_wait.lock);/* This might have made more room for writers */
@@ -1351,8 +1356,6 @@ static long pipe_set_size(struct pipe_inode_info *pipe, unsigned long arg)if (ret <0 ) goto out_revert_acct; - pipe->max_usage = nr_slots; - pipe->nr_accounted = nr_slots;return pipe->max_usage *PAGE_SIZE ; out_revert_acct:
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 101/476 ARM: dts: qcom: sdx55: fix USB wakeup interrupt types
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
[ Upstream commit d0ec3c4c11c3b30e1f2d344973b2a7bf0f986734 ]
The DP/DM wakeup interrupts are edge triggered and which edge to trigger on depends on use-case and whether a Low speed or Full/High speed device is connected.
--- arch/arm/boot/dts/qcom-sdx55.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/qcom-sdx55.dtsi +2 -2
@@ -422,8 +422,8 @@ usb: usb@a6f8800 { interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 198 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 158 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 157 IRQ_TYPE_LEVEL_HIGH>; + <GIC_SPI 158 IRQ_TYPE_EDGE_BOTH>, + <GIC_SPI 157 IRQ_TYPE_EDGE_BOTH>; interrupt-names = "hs_phy_irq", "ss_phy_irq", "dm_hs_phy_irq", "dp_hs_phy_irq";
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 102/476 ARM: dts: samsung: exynos4210-i9100: Unconditionally enable LDO12
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Cercueil <[email protected]>
[ Upstream commit 84228d5e29dbc7a6be51e221000e1d122125826c ]
The kernel hangs for a good 12 seconds without any info being printed to dmesg, very early in the boot process, if this regulator is not enabled.
Force-enable it to work around this issue, until we know more about the underlying problem.
--- arch/arm/boot/dts/exynos4210-i9100.dts | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/boot/dts/exynos4210-i9100.dts +8 -0
@@ -520,6 +520,14 @@ vtcam_reg: LDO12 { regulator-name = "VT_CAM_1.8V"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; + + /* + * Force-enable this regulator; otherwise the + * kernel hangs very early in the boot process + * for about 12 seconds, without apparent + * reason. + */ + regulator-always-on; }; vcclcd_reg: LDO13 {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 103/476 ARM: dts: qcom: sdx55: fix pdc #interrupt-cells
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
[ Upstream commit cc25bd06c16aa582596a058d375b2e3133f79b93 ]
The Qualcomm PDC interrupt controller binding expects two cells in interrupt specifiers.
--- arch/arm/boot/dts/qcom-sdx55.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/qcom-sdx55.dtsi +1 -1
@@ -447,7 +447,7 @@ pdc: interrupt-controller@b210000 { compatible = "qcom,sdx55-pdc", "qcom,pdc"; reg = <0x0b210000 0x30000>; qcom,pdc-ranges = <0 179 52>; - #interrupt-cells = <3>; + #interrupt-cells = <2>; interrupt-parent = <&intc>; interrupt-controller; };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 104/476 ARM: dts: qcom: sdx55: fix USB DP/DM HS PHY interrupts
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
[ Upstream commit de95f139394a5ed82270f005bc441d2e7c1e51b7 ]
The USB DP/DM HS PHY interrupts need to be provided by the PDC interrupt controller in order to be able to wake the system up from low-power states and to be able to detect disconnect events, which requires triggering on falling edges.
A recent commit updated the trigger type but failed to change the interrupt provider as required. This leads to the current Linux driver failing to probe instead of printing an error during suspend and USB wakeup not working as intended.
--- arch/arm/boot/dts/qcom-sdx55.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/boot/dts/qcom-sdx55.dtsi +4 -4
@@ -420,10 +420,10 @@ usb: usb@a6f8800 { <&gcc GCC_USB30_MASTER_CLK>; assigned-clock-rates = <19200000>, <200000000>; - interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 198 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 158 IRQ_TYPE_EDGE_BOTH>, - <GIC_SPI 157 IRQ_TYPE_EDGE_BOTH>; + interrupts-extended = <&intc GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>, + <&intc GIC_SPI 198 IRQ_TYPE_LEVEL_HIGH>, + <&pdc 11 IRQ_TYPE_EDGE_BOTH>, + <&pdc 10 IRQ_TYPE_EDGE_BOTH>; interrupt-names = "hs_phy_irq", "ss_phy_irq", "dm_hs_phy_irq", "dp_hs_phy_irq";
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 105/476 ARM: dts: qcom: sdx55: fix USB SS wakeup
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
[ Upstream commit 710dd03464e4ab5b3d329768388b165d61958577 ]
The USB SS PHY interrupt needs to be provided by the PDC interrupt controller in order to be able to wake the system up from low-power states.
--- arch/arm/boot/dts/qcom-sdx55.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/qcom-sdx55.dtsi +1 -1
@@ -421,7 +421,7 @@ usb: usb@a6f8800 { assigned-clock-rates = <19200000>, <200000000>; interrupts-extended = <&intc GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>, - <&intc GIC_SPI 198 IRQ_TYPE_LEVEL_HIGH>, + <&pdc 51 IRQ_TYPE_LEVEL_HIGH>, <&pdc 11 IRQ_TYPE_EDGE_BOTH>, <&pdc 10 IRQ_TYPE_EDGE_BOTH>; interrupt-names = "hs_phy_irq", "ss_phy_irq",
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 106/476 media: mtk-jpeg: Fix use after free bug due to error path handling in mtk_jpeg_dec_device_run
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zheng Wang <[email protected]>
[ Upstream commit 206c857dd17d4d026de85866f1b5f0969f2a109e ]
In mtk_jpeg_probe, &jpeg->job_timeout_work is bound with mtk_jpeg_job_timeout_work.
In mtk_jpeg_dec_device_run, if error happens in mtk_jpeg_set_dec_dst, it will finally start the worker while mark the job as finished by invoking v4l2_m2m_job_finish.
There are two methods to trigger the bug. If we remove the module, it which will call mtk_jpeg_remove to make cleanup. The possible sequence is as follows, which will cause a use-after-free bug.
CPU0 CPU1mtk_jpeg_dec_... |
start worker |
|mtk_jpeg_job_timeout_work
mtk_jpeg_remove |
v4l2_m2m_release |
kfree(m2m_dev); |
|
| v4l2_m2m_get_curr_priv
| m2m_dev->curr_ctx //useIf we close the file descriptor, which will call mtk_jpeg_release, it will have a similar sequence.
Fix this bug by starting timeout worker only if started jpegdec worker successfully. Then v4l2_m2m_job_finish will only be called in either mtk_jpeg_job_timeout_work or mtk_jpeg_dec_device_run.
--- drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c +3 -3
@@ -977,13 +977,13 @@ static void mtk_jpeg_dec_device_run(void *priv)if (ret <0 ) goto dec_end; -schedule_delayed_work (&jpeg->job_timeout_work, -msecs_to_jiffies (MTK_JPEG_HW_TIMEOUT_MSEC )); -mtk_jpeg_set_dec_src (ctx, &src_buf->vb2_buf, &bs);if (mtk_jpeg_set_dec_dst (ctx, &jpeg_src_buf->dec_param, &dst_buf->vb2_buf, &fb)) goto dec_end; +schedule_delayed_work (&jpeg->job_timeout_work, +msecs_to_jiffies (MTK_JPEG_HW_TIMEOUT_MSEC )); +spin_lock_irqsave (&jpeg->hw_lock, flags);mtk_jpeg_dec_reset (jpeg->reg_base); mtk_jpeg_dec_set_config(jpeg->reg_base,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 107/476 mm: use __pfn_to_section() instead of open coding it
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rolf Eike Beer <[email protected]>
[ Upstream commit f1dc0db296bd25960273649fc6ef2ecbf5aaa0e0 ]
It is defined in the same file just a few lines above.
Stable-dep-of: 5ec8e8ea8b77 ("mm/sparsemem: fix race in accessing memory_section->usage")
--- include/linux/mmzone.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/mmzone.h +2 -2
@@ -1493,7 +1493,7 @@ static inline int pfn_valid(unsigned long pfn)if (pfn_to_section_nr (pfn) >=NR_MEM_SECTIONS )return 0 ; - ms =__nr_to_section (pfn_to_section_nr (pfn)); + ms =__pfn_to_section (pfn);if (!valid_section (ms))return 0 ;/*
@@ -1508,7 +1508,7 @@ static inline int pfn_in_present_section(unsigned long pfn) {if (pfn_to_section_nr (pfn) >=NR_MEM_SECTIONS )return 0 ; -return present_section (__nr_to_section (pfn_to_section_nr (pfn))); +return present_section (__pfn_to_section (pfn)); }static inline unsigned long next_present_section_nr (unsigned long section_nr)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 108/476 mm/sparsemem: fix race in accessing memory_section->usage
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charan Teja Kalla <[email protected]>
[ Upstream commit 5ec8e8ea8b7783fab150cf86404fc38cb4db8800 ]
The below race is observed on a PFN which falls into the device memory region with the system memory configuration where PFN's are such that [ZONE_NORMAL ZONE_DEVICE ZONE_NORMAL]. Since normal zone start and end pfn contains the device memory PFN's as well, the compaction triggered will try on the device memory PFN's too though they end up in NOP(because pfn_to_online_page() returns NULL for ZONE_DEVICE memory sections). When from other core, the section mappings are being removed for the ZONE_DEVICE region, that the PFN in question belongs to, on which compaction is currently being operated is resulting into the kernel crash with CONFIG_SPASEMEM_VMEMAP enabled. The crash logs can be seen at [1].
compact_zone() memunmap_pages
------------- ---------------__pageblock_pfn_to_page
......
(a)pfn_valid():
valid_section()//return true
(b)__remove_pages()->
sparse_remove_section()->
section_deactivate():
[Free the array ms->usage and set
ms->usage = NULL]
pfn_section_valid()
[Access ms->usage which
is NULL]NOTE: From the above it can be said that the race is reduced to between the pfn_valid()/pfn_section_valid() and the section deactivate with SPASEMEM_VMEMAP enabled.
The commit b943f045a9af("mm/sparse: fix kernel crash with pfn_section_valid check") tried to address the same problem by clearing the SECTION_HAS_MEM_MAP with the expectation of valid_section() returns false thus ms->usage is not accessed.
Fix this issue by the below steps:
a) Clear SECTION_HAS_MEM_MAP before freeing the ->usage.
b) RCU protected read side critical section will either return NULL when SECTION_HAS_MEM_MAP is cleared or can successfully access ->usage.
c) Free the ->usage with kfree_rcu() and set ms->usage = NULL. No attempt will be made to access ->usage after this as the SECTION_HAS_MEM_MAP is cleared thus valid_section() return false.
Thanks to David/Pavan for their inputs on this patch.
[1] https://lore.kernel.org/linux-mm/[email protected]/
On Snapdragon SoC, with the mentioned memory configuration of PFN's as [ZONE_NORMAL ZONE_DEVICE ZONE_NORMAL], we are able to see bunch of issues daily while testing on a device farm.
For this particular issue below is the log. Though the below log is not directly pointing to the pfn_section_valid(){ ms->usage;}, when we loaded this dump on T32 lauterbach tool, it is pointing.
[ 540.578056] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 [ 540.578068] Mem abort info: [ 540.578070] ESR = 0x0000000096000005 [ 540.578073] EC = 0x25: DABT (current EL), IL = 32 bits [ 540.578077] SET = 0, FnV = 0 [ 540.578080] EA = 0, S1PTW = 0 [ 540.578082] FSC = 0x05: level 1 translation fault [ 540.578085] Data abort info: [ 540.578086] ISV = 0, ISS = 0x00000005 [ 540.578088] CM = 0, WnR = 0 [ 540.579431] pstate: 82400005 (Nzcv daif +PAN -UAO +TCO -DIT -SSBSBTYPE=--) [ 540.579436] pc : __pageblock_pfn_to_page+0x6c/0x14c [ 540.579454] lr : compact_zone+0x994/0x1058 [ 540.579460] sp : ffffffc03579b510 [ 540.579463] x29: ffffffc03579b510 x28: 0000000000235800 x27:000000000000000c [ 540.579470] x26: 0000000000235c00 x25: 0000000000000068 x24:ffffffc03579b640 [ 540.579477] x23: 0000000000000001 x22: ffffffc03579b660 x21:0000000000000000 [ 540.579483] x20: 0000000000235bff x19: ffffffdebf7e3940 x18:ffffffdebf66d140 [ 540.579489] x17: 00000000739ba063 x16: 00000000739ba063 x15:00000000009f4bff [ 540.579495] x14: 0000008000000000 x13: 0000000000000000 x12:0000000000000001 [ 540.579501] x11: 0000000000000000 x10: 0000000000000000 x9 :ffffff897d2cd440 [ 540.579507] x8 : 0000000000000000 x7 : 0000000000000000 x6 :ffffffc03579b5b4 [ 540.579512] x5 : 0000000000027f25 x4 : ffffffc03579b5b8 x3 :0000000000000001 [ 540.579518] x2 : ffffffdebf7e3940 x1 : 0000000000235c00 x0 :0000000000235800 [ 540.579524] Call trace: [ 540.579527] __pageblock_pfn_to_page+0x6c/0x14c [ 540.579533] compact_zone+0x994/0x1058 [ 540.579536] try_to_compact_pages+0x128/0x378 [ 540.579540] __alloc_pages_direct_compact+0x80/0x2b0 [ 540.579544] __alloc_pages_slowpath+0x5c0/0xe10 [ 540.579547] __alloc_pages+0x250/0x2d0 [ 540.579550] __iommu_dma_alloc_noncontiguous+0x13c/0x3fc [ 540.579561] iommu_dma_alloc+0xa0/0x320 [ 540.579565] dma_alloc_attrs+0xd4/0x108
--- include/linux/mmzone.h | 14 +++++++++++--- mm/sparse.c | 17 +++++++++-------- 2 files changed, 20 insertions(+), 11 deletions(-)
include/linux/mmzone.h +11 -3
@@ -1287,6 +1287,7 @@ static inline unsigned long section_nr_to_pfn(unsigned long sec)#define SUBSECTION_ALIGN_DOWN (pfn) ((pfn) & PAGE_SUBSECTION_MASK)struct mem_section_usage { +struct rcu_head rcu;#ifdef CONFIG_SPARSEMEM_VMEMMAP DECLARE_BITMAP(subsection_map, SUBSECTIONS_PER_SECTION);#endif
@@ -1457,7 +1458,7 @@ static inline int pfn_section_valid(struct mem_section *ms, unsigned long pfn) {int idx =subsection_map_index (pfn); -return test_bit (idx, ms->usage->subsection_map); +return test_bit (idx,READ_ONCE (ms->usage)->subsection_map); }#else static inline int pfn_section_valid (struct mem_section *ms,unsigned long pfn)
@@ -1481,6 +1482,7 @@ static inline int pfn_section_valid(struct mem_section *ms, unsigned long pfn)static inline int pfn_valid (unsigned long pfn) {struct mem_section *ms; +int ret;/* * Ensure the upper PAGE_SHIFT bits are clear in the
@@ -1494,13 +1496,19 @@ static inline int pfn_valid(unsigned long pfn)if (pfn_to_section_nr (pfn) >=NR_MEM_SECTIONS )return 0 ; ms =__pfn_to_section (pfn); -if (!valid_section (ms)) +rcu_read_lock (); +if (!valid_section (ms)) { +rcu_read_unlock ();return 0 ; + }/* * Traditionally early sections always returned pfn_valid() for * the entire section-sized span. */ - return early_section(ms) || pfn_section_valid(ms, pfn); + ret =early_section (ms) ||pfn_section_valid (ms, pfn); +rcu_read_unlock (); + + return ret; }#endif
mm/sparse.c +9 -8
@@ -789,6 +789,13 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages,if (empty) {unsigned long section_nr =pfn_to_section_nr (pfn); +/* +* Mark the section invalid so that valid_section() +* return false. This prevents code from dereferencing +* ms->usage array. +*/ + ms->section_mem_map &= ~SECTION_HAS_MEM_MAP ; +/* * When removing an early section, the usage map is kept (as the * usage maps of other sections fall into the same page). It
@@ -797,16 +804,10 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages,* was allocated during boot. */ if (!PageReserved (virt_to_page (ms->usage))) { -kfree (ms->usage); - ms->usage =NULL ; +kfree_rcu (ms->usage, rcu); +WRITE_ONCE (ms->usage,NULL ); } memmap =sparse_decode_mem_map (ms->section_mem_map, section_nr); -/* -* Mark the section invalid so that valid_section() -* return false. This prevents code from dereferencing -* ms->usage array. -*/ - ms->section_mem_map &= ~SECTION_HAS_MEM_MAP ; }/*
Signature · 1 line
2.43.0
Re: [PATCH 5.15 108/476] mm/sparsemem: fix race in accessing memory_section->usage
Quoted 199 lines · Greg Kroah-Hartman
5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charan Teja Kalla <[email protected]>
[ Upstream commit
5ec8e8ea8b7783fab150cf86404fc38cb4db8800]The below race is observed on a PFN which falls into the device memory region with the system memory configuration where PFN's are such that [
ZONE_NORMALZONE_DEVICEZONE_NORMAL]. Since normal zone start and end pfn contains the device memory PFN's as well, the compaction triggered will try on the device memory PFN's too though they end up inNOP(because pfn_to_online_page() returns NULL for ZONE_DEVICE memory sections). When from other core, the section mappings are being removed for theZONE_DEVICEregion, that the PFN in question belongs to, on which compaction is currently being operated is resulting into the kernel crash withCONFIG_SPASEMEM_VMEMAPenabled. The crash logs can be seen at [1].
compact_zone()memunmap_pages
------------- ---------------__pageblock_pfn_to_page
......
(a)pfn_valid():valid_section()//return true (b)__remove_pages()-> sparse_remove_section()-> section_deactivate(): [Free the array ms->usage and set ms->usage = NULL] pfn_section_valid() [Access ms->usage which is NULL]NOTE: From the above it can be said that the race is reduced to between the pfn_valid()/pfn_section_valid() and the section deactivate with
SPASEMEM_VMEMAPenabled.The commit
b943f045a9af("mm/sparse: fix kernel crash with pfn_section_valid check")tried to address the same problem by clearing theSECTION_HAS_MEM_MAPwith the expectation ofvalid_section()returns false thusms->usageis not accessed.Fix this issue by the below steps:
a) Clear
SECTION_HAS_MEM_MAPbefore freeing the ->usage.b) RCU protected read side critical section will either return NULL when
SECTION_HAS_MEM_MAPis cleared or can successfully access ->usage.c) Free the ->usage with
kfree_rcu()and setms->usage= NULL. No attempt will be made to access ->usage after this as theSECTION_HAS_MEM_MAPis cleared thusvalid_section()return false.Thanks to David/Pavan for their inputs on this patch.
[1] https://lore.kernel.org/linux-mm/[email protected]/
On Snapdragon SoC, with the mentioned memory configuration of PFN's as [
ZONE_NORMALZONE_DEVICEZONE_NORMAL], we are able to see bunch of issues daily while testing on a device farm.For this particular issue below is the log. Though the below log is not directly pointing to the pfn_section_valid(){
ms->usage;}, when we loaded this dump on T32 lauterbach tool, it is pointing.[ 540.578056] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 [ 540.578068] Mem abort info: [ 540.578070] ESR = 0x0000000096000005 [ 540.578073] EC = 0x25: DABT (current EL), IL = 32 bits [ 540.578077] SET = 0, FnV = 0 [ 540.578080] EA = 0, S1PTW = 0 [ 540.578082] FSC = 0x05: level 1 translation fault [ 540.578085] Data abort info: [ 540.578086] ISV = 0, ISS = 0x00000005 [ 540.578088] CM = 0, WnR = 0 [ 540.579431] pstate: 82400005 (Nzcv daif +PAN -UAO +TCO -DIT -SSBSBTYPE=--) [ 540.579436] pc : __pageblock_pfn_to_page+0x6c/0x14c [ 540.579454] lr : compact_zone+0x994/0x1058 [ 540.579460] sp : ffffffc03579b510 [ 540.579463] x29: ffffffc03579b510 x28: 0000000000235800 x27:000000000000000c [ 540.579470] x26: 0000000000235c00 x25: 0000000000000068 x24:ffffffc03579b640 [ 540.579477] x23: 0000000000000001 x22: ffffffc03579b660 x21:0000000000000000 [ 540.579483] x20: 0000000000235bff x19: ffffffdebf7e3940 x18:ffffffdebf66d140 [ 540.579489] x17: 00000000739ba063 x16: 00000000739ba063 x15:00000000009f4bff [ 540.579495] x14: 0000008000000000 x13: 0000000000000000 x12:0000000000000001 [ 540.579501] x11: 0000000000000000 x10: 0000000000000000 x9 :ffffff897d2cd440 [ 540.579507] x8 : 0000000000000000 x7 : 0000000000000000 x6 :ffffffc03579b5b4 [ 540.579512] x5 : 0000000000027f25 x4 : ffffffc03579b5b8 x3 :0000000000000001 [ 540.579518] x2 : ffffffdebf7e3940 x1 : 0000000000235c00 x0 :0000000000235800 [ 540.579524] Call trace: [ 540.579527] __pageblock_pfn_to_page+0x6c/0x14c [ 540.579533] compact_zone+0x994/0x1058 [ 540.579536] try_to_compact_pages+0x128/0x378 [ 540.579540] __alloc_pages_direct_compact+0x80/0x2b0 [ 540.579544] __alloc_pages_slowpath+0x5c0/0xe10 [ 540.579547] __alloc_pages+0x250/0x2d0 [ 540.579550] __iommu_dma_alloc_noncontiguous+0x13c/0x3fc [ 540.579561] iommu_dma_alloc+0xa0/0x320 [ 540.579565] dma_alloc_attrs+0xd4/0x108[[email protected]: use kfree_rcu() in place of synchronize_rcu(), per David]Fixes f46edbd1b151 ("mm/sparsemem: add helpers track active portions of a section at boot")Signed-off-by Charan Teja Kalla <[email protected]>Cc Aneesh Kumar K.V <[email protected]>Cc Dan Williams <[email protected]>Cc David Hildenbrand <[email protected]>Cc Mel Gorman <[email protected]>Cc Oscar Salvador <[email protected]>Cc Vlastimil Babka <[email protected]>Cc <[email protected]>Signed-off-by Andrew Morton <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- include/linux/mmzone.h | 14 +++++++++++--- mm/sparse.c | 17 +++++++++-------- 2 files changed, 20 insertions(+), 11 deletions(-)include/linux/mmzone.h +11
-3@@ -1287,6 +1287,7 @@ static inline unsigned long section_nr_to_pfn(unsigned long sec)#define SUBSECTION_ALIGN_DOWN (pfn) ((pfn) & PAGE_SUBSECTION_MASK)struct mem_section_usage { +struct rcu_head rcu;#ifdef CONFIG_SPARSEMEM_VMEMMAP DECLARE_BITMAP(subsection_map, SUBSECTIONS_PER_SECTION);#endif @@ -1457,7 +1458,7 @@ static inline int pfn_section_valid(struct mem_section *ms, unsigned long pfn) {int idx =subsection_map_index (pfn); -return test_bit (idx, ms->usage->subsection_map); +return test_bit (idx,READ_ONCE (ms->usage)->subsection_map); }#else static inline int pfn_section_valid (struct mem_section *ms,unsigned long pfn)@@ -1481,6 +1482,7 @@ static inline int pfn_section_valid(struct mem_section *ms, unsigned long pfn)static inline int pfn_valid (unsigned long pfn) {struct mem_section *ms; +int ret;/* * Ensure the upper PAGE_SHIFT bits are clear in the @@ -1494,13 +1496,19 @@ static inline int pfn_valid(unsigned long pfn)if (pfn_to_section_nr (pfn) >=NR_MEM_SECTIONS )return 0 ; ms =__pfn_to_section (pfn); -if (!valid_section (ms)) +rcu_read_lock (); +if (!valid_section (ms)) { +rcu_read_unlock ();return 0 ; + }/* * Traditionally early sections always returned pfn_valid() for * the entire section-sized span. */ - return early_section(ms) || pfn_section_valid(ms, pfn); + ret =early_section (ms) ||pfn_section_valid (ms, pfn); +rcu_read_unlock (); + + return ret; }#endif mm/sparse.c +9
-2@@ -789,6 +789,13 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages,if (empty) {unsigned long section_nr =pfn_to_section_nr (pfn); +/* +* Mark the section invalid so that valid_section() +* return false. This prevents code from dereferencing +* ms->usage array. +*/ + ms->section_mem_map &= ~SECTION_HAS_MEM_MAP ; +/* * When removing an early section, the usage map is kept (as the * usage maps of other sections fall into the same page). It @@ -797,16 +804,10 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages,* was allocated during boot. */ if (!PageReserved (virt_to_page (ms->usage))) { -kfree (ms->usage); - ms->usage =NULL ; +kfree_rcu (ms->usage, rcu); +WRITE_ONCE (ms->usage,NULL ); }
mm/sparse.c static void section_deactivate(unsigned long pfn, unsigned long nr_pages, · line 813
Quoted 10 lines
mm/sparse.c +0
-6memmap =sparse_decode_mem_map (ms->section_mem_map, section_nr); -/* -* Mark the section invalid so that valid_section() -* return false. This prevents code from dereferencing -* ms->usage array. -*/ - ms->section_mem_map &= ~SECTION_HAS_MEM_MAP ; }/*
Maybe this is already known, but just FYI I wanted to drop the note that for some reasons I don't understand, this patch prevents me from compiling the proprietary Nvidia Unix driver with versions 510.108.03 and 535.104.05 in the 5.15 series. No problems with the 6.5 series, although the patch is included there as well.
linux-5.15.155 , nvidia 535.104.05 :
make -j $(nproc) CC=gcc SYSSRC=/scratch/local/linux clean && make -j $(nproc) CC=gcc SYSSRC=/scratch/local/linux V=2 modules
[...]
MODPOST /scratch/local/bee-buczek/nvidia/test_535-104-05/kernel/Module.symvers - due to target missing
ERROR: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol 'rcu_read_unlock_strict'
make[2]: *** [scripts/Makefile.modpost:133: /scratch/local/bee-buczek/nvidia/test_535-104-05/kernel/Module.symvers] Error 1
make[2]: *** Deleting file '/scratch/local/bee-buczek/nvidia/test_535-104-05/kernel/Module.symvers'
make[1]: *** [Makefile:1826: modules] Error 2
make[1]: Leaving directory '/scratch/local/linux'
make: *** [Makefile:82: modules] Error 2With fd117d03cefd15 ("mm/sparsemem: fix race in accessing memory_section->usage") reverted, the build completes.
Best
Donald
Signature · 3 lines
Donald Buczek [email protected] Tel: +49 30 8413 1433
Re: [PATCH 5.15 108/476] mm/sparsemem: fix race in accessing memory_section->usage
Quoted 229 lines · Donald Buczek
Quoted 199 lines · Greg Kroah-Hartman
5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charan Teja Kalla <[email protected]>
[ Upstream commit
5ec8e8ea8b7783fab150cf86404fc38cb4db8800]The below race is observed on a PFN which falls into the device memory region with the system memory configuration where PFN's are such that [
ZONE_NORMALZONE_DEVICEZONE_NORMAL]. Since normal zone start and end pfn contains the device memory PFN's as well, the compaction triggered will try on the device memory PFN's too though they end up inNOP(because pfn_to_online_page() returns NULL for ZONE_DEVICE memory sections). When from other core, the section mappings are being removed for theZONE_DEVICEregion, that the PFN in question belongs to, on which compaction is currently being operated is resulting into the kernel crash withCONFIG_SPASEMEM_VMEMAPenabled. The crash logs can be seen at [1].
compact_zone()memunmap_pages
------------- ---------------__pageblock_pfn_to_page
......
(a)pfn_valid():valid_section()//return true (b)__remove_pages()-> sparse_remove_section()-> section_deactivate(): [Free the array ms->usage and set ms->usage = NULL] pfn_section_valid() [Access ms->usage which is NULL]NOTE: From the above it can be said that the race is reduced to between the pfn_valid()/pfn_section_valid() and the section deactivate with
SPASEMEM_VMEMAPenabled.The commit
b943f045a9af("mm/sparse: fix kernel crash with pfn_section_valid check")tried to address the same problem by clearing theSECTION_HAS_MEM_MAPwith the expectation ofvalid_section()returns false thusms->usageis not accessed.Fix this issue by the below steps:
a) Clear
SECTION_HAS_MEM_MAPbefore freeing the ->usage.b) RCU protected read side critical section will either return NULL when
SECTION_HAS_MEM_MAPis cleared or can successfully access ->usage.c) Free the ->usage with
kfree_rcu()and setms->usage= NULL. No attempt will be made to access ->usage after this as theSECTION_HAS_MEM_MAPis cleared thusvalid_section()return false.Thanks to David/Pavan for their inputs on this patch.
[1] https://lore.kernel.org/linux-mm/[email protected]/
On Snapdragon SoC, with the mentioned memory configuration of PFN's as [
ZONE_NORMALZONE_DEVICEZONE_NORMAL], we are able to see bunch of issues daily while testing on a device farm.For this particular issue below is the log. Though the below log is not directly pointing to the pfn_section_valid(){
ms->usage;}, when we loaded this dump on T32 lauterbach tool, it is pointing.[ 540.578056] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 [ 540.578068] Mem abort info: [ 540.578070] ESR = 0x0000000096000005 [ 540.578073] EC = 0x25: DABT (current EL), IL = 32 bits [ 540.578077] SET = 0, FnV = 0 [ 540.578080] EA = 0, S1PTW = 0 [ 540.578082] FSC = 0x05: level 1 translation fault [ 540.578085] Data abort info: [ 540.578086] ISV = 0, ISS = 0x00000005 [ 540.578088] CM = 0, WnR = 0 [ 540.579431] pstate: 82400005 (Nzcv daif +PAN -UAO +TCO -DIT -SSBSBTYPE=--) [ 540.579436] pc : __pageblock_pfn_to_page+0x6c/0x14c [ 540.579454] lr : compact_zone+0x994/0x1058 [ 540.579460] sp : ffffffc03579b510 [ 540.579463] x29: ffffffc03579b510 x28: 0000000000235800 x27:000000000000000c [ 540.579470] x26: 0000000000235c00 x25: 0000000000000068 x24:ffffffc03579b640 [ 540.579477] x23: 0000000000000001 x22: ffffffc03579b660 x21:0000000000000000 [ 540.579483] x20: 0000000000235bff x19: ffffffdebf7e3940 x18:ffffffdebf66d140 [ 540.579489] x17: 00000000739ba063 x16: 00000000739ba063 x15:00000000009f4bff [ 540.579495] x14: 0000008000000000 x13: 0000000000000000 x12:0000000000000001 [ 540.579501] x11: 0000000000000000 x10: 0000000000000000 x9 :ffffff897d2cd440 [ 540.579507] x8 : 0000000000000000 x7 : 0000000000000000 x6 :ffffffc03579b5b4 [ 540.579512] x5 : 0000000000027f25 x4 : ffffffc03579b5b8 x3 :0000000000000001 [ 540.579518] x2 : ffffffdebf7e3940 x1 : 0000000000235c00 x0 :0000000000235800 [ 540.579524] Call trace: [ 540.579527] __pageblock_pfn_to_page+0x6c/0x14c [ 540.579533] compact_zone+0x994/0x1058 [ 540.579536] try_to_compact_pages+0x128/0x378 [ 540.579540] __alloc_pages_direct_compact+0x80/0x2b0 [ 540.579544] __alloc_pages_slowpath+0x5c0/0xe10 [ 540.579547] __alloc_pages+0x250/0x2d0 [ 540.579550] __iommu_dma_alloc_noncontiguous+0x13c/0x3fc [ 540.579561] iommu_dma_alloc+0xa0/0x320 [ 540.579565] dma_alloc_attrs+0xd4/0x108[[email protected]: use kfree_rcu() in place of synchronize_rcu(), per David]Fixes f46edbd1b151 ("mm/sparsemem: add helpers track active portions of a section at boot")Signed-off-by Charan Teja Kalla <[email protected]>Cc Aneesh Kumar K.V <[email protected]>Cc Dan Williams <[email protected]>Cc David Hildenbrand <[email protected]>Cc Mel Gorman <[email protected]>Cc Oscar Salvador <[email protected]>Cc Vlastimil Babka <[email protected]>Cc <[email protected]>Signed-off-by Andrew Morton <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- include/linux/mmzone.h | 14 +++++++++++--- mm/sparse.c | 17 +++++++++-------- 2 files changed, 20 insertions(+), 11 deletions(-)include/linux/mmzone.h +11
-3@@ -1287,6 +1287,7 @@ static inline unsigned long section_nr_to_pfn(unsigned long sec)#define SUBSECTION_ALIGN_DOWN (pfn) ((pfn) & PAGE_SUBSECTION_MASK)struct mem_section_usage { +struct rcu_head rcu;#ifdef CONFIG_SPARSEMEM_VMEMMAP DECLARE_BITMAP(subsection_map, SUBSECTIONS_PER_SECTION);#endif @@ -1457,7 +1458,7 @@ static inline int pfn_section_valid(struct mem_section *ms, unsigned long pfn) {int idx =subsection_map_index (pfn); -return test_bit (idx, ms->usage->subsection_map); +return test_bit (idx,READ_ONCE (ms->usage)->subsection_map); }#else static inline int pfn_section_valid (struct mem_section *ms,unsigned long pfn)@@ -1481,6 +1482,7 @@ static inline int pfn_section_valid(struct mem_section *ms, unsigned long pfn)static inline int pfn_valid (unsigned long pfn) {struct mem_section *ms; +int ret;/* * Ensure the upper PAGE_SHIFT bits are clear in the @@ -1494,13 +1496,19 @@ static inline int pfn_valid(unsigned long pfn)if (pfn_to_section_nr (pfn) >=NR_MEM_SECTIONS )return 0 ; ms =__pfn_to_section (pfn); -if (!valid_section (ms)) +rcu_read_lock (); +if (!valid_section (ms)) { +rcu_read_unlock ();return 0 ; + }/* * Traditionally early sections always returned pfn_valid() for * the entire section-sized span. */ - return early_section(ms) || pfn_section_valid(ms, pfn); + ret =early_section (ms) ||pfn_section_valid (ms, pfn); +rcu_read_unlock (); + + return ret; }#endif mm/sparse.c +9
-2@@ -789,6 +789,13 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages,if (empty) {unsigned long section_nr =pfn_to_section_nr (pfn); +/* +* Mark the section invalid so that valid_section() +* return false. This prevents code from dereferencing +* ms->usage array. +*/ + ms->section_mem_map &= ~SECTION_HAS_MEM_MAP ; +/* * When removing an early section, the usage map is kept (as the * usage maps of other sections fall into the same page). It @@ -797,16 +804,10 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages,* was allocated during boot. */ if (!PageReserved (virt_to_page (ms->usage))) { -kfree (ms->usage); - ms->usage =NULL ; +kfree_rcu (ms->usage, rcu); +WRITE_ONCE (ms->usage,NULL ); }mm/sparse.c static void section_deactivate(unsigned long pfn, unsigned long nr_pages, · line 813
Quoted 10 lines
mm/sparse.c +0
-6memmap =sparse_decode_mem_map (ms->section_mem_map, section_nr); -/* -* Mark the section invalid so that valid_section() -* return false. This prevents code from dereferencing -* ms->usage array. -*/ - ms->section_mem_map &= ~SECTION_HAS_MEM_MAP ; }/* Maybe this is already known, but just FYI I wanted to drop the note that for some reasons I don't understand, this patch prevents me from compiling the proprietary Nvidia Unix driver with versions 510.108.03 and 535.104.05 in the 5.15 series. No problems with the 6.5 series, although the patch is included there as well.
linux-5.15.155 , nvidia 535.104.05 :
make -j $(nproc) CC=gcc SYSSRC=/scratch/local/linux clean && make -j $(nproc) CC=gcc SYSSRC=/scratch/local/linux V=2 modules [...] MODPOST /scratch/local/bee-buczek/nvidia/test_535-104-05/kernel/Module.symvers - due to target missing ERROR: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol 'rcu_read_unlock_strict' make[2]: *** [scripts/Makefile.modpost:133: /scratch/local/bee-buczek/nvidia/test_535-104-05/kernel/Module.symvers] Error 1 make[2]: *** Deleting file '/scratch/local/bee-buczek/nvidia/test_535-104-05/kernel/Module.symvers' make[1]: *** [Makefile:1826: modules] Error 2 make[1]: Leaving directory '/scratch/local/linux' make: *** [Makefile:82: modules] Error 2
Quoted 2 lines
With
fd117d03cefd15("mm/sparsemem: fix race in accessingmemory_section->usage") reverted, the build completes.
Sorry, that was my revert patch. Its b448de2459b6d6 ("mm/sparsemem: fix race in accessing memory_section->usage").
D.
Quoted 3 lines
Best
Donald
Signature · 3 lines
Donald Buczek [email protected] Tel: +49 30 8413 1433
Greg Kroah-Hartman
maintainerRe: [PATCH 5.15 108/476] mm/sparsemem: fix race in accessing memory_section->usage
In reply to Donald BuczekQuoted 3 lines · Donald Buczek
Maybe this is already known, but just FYI I wanted to drop the note that for some reasons I don't understand, this patch prevents me from compiling the proprietary Nvidia Unix driver with versions 510.108.03 and 535.104.05 in the 5.15 series.
For obvious reasons, we do not, and can not, care one bit about closed source kernel modules or any other sort of kernel code that is outside of our kernel tree. The companies involved in doing stuff like this take full responsibility for keeping their code up to date, all the while forcing you to be the one that violates the license of the kernel.
In other words, please ask them for support for stuff like this, they are the ones you are paying money to for support for this type of thing, and the ones that are putting you at risk of legal issues, and there's nothing that we could do about it even if we wanted to.
best of luck,
greg k-h
Re: [PATCH 5.15 108/476] mm/sparsemem: fix race in accessing memory_section->usage
Quoted 11 lines · Greg Kroah-Hartman
Quoted 3 lines · Donald Buczek
Maybe this is already known, but just FYI I wanted to drop the note that for some reasons I don't understand, this patch prevents me from compiling the proprietary Nvidia Unix driver with versions 510.108.03 and 535.104.05 in the 5.15 series.
For obvious reasons, we do not, and can not, care one bit about closed source kernel modules or any other sort of kernel code that is outside of our kernel tree. The companies involved in doing stuff like this take full responsibility for keeping their code up to date, all the while forcing you to be the one that violates the license of the kernel.
Quoted 4 lines
In other words, please ask them for support for stuff like this, they are the ones you are paying money to for support for this type of thing, and the ones that are putting you at risk of legal issues, and there's nothing that we could do about it even if we wanted to.
Really? Did I ask anything? Wasn't "just FYI" not clear enough? Maybe you are not interested, but maybe somebody else is. And if you think my mail is just noise, why did you reply at all?
Best
Donald
Quoted 3 lines
best of luck,
greg k-h
Signature · 3 lines
Donald Buczek [email protected] Tel: +49 30 8413 1433
Greg Kroah-Hartman
maintainerPATCH 109/476 PM / devfreq: Fix buffer overflow in trans_stat_show
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Marangi <[email protected]>
[ Upstream commit 08e23d05fa6dc4fc13da0ccf09defdd4bbc92ff4 ]
Fix buffer overflow in trans_stat_show().
Convert simple snprintf to the more secure scnprintf with size of PAGE_SIZE.
Add condition checking if we are exceeding PAGE_SIZE and exit early from loop. Also add at the end a warning that we exceeded PAGE_SIZE and that stats is disabled.
Return -EFBIG in the case where we don't have enough space to write the full transition table.
Also document in the ABI that this function can return -EFBIG error.
--- Documentation/ABI/testing/sysfs-class-devfreq | 3 + drivers/devfreq/devfreq.c | 59 +++++++++++++++++--------- 2 files changed, 43 insertions(+), 19 deletions(-)
Documentation/ABI/testing/sysfs-class-devfreq +3 -0
@@ -52,6 +52,9 @@ Description: echo 0 > /sys/class/devfreq/.../trans_stat + If the transition table is bigger than PAGE_SIZE, reading + this will return an -EFBIG error. + What: /sys/class/devfreq/.../available_frequencies Date: October 2012 Contact: Nishanth Menon <[email protected]>
drivers/devfreq/devfreq.c +40 -19
87 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 110/476 btrfs: add definition for EXTENT_TREE_V2
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
[ Upstream commit 2c7d2a230237e7c43fa067d695937b7e484bb92a ]
This adds the initial definition of the EXTENT_TREE_V2 incompat feature flag. This also hides the support behind CONFIG_BTRFS_DEBUG.
THIS IS A IN DEVELOPMENT FORMAT CHANGE, DO NOT USE UNLESS YOU ARE A DEVELOPER OR A TESTER.
The format is in flux and will be added in stages, any fs will need to be re-made between updates to the format.
Stable-dep-of: 7081929ab257 ("btrfs: don't abort filesystem when attempting to snapshot deleted subvolume")
--- fs/btrfs/ctree.h | 21 +++++++++++++++++++++ fs/btrfs/sysfs.c | 5 ++++- include/uapi/linux/btrfs.h | 1 + 3 files changed, 26 insertions(+), 1 deletion(-)
fs/btrfs/ctree.h +21 -0
@@ -282,6 +282,26 @@ struct btrfs_super_block {#define BTRFS_FEATURE_COMPAT_RO_SAFE_SET 0ULL#define BTRFS_FEATURE_COMPAT_RO_SAFE_CLEAR 0ULL +#ifdef CONFIG_BTRFS_DEBUG +/* +* Extent tree v2 supported only with CONFIG_BTRFS_DEBUG +*/ +#define BTRFS_FEATURE_INCOMPAT_SUPP \ + (BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF | \ + BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL | \ + BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS | \ + BTRFS_FEATURE_INCOMPAT_BIG_METADATA | \ + BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO | \ + BTRFS_FEATURE_INCOMPAT_COMPRESS_ZSTD | \ + BTRFS_FEATURE_INCOMPAT_RAID56 | \ + BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF | \ + BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA | \ + BTRFS_FEATURE_INCOMPAT_NO_HOLES | \ + BTRFS_FEATURE_INCOMPAT_METADATA_UUID | \ + BTRFS_FEATURE_INCOMPAT_RAID1C34 | \ + BTRFS_FEATURE_INCOMPAT_ZONED | \ + BTRFS_FEATURE_INCOMPAT_EXTENT_TREE_V2) +#else #define BTRFS_FEATURE_INCOMPAT_SUPP \ (BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF | \ BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL | \
@@ -296,6 +316,7 @@ struct btrfs_super_block { BTRFS_FEATURE_INCOMPAT_METADATA_UUID | \ BTRFS_FEATURE_INCOMPAT_RAID1C34 | \ BTRFS_FEATURE_INCOMPAT_ZONED) +#endif #define BTRFS_FEATURE_INCOMPAT_SAFE_SET \ (BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF)
fs/btrfs/sysfs.c +4 -1
@@ -283,9 +283,11 @@ BTRFS_FEAT_ATTR_INCOMPAT(no_holes, NO_HOLES);BTRFS_FEAT_ATTR_INCOMPAT (metadata_uuid,METADATA_UUID );BTRFS_FEAT_ATTR_COMPAT_RO (free_space_tree,FREE_SPACE_TREE );BTRFS_FEAT_ATTR_INCOMPAT (raid1c34,RAID1C34 ); -/* Remove once support for zoned allocation is feature complete */ #ifdef CONFIG_BTRFS_DEBUG +/* Remove once support for zoned allocation is feature complete */ BTRFS_FEAT_ATTR_INCOMPAT (zoned,ZONED ); +/* Remove once support for extent tree v2 is feature complete */ +BTRFS_FEAT_ATTR_INCOMPAT (extent_tree_v2,EXTENT_TREE_V2 );#endif #ifdef CONFIG_FS_VERITY BTRFS_FEAT_ATTR_COMPAT_RO (verity,VERITY );
@@ -314,6 +316,7 @@ static struct attribute *btrfs_supported_feature_attrs[] = { BTRFS_FEAT_ATTR_PTR(raid1c34),#ifdef CONFIG_BTRFS_DEBUG BTRFS_FEAT_ATTR_PTR(zoned), + BTRFS_FEAT_ATTR_PTR(extent_tree_v2),#endif #ifdef CONFIG_FS_VERITY BTRFS_FEAT_ATTR_PTR(verity),
include/uapi/linux/btrfs.h +1 -0
@@ -310,6 +310,7 @@ struct btrfs_ioctl_fs_info_args {#define BTRFS_FEATURE_INCOMPAT_METADATA_UUID (1ULL << 10)#define BTRFS_FEATURE_INCOMPAT_RAID1C34 (1ULL << 11)#define BTRFS_FEATURE_INCOMPAT_ZONED (1ULL << 12) +#define BTRFS_FEATURE_INCOMPAT_EXTENT_TREE_V2 (1ULL << 13)struct btrfs_ioctl_feature_flags {__u64 compat_flags;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 111/476 NFSD: Modernize nfsd4_release_lockowner()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit bd8fdb6e545f950f4654a9a10d7e819ad48146e5 ]
Refactor: Use existing helpers that other lock operations use. This change removes several automatic variables, so re-organize the variable declarations for readability.
Stable-dep-of: edcf9725150e ("nfsd: fix RELEASE_LOCKOWNER")
--- fs/nfsd/nfs4state.c | 36 +++++++++++------------------------- 1 file changed, 11 insertions(+), 25 deletions(-)
fs/nfsd/nfs4state.c +11 -25
@@ -7290,16 +7290,13 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp, union nfsd4_op_u *u) {struct nfsd4_release_lockowner *rlockowner = &u->release_lockowner; +struct nfsd_net *nn =net_generic (SVC_NET (rqstp), nfsd_net_id);clientid_t *clid = &rlockowner->rl_clientid; -struct nfs4_stateowner *sop; -struct nfs4_lockowner *lo =NULL ;struct nfs4_ol_stateid *stp; -struct xdr_netobj *owner = &rlockowner->rl_owner; -unsigned int hashval =ownerstr_hashval (owner); -__be32 status; -struct nfsd_net *nn =net_generic (SVC_NET (rqstp), nfsd_net_id); +struct nfs4_lockowner *lo;struct nfs4_client *clp; -LIST_HEAD (reaplist); +LIST_HEAD (reaplist); +__be32 status;dprintk ("nfsd4_release_lockowner clientid: (%08x/%08x):\n" , clid->cl_boot, clid->cl_id);
@@ -7307,30 +7304,19 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp, status =set_client (clid, cstate, nn);if (status)return status; - clp = cstate->clp; -/* Find the matching lock stateowner */ -spin_lock (&clp->cl_lock); -list_for_each_entry (sop, &clp->cl_ownerstr_hashtbl[hashval], - so_strhash) { -if (sop->so_is_open_owner || !same_owner_str (sop, owner)) -continue ; - -if (atomic_read (&sop->so_count) !=1 ) { -spin_unlock (&clp->cl_lock); -return nfserr_locks_held; - } - - lo =lockowner (sop); -nfs4_get_stateowner (sop); -break ; - } +spin_lock (&clp->cl_lock); + lo =find_lockowner_str_locked (clp, &rlockowner->rl_owner);if (!lo) {spin_unlock (&clp->cl_lock);return status; } - +if (atomic_read (&lo->lo_owner.so_count) !=2 ) { +spin_unlock (&clp->cl_lock); +nfs4_put_stateowner (&lo->lo_owner); +return nfserr_locks_held; + }unhash_lockowner_locked (lo);while (!list_empty (&lo->lo_owner.so_stateids)) { stp = list_first_entry(&lo->lo_owner.so_stateids,
Signature · 1 line
2.43.0
Re: [PATCH 5.15 111/476] NFSD: Modernize nfsd4_release_lockowner()
Hi,
Quoted 8 lines
5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit
bd8fdb6e545f950f4654a9a10d7e819ad48146e5]
Quoted 7 lines
Refactor: Use existing helpers that other lock operations use. This change removes several automatic variables, so re-organize the variable declarations for readability.
Signed-off-by Chuck Lever <[email protected]>Stable-dep-of:
edcf9725150e("nfsd: fixRELEASE_LOCKOWNER")Signed-off-by Sasha Levin <[email protected]>
"nfsd: fix RELEASE_LOCKOWNER" is yet not in 5.15.149-rc1? or I missed something?
Best Regards
Wang Yugui ([email protected])
2024/02/22
Greg Kroah-Hartman
maintainerRe: [PATCH 5.15 111/476] NFSD: Modernize nfsd4_release_lockowner()
Quoted 15 lines · Wang Yugui
Hi,
Quoted 12 lines
5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit
bd8fdb6e545f950f4654a9a10d7e819ad48146e5]Refactor: Use existing helpers that other lock operations use. This change removes several automatic variables, so re-organize the variable declarations for readability.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Chuck Lever <[email protected]>Stable-dep-of:
edcf9725150e("nfsd: fixRELEASE_LOCKOWNER")Signed-off-by Sasha Levin <[email protected]>"nfsd: fix
RELEASE_LOCKOWNER" is yet not in 5.15.149-rc1? or I missed something?
Good catch, you are correct! I'll go drop this, and the other nfsd "dep-of" commit in this queue, and in the 5.10 and 5.4 queues.
thanks,
greg k-h
Re: [PATCH 5.15 111/476] NFSD: Modernize nfsd4_release_lockowner()
Hi,
Quoted 21 lines · Wang Yugui
Quoted 20 lines
Hi,
Quoted 15 lines
5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit
bd8fdb6e545f950f4654a9a10d7e819ad48146e5]Refactor: Use existing helpers that other lock operations use. This change removes several automatic variables, so re-organize the variable declarations for readability.
Signed-off-by Chuck Lever <[email protected]>Stable-dep-of:
edcf9725150e("nfsd: fixRELEASE_LOCKOWNER")Signed-off-by Sasha Levin <[email protected]>
Quoted 5 lines
Quoted 2 lines
"nfsd: fix
RELEASE_LOCKOWNER" is yet not in 5.15.149-rc1? or I missed something?Good catch, you are correct! I'll go drop this, and the other nfsd "dep-of" commit in this queue, and in the 5.10 and 5.4 queues.
Will we add "nfsd: fix RELEASE_LOCKOWNER" to 5.15.y later?
It seems that at least 5.15.y need "nfsd: fix RELEASE_LOCKOWNER".
Best Regards
Wang Yugui ([email protected])
2024/02/22
Greg Kroah-Hartman
maintainerRe: [PATCH 5.15 111/476] NFSD: Modernize nfsd4_release_lockowner()
Quoted 26 lines · Wang Yugui
Hi,
Quoted 24 lines · Wang Yugui
Quoted 22 lines
Hi,
Quoted 8 lines
5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit
bd8fdb6e545f950f4654a9a10d7e819ad48146e5]Quoted 7 lines
Refactor: Use existing helpers that other lock operations use. This change removes several automatic variables, so re-organize the variable declarations for readability.
Signed-off-by Chuck Lever <[email protected]>Stable-dep-of:
edcf9725150e("nfsd: fixRELEASE_LOCKOWNER")Signed-off-by Sasha Levin <[email protected]>"nfsd: fix
RELEASE_LOCKOWNER" is yet not in 5.15.149-rc1? or I missed something?
Quoted 6 lines
Quoted 2 lines
Good catch, you are correct! I'll go drop this, and the other nfsd "dep-of" commit in this queue, and in the 5.10 and 5.4 queues.
Will we add "nfsd: fix
RELEASE_LOCKOWNER" to 5.15.y later?It seems that at least 5.15.y need "nfsd: fix
RELEASE_LOCKOWNER".
If someone sends a properly tested and backported series, sure!
thanks,
greg k-h
Re: [PATCH 5.15 111/476] NFSD: Modernize nfsd4_release_lockowner()
In reply to Wang YuguiQuoted 30 lines · Wang Yugui
Hi,
Quoted 24 lines · Wang Yugui
Quoted 22 lines
Hi,
Quoted 8 lines
5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit
bd8fdb6e545f950f4654a9a10d7e819ad48146e5]Quoted 7 lines
Refactor: Use existing helpers that other lock operations use. This change removes several automatic variables, so re-organize the variable declarations for readability.
Signed-off-by Chuck Lever <[email protected]>Stable-dep-of:
edcf9725150e("nfsd: fixRELEASE_LOCKOWNER")Signed-off-by Sasha Levin <[email protected]>"nfsd: fix
RELEASE_LOCKOWNER" is yet not in 5.15.149-rc1? or I missed something?
Quoted 6 lines
Quoted 2 lines
Good catch, you are correct! I'll go drop this, and the other nfsd "dep-of" commit in this queue, and in the 5.10 and 5.4 queues.
Will we add "nfsd: fix
RELEASE_LOCKOWNER" to 5.15.y later?It seems that at least 5.15.y need "nfsd: fix
RELEASE_LOCKOWNER".
Hi Wang-
I asked Greg and Sasha to hold off on that one (and its follow-on fix) until I can get them properly tested with 5.15.y (and 5.10.y).
--
Chuck Lever
Greg Kroah-Hartman
maintainerPATCH 112/476 NFSD: Add documenting comment for nfsd4_release_lockowner()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit 043862b09cc00273e35e6c3a6389957953a34207 ]
And return explicit nfserr values that match what is documented in the new comment / API contract.
Stable-dep-of: edcf9725150e ("nfsd: fix RELEASE_LOCKOWNER")
--- fs/nfsd/nfs4state.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
fs/nfsd/nfs4state.c +20 -3
@@ -7284,6 +7284,23 @@ check_for_locks(struct nfs4_file *fp, struct nfs4_lockowner *lowner)return status; } +/** +* nfsd4_release_lockowner - process NFSv4.0 RELEASE_LOCKOWNER operations +* @rqstp: RPC transaction +* @cstate: NFSv4 COMPOUND state +* @u: RELEASE_LOCKOWNER arguments +* +* The lockowner's so_count is bumped when a lock record is added +* or when copying a conflicting lock. The latter case is brief, +* but can lead to fleeting false positives when looking for +* locks-in-use. +* +* Return values: +* %nfs_ok: lockowner released or not found +* %nfserr_locks_held: lockowner still in use +* %nfserr_stale_clientid: clientid no longer active +* %nfserr_expired: clientid not recognized +*/ __be32 nfsd4_release_lockowner(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
@@ -7310,7 +7327,7 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp, lo =find_lockowner_str_locked (clp, &rlockowner->rl_owner);if (!lo) {spin_unlock (&clp->cl_lock); -return status; +return nfs_ok; }if (atomic_read (&lo->lo_owner.so_count) !=2 ) {spin_unlock (&clp->cl_lock);
@@ -7326,11 +7343,11 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp,put_ol_stateid_locked (stp, &reaplist); }spin_unlock (&clp->cl_lock); +free_ol_stateid_reaplist (&reaplist);remove_blocked_locks (lo);nfs4_put_stateowner (&lo->lo_owner); - -return status; +return nfs_ok; } static inline struct nfs4_client_reclaim *
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 113/476 ksmbd: fix global oob in ksmbd_nl_policy
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lin Ma <[email protected]>
[ Upstream commit ebeae8adf89d9a82359f6659b1663d09beec2faa ]
Similar to a reported issue (check the commit b33fb5b801c6 ("net:
qualcomm: rmnet: fix global oob in rmnet_policy"), my local fuzzer finds another global out-of-bounds read for policy ksmbd_nl_policy. See bug trace below:
==================================================================
BUG: KASAN: global-out-of-bounds in validate_nla lib/nlattr.c:386 [inline]
BUG: KASAN: global-out-of-bounds in __nla_validate_parse+0x24af/0x2750 lib/nlattr.c:600
Read of size 1 at addr ffffffff8f24b100 by task syz-executor.1/62810
CPU: 0 PID: 62810 Comm: syz-executor.1 Tainted: G N 6.1.0 #3
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x8b/0xb3 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:284 [inline]
print_report+0x172/0x475 mm/kasan/report.c:395
kasan_report+0xbb/0x1c0 mm/kasan/report.c:495
validate_nla lib/nlattr.c:386 [inline]
__nla_validate_parse+0x24af/0x2750 lib/nlattr.c:600
__nla_parse+0x3e/0x50 lib/nlattr.c:697
__nlmsg_parse include/net/netlink.h:748 [inline]
genl_family_rcv_msg_attrs_parse.constprop.0+0x1b0/0x290 net/netlink/genetlink.c:565
genl_family_rcv_msg_doit+0xda/0x330 net/netlink/genetlink.c:734
genl_family_rcv_msg net/netlink/genetlink.c:833 [inline]
genl_rcv_msg+0x441/0x780 net/netlink/genetlink.c:850
netlink_rcv_skb+0x14f/0x410 net/netlink/af_netlink.c:2540
genl_rcv+0x24/0x40 net/netlink/genetlink.c:861
netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
netlink_unicast+0x54e/0x800 net/netlink/af_netlink.c:1345
netlink_sendmsg+0x930/0xe50 net/netlink/af_netlink.c:1921
sock_sendmsg_nosec net/socket.c:714 [inline]
sock_sendmsg+0x154/0x190 net/socket.c:734
____sys_sendmsg+0x6df/0x840 net/socket.c:2482
___sys_sendmsg+0x110/0x1b0 net/socket.c:2536
__sys_sendmsg+0xf3/0x1c0 net/socket.c:2565
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fdd66a8f359
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fdd65e00168 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007fdd66bbcf80 RCX: 00007fdd66a8f359
RDX: 0000000000000000 RSI: 0000000020000500 RDI: 0000000000000003
RBP: 00007fdd66ada493 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffc84b81aff R14: 00007fdd65e00300 R15: 0000000000022000
</TASK>
The buggy address belongs to the variable:
ksmbd_nl_policy+0x100/0xa80
The buggy address belongs to the physical page:
page:0000000034f47940 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1ccc4b
flags: 0x200000000001000(reserved|node=0|zone=2)
raw: 0200000000001000 ffffea00073312c8 ffffea00073312c8 0000000000000000
raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffffffff8f24b000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffffffff8f24b080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffffffff8f24b100: f9 f9 f9 f9 00 00 f9 f9 f9 f9 f9 f9 00 00 07 f9
^
ffffffff8f24b180: f9 f9 f9 f9 00 05 f9 f9 f9 f9 f9 f9 00 00 00 05
ffffffff8f24b200: f9 f9 f9 f9 00 00 03 f9 f9 f9 f9 f9 00 00 04 f9
==================================================================To fix it, add a placeholder named __KSMBD_EVENT_MAX and let KSMBD_EVENT_MAX to be its original value - 1 according to what other netlink families do. Also change two sites that refer the KSMBD_EVENT_MAX to correct value.
--- fs/ksmbd/ksmbd_netlink.h | 3 ++- fs/ksmbd/transport_ipc.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-)
fs/ksmbd/ksmbd_netlink.h +2 -1
@@ -304,7 +304,8 @@ enum ksmbd_event {KSMBD_EVENT_SPNEGO_AUTHEN_REQUEST ,KSMBD_EVENT_SPNEGO_AUTHEN_RESPONSE =15 , - KSMBD_EVENT_MAX + __KSMBD_EVENT_MAX, + KSMBD_EVENT_MAX = __KSMBD_EVENT_MAX - 1 };/*
fs/ksmbd/transport_ipc.c +2 -2
@@ -74,7 +74,7 @@ static int handle_unsupported_event(struct sk_buff *skb, struct genl_info *info)static int handle_generic_event (struct sk_buff *skb,struct genl_info *info);static int ksmbd_ipc_heartbeat_request (void ); -static const struct nla_policy ksmbd_nl_policy[KSMBD_EVENT_MAX ] = { +static const struct nla_policy ksmbd_nl_policy[KSMBD_EVENT_MAX +1 ] = { [KSMBD_EVENT_UNSPEC ] = { .len =0 , },
@@ -402,7 +402,7 @@ static int handle_generic_event(struct sk_buff *skb, struct genl_info *info)return -EPERM ;#endif -if (type >=KSMBD_EVENT_MAX ) { +if (type >KSMBD_EVENT_MAX ) {WARN_ON (1 );return -EINVAL ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 114/476 cpufreq: intel_pstate: Drop redundant intel_pstate_get_hwp_cap() call
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
[ Upstream commit 458b03f81afbb27143c45d47c2d8f418b2ba2407 ]
It is not necessary to call intel_pstate_get_hwp_cap() from intel_pstate_update_perf_limits(), because it gets called from intel_pstate_verify_cpu_policy() which is either invoked directly right before intel_pstate_update_perf_limits(), in intel_cpufreq_verify_policy() in the passive mode, or called from driver callbacks in a sequence that causes it to be followed by an immediate intel_pstate_update_perf_limits().
Namely, in the active mode intel_cpufreq_verify_policy() is called by intel_pstate_verify_policy() which is the ->verify() callback routine of intel_pstate and gets called by the cpufreq core right before intel_pstate_set_policy(), which is the driver's ->setoplicy() callback routine, where intel_pstate_update_perf_limits() is called.
Stable-dep-of: 192cdb1c907f ("cpufreq: intel_pstate: Refine computation of P-state for given frequency")
--- drivers/cpufreq/intel_pstate.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
drivers/cpufreq/intel_pstate.c +8 -12
@@ -2332,18 +2332,14 @@ static void intel_pstate_update_perf_limits(struct cpudata *cpu,* HWP needs some special consideration, because HWP_REQUEST uses * abstract values to represent performance rather than pure ratios. */ -if (hwp_active) { -intel_pstate_get_hwp_cap (cpu); - -if (cpu->pstate.scaling != perf_ctl_scaling) { -int scaling = cpu->pstate.scaling; -int freq; - - freq = max_policy_perf * perf_ctl_scaling; - max_policy_perf =DIV_ROUND_UP (freq, scaling); - freq = min_policy_perf * perf_ctl_scaling; - min_policy_perf =DIV_ROUND_UP (freq, scaling); - } +if (hwp_active && cpu->pstate.scaling != perf_ctl_scaling) { +int scaling = cpu->pstate.scaling; +int freq; + + freq = max_policy_perf * perf_ctl_scaling; + max_policy_perf =DIV_ROUND_UP (freq, scaling); + freq = min_policy_perf * perf_ctl_scaling; + min_policy_perf =DIV_ROUND_UP (freq, scaling); } pr_debug("cpu:%d min_policy_perf:%d max_policy_perf:%d\n",
Signature · 1 line
2.43.0