5.15.224-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainercover 5.15.224-rc1 review
This is the start of the stable review cycle for the 5.15.224 release. There are 571 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, 30 Oct 2026 16:59:22 +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.224-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.224-rc1
Christian Brauner <[email protected]>
signal: don't retarget shared signals in a dying thread group
Christian Brauner <[email protected]>
io-wq: order the exit bit against worker creation task work
Srish Srinivasan <[email protected]>
keys/trusted_keys: return immediately after TPM unseal failure
Stefano Garzarella <[email protected]>
KEYS: trusted: Fix blob allocation size in tpm2_key_decode()
Adrian Martinez <[email protected]>
KEYS: Fix key_reject_and_link() race with keyring restriction
Cen Zhang <[email protected]>
keys: Protect the read method check against type removal
Kyle Zeng <[email protected]>
keys: make keyring indexes independent of kernel addresses
Cen Zhang <[email protected]>
keys: Protect the type name while describing a key
Cen Zhang <[email protected]>
keys: Check the authorization payload in process keyring searches
Cen Zhang <[email protected]>
keys: Avoid the owner account dereference in named keyring lookup
Donggeun Yoo <[email protected]>
tracing: Fix 64-bit and signed histogram fields on 32-bit kernels
Donggeun Yoo <[email protected]>
tracing: Unregister field variable histograms when the command fails
Donggeun Yoo <[email protected]>
tracing: Save the event file instead of the compatible histogram
Kyle Zeng <[email protected]>
tracing: Reject incomplete event filter expressions
Pauli Virtanen <[email protected]>
Bluetooth: L2CAP: refuse __l2cap_chan_add if chan already has conn
Pauli Virtanen <[email protected]>
Bluetooth: L2CAP: access chan->conn safely in get/setsockopt
Jonas Köppeler <[email protected]>
net_sched: codel: fix stale state for empty flows in fq_codel
Yu Kuai <[email protected]>
md: move initialization and destruction of 'io_acct_set' to md.c
Pablo Neira Ayuso <[email protected]>
netfilter: nf_tables: unconditionally bump set->nelems before insertion
Florian Westphal <[email protected]>
netfilter: nf_tables: always increment set element count
Xiang Mei <[email protected]>
net: bonding: fix use-after-free in bond_xmit_broadcast()
Aleksandr Khromov <[email protected]>
ksmbd: fill in FileSysIdentifier in FS_POSIX_INFORMATION
Aleksandr Khromov <[email protected]>
ksmbd: zero the FS_OBJECT_ID_INFORMATION buffer before filling it in
Aleksandr Khromov <[email protected]>
ksmbd: initialize FileSystemControlFlags in FS_CONTROL_INFORMATION
Yun Zhou <[email protected]>
xfs: don't hold buffer locks across sync transaction commit in xfs_sync_sb_buf
Frank Sorenson <[email protected]>
cifs: add revalidation on FSCTL failure in smb2_duplicate_extents()
Ben Cressey <[email protected]>
dm-integrity: fix infinite loop on discard with large tag size
Dibin Moolakadan Subrahmanian <[email protected]>
drm/i915/dmc: Harden DMC firmware payload parsing
Jann Horn <[email protected]>
futex: Fix mm reuse handling for FUT_OFF_MMSHARED
Wentao Liang <[email protected]>
i2c: viai2c-wmt: Fix clock leak in wmt_i2c_probe()
Ido Schimmel <[email protected]>
ipv4: udp: Create exceptions before socket matching
Daehyeon Ko <[email protected]>
vsock/virtio: validate packet source for connected sockets
Chen Cheng <[email protected]>
dm-integrity: require stable writes for internal hash modes
Florian Westphal <[email protected]>
netfilter: nf_tables: always walk all pending catchall elements
Ido Schimmel <[email protected]>
bridge: mcast: Fix use-after-free during router port configuration
Usama Arif <[email protected]>
mm/huge_memory: transfer the pmd dirty bit to the folio on zap
Linmao Li <[email protected]>
Input: byd - synchronize timer deletion before freeing private data
Christian Brauner <[email protected]>
unicode: free the map after a grace period
Cen Zhang (Microsoft) <[email protected]>
watch_queue: Fix note pool publication race in watch_queue_set_size()
Daniil Stas <[email protected]>
hwmon: (drivetemp) Fix driver producing garbage data when SCSI errors occur
Fuad Tabba <[email protected]>
KVM: arm64: vgic-its: Don't dereference a NULL collection on ITT save
Laurence Oberman <[email protected]>
scsi: st: Fix use-after-free race between st_remove() and st_open()
Lee Jones <[email protected]>
tracing/histograms: Reject non-stacktrace fields for synthetic stacktrace fields
Aohan Mei <[email protected]>
net/sched: cls_flower: validate mask pointer after nla_next()
Jun Yang <[email protected]>
net: bridge: mcast: don't truncate the port group walk on teardown
Hyunwoo Kim <[email protected]>
KVM: x86/mmu: Preserve nested TDP shadow page tables if they are used as roots
Di Shen <[email protected]>
OPP: Fix race between OPP addition and lookup
Zhang Changzhong <[email protected]>
net/sched: cls_u32: skip hash tables in u32_bind_class()
Linus Torvalds <[email protected]>
security/keys: fix missed RCU read section on lookup
David Rosca <[email protected]>
drm/amdgpu: Fix VCE 3 ring align_mask
Lorenzo Stoakes (ARM) <[email protected]>
mm/vmalloc: acquire init_mm lock on huge vmap to avoid ptdump UAF
Zihan Xi <[email protected]>
ipv4: avoid divide by zero in fib_rebalance
Niklas Schnelle <[email protected]>
s390/pci: Fix leak of uninitialized kernel data in SCLP report
Aswin Karuvally <[email protected]>
s390/ctcm: Prevent XID null dereference
Florian Schauer <[email protected]>
page_pool: keep frag_offset aligned for odd-sized requests
Charles Vosburgh <[email protected]>
sctp: validate chunk length in the inqueue parser
Chengfeng Ye <[email protected]>
tipc: protect node reset trace dump with node lock
Bryam Vargas <[email protected]>
net/iucv: fix the recvmsg window update
Genjian Zhang <[email protected]>
dm-ebs: fix incorrect device offset check in ebs_ctr()
Ben Cressey <[email protected]>
dm-crypt: fix a tiny race condition in crypt_dec_pending
Benjamin Marzinski <[email protected]>
dm cache: fix issue with background work locking
Ming-Hung Tsai <[email protected]>
dm cache: fix demotion stats in passthrough mode
Etienne Perot <[email protected]>
cgroup: fix spurious SIGKILL of CLONE_INTO_CGROUP children
Cen Zhang (Microsoft Security FORGE Labs) <[email protected]>
tcp: fix use-after-free in do_tcp_getsockopt(TCP_CC_INFO)
Heyang Tan <[email protected]>
wifi: p54: validate firmware record lengths
Tengda Wu <[email protected]>
tracing: Fix hist trigger timestamps for buffered events
Donggeun Yoo <[email protected]>
tracing: Fix the shift out of bounds in the log2 histogram modifier
Jesse Zhang <[email protected]>
drm/amdgpu: don't drop the runtime PM reference twice in amdgpu_gpr
Timur Kristóf <[email protected]>
drm/amdgpu/sdma3: Work around POLL_REGMEM / FENCE hang
Yehyeong Lee <[email protected]>
scsi: libiscsi: Validate the task named by a management response
Yehyeong Lee <[email protected]>
scsi: libiscsi: Validate the ITT reflected in a Reject PDU
Yehyeong Lee <[email protected]>
scsi: libiscsi: Reject a negative task index from parse_pdu_itt
Loic Poulain <[email protected]>
i2c: qcom-cci: Fix HALT_ACK reset request being dropped
Sasha Levin <[email protected]>
tools: gpio: fix building from the top level with O=
Daehyeon Ko <[email protected]>
sctp: revalidate output stream after association connect wait
Aohan Mei <[email protected]>
net: rds: fix uninitialized trans dereference in CM event handler
Jérémy Jean <[email protected]>
net/sched: fix use-after-free in __tcf_action_put()
Kyle Zeng <[email protected]>
fsnotify: prevent mark additions during connector teardown
Amirmohammad Eftekhar <[email protected]>
KVM: nVMX: Reset MMU back to the root MMU if loading L2 state fails for !VM-Entry
Sung Byeongchan <[email protected]>
autofs: ignore notification errors from a replaced pipe
Kyle Zeng <[email protected]>
netlink: avoid hashing the network namespace pointer
Kyle Zeng <[email protected]>
pipe: preserve existing fasync readers on writer setup failure
Nickolai Zeldovich <[email protected]>
exit: fix lost-update race on the child_subreaper bitfields
Christian Brauner <[email protected]>
clone: add CLONE_AUTOREAP
Sasha Levin <[email protected]>
samples: pidfd: fix userprogs typo
Cen Zhang <[email protected]>
ocfs2/dlm: Protect the recovery list during debugfs reads
Linfeng Sun <[email protected]>
scsi: target: iscsi: Fix race in discovery auth updates
Laurence Oberman <[email protected]>
scsi: st: Save the visited block for the partition the drive is in
Keith Busch <[email protected]>
nios2: fix __wsum type degradation in csum_fold()
Kyle Zeng <[email protected]>
netlink: reset skb headers before unicast and multicast filtering
Anjali Kulkarni <[email protected]>
netlink: Reverse the patch which removed filtering
Florian Westphal <[email protected]>
netlink: remove netlink_broadcast_filtered
HyeongJun An <[email protected]>
ASoC: nau8822: Fix the 128x oversampling switch bits
HyeongJun An <[email protected]>
ASoC: wm8978: Fix the 128x oversampling switch bits
HyeongJun An <[email protected]>
ASoC: max98371: Fix the Speaker DHT Min Volume bits
HyeongJun An <[email protected]>
ASoC: pcm3168a: Fix the DAC zero flag polarity bit
HyeongJun An <[email protected]>
ASoC: cs42l52: Fix the NG Type Switch bit
HyeongJun An <[email protected]>
ASoC: cs42l56: Put the Limiter Cushion control on the limiter register
Avi Weiss <[email protected]>
ASoC: stm32: spdifrx: fix synchronization state check
Allison Henderson <[email protected]>
net/rds: don't let the rdma_cm destroy an id RDS still owns on route failure
Michal Luczaj <[email protected]>
vsock: treat TCP_CLOSING as once-established
Michael Kelley <[email protected]>
Drivers: hv: Don't reset VMBus connection state on error/exit paths
Xueqin Luo <[email protected]>
power: supply: ds2780: Fix ds2780_get_capacity() returning raw value
Andrii Nakryiko <[email protected]>
bpf: fix potential 32-bit overflow when accessing ARRAY map element
Jinu Kim <[email protected]>
KVM: x86: Use active memslots for the per-vCPU MMIO cache
Ilan Dudnik <[email protected]>
ksmbd: fix heap out-of-bounds write in krb5_authenticate()
Dave Chinner <[email protected]>
xfs: fix unmount hang with unflushable inodes stuck in the AIL
Dave Chinner <[email protected]>
xfs: factor out stale buffer item completion
Dave Chinner <[email protected]>
xfs: rearrange code in xfs_buf_item.c
Dave Chinner <[email protected]>
xfs: catch stale AGF/AGF metadata
Dave Chinner <[email protected]>
xfs: xfs_ifree_cluster vs xfs_iflush_shutdown_abort deadlock
Dave Chinner <[email protected]>
xfs: buffer pins need to hold a buffer reference
Guo Xuenan <[email protected]>
xfs: fix super block buf log item UAF during force shutdown
Dave Chinner <[email protected]>
xfs: aborting inodes on shutdown may need buffer lock
Dave Chinner <[email protected]>
xfs: log items should have a xlog pointer, not a mount
Tahera Fahimi <[email protected]>
xfrm: prevent policy_hthresh.work from racing with netns teardown
Johan Hovold <[email protected]>
tty: add break_wait kernel-doc
Jiri Slaby <[email protected]>
tty: finish kernel-doc of tty_struct members
Florian Westphal <[email protected]>
netfilter: nf_tables: fix crash when nf_trace is enabled
Christian Brauner <[email protected]>
namespace: handle mount locking for automounts correctly
Christian Brauner <[email protected]>
fcntl: refuse F_SET_RW_HINT on an immutable inode
Christian Brauner <[email protected]>
namespace: check the target before walking it in do_mount_setattr()
Christian Brauner <[email protected]>
namespace: don't copy an unmounted mount tree
Christian Brauner <[email protected]>
namespace: unhash a dentry before detaching the mounts on it
Krzysztof Karas <[email protected]>
drm/i915/gt: Unmask interrupts only when ACTIVE is true
Nguyen Ngoc Thang <[email protected]>
drm/fb-helper: defer setup when fbdev_probe() fails, not just on -EAGAIN
Mikhail Gavrilov <[email protected]>
drm/amdgpu: copy debugfs register data outside the GRBM/SRBM locks
Ahmed Abdelhaleem Ahmed <[email protected]>
scsi: ch: Do not keep references to data transfer element devices
Shao-Fu Chen <[email protected]>
optee: register TEE devices only once fully initialized
Shawn Lin <[email protected]>
pmdomain: rockchip: propagate subdomain add errors
Shawn Lin <[email protected]>
pmdomain: rockchip: don't ignore clock lookup errors on attach
Shawn Lin <[email protected]>
pmdomain: rockchip: fix clock leak on domain probe failure
Mikulas Patocka <[email protected]>
dm: fix reading free memory in do_resume
Christian Brauner <[email protected]>
namespace: check the mounts before reading their parents in pivot_root()
Christian Brauner <[email protected]>
namespace: don't inherit MNT_UMOUNT in clone_mnt()
Zack Rusin <[email protected]>
drm/vmwgfx: validate pitch coming from userspace
Mikhail Gavrilov <[email protected]>
Bluetooth: RFCOMM: connect the session socket without rfcomm_mutex
Weiming Shi <[email protected]>
net: team: stop reusing skb after queue override
Weiming Shi <[email protected]>
net: team: fix NULL pointer dereference in team_xmit during mode change
Marc Harvey <[email protected]>
net: team: Rename port_disabled team mode op to port_tx_disabled
Marc Harvey <[email protected]>
net: team: Remove unused team_mode_op, port_enabled
Felix Fietkau <[email protected]>
netfilter: nf_tables: fix bidirectional offload regression
Lorenzo Stoakes (ARM) <[email protected]>
mm/mremap: fix locked_vm leak from MREMAP_DONTUNMAP self-merge
Lorenzo Stoakes (ARM) <[email protected]>
mm/mremap: fix locked_vm leak by splitting VMA for MREMAP_DONTUNMAP
Vishal Badole <[email protected]>
EDAC/amd64: Mask UMC chip select to the four implemented selects
Christian Göttsche <[email protected]>
selinux: fix data race on AVC latest_notif
Daehyeon Ko <[email protected]>
ip6_gre: remove obsolete ERSPAN PMTU update
Donggeun Yoo <[email protected]>
tracing: Set the trace clock before registering the histogram trigger
Vicki Pfau <[email protected]>
HID: steam: Clean up locking
Vicki Pfau <[email protected]>
HID: steam: Refactor registration
Vicki Pfau <[email protected]>
HID: steam: Rearrange teardown sequence
Vicki Pfau <[email protected]>
HID: steam: Fully unregister controller when hidraw is opened
Vicki Pfau <[email protected]>
HID: hid-steam: Make client_opened a counter
Dan Carpenter <[email protected]>
HID: hid-steam: Fix cleanup in probe()
Adrian Betschart <[email protected]>
drm/amd/display: Don't replace a sink mode that shares the native totals
Oliver Hartkopp <[email protected]>
can: fix unique skb identifier regression under RPS
Eric Dumazet <[email protected]>
ipv6: use RCU in ip6_xmit()
Frank Sorenson <[email protected]>
smb: client: reject short Next offsets in parse_server_interfaces()
Steve French <[email protected]>
smb3: fix for slab out of bounds on mount to ksmbd
Dan Carpenter <[email protected]>
cifs: fix underflow in parse_server_interfaces()
Pablo Neira Ayuso <[email protected]>
netfilter: nf_tables: release flowtable after rcu grace period on error
Ilya Maximets <[email protected]>
openvswitch: vport: fix self-deadlock on release of tunnel ports
Yang Yang <[email protected]>
openvswitch: defer tunnel netdev_put to RCU release
Ezrak1e <[email protected]>
dlm: validate length in dlm_search_rsb_tree
Xue Lei <[email protected]>
mtd: fix double free and WARN_ON in add_mtd_device() error paths
Miquel Raynal <[email protected]>
mtd: maps: vmu-flash: Fix the (mtd core) switch to ref counters
Miquel Raynal <[email protected]>
mtd: Clean refcounting with MTD_PARTITIONED_MASTER
Alexander Usyskin <[email protected]>
mtd: fix use-after-free in mtd release
Fernando Fernandez Mancera <[email protected]>
net: openvswitch: validate transport header presence in set_ipv6_addr
Li RongQing <[email protected]>
net/mlx5e: Order ICOSQ cc update after CQ doorbell
Eric Dumazet <[email protected]>
flow_dissector: avoid u16 truncation of hlen in bpf_flow_dissect()
Eric Dumazet <[email protected]>
flow_dissector: avoid u16 truncation of skb->len when computing thoff
Marek Szyprowski <[email protected]>
ASoC: samsung: i2s: enable op_clk in probe to balance runtime PM
Alvin Šipraga <[email protected]>
ASoC: adau1372: fix invalid default state of output ASRC and DAC muxes
Alvin Šipraga <[email protected]>
ASoC: adau1372: allow sleepy powerdown GPIOs
Sang-Hoon Choi <[email protected]>
nvmet: use the local P2P device on metadata allocation failure
Sang-Hoon Choi <[email protected]>
cxgb4/ch_ktls: disable softirqs around tid_list erases
Jamal Hadi Salim <[email protected]>
net/sched: em_text: reject unterminated algo before autoload
Maíra Canal <[email protected]>
drm/vc4: Free the BO cache size list on teardown
Myeonghun Pak <[email protected]>
drm/aspeed: Balance the display clock enable on teardown
Sang-Hoon Choi <[email protected]>
gpio: exar: initialize the ID before registering its cleanup
Oleg Keri <[email protected]>
drm/dp: don't mark the AUX backlight enabled when enabling failed
Christian Brauner <[email protected]>
namespace: refuse an automount below a mount that is in no namespace
Christian Brauner <[email protected]>
dcache: don't put a mountpoint on a dentry that's being removed
Christian Brauner <[email protected]>
namespace: check a submount for references right before unmounting it
Christian Brauner <[email protected]>
fs: refuse fspick() on internal superblocks
Alex Deucher <[email protected]>
drm/amdgpu: make Mac FB workaround generic
Fan Wu <[email protected]>
drm/vc4: drain the hangcheck timer and works on V3D unbind
Krzysztof Karas <[email protected]>
drm/i915/gem: Prevent overstepping exec array boundary
Sajal Gupta <[email protected]>
drm/gud: don't keep a connector without a CRTC as connector_state
Palla Raghunath <[email protected]>
Bluetooth: RFCOMM: Fix NULL tty_dev dereference in rfcomm_dev_shutdown
Maxim Skokov <[email protected]>
Bluetooth: RFCOMM: free the skb when the DLC has no owner
Chengfeng Ye <[email protected]>
Bluetooth: hci_sock: Serialize dead-device detachment
Runyu Xiao <[email protected]>
scsi: qedi: Initialize callback state before registration
Abhishek Ojha <[email protected]>
regulator: ltc3676: don't read the write-only HRST and CLIRQ registers
Denis V. Lunev <[email protected]>
openvswitch: fix soft lockup in the netlink flow dump
Karl Bonde Torp <[email protected]>
nvme: fix swapped ZRASF zone state values for full and read only
Fredrik Nyberg <[email protected]>
net: usb: ax88179_178a: fix rx frame length for non-last packets
Zixuan Chai <[email protected]>
net: bridge: avoid recursive multicast port cleanup
Chengfeng Ye <[email protected]>
net/smc: protect clcsock lifetime in smc_getname
Quchaosheng <[email protected]>
net/packet: guard the ll header push in packet_rcv_spkt()
Guangshuo Li <[email protected]>
mmc: sdhci-sprd: disable runtime PM on remove
Yibo Tan <[email protected]>
mmc: mtk-sd: Cancel request timeout work on remove
Guangshuo Li <[email protected]>
mmc: cavium-thunderx: destroy slot platform devices on remove
Guangshuo Li <[email protected]>
mmc: cavium-octeon: destroy slot platform devices on remove
Ma Xinmeng <[email protected]>
dm-snap: reject the transient exception store for snapshot-merge
Ben Cressey <[email protected]>
dm-crypt: reject the lmk IV mode with AEAD ciphers
Nguyen Ngoc Thang <[email protected]>
memstick: rtsx_usb_ms: complete requests after eject instead of dropping them
Raj Ojha <[email protected]>
memstick: core: wait for request completion before freeing card
성병찬 <[email protected]>
KEYS: Fix add_key() race with keyring restriction
Karl Mehltretter <[email protected]>
keys: finalize persistent keyring timeout after link attempt
Mingming Cao <[email protected]>
ibmveth: h_free logical LAN on open-fail after register
Ridham Khurana <[email protected]>
gpio: xilinx: fix runtime PM leak on request error path
Hui Peng <[email protected]>
sctp: copy zeroed stats to user in sctp_getsockopt_pr_streamstatus() when !streamoute
Stephen Smalley <[email protected]>
selinux: preserve NATIVE_LABELS on already-initialized sb in set_mnt_opts
Johannes Berg <[email protected]>
Revert "wifi: libertas: reject short monitor TX frames"
Chengfeng Ye <[email protected]>
tipc: hold a reference to nodes found by link name
Yuqi Xu <[email protected]>
tipc: destroy topsrv workqueues before closing connections
Sabrina Dubroca <[email protected]>
strparser: make sure __strp_recv isn't running before tearing down the parser
Josef Bacik <[email protected]>
xen/netfront: don't leak the skb when xennet_fill_frags() fails
Pavankumar Kondeti <[email protected]>
workqueue: Fix NULL current_pwq deref in chained work check
Jason A. Donenfeld <[email protected]>
wireguard: noise: reject response consumption after intermediate initiation
Michele Dionisio <[email protected]>
wifi: brcmfmac: fix P2P device removal race in brcmf_detach()
Palla Raghunath <[email protected]>
dm ioctl: don't let data_start run past the buffer
Wentao Liang <[email protected]>
btrfs: scrub: fix local_root reference leak in scrub_print_warning_inode()
Daehyeon Ko <[email protected]>
ipv6: do not warn on route notification size race
Daehyeon Ko <[email protected]>
ipv4: do not warn on route notification size race
Daehyeon Ko <[email protected]>
ipv4: stop route notification sizing when nexthop group shrinks
Daehyeon Ko <[email protected]>
ipv4: stop PMTU walk when nexthop group shrinks
Eric Biggers <[email protected]>
crypto: drbg - Fix ineffective sanity check
Carlos Llamas <[email protected]>
HID: uhid: convert to hid_safe_input_report()
Benjamin Tissoires <[email protected]>
HID: core: introduce hid_safe_input_report()
Cong Nguyen <[email protected]>
iio: adc: max1363: sign-extend bipolar differential channel reads
Pengpeng Hou <[email protected]>
iio: adc: aspeed: propagate reset deassert errors
Paulo Alcantara <[email protected]>
smb: client: discard post-EOF pagecache when extending a file via zero range
Felix Fietkau <[email protected]>
wifi: mac80211: set info->band for 802.3 encap offload frames
Sean Christopherson <[email protected]>
KVM: SVM: Use the active VMCB's MSR bitmap when checking if MSR is intercepted
Peter Xu <[email protected]>
mm/hugetlb: fix avoid_reserve to allow taking folio from subpool
Matthew Wilcox (Oracle) <[email protected]>
fs: Free any excess xarray nodes in clear_inode()
Zhiling Zou <[email protected]>
wifi: mac80211: count only matching reservations in reserved switch
Zhiling Zou <[email protected]>
wifi: mac80211: keep paired old chanctx alive
Johan Hovold <[email protected]>
tty: port: fix tty_port_tty_vhangup() race
Jiri Slaby (SUSE) <[email protected]>
tty: introduce and use tty_port_tty_vhangup() helper
Eric Dumazet <[email protected]>
bnxt_en: fix DMA mapping length for padded small packets
Johan Hovold <[email protected]>
USB: serial: fix driver deregistration order
Johan Hovold <[email protected]>
USB: serial: clean up core error labels
Zhao Li <[email protected]>
wifi: mac80211: account proxy paths against the mesh path limit
Han Xu <[email protected]>
mtd: spinand: Enable QE on all dies
Pei Xiao <[email protected]>
mtd: block2mtd: Fix divide error when erase_size is zero
Johan Hovold <[email protected]>
USB: serial: fix ioctl hangup race
Mika Westerberg <[email protected]>
thunderbolt: Fix KASAN reported use-after-free when request is canceled
Zhao Li <[email protected]>
wifi: mac80211: keep fallback association elements alive
Zhao Li <[email protected]>
wifi: mac80211: shut down RX BA session timer on teardown
Timur Kristóf <[email protected]>
drm/amd/display: Mark DCE 6.4 as not APU
Johan Hovold <[email protected]>
serial: fix TIOCMIWAIT race
Mingyu Wang <[email protected]>
tty: vt: fix memory leak in vc_allocate()
David Heidelberg <[email protected]>
Input: s6sy761 - fix resume ordering and restore sensing
Fan Wu <[email protected]>
tty: serial: max3100: shut down timer before freeing port
Johan Hovold <[email protected]>
tty: abort break signalling on hangup
Jiri Slaby <[email protected]>
tty: reformat kernel-doc in tty_io.c
Johan Hovold <[email protected]>
tty: tty_port: restore TTY_IO_ERROR on activation failure
Pannarat Wiriyaarritham <[email protected]>
usb: typec: ucsi: acpi: Assume UCSI 1.2 on Acer Nitro ANV15-41
Runyu Xiao <[email protected]>
USB: dwc2: shut down wakeup timer before freeing HCD state
Myeonghun Pak <[email protected]>
usb: ohci-spear: disable controller wakeup on removal
Chen Ni <[email protected]>
usb: ohci-spear: Remove unnecessary NULL check before clk_disable_unprepare()
Orgad Shaneh <[email protected]>
usb: octeon-hcd: fix the FIFO-flush timeout computation
Willian Oliveira <[email protected]>
drm/amdgpu/gfx6: fix firmware leak on teardown
Guangshuo Li <[email protected]>
drm/amdgpu: fix ACP MFD device leak on init failure
Vijendar Mukunda <[email protected]>
drm/amdgpu: fix for coding style issues
Francisco Beltrán Millalén <[email protected]>
drm/amdgpu: reset VI ASIC on MacBookPro14,3
Andre Eikmeyer <[email protected]>
drm/amdgpu: reset VI ASIC on MacBookPro15,1
Timur Kristóf <[email protected]>
drm/amd/pm/si: Fix updating clock limits on AC/DC
Jiangshan Yi <[email protected]>
drm/amd/display: check dc_state_create_copy() for NULL in dm_suspend
Eric Biggers <[email protected]>
fsverity: add dependency on 64K or smaller pages
Mostafa Saleh <[email protected]>
KVM: arm64: Don't use the VMA to size stage-2 block mappings for VM_PFNMAP
Jinseob Kim <[email protected]>
iio: buffer: serialize buffer teardown with mode claims
Beata Michalska <[email protected]>
arm64: errata: Add Cortex-A725 erratum 3821522 workaround
Beata Michalska <[email protected]>
arm64: errata: Factor out broken AMU const counter cap
Kyle Zeng <[email protected]>
ALSA: seq: Serialize compat port-info ioctls
Zhengchuan Liang <[email protected]>
perf: Require kernel access for text poke events
Johan Hovold <[email protected]>
tty: fix saved termios reset race
Jiazi Liu <[email protected]>
usb: dwc3: gadget: fix IRQ storm on invalid event buffer count
Viken Dadhaniya <[email protected]>
soc: qcom: geni-se: Correct QUP Core ICC vote constants
Timur Kristóf <[email protected]>
drm/amd/pm/si: Check AMD_IS_MOBILITY flag for PPSMC_SYSTEMFLAG_GPIO_DC
Jiangshan Yi <[email protected]>
smb: client: clear setuid/setgid bit on write with cifsacl/modefromsid/posix extensions
Josef Bacik <[email protected]>
xen/netfront: drop RX packets with a short Ethernet header
Amit Sunil Dhamne <[email protected]>
usb: typec: tcpm: constrain TCPM_SOURCING_VBUS event handling
Xu Yang <[email protected]>
usb: typec: tcpm: fix debug accessory mode detection for sink ports
Fan Wu <[email protected]>
usb: gadget: at91_udc: drain polled-VBUS timer/work before udc is freed
Uwe Kleine-König <[email protected]>
usb: gadget: at91_udc: Convert to platform remove callback returning void
Karl Mehltretter <[email protected]>
serial: imx: serialize imx_uart_ports[] lifetime
Uwe Kleine-König <[email protected]>
serial: imx: Convert to platform remove callback returning void
Gilberto Conde <[email protected]>
net: usb: qmi_wwan: add Quectel EG120K-EA
Tristan Madani <[email protected]>
wifi: wcn36xx: fix heap overflow from oversized firmware HAL response
Kuniyuki Iwashima <[email protected]>
vxlan: Fix potential null-ptr-deref in vxlan_gro_prepare_receive().
Chengchang Tang <[email protected]>
RDMA/hns: Fix WQ_MEM_RECLAIM warning
Wentao Liang <[email protected]>
wifi: wlcore: Fix runtime PM leak in wlcore_remove()
Uwe Kleine-König <[email protected]>
wifi: wlcore: Convert to platform remove callback returning void
Uwe Kleine-König <[email protected]>
wifi: wl12xx: Drop if with an always false condition
Frank Sorenson <[email protected]>
smb: client: split cifsFileInfo bitfields to avoid shared-byte RMW races
Mehmet Fide <[email protected]>
mtd: rawnand: vf610_nfc: fix false bitflips on reads of erased pages
Yi Yang <[email protected]>
vc_screen: reload vc pointer before if (ret) in vcs_write() to avoid UAF
Chris Mason <[email protected]>
SUNRPC: reject duplicate CREDS_VALUE options
Chris Mason <[email protected]>
SUNRPC: fix gssx_dec_option_array error path bugs
Asad Kamal <[email protected]>
drm/amd/powerplay: fix VoltageObjectInfo zero-stride loop and OOB read
Amit Pundir <[email protected]>
arm64: dts: qcom: sdm845-db845c: Mark cont splash memory region as reserved
Dmitry Torokhov <[email protected]>
Input: exc3000 - properly stop timer on shutdown
Simon Liebold <[email protected]>
Revert "scsi: sd: sd_zbc: Use logical blocks as unit when querying zones"
Victor Nogueira <[email protected]>
net: sched: cls_u32: Undo tcf_bind_filter if u32_replace_hw_knode
Fan Wu <[email protected]>
iio: trigger: cancel reenable_work before freeing trigger
Salah Triki <[email protected]>
iio: proximity: vcnl3020: fix ISR bitmask check in IRQ handler
Cong Nguyen <[email protected]>
iio: proximity: pulsedlight: fix iio_device left registered on PM setup failure
Salah Triki <[email protected]>
iio: proximity: isl29501: Fix return type of isl29501_register_write
Fan Wu <[email protected]>
iio: light: gp2ap020a00f: drain irq_work after free_irq
Arka Mondal <[email protected]>
iio: imu: adis16480: fix unprotected debugfs reads
Arka Mondal <[email protected]>
iio: imu: adis16400: fix unprotected debugfs reads
Arka Mondal <[email protected]>
iio: gyro: adis16136: fix unprotected debugfs reads
Felix Gu <[email protected]>
iio: adc: sun4i-gpadc-iio: drop underflowing pm_runtime_put() calls
Felix Gu <[email protected]>
iio: adc: sun4i-gpadc-iio: clean up on thermal zone registration failure
Salah Triki <[email protected]>
iio: accel: sca3000: fix frequency divider condition check
Jiale Yao <[email protected]>
iio: accel: kxcjk-1013: reject duplicate event disable
Daehyeon Ko <[email protected]>
thunderbolt: Reject oversized XDomain properties responses
Ian Lin <[email protected]>
USB: serial: option: add Compal EXC-T1 support
Sebastian Sjoholm <[email protected]>
USB: serial: option: add Quectel RG660QB
Ian Lin <[email protected]>
USB: serial: option: add Compal EXM-G1x support
Carlo Szelinsky <[email protected]>
USB: serial: option: add Quectel EG060W
Zhao Dongdong <[email protected]>
USB: serial: option: add support for SIMCom SIM8260C
Johan Hovold <[email protected]>
USB: serial: fix dynamic id driver deregistration race
Johan Hovold <[email protected]>
USB: serial: ssu100: fix baud rate overflow
Johan Hovold <[email protected]>
USB: serial: quatech2: fix baud rate overflow
Jérémy Carrat <[email protected]>
USB: serial: cp210x: add Corsair AX1500i Power Supply
Yuqi Xu <[email protected]>
wifi: mac80211: handle empty FILS association request payload
Zhao Li <[email protected]>
wifi: mac80211: release mesh path quota on failed additions
Yuqi Xu <[email protected]>
wifi: mac80211: minstrel_ht: validate fixed rate index
Zhao Li <[email protected]>
wifi: mac80211: drain PS delivery work during station teardown
Guangshuo Li <[email protected]>
wifi: iwlegacy: 3945: free EEPROM data on remove
Tianchu Chen <[email protected]>
wifi: cw1200: fix TX padding OOB read leaking heap data to device
Nuno Sá <[email protected]>
mtd: spinand: fix zero oobavail when no ECC engine is used
Mehmet Fide <[email protected]>
mtd: rawnand: vf610_nfc: fix reads on chips with more than 64 bytes of OOB
Runyu Xiao <[email protected]>
mtd: rawnand: cadence: Initialize IRQ state before requesting IRQ
Daehyeon Ko <[email protected]>
nvme-multipath: fix underflow in ANA log bounds checks
Leon Hwang <[email protected]>
kprobes: Skip disarmed probes when checking optkprobe overlap
Zhiling Zou <[email protected]>
ipvs: bound LBLCR and LBLC cache growth
Chandrashekar Devegowda <[email protected]>
Bluetooth: btintel: fix buffer over-read in btintel_hw_error()
Chengfeng Ye <[email protected]>
Bluetooth: hci_core: Serialize ACL scheduling with channel deletion
Linmao Li <[email protected]>
Bluetooth: hci_core: Fix inquiry cache timestamps on 64-bit systems
Chengfeng Ye <[email protected]>
Bluetooth: RFCOMM: Fix initial port reference race
Xiang Mei <[email protected]>
ALSA: ua101: reject mismatched capture/playback packet sizes
Zimeng Li <[email protected]>
ASoC: qcom: lpass-cpu: use DAI table index for playback constraints
Wentao Liang <[email protected]>
serial: vt8500: Fix clock reference leak in vt8500_serial_probe()
Simon Gassner <[email protected]>
serial: tegra: don't clear the Tx FIFO on an Rx-only reset
Fan Wu <[email protected]>
serial: 8250_bcm7271: fix use-after-free in brcmuart_remove()
Viken Dadhaniya <[email protected]>
tty: serial: qcom_geni_serial: Keep console RX functional after deep idle
Joshua Rogers <[email protected]>
tty: vcc: hold port lock when clearing tty pointer in vcc_cleanup
Joshua Rogers <[email protected]>
tty: vcc: zero-initialize control packet in vcc_send_ctl()
Johan Hovold <[email protected]>
tty: amiserial: fix broken TIOCMIWAIT
Jie Deng <[email protected]>
usb: cdns3: Fix NULL pointer dereference in cdns3_pci_probe
Fan Wu <[email protected]>
usb: cdns3: fix use-after-free in cdns3_gadget_exit()
Jameson Thies <[email protected]>
usb: typec: ucsi: displayport: Current CAM OOB index fixup
Prashanth K <[email protected]>
usb: typec: ucsi: Get the connector fwnode based on reg value
Radhey Shyam Pandey <[email protected]>
usb: typec: tipd: fix uninitialized typec_partner_desc in tps6598x_connect()
Amit Sunil Dhamne <[email protected]>
usb: typec: tcpm: recover after failure to start the frs ams
Hui Peng <[email protected]>
usb: core: clear both ep_in and ep_out for non-ep0 control endpoints
Yuchao Zhang <[email protected]>
usb: gadget: f_fs: Fix NULL pointer dereference in FUNCTIONFS_ENDPOINT_DESC
Alan Stern <[email protected]>
USB: gadget: dummy-hcd: Fix wait for outstanding request completions
Fan Wu <[email protected]>
usb: gadget: aspeed-vhub: cancel wake work on device removal
Liu Chao <[email protected]>
usb: gadget: f_uac1_legacy: validate bRequest index in generic_{set,get}_cmd
Myeonghun Pak <[email protected]>
usb: ohci-st: disable controller wakeup on removal
Myeonghun Pak <[email protected]>
usb: ohci-s3c2410: disable controller wakeup on removal
Myeonghun Pak <[email protected]>
usb: ohci-da8xx: disable controller wakeup on cleanup
Lovekesh Solanki <[email protected]>
usb: hub: use shorter 120ms post resume hold for SS root hubs
Syed Labeeq Sajid Bukhari <[email protected]>
usb: storage: sierra_ms: reject short SWoC info transfers
Johan Hovold <[email protected]>
USB: serial: fix port tear down use-after-free
Johan Hovold <[email protected]>
USB: cdc-acm: fix racy TIOCMIWAIT implementation
Yuxiao Wang <[email protected]>
nitro_enclaves: fix use-after-free on SLOT_ALLOC failure
Raphaël Larocque <[email protected]>
Input: synaptics - limit T440p InterTouch quirk to LEN0036
Lovekesh Solanki <[email protected]>
Input: synaptics - add LEN205b entry to smbus_pnp_ids for ThinkPad T490
Lovekesh Solanki <[email protected]>
Input: i8042 - add nomux quirk for Fujitsu LIFEBOOK U7410
Martino Papero <[email protected]>
Input: atkbd - skip deactivate for Lenovo IdeaPad Slim 3 15IWC11
Wentao Liang <[email protected]>
kgdboc: Fix tty driver reference leak in configure_kgdboc()
Imre Kaloz <[email protected]>
drm/radeon: Read the VRAM VBIOS signature with readb()
Nikola Prica <[email protected]>
PCI: Accept AtomicOps already enabled by the hypervisor
Luo Gengkun <[email protected]>
perf: Fix race between perf_event_exit_task() and perf_pending_task()
Hongjian Dai <[email protected]>
i2c: at91: release DMA channels when probe defers
Eric Dumazet <[email protected]>
ipv6: sr: use skb_get_hash_net() in seg6_make_flowlabel()
Florian Westphal <[email protected]>
net: add and use skb_get_hash_net
Florian Westphal <[email protected]>
netfilter: nf_tables: avoid skb access on nf_stolen
Julian Anastasov <[email protected]>
ipvs: filter some flags received in the backup server
Julian Anastasov <[email protected]>
ipvs: do not create invisible templates
Julian Anastasov <[email protected]>
ipvs: fix missing counter decrement in lblc
Jeff Jo <[email protected]>
tcp: refresh TS.Recent for accepted old ACKs
Jamal Hadi Salim <[email protected]>
net/sched: sch_codel: match the no-drop threshold to the packet size
Jamal Hadi Salim <[email protected]>
net/sched: fq_codel: match the no-drop threshold to the packet size
Jérémy Jean <[email protected]>
tipc: prevent GCM nonce reuse on peer key changes
Florian Fainelli <[email protected]>
net: systemport: Fix RUNT MIB counter register offset calculation
Florian Westphal <[email protected]>
netfilter: ipset: do not update comments from kernel-side adds
Jamal Hadi Salim <[email protected]>
net/sched: cls_api: reclaim an empty proto on the error path
Binbin Deng <[email protected]>
net/mctp: publish the mctp_dev only after it is initialised
Jeremy Kerr <[email protected]>
mctp: Add refcounts to mctp_dev
Sai Teja Aluvala <[email protected]>
Bluetooth: btintel: validate DDC record lengths
Sang-Hoon Choi <[email protected]>
Bluetooth: hci_core: free the HCI ID if naming fails
Cezary Rojewski <[email protected]>
ASoC: codecs: rt274: Fix format setting for 44100 rate
Zhao Li <[email protected]>
wifi: cfg80211: preserve hidden-group beacon IE ownership
Nicolas Escande <[email protected]>
wifi: ath11k: reset ar->num_stations on hardware start
HyeongJun An <[email protected]>
ASoC: wm8903: Move the DRC QR threshold to the register that holds it
Abdurrahman Hussain <[email protected]>
of/overlay: don't create "//" paths for fragments targeting the root
Abdurrahman Hussain <[email protected]>
of/overlay: don't leak fragment references when changeset init fails
Julian Sun <[email protected]>
nvmet: preserve device path on allocation failure
Karl Mehltretter <[email protected]>
mtd: core: call _get_device() with the master MTD
Alexander Usyskin <[email protected]>
mtd: call external _get and _put in right order
Tomas Winkler <[email protected]>
mtd: use refcount to prevent corruption
Shang XiaoJing <[email protected]>
mtd: core: Fix refcount error in del_mtd_device()
Andy Shevchenko <[email protected]>
mtd: core: Drop duplicate NULL checks around nvmem_unregister()
Zev Weiss <[email protected]>
mtd: core: clear out unregistered devices a bit more
Nilesh Javali <[email protected]>
scsi: qla2xxx: Fix NVMe abort reference leak on repeated abort
Nilesh Javali <[email protected]>
scsi: qla2xxx: Initialize NVMe abort_work once at submission
Kuniyuki Iwashima <[email protected]>
hsr: Remove WARN_ONCE() in hsr_addr_is_self().
Duoming Zhou <[email protected]>
watchdog: cpu5wdt.c: Fix use-after-free bug caused by cpu5wdt_trigger
Tetsuo Handa <[email protected]>
perf/core: Fix WARN in perf_sigtrap()
Xiang Mei <[email protected]>
ALSA: line6: reject oversized playback packets
Nguyen Ngoc Thang <[email protected]>
ALSA: caiaq: unregister the input device when probe fails
Zizhi Wo <[email protected]>
vt: skip screen update for DEC alignment test on backgroup consoles
Clément Léger <[email protected]>
of/irq: add missing of_node_put() for interrupt parent node
Sanghyun Park <[email protected]>
vxlan: use one headroom snapshot for neighbour replies
Maoyi Xie <[email protected]>
rds_tcp: close NULL deref window in rds_tcp_set_callbacks
Xin Long <[email protected]>
openvswitch: add nf_ct_is_confirmed check before assigning the helper
Konrad Dybcio <[email protected]>
drm/msm/a6xx: Avoid a nullptr dereference when speedbin setting fails
Konrad Dybcio <[email protected]>
drm/msm/adreno: Assign msm_gpu->pdev earlier to avoid nullptrs
Benjamin Berg <[email protected]>
wifi: cfg80211: avoid double free if updating BSS fails
Jun Yang <[email protected]>
sctp: check RCV_SHUTDOWN after the sendmsg connect wait
Runyu Xiao <[email protected]>
rtc: spear: initialize IRQ state before requesting alarm IRQ
Ilkka Lappeteläinen <[email protected]>
net/packet: prevent TX_RING byte count overflow
Aohan Mei <[email protected]>
netfilter: nft_flow_offload: drop flowtable reference on init error path
Abdurrahman Hussain <[email protected]>
of/overlay: only treat a positive changeset id as registered
Abdurrahman Hussain <[email protected]>
of/overlay: put property on deadprops only after changeset add succeeds
Wentao Liang <[email protected]>
of/irq: Fix remaining refcount leaks in of_irq_init()
Jérémy Jean <[email protected]>
audit: fix exe mark UAF in kill_rules()
Takashi Iwai <[email protected]>
ALSA: usb-audio: Apply IGNORE_CTL_ERROR quirk to all Audient devices
Zihan Xi <[email protected]>
smb: client: close completed creates on compound wait errors
Zihan Xi <[email protected]>
smb: client: close handle after create-context parsing failure
ChenXiaoSong <[email protected]>
smb/client: pass cifs_open_info_data to SMB2_open()
ChenXiaoSong <[email protected]>
smb/client: use stack-allocated smb2_file_all_info in smb3_query_mf_symlink()
Chen Changcheng <[email protected]>
HID: alps: unregister DualPoint Stick input device on remove
Bastien Nocera <[email protected]>
HID: hid-alps: Use pm_ptr instead of #ifdef CONFIG_PM
Marcus Folkesson <[email protected]>
HID: hid-alps: use default remove for hid device
Thomas Weißschuh <[email protected]>
HID: core: remove #ifdef CONFIG_PM from hid_driver
Tibor Harcsa <[email protected]>
Bluetooth: btusb: Add IMC Networks QCA9377 to quirks table
Aldo Ariel Panzardo <[email protected]>
Bluetooth: mgmt: fix race in read_unconf_index_list()
Zihan Xi <[email protected]>
smb: client: validate POSIX create context length
Namjae Jeon <[email protected]>
smb: client: use finish_no_open() for non-regular inodes
Aohan Mei <[email protected]>
netfilter: nf_tables: skip expired catchall elements on insert and delete
Pablo Neira Ayuso <[email protected]>
netfilter: nf_tables: set->ops->insert returns opaque set element in case of EEXIST
Guangshuo Li <[email protected]>
net: ena: fix MMIO read buffer leak on probe failure
Dr. David Alan Gilbert <[email protected]>
net: ena: Remove autopolling mode
Ilya Titov <[email protected]>
pinctrl: sunxi: keep a shadow copy of the data register output latches
Wang Jianzheng <[email protected]>
pinctrl: sunxi: Use devm_clk_get_enabled() helpers
Samuel Holland <[email protected]>
pinctrl: sunxi: Refactor register/offset calculation
Yuqi Xu <[email protected]>
net: ipconfig: bound DHCP option construction
Thorsten Blum <[email protected]>
net: ipconfig: Remove outdated comment and indent code block
Zihan Xi <[email protected]>
smb: client: fix create context out-of-bounds reads
Steve French <[email protected]>
smb3: make query_on_disk_id open context consistent and move to common code
Ilya Maximets <[email protected]>
net: openvswitch: conntrack: fix helper UAF due to extensions realloc
Jinjiang Tu <[email protected]>
mm/rmap: fix missing barrier between anon_vma init and vma->anon_vma publish
Dapeng Mi <[email protected]>
perf/x86/intel: Remove anythread_deprecated bit from perf_capabilities
Wentao Liang <[email protected]>
drm/amdgpu: Fix runtime PM leak in amdgpu_debugfs_test_ib_show()
Willem de Bruijn <[email protected]>
tcp: prevent collapsing skbs across boundary in rtx queue
Myeonghun Pak <[email protected]>
bna: prevent IOC timer rearm during teardown
Paulo Alcantara <[email protected]>
smb: client: fix smbd_connection leak on cifs_get_tcp_session() error
Fan Wu <[email protected]>
wifi: wcn36xx: Fix potential use-after-free in TX ack timer teardown
Yibo Tan <[email protected]>
hwmon: (pwm-fan) Stop RPM timer before freeing tach data
Tzung-Bi Shih <[email protected]>
watchdog: rtd119x: Avoid division by zero
Christophe JAILLET <[email protected]>
watchdog: rtd119x: Use devm_clk_get_enabled() helper
Hongling Zeng <[email protected]>
btrfs: take commit root semaphore when iterating in mark_block_group_to_copy()
Yuho Choi <[email protected]>
ALSA: virtio: reset device before deleting virtqueues
Bjoern Doebel <[email protected]>
smb: client: avoid leaking refcount when cifs_sb_tlink() fails
Fan Wu <[email protected]>
smb: client: fix cifsFileInfo reference leak in deferred close
Paulo Alcantara <[email protected]>
smb: client: fix file type corruption in cifs_reparse_point_to_fattr()
Sebastian Andrzej Siewior <[email protected]>
ring-buffer: Acquire the lock with irqsave in rb_wake_up_waiters()
Xuanqiang Luo <[email protected]>
net/sched: act_api: release all action references on NEWACTION failure
Zihan Xi <[email protected]>
ipmr: account multicast table and route memory
Guanghui Yang <[email protected]>
f2fs: fix dentry folio leak in find_in_level
Wenjie Qi <[email protected]>
f2fs: limit recovery filename logging to stored length
Nilesh Javali <[email protected]>
scsi: qla2xxx: Fix soft lockup polling continuation IOCB signature
Nilesh Javali <[email protected]>
scsi: qla2xxx: Use memset_io() to clear QLAFX00 request ring slot
Nilesh Javali <[email protected]>
scsi: qla2xxx: Quiesce response IRQ before freeing request queue
Nilesh Javali <[email protected]>
scsi: qla2xxx: Fix 64G link speed reporting in get_data_rate
Nilesh Javali <[email protected]>
scsi: qla2xxx: Null out freed pointers in qla2x00_mem_alloc() error path
Ruoyu Wang <[email protected]>
media: zoran: Avoid freeing a registered video_device twice
Guangshuo Li <[email protected]>
media: saa7164: fix cleanup on resource allocation failure
Narasimharao Vadlamudi <[email protected]>
media: rkvdec: Propagate platform_get_irq() errors
Lorenzo Stoakes (ARM) <[email protected]>
mm/mremap: reset unfaulted VMA page offset for MREMAP_DONTUNMAP
Karl Mehltretter <[email protected]>
arm64: mm: Fix the lockless page-table walk in show_pte()
Hugh Dickins <[email protected]>
arm64: allow pte_offset_map() to fail
Steven Rostedt <[email protected]>
ftrace: Synchronize the initialization of ftrace_ops
Muhammad Bilal <[email protected]>
staging: sm750fb: fix mono image source stride mismatch in lynxfb_ops_imageblit()
Can Peng <[email protected]>
spi: bcm63xx: disable clock on resume failure
Jeffin Philip <[email protected]>
usb: gadget: f_mass_storage: fix null pointer dereference in fsg_common_set_num_buffers()
Adrian Hunter <[email protected]>
i3c: master: Fix use-after-free of master->this
Adrian Hunter <[email protected]>
i3c: master: Do not treat master device as a duplicate target
Can Peng <[email protected]>
hwrng: stm32 - Fix runtime PM cleanup on registration failure
Fan Wu <[email protected]>
mmc: via-sdmmc: cancel card-detect work on remove
Jianing Li <[email protected]>
power: supply: max17040: drop incorrect I2C functionality check
Uwe Kleine-König <[email protected]>
power: supply: max17040: Convert to i2c's .probe_new()
Angel Iglesias <[email protected]>
i2c: core: Introduce i2c_client_get_device_id helper function
Fan Wu <[email protected]>
power: supply: rt9455: quiesce delayed work before teardown
Uwe Kleine-König <[email protected]>
power: supply: rt9455: Convert to i2c's .probe_new()
Oscar Ou <[email protected]>
lockd: fix swapped arguments in nlmsvc_match_ip()
Ruoyu Wang <[email protected]>
i2c: mxs: fix DMA channel leak on probe error
Bence Csókás <[email protected]>
dmaengine: Add devm_dma_request_chan()
Jiacheng Yu <[email protected]>
params: fix charp corruption on allocation failure
Andy Shevchenko <[email protected]>
params: Fix multi-line comment style
Andy Shevchenko <[email protected]>
params: Sort headers
Andy Shevchenko <[email protected]>
params: Use size_add() for kmalloc()
Andy Shevchenko <[email protected]>
params: Do not go over the limit when getting the string length
Christophe JAILLET <[email protected]>
kernel/params.c: Use kstrtobool() instead of strtobool()
Kuan-Wei Chiu <[email protected]>
coresight: etm3x: Fix cntr_val_show() to match cntr_val_store() behavior
Frank Sorenson <[email protected]>
cifs: fix loff_t underflow in cifs_remap_file_range() when len == 0
Chuck Lever <[email protected]>
nfsd: gate nfs2 setacl by argp->mask
Jeff Layton <[email protected]>
nfsd: fix clock domain mismatch in clients_still_reclaiming()
Jeff Layton <[email protected]>
nfsd: check nfsd4_acl_to_attr() return value in nfsd4_create()
Chris Mason <[email protected]>
nfsd: size fh_verify server sockaddr slot by xpt_locallen
Chris Mason <[email protected]>
nfsd: release path refs on follow_down() error
Longlong Xia <[email protected]>
zram: fix out-of-bounds access in read_block_state()
Sergey Senozhatsky <[email protected]>
zram: fixup read_block_state()
Chengfeng Ye <[email protected]>
KEYS: trusted: Fix TPM teardown ordering
Qing Ming <[email protected]>
gtp: serialize PDP context updates
Breno Leitao <[email protected]>
usb: xhci: bail out of setup if the controller is inaccessible
Arnaldo Carvalho de Melo <[email protected]>
perf test bpf: Address error about non-null argument for epoll_pwait 2nd arg
Namhyung Kim <[email protected]>
perf tools: Fix a asan issue in parse_events_multi_pmu_add()
Xiang Mei <[email protected]>
vlan: require the MAC header to be present in __vlan_insert_inner_tag()
Frank Sorenson <[email protected]>
smb: client: fix OOB struct field reads in move_smb2_ea_to_cifs()
Frank Sorenson <[email protected]>
smb: client: fix next_buffer UAF and NextCommand bounds in compound PDUs
Frank Sorenson <[email protected]>
smb: client: fix potential OOB read in smb3_enum_snapshots()
Daehyeon Ko <[email protected]>
wifi: libipw: reject TKIP frames without a full MIC
Xiang Mei <[email protected]>
ALSA: usb-audio: Clamp implicit feedback packet count to URB capacity
Takashi Iwai <[email protected]>
ALSA: usb-audio: Optimize the copy of packet sizes for implicit fb handling
Bjoern Doebel <[email protected]>
smb: client: fix heap overflow in DACL owner/group rewrite
Bjoern Doebel <[email protected]>
smb: client: avoid leaking refcount in cifs_queue_oplock_break()
Aohan Mei <[email protected]>
smb: client: reject userspace cifs.idmap descriptions
Zhiling Zou <[email protected]>
net: bridge: use option bits for CFM/MRP frame handlers
Jens Axboe <[email protected]>
io_uring/rw: end write accounting from ->ki_complete
XingWang Xiang <[email protected]>
genetlink: pin family module during policy dump
Xu Rao <[email protected]>
Bluetooth: btqcomsmd: destroy RPMsg endpoints before freeing hci_dev
Uwe Kleine-König <[email protected]>
Bluetooth: btqcomsmd: Convert to platform remove callback returning void
Thomas Gleixner <[email protected]>
tick/broadcast: Plug clockevents replacement race
Chao Yu <[email protected]>
f2fs: embed f2fs_gc_kthread in f2fs_sb_info
Nilesh Javali <[email protected]>
scsi: qla2xxx: Validate BSG request_len before reading vendor_cmd[]
Nilesh Javali <[email protected]>
scsi: qla2xxx: Fix use-after-free of qpair work on queue teardown
Nilesh Javali <[email protected]>
scsi: qla2xxx: Fix queue teardown NULL dma_free and bitmap locking
Nilesh Javali <[email protected]>
scsi: qla2xxx: Zero dport diagnostics buffer to avoid info leak
Christian Borntraeger <[email protected]>
KVM: s390: Zero initialize data structures for inject_pfault_token
Tristan Madani <[email protected]>
nvme: add missing SRCU grace period in error path
Masami Hiramatsu (Google) <[email protected]>
kprobes: Protect kprobe_blacklist with RCU
Steven Rostedt <[email protected]>
ftrace: Take trace_array reference before accessing its ftrace_ops
Muhammad Bilal <[email protected]>
staging: rtl8723bs: fix OOB read in rtw_restruct_wmm_ie()
Vivek BalachandharTN <[email protected]>
staging: rtl8723bs: fix spacing around operators
Myeonghun Pak <[email protected]>
usb: storage: realtek_cr: fix use-after-free on disconnect
Fan Wu <[email protected]>
wifi: rtl8xxxu: fix use-after-free from rx_urb_wq on stop
Yehyeong Lee <[email protected]>
nvme-tcp: fix host memory disclosure on R2T for a read command
Varun Prakash <[email protected]>
nvme-tcp: validate R2T PDU in nvme_tcp_handle_r2t()
Doruk Tan Ozturk <[email protected]>
ocfs2: validate directory-index entry counts when reading metadata
Joseph Qi <[email protected]>
ocfs2: validate dx_root extent list fields during block read
Dave Airlie <[email protected]>
nouveau/gem: reserve the bo in the info ioctl around the vma lookup
Doruk Tan Ozturk <[email protected]>
HID: sony: fix UAF of ghl_poke_timer / ghl_urb at driver unbind
Frank Sorenson <[email protected]>
smb: client: fix OOB read/write from unvalidated DataOffset in coalesce_t2()
Michael Bommarito <[email protected]>
ceph: bound copied dentry name length in NFS export get_name
Jeff Layton <[email protected]>
nfsd: fix nfsd_file leak on inter-server COPY setup failure
Xu Yang <[email protected]>
device property: fix infinite loop in fwnode_for_each_child_node()
Jonathan Cameron <[email protected]>
device property: Add cleanup.h based fwnode_handle_put() scope based cleanup.
Hyunwoo Kim <[email protected]>
apparmor: fix out-of-bounds write when null terminating a label vec
Jiayuan Chen <[email protected]>
tls: device: fix out-of-bounds write in tls_append_frag()
-------------
Diffstat:
Documentation/arm64/silicon-errata.rst | 2 + Documentation/networking/strparser.rst | 2 +- Makefile | 4 +- arch/arm64/Kconfig | 30 + arch/arm64/boot/dts/qcom/sdm845-db845c.dts | 9 + arch/arm64/kernel/cpu_errata.c | 24 +- arch/arm64/kernel/cpufeature.c | 2 +- arch/arm64/kernel/topology.c | 11 +- arch/arm64/kvm/mmu.c | 25 +- arch/arm64/kvm/vgic/vgic-its.c | 8 + arch/arm64/mm/fault.c | 17 +- arch/arm64/tools/cpucaps | 2 +- arch/nios2/include/asm/checksum.h | 2 +- arch/s390/kvm/kvm-s390.c | 4 +- arch/s390/pci/pci_sysfs.c | 3 + arch/x86/events/intel/core.c | 10 +- arch/x86/events/perf_event.h | 2 +- arch/x86/kvm/mmu/mmu.c | 4 +- arch/x86/kvm/svm/svm.c | 3 +- arch/x86/kvm/vmx/nested.c | 4 +- arch/x86/kvm/x86.h | 4 +- crypto/drbg.c | 11 +- drivers/base/property.c | 19 +- drivers/block/zram/zram_drv.c | 6 +- drivers/bluetooth/btintel.c | 15 +- drivers/bluetooth/btqcomsmd.c | 10 +- drivers/bluetooth/btusb.c | 2 + drivers/char/hw_random/stm32-rng.c | 12 +- drivers/dma/dmaengine.c | 30 + drivers/edac/amd64_edac.c | 2 +- drivers/gpio/gpio-exar.c | 2 +- drivers/gpio/gpio-xilinx.c | 9 +- drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 46 +- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 66 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 17 +- drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 9 + drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 25 +- drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/vi.c | 21 + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 16 +- .../gpu/drm/amd/display/dc/dce60/dce60_resource.c | 1 - .../gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.c | 10 +- .../gpu/drm/amd/pm/powerplay/hwmgr/ppatomfwctrl.c | 11 +- drivers/gpu/drm/amd/pm/powerplay/si_dpm.c | 39 +- drivers/gpu/drm/aspeed/aspeed_gfx_drv.c | 5 +- drivers/gpu/drm/drm_dp_helper.c | 4 +- drivers/gpu/drm/drm_fb_helper.c | 8 +- drivers/gpu/drm/gud/gud_pipe.c | 1 + drivers/gpu/drm/i915/display/intel_dmc.c | 21 +- drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 2 +- drivers/gpu/drm/i915/gt/intel_rps.c | 3 +- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 3 +- drivers/gpu/drm/msm/adreno/adreno_gpu.c | 2 + drivers/gpu/drm/msm/msm_gpu.c | 1 - drivers/gpu/drm/nouveau/nouveau_gem.c | 11 +- drivers/gpu/drm/radeon/radeon_bios.c | 6 +- drivers/gpu/drm/vc4/vc4_bo.c | 1 + drivers/gpu/drm/vc4/vc4_v3d.c | 8 + drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 22 +- drivers/hid/hid-alps.c | 21 +- drivers/hid/hid-core.c | 26 +- drivers/hid/hid-sony.c | 4 +- drivers/hid/hid-steam.c | 211 ++--- drivers/hid/i2c-hid/i2c-hid-core.c | 5 +- drivers/hid/uhid.c | 8 +- drivers/hid/usbhid/hid-core.c | 11 +- drivers/hv/connection.c | 1 - drivers/hv/vmbus_drv.c | 1 - drivers/hwmon/drivetemp.c | 10 +- drivers/hwmon/pwm-fan.c | 15 +- .../hwtracing/coresight/coresight-etm3x-sysfs.c | 15 +- drivers/i2c/busses/i2c-at91-master.c | 8 +- drivers/i2c/busses/i2c-mxs.c | 5 +- drivers/i2c/busses/i2c-qcom-cci.c | 4 +- drivers/i2c/busses/i2c-wmt.c | 2 +- drivers/i2c/i2c-core-base.c | 14 + drivers/i3c/master.c | 20 +- drivers/iio/accel/kxcjk-1013.c | 2 +- drivers/iio/accel/sca3000.c | 2 +- drivers/iio/adc/aspeed_adc.c | 4 +- drivers/iio/adc/max1363.c | 8 + drivers/iio/adc/sun4i-gpadc-iio.c | 10 +- drivers/iio/gyro/adis16136.c | 2 +- drivers/iio/imu/adis16400.c | 2 +- drivers/iio/imu/adis16480.c | 4 +- drivers/iio/industrialio-buffer.c | 2 + drivers/iio/industrialio-trigger.c | 2 + drivers/iio/light/gp2ap020a00f.c | 2 + drivers/iio/proximity/isl29501.c | 2 +- drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 4 +- drivers/iio/proximity/vcnl3020.c | 24 +- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 3 +- drivers/input/keyboard/atkbd.c | 8 + drivers/input/mouse/byd.c | 2 +- drivers/input/mouse/synaptics.c | 7 +- drivers/input/serio/i8042-acpipnpio.h | 9 + drivers/input/touchscreen/exc3000.c | 10 + drivers/input/touchscreen/s6sy761.c | 14 +- drivers/isdn/capi/capi.c | 8 +- drivers/md/dm-cache-target.c | 59 +- drivers/md/dm-crypt.c | 10 +- drivers/md/dm-ebs-target.c | 3 +- drivers/md/dm-integrity.c | 5 +- drivers/md/dm-ioctl.c | 14 +- drivers/md/dm-snap.c | 14 + drivers/md/dm-table.c | 2 +- drivers/md/md.c | 28 +- drivers/md/md.h | 2 - drivers/md/raid0.c | 16 +- drivers/md/raid5.c | 41 +- drivers/media/pci/saa7164/saa7164-core.c | 6 + drivers/memstick/core/memstick.c | 8 +- drivers/memstick/host/rtsx_usb_ms.c | 31 +- drivers/mmc/host/cavium-octeon.c | 5 +- drivers/mmc/host/cavium-thunderx.c | 5 +- drivers/mmc/host/mtk-sd.c | 1 + drivers/mmc/host/sdhci-sprd.c | 4 + drivers/mmc/host/via-sdmmc.c | 4 + drivers/mtd/devices/block2mtd.c | 2 +- drivers/mtd/maps/vmu-flash.c | 2 +- drivers/mtd/mtdcore.c | 134 +-- drivers/mtd/mtdcore.h | 1 + drivers/mtd/mtdpart.c | 14 +- drivers/mtd/nand/raw/cadence-nand-controller.c | 6 +- drivers/mtd/nand/raw/vf610_nfc.c | 85 +- drivers/mtd/nand/spi/core.c | 34 +- drivers/net/bonding/bond_main.c | 27 +- drivers/net/can/dev/skb.c | 2 + drivers/net/can/slcan.c | 1 + drivers/net/ethernet/amazon/ena/ena_com.c | 25 +- drivers/net/ethernet/amazon/ena/ena_com.h | 14 - drivers/net/ethernet/amazon/ena/ena_netdev.c | 1 + drivers/net/ethernet/broadcom/bcmsysport.c | 4 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 23 +- drivers/net/ethernet/brocade/bna/bnad.c | 16 +- .../chelsio/inline_crypto/ch_ktls/chcr_ktls.c | 4 +- drivers/net/ethernet/ibm/ibmveth.c | 7 +- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 6 +- drivers/net/gtp.c | 18 +- drivers/net/team/team.c | 67 +- drivers/net/team/team_mode_loadbalance.c | 4 +- drivers/net/usb/ax88179_178a.c | 6 +- drivers/net/usb/qmi_wwan.c | 1 + drivers/net/vxlan/vxlan_core.c | 12 +- drivers/net/wireguard/noise.c | 7 +- drivers/net/wireless/ath/ath11k/mac.c | 1 + drivers/net/wireless/ath/wcn36xx/dxe.c | 2 +- drivers/net/wireless/ath/wcn36xx/smd.c | 4 + .../wireless/broadcom/brcm80211/brcmfmac/core.c | 27 +- drivers/net/wireless/intel/iwlegacy/3945-mac.c | 1 + drivers/net/wireless/intersil/p54/fwio.c | 42 +- drivers/net/wireless/marvell/libertas/tx.c | 7 - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 19 +- drivers/net/wireless/st/cw1200/bh.c | 8 +- drivers/net/wireless/st/cw1200/txrx.c | 14 + drivers/net/wireless/ti/wl12xx/main.c | 9 +- drivers/net/wireless/ti/wl18xx/main.c | 2 +- drivers/net/wireless/ti/wlcore/main.c | 10 +- drivers/net/wireless/ti/wlcore/wlcore.h | 2 +- drivers/net/xen-netfront.c | 16 +- drivers/nvme/host/core.c | 3 + drivers/nvme/host/multipath.c | 5 +- drivers/nvme/host/tcp.c | 62 +- drivers/nvme/target/configfs.c | 9 +- drivers/nvme/target/core.c | 2 +- drivers/of/irq.c | 14 +- drivers/of/overlay.c | 17 +- drivers/opp/core.c | 6 +- drivers/pci/pci.c | 15 +- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 197 +++-- drivers/pinctrl/sunxi/pinctrl-sunxi.h | 100 +-- drivers/power/supply/ds2780_battery.c | 2 +- drivers/power/supply/max17040_battery.c | 10 +- drivers/power/supply/rt9455_charger.c | 26 +- drivers/regulator/ltc3676.c | 15 +- drivers/rtc/rtc-spear.c | 11 +- drivers/s390/net/ctcm_mpc.c | 3 +- drivers/scsi/ch.c | 30 +- drivers/scsi/libiscsi.c | 14 +- drivers/scsi/qedi/qedi_main.c | 3 +- drivers/scsi/qla2xxx/qla_bsg.c | 47 +- drivers/scsi/qla2xxx/qla_init.c | 17 + drivers/scsi/qla2xxx/qla_iocb.c | 4 +- drivers/scsi/qla2xxx/qla_isr.c | 27 +- drivers/scsi/qla2xxx/qla_mbx.c | 4 +- drivers/scsi/qla2xxx/qla_mid.c | 33 +- drivers/scsi/qla2xxx/qla_nvme.c | 10 +- drivers/scsi/qla2xxx/qla_os.c | 13 + drivers/scsi/sd_zbc.c | 11 +- drivers/scsi/st.c | 18 +- drivers/soc/rockchip/pm_domains.c | 20 +- drivers/spi/spi-bcm63xx.c | 6 +- drivers/staging/greybus/uart.c | 10 +- drivers/staging/media/rkvdec/rkvdec.c | 4 +- drivers/staging/media/zoran/zoran_card.c | 2 +- drivers/staging/octeon-usb/octeon-hcd.c | 2 +- drivers/staging/rtl8723bs/core/rtw_mlme.c | 5 +- drivers/staging/sm750fb/sm750.c | 2 +- drivers/staging/sm750fb/sm750.h | 2 +- drivers/staging/sm750fb/sm750_accel.c | 6 +- drivers/staging/sm750fb/sm750_accel.h | 4 +- drivers/target/iscsi/iscsi_target_configfs.c | 26 +- drivers/tee/optee/core.c | 26 +- drivers/thunderbolt/ctl.c | 47 +- drivers/thunderbolt/xdomain.c | 4 + drivers/tty/amiserial.c | 9 +- drivers/tty/serial/8250/8250_bcm7271.c | 2 +- drivers/tty/serial/imx.c | 25 +- drivers/tty/serial/kgdboc.c | 9 + drivers/tty/serial/max3100.c | 14 +- drivers/tty/serial/qcom_geni_serial.c | 5 +- drivers/tty/serial/serial-tegra.c | 18 +- drivers/tty/serial/serial_core.c | 11 +- drivers/tty/serial/vt8500_serial.c | 1 + drivers/tty/tty_io.c | 919 ++++++++++----------- drivers/tty/tty_port.c | 43 +- drivers/tty/vcc.c | 5 +- drivers/tty/vt/vc_screen.c | 25 +- drivers/tty/vt/vt.c | 5 +- drivers/usb/cdns3/cdns3-gadget.c | 4 + drivers/usb/cdns3/cdns3-pci-wrap.c | 5 + drivers/usb/class/cdc-acm.c | 45 +- drivers/usb/class/cdc-acm.h | 1 - drivers/usb/core/hub.c | 7 +- drivers/usb/core/message.c | 8 +- drivers/usb/dwc2/hcd.c | 3 +- drivers/usb/dwc3/core.h | 19 + drivers/usb/dwc3/ep0.c | 9 + drivers/usb/dwc3/gadget.c | 104 ++- drivers/usb/gadget/function/f_fs.c | 15 +- drivers/usb/gadget/function/f_mass_storage.c | 3 + drivers/usb/gadget/function/f_uac1_legacy.c | 6 + drivers/usb/gadget/udc/aspeed-vhub/core.c | 4 + drivers/usb/gadget/udc/aspeed-vhub/dev.c | 2 +- drivers/usb/gadget/udc/aspeed-vhub/hub.c | 5 +- drivers/usb/gadget/udc/aspeed-vhub/vhub.h | 1 + drivers/usb/gadget/udc/at91_udc.c | 33 +- drivers/usb/gadget/udc/dummy_hcd.c | 4 + drivers/usb/host/ohci-da8xx.c | 2 + drivers/usb/host/ohci-s3c2410.c | 1 + drivers/usb/host/ohci-spear.c | 4 +- drivers/usb/host/ohci-st.c | 1 + drivers/usb/host/xhci.c | 12 +- drivers/usb/serial/bus.c | 6 +- drivers/usb/serial/cp210x.c | 1 + drivers/usb/serial/generic.c | 10 +- drivers/usb/serial/option.c | 14 + drivers/usb/serial/quatech2.c | 19 +- drivers/usb/serial/ssu100.c | 18 +- drivers/usb/serial/usb-serial.c | 168 ++-- drivers/usb/storage/realtek_cr.c | 9 +- drivers/usb/storage/sierra_ms.c | 7 + drivers/usb/typec/tcpm/tcpm.c | 41 +- drivers/usb/typec/tipd/core.c | 3 +- drivers/usb/typec/ucsi/displayport.c | 9 +- drivers/usb/typec/ucsi/ucsi.c | 17 +- drivers/usb/typec/ucsi/ucsi_acpi.c | 18 + drivers/virt/nitro_enclaves/ne_misc_dev.c | 1 + drivers/watchdog/cpu5wdt.c | 2 +- drivers/watchdog/rtd119x_wdt.c | 21 +- fs/autofs/waitq.c | 25 +- fs/btrfs/dev-replace.c | 1 + fs/btrfs/scrub.c | 4 +- fs/ceph/export.c | 23 +- fs/cifs/cifsacl.c | 27 +- fs/cifs/cifsfs.c | 16 +- fs/cifs/cifsglob.h | 6 +- fs/cifs/connect.c | 1 + fs/cifs/dir.c | 37 +- fs/cifs/file.c | 22 +- fs/cifs/inode.c | 29 +- fs/cifs/link.c | 15 +- fs/cifs/misc.c | 7 +- fs/cifs/smb1ops.c | 21 +- fs/cifs/smb2misc.c | 9 +- fs/cifs/smb2ops.c | 102 ++- fs/cifs/smb2pdu.c | 85 +- fs/cifs/smb2pdu.h | 6 +- fs/cifs/transport.c | 62 +- fs/dcache.c | 4 +- fs/dlm/lock.c | 2 + fs/f2fs/debug.c | 4 - fs/f2fs/dir.c | 1 + fs/f2fs/f2fs.h | 22 +- fs/f2fs/gc.c | 33 +- fs/f2fs/gc.h | 20 - fs/f2fs/recovery.c | 33 +- fs/f2fs/segment.c | 9 +- fs/f2fs/super.c | 4 +- fs/f2fs/sysfs.c | 8 +- fs/fcntl.c | 3 + fs/fsopen.c | 3 + fs/inode.c | 23 +- fs/ksmbd/smb2pdu.c | 7 +- fs/lockd/svcsubs.c | 2 +- fs/namespace.c | 123 ++- fs/nfsd/netns.h | 1 + fs/nfsd/nfs2acl.c | 21 +- fs/nfsd/nfs4proc.c | 25 +- fs/nfsd/nfs4state.c | 3 +- fs/nfsd/trace.h | 4 +- fs/nfsd/vfs.c | 4 +- fs/notify/mark.c | 11 + fs/ocfs2/dir.c | 71 +- fs/ocfs2/dlm/dlmcommon.h | 2 + fs/ocfs2/dlm/dlmdebug.c | 5 +- fs/ocfs2/dlm/dlmrecovery.c | 2 +- fs/pipe.c | 6 +- fs/unicode/utf8-core.c | 9 +- fs/verity/Kconfig | 3 + fs/xfs/libxfs/xfs_alloc.c | 45 +- fs/xfs/libxfs/xfs_ialloc.c | 32 +- fs/xfs/libxfs/xfs_sb.c | 17 +- fs/xfs/xfs_bmap_item.c | 2 +- fs/xfs/xfs_buf_item.c | 382 ++++++--- fs/xfs/xfs_buf_item.h | 3 +- fs/xfs/xfs_extfree_item.c | 2 +- fs/xfs/xfs_icache.c | 10 +- fs/xfs/xfs_inode.c | 4 +- fs/xfs/xfs_inode_item.c | 164 +++- fs/xfs/xfs_inode_item.h | 1 + fs/xfs/xfs_log.c | 2 +- fs/xfs/xfs_log_cil.c | 2 +- fs/xfs/xfs_refcount_item.c | 2 +- fs/xfs/xfs_rmap_item.c | 2 +- fs/xfs/xfs_trace.h | 4 +- fs/xfs/xfs_trans.c | 2 +- fs/xfs/xfs_trans.h | 3 +- include/linux/can/skb.h | 3 + include/linux/cgroup-defs.h | 5 +- include/linux/device-mapper.h | 5 + include/linux/dmaengine.h | 7 + include/linux/fsnotify_backend.h | 1 + include/linux/ftrace.h | 5 +- include/linux/futex.h | 14 +- include/linux/hid.h | 6 +- include/linux/i2c.h | 1 + include/linux/if_team.h | 3 +- include/linux/if_vlan.h | 3 + include/linux/key-type.h | 1 + include/linux/key.h | 5 + include/linux/kprobes.h | 1 + include/linux/lockd/lockd.h | 2 +- include/linux/mm.h | 2 +- include/linux/mm_types.h | 4 + include/linux/mount.h | 2 +- include/linux/mtd/mtd.h | 2 +- include/linux/netlink.h | 3 +- include/linux/nvme.h | 4 +- include/linux/property.h | 3 + include/linux/qcom-geni-se.h | 15 +- include/linux/sched/signal.h | 5 +- include/linux/skbuff.h | 12 +- include/linux/tty.h | 81 +- include/linux/tty_driver.h | 5 + include/linux/tty_port.h | 1 + include/linux/unicode.h | 1 + include/linux/usb/serial.h | 1 + include/net/af_vsock.h | 3 + include/net/bluetooth/hci_core.h | 4 +- include/net/bluetooth/rfcomm.h | 1 + include/net/codel_impl.h | 1 + include/net/mctpdevice.h | 5 + include/net/netfilter/nf_tables.h | 18 +- include/net/netns/xfrm.h | 1 + include/net/strparser.h | 10 +- include/net/tcp.h | 4 + include/uapi/linux/sched.h | 5 +- io_uring/io-wq.c | 2 + io_uring/io_uring.c | 9 +- kernel/audit_tree.c | 36 +- kernel/bpf/arraymap.c | 18 +- kernel/cgroup/cgroup.c | 6 +- kernel/events/core.c | 18 +- kernel/fork.c | 20 +- kernel/futex/core.c | 49 +- kernel/kprobes.c | 27 +- kernel/params.c | 61 +- kernel/ptrace.c | 3 +- kernel/signal.c | 8 + kernel/time/clockevents.c | 35 +- kernel/time/tick-broadcast.c | 37 +- kernel/time/tick-internal.h | 2 + kernel/trace/ftrace.c | 72 +- kernel/trace/ring_buffer.c | 6 +- kernel/trace/trace.h | 4 +- kernel/trace/trace_events_filter.c | 6 + kernel/trace/trace_events_hist.c | 50 +- kernel/trace/trace_functions.c | 2 +- kernel/trace/trace_stack.c | 2 +- kernel/watch_queue.c | 11 +- kernel/workqueue.c | 2 +- mm/huge_memory.c | 3 + mm/hugetlb.c | 22 +- mm/mmap.c | 31 +- mm/mremap.c | 38 +- mm/rmap.c | 6 +- mm/vmalloc.c | 51 +- net/bluetooth/hci_core.c | 12 +- net/bluetooth/hci_debugfs.c | 2 +- net/bluetooth/hci_sock.c | 2 + net/bluetooth/l2cap_core.c | 7 +- net/bluetooth/l2cap_sock.c | 59 +- net/bluetooth/mgmt.c | 9 +- net/bluetooth/rfcomm/core.c | 134 ++- net/bluetooth/rfcomm/sock.c | 5 +- net/bluetooth/rfcomm/tty.c | 16 +- net/bridge/br_cfm.c | 11 +- net/bridge/br_device.c | 1 - net/bridge/br_input.c | 35 +- net/bridge/br_mrp.c | 13 +- net/bridge/br_multicast.c | 45 +- net/bridge/br_private.h | 26 +- net/can/af_can.c | 6 +- net/can/bcm.c | 2 + net/can/isotp.c | 11 +- net/can/j1939/socket.c | 1 + net/can/j1939/transport.c | 2 + net/can/raw.c | 7 +- net/core/flow_dissector.c | 26 +- net/core/page_pool.c | 3 +- net/hsr/hsr_framereg.c | 4 +- net/ipv4/fib_semantics.c | 5 +- net/ipv4/fib_trie.c | 2 - net/ipv4/ipconfig.c | 90 +- net/ipv4/ipmr.c | 3 +- net/ipv4/ipmr_base.c | 2 +- net/ipv4/route.c | 2 + net/ipv4/tcp.c | 4 +- net/ipv4/tcp_dctcp.c | 2 +- net/ipv4/tcp_input.c | 6 + net/ipv4/udp.c | 9 + net/ipv6/ip6_gre.c | 5 - net/ipv6/ip6_output.c | 35 +- net/ipv6/ip6mr.c | 2 +- net/ipv6/route.c | 2 - net/ipv6/seg6_iptunnel.c | 2 +- net/iucv/af_iucv.c | 42 +- net/mac80211/agg-rx.c | 2 +- net/mac80211/chan.c | 36 +- net/mac80211/fils_aead.c | 8 + net/mac80211/mesh_pathtbl.c | 16 +- net/mac80211/mlme.c | 5 +- net/mac80211/rc80211_minstrel_ht.c | 30 +- net/mac80211/sta_info.c | 6 +- net/mac80211/tx.c | 6 + net/mctp/device.c | 29 +- net/mctp/neigh.c | 4 +- net/mctp/route.c | 4 +- net/netfilter/ipset/ip_set_bitmap_gen.h | 2 +- net/netfilter/ipvs/ip_vs_conn.c | 3 + net/netfilter/ipvs/ip_vs_lblc.c | 4 + net/netfilter/ipvs/ip_vs_lblcr.c | 3 + net/netfilter/ipvs/ip_vs_sync.c | 33 +- net/netfilter/nf_tables_api.c | 54 +- net/netfilter/nf_tables_core.c | 29 +- net/netfilter/nf_tables_trace.c | 44 +- net/netfilter/nft_flow_offload.c | 8 +- net/netfilter/nft_set_bitmap.c | 4 +- net/netfilter/nft_set_hash.c | 8 +- net/netfilter/nft_set_pipapo.c | 10 +- net/netfilter/nft_set_rbtree.c | 10 +- net/netlink/af_netlink.c | 24 +- net/netlink/genetlink.c | 28 +- net/openvswitch/actions.c | 7 +- net/openvswitch/conntrack.c | 23 +- net/openvswitch/datapath.c | 8 + net/openvswitch/vport-netdev.c | 8 +- net/packet/af_packet.c | 6 +- net/rds/rdma_transport.c | 38 +- net/rds/tcp.c | 9 +- net/sched/act_api.c | 20 +- net/sched/cls_api.c | 15 +- net/sched/cls_flower.c | 5 + net/sched/cls_u32.c | 41 +- net/sched/em_text.c | 3 + net/sched/sch_codel.c | 2 +- net/sched/sch_fq_codel.c | 4 +- net/sctp/inqueue.c | 6 +- net/sctp/socket.c | 39 +- net/smc/af_smc.c | 7 +- net/strparser/strparser.c | 6 +- net/sunrpc/auth_gss/gss_rpc_xdr.c | 15 +- net/tipc/crypto.c | 20 +- net/tipc/node.c | 12 +- net/tipc/topsrv.c | 80 +- net/tls/tls_device.c | 7 +- net/vmw_vsock/af_vsock.c | 49 +- net/vmw_vsock/virtio_transport_common.c | 3 +- net/wireless/lib80211_crypt_tkip.c | 13 +- net/wireless/scan.c | 29 +- net/xfrm/xfrm_policy.c | 19 +- samples/pidfd/Makefile | 2 +- security/apparmor/include/label.h | 6 +- security/keys/key.c | 19 +- security/keys/keyctl.c | 15 +- security/keys/keyring.c | 151 ++-- security/keys/persistent.c | 55 +- security/keys/process_keys.c | 5 +- security/keys/trusted-keys/trusted_tpm1.c | 6 +- security/keys/trusted-keys/trusted_tpm2.c | 2 +- security/selinux/avc.c | 5 +- security/selinux/hooks.c | 9 +- sound/core/seq/seq_compat.c | 2 + sound/soc/codecs/adau1372.c | 18 +- sound/soc/codecs/cs42l52.c | 2 +- sound/soc/codecs/cs42l56.c | 2 +- sound/soc/codecs/max98371.c | 2 +- sound/soc/codecs/nau8822.c | 4 +- sound/soc/codecs/pcm3168a.c | 2 +- sound/soc/codecs/rt274.c | 4 +- sound/soc/codecs/wm8903.c | 2 +- sound/soc/codecs/wm8978.c | 4 +- sound/soc/qcom/lpass-cpu.c | 4 +- sound/soc/samsung/i2s.c | 8 + sound/soc/stm/stm32_spdifrx.c | 2 +- sound/usb/caiaq/device.c | 3 + sound/usb/card.h | 3 +- sound/usb/endpoint.c | 16 +- sound/usb/line6/playback.c | 7 + sound/usb/misc/ua101.c | 9 + sound/usb/quirks.c | 4 +- sound/virtio/virtio_card.c | 4 +- tools/gpio/Makefile | 6 + tools/perf/tests/bpf.c | 3 +- tools/perf/util/parse-events.c | 2 +- .../test.d/filter/event-filter-incomplete.tc | 24 + 527 files changed, 6088 insertions(+), 3172 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/571 tls: device: fix out-of-bounds write in tls_append_frag()
5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <[email protected]>
[ Upstream commit b17cf742eaad70ae29ac558cefb3aa9bbeea03d4 ]
Found with syzkaller and a local syzbot instance running on top of a netdevsim TLS offload emulation; tls_device.c is otherwise only reachable on a machine with a NIC that implements the offload.
tls_push_data() only checks whether the open record still has room for another frag at the bottom of its loop, and the MSG_MORE early break skips that check. The record survives to the next syscall with the frag count it already had, and tls_append_frag() does not check either, so with TLS_TX_ZEROCOPY_RO every splice(SPLICE_F_MORE) of a byte or two adds a non-coalescing pipe page and num_frags walks off the end of tls_record_info.frags[MAX_SKB_FRAGS]. Once the record is pushed, tls_push_record() runs the same index over sg_tx_data[MAX_SKB_FRAGS] and the sg_set_page() writes land on the destruct_work that follows it, which the workqueue then calls.
The byte limit is fine because copy drops to 0 and the loop falls through to the same check; the frag count has no such feedback.
Push the record rather than keep a full one open, which is what a plain TCP socket does - tcp_sendmsg_locked() uses tcp_mark_push() and new_segment in both the copy and the MSG_SPLICE_PAGES paths, and tls_sw already sets full_record when the sk_msg ring fills up, MSG_MORE or not.
BUG: KASAN: slab-out-of-bounds in tls_append_frag ( net/tls/tls_device.c:269) Write of size 8 at addr ffff8881104d1530 by task tls_oob/450 CPU: 2 UID: 0 PID: 450 Comm: tls_oob Not tainted 7.2.0-rc7+ #329 PREEMPT Call Trace: <TASK> dump_stack_lvl (lib/dump_stack.c:94 lib/dump_stack.c:120) print_report (mm/kasan/report.c:378 mm/kasan/report.c:482) kasan_report (mm/kasan/report.c:595) tls_append_frag (net/tls/tls_device.c:269) tls_push_data (net/tls/tls_device.c:518) tls_device_sendmsg (net/tls/tls_device.c:583) inet_sendmsg (net/ipv4/af_inet.c:865) sock_sendmsg (net/socket.c:775 net/socket.c:790 net/socket.c:813) splice_to_socket (fs/splice.c:884) do_splice (fs/splice.c:936 fs/splice.c:1349) __do_splice (fs/splice.c:1431) __x64_sys_splice (fs/splice.c:1634 fs/splice.c:1616) do_syscall_64 (arch/x86/entry/syscall_64.c:63 arch/x86/entry/syscall_64.c:94) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121) </TASK>
and, once the record is pushed:
UBSAN: array-index-out-of-bounds in net/tls/tls_device.c:300:24 index 18 is out of range for type 'skb_frag_t [17]' UBSAN: array-index-out-of-bounds in net/tls/tls_device.c:301:41 index 18 is out of range for type 'scatterlist [17]' UBSAN: array-index-out-of-bounds in net/tls/tls_device.c:302:39 index 18 is out of range for type 'scatterlist [17]' UBSAN: array-index-out-of-bounds in net/tls/tls_device.c:307:38 index 26 is out of range for type 'scatterlist [17]'
kernel tried to execute NX-protected page - exploit attempt? (uid: 0)
BUG: unable to handle page fault for address: ffffea000411a680 #PF: supervisor instruction fetch in kernel mode #PF: error_code(0x0011) - permissions violation Oops: Oops: 0011 [#1] SMP KASAN PTI Workqueue: ktls_device_destruct 0xffffea000411a680 RIP: 0010:0xffffea000411a680 Call Trace: <TASK> worker_thread (kernel/workqueue.c:3405 kernel/workqueue.c:3486) kthread (kernel/kthread.c:436) ret_from_fork (arch/x86/kernel/process.c:158) ret_from_fork_asm (arch/x86/entry/entry_64.S:245) </TASK>
--- net/tls/tls_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/tls/tls_device.c +2 -1
@@ -493,7 +493,8 @@ static int tls_push_data(struct sock *sk,if (!size) { last_record: tls_push_record_flags = flags; -if (flags & (MSG_SENDPAGE_NOTLAST |MSG_MORE )) { +if ((flags & (MSG_SENDPAGE_NOTLAST |MSG_MORE )) && + record->num_frags <MAX_SKB_FRAGS -1 ) { more = true;break ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2/571 apparmor: fix out-of-bounds write when null terminating a label vec
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hyunwoo Kim <[email protected]>
[ Upstream commit 9f1e40193eef7f047e6b77cfb4b4cafdecd7a123 ]
aa_vec_unique() null terminates at vec[n - dups] when VEC_FLAG_TERMINATE is passed. If the components are all distinct no duplicates are dropped, dups is 0 and the terminator goes to vec[n], so the caller has to provide room for n + 1 entries.
aa_label_strn_parse() sets up its vector with vec_setup(profile, vec, len, gfp) and then calls aa_vec_unique(vec, len, VEC_FLAG_TERMINATE), but vec_setup() does not reserve the terminator entry. Up to LOCAL_VEC_ENTRIES it uses the local array of LOCAL_VEC_ENTRIES pointers, above that it allocates exactly len pointers. The terminator therefore lands one entry past the end of the local array when len is LOCAL_VEC_ENTRIES, and one entry past the end of the allocation when len is larger.
len comes from the number of "//&" separated components in the label name and label_count_strn_entries() does not bound it. An unprivileged task reaches the parse by writing to /proc/self/attr/apparmor/current or through lsm_set_self_attr(2), both of which go through do_setattr(), and the name is parsed before the change_profile permission is checked.
The query_label() path behind the securityfs .access file, which is mode 0666, performs no permission check at all. Every component has to resolve to a loaded profile, so a system with policy loaded is required.
The other two VEC_FLAG_TERMINATE users work on a label vec that aa_label_alloc() has already sized with "+ 1 for null terminator entry on vec". Reserve the same entry in vec_setup() and DEFINE_VEC(). Passing len + 1 from the caller instead would move len == LOCAL_VEC_ENTRIES out of the local array and into kzalloc().
--- security/apparmor/include/label.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
security/apparmor/include/label.h +3 -3
@@ -22,7 +22,7 @@ struct aa_ns;#define LOCAL_VEC_ENTRIES 8#define DEFINE_VEC (T ,V ) \ - struct aa_ ## T *(_ ## V ## _localtmp)[LOCAL_VEC_ENTRIES]; \ + struct aa_ ## T *(_ ## V ## _localtmp)[LOCAL_VEC_ENTRIES + 1]; \ struct aa_ ## T **(V)#define vec_setup (T ,V ,N ,GFP ) \
@@ -30,10 +30,10 @@ struct aa_ns;if ((N ) <=LOCAL_VEC_ENTRIES ) { \typeof (N) i; \ (V) = (_ ## V ## _localtmp); \ - for (i = 0; i < (N); i++) \ + for (i = 0; i <= (N); i++) \ (V)[i] = NULL; \ } else \ - (V) = kzalloc(sizeof(struct aa_ ## T *) * (N), (GFP)); \ + (V) = kcalloc((N) + 1, sizeof(struct aa_ ## T *), (GFP)); \ (V) ? 0 : -ENOMEM; \ })
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 3/571 device property: Add cleanup.h based fwnode_handle_put() scope based cleanup.
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Cameron <[email protected]>
[ Upstream commit 59ed5e2d505bf5f9b4af64d0021cd0c96aec1f7c ]
Useful where the fwnode_handle was obtained from a call such as fwnode_find_reference() as it will safely do nothing if IS_ERR() is true and will automatically release the reference on the variable leaving scope.
Stable-dep-of: 190069255582 ("device property: fix infinite loop in fwnode_for_each_child_node()")
--- include/linux/property.h | 3 +++ 1 file changed, 3 insertions(+)
include/linux/property.h +3 -0
@@ -11,6 +11,7 @@#define _LINUX_PROPERTY_H_#include <linux/bits.h> +#include <linux/cleanup.h> #include <linux/fwnode.h> #include <linux/types.h>
@@ -124,6 +125,8 @@ struct fwnode_handle *device_get_named_child_node(struct device *dev,struct fwnode_handle *fwnode_handle_get (struct fwnode_handle *fwnode);void fwnode_handle_put (struct fwnode_handle *fwnode); +DEFINE_FREE(fwnode_handle, struct fwnode_handle *, fwnode_handle_put(_T)) +int fwnode_irq_get (const struct fwnode_handle *fwnode,unsigned int index);int fwnode_irq_get_byname (const struct fwnode_handle *fwnode,const char *name);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 4/571 device property: fix infinite loop in fwnode_for_each_child_node()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xu Yang <[email protected]>
[ Upstream commit 1900692555826753adab8799a1a8d50bb1ee200c ]
When iterate over children of a fwnode that has a secondary fwnode, fwnode_get_next_child_node() can enter an infinite loop if the secondary fwnode has more than one child.
Parent Child
(Primary fwnode) FWa: {FWa1, FWa2, FWa3}
(Secondary fwnode) FWb: {FWb1, FWb2}In this case:
┌─> fwnode_get_next_child_node(FWa, FWa1) │ - fwnode_call_ptr_op(FWa, get_next_child_node, FWa1) returns FWa2 │ │ ... │ │ fwnode_get_next_child_node(FWa, FWa3) │ - fwnode_call_ptr_op(FWa, get_next_child_node, FWa3) returns NULL │ - fwnode_call_ptr_op(FWb, get_next_child_node, FWa3) returns FWb1 │ │ fwnode_get_next_child_node(FWa, FWb1) │ - fwnode_call_ptr_op(FWa, get_next_child_node, FWb1) returns FWa1 └────┘
This cause fwnode_for_each_child_node() to loop indefinitely, reapeatedly output {FWa1, FWa2, FWa3, FWb1, FWa1, ...}.
The root cause is that when the current child (FWb1) belongs to the secondary fwnode, calling get_next_child_node() on the parimary fwnode incorrectly returns the first child (FWa1) again instead of NULL.
Fix this by dynamically checking the parent fwnode of the current child before calling get_next_child_node(). This approach follows the pattern established in commit b5b41ab6b0c1 ("device property: Check fwnode->secondary in fwnode_graph_get_next_endpoint()").
--- drivers/base/property.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/base/property.c +16 -3
@@ -748,18 +748,31 @@ struct fwnode_handle * fwnode_get_next_child_node(const struct fwnode_handle *fwnode, struct fwnode_handle *child) { + const struct fwnode_handle *parent; + struct fwnode_handle *child_parent __free(fwnode_handle) = NULL;struct fwnode_handle *next; -if (IS_ERR_OR_NULL (fwnode)) +/* +* If this function is in a loop and the previous iteration returned +* an child from fwnode->secondary, then we need to use the secondary +* as parent rather than @fwnode. +*/ +if (child) { + child_parent =fwnode_get_parent (child); + parent = child_parent; + }else { + parent = fwnode; + } +if (IS_ERR_OR_NULL (parent))return NULL ;/* Try to find a child in primary fwnode */ - next =fwnode_call_ptr_op (fwnode, get_next_child_node, child); + next =fwnode_call_ptr_op (parent, get_next_child_node, child);if (next)return next;/* When no more children in primary, continue with secondary */ -return fwnode_call_ptr_op (fwnode->secondary, get_next_child_node, child); +return fwnode_get_next_child_node (parent->secondary,NULL ); }EXPORT_SYMBOL_GPL (fwnode_get_next_child_node);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 5/571 nfsd: fix nfsd_file leak on inter-server COPY setup failure
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
[ Upstream commit 88a76145451d703eedd867b5989bf73d17340399 ]
When nfsd4_setup_inter_ssc() fails, nfsd4_copy() returns nfserr_offload_denied directly, bypassing the out: label where release_copy_files() would drop the nf_dst reference taken by nfs4_preprocess_stateid_op(). Each failed inter-server COPY leaks one nfsd_file, pinning file/inode/dentry/vfsmount.
Fix by setting status and jumping to out: instead of returning directly.
--- fs/nfsd/nfs4proc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/nfsd/nfs4proc.c +5 -3
@@ -1778,12 +1778,14 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, goto out; } status =nfsd4_setup_inter_ssc (rqstp, cstate, copy); -if (status) -return nfserr_offload_denied; +if (status) { + status = nfserr_offload_denied; + goto out; + } }else { status =nfsd4_setup_intra_ssc (rqstp, cstate, copy);if (status) -return status; + goto out; } memcpy(©->fh, &cstate->current_fh.fh_handle,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 6/571 ceph: bound copied dentry name length in NFS export get_name
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Bommarito <[email protected]>
[ Upstream commit eff8013c5a8916613c742ae5a2cc341cb605c0ae ]
ceph_get_name() copies the MDS-supplied name into the caller's NAME_MAX-sized buffer with memcpy(name, rinfo->dname, rinfo->dname_len) and then writes name[rinfo->dname_len] = 0, without checking dname_len against NAME_MAX. A malicious or buggy MDS that returns a LOOKUPNAME reply with dname_len > NAME_MAX overflows the buffer. __get_snap_name() copies rde->name / rde->name_len the same unchecked way.
Impact: a malicious or compromised Ceph MDS overflows the NAME_MAX name buffer in a client's NFS-export get_name path, a slab out-of-bounds write reported by KASAN. Reachable when a CephFS mount is re-exported over NFS.
Add ceph_export_copy_name(), which rejects lengths above NAME_MAX with -ENAMETOOLONG before the copy, and use it in both ceph_get_name() and __get_snap_name().
--- fs/ceph/export.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
fs/ceph/export.c +18 -5
@@ -422,6 +422,16 @@ static struct dentry *ceph_fh_to_parent(struct super_block *sb,return dentry; } +static int ceph_export_copy_name (char *name,const char *src,u32 len) +{ +if (len >NAME_MAX ) +return -ENAMETOOLONG ; + +memcpy (name, src, len); + name[len] ='\0' ; +return 0 ; +} +static int __get_snap_name (struct dentry *parent,char *name,struct dentry *child) {
@@ -487,9 +497,8 @@ static int __get_snap_name(struct dentry *parent, char *name,BUG_ON (!rde->inode.in);if (ceph_snap (inode) ==le64_to_cpu (rde->inode.in->snapid)) { -memcpy (name, rde->name, rde->name_len); - name[rde->name_len] ='\0' ; - err =0 ; + err =ceph_export_copy_name (name, rde->name, + rde->name_len); goto out; } }
@@ -551,8 +560,12 @@ static int ceph_get_name(struct dentry *parent, char *name,if (!err) {struct ceph_mds_reply_info_parsed *rinfo = &req->r_reply_info; -memcpy (name, rinfo->dname, rinfo->dname_len); - name[rinfo->dname_len] =0 ; + + err =ceph_export_copy_name (name, rinfo->dname, + rinfo->dname_len); + } + +if (!err) {dout ("get_name %p ino %llx.%llx name %s\n" , child,ceph_vinop (inode), name); }else {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 7/571 smb: client: fix OOB read/write from unvalidated DataOffset in coalesce_t2()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Sorenson <[email protected]>
[ Upstream commit 6343c1da561962688f203362d80d6a3bfa39fa1b ]
coalesce_t2() computes data pointers directly from server-supplied DataOffset fields with no validation against buffer bounds:
data_area_of_tgt = (char *)&pSMBt->hdr.Protocol +
get_unaligned_le16(&pSMBt->t2_rsp.DataOffset);
data_area_of_src = (char *)&pSMBs->hdr.Protocol +
get_unaligned_le16(&pSMBs->t2_rsp.DataOffset);
data_area_of_tgt += total_in_tgt;
...
memcpy(data_area_of_tgt, data_area_of_src, total_in_src);A small DataOffset can push a pointer below the actual byte area, overwriting header fields; a large one can push it past the buffer end, causing out-of-bounds heap reads (source) or writes (target). The BCC overflow guard does not prevent this: BCC reflects how much data is present, while DataOffset controls where in the buffer it starts.
The "validate target area" comment present since the function was first written in 2005 was a placeholder that was never implemented.
Add lower- and upper-bound checks for both data pointers before the memcpy, and before any target header fields are modified.
--- fs/cifs/smb1ops.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
fs/cifs/smb1ops.c +20 -1
@@ -319,12 +319,31 @@ coalesce_t2(char *second_buf, struct smb_hdr *target_hdr) data_area_of_tgt = (char *)&pSMBt->hdr.Protocol +get_unaligned_le16 (&pSMBt->t2_rsp.DataOffset); -/* validate target area */ data_area_of_src = (char *)&pSMBs->hdr.Protocol +get_unaligned_le16 (&pSMBs->t2_rsp.DataOffset); data_area_of_tgt += total_in_tgt; +/* +* DataOffset fields are server-supplied and not validated against +* buffer bounds; check both data pointers before mutating the +* target header. +*/ +if (data_area_of_tgt < (char *)target_hdr + +sizeof (struct smb_t2_rsp ) +sizeof (__le16) || + data_area_of_tgt + total_in_src > + (char *)target_hdr + CIFSMaxBufSize +MAX_CIFS_HDR_SIZE ) { +cifs_dbg (VFS ,"%s: target data area out of bounds\n" , __func__); +return -EPROTO ; + } +if (data_area_of_src < second_buf + +sizeof (struct smb_t2_rsp ) +sizeof (__le16) || + data_area_of_src + total_in_src > + second_buf +smbCalcSize ((struct smb_hdr *)second_buf)) { +cifs_dbg (VFS ,"%s: secondary data area out of bounds\n" , __func__); +return -EPROTO ; + } + total_in_tgt += total_in_src;/* is the result too big for the field? */ if (total_in_tgt >USHRT_MAX ) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 8/571 HID: sony: fix UAF of ghl_poke_timer / ghl_urb at driver unbind
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Doruk Tan Ozturk <[email protected]>
[ Upstream commit a26705bd2e2728833e7a538ce91e58a5eeff496a ]
For GHL (Guitar Hero Live) dongles, sony_probe() arms a periodic timer:ghl_magic_poke() (the timer callback) submits sc->ghl_urb, and the URB completion ghl_magic_poke_cb() re-arms the timer with mod_timer().
sony_remove() drained the timer with timer_delete_sync() and then freed the URB with usb_free_urb():
timer_delete_sync(&sc->ghl_poke_timer); usb_free_urb(sc->ghl_urb);
timer_delete_sync() does not block re-arming, and while the URB is in flight the timer is not pending, so the sync delete is a no-op. A URB completion that runs after the delete re-arms the timer, and usb_free_urb() only drops a reference -- it does not kill an in-flight URB. sc is allocated with devm_kzalloc() and freed once sony_remove() returns, so the re-armed ghl_poke_timer (embedded in sc) then fires on freed memory, a use-after-free from timer softirq. This is a disconnect/rmmod race.
Poison the URB first, then shut the timer down, before freeing the URB. usb_poison_urb() kills any in-flight URB and permanently rejects further submissions, so a poke timer that is still pending cannot re-submit the URB from ghl_magic_poke() in the window before timer_shutdown_sync() runs. usb_kill_urb() would not suffice: it only cancels the in-flight URB and leaves it submittable once it returns, so the pending timer could re-submit it and put a fresh URB in flight over the freed sc. timer_shutdown_sync() then drains any last callback and blocks re-arming. The probe error path is unaffected: it is only reached before the timer is armed.
Reproduced under KASAN on next-20260710 via dummy_hcd + raw-gadget emulation of the GHL PS4 dongle (VID 0x1430 / PID 0x07bb): hid-sony binds and arms the poke timer, the poke URB is held in flight, the driver is unbound (freeing sc), then the URB is released. The completion re-arms the timer on the freed sc, and the re-armed timer fires ~8 s later:
BUG: KASAN: slab-use-after-free in ghl_magic_poke+0x98/0xb0 Read of size 8 at addr ffff88810b02fd50 by task swapper/0/0 ghl_magic_poke+0x98/0xb0 call_timer_fn+0x35/0x2b0 __run_timers+0x69c/0x9a0 run_timer_softirq+0x173/0x2a0 Allocated by task 169: sony_probe Freed by task 338: devres_release_group <- hid_device_remove (sony_remove)
Found by 0sec (https://0sec.ai) using automated source analysis.
--- drivers/hid/hid-sony.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hid/hid-sony.c +3 -1
@@ -3085,7 +3085,9 @@ static void sony_remove(struct hid_device *hdev)struct sony_sc *sc =hid_get_drvdata (hdev);if (sc->quirks & (GHL_GUITAR_PS3WIIU |GHL_GUITAR_PS4 )) { -del_timer_sync (&sc->ghl_poke_timer); +/* poison, not kill: a pending timer must not re-submit during teardown */ +usb_poison_urb (sc->ghl_urb); +timer_shutdown_sync (&sc->ghl_poke_timer);usb_free_urb (sc->ghl_urb); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 9/571 nouveau/gem: reserve the bo in the info ioctl around the vma lookup
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
[ Upstream commit 5e17160d41d92823f3379c1982e1369680c5ce4d ]
In the non-uvmm path, there could be a race between the info lookup finding the vma, and the gem close path closing the vma leading to a use-after-free.
Spotted with the help of Opus 4.6.
--- drivers/gpu/drm/nouveau/nouveau_gem.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_gem.c +10 -1
@@ -277,11 +277,20 @@ nouveau_gem_info(struct drm_file *file_priv, struct drm_gem_object *gem, rep->domain =NOUVEAU_GEM_DOMAIN_VRAM ; rep->offset = nvbo->offset;if (vmm->vmm.object.oclass >=NVIF_CLASS_VMM_NV50 ) { +int ret; + + ret =ttm_bo_reserve (&nvbo->bo, false, false,NULL ); +if (ret) +return ret; + vma =nouveau_vma_find (nvbo, vmm); -if (!vma) +if (!vma) { +ttm_bo_unreserve (&nvbo->bo);return -EINVAL ; + } rep->offset = vma->addr; +ttm_bo_unreserve (&nvbo->bo); } rep->size = nvbo->bo.base.size;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 10/571 ocfs2: validate dx_root extent list fields during block read
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joseph Qi <[email protected]>
[ Upstream commit 775c17386a6fd695f999d4cda90e3931386570dd ]
Patch series "ocfs2: consolidate extent list validation into block read callbacks".
ocfs2 validates extent list fields (l_count, l_next_free_rec) at various points during extent tree traversal. This is fragile because each caller must remember to check for corrupted on-disk data before using it.
This series moves those checks into the block read validation callbacks (ocfs2_validate_dx_root and ocfs2_validate_extent_block), so corrupted fields are caught early at block read time. Redundant post-read checks are then removed.
This patch (of 4):
Move the extent list l_count validation from ocfs2_dx_dir_lookup_rec() into ocfs2_validate_dx_root(), so that corrupted on-disk fields are caught early at block read time rather than during directory lookups.
Additionally, add a l_next_free_rec <= l_count check to prevent out-of-bounds access when iterating over extent records.
Both checks are skipped for inline dx roots (OCFS2_DX_FLAG_INLINE), which use dr_entries instead of dr_list.
Stable-dep-of: bc70726ddad5 ("ocfs2: validate directory-index entry counts when reading metadata")
--- fs/ocfs2/dir.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)
fs/ocfs2/dir.c +25 -1
@@ -580,7 +580,7 @@ static int ocfs2_validate_dx_root(struct super_block *sb,mlog (ML_ERROR ,"Checksum failed for dir index root block %llu\n" , (unsigned long long )bh->b_blocknr); -return ret; + goto bail; }if (!OCFS2_IS_VALID_DX_ROOT (dx_root)) {
@@ -588,8 +588,32 @@ static int ocfs2_validate_dx_root(struct super_block *sb,"Dir Index Root # %llu has bad signature %.*s\n" , (unsigned long long )le64_to_cpu (dx_root->dr_blkno), 7, dx_root->dr_signature); + goto bail; + } + +if (!(dx_root->dr_flags &OCFS2_DX_FLAG_INLINE )) { +struct ocfs2_extent_list *el = &dx_root->dr_list; + +if (le16_to_cpu (el->l_count) !=ocfs2_extent_recs_per_dx_root (sb)) { + ret =ocfs2_error (sb, +"Dir Index Root # %llu has invalid l_count %u (expected %u)\n" , + (unsigned long long )le64_to_cpu (dx_root->dr_blkno), +le16_to_cpu (el->l_count), +ocfs2_extent_recs_per_dx_root (sb)); + goto bail; + } + +if (le16_to_cpu (el->l_next_free_rec) >le16_to_cpu (el->l_count)) { + ret =ocfs2_error (sb, +"Dir Index Root # %llu has invalid l_next_free_rec %u (l_count %u)\n" , + (unsigned long long )le64_to_cpu (dx_root->dr_blkno), +le16_to_cpu (el->l_next_free_rec), +le16_to_cpu (el->l_count)); + goto bail; + } } +bail:return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 11/571 ocfs2: validate directory-index entry counts when reading metadata
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Doruk Tan Ozturk <[email protected]>
[ Upstream commit bc70726ddad53c7e9a9a85915bf2415b0d4f42f9 ]
ocfs2_validate_dx_leaf() and ocfs2_validate_dx_root() check the ECC and signature of an indexed-directory block before it reaches higher-level callers, but neither validator bounds the ocfs2_dx_entry_list counts against the capacity of the block that holds them.
ocfs2_dx_dir_search() then walks
for (i = 0; i < le16_to_cpu(entry_list->de_num_used); i++) dx_entry = &entry_list->de_entries[i];
over de_num_used entries with no bounds check. entry_list is either dx_leaf->dl_list (from ocfs2_read_dx_leaf) or, for an inline root, dx_root->dr_entries. A crafted on-disk image can set de_num_used (and de_count, which is the __counted_by_le() bound of de_entries) to 0xffff and make the walk read far past the end of the 4KB metadata block, giving a slab out-of-bounds read reachable from any path lookup, stat() or open() on an indexed directory once the image is mounted.
Commit 775c17386a6f ("ocfs2: validate dx_root extent list fields during block read") already bounds dr_list for the non-inline dx_root, but left the inline dr_entries path and the dx_leaf dl_list unchecked. Add the same read-time validation for both entry lists: de_count must equal the capacity of the block (ocfs2_dx_entries_per_leaf()/per_root()) and de_num_used must not exceed de_count, rejecting corrupted metadata with -EFSCORRUPTED before ocfs2_dx_dir_search() can walk an out-of-range entry array.
de_count is always written as exactly the block capacity when a leaf or inline root is formatted, so the equality check does not reject any valid image.
Found by 0sec automated security-research tooling (https://0sec.ai).
--- fs/ocfs2/dir.c | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-)
fs/ocfs2/dir.c +41 -4
@@ -611,6 +611,28 @@ static int ocfs2_validate_dx_root(struct super_block *sb, le16_to_cpu(el->l_count)); goto bail; } + }else { +struct ocfs2_dx_entry_list *dl_list = &dx_root->dr_entries; + +if (le16_to_cpu (dl_list->de_count) != +ocfs2_dx_entries_per_root (sb)) { + ret =ocfs2_error (sb, +"Dir Index Root # %llu has invalid de_count %u (expected %u)\n" , + (unsigned long long )le64_to_cpu (dx_root->dr_blkno), +le16_to_cpu (dl_list->de_count), +ocfs2_dx_entries_per_root (sb)); + goto bail; + } + +if (le16_to_cpu (dl_list->de_num_used) > +le16_to_cpu (dl_list->de_count)) { + ret =ocfs2_error (sb, +"Dir Index Root # %llu has invalid de_num_used %u (de_count %u)\n" , + (unsigned long long )le64_to_cpu (dx_root->dr_blkno), +le16_to_cpu (dl_list->de_num_used), +le16_to_cpu (dl_list->de_count)); + goto bail; + } } bail:
@@ -650,10 +672,25 @@ static int ocfs2_validate_dx_leaf(struct super_block *sb,return ret; } -if (!OCFS2_IS_VALID_DX_LEAF (dx_leaf)) { - ret =ocfs2_error (sb,"Dir Index Leaf has bad signature %.*s\n" , -7 , dx_leaf->dl_signature); - } +if (!OCFS2_IS_VALID_DX_LEAF (dx_leaf)) +return ocfs2_error (sb,"Dir Index Leaf has bad signature %.*s\n" , +7 , dx_leaf->dl_signature); + +if (le16_to_cpu (dx_leaf->dl_list.de_count) != +ocfs2_dx_entries_per_leaf (sb)) +return ocfs2_error (sb, +"Dir Index Leaf # %llu has invalid de_count %u (expected %u)\n" , + (unsigned long long )le64_to_cpu (dx_leaf->dl_blkno), +le16_to_cpu (dx_leaf->dl_list.de_count), +ocfs2_dx_entries_per_leaf (sb)); + +if (le16_to_cpu (dx_leaf->dl_list.de_num_used) > +le16_to_cpu (dx_leaf->dl_list.de_count)) +return ocfs2_error (sb, +"Dir Index Leaf # %llu has invalid de_num_used %u (de_count %u)\n" , + (unsigned long long )le64_to_cpu (dx_leaf->dl_blkno), +le16_to_cpu (dx_leaf->dl_list.de_num_used), +le16_to_cpu (dx_leaf->dl_list.de_count));return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 12/571 nvme-tcp: validate R2T PDU in nvme_tcp_handle_r2t()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Varun Prakash <[email protected]>
[ Upstream commit 1d3ef9c3a39e04be31155c27ebf80342350c3abf ]
If maxh2cdata < r2t_length then driver will form multiple H2CData PDUs, validate R2T PDU in nvme_tcp_handle_r2t() to reuse nvme_tcp_setup_h2c_data_pdu().
Also set req->state to NVME_TCP_SEND_H2C_PDU innvme_tcp_setup_h2c_data_pdu().
Stable-dep-of: 6efbc52237fa ("nvme-tcp: fix host memory disclosure on R2T for a read command")
--- drivers/nvme/host/tcp.c | 55 ++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 31 deletions(-)
drivers/nvme/host/tcp.c +24 -31
@@ -643,7 +643,7 @@ static int nvme_tcp_handle_comp(struct nvme_tcp_queue *queue,return ret; } -static int nvme_tcp_setup_h2c_data_pdu (struct nvme_tcp_request *req, +static void nvme_tcp_setup_h2c_data_pdu (struct nvme_tcp_request *req,struct nvme_tcp_r2t_pdu *pdu) {struct nvme_tcp_data_pdu *data = req->pdu;
@@ -652,32 +652,11 @@ static int nvme_tcp_setup_h2c_data_pdu(struct nvme_tcp_request *req,u8 hdgst =nvme_tcp_hdgst_len (queue);u8 ddgst =nvme_tcp_ddgst_len (queue); + req->state =NVME_TCP_SEND_H2C_PDU ; + req->offset =0 ; req->pdu_len =le32_to_cpu (pdu->r2t_length); req->pdu_sent =0 ; -if (unlikely (!req->pdu_len)) { -dev_err (queue->ctrl->ctrl.device, -"req %d r2t len is %u, probably a bug...\n" , - rq->tag, req->pdu_len); -return -EPROTO ; - } - -if (unlikely (req->data_sent + req->pdu_len > req->data_len)) { -dev_err (queue->ctrl->ctrl.device, -"req %d r2t len %u exceeded data len %u (%zu sent)\n" , - rq->tag, req->pdu_len, req->data_len, - req->data_sent); -return -EPROTO ; - } - -if (unlikely (le32_to_cpu (pdu->r2t_offset) < req->data_sent)) { -dev_err (queue->ctrl->ctrl.device, -"req %d unexpected r2t offset %u (expected %zu)\n" , - rq->tag,le32_to_cpu (pdu->r2t_offset), - req->data_sent); -return -EPROTO ; - } -memset (data,0 ,sizeof (*data)); data->hdr.type = nvme_tcp_h2c_data; data->hdr.flags =NVME_TCP_F_DATA_LAST ;
@@ -693,7 +672,6 @@ static int nvme_tcp_setup_h2c_data_pdu(struct nvme_tcp_request *req, data->command_id =nvme_cid (rq); data->data_offset = pdu->r2t_offset; data->data_length =cpu_to_le32 (req->pdu_len); -return 0 ; } static int nvme_tcp_handle_r2t(struct nvme_tcp_queue *queue,
@@ -701,7 +679,7 @@ static int nvme_tcp_handle_r2t(struct nvme_tcp_queue *queue, {struct nvme_tcp_request *req;struct request *rq; -int ret; +u32 r2t_length =le32_to_cpu (pdu->r2t_length); rq =nvme_find_rq (nvme_tcp_tagset (queue), pdu->command_id);if (!rq) {
@@ -712,13 +690,28 @@ static int nvme_tcp_handle_r2t(struct nvme_tcp_queue *queue, } req =blk_mq_rq_to_pdu (rq); - ret =nvme_tcp_setup_h2c_data_pdu (req, pdu); -if (unlikely (ret)) -return ret; +if (unlikely (!r2t_length)) { +dev_err (queue->ctrl->ctrl.device, +"req %d r2t len is %u, probably a bug...\n" , + rq->tag, r2t_length); +return -EPROTO ; + } - req->state =NVME_TCP_SEND_H2C_PDU ; - req->offset =0 ; +if (unlikely (req->data_sent + r2t_length > req->data_len)) { +dev_err (queue->ctrl->ctrl.device, +"req %d r2t len %u exceeded data len %u (%zu sent)\n" , + rq->tag, r2t_length, req->data_len, req->data_sent); +return -EPROTO ; + } + +if (unlikely (le32_to_cpu (pdu->r2t_offset) < req->data_sent)) { +dev_err (queue->ctrl->ctrl.device, +"req %d unexpected r2t offset %u (expected %zu)\n" , + rq->tag,le32_to_cpu (pdu->r2t_offset), req->data_sent); +return -EPROTO ; + } +nvme_tcp_setup_h2c_data_pdu (req, pdu);nvme_tcp_queue_request (req, false, true);return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 13/571 nvme-tcp: fix host memory disclosure on R2T for a read command
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yehyeong Lee <[email protected]>
[ Upstream commit 6efbc52237facda35d2d874fe1765bb4839275d8 ]
nvme_tcp_handle_r2t() does not check the direction of the request the R2T refers to. A malicious controller can send an R2T for a READ and the host will answer it: nvme_tcp_setup_h2c_data_pdu() builds the H2CData header and nvme_tcp_try_send_data() sends the request's data buffer. That buffer is the READ destination, so its contents go to the controller.
The command then completes normally and nothing is logged.
Against a test controller that answers every READ with an R2T, a 4096 byte buffered read returned all 4096 bytes, split over two R2Ts. The pages contained stale kernel data, including an array of struct page pointers.
Reject an R2T for a request that is not a write.
--- drivers/nvme/host/tcp.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/nvme/host/tcp.c +7 -0
@@ -690,6 +690,13 @@ static int nvme_tcp_handle_r2t(struct nvme_tcp_queue *queue, } req =blk_mq_rq_to_pdu (rq); +if (unlikely (rq_data_dir (rq) !=WRITE )) { +dev_err (queue->ctrl->ctrl.device, +"req %d unexpected r2t for a non-write command\n" , + rq->tag); +return -EPROTO ; + } +if (unlikely (!r2t_length)) { dev_err(queue->ctrl->ctrl.device, "req %d r2t len is %u, probably a bug...\n",
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 14/571 wifi: rtl8xxxu: fix use-after-free from rx_urb_wq on stop
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fan Wu <[email protected]>
[ Upstream commit 6c080026ecc17eecb103f8927c64ea73a74bb818 ]
rtl8xxxu arms rx_urb_wq from the RX completion path:rtl8xxxu_rx_complete() hands the URB to rtl8xxxu_queue_rx_urb(), which queues it on rx_urb_pending_list and, once the list grows past RTL8XXXU_RX_URB_PENDING_WATER, schedules rx_urb_wq. The worker rtl8xxxu_rx_urb_work() drains rx_urb_pending_list, recovers priv through container_of, and resubmits each URB through rtl8xxxu_submit_rx_urb(), which anchors it on rx_anchor and dereferences priv->udev.
rtl8xxxu_stop() cancels the sibling work items (c2hcmd_work, ra_watchdog, update_beacon_work) but never cancels rx_urb_wq, so a worker armed during the last burst of RX traffic can run rtl8xxxu_rx_urb_work() after rtl8xxxu_disconnect() has called ieee80211_free_hw(), which frees priv, producing a use-after-free. The window opens under active RX traffic (pending count above the watermark) followed by a disconnect.
There are two teardown races to close:
* rtl8xxxu_queue_rx_urb() decided whether to enqueue under rx_urb_lock but called schedule_work() after dropping the lock. A completion that observed shutdown == false and released the lock could then call schedule_work() after rtl8xxxu_stop() had set shutdown and cancel_work_sync() had already returned, arming the worker to run after the teardown. Move schedule_work() under the same !shutdown branch so the arming decision is atomic with the shutdown check.
* rtl8xxxu_rx_urb_work() anchors every URB it drained back onto rx_anchor through rtl8xxxu_submit_rx_urb(). A worker still running when usb_kill_anchored_urbs(&priv->rx_anchor) returned would submit a URB that escaped the kill. In rtl8xxxu_stop(), call cancel_work_sync(&priv->rx_urb_wq) before the kill so the worker is drained first.
After priv->shutdown is set under rx_urb_lock, completions can no longer queue rx_urb_wq. cancel_work_sync() then drains the last queued or running worker, and the following usb_kill_anchored_urbs() kills the URBs it may have submitted.
rtl8xxxu_disconnect() is covered because ieee80211_unregister_hw() guarantees .stop() runs for a live interface before ieee80211_free_hw() frees priv. The probe error path needs no cancel: rx_urb_wq is INIT_WORK()'d there but cannot have been scheduled, since no URB is submitted before ieee80211_register_hw() succeeds.
This bug was found by static analysis.
--- .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +14 -5
@@ -5171,14 +5171,19 @@ static void rtl8xxxu_queue_rx_urb(struct rtl8xxxu_priv *priv, {struct sk_buff *skb;unsigned long flags; -int pending =0 ;spin_lock_irqsave (&priv->rx_urb_lock, flags);if (!priv->shutdown) {list_add_tail (&rx_urb->list, &priv->rx_urb_pending_list); priv->rx_urb_pending_count++; - pending = priv->rx_urb_pending_count; +/* +* Arm the worker under rx_urb_lock so this is atomic with the +* shutdown check: moving it out of the lock would let a +* completion arm the work after rtl8xxxu_stop() canceled it. +*/ +if (priv->rx_urb_pending_count >RTL8XXXU_RX_URB_PENDING_WATER ) +schedule_work (&priv->rx_urb_wq); }else { skb = (struct sk_buff *)rx_urb->urb.context;dev_kfree_skb_irq (skb);
@@ -5186,9 +5191,6 @@ static void rtl8xxxu_queue_rx_urb(struct rtl8xxxu_priv *priv, }spin_unlock_irqrestore (&priv->rx_urb_lock, flags); - -if (pending >RTL8XXXU_RX_URB_PENDING_WATER ) -schedule_work (&priv->rx_urb_wq); }static void rtl8xxxu_rx_urb_work (struct work_struct *work)
@@ -6465,6 +6467,13 @@ static void rtl8xxxu_stop(struct ieee80211_hw *hw) priv->shutdown = true;spin_unlock_irqrestore (&priv->rx_urb_lock, flags); +/* +* Cancel before killing rx_anchor: the worker re-anchors every URB +* it drained via rtl8xxxu_submit_rx_urb(), so a worker still running +* after the kill could submit a URB that escapes it. +*/ +cancel_work_sync (&priv->rx_urb_wq); +usb_kill_anchored_urbs (&priv->rx_anchor);usb_kill_anchored_urbs (&priv->tx_anchor);if (priv->usb_interrupts)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 15/571 usb: storage: realtek_cr: fix use-after-free on disconnect
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myeonghun Pak <[email protected]>
[ Upstream commit 4ffee1aebb0c0ffcda9faffd17834ea9b00d42cc ]
realtek_cr_destructor() calls timer_delete() before the chip containing the timer is freed. The timer callback may still be running and can rearm itself, resulting in a use-after-free.
Use timer_shutdown_sync() to wait for the callback and prevent further rearming. Do this unconditionally because ss_en may be changed after the timer is armed.
Move timer_setup() into init_realtek_cr() so the timer is initialized before any failure path can invoke the destructor.
Found by static analysis.
--- drivers/usb/storage/realtek_cr.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/usb/storage/realtek_cr.c +4 -5
@@ -915,7 +915,6 @@ static int realtek_cr_autosuspend_setup(struct us_data *us) us->proto_handler = rts51x_invoke_transport; chip->timer_expires =0 ; -timer_setup (&chip->rts51x_suspend_timer, rts51x_suspend_timer_fn,0 );fw5895_init (us);/* enable autosuspend function of the usb device */
@@ -933,10 +932,7 @@ static void realtek_cr_destructor(void *extra)return ;#ifdef CONFIG_REALTEK_AUTOPM -if (ss_en) { -del_timer (&chip->rts51x_suspend_timer); - chip->timer_expires =0 ; - } +timer_shutdown_sync (&chip->rts51x_suspend_timer);#endif kfree (chip->status); }
@@ -981,6 +977,9 @@ static int init_realtek_cr(struct us_data *us) us->extra = chip; us->extra_destructor = realtek_cr_destructor; +#ifdef CONFIG_REALTEK_AUTOPM +timer_setup (&chip->rts51x_suspend_timer, rts51x_suspend_timer_fn,0 ); +#endif us->max_lun = chip->max_lun =rts51x_get_max_lun (us); chip->us = us;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 16/571 staging: rtl8723bs: fix spacing around operators
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vivek BalachandharTN <[email protected]>
[ Upstream commit 2038fe84b8bdf894b634f777096685e78e8f3774 ]
Fix several instances where operators lacked spaces around them. This improves readability and brings the driver closer to kernel coding-style guidelines. No functional change.
For this stable dependency, retain only the spacing change to the IE advance in rtw_restruct_wmm_ie(). This supplies the exact context needed by target commit 28a289beaf226 ("staging: rtl8723bs: fix OOB read in rtw_restruct_wmm_ie()"). Drop the unrelated operator-spacing hunks.
Keep the existing bounds-first WMM match condition from stable commit 4dd2d9cf563c5 (upstream a75281626fc8f); applying the older condition would undo its out-of-bounds-read fix. No functional change.
Stable-dep-of: 28a289beaf22 ("staging: rtl8723bs: fix OOB read in rtw_restruct_wmm_ie()")
--- drivers/staging/rtl8723bs/core/rtw_mlme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8723bs/core/rtw_mlme.c +1 -1
@@ -2023,7 +2023,7 @@ int rtw_restruct_wmm_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie, uint in_break ; } - i += (in_ie[i+1 ]+2 );/* to the next IE element */ + i += (in_ie[i +1 ] +2 );/* to the next IE element */ }return ielength;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 17/571 staging: rtl8723bs: fix OOB read in rtw_restruct_wmm_ie()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muhammad Bilal <[email protected]>
[ Upstream commit 28a289beaf226b30b1e6e7d7b1a2946fe2d6e852 ]
rtw_restruct_wmm_ie() scans in_ie for a WMM IE with:
while (i < in_len) {
...
if (i + 5 < in_len && in_ie[i] == 0xDD && ...) {
...
break;
}
i += (in_ie[i + 1] + 2); /* to the next IE element */
}When the "i + 5 < in_len" match check fails simply because i is within 5 bytes of the end of the buffer (i.e. no WMM IE was found near the tail of in_ie), execution falls through to
"i += (in_ie[i + 1] + 2)", which reads in_ie[i + 1]. If i == in_len
- 1 at that point, this is a 1-byte out-of-bounds read of an attacker-influenced IE buffer built from association/scan data.
Commit a75281626fc8f ("staging: rtl8723bs: fix potential out-of-bounds read in rtw_restruct_wmm_ie") added the "i + 5 < in_len" guard to the match condition itself, but did not add an equivalent guard before the fallthrough advance, so the same class of OOB read remained reachable through the non-matching path.
Add an explicit bounds check before advancing to the next IE.
--- drivers/staging/rtl8723bs/core/rtw_mlme.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/staging/rtl8723bs/core/rtw_mlme.c +3 -0
@@ -2023,6 +2023,9 @@ int rtw_restruct_wmm_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie, uint in_break ; } +if (i +1 >= in_len) +break ; + i += (in_ie[i +1 ] +2 );/* to the next IE element */ }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 18/571 ftrace: Take trace_array reference before accessing its ftrace_ops
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
[ Upstream commit 9100191e5acb2e5ea2313f436667bb5fce129f47 ]
The trace instance files set_ftrace_filter and set_ftrace_notrace was updated to work with specific trace instances (trace_arrays). The issue is that when these files are opened, there is a small race window where it will use the ftrace_ops from the inode->private pointer to get a reference to the trace_array and then take its reference. The problem is that the ftrace_ops itself could be freed. If the rmdir on the instance happens at the same time the set_ftrace_filter file is opened, the rmdir could have also freed the ftrace_ops and referencing it will cause a use-after-free bug and crash the kernel.
Instead, pass in the trace_array as the file private data (NULL for the top level instance), and then pass both the trace_array and the ftrace_ops to the ftrace_regex_open() function. If the trace_array is NULL, then it just uses the ftrace_ops without the need to take its reference (like normal). If the ftrace_ops is NULL, that is only the case for the top level instance and the global_ops can be used.
This allows the trace_array to have its reference incremented before touching the ftrace_ops that could also be freed when the instance is.
--- include/linux/ftrace.h | 5 +-- kernel/trace/ftrace.c | 59 ++++++++++++++++++++++------------ kernel/trace/trace.h | 4 +-- kernel/trace/trace_functions.c | 2 +- kernel/trace/trace_stack.c | 2 +- 5 files changed, 46 insertions(+), 26 deletions(-)
include/linux/ftrace.h +3 -2
@@ -559,8 +559,9 @@ unsigned long ftrace_get_addr_new(struct dyn_ftrace *rec);unsigned long ftrace_get_addr_curr (struct dyn_ftrace *rec);extern ftrace_func_t ftrace_trace_function; +struct trace_array ; -int ftrace_regex_open (struct ftrace_ops *ops,int flag, +int ftrace_regex_open (struct trace_array *tr,struct ftrace_ops *ops,int flag,struct inode *inode,struct file *file);ssize_t ftrace_filter_write (struct file *file,const char __user *ubuf,size_t cnt,loff_t *ppos);
@@ -774,7 +775,7 @@ static inline unsigned long ftrace_location(unsigned long ip)* have them defined when ftrace is not enabled, but these * functions may still be called. Use a macro instead of inline. */ -#define ftrace_regex_open (ops, flag, inod, file) ({ -ENODEV; }) +#define ftrace_regex_open (tr, ops, flag, inode, file) ({ -ENODEV; })#define ftrace_set_early_filter (ops, buf, enable) do { } while (0)#define ftrace_set_filter_ip (ops, ip, remove, reset) ({ -ENODEV; })#define ftrace_set_filter (ops, buf, len, reset) ({ -ENODEV; })
kernel/trace/ftrace.c +39 -20
121 lines not on this page · raw message
kernel/trace/trace.h +2 -2
@@ -1093,7 +1093,7 @@ extern void clear_ftrace_function_probes(struct trace_array *tr);int register_ftrace_command (struct ftrace_func_command *cmd);int unregister_ftrace_command (struct ftrace_func_command *cmd); -void ftrace_create_filter_files (struct ftrace_ops *ops, +void ftrace_create_filter_files (struct trace_array *tr,struct dentry *parent);void ftrace_destroy_filter_files (struct ftrace_ops *ops);
@@ -1116,11 +1116,11 @@ static inline void clear_ftrace_function_probes(struct trace_array *tr) { } +#define ftrace_create_filter_files (tr, parent) do { } while (0)/* * The ops parameter passed in is usually undefined. * This must be a macro. */ -#define ftrace_create_filter_files (ops, parent) do { } while (0)#define ftrace_destroy_filter_files (ops) do { } while (0)#endif /* CONFIG_FUNCTION_TRACER && CONFIG_DYNAMIC_FTRACE */
kernel/trace/trace_functions.c +1 -1
@@ -90,7 +90,7 @@ int ftrace_create_function_files(struct trace_array *tr,if (!tr->ops)return -EINVAL ; -ftrace_create_filter_files (tr->ops, parent); +ftrace_create_filter_files (tr, parent);return 0 ; }
kernel/trace/trace_stack.c +1 -1
@@ -499,7 +499,7 @@ stack_trace_filter_open(struct inode *inode, struct file *file)struct ftrace_ops *ops = inode->i_private;/* Checks for tracefs lockdown */ -return ftrace_regex_open (ops,FTRACE_ITER_FILTER , +return ftrace_regex_open (NULL , ops,FTRACE_ITER_FILTER , inode, file); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 19/571 kprobes: Protect kprobe_blacklist with RCU
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <[email protected]>
[ Upstream commit 0c4256196b3a105307e2235fbfd85e768bbcdd0f ]
__within_kprobe_blacklist() traverses kprobe_blacklist without holding kprobe_mutex. When a module is unloaded, kprobe_remove_area_blacklist() removes blacklist entries and immediately frees them with kfree(). A concurrent call to within_kprobe_blacklist() can therefore dereference freed memory.
Furthermore, within_kprobe_blacklist() can be called in atomic or non-preemptible contexts where the sleeping kprobe_mutex cannot be taken.
Protect kprobe_blacklist with RCU. Use guard(rcu)() and list_for_each_entry_rcu() for traversal, list_add_tail_rcu() for insertions, list_del_rcu() for deletions, and kfree_rcu() to reclaim entries safely after a grace period.
--- include/linux/kprobes.h | 1 + kernel/kprobes.c | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-)
include/linux/kprobes.h +1 -0
@@ -177,6 +177,7 @@ struct kprobe_blacklist_entry {struct list_head list;unsigned long start_addr;unsigned long end_addr; +struct rcu_head rcu; };#ifdef CONFIG_KPROBES
kernel/kprobes.c +14 -5
@@ -1427,11 +1427,20 @@ static bool __within_kprobe_blacklist(unsigned long addr)/* * If there exists a kprobe_blacklist, verify and * fail any probe registration in the prohibited area +* Note: this can return true during transition period where +* (start_addr, end_addr) in the black list is shrinking +* but old entry has not been removed yet. This is acceptable +* because the worst case is that we reject more probes than +* we should. */ -list_for_each_entry (ent, &kprobe_blacklist, list) { -if (addr >= ent->start_addr && addr < ent->end_addr) +rcu_read_lock (); +list_for_each_entry_rcu (ent, &kprobe_blacklist, list) { +if (addr >= ent->start_addr && addr < ent->end_addr) { +rcu_read_unlock ();return true; + } } +rcu_read_unlock ();return false; }
@@ -2258,7 +2267,7 @@ int kprobe_add_ksym_blacklist(unsigned long entry) ent->start_addr = entry; ent->end_addr = entry + size;INIT_LIST_HEAD (&ent->list); -list_add_tail (&ent->list, &kprobe_blacklist); +list_add_tail_rcu (&ent->list, &kprobe_blacklist);return (int )size; }
@@ -2287,8 +2296,8 @@ static void kprobe_remove_area_blacklist(unsigned long start, unsigned long end)list_for_each_entry_safe (ent, n, &kprobe_blacklist, list) {if (ent->start_addr < start || ent->start_addr >= end)continue ; -list_del (&ent->list); -kfree (ent); +list_del_rcu (&ent->list); +kfree_rcu (ent, rcu); } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 20/571 nvme: add missing SRCU grace period in error path
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tristan Madani <[email protected]>
[ Upstream commit ef248d5de4469fb6bbaf8dbe0c4c47800080d648 ]
nvme_alloc_ns() error path at out_unlink_ns removes ns from the namespace head siblings list with list_del_rcu(&ns->siblings) but does not wait for SRCU readers before freeing the namespace struct. Multipath code iterates the head->list under srcu_read_lock() in nvme_find_path() and nvme_mpath_revalidate_paths(), so a concurrent reader can still hold a reference to ns when kfree(ns) runs.
The normal removal path in nvme_ns_remove() correctly calls synchronize_srcu(&ns->head->srcu) after list_del_rcu() to wait for in-progress readers. Add the same grace period in the error path.
--- drivers/nvme/host/core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/nvme/host/core.c +3 -0
@@ -3953,6 +3953,9 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid,if (list_empty (&ns->head->list))list_del_init (&ns->head->entry);mutex_unlock (&ctrl->subsys->lock); + +/* guarantee not available in head->list */ +synchronize_srcu (&ns->head->srcu);nvme_put_ns_head (ns->head); out_cleanup_disk:blk_cleanup_disk (disk);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 21/571 KVM: s390: Zero initialize data structures for inject_pfault_token
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Borntraeger <[email protected]>
[ Upstream commit 4e2c7f7cbc27418f9a290399b986c1b85ff93b90 ]
__kvm_inject_pfault_token() only sets .type and .u.ext.ext_params2 of the on-stack struct kvm_s390_irq but the full ext substructure is copied into the cpu local variable on inject. ext_params and pad contain stale stack values.
Interrupt delivery only uses ext_params2, so nothing leaks to the guest, but a host user can use the migration ioctls to get to the data.
Fix by zero-initializing the irq struct.
Do the same for the inti data structure.
Message-ID: <[email protected]>
--- arch/s390/kvm/kvm-s390.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/s390/kvm/kvm-s390.c +2 -2
@@ -3985,8 +3985,8 @@ long kvm_arch_fault_in_page(struct kvm_vcpu *vcpu, gpa_t gpa, int writable)static void __kvm_inject_pfault_token (struct kvm_vcpu *vcpu,bool start_token,unsigned long token) { -struct kvm_s390_interrupt inti; -struct kvm_s390_irq irq; +struct kvm_s390_interrupt inti = {}; +struct kvm_s390_irq irq = {};if (start_token) { irq.u.ext.ext_params2 = token;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 22/571 scsi: qla2xxx: Zero dport diagnostics buffer to avoid info leak
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nilesh Javali <[email protected]>
[ Upstream commit a152edab3854f01dd2daf3eaf8f32cbabdb3834e ]
qla2x00_do_dport_diagnostics() allocates the qla_dport_diag response buffer with kmalloc_obj() (non-zeroing) and, on success, copies the full sizeof(*dd) back to user space via sg_copy_from_buffer(). The inbound sg_copy_to_buffer() only fills as many bytes as the user request payload provides, and qla26xx_dport_diagnostics() zeroes only dd->buf. The options and unused[] fields are therefore copied out uninitialized, leaking kernel heap contents to user space.
Allocate with kzalloc_obj(), matching qla2x00_do_dport_diagnostics_v2().
--- drivers/scsi/qla2xxx/qla_bsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_bsg.c +1 -1
@@ -2412,7 +2412,7 @@ qla2x00_do_dport_diagnostics(struct bsg_job *bsg_job) !IS_QLA28XX(vha->hw))return -EPERM ; - dd =kmalloc (sizeof (*dd),GFP_KERNEL ); + dd =kzalloc (sizeof (*dd),GFP_KERNEL );if (!dd) {ql_log (ql_log_warn, vha,0x70db ,"Failed to allocate memory for dport.\n" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 23/571 scsi: qla2xxx: Fix queue teardown NULL dma_free and bitmap locking
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nilesh Javali <[email protected]>
[ Upstream commit 34a40e0dff940ac5eba494a69b553ea571e24873 ]
qla25xx_free_req_que() and qla25xx_free_rsp_que() have two pre-existing bugs exposed on the error path of qla25xx_create_{req,rsp}_que():
1. When dma_alloc_coherent() fails during queue creation, the error path calls the free function with req->ring / rsp->ring still NULL (from kzalloc). The unconditional dma_free_coherent() with a NULL cpu_addr is undefined behavior and can panic.
2. The free functions clear req_qid_map / rsp_qid_map under vport_lock, but the create functions protect the same bitmaps with mq_lock. This provides no mutual exclusion. Additionally, the create error path clears the bit and releases mq_lock before calling the free function, creating a window where another thread can allocate the same que_id and have its ha->req_q_map entry clobbered by the subsequent lockless NULL assignment in the free function.
Fix by:
- Guarding dma_free_coherent() with a NULL check on the ring pointer.
- Using mq_lock (the lock held by all creators) in the free functions to atomically NULL the map entry and clear the bitmap bit.
- Removing the now-redundant clear_bit blocks from the create error paths since the free functions handle it atomically.
Backport adaptation for the stable tree: the 29xx IOCB size-selection helpers are absent, and queue creation still allocates fixed-size entries. Initialize the local req_entry_size and rsp_entry_size values with sizeof(request_t) and sizeof(response_t), respectively, so DMA freeing continues to match allocation without adding helper functions or 29xx support. Retain all NULL-ring guards, mq_lock protection, and removal of the premature bitmap clears.
Keep the response-ring cleanup layout used by upstream so target commit 19788a55cab61d78e33e0914a5a31d27843e8a4a applies unchanged.
Stable-dep-of: 19788a55cab6 ("scsi: qla2xxx: Fix use-after-free of qpair work on queue teardown")
--- drivers/scsi/qla2xxx/qla_mid.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-)
drivers/scsi/qla2xxx/qla_mid.c +15 -14
@@ -583,16 +583,19 @@ qla25xx_free_req_que(struct scsi_qla_host *vha, struct req_que *req) {struct qla_hw_data *ha = vha->hw;uint16_t que_id = req->id; +size_t req_entry_size =sizeof (request_t); -dma_free_coherent (&ha->pdev->dev, (req->length +1 ) * -sizeof (request_t), req->ring, req->dma); +if (req->ring) +dma_free_coherent (&ha->pdev->dev, + (req->length +1 ) * req_entry_size, + req->ring, req->dma); req->ring =NULL ; req->dma =0 ;if (que_id) { +mutex_lock (&ha->mq_lock); ha->req_q_map[que_id] =NULL ; -mutex_lock (&ha->vport_lock);clear_bit (que_id, ha->req_qid_map); -mutex_unlock (&ha->vport_lock); +mutex_unlock (&ha->mq_lock); }kfree (req->outstanding_cmds);kfree (req);
@@ -604,6 +607,7 @@ qla25xx_free_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp) {struct qla_hw_data *ha = vha->hw;uint16_t que_id = rsp->id; +size_t rsp_entry_size =sizeof (response_t);if (rsp->msix && rsp->msix->have_irq) {free_irq (rsp->msix->vector, rsp->msix->handle);
@@ -611,15 +615,18 @@ qla25xx_free_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp) rsp->msix->in_use =0 ; rsp->msix->handle =NULL ; } -dma_free_coherent (&ha->pdev->dev, (rsp->length +1 ) * -sizeof (response_t), rsp->ring, rsp->dma); + +if (rsp->ring) +dma_free_coherent (&ha->pdev->dev, + (rsp->length +1 ) * rsp_entry_size, + rsp->ring, rsp->dma); rsp->ring =NULL ; rsp->dma =0 ;if (que_id) { +mutex_lock (&ha->mq_lock); ha->rsp_q_map[que_id] =NULL ; -mutex_lock (&ha->vport_lock);clear_bit (que_id, ha->rsp_qid_map); -mutex_unlock (&ha->vport_lock); +mutex_unlock (&ha->mq_lock); }kfree (rsp); rsp =NULL ;
@@ -805,9 +812,6 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options,if (ret !=QLA_SUCCESS ) {ql_log (ql_log_fatal, base_vha,0x00df ,"%s failed.\n" , __func__); -mutex_lock (&ha->mq_lock); -clear_bit (que_id, ha->req_qid_map); -mutex_unlock (&ha->mq_lock); goto que_failed; } vha->flags.qpairs_req_created =1 ;
@@ -919,9 +923,6 @@ qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options,if (ret !=QLA_SUCCESS ) {ql_log (ql_log_fatal, base_vha,0x00e7 ,"%s failed.\n" , __func__); -mutex_lock (&ha->mq_lock); -clear_bit (que_id, ha->rsp_qid_map); -mutex_unlock (&ha->mq_lock); goto que_failed; } vha->flags.qpairs_rsp_created =1 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 24/571 scsi: qla2xxx: Fix use-after-free of qpair work on queue teardown
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nilesh Javali <[email protected]>
[ Upstream commit 19788a55cab61d78e33e0914a5a31d27843e8a4a ]
The response queue MSI-X handler qla2xxx_msix_rsp_q() schedules qla_do_work() via queue_work(ha->wq, &qpair->q_work). qla_do_work() dereferences the qpair (vha, rsp) and takes qpair->qp_lock.
During teardown, qla2xxx_delete_qpair() deletes the response queue, which calls free_irq() in qla25xx_free_rsp_que(), and then frees the queue and the qpair. free_irq() waits for running hardirq handlers but does not cancel work already placed on ha->wq. A still-pending q_work then runs qla_do_work() against the freed qpair and response queue, causing a use-after-free. This is especially likely during full adapter teardown, where destroy_workqueue(ha->wq) forces pending work to run after the queue pairs have been freed.
Flush the work item with cancel_work_sync() in qla25xx_free_rsp_que() after free_irq() has released the interrupt (so no new work can be queued) and before the response queue and qpair memory are freed (so the flushed handler still sees valid memory). Guard on rsp->qpair and ha->wq to match the INIT_WORK() condition and avoid operating on an uninitialized work_struct.
--- drivers/scsi/qla2xxx/qla_mid.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/scsi/qla2xxx/qla_mid.c +4 -0
@@ -616,6 +616,10 @@ qla25xx_free_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp) rsp->msix->handle =NULL ; } +/* Flush any queued response work before freeing the queue/qpair. */ +if (rsp->qpair && ha->wq) +cancel_work_sync (&rsp->qpair->q_work); +if (rsp->ring) dma_free_coherent(&ha->pdev->dev, (rsp->length + 1) * rsp_entry_size,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 25/571 scsi: qla2xxx: Validate BSG request_len before reading vendor_cmd[]
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nilesh Javali <[email protected]>
[ Upstream commit 4cf38dd9465736141263ebb63375868311a0ec81 ]
The FC BSG transport allocates job->request via memdup_user() using the exact user-supplied request_len. For FC_BSG_HST_VENDOR, fc_bsg_host_dispatch() only guarantees request_len covers msgcode and vendor_id; it does not account for the vendor_cmd[] flexible array.
qla2xxx then reads the command selector vendor_cmd[0] and, in several sub-handlers, vendor_cmd[1]/[2] or structures overlaid on the vendor command area without verifying request_len. A caller holding CAP_SYS_RAWIO can submit a short request whose vendor_id matches the host, triggering out-of-bounds heap reads (KASAN-detectable, and able to mis-select a command or panic).
Add a central guard in qla2x00_process_vendor_specific() so the selector is always in bounds, restrict the early vendor_cmd[0] read in qla24xx_bsg_request() to sufficiently long vendor messages, and add request_len checks to the sub-handlers that read further:qla24xx_proc_fcp_prio_cfg_cmd(), qla2x00_process_loopback(), qla84xx_reset(), qla84xx_updatefw(), qla2x00_read_optrom(), qla2x00_update_optrom(), qlafx00_mgmt_cmd() and qla28xx_validate_flash_image().
--- drivers/scsi/qla2xxx/qla_bsg.c | 45 ++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_bsg.c +43 -2
@@ -158,6 +158,12 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct bsg_job *bsg_job) goto exit_fcp_prio_cfg; } +if (bsg_job->request_len < +sizeof (struct fc_bsg_request ) +2 *sizeof (uint32_t )) { + ret = -EINVAL ; + goto exit_fcp_prio_cfg; + } +/* Get the sub command */ oper = bsg_request->rqst_data.h_vendor.vendor_cmd[1 ];
@@ -756,6 +762,10 @@ qla2x00_process_loopback(struct bsg_job *bsg_job)return -EIO ; } +if (bsg_job->request_len < +sizeof (struct fc_bsg_request ) +3 *sizeof (uint32_t )) +return -EINVAL ; +memset (&elreq,0 ,sizeof (elreq)); elreq.req_sg_cnt = dma_map_sg(&ha->pdev->dev,
@@ -988,6 +998,10 @@ qla84xx_reset(struct bsg_job *bsg_job)return -EINVAL ; } +if (bsg_job->request_len < +sizeof (struct fc_bsg_request ) +2 *sizeof (uint32_t )) +return -EINVAL ; + flag = bsg_request->rqst_data.h_vendor.vendor_cmd[1 ]; rval =qla84xx_reset_chip (vha, flag ==A84_ISSUE_RESET_DIAG_FW );
@@ -1032,6 +1046,10 @@ qla84xx_updatefw(struct bsg_job *bsg_job)return -EINVAL ; } +if (bsg_job->request_len < +sizeof (struct fc_bsg_request ) +2 *sizeof (uint32_t )) +return -EINVAL ; + sg_cnt =dma_map_sg (&ha->pdev->dev, bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt,DMA_TO_DEVICE );if (!sg_cnt) {
@@ -1482,6 +1500,10 @@ qla2x00_read_optrom(struct bsg_job *bsg_job)struct qla_hw_data *ha = vha->hw;int rval =0 ; +if (bsg_job->request_len < +sizeof (struct fc_bsg_request ) +2 *sizeof (uint32_t )) +return -EINVAL ; +if (ha->flags.nic_core_reset_hdlr_active)return -EBUSY ;
@@ -1519,6 +1541,10 @@ qla2x00_update_optrom(struct bsg_job *bsg_job)struct qla_hw_data *ha = vha->hw;int rval =0 ; +if (bsg_job->request_len < +sizeof (struct fc_bsg_request ) +2 *sizeof (uint32_t )) +return -EINVAL ; +mutex_lock (&ha->optrom_mutex); rval =qla2x00_optrom_setup (bsg_job, vha,1 );if (rval) {
@@ -2010,6 +2036,11 @@ qlafx00_mgmt_cmd(struct bsg_job *bsg_job)struct fc_port *fcport;char *type ="FC_BSG_HST_FX_MGMT" ; +if (bsg_job->request_len < +sizeof (struct fc_bsg_request ) +sizeof (uint32_t ) + +sizeof (struct qla_mt_iocb_rqst_fx00 )) +return -EINVAL ; +/* Copy the IOCB specific information */ piocb_rqst = (struct qla_mt_iocb_rqst_fx00 *) &bsg_request->rqst_data.h_vendor.vendor_cmd[1 ];
@@ -2812,6 +2843,13 @@ qla2x00_process_vendor_specific(struct scsi_qla_host *vha, struct bsg_job *bsg_j {struct fc_bsg_request *bsg_request = bsg_job->request; +if (bsg_job->request_len < +sizeof (struct fc_bsg_request ) +sizeof (uint32_t )) { +ql_log (ql_log_warn, vha,0x7000 , +"BSG request too small for vendor cmd.\n" ); +return -EINVAL ; + } +ql_dbg (ql_dbg_edif, vha,0x911b ,"%s FC_BSG_HST_VENDOR cmd[0]=0x%x\n" , __func__, bsg_request->rqst_data.h_vendor.vendor_cmd[0 ]);
@@ -2931,8 +2969,11 @@ qla24xx_bsg_request(struct bsg_job *bsg_job) }/* Disable port will bring down the chip, allow enable command */ -if (bsg_request->rqst_data.h_vendor.vendor_cmd[0 ] ==QL_VND_MANAGE_HOST_PORT || - bsg_request->rqst_data.h_vendor.vendor_cmd[0 ] ==QL_VND_GET_HOST_STATS ) +if (bsg_request->msgcode ==FC_BSG_HST_VENDOR && + bsg_job->request_len >= +sizeof (struct fc_bsg_request ) +sizeof (uint32_t ) && + (bsg_request->rqst_data.h_vendor.vendor_cmd[0 ] ==QL_VND_MANAGE_HOST_PORT || + bsg_request->rqst_data.h_vendor.vendor_cmd[0 ] ==QL_VND_GET_HOST_STATS )) goto skip_chip_chk;if (vha->hw->flags.port_isolated) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 26/571 f2fs: embed f2fs_gc_kthread in f2fs_sb_info
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit 3d7bca9d583793bb7d0bac0d95a24ddd2e129eed ]
Instead of allocating f2fs_gc_kthread dynamically, embed it in f2fs_sb_info. This simplifies lifetime management and prepares for fixing race conditions during teardown.
- __sbi_store - remount|shutdown
- f2fs_stop_gc_thread
- access sbi->gc_thread
- sbi->gc_thread = NULL
- access sbi->gc_thread->f2fs_gc_task
--- fs/f2fs/debug.c | 4 ---- fs/f2fs/f2fs.h | 22 +++++++++++++++++++++- fs/f2fs/gc.c | 33 ++++++++++++--------------------- fs/f2fs/gc.h | 20 -------------------- fs/f2fs/segment.c | 9 ++++----- fs/f2fs/super.c | 4 ++-- fs/f2fs/sysfs.c | 8 ++++---- 7 files changed, 43 insertions(+), 57 deletions(-)
fs/f2fs/debug.c +0 -4
@@ -275,10 +275,6 @@ static void update_mem_info(struct f2fs_sb_info *sbi) get_cache: si->cache_mem =0 ; -/* build gc */ -if (sbi->gc_thread) - si->cache_mem +=sizeof (struct f2fs_gc_kthread ); -/* build merge flush thread */ if (SM_I (sbi)->fcc_info) si->cache_mem +=sizeof (struct flush_cmd_control );
fs/f2fs/f2fs.h +21 -1
@@ -1561,6 +1561,26 @@ struct decompress_io_ctx {#define MAX_COMPRESS_LOG_SIZE 8#define MAX_COMPRESS_WINDOW_SIZE (log_size) ((PAGE_SIZE) << (log_size)) +struct f2fs_gc_kthread { +struct task_struct *f2fs_gc_task; +wait_queue_head_t gc_wait_queue_head; + +/* for gc sleep time */ +unsigned int urgent_sleep_time; +unsigned int min_sleep_time; +unsigned int max_sleep_time; +unsigned int no_gc_sleep_time; + +/* for changing gc mode */ +unsigned int gc_wake; + +/* for GC_MERGE mount option */ +wait_queue_head_t fggc_wq;/* +* caller of f2fs_balance_fs() +* will wait on this wait queue. +*/ +}; +struct f2fs_sb_info {struct super_block *sb;/* pointer to VFS super block */ struct proc_dir_entry *s_proc;/* proc entry */
@@ -1677,7 +1697,7 @@ struct f2fs_sb_info {* semaphore for GC, avoid * race between GC and GC or CP */ -struct f2fs_gc_kthread *gc_thread;/* GC thread */ +struct f2fs_gc_kthread gc_thread;/* GC thread */ struct atgc_management am;/* atgc management */ unsigned int cur_victim_sec;/* current victim section num */ unsigned int gc_mode;/* current GC state */
fs/f2fs/gc.c +12 -21
@@ -30,9 +30,9 @@ static unsigned int count_bits(const unsigned long *addr,static int gc_thread_func (void *data) {struct f2fs_sb_info *sbi = data; -struct f2fs_gc_kthread *gc_th = sbi->gc_thread; -wait_queue_head_t *wq = &sbi->gc_thread->gc_wait_queue_head; -wait_queue_head_t *fggc_wq = &sbi->gc_thread->fggc_wq; +struct f2fs_gc_kthread *gc_th = &sbi->gc_thread; +wait_queue_head_t *wq = &sbi->gc_thread.gc_wait_queue_head; +wait_queue_head_t *fggc_wq = &sbi->gc_thread.fggc_wq;unsigned int wait_ms; wait_ms = gc_th->min_sleep_time;
@@ -146,16 +146,10 @@ static int gc_thread_func(void *data)int f2fs_start_gc_thread (struct f2fs_sb_info *sbi) { -struct f2fs_gc_kthread *gc_th; +struct f2fs_gc_kthread *gc_th = &sbi->gc_thread;dev_t dev = sbi->sb->s_bdev->bd_dev;int err =0 ; - gc_th =f2fs_kmalloc (sbi,sizeof (struct f2fs_gc_kthread ),GFP_KERNEL ); -if (!gc_th) { - err = -ENOMEM ; - goto out; - } - gc_th->urgent_sleep_time =DEF_GC_THREAD_URGENT_SLEEP_TIME ; gc_th->min_sleep_time =DEF_GC_THREAD_MIN_SLEEP_TIME ; gc_th->max_sleep_time =DEF_GC_THREAD_MAX_SLEEP_TIME ;
@@ -163,30 +157,27 @@ int f2fs_start_gc_thread(struct f2fs_sb_info *sbi) gc_th->gc_wake =0 ; - sbi->gc_thread = gc_th; -init_waitqueue_head (&sbi->gc_thread->gc_wait_queue_head); -init_waitqueue_head (&sbi->gc_thread->fggc_wq); - sbi->gc_thread->f2fs_gc_task =kthread_run (gc_thread_func, sbi, +init_waitqueue_head (&gc_th->gc_wait_queue_head); +init_waitqueue_head (&gc_th->fggc_wq); + gc_th->f2fs_gc_task =kthread_run (gc_thread_func, sbi,"f2fs_gc-%u:%u" ,MAJOR (dev),MINOR (dev));if (IS_ERR (gc_th->f2fs_gc_task)) { err =PTR_ERR (gc_th->f2fs_gc_task); -kfree (gc_th); - sbi->gc_thread =NULL ; + gc_th->f2fs_gc_task =NULL ; } -out:return err; }void f2fs_stop_gc_thread (struct f2fs_sb_info *sbi) { -struct f2fs_gc_kthread *gc_th = sbi->gc_thread; +struct f2fs_gc_kthread *gc_th = &sbi->gc_thread; -if (!gc_th) +if (!gc_th->f2fs_gc_task)return ; +kthread_stop (gc_th->f2fs_gc_task); + gc_th->f2fs_gc_task =NULL ;wake_up_all (&gc_th->fggc_wq); -kfree (gc_th); - sbi->gc_thread =NULL ; }static int select_gc_type (struct f2fs_sb_info *sbi,int gc_type)
fs/f2fs/gc.h +0 -20
@@ -30,26 +30,6 @@/* Search max. number of dirty segments to select a victim segment */ #define DEF_MAX_VICTIM_SEARCH 4096/* covers 8GB */ -struct f2fs_gc_kthread { -struct task_struct *f2fs_gc_task; -wait_queue_head_t gc_wait_queue_head; - -/* for gc sleep time */ -unsigned int urgent_sleep_time; -unsigned int min_sleep_time; -unsigned int max_sleep_time; -unsigned int no_gc_sleep_time; - -/* for changing gc mode */ -unsigned int gc_wake; - -/* for GC_MERGE mount option */ -wait_queue_head_t fggc_wq;/* -* caller of f2fs_balance_fs() -* will wait on this wait queue. -*/ -}; -struct gc_inode_list {struct list_head ilist;struct radix_tree_root iroot;
fs/f2fs/segment.c +4 -5
@@ -522,15 +522,14 @@ void f2fs_balance_fs(struct f2fs_sb_info *sbi, bool need)f2fs_submit_merged_write (sbi,DATA );f2fs_submit_all_merged_ipu_writes (sbi); -if (test_opt (sbi,GC_MERGE ) && sbi->gc_thread && - sbi->gc_thread->f2fs_gc_task) { +if (test_opt (sbi,GC_MERGE ) && sbi->gc_thread.f2fs_gc_task) {DEFINE_WAIT (wait); -prepare_to_wait (&sbi->gc_thread->fggc_wq, &wait, +prepare_to_wait (&sbi->gc_thread.fggc_wq, &wait,TASK_UNINTERRUPTIBLE ); -wake_up (&sbi->gc_thread->gc_wait_queue_head); +wake_up (&sbi->gc_thread.gc_wait_queue_head);io_schedule (); -finish_wait (&sbi->gc_thread->fggc_wq, &wait); +finish_wait (&sbi->gc_thread.fggc_wq, &wait); }else {down_write (&sbi->gc_lock);f2fs_gc (sbi, false, false, false,NULL_SEGNO );
fs/f2fs/super.c +2 -2
@@ -2349,11 +2349,11 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)if ((*flags &SB_RDONLY ) || (F2FS_OPTION (sbi).bggc_mode ==BGGC_MODE_OFF && !test_opt (sbi,GC_MERGE ))) { -if (sbi->gc_thread) { +if (sbi->gc_thread.f2fs_gc_task) {f2fs_stop_gc_thread (sbi); need_restart_gc = true; } - }else if (!sbi->gc_thread) { + }else if (!sbi->gc_thread.f2fs_gc_task) { err =f2fs_start_gc_thread (sbi);if (err) goto restore_opts;
fs/f2fs/sysfs.c +4 -4
@@ -58,7 +58,7 @@ static ssize_t f2fs_sbi_show(struct f2fs_attr *a,static unsigned char *__struct_ptr (struct f2fs_sb_info *sbi,int struct_type) {if (struct_type ==GC_THREAD ) -return (unsigned char *)sbi->gc_thread; +return (unsigned char *)&sbi->gc_thread;else if (struct_type ==SM_INFO )return (unsigned char *)SM_I (sbi);else if (struct_type ==DCC_INFO )
@@ -499,10 +499,10 @@ static ssize_t __sbi_store(struct f2fs_attr *a, sbi->gc_mode =GC_NORMAL ; }else if (t ==1 ) { sbi->gc_mode =GC_URGENT_HIGH ; -if (sbi->gc_thread) { - sbi->gc_thread->gc_wake =1 ; +if (sbi->gc_thread.f2fs_gc_task) { + sbi->gc_thread.gc_wake =1 ;wake_up_interruptible_all ( - &sbi->gc_thread->gc_wait_queue_head); + &sbi->gc_thread.gc_wait_queue_head);wake_up_discard_thread (sbi, true); } }else if (t ==2 ) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 27/571 tick/broadcast: Plug clockevents replacement race
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
[ Upstream commit 113a9796effe3376d2ec5aabcca1fef4fef4cd62 ]
朱恺乾 reported and decoded the following race condition when a broadcast device is replaced:
CPUA CPUB
__tick_broadcast_oneshot_control()
bc = tick_broadcast_device.evtdev;
tick_install_broadcast_device(dev)
clockevents_exchange_device(cur, dev)
shutdown(cur);
detach(cur);
cur->handler = noop;
tick_broadcast_device.evtdev = dev; tick_broadcast_set_event(bc, next_event); <- FAIL: arms a detached device.
If the original broadcast device has a restricted interrupt affinity mask and the last CPU in that mask goes offline then the BUG() in tick_cleanup_dead_cpu() triggers because the clockevent device is not in detached state.
The reason for this is that tick_install_broadcast_device() is not serialized vs. tick broadcast operations.
The obvious cure is to serialize tick_install_broadcast_device() with tick_broadcast_lock against a concurrent tick broadcast operation.
That requires to split clockevents_exchange_device() into two parts, one which does the exchange, shutdown and detach operation and the other which drops the module reference count. This is required because the module reference cannot be dropped while holding tick_broadcast_lock.
Let clockevents_exchange_device() do both operations as before, but let the broadcast device code take the two step approach and do the device exchange under tick_broadcast_lock and drop the module reference count after releasing it.
--- kernel/time/clockevents.c | 33 +++++++++++++++++++------------- kernel/time/tick-broadcast.c | 37 ++++++++++++++++++++++-------------- kernel/time/tick-internal.h | 2 ++ 3 files changed, 45 insertions(+), 27 deletions(-)
kernel/time/clockevents.c +20 -13
@@ -557,33 +557,40 @@ void clockevents_handle_noop(struct clock_event_device *dev) { } -/** -* clockevents_exchange_device - release and request clock devices -* @old: device to release (can be NULL) -* @new: device to request (can be NULL) -* -* Called from various tick functions with clockevents_lock held and -* interrupts disabled. -*/ -void clockevents_exchange_device (struct clock_event_device *old, -struct clock_event_device *new) +void __clockevents_exchange_device (struct clock_event_device *old, +struct clock_event_device *new) {/* * Caller releases a clock event device. We queue it into the * released list and do a notify add later. */ if (old) { -module_put (old->owner);clockevents_switch_state (old,CLOCK_EVT_STATE_DETACHED );list_move (&old->list, &clockevents_released); }if (new) { -BUG_ON (!clockevent_state_detached (new)); +WARN_ON (!clockevent_state_detached (new));clockevents_shutdown (new); } } +/** +* clockevents_exchange_device - release and request clock devices +* @old: device to release (can be NULL) +* @new: device to request (can be NULL) +* +* Called from various tick functions with clockevents_lock held and +* interrupts disabled. +*/ +void clockevents_exchange_device (struct clock_event_device *old, +struct clock_event_device *new) +{ +__clockevents_exchange_device (old, new); +if (old) +module_put (old->owner); +} +/** * clockevents_suspend - suspend clock devices */
@@ -650,7 +657,7 @@ void tick_cleanup_dead_cpu(int cpu)if (cpumask_test_cpu (cpu, dev->cpumask) &&cpumask_weight (dev->cpumask) ==1 && !tick_is_broadcast_device (dev)) { -BUG_ON (!clockevent_state_detached (dev)); +WARN_ON (!clockevent_state_detached (dev));list_del (&dev->list); } }
kernel/time/tick-broadcast.c +23 -14
@@ -162,23 +162,32 @@ static bool tick_set_oneshot_wakeup_device(struct clock_event_device *newdev,*/ void tick_install_broadcast_device (struct clock_event_device *dev,int cpu) { -struct clock_event_device *cur = tick_broadcast_device.evtdev; +struct clock_event_device *cur; -if (tick_set_oneshot_wakeup_device (dev, cpu)) -return ; + { +guard (raw_spinlock_irqsave)(&tick_broadcast_lock); -if (!tick_check_broadcast_device (cur, dev)) -return ; +if (tick_set_oneshot_wakeup_device (dev, cpu)) +return ; -if (!try_module_get (dev->owner)) -return ; + cur = tick_broadcast_device.evtdev; +if (!tick_check_broadcast_device (cur, dev)) +return ; -clockevents_exchange_device (cur, dev); +if (!try_module_get (dev->owner)) +return ; + +__clockevents_exchange_device (cur, dev); +if (cur) + cur->event_handler = clockevents_handle_noop; +WRITE_ONCE (tick_broadcast_device.evtdev, dev); +if (!cpumask_empty (tick_broadcast_mask)) +tick_broadcast_start_periodic (dev); + } + +/* Module release must be outside of the lock */ if (cur) - cur->event_handler = clockevents_handle_noop; - tick_broadcast_device.evtdev = dev; -if (!cpumask_empty (tick_broadcast_mask)) -tick_broadcast_start_periodic (dev); +module_put (cur->owner);if (!(dev->features &CLOCK_EVT_FEAT_ONESHOT ))return ;
@@ -1205,7 +1214,7 @@ int tick_broadcast_oneshot_active(void)*/ bool tick_broadcast_oneshot_available (void ) { -struct clock_event_device *bc = tick_broadcast_device.evtdev; +struct clock_event_device *bc =READ_ONCE (tick_broadcast_device.evtdev);return bc ? bc->features &CLOCK_EVT_FEAT_ONESHOT : false; }
@@ -1213,7 +1222,7 @@ bool tick_broadcast_oneshot_available(void)#else int __tick_broadcast_oneshot_control (enum tick_broadcast_state state) { -struct clock_event_device *bc = tick_broadcast_device.evtdev; +struct clock_event_device *bc =READ_ONCE (tick_broadcast_device.evtdev);if (!bc || (bc->features &CLOCK_EVT_FEAT_HRTIMER ))return -EBUSY ;
kernel/time/tick-internal.h +2 -0
@@ -48,6 +48,8 @@ static inline void clockevent_set_state(struct clock_event_device *dev, }extern void clockevents_shutdown (struct clock_event_device *dev); +extern void __clockevents_exchange_device (struct clock_event_device *old, +struct clock_event_device *new);extern void clockevents_exchange_device (struct clock_event_device *old,struct clock_event_device *new); extern void clockevents_switch_state(struct clock_event_device *dev,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 28/571 Bluetooth: btqcomsmd: Convert to platform remove callback returning void
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 4a62832f565c950d645a4f7b199a0a7985815940 ]
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Stable-dep-of: f5a427b16e45 ("Bluetooth: btqcomsmd: destroy RPMsg endpoints before freeing hci_dev")
--- drivers/bluetooth/btqcomsmd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/bluetooth/btqcomsmd.c +2 -4
@@ -197,7 +197,7 @@ static int btqcomsmd_probe(struct platform_device *pdev)return ret; } -static int btqcomsmd_remove (struct platform_device *pdev) +static void btqcomsmd_remove (struct platform_device *pdev) {struct btqcomsmd *btq =platform_get_drvdata (pdev);
@@ -206,8 +206,6 @@ static int btqcomsmd_remove(struct platform_device *pdev)rpmsg_destroy_ept (btq->cmd_channel);rpmsg_destroy_ept (btq->acl_channel); - -return 0 ; }static const struct of_device_id btqcomsmd_of_match[] = {
@@ -218,7 +216,7 @@ MODULE_DEVICE_TABLE(of, btqcomsmd_of_match);static struct platform_driver btqcomsmd_driver = { .probe = btqcomsmd_probe, - .remove = btqcomsmd_remove, + .remove_new = btqcomsmd_remove, .driver = { .name ="btqcomsmd" , .of_match_table = btqcomsmd_of_match,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 29/571 Bluetooth: btqcomsmd: destroy RPMsg endpoints before freeing hci_dev
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xu Rao <[email protected]>
[ Upstream commit f5a427b16e45210dee656b0860728f3d496dee85 ]
The command and ACL RPMsg endpoints store struct btqcomsmd as their callback private data. The receive callbacks dereference btq->hdev without taking an hci_dev reference.
The current teardown order frees the hci_dev before destroying the RPMsg endpoints in both the hci_register_dev() error path and the driver remove path. If WCNSS delivers data in that window, the endpoint callback can run with an already freed hci_dev and pass it to the Bluetooth core.
For qcom_smd endpoints, rpmsg_destroy_ept() closes the channel and clears the callback under the channel recv_lock. The receive path holds the same lock while invoking the callback, so destroying the endpoints first both prevents new callbacks and serializes with any callback already running.
Destroy the command and ACL endpoints before hci_free_dev(). Keep hci_unregister_dev() first during remove so the HCI core stops issuing operations before the transport endpoints are shut down. In the full registration-error cleanup path, return directly after freeing the hci_dev to avoid falling through to the partial-construction labels and destroying the endpoints twice.
--- drivers/bluetooth/btqcomsmd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/bluetooth/btqcomsmd.c +5 -1
@@ -188,7 +188,10 @@ static int btqcomsmd_probe(struct platform_device *pdev)return 0 ; hci_free_dev: +rpmsg_destroy_ept (btq->cmd_channel); +rpmsg_destroy_ept (btq->acl_channel);hci_free_dev (hdev); +return ret; destroy_cmd_channel:rpmsg_destroy_ept (btq->cmd_channel); destroy_acl_channel:
@@ -202,10 +205,11 @@ static void btqcomsmd_remove(struct platform_device *pdev)struct btqcomsmd *btq =platform_get_drvdata (pdev);hci_unregister_dev (btq->hdev); -hci_free_dev (btq->hdev);rpmsg_destroy_ept (btq->cmd_channel);rpmsg_destroy_ept (btq->acl_channel); + +hci_free_dev (btq->hdev); }static const struct of_device_id btqcomsmd_of_match[] = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 30/571 genetlink: pin family module during policy dump
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: XingWang Xiang <[email protected]>
[ Upstream commit 6a1094c34d176827b2b173e163dcc964a13af93f ]
The generic netlink controller's policy dump keeps pointers to the target family's operation and policy tables in its callback state. A dump may be split across multiple skbs and remain pending after the initial request.
Netlink pins the module which owns the dump callback, but in this case that is the controller's owner rather than the target family's owner. The target family can consequently be unregistered and its module unloaded while a policy dump is pending. Advancing the dump then dereferences policy memory from the unloaded module.
Take a reference to the target family's module when the dump starts. Drop it from the error and done paths. This matches the lifetime for which the dump context retains the family and policy pointers.
--- net/netlink/genetlink.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-)
net/netlink/genetlink.c +21 -7
@@ -1101,6 +1101,7 @@ static int genl_ctrl_event(int event, const struct genl_family *family,struct ctrl_dump_policy_ctx {struct netlink_policy_dump_state *state;const struct genl_family *rt; +struct module *owner;unsigned int opidx;u32 op;u16 fam_id;
@@ -1144,6 +1145,9 @@ static int ctrl_dumppolicy_start(struct netlink_callback *cb)return -ENOENT ; ctx->rt = rt; + ctx->owner = rt->module; +if (!try_module_get (ctx->owner)) +return -ENOENT ;if (tb[CTRL_ATTR_OP ]) { ctx->single_op = true;
@@ -1152,14 +1156,19 @@ static int ctrl_dumppolicy_start(struct netlink_callback *cb) err =genl_get_cmd (ctx->op, rt, &op);if (err) {NL_SET_BAD_ATTR (cb->extack, tb[CTRL_ATTR_OP ]); -return err; + goto err_put_owner; } -if (!op.policy) -return -ENODATA ; +if (!op.policy) { + err = -ENODATA ; + goto err_put_owner; + } -return netlink_policy_dump_add_policy (&ctx->state, op.policy, - op.maxattr); + err =netlink_policy_dump_add_policy (&ctx->state, op.policy, + op.maxattr); +if (err) + goto err_free_state; +return 0 ; }for (i =0 ; i <genl_get_cmd_cnt (rt); i++) {
@@ -1174,12 +1183,16 @@ static int ctrl_dumppolicy_start(struct netlink_callback *cb) } } -if (!ctx->state) -return -ENODATA ; +if (!ctx->state) { + err = -ENODATA ; + goto err_put_owner; + }return 0 ; err_free_state:netlink_policy_dump_free (ctx->state); +err_put_owner: +module_put (ctx->owner);return err; }
@@ -1314,6 +1327,7 @@ static int ctrl_dumppolicy_done(struct netlink_callback *cb)struct ctrl_dump_policy_ctx *ctx = (void *)cb->ctx;netlink_policy_dump_free (ctx->state); +module_put (ctx->owner);return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 31/571 io_uring/rw: end write accounting from ->ki_complete
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
[ Upstream commit 796aa0547557e63338657ed1c487906f9fac4c73 ]
Commit b000145e9907 moved both the fsnotify calls and the write accounting out of the kiocb completion handler and into the io_req_rw_complete() task_work. However, only the fsnotify part actually needed to move as it may sleep. Ending the write accounting is just a percpu_up_read() on the superblock writers sem.
Deferring it is a problem, because it makes dropping SB_FREEZE_WRITE protection depend on the ring owner getting to running task_work. But the task may be blocked in freeze_super(), causing it to never get to that:
task io-wq worker
--------------------------------------------------------------
io_write()
io_kiocb_start_write() (takes sb_writers, hidden from
lockdep by __sb_writers_release)
write_iter() -> -EIOCBQUEUED
ioctl(FS_IOC_SHUTDOWN)
bdev_freeze()
freeze_super()
percpu_down_write() <- waits for the reader above
io_write()
kiocb_start_write()
percpu_down_read() <- queued
behind the writer
<bio completes>
io_complete_rw()
queues io_req_rw_complete() <- never runs, task is in D state
End the write from io_complete_rw() instead, and leave only the fsnotify calls in task_work.
--- io_uring/io_uring.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
io_uring/io_uring.c +8 -1
@@ -2797,7 +2797,10 @@ static void io_req_task_complete(struct io_kiocb *req, bool *locked)static void io_req_rw_complete (struct io_kiocb *req,bool *locked) { -io_req_io_end (req); +if (req->rw.kiocb.ki_flags &IOCB_WRITE ) +fsnotify_modify (req->file); +else +fsnotify_access (req->file);io_req_task_complete (req, locked); }
@@ -2807,6 +2810,10 @@ static void io_complete_rw(struct kiocb *kiocb, long res, long res2)if (__io_complete_rw_common (req, res))return ; +/* ring owner may block in freeze_super() before task_work runs */ +if (kiocb->ki_flags &IOCB_WRITE ) +io_req_end_write (req); + req->result =io_fixup_rw_res (req, res); req->io_task_work.func = io_req_rw_complete;io_req_task_work_add (req);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 32/571 net: bridge: use option bits for CFM/MRP frame handlers
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhiling Zou <[email protected]>
[ Upstream commit 7a49e6b16f36b8e085521699adbca3e321b6dd0c ]
CFM and MRP register a global br_frame_type whose hlist_node is linked into the per-bridge frame_type_list when the first MEP/MRP instance is created. Enabling the protocol on multiple bridges therefore inserts the same node into multiple lists. Unregistering it on one bridge then corrupts list state belonging to another.
These handlers can only be installed once per bridge, and they are uncommon. Track their per-bridge enable state with net_bridge option bits, which already live on the Rx hot cache line, and dispatch the matching handler directly from the receive path. Check both bits together first as an unlikely case.
Remove the generic frame_type_list and br_frame_type helpers, which have had no other users since CFM and MRP were added. That shrinks struct net_bridge by 8 bytes and drops the list walk from the fast path. When neither protocol is compiled in, BR_CFM_MRP_OPTS is 0 and the compiler prunes the branch.
--- net/bridge/br_cfm.c | 11 +++-------- net/bridge/br_device.c | 1 - net/bridge/br_input.c | 35 ++++++++++++++--------------------- net/bridge/br_mrp.c | 13 +++---------- net/bridge/br_private.h | 26 +++++++++++++++----------- 5 files changed, 35 insertions(+), 51 deletions(-)
net/bridge/br_cfm.c +3 -8
@@ -367,7 +367,7 @@ static u32 ccm_tlv_extract(struct sk_buff *skb, u32 index, }/* note: already called with rcu_read_lock */ -static int br_cfm_frame_rx (struct net_bridge_port *port,struct sk_buff *skb) +int br_cfm_frame_rx (struct net_bridge_port *port,struct sk_buff *skb) {u32 mdlevel, interval, size, index, max;const struct br_cfm_common_hdr *hdr;
@@ -489,11 +489,6 @@ static int br_cfm_frame_rx(struct net_bridge_port *port, struct sk_buff *skb)return 1 ; } -static struct br_frame_type cfm_frame_type__read_mostly = { - .type =cpu_to_be16 (ETH_P_CFM ), - .frame_handler = br_cfm_frame_rx, -}; - int br_cfm_mep_create(struct net_bridge *br, const u32 instance, struct br_cfm_mep_create *const create,
@@ -559,7 +554,7 @@ int br_cfm_mep_create(struct net_bridge *br,INIT_DELAYED_WORK (&mep->ccm_tx_dwork, ccm_tx_work_expired);if (hlist_empty (&br->mep_list)) -br_add_frame (br, &cfm_frame_type); +br_opt_toggle (br,BROPT_CFM_ENABLED , true);hlist_add_tail_rcu (&mep->head, &br->mep_list);
@@ -588,7 +583,7 @@ static void mep_delete_implementation(struct net_bridge *br,kfree_rcu (mep, rcu);if (hlist_empty (&br->mep_list)) -br_del_frame (br, &cfm_frame_type); +br_opt_toggle (br,BROPT_CFM_ENABLED , false); } int br_cfm_mep_delete(struct net_bridge *br,
net/bridge/br_device.c +0 -1
@@ -506,7 +506,6 @@ void br_dev_setup(struct net_device *dev)spin_lock_init (&br->lock);INIT_LIST_HEAD (&br->port_list);INIT_HLIST_HEAD (&br->fdb_list); -INIT_HLIST_HEAD (&br->frame_type_list);#if IS_ENABLED (CONFIG_BRIDGE_MRP )INIT_HLIST_HEAD (&br->mrp_list);#endif
net/bridge/br_input.c +14 -21
@@ -268,17 +268,25 @@ static int nf_hook_bridge_pre(struct sk_buff *skb, struct sk_buff **pskb)return RX_HANDLER_CONSUMED ; } +#define BR_CFM_MRP_OPTS \ + ((IS_ENABLED(CONFIG_BRIDGE_CFM) ? BIT(BROPT_CFM_ENABLED) : 0UL) | \ + (IS_ENABLED(CONFIG_BRIDGE_MRP) ? BIT(BROPT_MRP_ENABLED) : 0UL)) +/* Return 0 if the frame was not processed otherwise 1 * note: already called with rcu_read_lock */ static int br_process_frame_type (struct net_bridge_port *p,struct sk_buff *skb) { -struct br_frame_type *tmp; +struct net_bridge *br = p->br; + +if (skb->protocol ==htons (ETH_P_CFM ) && +br_opt_get (br,BROPT_CFM_ENABLED )) +return br_cfm_frame_rx (p, skb); -hlist_for_each_entry_rcu (tmp, &p->br->frame_type_list, list) -if (unlikely (tmp->type == skb->protocol)) -return tmp->frame_handler (p, skb); +if (skb->protocol ==htons (ETH_P_MRP ) && +br_opt_get (br,BROPT_MRP_ENABLED )) +return br_mrp_process (p, skb);return 0 ; }
@@ -371,7 +379,8 @@ static rx_handler_result_t br_handle_frame(struct sk_buff **pskb) } } -if (unlikely (br_process_frame_type (p, skb))) +if (unlikely ((READ_ONCE (p->br->options) &BR_CFM_MRP_OPTS ) && +br_process_frame_type (p, skb)))return RX_HANDLER_PASS ; forward:
@@ -408,19 +417,3 @@ rx_handler_func_t *br_get_rx_handler(const struct net_device *dev)return br_handle_frame; } - -void br_add_frame (struct net_bridge *br,struct br_frame_type *ft) -{ -hlist_add_head_rcu (&ft->list, &br->frame_type_list); -} - -void br_del_frame (struct net_bridge *br,struct br_frame_type *ft) -{ -struct br_frame_type *tmp; - -hlist_for_each_entry (tmp, &br->frame_type_list, list) -if (ft == tmp) { -hlist_del_rcu (&ft->list); -return ; - } -}
net/bridge/br_mrp.c +3 -10
@@ -6,13 +6,6 @@static const u8 mrp_test_dmac[ETH_ALEN ] = {0x1 ,0x15 ,0x4e ,0x0 ,0x0 ,0x1 };static const u8 mrp_in_test_dmac[ETH_ALEN ] = {0x1 ,0x15 ,0x4e ,0x0 ,0x0 ,0x3 }; -static int br_mrp_process (struct net_bridge_port *p,struct sk_buff *skb); - -static struct br_frame_type mrp_frame_type__read_mostly = { - .type =cpu_to_be16 (ETH_P_MRP ), - .frame_handler = br_mrp_process, -}; -static bool br_mrp_is_ring_port (struct net_bridge_port *p_port,struct net_bridge_port *s_port,struct net_bridge_port *port)
@@ -486,7 +479,7 @@ static void br_mrp_del_impl(struct net_bridge *br, struct br_mrp *mrp)kfree_rcu (mrp, rcu);if (hlist_empty (&br->mrp_list)) -br_del_frame (br, &mrp_frame_type); +br_opt_toggle (br,BROPT_MRP_ENABLED , false); }/* Adds a new MRP instance.
@@ -536,7 +529,7 @@ int br_mrp_add(struct net_bridge *br, struct br_mrp_instance *instance)rcu_assign_pointer (mrp->s_port, p);if (hlist_empty (&br->mrp_list)) -br_add_frame (br, &mrp_frame_type); +br_opt_toggle (br,BROPT_MRP_ENABLED , true);INIT_DELAYED_WORK (&mrp->test_work, br_mrp_test_work_expired);INIT_DELAYED_WORK (&mrp->in_test_work, br_mrp_in_test_work_expired);
@@ -1241,7 +1234,7 @@ static int br_mrp_rcv(struct net_bridge_port *p,* normal forwarding. * note: already called with rcu_read_lock */ -static int br_mrp_process (struct net_bridge_port *p,struct sk_buff *skb) +int br_mrp_process (struct net_bridge_port *p,struct sk_buff *skb) {/* If there is no MRP instance do normal forwarding */ if (likely (!(p->flags &BR_MRP_AWARE )))
net/bridge/br_private.h +15 -11
@@ -447,12 +447,13 @@ enum net_bridge_opts {BROPT_NO_LL_LEARN ,BROPT_VLAN_BRIDGE_BINDING ,BROPT_MCAST_VLAN_SNOOPING_ENABLED , +BROPT_CFM_ENABLED , + BROPT_MRP_ENABLED, };struct net_bridge {spinlock_t lock;spinlock_t hash_lock; -struct hlist_head frame_type_list;struct net_device *dev;unsigned long options;/* These fields are accessed on each packet */
@@ -841,16 +842,6 @@ int nbp_backup_change(struct net_bridge_port *p, struct net_device *backup_dev);int br_handle_frame_finish (struct net *net,struct sock *sk,struct sk_buff *skb);rx_handler_func_t *br_get_rx_handler (const struct net_device *dev); -struct br_frame_type { -__be16 type; -int (*frame_handler)(struct net_bridge_port *port, -struct sk_buff *skb); -struct hlist_node list; -}; - -void br_add_frame (struct net_bridge *br,struct br_frame_type *ft); -void br_del_frame (struct net_bridge *br,struct br_frame_type *ft); -static inline bool br_rx_handler_check_rcu (const struct net_device *dev) {return rcu_dereference (dev->rx_handler) ==br_get_rx_handler (dev);
@@ -1854,6 +1845,7 @@ int br_mrp_parse(struct net_bridge *br, struct net_bridge_port *p,bool br_mrp_enabled (struct net_bridge *br);void br_mrp_port_del (struct net_bridge *br,struct net_bridge_port *p);int br_mrp_fill_info (struct sk_buff *skb,struct net_bridge *br); +int br_mrp_process (struct net_bridge_port *p,struct sk_buff *skb);#else static inline int br_mrp_parse(struct net_bridge *br, struct net_bridge_port *p, struct nlattr *attr, int cmd,
@@ -1877,6 +1869,11 @@ static inline int br_mrp_fill_info(struct sk_buff *skb, struct net_bridge *br) return 0; } +static inline int br_mrp_process (struct net_bridge_port *p,struct sk_buff *skb) +{ +return 0 ; +} +#endif /* br_cfm.c */
@@ -1885,6 +1882,7 @@ int br_cfm_parse(struct net_bridge *br, struct net_bridge_port *p, struct nlattr *attr, int cmd, struct netlink_ext_ack *extack);bool br_cfm_created (struct net_bridge *br);void br_cfm_port_del (struct net_bridge *br,struct net_bridge_port *p); +int br_cfm_frame_rx (struct net_bridge_port *port,struct sk_buff *skb);int br_cfm_config_fill_info (struct sk_buff *skb,struct net_bridge *br); int br_cfm_status_fill_info(struct sk_buff *skb, struct net_bridge *br,
@@ -1909,6 +1907,12 @@ static inline void br_cfm_port_del(struct net_bridge *br, { } +static inline int br_cfm_frame_rx (struct net_bridge_port *port, +struct sk_buff *skb) +{ +return 0 ; +} +static inline int br_cfm_config_fill_info (struct sk_buff *skb,struct net_bridge *br) {return -EOPNOTSUPP ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 33/571 smb: client: reject userspace cifs.idmap descriptions
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aohan Mei <[email protected]>
[ Upstream commit d9d7eeb0cea5b55b82888f443622fd8d4ee064f3 ]
cifs.idmap key descriptions carry authority-bearing fields (owner and group SIDs and uid/gid values in "os:"/"gs:"/"oi:"/"gi:" form) that the cifs.idmap upcall helper treats as kernel-originating inputs. Unlike its sibling cifs.spnego, the cifs.idmap key type has no vet_description hook, so userspace can create keys of this type through request_key(2)/add_key(2) and supply those fields without CIFS origin. A request_key(2) call with a non-NULL callout then drives a root usermodehelper upcall (/sbin/request-key -> cifs.idmap) that consumes the unvetted description in root context.
Only accept cifs.idmap descriptions while CIFS is using its private root_cred to request the key. id_to_sid()/sid_to_id() already run under override_creds(root_cred), so the kernel-originated path is unaffected.
This mirrors commit 3da1fdf4efbc ("smb: client: reject userspace cifs.spnego descriptions"), which applied the same restriction to cifs.spnego.
--- fs/cifs/cifsacl.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
fs/cifs/cifsacl.c +15 -0
@@ -96,8 +96,23 @@ cifs_idmap_key_destroy(struct key *key)kfree (key->payload.data[0 ]); } +static int +cifs_idmap_key_vet_description (const char *description) +{ +/* +* cifs.idmap descriptions are authority-bearing inputs to the +* cifs.idmap upcall helper. Only allow the kernel to create this +* type of key using the private root_cred installed in +* init_cifs_idmap; reject userspace request_key(2)/add_key(2). +*/ +if (current_cred () != root_cred) +return -EPERM ; +return 0 ; +} +static struct key_type cifs_idmap_key_type = { .name ="cifs.idmap" , + .vet_description = cifs_idmap_key_vet_description, .instantiate = cifs_idmap_key_instantiate, .destroy = cifs_idmap_key_destroy, .describe = user_describe,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 34/571 smb: client: avoid leaking refcount in cifs_queue_oplock_break()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjoern Doebel <[email protected]>
[ Upstream commit 9f2e63f1b2d5fc5b5423424902c091123e220e7e ]
cifs_queue_oplock_break() unconditionally takes a reference on the target file before queueing cifs_oplock_break(). Only that work item decreases the reference counter again.
If another oplock break arrives while that work is still queued, queue_work() will return false and not queue this second work item. As a result, we will never reach the point to drop the file reference again and are leaking this reference. This can be triggered when interacting with a slow-responding server.
As a result, later unmount operations for this file system will fail with
BUG: Dentry ... still in use (1) [unmount of cifs cifs] VFS: Busy inodes after unmount of cifs (cifs) kernel BUG at fs/super.c:777!
Fix this by only incrementing the reference count if the work has been queued successfully. Taking it after queue_work() is safe because all three callers hold tcon->open_file_lock across the call and _cifsFileInfo_put() decrements under that same lock, so a worker that starts the handler in the window cannot drop the reference before it has been taken.
--- fs/cifs/misc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/cifs/misc.c +4 -3
@@ -620,10 +620,11 @@ void cifs_queue_oplock_break(struct cifsFileInfo *cfile)* open_file_lock to enforce the validity of it for the oplock * break handler. The matching put is done at the end of the * handler. +* +* Only take a reference if the work is actually queued. */ -cifsFileInfo_get (cfile); - -queue_work (cifsoplockd_wq, &cfile->oplock_break); +if (queue_work (cifsoplockd_wq, &cfile->oplock_break)) +cifsFileInfo_get (cfile); }void cifs_done_oplock_break (struct cifsInodeInfo *cinode)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 35/571 smb: client: fix heap overflow in DACL owner/group rewrite
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjoern Doebel <[email protected]>
[ Upstream commit 0ee150794c75bcd0be0e24ff3394f433cbae18cc ]
When id_mode_to_cifs_acl rewrites an existing DACL, it allocates a buffer sized according to the on-disk DACL length reported by dacl_ptr->size. However, replace_sids_and_copy_aces may rewrite each ACE with a new owner/group SID obtained from the cifs.idmap upcall. Those SIDs can have up to SID_MAX_SUB_AUTHORITIES (15) sub-authorities, making each ACE up to 76 bytes (sizeof(struct smb_ace)).
If the original DACL contains short SIDs (e.g., 1 sub-authority) while the replacement SIDs are long, the rewritten ACEs overflow the allocation.
Fix this by always budgeting for worst-case SID expansion: allocate sizeof(struct smb_acl) plus num_aces * sizeof(struct smb_ace), which covers the smb_acl header and room for every ACE at maximum SID size. This replaces the previous split logic that used dacl_ptr->size for cifsacl mounts but num_aces * sizeof(struct smb_ace) for mode_from_sid
mounts: both paths can trigger the same rewrite and need the same headroom.
KASAN reports this as:
BUG: KASAN: slab-out-of-bounds in build_sec_desc+0x1e8a/0x2680 [cifs] Write of size 4 at addr ffff8881a5e25374 by task chown/5298 ... The buggy address is located 0 bytes to the right of allocated 884-byte region [ffff8881a5e25000, ffff8881a5e25374)
--- fs/cifs/cifsacl.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
fs/cifs/cifsacl.c +7 -5
@@ -1747,11 +1747,13 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 *pnmode,cifs_put_tlink (tlink);return rc; } -if (mode_from_sid) - nsecdesclen += -le32_to_cpu (dacl_ptr->num_aces) *sizeof (struct cifs_ace ); -else /* cifsacl */ - nsecdesclen +=le16_to_cpu (dacl_ptr->size); +/* +* Worst case: every ACE is rewritten with a new SID of +* SID_MAX_SUB_AUTHORITIES sub-auths -> sizeof(cifs_ace) each, +* plus the cifs_acl header replace_sids_and_copy_aces() emits. +*/ + nsecdesclen +=sizeof (struct cifs_acl ) + +le32_to_cpu (dacl_ptr->num_aces) *sizeof (struct cifs_ace ); } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 36/571 ALSA: usb-audio: Optimize the copy of packet sizes for implicit fb handling
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 36adb51ac0b19edb32ffeea3fe66b174bad25ead ]
We did manual copies over loop for the packet data update of the implicit feedback, but this can be optimized with a simple memcpy().
Along with it, change the data type of snd_usb_packet_info struct to align with other (from uint32_t to int).
No functional changes but only code optimizations.
Stable-dep-of: 76a986c980bb ("ALSA: usb-audio: Clamp implicit feedback packet count to URB capacity")
--- sound/usb/card.h | 2 +- sound/usb/endpoint.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
sound/usb/card.h +1 -1
@@ -89,7 +89,7 @@ struct snd_usb_endpoint {struct snd_urb_ctx urb[MAX_URBS ];struct snd_usb_packet_info { -uint32_t packet_size[MAX_PACKS_HS ]; +int packet_size[MAX_PACKS_HS ];int packets; } next_packet[MAX_URBS ];unsigned int next_packet_head;/* ring buffer offset to read */
sound/usb/endpoint.c +3 -3
@@ -477,7 +477,7 @@ int snd_usb_queue_pending_output_urbs(struct snd_usb_endpoint *ep,unsigned long flags;struct snd_usb_packet_info *packet;struct snd_urb_ctx *ctx =NULL ; -int err, i; +int err;spin_lock_irqsave (&ep->lock, flags); if ((!implicit_fb || ep->next_packet_queued > 0) &&
@@ -497,8 +497,8 @@ int snd_usb_queue_pending_output_urbs(struct snd_usb_endpoint *ep,/* copy over the length information */ if (implicit_fb) { ctx->packets = packet->packets; -for (i =0 ; i < packet->packets; i++) - ctx->packet_size[i] = packet->packet_size[i]; +memcpy (ctx->packet_size, packet->packet_size, + packet->packets *sizeof (packet->packet_size[0 ])); }/* call the data handler to fill in playback data */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 37/571 ALSA: usb-audio: Clamp implicit feedback packet count to URB capacity
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiang Mei <[email protected]>
[ Upstream commit 76a986c980bb502c7688d605ac7a67fd257a9a1b ]
data_ep_set_params() allocates each data URB for exactly u->packets isochronous frames, so urb->iso_frame_desc[] has u->packets slots and ctx->packets is the driver's only record of that limit. For an implicit feedback sink, snd_usb_queue_pending_output_urbs() overwrites it with the sync source's packet count, which is calculated independently from the capture endpoint's parameters. When that count is larger, prepare_playback_urb() and prepare_silent_urb() can write iso_frame_desc[] past the allocation; their existing bounds limit payload bytes, not the descriptor index.
The reproducer uses a high-speed UAC2 device declaring bInterval 1 for implicit feedback capture (8 packets) and bInterval 4 for playback (1 packet). On the first capture completion after the stream starts, it accesses seven descriptors spanning 112 bytes beyond the one-packet URB:
BUG: KASAN: slab-out-of-bounds in prepare_playback_urb (sound/usb/pcm.c:1560) Write of size 4 at addr ffff88801e696ad0 by task vhci_rx/178 prepare_playback_urb (sound/usb/pcm.c:1560) prepare_outbound_urb (sound/usb/endpoint.c:340) snd_usb_queue_pending_output_urbs (sound/usb/endpoint.c:501) snd_complete_urb (sound/usb/endpoint.c:1834) __usb_hcd_giveback_urb (drivers/usb/core/hcd.c:1657) usb_hcd_giveback_urb (drivers/usb/core/hcd.c:1741) vhci_rx_loop (drivers/usb/usbip/vhci_rx.c:107) kthread (kernel/kthread.c:436) The buggy address belongs to the object at ffff88801e696a00 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 0 bytes to the right of allocated 208-byte region [ffff88801e696a00, ffff88801e696ad0)
Record the allocated packet count per endpoint and clamp both the adopted count and the packet-size copy to it. Fold the Format Type II delimiter into urb_packs before the allocation loop so the recorded limit matches every URB.
--- sound/usb/card.h | 1 + sound/usb/endpoint.c | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-)
sound/usb/card.h +1 -0
@@ -115,6 +115,7 @@ struct snd_usb_endpoint {unsigned int phase;/* phase accumulator */ unsigned int maxpacksize;/* max packet size in bytes */ unsigned int maxframesize;/* max packet size in frames */ +unsigned int max_urb_packs;/* packets allocated per data URB */ unsigned int max_urb_frames;/* max URB size in frames */ unsigned int curpacksize;/* current packet size in bytes (for capture) */ unsigned int curframesize;/* current packet size in frames (for capture) */
sound/usb/endpoint.c +7 -5
@@ -496,9 +496,10 @@ int snd_usb_queue_pending_output_urbs(struct snd_usb_endpoint *ep,/* copy over the length information */ if (implicit_fb) { - ctx->packets = packet->packets; + ctx->packets =min_t (int, packet->packets, + ep->max_urb_packs);memcpy (ctx->packet_size, packet->packet_size, - packet->packets *sizeof (packet->packet_size[0 ])); + ctx->packets *sizeof (packet->packet_size[0 ])); }/* call the data handler to fill in playback data */
@@ -1247,15 +1248,16 @@ static int data_ep_set_params(struct snd_usb_endpoint *ep) ep->nurbs =min (max_urbs, urbs_per_period * ep->cur_buffer_periods); } +if (fmt->fmt_type ==UAC_FORMAT_TYPE_II ) + urb_packs++;/* for transfer delimiter */ + ep->max_urb_packs = urb_packs; +/* allocate and initialize data urbs */ for (i =0 ; i < ep->nurbs; i++) {struct snd_urb_ctx *u = &ep->urb[i]; u->index = i; u->ep = ep; u->packets = urb_packs; - -if (fmt->fmt_type ==UAC_FORMAT_TYPE_II ) - u->packets++;/* for transfer delimiter */ u->buffer_size = maxsize * u->packets; u->urb =usb_alloc_urb (u->packets,GFP_KERNEL );if (!u->urb)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 38/571 wifi: libipw: reject TKIP frames without a full MIC
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daehyeon Ko <[email protected]>
[ Upstream commit 06f42accaf3c6aecab1dcc57f68dde6c06c8b380 ]
libipw_michael_mic_verify() assumes that an skb contains an eight-byte Michael MIC. A short TKIP frame makes the unsigned payload length wrap, causing michael_mic() to read past the skb.
Check that the MIC is present before verifying it, and use the existing MICHAEL_MIC_LEN constant for all MIC lengths in the verifier.
--- net/wireless/lib80211_crypt_tkip.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
net/wireless/lib80211_crypt_tkip.c +8 -5
@@ -38,6 +38,7 @@ MODULE_DESCRIPTION("lib80211 crypt: TKIP");MODULE_LICENSE ("GPL" );#define TKIP_HDR_LEN 8 +#define MICHAEL_MIC_LEN 8struct lib80211_tkip_data {#define TKIP_KEY_LEN 32
@@ -585,16 +586,18 @@ static int lib80211_michael_mic_verify(struct sk_buff *skb, int keyidx, int hdr_len, void *priv) { struct lib80211_tkip_data *tkey = priv; -u8 mic[8 ]; +u8 mic[MICHAEL_MIC_LEN ]; -if (!tkey->key_set) +if (!tkey->key_set || skb->len < hdr_len +MICHAEL_MIC_LEN )return -1 ;michael_mic_hdr (skb, tkey->rx_hdr);if (michael_mic (tkey->rx_tfm_michael, &tkey->key[24 ], tkey->rx_hdr, - skb->data + hdr_len, skb->len -8 - hdr_len, mic)) + skb->data + hdr_len, + skb->len -MICHAEL_MIC_LEN - hdr_len, mic))return -1 ; -if (memcmp (mic, skb->data + skb->len -8 ,8 ) !=0 ) { +if (memcmp (mic, skb->data + skb->len -MICHAEL_MIC_LEN , +MICHAEL_MIC_LEN ) !=0 ) {struct ieee80211_hdr *hdr; hdr = (struct ieee80211_hdr *)skb->data; printk(KERN_DEBUG "%s: Michael MIC verification failed for "
@@ -612,7 +615,7 @@ static int lib80211_michael_mic_verify(struct sk_buff *skb, int keyidx, tkey->rx_iv32 = tkey->rx_iv32_new; tkey->rx_iv16 = tkey->rx_iv16_new; -skb_trim (skb, skb->len -8 ); +skb_trim (skb, skb->len -MICHAEL_MIC_LEN );return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 39/571 smb: client: fix potential OOB read in smb3_enum_snapshots()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Sorenson <[email protected]>
[ Upstream commit 4775c3b7a597907e0b97556c7986fda238a377ae ]
If snapshot_array_size is smaller than GMT_TOKEN_SIZE, smb3_enum_snapshots() sets ret_data_len tosizeof(struct smb_snapshot_array) without verifying the actual length of the server's reply.
Because SMB2_ioctl() places no lower bound on the server-supplied OutputCount and allocates retbuf to exactly that length, a short reply results in ret_data_len exceeding the size of retbuf. The subsequent copy_to_user() then reads past the end of retbuf, leaking adjacent slab memory to userspace. The subsequent clamp check is ineffective as it only reduces ret_data_len.
Fix this by rejecting replies shorter thansizeof(struct smb_snapshot_array) with -EIO. Note that the bound is set to the 12-byte struct size rather than the 16-byte MIN_SNAPSHOT_ARRAY_SIZE defined in MS-SMB2 3.3.5.15.1, because 12 bytes is exactly what copy_to_user() attempts to read.
--- fs/cifs/smb2ops.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
fs/cifs/smb2ops.c +7 -1
@@ -2271,8 +2271,14 @@ smb3_enum_snapshots(const unsigned int xid, struct cifs_tcon *tcon,* and retry the ioctl again with larger array size sufficient * to hold all of the snapshot GMT tokens on the second try. */ -if (snapshot_in.snapshot_array_size <GMT_TOKEN_SIZE ) +if (snapshot_in.snapshot_array_size <GMT_TOKEN_SIZE ) { +if (ret_data_len <sizeof (struct smb_snapshot_array )) { + rc = -EIO ; +kfree (retbuf); +return rc; + } ret_data_len =sizeof (struct smb_snapshot_array ); + }/* * We return struct SRV_SNAPSHOT_ARRAY, followed by
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 40/571 smb: client: fix next_buffer UAF and NextCommand bounds in compound PDUs
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Sorenson <[email protected]>
[ Upstream commit 05762c5bc1cfdcac36747994fde2c04387a457f1 ]
Fix several related bounds checking and pointer lifecycle issues in receive_encrypted_standard()'s handling of compound encrypted frames:
- Clear next_buffer after assigning it to server->bigbuf. A stale next_buffer pointer can lead to a use-after-free on subsequent error paths.
- Update pdu_length to the decrypted plaintext size (buf_size). Using the pre-decryption length allows NextCommand to point into stale ciphertext residue.
- Reject next_cmd values smaller than MID_HEADER_SIZE(server).
- Fix an integer overflow in the upper bound check by verifying pdu_length - next_cmd < MID_HEADER_SIZE(server), ensuring the trailing slice is large enough for a header.
--- fs/cifs/smb2ops.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
fs/cifs/smb2ops.c +10 -1
@@ -5228,6 +5228,7 @@ receive_encrypted_standard(struct TCP_Server_Info *server, length =decrypt_raw_data (server, buf, buf_size,NULL ,0 ,0 , false);if (length)return length; + pdu_length = buf_size; next_is_large = server->large_buf; one_more:
@@ -5240,8 +5241,15 @@ receive_encrypted_standard(struct TCP_Server_Info *server, }if (next_cmd) { -if (WARN_ON_ONCE (next_cmd > pdu_length)) +if (next_cmd < (HEADER_SIZE (server) -1 ) || + next_cmd > pdu_length || + pdu_length - next_cmd < (HEADER_SIZE (server) -1 )) { +unsigned int max_next = pdu_length > (unsigned int )(HEADER_SIZE (server) -1 ) ? + pdu_length - (unsigned int )(HEADER_SIZE (server) -1 ) :0 ; +cifs_server_dbg (VFS ,"invalid NextCommand offset %u out of range [%zu, %u]\n" , + next_cmd, (HEADER_SIZE (server) -1 ), max_next);return -1 ; + }if (next_is_large) next_buffer = (char *)cifs_buf_get ();else
@@ -5277,6 +5285,7 @@ receive_encrypted_standard(struct TCP_Server_Info *server, server->bigbuf = buf = next_buffer; else server->smallbuf = buf = next_buffer; + next_buffer =NULL ; goto one_more; }else if (ret !=0 ) {/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 41/571 smb: client: fix OOB struct field reads in move_smb2_ea_to_cifs()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Sorenson <[email protected]>
[ Upstream commit eeb5ef6083e1cefa2ef75041b5597ff228b8d7bb ]
In move_smb2_ea_to_cifs(), the while (src_size > 0) loop condition is insufficient. It allows iteration to continue even if the remaining src_size is too small to contain a complete smb2_ea_info structure. Consequently, reads of ea_name_length and ea_value_length can occur out-of-bounds.
Fix this by ensuring src_size >= sizeof(*src) before attempting to read any structure fields. Additionally, reject any next_entry_offset that is smaller than sizeof(*src) or that would advance the pointer beyond the available buffer.
Note that for calls where the server returns a malformed EA list, the error returned to userspace changes from -ENODATA (getxattr) or -ERANGE (listxattr) to -EIO. This correctly signals a server protocol error rather than misleadingly indicating "attribute not present" or "output buffer too small".
--- fs/cifs/smb2ops.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
fs/cifs/smb2ops.c +16 -8
@@ -1115,8 +1115,9 @@ move_smb2_ea_to_cifs(char *dst, size_t dst_size,char *name, *value;size_t buf_size = dst_size;size_t name_len, value_len, user_name_len; +u32 next_off; -while (src_size >0 ) { +while (src_size >=sizeof (*src)) { name_len = (size_t )src->ea_name_length; value_len = (size_t )le16_to_cpu (src->ea_value_length);
@@ -1171,14 +1172,21 @@ move_smb2_ea_to_cifs(char *dst, size_t dst_size,if (!src->next_entry_offset)break ; -if (src_size <le32_to_cpu (src->next_entry_offset)) { -/* stop before overrun buffer */ - rc = -ERANGE ; -break ; + next_off =le32_to_cpu (src->next_entry_offset); +if (next_off <sizeof (*src) || src_size < next_off) { +cifs_dbg (FYI ,"EA next_entry_offset %u out of range [%zu, %zu]\n" , + next_off,sizeof (*src), src_size); + rc = -EIO ; + goto out; + } + src_size -= next_off; + src = (void *)((char *)src + next_off); +if (src_size >0 && src_size <sizeof (*src)) { +cifs_dbg (FYI ,"EA next_entry_offset %u left truncated entry (%zu bytes)\n" , + next_off, src_size); + rc = -EIO ; + goto out; } - src_size -=le32_to_cpu (src->next_entry_offset); - src = (void *)((char *)src + -le32_to_cpu (src->next_entry_offset)); }/* didn't find the named attribute */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 42/571 vlan: require the MAC header to be present in __vlan_insert_inner_tag()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiang Mei <[email protected]>
[ Upstream commit ab888242fce4f16f6c4d4c6ec53939ad36aa3b3a ]
__vlan_insert_inner_tag() only guarantees head room via skb_cow_head(), never that mac_len bytes of MAC header are present. Its ETH_HLEN wrappers - __vlan_insert_tag() under skb_vlan_push(), and vlan_insert_tag() under validate_xmit_vlan() on the generic transmit path - therefore rewrite the first 16 bytes at skb->data: a 12-byte memmove plus two 2-byte stores at +12 and +14. No caller supplies the bound, while the pop helpers use skb_ensure_writable()/pskb_may_pull().
An IFF_TUN device has hard_header_len == 0, so packet_snd() accepts a one-byte AF_PACKET/SOCK_RAW frame. The first vlan push only sets a hwaccel tag; the next - clsact "action vlan push" or bpf_skb_vlan_push() - enters the helper with skb->len still 1. The head comes from skbuff_small_head without __GFP_ZERO, so each push drags bytes from beyond skb->tail into the frame. After three the one-byte send leaves as 13 bytes carrying 11 bytes of uninitialised slab:
0000: 5a b3 62 12 80 88 ff ff 00 b3 62 12 81
`------------------------------'
only 0x5a was sent; the rest is slab, here the top 56 bits of a linear-map address
Require the MAC header the helper rewrites to be present, so such a frame is dropped rather than transmitted.
--- include/linux/if_vlan.h | 3 +++ 1 file changed, 3 insertions(+)
include/linux/if_vlan.h +3 -0
@@ -346,6 +346,9 @@ static inline int __vlan_insert_inner_tag(struct sk_buff *skb, {struct vlan_ethhdr *veth; +if (unlikely (!pskb_may_pull (skb, mac_len))) +return -EINVAL ; +if (skb_cow_head (skb,VLAN_HLEN ) <0 )return -ENOMEM ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 43/571 perf tools: Fix a asan issue in parse_events_multi_pmu_add()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
commit 66c9598bd8916c6c1319d0100ac916cac89d4b0e upstream
In the parse_events_multi_pmu_add() it passes the 'config' variable twice to parse_events_term__num() - one for config and another for loc_term. I'm not sure about the second one as it's converted to YYLTYPE variable. Asan reports it like below:
In function ‘parse_events_term__num’,
inlined from ‘parse_events_multi_pmu_add’ at util/parse-events.c:1602:6:
util/parse-events.c:2653:64: error: array subscript ‘YYLTYPE[0]’ is partly outside
array bounds of ‘char[8]’ [-Werror=array-bounds]
2653 | .err_term = loc_term ? loc_term->first_column : 0,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
util/parse-events.c: In function ‘parse_events_multi_pmu_add’:
util/parse-events.c:1587:15: note: object ‘config’ of size 8
1587 | char *config;
| ^~~~~~cc1: all warnings being treated as errors
[florian: Resolve conflict in parse_events_multi_pmu_add() where term
initialization is located inside the PMU scan loop in 5.15.y]
--- tools/perf/util/parse-events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/parse-events.c +1 -1
@@ -1686,7 +1686,7 @@ int parse_events_multi_pmu_add(struct parse_events_state *parse_state,return -1 ;if (parse_events_term__num (&term,PARSE_EVENTS__TERM_TYPE_USER , - config,1 , false, &config, + config,1 , false,NULL ,NULL ) <0 ) {free (list);free (config);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 44/571 perf test bpf: Address error about non-null argument for epoll_pwait 2nd arg
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
commit ed847e30f001b207013b6136c264454d7560557f upstream
First noticed on Fedora Rawhide:
tests/bpf.c: In function ‘epoll_pwait_loop’:
tests/bpf.c:36:17: error: argument 2 null where non-null expected [-Werror=nonnull]
36 | epoll_pwait(-(i + 1), NULL, 0, 0, NULL);
| ^~~~~~~~~~~ In file included from tests/bpf.c:5:
/usr/include/sys/epoll.h:134:12: note: in a call to function ‘epoll_pwait’ declared ‘nonnull’
134 | extern int epoll_pwait (int __epfd, struct epoll_event *__events,
| ^~~~~~~~~~~
[perfbuilder@27cfe44d67ed perf-6.5.0-rc2]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/13/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,m2,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-libstdcxx-backtrace --with-libstdcxx-zoneinfo=/usr/share/zoneinfo --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-13.2.1-20230728/obj-x86_64-redhat-linux/isl-install --enable-offload-targets=nvptx-none --without-cuda-driver --enable-offload-defaulted --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux --with-build-config=bootstrap-lto --enable-link-serialization=1 Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.1 20230728 (Red Hat 13.2.1-1) (GCC)
[perfbuilder@27cfe44d67ed perf-6.5.0-rc2]$
Just add that argument to address this compiler warning.
--- tools/perf/tests/bpf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/tests/bpf.c +2 -1
@@ -29,11 +29,12 @@static int epoll_pwait_loop (void ) { +struct epoll_event events;int i;/* Should fail NR_ITERS times */ for (i =0 ; i <NR_ITERS ; i++) -epoll_pwait (-(i +1 ),NULL ,0 ,0 ,NULL ); +epoll_pwait (-(i +1 ), &events,0 ,0 ,NULL );return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 45/571 usb: xhci: bail out of setup if the controller is inaccessible
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit 78203d5b54a40f0e36196ebf31c9c7a380fc8811 ]
xhci_gen_setup() locates the operational registers using the capability length read from the very first register:
xhci->op_regs = hcd->regs + HC_LENGTH(readl(&xhci->cap_regs->hc_capbase));
If the controller is dead or has dropped off the bus, that read returns ~0, HC_LENGTH() truncates it to 0xff, and op_regs ends up 0xff bytes past the page-aligned MMIO base, i.e. unaligned. The first access through it, xhci_halt() -> xhci_handshake() reading op_regs->status, is then an unaligned readl() on device memory. arm64 faults on unaligned device accesses, so instead of xhci_handshake() catching the all-ones value and returning -ENODEV, setup oopses:
xhci-pci-renesas 0005:08:00.0: Unable to change power state from D3cold to D0, device inaccessible xhci-pci-renesas 0005:08:00.0: xHCI Host Controller
xhci-pci-renesas 0005:08:00.0: new USB bus registered, assigned bus number 1
Unable to handle kernel paging request at virtual address ffff80030a770103
ESR = 0x0000000096000021
FSC = 0x21: alignment fault
Internal error: Oops: 0000000096000021 [#1] SMP
pc : xhci_halt [xhci_hcd]
Call trace:
xhci_halt
xhci_gen_setup
xhci_pci_setup
usb_add_hcd
usb_hcd_pci_probe
xhci_pci_common_probe
xhci_pci_renesas_probeThis was hit with a Renesas uPD720201 that failed to power up ("Unable to change power state from D3cold to D0, device inaccessible") yet still reached the HCD probe path.
Read the capability register once, and if it reads back the all-ones value (as xhci_handshake() and xhci_reset() already test for), abort setup with -ENODEV before op_regs is derived from it. Reading it once also avoids re-reading a register that may change under a concurrent hot-removal.
--- drivers/usb/host/xhci.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/usb/host/xhci.c +8 -4
@@ -5320,6 +5320,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)struct device *dev = hcd->self.sysdev;unsigned int minor_rev;int retval; +u32 hc_capbase;/* Accept arbitrarily long scatter-gather lists */ hcd->self.sg_tablesize = ~0 ;
@@ -5388,16 +5389,19 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)mutex_init (&xhci->mutex); xhci->cap_regs = hcd->regs; - xhci->op_regs = hcd->regs + -HC_LENGTH (readl (&xhci->cap_regs->hc_capbase)); + hc_capbase =readl (&xhci->cap_regs->hc_capbase); +if (hc_capbase ==U32_MAX ) { +xhci_warn (xhci,"Host controller not accessible, removed?\n" ); +return -ENODEV ; + } + xhci->op_regs = hcd->regs +HC_LENGTH (hc_capbase); xhci->run_regs = hcd->regs + (readl (&xhci->cap_regs->run_regs_off) &RTSOFF_MASK );/* Cache read-only capability registers */ xhci->hcs_params1 =readl (&xhci->cap_regs->hcs_params1); xhci->hcs_params2 =readl (&xhci->cap_regs->hcs_params2); xhci->hcs_params3 =readl (&xhci->cap_regs->hcs_params3); - xhci->hcc_params =readl (&xhci->cap_regs->hc_capbase); - xhci->hci_version =HC_VERSION (xhci->hcc_params); + xhci->hci_version =HC_VERSION (hc_capbase); xhci->hcc_params =readl (&xhci->cap_regs->hcc_params);if (xhci->hci_version >0x100 ) xhci->hcc_params2 =readl (&xhci->cap_regs->hcc_params2);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 46/571 gtp: serialize PDP context updates
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qing Ming <[email protected]>
[ Upstream commit 498386b6d402737db1e2eeed4c385acbf0ef9e34 ]
PDP contexts can be deleted through GTP_CMD_DELPDP or while the GTP network device is being unregistered. The latter is serialized by RTNL, but the generic-netlink delete path only holds RCU.
Running both paths concurrently can therefore make both paths delete the same PDP context. The issue was found through static analysis and reproduced on a KASAN-enabled kernel by a simple two-thread program racing GTP_CMD_DELPDP against RTM_DELLINK:
Oops: general protection fault, probably for non-canonical address
KASAN: maybe wild-memory-access in range
[0xdead000000000120-0xdead000000000127]
RIP: gtp_genl_del_pdp+0x1c1/0x420 [gtp]
RBP: dead000000000122The second deletion dereferenced the poisoned hlist pprev pointer.
Serialize gtp_pdp_add(), gtp_genl_del_pdp(), and gtp_dellink() with a shared mutex. Keep the mutex held until the final use of a PDP context in the NEWPDP path, and keep the RCU read-side section around the complete PDP context use in the DELPDP path.
--- drivers/net/gtp.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/net/gtp.c +15 -3
@@ -12,6 +12,7 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#include <linux/module.h> +#include <linux/mutex.h> #include <linux/skbuff.h> #include <linux/udp.h> #include <linux/rculist.h>
@@ -82,6 +83,7 @@ struct gtp_net { };static u32 gtp_h_initval; +static DEFINE_MUTEX (gtp_pdp_lock);static void pdp_context_delete (struct pdp_ctx *pctx);
@@ -109,7 +111,8 @@ static struct pdp_ctx *gtp0_pdp_find(struct gtp_dev *gtp, u64 tid) head = >p->tid_hash[gtp0_hashfn (tid) % gtp->hash_size]; -hlist_for_each_entry_rcu (pdp, head, hlist_tid) { +hlist_for_each_entry_rcu (pdp, head, hlist_tid, +lockdep_is_held (>p_pdp_lock)) {if (pdp->gtp_version ==GTP_V0 && pdp->u.v0.tid == tid)return pdp;
@@ -125,7 +128,8 @@ static struct pdp_ctx *gtp1_pdp_find(struct gtp_dev *gtp, u32 tid) head = >p->tid_hash[gtp1u_hashfn (tid) % gtp->hash_size]; -hlist_for_each_entry_rcu (pdp, head, hlist_tid) { +hlist_for_each_entry_rcu (pdp, head, hlist_tid, +lockdep_is_held (>p_pdp_lock)) {if (pdp->gtp_version ==GTP_V1 && pdp->u.v1.i_tei == tid)return pdp;
@@ -141,7 +145,8 @@ static struct pdp_ctx *ipv4_pdp_find(struct gtp_dev *gtp, __be32 ms_addr) head = >p->addr_hash[ipv4_hashfn (ms_addr) % gtp->hash_size]; -hlist_for_each_entry_rcu (pdp, head, hlist_addr) { +hlist_for_each_entry_rcu (pdp, head, hlist_addr, +lockdep_is_held (>p_pdp_lock)) {if (pdp->af ==AF_INET && pdp->ms_addr_ip4.s_addr == ms_addr)return pdp;
@@ -722,9 +727,11 @@ static void gtp_dellink(struct net_device *dev, struct list_head *head)struct pdp_ctx *pctx;int i; +mutex_lock (>p_pdp_lock);for (i =0 ; i < gtp->hash_size; i++)hlist_for_each_entry_safe (pctx, next, >p->tid_hash[i], hlist_tid)pdp_context_delete (pctx); +mutex_unlock (>p_pdp_lock);list_del (>p->list);unregister_netdevice_queue (dev, head);
@@ -1112,6 +1119,7 @@ static int gtp_genl_new_pdp(struct sk_buff *skb, struct genl_info *info) goto out_unlock; } +mutex_lock (>p_pdp_lock); pctx =gtp_pdp_add (gtp, sk, info);if (IS_ERR (pctx)) { err =PTR_ERR (pctx);
@@ -1119,6 +1127,7 @@ static int gtp_genl_new_pdp(struct sk_buff *skb, struct genl_info *info)gtp_tunnel_notify (pctx,GTP_CMD_NEWPDP ,GFP_KERNEL ); err =0 ; } +mutex_unlock (>p_pdp_lock); out_unlock:rtnl_unlock ();
@@ -1173,6 +1182,8 @@ static int gtp_genl_del_pdp(struct sk_buff *skb, struct genl_info *info)if (!info->attrs[GTPA_VERSION ])return -EINVAL ; +mutex_lock (>p_pdp_lock); +rcu_read_lock (); pctx =gtp_find_pdp (sock_net (skb->sk), info->attrs);
@@ -1193,6 +1204,7 @@ static int gtp_genl_del_pdp(struct sk_buff *skb, struct genl_info *info) out_unlock:rcu_read_unlock (); +mutex_unlock (>p_pdp_lock);return err; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 47/571 KEYS: trusted: Fix TPM teardown ordering
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengfeng Ye <[email protected]>
[ Upstream commit 5e2d672280d97d83de43031d93761b12dadd7b8a ]
trusted_tpm_exit() drops the TPM chip reference and frees the digest array before unregistering the trusted key type. key_type_lookup() holds key_types_sem for reading until the key operation finishes, while unregister_key_type() takes it for writing. It therefore provides the synchronization point that must precede backend teardown.
The current order permits this interleaving:
CPU 0 CPU 1
trusted_tpm_exit() key_type_lookup("trusted")
put_device(&chip->dev) trusted_tpm_seal()
kfree(digests) pcrlock()
unregister_key_type() tpm_pcr_extend(..., digests)
CPU 1 can consequently dereference the freed digest array. The chip can also be released before callbacks stop using it.
KASAN reported:
BUG: KASAN: slab-use-after-free in tpm_pcr_extend+0x1f0/0x200
Read of size 2 at addr ffff88810872d000 by task poc/89
Call Trace:
tpm_pcr_extend+0x1f0/0x200
pcrlock+0x42/0x70 [trusted]
trusted_tpm_seal+0x1b6/0x570 [trusted]
trusted_instantiate+0x293/0x340 [trusted]
__key_instantiate_and_link+0xb2/0x2b0
__key_create_or_update+0x61e/0xb50
__do_sys_add_key+0x1b8/0x310
Allocated by task 88:
__kmalloc_noprof+0x1a7/0x490
do_one_initcall+0xa1/0x390
do_init_module+0x2df/0x840
Freed by task 90:
kfree+0x131/0x3c0
trusted_tpm_exit+0x59/0xa0 [trusted]
__do_sys_delete_module+0x346/0x510Move unregister_key_type() before releasing either resource. This stops new lookups and waits for in-flight key operations to finish before the backend state is destroyed.
--- security/keys/trusted-keys/trusted_tpm1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/keys/trusted-keys/trusted_tpm1.c +1 -1
@@ -1058,10 +1058,10 @@ static int __init trusted_tpm_init(void)static void trusted_tpm_exit (void ) {if (chip) { +unregister_key_type (&key_type_trusted);put_device (&chip->dev);kfree (digests);trusted_shash_release (); -unregister_key_type (&key_type_trusted); } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 48/571 zram: fixup read_block_state()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Senozhatsky <[email protected]>
[ Upstream commit 8b05d2d8af817c6a1e23032df51e7ad83030d543 ]
ac_time is now in seconds, do not use ktime_to_timespec64()
[ Stable tree note: The ac_time conversion described above is not present
here, so retain the ktime_t conversion and microsecond output. Move the timespec64 temporary into the scan loop instead, allowing the follow-up bounds fix to move nr_pages initialization under init_lock cleanly. ]
Stable-dep-of: 391f057f44a5 ("zram: fix out-of-bounds access in read_block_state()")
--- drivers/block/zram/zram_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/zram/zram_drv.c +1 -1
@@ -886,7 +886,6 @@ static ssize_t read_block_state(struct file *file, char __user *buf,ssize_t index, written =0 ;struct zram *zram = file->private_data;unsigned long nr_pages = zram->disksize >>PAGE_SHIFT ; -struct timespec64 ts; kbuf =kvmalloc (count,GFP_KERNEL );if (!kbuf)
@@ -901,6 +900,7 @@ static ssize_t read_block_state(struct file *file, char __user *buf,for (index = *ppos; index < nr_pages; index++) {int copied; +struct timespec64 ts;zram_slot_lock (zram, index);if (!zram_allocated (zram, index))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 49/571 zram: fix out-of-bounds access in read_block_state()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Longlong Xia <[email protected]>
[ Upstream commit 391f057f44a51cc9418da5cba78b014324174264 ]
read_block_state() calculates nr_pages before taking dev_lock. If the device is reset and reinitialized with a smaller disksize before lock acquisition, nr_pages still describes the old table. The subsequent loop can then call slot_lock() past the end of the newly allocated table.
Read disksize after acquiring dev_lock and checking that the device is initialized. The read lock then keeps the table and its bound stable for the duration of the scan.
--- drivers/block/zram/zram_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/block/zram/zram_drv.c +3 -1
@@ -885,7 +885,7 @@ static ssize_t read_block_state(struct file *file, char __user *buf,char *kbuf;ssize_t index, written =0 ;struct zram *zram = file->private_data; -unsigned long nr_pages = zram->disksize >>PAGE_SHIFT ; +unsigned long nr_pages; kbuf =kvmalloc (count,GFP_KERNEL );if (!kbuf)
@@ -898,6 +898,8 @@ static ssize_t read_block_state(struct file *file, char __user *buf,return -EINVAL ; } + nr_pages = zram->disksize >>PAGE_SHIFT ; +for (index = *ppos; index < nr_pages; index++) {int copied;struct timespec64 ts;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 50/571 nfsd: release path refs on follow_down() error
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <[email protected]>
[ Upstream commit 6cba08dc1922140d260cfeb30bbda4ee1bf869d8 ]
nfsd_cross_mnt() initializes a local struct path with mntget() and dget() before calling follow_down(). On a negative return the error arm jumps to out without releasing those references:
err = follow_down(&path, follow_flags);
if (err < 0)
goto out;follow_down() never drops the caller's entry-time refs on any error sub-case; for example a pre-cross d_manage() failure leaves path untouched, so the mntget()/dget() taken on entry survive the call.
Every other early-exit arm in nfsd_cross_mnt() (other-namespace return, IS_ERR(exp2), and the success tail after the swap) already calls path_put(&path); the err < 0 arm is the lone omission. The leak inflates mnt_count and d_count on each failed cross-mount, blocking umount and pinning dentries against the shrinker, and is reachable by any authenticated NFS client through nfsd_lookup_dentry or the NFSv4 READDIR encode path.
Fix by calling path_put(&path) before the goto out in the err < 0 arm so the entry-time refs are released on all follow_down() error returns.
--- fs/nfsd/vfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nfsd/vfs.c +3 -1
@@ -129,8 +129,10 @@ nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,int err =0 ; err =follow_down (&path); -if (err <0 ) +if (err <0 ) { +path_put (&path); goto out; + }if (path.mnt == exp->ex_path.mnt && path.dentry == dentry &&nfsd_mountpoint (dentry, exp) ==2 ) {/* This is only a mountpoint in some other namespace */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 51/571 nfsd: size fh_verify server sockaddr slot by xpt_locallen
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <[email protected]>
[ Upstream commit 71d068490098b1d23c63b2345e40675d3a1ca763 ]
The nfsd_fh_verify and nfsd_fh_verify_err tracepoints declare the server sockaddr slot sized by xpt_remotelen but fill it from xpt_local using xpt_locallen:
TP_STRUCT__entry(
...
__sockaddr(server, rqstp->rq_xprt->xpt_remotelen)
...
)
TP_fast_assign(
...
__assign_sockaddr(server, &rqstp->rq_xprt->xpt_local,
rqstp->rq_xprt->xpt_locallen);
...
)When xpt_locallen exceeds xpt_remotelen, __assign_sockaddr's memcpy writes past the reserved ring-buffer slot. In the reverse direction (xpt_locallen < xpt_remotelen) the slot is oversized and the unwritten tail leaks prior ring-buffer contents to trace consumers.
The write-past-end case is reachable on NFS/UDP. svc_xprt_set_remote() is only called from svc_tcp_accept() (net/sunrpc/svcsock.c) and from the RDMA connect path; svc_create_socket() for UDP calls only svc_xprt_set_local(), so xpt_remotelen stays 0 for the xprt's lifetime. Every fh_verify trace for an NFSv2/v3-over-UDP request then copies 16 or 28 bytes from xpt_local into a zero-byte slot.
The other NFSD tracepoints that record the server address (NFSD_TRACE_PROC_CALL_FIELDS, NFSD_TRACE_PROC_RES_FIELDS, SVC_RQST_ENDPOINT_FIELDS) already size the server slot by xpt_locallen; nfsd_fh_verify and nfsd_fh_verify_err were the only exceptions.
Fix by sizing the server slot with xpt_locallen so the declared slot matches the copy length. The client slot and its assignment already agree on xpt_remotelen and are left untouched.
--- fs/nfsd/trace.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/trace.h +2 -2
@@ -201,7 +201,7 @@ TRACE_EVENT(nfsd_fh_verify, TP_ARGS(rqstp, fhp, type, access),TP_STRUCT__entry (__field (unsigned int ,netns_ino ) - __sockaddr(server, rqstp->rq_xprt->xpt_remotelen) + __sockaddr(server, rqstp->rq_xprt->xpt_locallen) __sockaddr(client, rqstp->rq_xprt->xpt_remotelen)__field (u32, xid) __field(u32, fh_hash)
@@ -240,7 +240,7 @@ TRACE_EVENT_CONDITION(nfsd_fh_verify_err, TP_CONDITION(error), TP_STRUCT__entry( __field(unsigned int, netns_ino) - __sockaddr(server, rqstp->rq_xprt->xpt_remotelen) + __sockaddr(server, rqstp->rq_xprt->xpt_locallen) __sockaddr(client, rqstp->rq_xprt->xpt_remotelen) __field(u32, xid) __field(u32, fh_hash)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 52/571 nfsd: check nfsd4_acl_to_attr() return value in nfsd4_create()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
[ Upstream commit 2c7912732184773dbd371a411da87af1cc080b86 ]
nfsd4_create() stores the return value of nfsd4_acl_to_attr() in status, but the switch(create->cr_type) block unconditionally overwrites it in every branch. ACL translation errors are silently discarded, and the CREATE proceeds without the requested ACL.
Add an early exit check after nfsd4_acl_to_attr(), matching the pattern already used in nfsd4_setattr().
--- fs/nfsd/nfs4proc.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
fs/nfsd/nfs4proc.c +17 -0
@@ -762,7 +762,23 @@ nfsd4_create(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,if (status)return status; +/* Sanitize cr_type to avoid returning ATTRNOTSUPP. */ +switch (create->cr_type) { +case NF4LNK : +case NF4BLK : +case NF4CHR : +case NF4SOCK : +case NF4FIFO : +case NF4DIR : +break ; +default : + status = nfserr_badtype; + goto out_aftermask; + } + status =nfsd4_acl_to_attr (create->cr_type, create->cr_acl, &attrs); +if (status != nfs_ok) + goto out_aftermask; current->fs->umask = create->cr_umask;switch (create->cr_type) {case NF4LNK :
@@ -829,6 +845,7 @@ nfsd4_create(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,fh_put (&resfh); out_umask: current->fs->umask =0 ; +out_aftermask:nfsd_attrs_free (&attrs);return status; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 53/571 nfsd: fix clock domain mismatch in clients_still_reclaiming()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
[ Upstream commit 09ea3eb9a518565f5bca386e81b993ed8825f5e8 ]
clients_still_reclaiming() computes a deadline from nn->boot_time (CLOCK_REALTIME, ~1.7 billion) but compares it against ktime_get_boottime_seconds() (CLOCK_BOOTTIME, seconds since boot). The comparison is always false — it would take ~54 years of uptime for BOOTTIME to exceed the REALTIME-derived deadline.
This means any client can hold the server in grace indefinitely by sending CLAIM_PREVIOUS OPEN requests, blocking all non-reclaim operations for all other clients.
Add boot_time_bt (CLOCK_BOOTTIME) alongside the existing boot_time and use it for the deadline computation. boot_time (CLOCK_REALTIME) is preserved for its cl_boot clientid-nonce role.
--- fs/nfsd/netns.h | 1 + fs/nfsd/nfs4state.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
fs/nfsd/netns.h +1 -0
@@ -67,6 +67,7 @@ struct nfsd_net {bool grace_end_forced;bool client_tracking_active;time64_t boot_time; +time64_t boot_time_bt;/* same instant in CLOCK_BOOTTIME */ struct dentry *nfsd_client_dir;
fs/nfsd/nfs4state.c +2 -1
@@ -6030,7 +6030,7 @@ bool nfsd4_force_end_grace(struct nfsd_net *nn)*/ static bool clients_still_reclaiming (struct nfsd_net *nn) { -time64_t double_grace_period_end = nn->boot_time + +time64_t double_grace_period_end = nn->boot_time_bt +2 * nn->nfsd4_lease;if (READ_ONCE (nn->grace_end_forced))
@@ -8278,6 +8278,7 @@ static int nfs4_state_create_net(struct net *net) nn->conf_name_tree =RB_ROOT ; nn->unconf_name_tree =RB_ROOT ; nn->boot_time =ktime_get_real_seconds (); + nn->boot_time_bt =ktime_get_boottime_seconds (); nn->grace_ended = false; nn->grace_end_forced = false; nn->client_tracking_active = false;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 54/571 nfsd: gate nfs2 setacl by argp->mask
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 a3a7e20ed66d3f04d37883c398da8a113b430769 ]
The NFSACL v2 SETACL path shares the decoder convention used by its v3 sibling: nfsaclsvc_decode_setaclargs() fills in argp->acl_access only when NFS_ACL is set in the request mask and argp->acl_default only when NFS_DFACL is set, leaving the other pointer NULL because the argument buffer is zeroed up to pc_argzero before decode.
nfsacld_proc_setacl() then hands both pointers to set_posix_acl() unconditionally. set_posix_acl(idmap, dentry, type, NULL) is the VFS "remove this ACL type" operation, so an omitted arm is indistinguishable from an explicit request to delete that ACL. A SETACL carrying only NFS_ACL silently strips the directory's default ACL; mask=0 strips both.
This is the same defect just fixed in nfsd3_proc_setacl(); apply the same remedy. Gate each set_posix_acl() call on its mask bit and initialize error to 0 so that a request with neither bit set leaves the on-disk ACLs untouched and returns success. The out_drop_lock path and the unconditional posix_acl_release() in nfsaclsvc_release_setacl() already tolerate the skipped arms.
--- fs/nfsd/nfs2acl.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
fs/nfsd/nfs2acl.c +13 -8
@@ -115,14 +115,19 @@ static __be32 nfsacld_proc_setacl(struct svc_rqst *rqstp)inode_lock (inode); - error =set_posix_acl (&init_user_ns, inode,ACL_TYPE_ACCESS , - argp->acl_access); -if (error) - goto out_drop_lock; - error =set_posix_acl (&init_user_ns, inode,ACL_TYPE_DEFAULT , - argp->acl_default); -if (error) - goto out_drop_lock; + error =0 ; +if (argp->mask &NFS_ACL ) { + error =set_posix_acl (&init_user_ns, inode,ACL_TYPE_ACCESS , + argp->acl_access); +if (error) + goto out_drop_lock; + } +if (argp->mask &NFS_DFACL ) { + error =set_posix_acl (&init_user_ns, inode,ACL_TYPE_DEFAULT , + argp->acl_default); +if (error) + goto out_drop_lock; + }inode_unlock (inode);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 55/571 cifs: fix loff_t underflow in cifs_remap_file_range() when len == 0
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Sorenson <[email protected]>
[ Upstream commit 6c322f5cf7476ded7a9a20f7be72462065a03c68 ]
With len == 0 (clone to EOF), the effective length is computed as:
len = src_inode->i_size - off;
If off > i_size, this is a negative loff_t, corrupting the ByteCount in the FSCTL_DUPLICATE_EXTENTS_TO_FILE request and inverting the range in filemap_write_and_wait_range(). The existing off >= i_size check fires only after the ioctl has already been sent.
Snapshot i_size_read() once for both the bounds check and the length calculation, eliminating the TOCTOU and 32-bit torn-read risk. Reject off > src_size with -EINVAL. Treat off == src_size as a no-op, consistent with __generic_remap_file_range_prep().
--- fs/cifs/cifsfs.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
fs/cifs/cifsfs.c +14 -2
@@ -1171,8 +1171,19 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off,*/ lock_two_nondirectories (target_inode, src_inode); -if (len ==0 ) - len = src_inode->i_size - off; +if (len ==0 ) { +loff_t src_size =i_size_read (src_inode); + +if (off > src_size) { + rc = -EINVAL ; + goto unlock; + } + len = src_size - off; +if (!len) { + rc =0 ; + goto unlock; + } + }cifs_dbg (FYI ,"about to flush pages\n" );/* should we flush first and last page first */
@@ -1188,6 +1199,7 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off,/* force revalidate of size and timestamps of target file now that target is updated on the server */ CIFS_I (target_inode)->time =0 ; +unlock:/* although unlocking in the reverse order from locking is not strictly necessary here it is a little cleaner to be consistent */ unlock_two_nondirectories (src_inode, target_inode);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 56/571 coresight: etm3x: Fix cntr_val_show() to match cntr_val_store() behavior
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuan-Wei Chiu <[email protected]>
[ Upstream commit 41fb4e925528aefa4b7a5f76c7f81db99c0d0f38 ]
The cntr_val_show() function was intended to print the values of all counters using a loop. However, due to a buffer overwrite issue with sprintf(), it effectively only displayed the value of the last counter.
The companion function, cntr_val_store(), allows users to modify a specific counter selected by 'cntr_idx'. To maintain consistency between read and write operations and to align with the ETM4x driver behavior, modify cntr_val_show() to report only the value of the currently selected counter.
This change removes the loop and the "counter %d:" prefix, printing only the hexadecimal value. It also adopts sysfs_emit() for standard sysfs output formatting.
--- .../hwtracing/coresight/coresight-etm3x-sysfs.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/hwtracing/coresight/coresight-etm3x-sysfs.c +4 -11
@@ -716,26 +716,19 @@ static DEVICE_ATTR_RW(cntr_rld_event);static ssize_t cntr_val_show (struct device *dev,struct device_attribute *attr,char *buf) { -int i, ret =0 ;u32 val;struct etm_drvdata *drvdata =dev_get_drvdata (dev->parent);struct etm_config *config = &drvdata->config;if (!local_read (&drvdata->mode)) {spin_lock (&drvdata->spinlock); -for (i =0 ; i < drvdata->nr_cntr; i++) - ret +=sprintf (buf,"counter %d: %x\n" , - i, config->cntr_val[i]); + val = config->cntr_val[config->cntr_idx];spin_unlock (&drvdata->spinlock); -return ret; - } - -for (i =0 ; i < drvdata->nr_cntr; i++) { - val =etm_readl (drvdata,ETMCNTVRn (i)); - ret +=sprintf (buf,"counter %d: %x\n" , i, val); + }else { + val =etm_readl (drvdata,ETMCNTVRn (config->cntr_idx)); } -return ret; +return sysfs_emit (buf,"%#x\n" , val); } static ssize_t cntr_val_store(struct device *dev,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 57/571 kernel/params.c: Use kstrtobool() instead of strtobool()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit def7b92efd868a6c78da86770704c1a03506016e ]
strtobool() is the same as kstrtobool(). However, the latter is more used within the kernel.
In order to remove strtobool() and slightly simplify kstrtox.h, switch to the other function name.
While at it, include the corresponding header file (<linux/kstrtox.h>)
Stable-dep-of: 3dfaae04243c ("params: fix charp corruption on allocation failure")
--- kernel/params.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/params.c +2 -1
@@ -4,6 +4,7 @@*/ #include <linux/kernel.h> +#include <linux/kstrtox.h> #include <linux/string.h> #include <linux/errno.h> #include <linux/module.h>
@@ -310,7 +311,7 @@ int param_set_bool(const char *val, const struct kernel_param *kp)if (!val) val ="1" ;/* One of =[yYnN01] */ -return strtobool (val, kp->arg); +return kstrtobool (val, kp->arg); }EXPORT_SYMBOL (param_set_bool);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 58/571 params: Do not go over the limit when getting the string length
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit fd0cd057a1b7351604daa6ffc91dfe28adf7225d ]
We can use strnlen() even on early stages and it prevents from going over the string boundaries in case it's already too long.
Stable-dep-of: 3dfaae04243c ("params: fix charp corruption on allocation failure")
--- kernel/params.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
kernel/params.c +6 -3
@@ -264,7 +264,10 @@ EXPORT_SYMBOL_GPL(param_set_uint_minmax);int param_set_charp (const char *val,const struct kernel_param *kp) { -if (strlen (val) >1024 ) { +size_t len, maxlen =1024 ; + + len =strnlen (val, maxlen +1 ); +if (len == maxlen +1 ) {pr_err ("%s: string parameter too long\n" , kp->name);return -ENOSPC ; }
@@ -274,7 +277,7 @@ int param_set_charp(const char *val, const struct kernel_param *kp)/* This is a hack. We can't kmalloc in early boot, and we * don't need to; this mangled commandline is preserved. */ if (slab_is_available ()) { - *(char **)kp->arg =kmalloc_parameter (strlen (val)+1 ); + *(char **)kp->arg =kmalloc_parameter (len +1 );if (!*(char **)kp->arg)return -ENOMEM ;strcpy (*(char **)kp->arg, val);
@@ -512,7 +515,7 @@ int param_set_copystring(const char *val, const struct kernel_param *kp) {const struct kparam_string *kps = kp->str; -if (strlen (val)+1 > kps->maxlen) { +if (strnlen (val, kps->maxlen) == kps->maxlen) {pr_err ("%s: string doesn't fit in %u chars.\n" , kp->name, kps->maxlen-1 );return -ENOSPC ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 59/571 params: Use size_add() for kmalloc()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 0fc79cbc937f2a754a302a710a94b68c61d0a89a ]
Prevent allocations from integer overflow by using size_add().
Stable-dep-of: 3dfaae04243c ("params: fix charp corruption on allocation failure")
--- kernel/params.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/params.c +2 -1
@@ -11,6 +11,7 @@#include <linux/moduleparam.h> #include <linux/device.h> #include <linux/err.h> +#include <linux/overflow.h> #include <linux/slab.h> #include <linux/ctype.h> #include <linux/security.h>
@@ -48,7 +49,7 @@ static void *kmalloc_parameter(unsigned int size) {struct kmalloced_param *p; - p =kmalloc (sizeof (*p) + size,GFP_KERNEL ); + p =kmalloc (size_add (sizeof (*p), size),GFP_KERNEL );if (!p)return NULL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 60/571 params: Sort headers
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit a05f096c2c0ca52e8fd34740c7d4b53ab3e7123e ]
Sort the headers in alphabetic order in order to ease the maintenance for this part.
Stable-dep-of: 3dfaae04243c ("params: fix charp corruption on allocation failure")
--- kernel/params.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
kernel/params.c +6 -6
@@ -3,18 +3,18 @@Copyright (C) 2001 Rusty Russell. */ +#include <linux/ctype.h> +#include <linux/device.h> +#include <linux/err.h> +#include <linux/errno.h> #include <linux/kernel.h> #include <linux/kstrtox.h> -#include <linux/string.h> -#include <linux/errno.h> #include <linux/module.h> #include <linux/moduleparam.h> -#include <linux/device.h> -#include <linux/err.h> #include <linux/overflow.h> -#include <linux/slab.h> -#include <linux/ctype.h> #include <linux/security.h> +#include <linux/slab.h> +#include <linux/string.h> #ifdef CONFIG_SYSFS /* Protects all built-in parameters, modules use their own param_lock */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 61/571 params: Fix multi-line comment style
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit b5e3f86a47d34f7b8af899f8cc70520f6daf8b53 ]
The multi-line comment style in the file is rather arbitrary. Make it follow the standard one.
Stable-dep-of: 3dfaae04243c ("params: fix charp corruption on allocation failure")
--- kernel/params.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
kernel/params.c +12 -8
@@ -1,8 +1,8 @@// SPDX-License-Identifier: GPL-2.0-or-later -/* Helpers for initial module or kernel cmdline parsing -Copyright (C) 2001 Rusty Russell. - -*/ +/* +* Helpers for initial module or kernel cmdline parsing +* Copyright (C) 2001 Rusty Russell. +*/ #include <linux/ctype.h> #include <linux/device.h> #include <linux/err.h>
@@ -275,8 +275,10 @@ int param_set_charp(const char *val, const struct kernel_param *kp)maybe_kfree_parameter (*(char **)kp->arg); -/* This is a hack. We can't kmalloc in early boot, and we -* don't need to; this mangled commandline is preserved. */ +/* +* This is a hack. We can't kmalloc() in early boot, and we +* don't need to; this mangled commandline is preserved. +*/ if (slab_is_available ()) { *(char **)kp->arg =kmalloc_parameter (len +1 );if (!*(char **)kp->arg)
@@ -741,8 +743,10 @@ void module_param_sysfs_remove(struct module *mod) {if (mod->mkobj.mp) {sysfs_remove_group (&mod->mkobj.kobj, &mod->mkobj.mp->grp); -/* We are positive that no one is using any param -* attrs at this point. Deallocate immediately. */ +/* +* We are positive that no one is using any param +* attrs at this point. Deallocate immediately. +*/ free_module_param_attrs (&mod->mkobj); } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 62/571 params: fix charp corruption on allocation failure
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiacheng Yu <[email protected]>
[ Upstream commit 3dfaae04243cde460d82dfc2a7dd0bb6664d20ae ]
param_set_charp() stores charp parameters in allocated memory after slab is available, and releases the previous value when the parameter is updated.
The previous value is released before the replacement allocation succeeds. If kmalloc_parameter() fails, the setter returns -ENOMEM with the parameter left as NULL.
Failing zswap's compressor update before zswap is initialized can later trigger:
BUG: kernel NULL pointer dereference, address: 0000000000000000
RIP: 0010:strcmp+0x10/0x30
Call Trace:
zswap_setup+0x3b1/0x490
zswap_enabled_param_set+0x5b/0xa0
param_attr_store+0x93/0xe0
module_attr_store+0x1c/0x30
kernfs_fop_write_iter+0x116/0x1f0Allocate and copy the replacement first, then replace the parameter value only after allocation succeeds.
--- kernel/params.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
kernel/params.c +8 -6
@@ -265,6 +265,7 @@ EXPORT_SYMBOL_GPL(param_set_uint_minmax);int param_set_charp (const char *val,const struct kernel_param *kp) { +char *tmp;size_t len, maxlen =1024 ; len =strnlen (val, maxlen +1 );
@@ -273,19 +274,20 @@ int param_set_charp(const char *val, const struct kernel_param *kp)return -ENOSPC ; } -maybe_kfree_parameter (*(char **)kp->arg); -/* * This is a hack. We can't kmalloc() in early boot, and we * don't need to; this mangled commandline is preserved. */ if (slab_is_available ()) { - *(char **)kp->arg =kmalloc_parameter (len +1 ); -if (!*(char **)kp->arg) + tmp =kmalloc_parameter (len +1 ); +if (!tmp)return -ENOMEM ; -strcpy (*(char **)kp->arg, val); +memcpy (tmp, val, len +1 ); }else - *(const char **)kp->arg = val; + tmp = (char *)val; + +maybe_kfree_parameter (*(char **)kp->arg); + *(char **)kp->arg = tmp;return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 63/571 dmaengine: Add devm_dma_request_chan()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bence Csókás <[email protected]>
[ Upstream commit 08bf1663c21a3e815eda28fa242d84c945ca3b94 ]
Expand the arsenal of devm functions for DMA devices, this time for requesting channels.
Stable-dep-of: 777979e62711 ("i2c: mxs: fix DMA channel leak on probe error")
--- drivers/dma/dmaengine.c | 30 ++++++++++++++++++++++++++++++ include/linux/dmaengine.h | 7 +++++++ 2 files changed, 37 insertions(+)
drivers/dma/dmaengine.c +30 -0
@@ -934,6 +934,36 @@ void dma_release_channel(struct dma_chan *chan) }EXPORT_SYMBOL_GPL (dma_release_channel); +static void dmaenginem_release_channel (void *chan) +{ +dma_release_channel (chan); +} + +/** +* devm_dma_request_chan - try to allocate an exclusive slave channel +* @dev: pointer to client device structure +* @name: slave channel name +* +* Returns pointer to appropriate DMA channel on success or an error pointer. +* +* The operation is managed and will be undone on driver detach. +*/ + +struct dma_chan *devm_dma_request_chan (struct device *dev,const char *name) +{ +struct dma_chan *chan =dma_request_chan (dev, name); +int ret =0 ; + +if (!IS_ERR (chan)) + ret =devm_add_action_or_reset (dev, dmaenginem_release_channel, chan); + +if (ret) +return ERR_PTR (ret); + +return chan; +} +EXPORT_SYMBOL_GPL (devm_dma_request_chan); +/** * dmaengine_get - register interest in dma_channels */
include/linux/dmaengine.h +7 -0
@@ -1486,6 +1486,7 @@ struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,struct dma_chan *dma_request_chan (struct device *dev,const char *name);struct dma_chan *dma_request_chan_by_mask (const dma_cap_mask_t *mask); +struct dma_chan *devm_dma_request_chan (struct device *dev,const char *name);void dma_release_channel (struct dma_chan *chan);int dma_get_slave_caps (struct dma_chan *chan,struct dma_slave_caps *caps);
@@ -1522,6 +1523,12 @@ static inline struct dma_chan *dma_request_chan_by_mask( {return ERR_PTR (-ENODEV ); } + +static inline struct dma_chan *devm_dma_request_chan (struct device *dev,const char *name) +{ +return ERR_PTR (-ENODEV ); +} +static inline void dma_release_channel (struct dma_chan *chan) { }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 64/571 i2c: mxs: fix DMA channel leak on probe error
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruoyu Wang <[email protected]>
[ Upstream commit 777979e627115734052b323d2721cdb500e81dcf ]
mxs_i2c_probe() requests an exclusive DMA channel before resetting the controller and registering the I2C adapter. If either later operation fails, probe returns without releasing the channel because the remove callback is not invoked after a failed probe.
Use devm_dma_request_chan() so the device core releases the channel on probe failure and driver detach. Remove the manual release from the remove callback because the channel is now device-managed.
This issue was found by a static analysis checker and confirmed by manual source review.
--- drivers/i2c/busses/i2c-mxs.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/i2c/busses/i2c-mxs.c +1 -4
@@ -824,7 +824,7 @@ static int mxs_i2c_probe(struct platform_device *pdev) }/* Setup the DMA */ - i2c->dmach =dma_request_chan (dev,"rx-tx" ); + i2c->dmach =devm_dma_request_chan (dev,"rx-tx" );if (IS_ERR (i2c->dmach)) {return dev_err_probe (dev,PTR_ERR (i2c->dmach),"Failed to request dma\n" );
@@ -862,9 +862,6 @@ static int mxs_i2c_remove(struct platform_device *pdev)i2c_del_adapter (&i2c->adapter); -if (i2c->dmach) -dma_release_channel (i2c->dmach); -writel (MXS_I2C_CTRL0_SFTRST , i2c->regs +MXS_I2C_CTRL0_SET );return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 65/571 lockd: fix swapped arguments in nlmsvc_match_ip()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oscar Ou <[email protected]>
[ Upstream commit b9060689f49dc663e9a3d069c4a65ff63a836e66 ]
When releasing locks by server IP address via /proc/fs/nfsd/unlock_ip, nlmsvc_unlock_all_by_ip() calls nlm_traverse_files() with the server sockaddr as the opaque @data argument:
nlm_traverse_files(server_addr, nlmsvc_match_ip, NULL);
The match callback is later invoked from nlm_traverse_locks() as:
match(lockhost, host);
where the first argument is the nlm_host that owns the lock, and the second argument is the @data that was originally passed down (here the server sockaddr). This is the convention every other match callback relies on (nlmsvc_mark_host(), nlmsvc_same_host(), nlmsvc_is_client()):
arg1 is the real nlm_host, arg2 is the caller-supplied reference value.
nlmsvc_match_ip() has had these two arguments reversed ever since the unlock-by-IP feature was introduced in commit 4373ea84c84d ("lockd:
unlock lockd locks associated with a given server ip"):
return rpc_cmp_addr(nlm_srcaddr(host), datap);
Here @host is actually the server sockaddr, so nlm_srcaddr(host) dereferences a struct sockaddr as a struct nlm_host and reads garbage at the offset of h_srcaddr; meanwhile @datap is actually the lock owner's nlm_host but is compared as a sockaddr. As a result the comparison practically never matches and locks are not released for the requested IP.
Swap the arguments so the lock owner's source address is compared against the requested server address:
return rpc_cmp_addr(nlm_srcaddr(datap), (struct sockaddr *)host);
--- fs/lockd/svcsubs.c | 2 +- include/linux/lockd/lockd.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/lockd/svcsubs.c +1 -1
@@ -493,7 +493,7 @@ EXPORT_SYMBOL_GPL(nlmsvc_unlock_all_by_sb);static int nlmsvc_match_ip (void *datap,struct nlm_host *host) { -return rpc_cmp_addr (nlm_srcaddr (host), datap); +return rpc_cmp_addr (nlm_srcaddr (datap), (struct sockaddr *)host); }/**
include/linux/lockd/lockd.h +1 -1
@@ -265,7 +265,7 @@ void nsm_release(struct nsm_handle *nsm);* This is used in garbage collection and resource reclaim * A return value != 0 means destroy the lock/block/share */ -typedef int (*nlm_host_match_fn_t )(void *cur,struct nlm_host *ref); +typedef int (*nlm_host_match_fn_t )(void *owner,struct nlm_host *ref);/* * Server-side lock handling
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 66/571 power: supply: rt9455: Convert to i2cs .probe_new()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 2adfc4370ebb745380a44c3e5418486a32a9ba67 ]
The probe function doesn't make use of the i2c_device_id * parameter so it can be trivially converted.
Stable-dep-of: 3e7a1ebc32fa ("power: supply: rt9455: quiesce delayed work before teardown")
--- drivers/power/supply/rt9455_charger.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/power/supply/rt9455_charger.c +2 -3
@@ -1583,8 +1583,7 @@ static const struct regmap_config rt9455_regmap_config = { .cache_type = REGCACHE_RBTREE, }; -static int rt9455_probe (struct i2c_client *client, -const struct i2c_device_id *id) +static int rt9455_probe (struct i2c_client *client) {struct i2c_adapter *adapter = client->adapter;struct device *dev = &client->dev;
@@ -1743,7 +1742,7 @@ MODULE_DEVICE_TABLE(acpi, rt9455_i2c_acpi_match);#endif static struct i2c_driver rt9455_driver = { - .probe = rt9455_probe, + .probe_new = rt9455_probe, .remove = rt9455_remove, .id_table = rt9455_i2c_id_table, .driver = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 67/571 power: supply: rt9455: quiesce delayed work before teardown
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fan Wu <[email protected]>
[ Upstream commit 3e7a1ebc32fad5a558254a478efd401c17a24381 ]
The threaded IRQ handler can queue pwr_rdy_work, max_charging_time_work and batt_presence_work. pwr_rdy_work and batt_presence_work can also queue max_charging_time_work, while batt_presence_work can requeue itself.
rt9455_remove() cancels max_charging_time_work before batt_presence_work. The latter can therefore queue max_charging_time_work after it has already been cancelled:
rt9455_remove() workqueue
cancel pwr_rdy_work
cancel max_charging_time_work
batt_presence_work queues
max_charging_time_work
cancel batt_presence_work
return
devres frees rt9455_info
max_charging_time_work dereferences
rt9455_info
The IRQ also remains registered until devres cleanup and can queue more work after any of the cancellation calls. If rt9455_hw_init() fails after the IRQ has been requested, probe returns without cancelling work that may already have been queued. A pending callback can then access rt9455_info after it has been freed.
Register rt9455_cancel_all_delayed_works() through devm_add_action_or_reset() right after devm_power_supply_register(). devres invokes the action in reverse registration order, after the managed IRQ has been freed and before rt9455_info is released, so the delayed works are drained in both rt9455_remove() and the probe error path. Cancel pwr_rdy_work and batt_presence_work before max_charging_time_work because both can queue the latter.
This issue was found by an in-house static analysis tool.
--- drivers/power/supply/rt9455_charger.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
drivers/power/supply/rt9455_charger.c +17 -4
@@ -1583,6 +1583,19 @@ static const struct regmap_config rt9455_regmap_config = { .cache_type = REGCACHE_RBTREE, }; +static void rt9455_cancel_all_delayed_works (void *data) +{ +struct rt9455_info *info = data; + +/* +* Both pwr_rdy_work and batt_presence_work can queue +* max_charging_time_work, so cancel them first. +*/ +cancel_delayed_work_sync (&info->pwr_rdy_work); +cancel_delayed_work_sync (&info->batt_presence_work); +cancel_delayed_work_sync (&info->max_charging_time_work); +} +static int rt9455_probe (struct i2c_client *client) {struct i2c_adapter *adapter = client->adapter;
@@ -1673,6 +1686,10 @@ static int rt9455_probe(struct i2c_client *client) goto put_usb_notifier; } + ret =devm_add_action_or_reset (dev, rt9455_cancel_all_delayed_works, info); +if (ret) + goto put_usb_notifier; + ret = devm_request_threaded_irq(dev, client->irq, NULL, rt9455_irq_handler_thread, IRQF_TRIGGER_LOW | IRQF_ONESHOT,
@@ -1714,10 +1731,6 @@ static int rt9455_remove(struct i2c_client *client)usb_unregister_notifier (info->usb_phy, &info->nb);#endif -cancel_delayed_work_sync (&info->pwr_rdy_work); -cancel_delayed_work_sync (&info->max_charging_time_work); -cancel_delayed_work_sync (&info->batt_presence_work); -return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 68/571 i2c: core: Introduce i2c_client_get_device_id helper function
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Angel Iglesias <[email protected]>
[ Upstream commit 662233731d66cf41e7494e532e702849c8ce18f3 ]
Introduces new helper function to aid in .probe_new() refactors. In order to use existing i2c_get_device_id() on the probe callback, the device match table needs to be accessible in that function, which would require bigger refactors in some drivers using the deprecated .probe callback.
This issue was discussed in more detail in the IIO mailing list.
Stable-dep-of: 4e4b9f5ce9df ("power: supply: max17040: drop incorrect I2C functionality check")
--- drivers/i2c/i2c-core-base.c | 14 ++++++++++++++ include/linux/i2c.h | 1 + 2 files changed, 15 insertions(+)
drivers/i2c/i2c-core-base.c +14 -0
@@ -2429,6 +2429,20 @@ int i2c_get_device_id(const struct i2c_client *client, }EXPORT_SYMBOL_GPL (i2c_get_device_id); +/** +* i2c_client_get_device_id - get the driver match table entry of a device +* @client: the device to query. The device must be bound to a driver +* +* Returns a pointer to the matching entry if found, NULL otherwise. +*/ +const struct i2c_device_id *i2c_client_get_device_id (const struct i2c_client *client) +{ +const struct i2c_driver *drv =to_i2c_driver (client->dev.driver); + +return i2c_match_id (drv->id_table, client); +} +EXPORT_SYMBOL_GPL (i2c_client_get_device_id); +/* ---------------------------------------------------- * the i2c address scanning function * Will not work for 10-bit addresses!
include/linux/i2c.h +1 -0
@@ -188,6 +188,7 @@ s32 i2c_smbus_read_i2c_block_data_or_emulated(const struct i2c_client *client, u8 *values);int i2c_get_device_id (const struct i2c_client *client,struct i2c_device_identity *id); +const struct i2c_device_id *i2c_client_get_device_id (const struct i2c_client *client);#endif /* I2C */ /**
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 69/571 power: supply: max17040: Convert to i2cs .probe_new()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit a07fca69378c26ea034826feb0011256e25ad237 ]
.probe_new() doesn't get the i2c_device_id * parameter, so determine that explicitly in the probe function.
Stable-dep-of: 4e4b9f5ce9df ("power: supply: max17040: drop incorrect I2C functionality check")
--- drivers/power/supply/max17040_battery.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/power/supply/max17040_battery.c +3 -3
@@ -430,9 +430,9 @@ static const struct power_supply_desc max17040_battery_desc = { .num_properties = ARRAY_SIZE(max17040_battery_props), }; -static int max17040_probe (struct i2c_client *client, -const struct i2c_device_id *id) +static int max17040_probe (struct i2c_client *client) { +const struct i2c_device_id *id =i2c_client_get_device_id (client);struct i2c_adapter *adapter = client->adapter;struct power_supply_config psy_cfg = {};struct max17040_chip *chip;
@@ -599,7 +599,7 @@ static struct i2c_driver max17040_i2c_driver = { .of_match_table = max17040_of_match, .pm = MAX17040_PM_OPS, }, - .probe = max17040_probe, + .probe_new = max17040_probe, .id_table = max17040_id, };module_i2c_driver (max17040_i2c_driver);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 70/571 power: supply: max17040: drop incorrect I2C functionality check
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jianing Li <[email protected]>
[ Upstream commit 4e4b9f5ce9dfb8ed4b8d1262a504b8043ac09d87 ]
max17040_probe() rejects adapters that do not advertise I2C_FUNC_SMBUS_BYTE. The driver does not issue SMBus byte transactions, however. Its regmap has 8-bit registers and 16-bit big-endian values, for which regmap-i2c supports either raw I2C transfers or SMBus word-data transactions.
Consequently, an adapter providing raw I2C transfers or SMBus word data but not SMBus byte transactions is rejected even though regmap can access the device. Conversely, the current check can pass an adapter that regmap cannot use.
Drop the stale check and let devm_regmap_init_i2c() validate and select the supported transfer method.
--- drivers/power/supply/max17040_battery.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/power/supply/max17040_battery.c +0 -4
@@ -433,16 +433,12 @@ static const struct power_supply_desc max17040_battery_desc = {static int max17040_probe (struct i2c_client *client) {const struct i2c_device_id *id =i2c_client_get_device_id (client); -struct i2c_adapter *adapter = client->adapter;struct power_supply_config psy_cfg = {};struct max17040_chip *chip;enum chip_id chip_id;bool enable_irq = false;int ret; -if (!i2c_check_functionality (adapter,I2C_FUNC_SMBUS_BYTE )) -return -EIO ; - chip =devm_kzalloc (&client->dev,sizeof (*chip),GFP_KERNEL );if (!chip)return -ENOMEM ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 71/571 mmc: via-sdmmc: cancel card-detect work on remove
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fan Wu <[email protected]>
[ Upstream commit 57e5d877f898d5e5c9d672a77bb6bdd24f0d9bf5 ]
Disabling the device interrupt and freeing the IRQ prevents new card-detect work from being queued, but carddet_work already queued by the handler can still run after via_sd_remove() returns. via_sdc_card_detect() recovers the host through container_of() and dereferences its MMIO base; once remove() returns the host can be freed, so that work would touch freed memory.
Cancel carddet_work after freeing the IRQ and before cancelling finish_bh_work, which the card-detect handler can also queue. carddet_work can re-enable the interrupt through via_reset_pcictrl(); mask it again afterwards.
This issue was found by an in-house static analysis tool and confirmed by manual code review.
--- drivers/mmc/host/via-sdmmc.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/mmc/host/via-sdmmc.c +4 -0
@@ -1208,6 +1208,10 @@ static void via_sd_remove(struct pci_dev *pcidev)free_irq (pcidev->irq, sdhost); +cancel_work_sync (&sdhost->carddet_work); +/* carddet_work may re-enable the interrupt via via_reset_pcictrl(). */ +writeb (0x0 , sdhost->pcictrl_mmiobase +VIA_CRDR_PCIINTCTRL ); +del_timer_sync (&sdhost->timer);tasklet_kill (&sdhost->finish_tasklet);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 72/571 hwrng: stm32 - Fix runtime PM cleanup on registration failure
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Can Peng <[email protected]>
[ Upstream commit 1163a476a568f6c0f852d469c8e4c5a5f805adac ]
stm32_rng_probe() enables autosuspend and runtime PM before registering the hwrng. If devm_hwrng_register() fails, probe returns with runtime PM left enabled and autosuspend still selected.
The remove callback also only disables runtime PM and does not undo pm_runtime_use_autosuspend().
Use devm_pm_runtime_enable() so runtime PM is unwound automatically on probe failure and driver detach. Since the managed cleanup also disables runtime PM,drop the remove callback.
--- drivers/char/hw_random/stm32-rng.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/char/hw_random/stm32-rng.c +3 -9
@@ -156,18 +156,13 @@ static int stm32_rng_probe(struct platform_device *ofdev)pm_runtime_set_autosuspend_delay (dev,100 );pm_runtime_use_autosuspend (dev); -pm_runtime_enable (dev); + err =devm_pm_runtime_enable (dev); +if (err) +return err;return devm_hwrng_register (dev, &priv->rng); } -static int stm32_rng_remove (struct platform_device *ofdev) -{ -pm_runtime_disable (&ofdev->dev); - -return 0 ; -} -#ifdef CONFIG_PM static int stm32_rng_runtime_suspend (struct device *dev) {
@@ -209,7 +204,6 @@ static struct platform_driver stm32_rng_driver = { .of_match_table = stm32_rng_match, }, .probe = stm32_rng_probe, - .remove = stm32_rng_remove, };module_platform_driver (stm32_rng_driver);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 73/571 i3c: master: Do not treat master device as a duplicate target
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
[ Upstream commit 4dc1b3eeba7991905a5b5b8129ebea51be7d87b7 ]
i3c_master_search_i3c_dev_duplicate() searches the bus for another I3C device with the same PID as the reference device. The search can match master->this, causing the controller itself to be returned as a duplicate.
Since the controller is not a target device, it cannot be a duplicate of one. Exclude master->this from matching so that the function only returns real duplicate target devices.
--- drivers/i3c/master.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i3c/master.c +2 -1
@@ -1830,7 +1830,8 @@ i3c_master_search_i3c_dev_duplicate(struct i3c_dev_desc *refdev)struct i3c_dev_desc *i3cdev;i3c_bus_for_each_i3cdev (&master->bus, i3cdev) { -if (i3cdev != refdev && i3cdev->info.pid == refdev->info.pid) +if (i3cdev != refdev && i3cdev->info.pid == refdev->info.pid && + i3cdev != master->this)return i3cdev; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 74/571 i3c: master: Fix use-after-free of master->this
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
[ Upstream commit feb0ed76601f3c2f91f08688c5a7d8b9d382f720 ]
sysfs attribute callbacks for the master controller device dereference master->this. However, master->this is freed in i3c_master_detach_free_devs() before the master device itself is released.
As a result, sysfs accesses can dereference a freed master->this pointer, leading to a use-after-free.
Keep master->this alive until i3c_masterdev_release(), which is called after the master device and its sysfs state are being torn down. Do not free master->this as part of the normal device detach path.
On the error path in i3c_master_set_info(), reset master->this and bus.cur_master to NULL before freeing the allocated device.
--- drivers/i3c/master.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/i3c/master.c +11 -6
@@ -529,6 +529,11 @@ static struct attribute *i3c_masterdev_attrs[] = { };ATTRIBUTE_GROUPS (i3c_masterdev); +static void i3c_master_free_i3c_dev (struct i3c_dev_desc *dev) +{ +kfree (dev); +} +static void i3c_masterdev_release (struct device *dev) {struct i3c_master_controller *master =dev_to_i3cmaster (dev);
@@ -541,6 +546,8 @@ static void i3c_masterdev_release(struct device *dev)i3c_bus_cleanup (bus);of_node_put (dev->of_node); + +i3c_master_free_i3c_dev (master->this); }static const struct device_type i3c_masterdev_type = {
@@ -728,11 +735,6 @@ static void i3c_device_release(struct device *dev)kfree (i3cdev); } -static void i3c_master_free_i3c_dev (struct i3c_dev_desc *dev) -{ -kfree (dev); -} -static struct i3c_dev_desc *i3c_master_alloc_i3c_dev (struct i3c_master_controller *master,const struct i3c_device_info *info)
@@ -1604,6 +1606,8 @@ int i3c_master_set_info(struct i3c_master_controller *master,return 0 ; err_free_dev: + master->bus.cur_master =NULL ; + master->this =NULL ;i3c_master_free_i3c_dev (i3cdev);return ret;
@@ -1624,7 +1628,8 @@ static void i3c_master_detach_free_devs(struct i3c_master_controller *master) i3cdev->boardinfo->init_dyn_addr, I3C_ADDR_SLOT_FREE); -i3c_master_free_i3c_dev (i3cdev); +if (i3cdev != master->this) +i3c_master_free_i3c_dev (i3cdev); } list_for_each_entry_safe(i2cdev, i2ctmp, &master->bus.devs.i2c,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 75/571 usb: gadget: f_mass_storage: fix null pointer dereference in fsg_common_set_num_buffers()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeffin Philip <[email protected]>
[ Upstream commit 2c0f5ca48674a5b5f9fa4a9c3325aa48053af0bc ]
Previously fsg_num_buffers_validate() was removed as it was not necessary due to Kconfig setting the limits for n from 2 to 256 with default as 2. However, setting the page content in such a way that kstrtou8() reflects n value as either 0 or 1 bypasses these restrictions leading to a null pointer dereference if n is 0. Fix this by adding a check for n < 2 and returning -EINVAL if n is either 0 or 1 consistent with Kconfig logic.
--- drivers/usb/gadget/function/f_mass_storage.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/gadget/function/f_mass_storage.c +3 -0
@@ -2592,6 +2592,9 @@ int fsg_common_set_num_buffers(struct fsg_common *common, unsigned int n)struct fsg_buffhd *bh, *buffhds;int i; +if (n <2 ) +return -EINVAL ; + buffhds =kcalloc (n,sizeof (*buffhds),GFP_KERNEL );if (!buffhds)return -ENOMEM ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 76/571 spi: bcm63xx: disable clock on resume failure
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Can Peng <[email protected]>
[ Upstream commit 2b62c2c134fa32d9d3a9e7323c8ac74518eeb4ac ]
bcm63xx_spi_resume() enables the controller clock before restarting the SPI controller queue.
If spi_controller_resume() fails, the function currently reports success and leaves the clock enabled. Propagate the error and disable the clock before returning.
--- drivers/spi/spi-bcm63xx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/spi/spi-bcm63xx.c +5 -1
@@ -669,7 +669,11 @@ static int bcm63xx_spi_resume(struct device *dev)if (ret)return ret; -spi_master_resume (master); + ret =spi_master_resume (master); +if (ret) { +clk_disable_unprepare (bs->clk); +return ret; + }return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 77/571 staging: sm750fb: fix mono image source stride mismatch in lynxfb_ops_imageblit()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muhammad Bilal <[email protected]>
[ Upstream commit cc7cd2a9228175c975f62ad56ed7c767701cb4fa ]
sm750_hw_imageblit() advances its monochrome source pointer by src_delta per scanline, and computes the correct rounded-up stride internally as:
bytes_per_scan = (width + start_bit + 7) / 8;
Its only caller, lynxfb_ops_imageblit(), instead passed src_delta as image->width >> 3. For widths not a multiple of 8 this under-counted the stride, so the source pointer fell further behind the real per-scanline layout on every line, corrupting the rendered image.
Rather than just fixing the caller's calculation, remove src_delta as a parameter entirely and have sm750_hw_imageblit() advance by the bytes_per_scan it already computes for itself. There has only ever been one caller, and that caller was passing an out-of-sync derivative of the same width/start_bit values sm750_hw_imageblit() already has, so keeping stride as a separate parameter served no purpose beyond letting the two calculations drift apart, which is exactly what happened here.
Rounding up, rather than down, is the direction consistent with the rest of the fbdev core: struct fb_image mono bitmap data (the same image->data this driver receives) is walked elsewhere with byte strides derived from a ceiling division of width by 8. The generic mono bit iterator in drivers/video/fbdev/core/fb_imageblit.h advances scanlines with "iter->data += BITS_TO_BYTES(iter->width)", and BITS_TO_BYTES() (include/linux/bitops.h) is a ceiling division. sm750_hw_imageblit()'s own "(width + start_bit + 7) / 8" is that same ceiling division with an added start_bit offset, so the caller's ">> 3" (floor) was the one calculation out of step with how this data layout is handled everywhere else.
Found by code review of sm750_hw_imageblit()'s internal stride calculation against what its only caller was passing in, and confirmed with a clean -Werror build. I do not have this hardware, so this has not been exercised at runtime on real sm750 silicon.
--- drivers/staging/sm750fb/sm750.c | 2 +- drivers/staging/sm750fb/sm750.h | 2 +- drivers/staging/sm750fb/sm750_accel.c | 6 ++---- drivers/staging/sm750fb/sm750_accel.h | 4 +--- 4 files changed, 5 insertions(+), 9 deletions(-)
drivers/staging/sm750fb/sm750.c +1 -1
@@ -275,7 +275,7 @@ static void lynxfb_ops_imageblit(struct fb_info *info,spin_lock (&sm750_dev->slock); sm750_dev->accel.de_imageblit(&sm750_dev->accel, - image->data, image->width >> 3, 0, + image->data, 0, base, pitch, Bpp, image->dx, image->dy, image->width, image->height,
drivers/staging/sm750fb/sm750.h +1 -1
@@ -73,7 +73,7 @@ struct lynx_accel { u32 rop2);int (*de_imageblit)(struct lynx_accel *accel,const char *p_srcbuf, -u32 src_delta,u32 start_bit,u32 d_base,u32 d_pitch, +u32 start_bit,u32 d_base,u32 d_pitch,u32 byte_per_pixel,u32 dx,u32 dy,u32 width,u32 height,u32 f_color,u32 b_color,u32 rop2);
drivers/staging/sm750fb/sm750_accel.c +2 -4
@@ -301,8 +301,6 @@ static unsigned int deGetTransparency(struct lynx_accel *accel)* sm750_hw_imageblit * @accel: Acceleration device data * @pSrcbuf: pointer to start of source buffer in system memory -* @srcDelta: Pitch value (in bytes) of the source buffer, +ive means top down -* and -ive mean button up * @startBit: Mono data can start at any bit in a byte, this value should be * 0 to 7 * @dBase: Address of destination: offset in frame buffer
@@ -317,7 +315,7 @@ static unsigned int deGetTransparency(struct lynx_accel *accel)* @rop2: ROP value */ int sm750_hw_imageblit (struct lynx_accel *accel,const char *pSrcbuf, -u32 srcDelta,u32 startBit,u32 dBase,u32 dPitch, +u32 startBit,u32 dBase,u32 dPitch,u32 bytePerPixel,u32 dx,u32 dy,u32 width,u32 height,u32 fColor,u32 bColor,u32 rop2) {
@@ -406,7 +404,7 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,write_dpPort (accel, *(unsigned int *)ajRemain); } - pSrcbuf += srcDelta; + pSrcbuf += ulBytesPerScan; }return 0 ;
drivers/staging/sm750fb/sm750_accel.h +1 -3
@@ -220,8 +220,6 @@ int sm750_hw_copyarea(struct lynx_accel *accel,/** * sm750_hw_imageblit * @pSrcbuf: pointer to start of source buffer in system memory -* @srcDelta: Pitch value (in bytes) of the source buffer, +ive means top down -*>----- and -ive mean button up * @startBit: Mono data can start at any bit in a byte, this value should be *>----- 0 to 7 * @dBase: Address of destination: offset in frame buffer
@@ -236,7 +234,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,* @rop2: ROP value */ int sm750_hw_imageblit (struct lynx_accel *accel,const char *pSrcbuf, -u32 srcDelta,u32 startBit,u32 dBase,u32 dPitch, +u32 startBit,u32 dBase,u32 dPitch,u32 bytePerPixel,u32 dx,u32 dy,u32 width,u32 height,u32 fColor,u32 bColor,u32 rop2);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 78/571 ftrace: Synchronize the initialization of ftrace_ops
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
[ Upstream commit 4617721c502b2ddaa4e324e86da4997edf738fa5 ]
There's some internal state that ftrace_ops needs to have set, but since it can be declared outside of the ftrace.c code, it calls ftrace_ops_init() on the ops in every global function. The issue is that if two tasks call it on the same ops at the same time it is possible to have the initialization of one corrupt the initialization of the other call.
Create a ops_mutex to use to synchronize every initialization of the ftrace_ops. The mutex is taken within checking the ftrace_ops flag that states it was initializied but the flag is checked again after the mutex has been taken. Checking first outside the mutex allows it to shortcut having to take the mutex. But then the check needs to be done again after the mute is taken in case of races.
Close: https://lore.kernel.org/all/[email protected]/
--- kernel/trace/ftrace.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
kernel/trace/ftrace.c +11 -2
@@ -69,6 +69,8 @@#define INIT_OPS_HASH (opsname) \ .func_hash = &opsname.local_hash, \ .local_hash.regex_lock = __MUTEX_INITIALIZER(opsname.local_hash.regex_lock), +/* Used only to synchronize the initialization of ftrace_ops */ +static DEFINE_MUTEX (ops_mutex);#else #define INIT_OPS_HASH (opsname)#endif
@@ -131,10 +133,17 @@ static void ftrace_ops_no_ops(unsigned long ip, unsigned long parent_ip);static inline void ftrace_ops_init (struct ftrace_ops *ops) {#ifdef CONFIG_DYNAMIC_FTRACE -if (!(ops->flags &FTRACE_OPS_FL_INITIALIZED )) { +unsigned long flags =smp_load_acquire (&ops->flags); + +if (!(flags &FTRACE_OPS_FL_INITIALIZED )) { +guard (mutex)(&ops_mutex); +/* Could have been initialized before lock taken */ +if (unlikely (ops->flags &FTRACE_OPS_FL_INITIALIZED )) +return ;mutex_init (&ops->local_hash.regex_lock); ops->func_hash = &ops->local_hash; - ops->flags |=FTRACE_OPS_FL_INITIALIZED ; + flags = ops->flags |FTRACE_OPS_FL_INITIALIZED ; +smp_store_release (&ops->flags, flags); }#endif }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 79/571 arm64: allow pte_offset_map() to fail
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hugh Dickins <[email protected]>
[ Upstream commit 52924726f4c06b3f77de75fb665e6efd8e777d07 ]
In rare transient cases, not yet made possible, pte_offset_map() and pte_offset_map_lock() may not find a page table: handle appropriately.
Stable-dep-of: a77644d009de ("arm64: mm: Fix the lockless page-table walk in show_pte()")
--- arch/arm64/mm/fault.c | 3 +++ 1 file changed, 3 insertions(+)
arch/arm64/mm/fault.c +3 -0
@@ -176,6 +176,9 @@ static void show_pte(unsigned long addr)break ; ptep =pte_offset_map (pmdp, addr); +if (!ptep) +break ; + pte =READ_ONCE (*ptep);pr_cont (", pte=%016llx" ,pte_val (pte));pte_unmap (ptep);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 80/571 arm64: mm: Fix the lockless page-table walk in show_pte()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <[email protected]>
[ Upstream commit a77644d009dece1104b6fcc6e322b0e4503db0d6 ]
show_pte() walks page tables locklessly and can run with interrupts enabled. A concurrent teardown can free a table page while it is being walked. It can also clear a parent entry after show_pte() checked it; the regular pXd_offset() helpers then reread the cleared entry and can derive a bogus lower-level pointer and fault again.
Use the lockless offset helpers with the saved parent entries, as gup_fast() does, and pass the saved PMD to pte_offset_map().
For task page tables, arm64 selects MMU_GATHER_RCU_TABLE_FREE. Disable local interrupts around the walk to hold off RCU-deferred table frees and block the tlb_remove_table_sync_one() IPI until the walk is finished.
Place the IRQ guard after the header print. This does not make the output a consistent snapshot, but prevents the task page-table walk from dereferencing a released table page or deriving a pointer from a different parent value.
--- arch/arm64/mm/fault.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
arch/arm64/mm/fault.c +10 -4
@@ -15,6 +15,7 @@#include <linux/mm.h> #include <linux/hardirq.h> #include <linux/init.h> +#include <linux/irqflags.h> #include <linux/kasan.h> #include <linux/kprobes.h> #include <linux/uaccess.h>
@@ -123,6 +124,7 @@ static void show_pte(unsigned long addr)struct mm_struct *mm;pgd_t *pgdp;pgd_t pgd; +unsigned long flags;if (is_ttbr0_addr (addr)) {/* TTBR0 */
@@ -144,6 +146,9 @@ static void show_pte(unsigned long addr)pr_alert ("%s pgtable: %luk pages, %llu-bit VAs, pgdp=%016lx\n" , mm == &init_mm ?"swapper" :"user" ,PAGE_SIZE /SZ_1K , vabits_actual,mm_to_pgd_phys (mm)); + +local_irq_save (flags); + pgdp =pgd_offset (mm, addr); pgd =READ_ONCE (*pgdp);pr_alert ("[%016lx] pgd=%016llx" , addr,pgd_val (pgd));
@@ -157,25 +162,25 @@ static void show_pte(unsigned long addr)if (pgd_none (pgd) ||pgd_bad (pgd))break ; - p4dp =p4d_offset (pgdp, addr); + p4dp =p4d_offset_lockless (pgdp, pgd, addr); p4d =READ_ONCE (*p4dp);pr_cont (", p4d=%016llx" ,p4d_val (p4d));if (p4d_none (p4d) ||p4d_bad (p4d))break ; - pudp =pud_offset (p4dp, addr); + pudp =pud_offset_lockless (p4dp, p4d, addr); pud =READ_ONCE (*pudp);pr_cont (", pud=%016llx" ,pud_val (pud));if (pud_none (pud) ||pud_bad (pud))break ; - pmdp =pmd_offset (pudp, addr); + pmdp =pmd_offset_lockless (pudp, pud, addr); pmd =READ_ONCE (*pmdp);pr_cont (", pmd=%016llx" ,pmd_val (pmd));if (pmd_none (pmd) ||pmd_bad (pmd))break ; - ptep =pte_offset_map (pmdp, addr); + ptep =pte_offset_map (&pmd, addr);if (!ptep)break ;
@@ -185,6 +190,7 @@ static void show_pte(unsigned long addr) }while (0 );pr_cont ("\n" ); +local_irq_restore (flags); }/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 81/571 mm/mremap: reset unfaulted VMA page offset for MREMAP_DONTUNMAP
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Stoakes (ARM) <[email protected]>
[ Upstream commit 35b0fb391b0df57383bc15985bb769f4555c97ba ]
Uniquely an mremap() invocation using the MREMAP_DONTUNMAP flag can reset a faulted VMA into an unfaulted one.
It does so after the page tables have been moved to the copied VMA with MREMAP_DONTUNMAP leaving the old VMA in place which is naturally unfaulted as the page tables it had are no longer present.
However, in doing so, it violates the invariant that the anonymous page offset of an unfaulted VMA is vma->vm_start >> PAGE_SHIFT.
This is because a VMA may have been faulted in, mremap()'d (causing a delta between its page offset and vma->vm_start >> PAGE_SHIFT), and then mremap()'d again with MREMAP_DONTUNMAP resulting in the unfaulting.
This condition is a violation of a fundamental assumption in mm, but now also triggers an assert in assert_sane_pgoff() which explicitly checks for this condition.
Correct it by resetting the VMA's page offset at the point of completing the MREMAP_DONTUNMAP operation.
--- mm/mremap.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
mm/mremap.c +11 -1
@@ -679,8 +679,18 @@ static unsigned long move_vma(struct vm_area_struct *vma,* table has been moved. */ if (new_vma != vma && vma->vm_start == old_addr && - vma->vm_end == (old_addr + old_len)) + vma->vm_end == (old_addr + old_len)) { +const pgoff_t pgoff_unfaulted = vma->vm_start >>PAGE_SHIFT ; +unlink_anon_vmas (vma); +/* +* The VMA is now unfaulted and it is an invariant that +* unfaulted anonymous VMAs have page offset equal to +* vma->vm_start >> PAGE_SHIFT. +*/ +if (vma_is_anonymous (vma) && !vma->vm_file) + vma->vm_pgoff = pgoff_unfaulted; + }/* Because we won't unmap we don't need to touch locked_vm */ return new_addr;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 82/571 media: rkvdec: Propagate platform_get_irq() errors
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Narasimharao Vadlamudi <[email protected]>
[ Upstream commit c37aca64206fafe938119e801a3fd10a537a051f ]
platform_get_irq() returns a positive IRQ number on success and a negative error code on failure. It no longer returns zero. The driver currently returns -ENXIO for all failures, which loses useful errors such as -EPROBE_DEFER.
Return the error from platform_get_irq() directly.
--- drivers/staging/media/rkvdec/rkvdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/media/rkvdec/rkvdec.c +2 -2
@@ -1017,8 +1017,8 @@ static int rkvdec_probe(struct platform_device *pdev)vb2_dma_contig_set_max_seg_size (&pdev->dev,DMA_BIT_MASK (32 )); irq =platform_get_irq (pdev,0 ); -if (irq <=0 ) -return -ENXIO ; +if (irq <0 ) +return irq; ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, rkvdec_irq_handler, IRQF_ONESHOT,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 83/571 media: saa7164: fix cleanup on resource allocation failure
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guangshuo Li <[email protected]>
[ Upstream commit 28e84c6e2e6753ed238ea097b2842a32a6a6879b ]
saa7164_dev_setup() adds the device to the global saa7164_devlist before requesting the PCI BAR memory regions.
If get_resources() fails, saa7164_dev_setup() decrements the device count and returns an error, but leaves the device on saa7164_devlist. The probe error path then frees the device, leaving a dangling entry on the global list.
Reuse the existing MMIO mapping error path to remove the device from saa7164_devlist and decrement the device count before returning.
Also release BAR0 if it was successfully requested but the BAR2 request fails.
--- drivers/media/pci/saa7164/saa7164-core.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/media/pci/saa7164/saa7164-core.c +6 -0
@@ -880,6 +880,9 @@ static int get_resources(struct saa7164_dev *dev)if (request_mem_region (pci_resource_start (dev->pci,2 ),pci_resource_len (dev->pci,2 ), dev->name))return 0 ; + +release_mem_region (pci_resource_start (dev->pci,0 ), +pci_resource_len (dev->pci,0 )); } printk(KERN_ERR "%s: can't get MMIO memory @ 0x%llx or 0x%llx\n",
@@ -993,6 +996,9 @@ static int saa7164_dev_setup(struct saa7164_dev *dev) dev->name, dev->pci->subsystem_vendor, dev->pci->subsystem_device); +mutex_lock (&devlist); +list_del (&dev->devlist); +mutex_unlock (&devlist); saa7164_devcount--;return -ENODEV ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 84/571 media: zoran: Avoid freeing a registered video_device twice
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruoyu Wang <[email protected]>
[ Upstream commit 0735e0b5a96761a9ce277a238e834008ad92a0a5 ]
zoran_init_video_device() installs zoran_vdev_release() as the video_device release callback through zoran_template. After video_register_device() succeeds, video_unregister_device() drops the registered video_device reference and the V4L2 core eventually invokes that release callback, which kfree()s the video_device.
zoran_exit_video_devices() called video_unregister_device() and then kfree(zr->video_dev), so device teardown could free the same video_device twice.
Remove the direct kfree() and clear the cached pointer after unregistering. The pre-registration failure path keeps its manual free because the video_device was not registered there.
This issue was found by a static analysis checker and confirmed by manual source review.
--- drivers/staging/media/zoran/zoran_card.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/zoran/zoran_card.c +1 -1
@@ -832,7 +832,7 @@ static int zoran_init_video_device(struct zoran *zr, struct video_device *video_static void zoran_exit_video_devices (struct zoran *zr) {video_unregister_device (zr->video_dev); -kfree (zr->video_dev); + zr->video_dev =NULL ; }static int zoran_init_video_devices (struct zoran *zr)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 85/571 scsi: qla2xxx: Null out freed pointers in qla2x00_mem_alloc() error path
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nilesh Javali <[email protected]>
[ Upstream commit 6d90f0feb929f6c0f3010f9af4747c7230b75993 ]
When qla2x00_mem_alloc() fails, qla2x00_probe_one() jumps to probe_hw_failed and calls qla2x00_mem_free(). Several error labels in qla2x00_mem_alloc() freed adapter members (elsrej.c, purex_dma_pool, flt, sfp_data, loop_id_map, async_pd, sf_init_cb, ex_init_cb, npiv_info) but left the pointers dangling. qla2x00_mem_free() then freed them a second time. Worse, for the dma_pool members it issued dma_pool_free(ha->s_dma_pool, ...) after s_dma_pool had already been destroyed and set to NULL at fail_s_dma_pool, dereferencing a NULL pool.
Clear each freed pointer (and its DMA handle) in the error labels so the subsequent qla2x00_mem_free() skips them.
--- drivers/scsi/qla2xxx/qla_os.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/scsi/qla2xxx/qla_os.c +13 -0
@@ -4431,23 +4431,36 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len, fail_elsrej:dma_pool_destroy (ha->purex_dma_pool); + ha->purex_dma_pool =NULL ; fail_flt:dma_free_coherent (&ha->pdev->dev,sizeof (struct qla_flt_header ) +FLT_REGIONS_SIZE , ha->flt, ha->flt_dma); + ha->flt =NULL ; + ha->flt_dma =0 ; fail_flt_buffer:dma_free_coherent (&ha->pdev->dev,SFP_DEV_SIZE , ha->sfp_data, ha->sfp_data_dma); + ha->sfp_data =NULL ; + ha->sfp_data_dma =0 ; fail_sfp_data:kfree (ha->loop_id_map); + ha->loop_id_map =NULL ; fail_loop_id_map:dma_pool_free (ha->s_dma_pool, ha->async_pd, ha->async_pd_dma); + ha->async_pd =NULL ; + ha->async_pd_dma =0 ; fail_async_pd:dma_pool_free (ha->s_dma_pool, ha->sf_init_cb, ha->sf_init_cb_dma); + ha->sf_init_cb =NULL ; + ha->sf_init_cb_dma =0 ; fail_sf_init_cb:dma_pool_free (ha->s_dma_pool, ha->ex_init_cb, ha->ex_init_cb_dma); + ha->ex_init_cb =NULL ; + ha->ex_init_cb_dma =0 ; fail_ex_init_cb:kfree (ha->npiv_info); + ha->npiv_info =NULL ; fail_npiv_info:dma_free_coherent (&ha->pdev->dev, ((*rsp)->length +1 ) *sizeof (response_t), (*rsp)->ring, (*rsp)->dma);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 86/571 scsi: qla2xxx: Fix 64G link speed reporting in get_data_rate
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nilesh Javali <[email protected]>
[ Upstream commit 52fba32317ee631faa878725b2f7cd5c08acacd3 ]
qla2x00_get_data_rate() skips updating ha->link_data_rate when the firmware returns mcp->mb[1] == 0x7. That value was a legacy sentinel from before 64G hardware existed, but PORT_SPEED_64GB is now defined as 0x07 and ha->link_data_rate is decoded with the PORT_SPEED_* encoding. On a 64G-capable adapter a genuine 64G link is therefore dropped, and the port speed is misreported (port_speed sysfs, fc_host speed, FDMI).
Only 28xx and 29xx support 64G, so accept 0x07 on those adapters while keeping the legacy filter for older ones. Also drop the duplicate copy of the check at the end of the success branch; it repeated the first assignment with no intervening change.
--- drivers/scsi/qla2xxx/qla_mbx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/qla2xxx/qla_mbx.c +1 -3
@@ -5650,7 +5650,7 @@ qla2x00_get_data_rate(scsi_qla_host_t *vha)ql_dbg (ql_dbg_mbx, vha,0x1107 ,"Failed=%x mb[0]=%x.\n" , rval, mcp->mb[0 ]); }else { -if (mcp->mb[1 ] !=0x7 ) +if (mcp->mb[1 ] !=0x7 ||IS_QLA28XX (ha)) ha->link_data_rate = mcp->mb[1 ];if (IS_QLA83XX (ha) ||IS_QLA27XX (ha) ||IS_QLA28XX (ha)) {
@@ -5661,8 +5661,6 @@ qla2x00_get_data_rate(scsi_qla_host_t *vha)ql_dbg (ql_dbg_mbx + ql_dbg_verbose, vha,0x1108 ,"Done %s.\n" , __func__); -if (mcp->mb[1 ] !=0x7 ) - ha->link_data_rate = mcp->mb[1 ]; }return rval;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 87/571 scsi: qla2xxx: Quiesce response IRQ before freeing request queue
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nilesh Javali <[email protected]>
[ Upstream commit 505753ec2594c6af09a601f0dd60be7d840c1d2d ]
qla2xxx_delete_qpair() deletes the request queue before the response queue. qla25xx_delete_req_que() frees the request queue memory (kfree(req) in qla25xx_free_req_que()), but the response-queue MSI-X is only released later, in qla25xx_free_rsp_que(). In that window the response interrupt can still fire, qla2xxx_msix_rsp_q() queues qpair->q_work, and qla_do_work() -> qla24xx_process_response_queue() dereferences the now-freed rsp->req (LOGINOUT/CT/ELS entries and the status path), a use-after-free.
The cancel_work_sync() added for the qpair teardown lives in the response free path, which runs after the request queue is already freed, so it does not protect rsp->req.
Release the response-queue interrupt and flush qpair->q_work before deleting the request queue, so no late completion can reach the freed request queue. Clearing have_irq makes the subsequent qla25xx_free_rsp_que() skip its free_irq(), and the firmware queue-delete order (request then response) is preserved; the request-delete mailbox completes on the default vector and is unaffected by dropping the qpair response interrupt early.
--- drivers/scsi/qla2xxx/qla_init.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/scsi/qla2xxx/qla_init.c +17 -0
@@ -9938,9 +9938,26 @@ int qla2xxx_delete_qpair(struct scsi_qla_host *vha, struct qla_qpair *qpair) {int ret =QLA_FUNCTION_FAILED ;struct qla_hw_data *ha = qpair->hw; +struct rsp_que *rsp = qpair->rsp; qpair->delete_in_progress =1 ; +/* +* The response-queue interrupt schedules qla_do_work(), which +* dereferences qpair->rsp->req. Release the interrupt and flush +* any pending work before the request queue is freed below so a +* late completion cannot touch the freed request queue. The +* firmware queue-delete order (request then response) is kept. +*/ +if (rsp && rsp->msix && rsp->msix->have_irq) { +free_irq (rsp->msix->vector, rsp->msix->handle); + rsp->msix->have_irq =0 ; + rsp->msix->in_use =0 ; + rsp->msix->handle =NULL ; + } +if (rsp && ha->wq) +cancel_work_sync (&qpair->q_work); + ret =qla25xx_delete_req_que (vha, qpair->req);if (ret !=QLA_SUCCESS ) goto fail;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 88/571 scsi: qla2xxx: Use memset_io() to clear QLAFX00 request ring slot
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nilesh Javali <[email protected]>
[ Upstream commit 626e44f3d8a924a97a3848a9fd45833947e081e9 ]
For QLAFX00 the request ring is ioremapped device I/O memory (ha->iobase + req_que_off), not DMA-coherent RAM, which is why the rest of the FX00 path accesses it through memcpy_toio() and the wrt_reg_* helpers. __qla2x00_alloc_iocbs() however zeroed the producer slot with a plain memset(). On architectures such as ARM64 a regular memset() may emit unaligned or block-zeroing instructions (e.g. DC ZVA) that are invalid on Device memory, leading to a synchronous external abort.
Use memset_io() to clear the slot for QLAFX00, matching the I/O accessors used elsewhere on this ring. Other adapters keep the plain memset() on their DMA-coherent rings. The zero-fill is retained for FX00 because its IOCB builders (e.g. qlafx00_fxdisc_iocb()) copy only part of the entry and rely on the unused tail being pre-zeroed.
--- drivers/scsi/qla2xxx/qla_iocb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_iocb.c +3 -1
@@ -2347,11 +2347,13 @@ __qla2x00_alloc_iocbs(struct qla_qpair *qpair, srb_t *sp)/* Prep packet */ req->cnt -= req_cnt; pkt = req->ring_ptr; -memset (pkt,0 ,REQUEST_ENTRY_SIZE );if (IS_QLAFX00 (ha)) { +memset_io ((void __iomem __force *)pkt,0 , +REQUEST_ENTRY_SIZE );wrt_reg_byte ((u8 __force __iomem *)&pkt->entry_count, req_cnt);wrt_reg_dword ((__le32 __force __iomem *)&pkt->handle, handle); }else { +memset (pkt,0 ,REQUEST_ENTRY_SIZE ); pkt->entry_count = req_cnt; pkt->handle = handle; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 89/571 scsi: qla2xxx: Fix soft lockup polling continuation IOCB signature
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nilesh Javali <[email protected]>
[ Upstream commit d7e3fa7d06bf7fcaac186d3c4d635caac166d36c ]
qla27xx_copy_multiple_pkt() and qla27xx_copy_fpin_pkt() poll rsp_q->ring_ptr->signature for RESPONSE_PROCESSED (0xDEADDEAD) to decide whether the next continuation IOCB has arrived, spinning on cpu_relax() without advancing the ring or decrementing the entry count while it has not. response_t::signature lives at byte offset 60, but a continuation IOCB (sts_cont_entry_t / struct sts_cont_entry_ext) carries raw FC frame payload at that offset (data[56..59]). A received frame whose payload bytes happen to equal 0xDEADDEAD is therefore misread as "not yet arrived", and the loop spins forever in interrupt/DPC context, causing a CPU soft lockup.
The poll is also unnecessary: callers of qla27xx_copy_multiple_pkt() (PT_LS4_UNSOL and the NVMe purls path) already gate on qla_chk_cont_iocb_avail(), which guarantees all entry_count IOCBs are present before copying begins. The sibling helper __qla_copy_purex_to_buffer() already drops the signature poll and relies on the entry_type == STATUS_CONT_TYPE guard instead.
Remove the signature busy-wait from both helpers, keeping the entry_type guard, and gate the FPIN path with qla_chk_cont_iocb_avail() so it defers and re-processes on the next interrupt once all continuation IOCBs have arrived, mirroring the ELS_AUTH_ELS and PT_LS4_UNSOL arms. With this the signature field is never read on a continuation IOCB, eliminating the payload-aliasing lockup.
--- drivers/scsi/qla2xxx/qla_isr.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-)
drivers/scsi/qla2xxx/qla_isr.c +17 -10
@@ -1053,14 +1053,6 @@ qla27xx_copy_fpin_pkt(struct scsi_qla_host *vha, void **pkt, do { while ((total_bytes > 0) && (entry_count_remaining > 0)) { - if (rsp_q->ring_ptr->signature == RESPONSE_PROCESSED) { - ql_dbg(ql_dbg_async, vha, 0x5084, - "Ran out of IOCBs, partial data 0x%x\n", - buffer_copy_offset); - cpu_relax(); - continue; - } - new_pkt = (sts_cont_entry_t *)rsp_q->ring_ptr; *pkt = new_pkt;
@@ -3963,10 +3955,25 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha, "SCM not active for this port\n");break ; } +__update_rsp_in (1 , is_shadow_hba, rsp, rsp_in); +if (qla_chk_cont_iocb_avail (vha, rsp, + (response_t *)pkt, rsp_in)) { +/* +* ring_ptr and ring_index were +* pre-incremented above. Reset them +* back to current. Wait for next +* interrupt with all IOCBs to arrive +* and re-process. +*/ + rsp->ring_ptr = (response_t *)pkt; + rsp->ring_index = cur_ring_index; + +ql_dbg (ql_dbg_init, vha,0x5095 , +"Defer processing FPIN...\n" ); +return ; + } pure_item =qla27xx_copy_fpin_pkt (vha, (void **)&pkt, &rsp); -__update_rsp_in (follow_inptr, is_shadow_hba, - rsp, rsp_in);if (!pure_item)break ; qla24xx_queue_purex_item(vha, pure_item,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 90/571 f2fs: limit recovery filename logging to stored length
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wenjie Qi <[email protected]>
[ Upstream commit 01027b2fcb74dade59fb833b51023f6593b6a9a2 ]
F2FS stores recovery filenames as a length plus a fixed-size i_name buffer. The buffer is not NUL-terminated, but recover_inode() and recover_dentry() print it with %s.
For a 255-byte filename, recovery logging can read past i_name into the following raw inode fields.
Print the name with a precision bounded by i_namelen and F2FS_NAME_LEN.
--- fs/f2fs/recovery.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-)
fs/f2fs/recovery.c +22 -11
@@ -171,7 +171,8 @@ static int recover_dentry(struct inode *inode, struct page *ipage,struct inode *dir, *einode;struct fsync_inode_entry *entry;int err =0 ; -char *name; +const char *name; +int name_len; entry =get_fsync_inode (dir_list, pino);if (!entry) {
@@ -230,12 +231,16 @@ static int recover_dentry(struct inode *inode, struct page *ipage, out_put:f2fs_put_page (page,0 ); out: -if (file_enc_name (inode)) +if (file_enc_name (inode)) { name ="<encrypted>" ; -else + name_len =sizeof ("<encrypted>" ) -1 ; + }else { name = raw_inode->i_name; -f2fs_notice (F2FS_I_SB (inode),"%s: ino = %x, name = %s, dir = %lx, err = %d" , - __func__,ino_of_node (ipage), name, + name_len = min_t(unsigned int, le32_to_cpu(raw_inode->i_namelen), +F2FS_NAME_LEN ); + } +f2fs_notice (F2FS_I_SB (inode),"%s: ino = %x, name = %.*s, dir = %lx, err = %d" , + __func__,ino_of_node (ipage), name_len, name,IS_ERR (dir) ?0 : dir->i_ino, err);return err; }
@@ -282,7 +287,8 @@ static void recover_inline_flags(struct inode *inode, struct f2fs_inode *ri)static int recover_inode (struct inode *inode,struct page *page) {struct f2fs_inode *raw =F2FS_INODE (page); -char *name; +const char *name; +int name_len;int err; inode->i_mode =le16_to_cpu (raw->i_mode);
@@ -332,13 +338,18 @@ static int recover_inode(struct inode *inode, struct page *page)f2fs_mark_inode_dirty_sync (inode, true); -if (file_enc_name (inode)) +if (file_enc_name (inode)) { name ="<encrypted>" ; -else - name =F2FS_INODE (page)->i_name; + name_len =sizeof ("<encrypted>" ) -1 ; + }else { + name = raw->i_name; + name_len = min_t(unsigned int, le32_to_cpu(raw->i_namelen), +F2FS_NAME_LEN ); + } -f2fs_notice (F2FS_I_SB (inode),"recover_inode: ino = %x, name = %s, inline = %x" , -ino_of_node (page), name, raw->i_inline); +f2fs_notice (F2FS_I_SB (inode),"%s: ino = %x, name = %.*s, inline = %x" , + __func__,ino_of_node (page), name_len, name, + raw->i_inline);return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 91/571 f2fs: fix dentry folio leak in find_in_level
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guanghui Yang <[email protected]>
[ Upstream commit cca7d3e30bf30333314e31bc70b9a739f1342167 ]
find_in_level() gets a dentry folio with f2fs_find_data_folio() before calling find_in_block(). If find_in_block() returns an error, the function stores the error in res_folio and breaks out of the loop without dropping the dentry folio.
This leaks the folio reference on the find_in_block() error path. Drop the dentry folio before returning the error to the caller.
--- fs/f2fs/dir.c | 1 + 1 file changed, 1 insertion(+)
fs/f2fs/dir.c +1 -0
@@ -372,6 +372,7 @@ static struct f2fs_dir_entry *find_in_level(struct inode *dir, de =find_in_block (dir, dentry_page, fname, &max_slots, use_hash);if (IS_ERR (de)) { +f2fs_put_page (dentry_page,0 ); *res_page =ERR_CAST (de); de =NULL ;break ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 92/571 ipmr: account multicast table and route memory
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zihan Xi <[email protected]>
[ Upstream commit b7ee18725f2292ab554aa96a101ae42d45f008bd ]
A netadmin in a user+net namespace can create many IPv4 and IPv6 multicast routing tables with MRT_TABLE and MRT6_TABLE. Each unseen id allocates an mr_table via the shared mr_table_alloc(), links it into the per-net list, and leaves it until netns teardown. Those objects were not charged to memcg, so the host unreclaimable slab grows with the table count.
Account mr_table allocations with GFP_KERNEL_ACCOUNT and mark the IPv4/IPv6 MFC caches SLAB_ACCOUNT. This matches the established handling of IP addresses, routes and alternate interface names.
Unresolved MFC entries are still allocated from softIRQ with GFP_ATOMIC and are not charged. They expire after 10 seconds and are bounded by the socket receive queue; see commit 0079ad8e8dc3 ("ipmr: remove hard code cache_resolve_queue_len limit").
--- net/ipv4/ipmr.c | 3 ++- net/ipv4/ipmr_base.c | 2 +- net/ipv6/ip6mr.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-)
net/ipv4/ipmr.c +2 -1
@@ -3115,7 +3115,8 @@ int __init ip_mr_init(void) mrt_cachep =kmem_cache_create ("ip_mrt_cache" ,sizeof (struct mfc_cache ), -0 ,SLAB_HWCACHE_ALIGN |SLAB_PANIC , +0 ,SLAB_HWCACHE_ALIGN |SLAB_PANIC | +SLAB_ACCOUNT ,NULL ); err =register_pernet_subsys (&ipmr_net_ops);
net/ipv4/ipmr_base.c +1 -1
@@ -38,7 +38,7 @@ mr_table_alloc(struct net *net, u32 id,struct mr_table *mrt;int err; - mrt =kzalloc (sizeof (*mrt),GFP_KERNEL ); + mrt =kzalloc (sizeof (*mrt),GFP_KERNEL_ACCOUNT );if (!mrt)return ERR_PTR (-ENOMEM ); mrt->id = id;
net/ipv6/ip6mr.c +1 -1
@@ -1357,7 +1357,7 @@ int __init ip6_mr_init(void) mrt_cachep =kmem_cache_create ("ip6_mrt_cache" ,sizeof (struct mfc6_cache ), -0 ,SLAB_HWCACHE_ALIGN , +0 ,SLAB_HWCACHE_ALIGN |SLAB_ACCOUNT ,NULL );if (!mrt_cachep)return -ENOMEM ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 93/571 net/sched: act_api: release all action references on NEWACTION failure
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xuanqiang Luo <[email protected]>
[ Upstream commit 478eb5abb51931a152abab068f8a717b7ff480fd ]
When a batched RTM_NEWACTION request replaces an existing action, tcf_idr_check_alloc() takes a temporary reference on it. If a later action fails to initialize, tcf_action_destroy() uses strict release semantics to clean up the actions initialized so far. For an action bound to a filter, the strict check returns -EPERM without dropping the temporary reference.
This error also makes tcf_action_destroy() return before releasing subsequent entries. Any new action initialized between the bound action and the failing entry is leaked together with its reserved IDR slot, preventing reuse of its index.
Use tcf_idr_release() to drop each reference held by the batch without rejecting bound actions. This allows cleanup to continue through all initialized entries and preserves the module reference release when an action is destroyed. Explicit action deletion and flushing retain their separate bind-count checks.
--- net/sched/act_api.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
net/sched/act_api.c +2 -7
@@ -807,19 +807,14 @@ EXPORT_SYMBOL(tcf_action_exec);int tcf_action_destroy (struct tc_action *actions[],int bind) { -const struct tc_action_ops *ops;struct tc_action *a;int ret =0 , i;for (i =0 ; i <TCA_ACT_MAX_PRIO && actions[i]; i++) { a = actions[i]; actions[i] =NULL ; - ops = a->ops; - ret =__tcf_idr_release (a, bind, true); -if (ret ==ACT_P_DELETED ) -module_put (ops->owner); -else if (ret <0 ) -return ret; +/* Drop our reference even if the action is still bound to a filter. */ + ret =tcf_idr_release (a, bind); }return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 94/571 ring-buffer: Acquire the lock with irqsave in rb_wake_up_waiters()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
[ Upstream commit 815e07c8fe885a87751c2496a30ae0dcd4118210 ]
rb_wake_up_waiters() is a irq_work callback which is initialized with init_irq_work(). As such it will be invoked in thread context on PREEMPT_RT. Invoking the callback in IRQ context on PREEMPT_RT is not an option due its usage of wake_up_all(). Since this callback may run in thread context, it needs to acquire ring_buffer_per_cpu::reader_lock with disabling interrupts and may not assume that they are disabled.
Use raw_spinlock_irqsave() to acquire ring_buffer_per_cpu::reader_lock.
--- kernel/trace/ring_buffer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/trace/ring_buffer.c +3 -3
@@ -877,15 +877,15 @@ static void rb_wake_up_waiters(struct irq_work *work)/* Only cpu_buffer sets the above flags */ struct ring_buffer_per_cpu *cpu_buffer = container_of(rbwork, struct ring_buffer_per_cpu, irq_work); +unsigned long flags; -/* Called from interrupt context */ -raw_spin_lock (&cpu_buffer->reader_lock); +raw_spin_lock_irqsave (&cpu_buffer->reader_lock, flags); rbwork->wakeup_full = false; rbwork->full_waiters_pending = false;/* Waking up all waiters, they will reset the shortest full */ cpu_buffer->shortest_full =0 ; -raw_spin_unlock (&cpu_buffer->reader_lock); +raw_spin_unlock_irqrestore (&cpu_buffer->reader_lock, flags);wake_up_all (&rbwork->full_waiters); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 95/571 smb: client: fix file type corruption in cifs_reparse_point_to_fattr()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <[email protected]>
[ Upstream commit 6bd360447941357e959414a525aa62576a448116 ]
Setting the file type in cf_mode without clearing the existing S_IFMT bits first is wrong as it corrupts the file type when cf_mode already has type bits set (e.g. S_IFREG | S_IFLNK == S_IFDIR | S_IFREG).
Clear S_IFMT before setting S_IFLNK for native and SMB1 symlinks.
--- fs/cifs/inode.c | 1 + 1 file changed, 1 insertion(+)
fs/cifs/inode.c +1 -0
@@ -623,6 +623,7 @@ smb311_posix_info_to_fattr(struct cifs_fattr *fattr, struct smb311_posix_qinfo */* fattr->cf_rdev = le32_to_cpu(info->DeviceId); */ if (symlink) { + fattr->cf_mode &= ~S_IFMT ; fattr->cf_mode |=S_IFLNK ; fattr->cf_dtype =DT_LNK ; }else if (fattr->cf_cifsattrs &ATTR_DIRECTORY ) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 96/571 smb: client: fix cifsFileInfo reference leak in deferred close
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fan Wu <[email protected]>
[ Upstream commit 5520e89a5a4f834bced64cf2ac927001cc513a40 ]
When cifs_close() defers a close, it hands the cifsFileInfo reference of the closing struct file to the queued work. Each execution of smb2_deferred_work_close() drops one such reference.
deferred_close_scheduled can be false while the work is pending: the workqueue clears PENDING when the callback starts to run, before the callback clears the flag under deferred_lock. A close in that interval requeues the running work, and the callback then clears the flag, leaving the requeued work pending with the flag down. A later cifs_open() can reuse the handle and its cifs_close() reaches the same branch: queue_delayed_work() fails because the work is still pending, but cifs_close() returns without dropping the closing file's reference. The cifsFileInfo count stays pinned and its tlink, dentry and server handle are leaked.
Check the return value and hand off the reference only when work was actually queued. Otherwise, use the shared _cifsFileInfo_put(), like the mod_delayed_work() branch above: the pending execution already owns its reference.
This issue was found by an in-house static analysis tool.
--- fs/cifs/file.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
fs/cifs/file.c +12 -5
@@ -901,11 +901,18 @@ int cifs_close(struct inode *inode, struct file *file)cifsFileInfo_get (cfile); }else {/* Deferred close for files */ -queue_delayed_work (deferredclose_wq, - &cfile->deferred, cifs_sb->ctx->closetimeo); - cfile->deferred_close_scheduled = true; -spin_unlock (&cinode->deferred_lock); -return 0 ; +/* +* Each queued execution owns one reference. +* If nothing was queued, the reference of +* the closing file is dropped below. +*/ +if (queue_delayed_work (deferredclose_wq, + &cfile->deferred, + cifs_sb->ctx->closetimeo)) { + cfile->deferred_close_scheduled = true; +spin_unlock (&cinode->deferred_lock); +return 0 ; + } }spin_unlock (&cinode->deferred_lock);_cifsFileInfo_put (cfile, true, false);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 97/571 smb: client: avoid leaking refcount when cifs_sb_tlink() fails
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjoern Doebel <[email protected]>
[ Upstream commit 23b26f4408ac3f35a482d2e5cf6fc865d4201b71 ]
cifs_oplock_break() takes over the reference that cifs_queue_oplock_break() acquired when it queued the work, and drops it with _cifsFileInfo_put() once the break has been processed.
Only in setups with "-o multiuser", cifs_sb_tlink() may fail, at which point cifs_oplock_break() returns without putting the file reference, mirroring the reference leak we already fixed in the companion patch to cifs_queue_oplock_break().
This would trigger a crash due to busy inodes on the next unmount:
BUG: Dentry ... still in use (1) [unmount of cifs cifs] VFS: Busy inodes after unmount of cifs (cifs)
Drop the reference on that path as well. Doing so before the out label mirrors the normal path, which also puts the reference before cifs_done_oplock_break().
Found by Sashiko code review. The failure path was not exercised at runtime.
--- fs/cifs/file.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/cifs/file.c +4 -1
@@ -4893,8 +4893,11 @@ void cifs_oplock_break(struct work_struct *work) TASK_UNINTERRUPTIBLE); tlink =cifs_sb_tlink (cifs_sb); -if (IS_ERR (tlink)) +if (IS_ERR (tlink)) { +/* drop the reference taken when the break was queued */ +_cifsFileInfo_put (cfile, false/* do not wait for ourself */ , false); goto out; + } tcon =tlink_tcon (tlink); server = tcon->ses->server;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 98/571 ALSA: virtio: reset device before deleting virtqueues
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuho Choi <[email protected]>
[ Upstream commit 6c05d00af307560e6a9f1631d6270d3df5aa2272 ]
virtsnd_remove() and virtsnd_freeze() delete the virtqueues before resetting the device. del_vqs() frees the vring backing, but does not provide a generic device quiesce operation. In particular, modern virtio-pci keeps enabled queues active until the device is reset.
Reset the device before deleting the virtqueues so it can no longer access the vring memory when that memory is released. This also covers probe failures after DRIVER_OK, which unwind through virtsnd_remove().
--- sound/virtio/virtio_card.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/virtio/virtio_card.c +2 -2
@@ -349,8 +349,8 @@ static void virtsnd_remove(struct virtio_device *vdev)if (snd->card)snd_card_free (snd->card); - vdev->config->del_vqs (vdev); vdev->config->reset (vdev); + vdev->config->del_vqs (vdev);for (i =0 ; snd->substreams && i < snd->nsubstreams; ++i) {struct virtio_pcm_substream *vss = &snd->substreams[i];
@@ -378,8 +378,8 @@ static int virtsnd_freeze(struct virtio_device *vdev)virtsnd_disable_event_vq (snd);virtsnd_ctl_msg_cancel_all (snd); - vdev->config->del_vqs (vdev); vdev->config->reset (vdev); + vdev->config->del_vqs (vdev);for (i =0 ; i < snd->nsubstreams; ++i)cancel_work_sync (&snd->substreams[i].elapsed_period);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 99/571 btrfs: take commit root semaphore when iterating in mark_block_group_to_copy()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongling Zeng <[email protected]>
[ Upstream commit 0594e3423f4ba3137c734371169491f9a98e9af4 ]
mark_block_group_to_copy() iterates over the commit root with skip_locking=true. A concurrent transaction commit can swap and free the commit root during iteration, causing use-after-free when accessing extent buffers.
Fix it by using path->need_commit_sem to protect the commit root search.
--- fs/btrfs/dev-replace.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/dev-replace.c +1 -0
@@ -516,6 +516,7 @@ static int mark_block_group_to_copy(struct btrfs_fs_info *fs_info, path->reada =READA_FORWARD ; path->search_commit_root =1 ; path->skip_locking =1 ; + path->need_commit_sem =1 ; key.objectid = src_dev->devid; key.type =BTRFS_DEV_EXTENT_KEY ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 100/571 watchdog: rtd119x: Use devm_clk_get_enabled() helper
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit 6cc0768ba6f5293a4435612164a2cfbf2edbd025 ]
The devm_clk_get_enabled() helper:
- calls devm_clk_get()
- calls clk_prepare_enable() and registers what is needed in order to call clk_disable_unprepare() when needed, as a managed resource.
This simplifies the code and avoids the need of a dedicated function used with devm_add_action_or_reset().
Stable-dep-of: 5af7d2cbd20f ("watchdog: rtd119x: Avoid division by zero")
--- drivers/watchdog/rtd119x_wdt.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-)
drivers/watchdog/rtd119x_wdt.c +1 -15
@@ -94,16 +94,10 @@ static const struct of_device_id rtd119x_wdt_dt_ids[] = { { } }; -static void rtd119x_clk_disable_unprepare (void *data) -{ -clk_disable_unprepare (data); -} -static int rtd119x_wdt_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;struct rtd119x_watchdog_device *data; -int ret; data =devm_kzalloc (dev,sizeof (*data),GFP_KERNEL );if (!data)
@@ -113,18 +107,10 @@ static int rtd119x_wdt_probe(struct platform_device *pdev)if (IS_ERR (data->base))return PTR_ERR (data->base); - data->clk =devm_clk_get (dev,NULL ); + data->clk =devm_clk_get_enabled (dev,NULL );if (IS_ERR (data->clk))return PTR_ERR (data->clk); - ret =clk_prepare_enable (data->clk); -if (ret) -return ret; - ret =devm_add_action_or_reset (dev, rtd119x_clk_disable_unprepare, - data->clk); -if (ret) -return ret; - data->wdt_dev.info = &rtd119x_wdt_info; data->wdt_dev.ops = &rtd119x_wdt_ops; data->wdt_dev.timeout =120 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 101/571 watchdog: rtd119x: Avoid division by zero
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tzung-Bi Shih <[email protected]>
[ Upstream commit 5af7d2cbd20f893def03c8310a460ade66a5d822 ]
clk_get_rate() could return 0. Avoid a division by zero panic.
--- drivers/watchdog/rtd119x_wdt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/watchdog/rtd119x_wdt.c +6 -1
@@ -98,6 +98,7 @@ static int rtd119x_wdt_probe(struct platform_device *pdev) {struct device *dev = &pdev->dev;struct rtd119x_watchdog_device *data; +unsigned long rate; data =devm_kzalloc (dev,sizeof (*data),GFP_KERNEL );if (!data)
@@ -111,10 +112,14 @@ static int rtd119x_wdt_probe(struct platform_device *pdev)if (IS_ERR (data->clk))return PTR_ERR (data->clk); + rate =clk_get_rate (data->clk); +if (!rate) +return -EINVAL ; + data->wdt_dev.info = &rtd119x_wdt_info; data->wdt_dev.ops = &rtd119x_wdt_ops; data->wdt_dev.timeout =120 ; - data->wdt_dev.max_timeout =0xffffffff /clk_get_rate (data->clk); + data->wdt_dev.max_timeout =0xffffffff / rate; data->wdt_dev.min_timeout =1 ; data->wdt_dev.parent = dev;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 102/571 hwmon: (pwm-fan) Stop RPM timer before freeing tach data
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yibo Tan <[email protected]>
[ Upstream commit 26d5ff79768548efb1e604bb6e8697c101e06269 ]
sample_timer() rearms the RPM timer and accesses the devm-managed ctx->tachs and ctx->pulses_per_revolution arrays. The cleanup action which stops the timer is registered before those arrays are allocated.
Since devres releases entries in reverse order, driver detach can free the arrays before pwm_fan_cleanup() shuts down the timer. A timer expiry in that window accesses the freed tach data.
With a KASAN kernel, a test-only kprobe delayed entry to pwm_fan_cleanup() while normal sysfs unbind ran. Each of three runs reported three four-byte reads and two four-byte writes in sample_timer() after its backing devm allocations had been freed. The helper did not invoke the timer callback, cleanup actions or free functions.
With the fix, three matching unbind runs completed without KASAN, BUG, WARNING, Oops or panic. Instrumentation confirmed that timer retirement completed before the first timer backing allocation was released.
Split timer retirement from the power cleanup and register its devres action after the timer backing data and IRQ actions are installed. This preserves the early power rollback action while ensuring the timer is retired before its backing data is released. Use timer_shutdown_sync() because the callback can rearm itself.
--- drivers/hwmon/pwm-fan.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/hwmon/pwm-fan.c +14 -1
@@ -291,7 +291,13 @@ static void pwm_fan_pwm_disable(void *__ctx) ctx->pwm_state.enabled = false;pwm_apply_state (ctx->pwm, &ctx->pwm_state); -del_timer_sync (&ctx->rpm_timer); +} + +static void pwm_fan_timer_cleanup (void *__ctx) +{ +struct pwm_fan_ctx *ctx = __ctx; + +timer_shutdown_sync (&ctx->rpm_timer); }static int pwm_fan_probe (struct platform_device *pdev)
@@ -424,6 +430,10 @@ static int pwm_fan_probe(struct platform_device *pdev) }if (ctx->tach_count >0 ) { + ret =devm_add_action_or_reset (dev, pwm_fan_timer_cleanup, ctx); +if (ret) +return ret; + ctx->sample_start =ktime_get ();mod_timer (&ctx->rpm_timer, jiffies +HZ );
@@ -490,6 +500,9 @@ static int pwm_fan_disable(struct device *dev)static void pwm_fan_shutdown (struct platform_device *pdev) { +struct pwm_fan_ctx *ctx =platform_get_drvdata (pdev); + +pwm_fan_timer_cleanup (ctx);pwm_fan_disable (&pdev->dev); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 103/571 wifi: wcn36xx: Fix potential use-after-free in TX ack timer teardown
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fan Wu <[email protected]>
[ Upstream commit d9be5e75530772fc31637070d51e5717d6aeaa2a ]
wcn36xx_dxe_deinit() tears down the TX ack timer with timer_delete(), which only dequeues the timer and does not wait for a callback that is already executing; the preceding free_irq() calls synchronize the interrupt handlers only. The callback, wcn36xx_dxe_tx_timer(), can therefore be running past the teardown and use the wcn freed along with the ieee80211_hw in wcn36xx_remove(): it takes wcn->dxe_lock, reads wcn->tx_ack_skb and passes wcn->hw to ieee80211_tx_status_irqsafe().
Fix this by using timer_shutdown_sync(), which waits for a running callback and also prevents the timer from being rearmed again. The timer is set up again by wcn36xx_dxe_init() on the next start, so the start/stop cycle is unaffected.
This issue was found by an in-house static analysis tool.
--- drivers/net/wireless/ath/wcn36xx/dxe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/wcn36xx/dxe.c +1 -1
@@ -1007,7 +1007,7 @@ void wcn36xx_dxe_deinit(struct wcn36xx *wcn)free_irq (wcn->tx_irq, wcn);free_irq (wcn->rx_irq, wcn); -del_timer (&wcn->tx_ack_timer); +timer_shutdown_sync (&wcn->tx_ack_timer);if (wcn->tx_ack_skb) {ieee80211_tx_status_irqsafe (wcn->hw, wcn->tx_ack_skb);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 104/571 smb: client: fix smbd_connection leak on cifs_get_tcp_session() error
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <[email protected]>
[ Upstream commit e75c96157d45e498970158c8f7373d90102e33b9 ]
When an RDMA connection is successfully established via smbd_get_connection() but cifs_get_tcp_session() later fails (e.g. kthread_create() returns an error), the error path frees tcp_ses without first destroying the smbd_connection.
Fix this by calling smbd_destroy() in the out_err cleanup path before kfree(tcp_ses). smbd_destroy() safely handles the case where smbd_conn is NULL, so it can be called unconditionally.
--- fs/cifs/connect.c | 1 + 1 file changed, 1 insertion(+)
fs/cifs/connect.c +1 -0
@@ -1574,6 +1574,7 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx)kfree (tcp_ses->hostname);if (tcp_ses->ssocket)sock_release (tcp_ses->ssocket); +smbd_destroy (tcp_ses);kfree (tcp_ses); }return ERR_PTR (rc);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 105/571 bna: prevent IOC timer rearm during teardown
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myeonghun Pak <[email protected]>
[ Upstream commit 77b1718e39e5c9f6956fb60807326af20baf889d ]
bna: prevent IOC timer rearm during teardown
bnad_pci_remove() and the probe disable_ioceth path call timer_delete_sync() for ioc_timer, sem_timer and hb_timer, but not for iocpf_timer. bnad_iocpf_timeout() then takes bnad->bna_lock after free_netdev() has freed the struct bnad.
Deleting iocpf_timer last does not fix this. sem_timer and iocpf_timer rearm each other: bnad_iocpf_sem_timeout() can arm iocpf_timer, and bnad_iocpf_timeout() arms sem_timer from bfa_ioc_hw_sem_get() when the semaphore is busy. timer_delete_sync() only waits out its own callback. bnad_ioceth_disable() can time out and leave that callback live.
Shut all four IOC timers down with timer_shutdown_sync() on both paths, so a later mod_timer() is ignored.
This issue was identified during our ongoing static-analysis research while reviewing kernel code.
--- drivers/net/ethernet/brocade/bna/bnad.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/net/ethernet/brocade/bna/bnad.c +10 -6
@@ -3745,9 +3745,11 @@ bnad_pci_probe(struct pci_dev *pdev,bnad_res_free (bnad, &bnad->mod_res_info[0 ],BNA_MOD_RES_T_MAX ); disable_ioceth:bnad_ioceth_disable (bnad); -del_timer_sync (&bnad->bna.ioceth.ioc.ioc_timer); -del_timer_sync (&bnad->bna.ioceth.ioc.sem_timer); -del_timer_sync (&bnad->bna.ioceth.ioc.hb_timer); +/* The IOC timers rearm one another. Shut down all of them. */ +timer_shutdown_sync (&bnad->bna.ioceth.ioc.ioc_timer); +timer_shutdown_sync (&bnad->bna.ioceth.ioc.sem_timer); +timer_shutdown_sync (&bnad->bna.ioceth.ioc.hb_timer); +timer_shutdown_sync (&bnad->bna.ioceth.ioc.iocpf_timer);spin_lock_irqsave (&bnad->bna_lock, flags);bna_uninit (bna);spin_unlock_irqrestore (&bnad->bna_lock, flags);
@@ -3788,9 +3790,11 @@ bnad_pci_remove(struct pci_dev *pdev)mutex_lock (&bnad->conf_mutex);bnad_ioceth_disable (bnad); -del_timer_sync (&bnad->bna.ioceth.ioc.ioc_timer); -del_timer_sync (&bnad->bna.ioceth.ioc.sem_timer); -del_timer_sync (&bnad->bna.ioceth.ioc.hb_timer); +/* The IOC timers rearm one another. Shut down all of them. */ +timer_shutdown_sync (&bnad->bna.ioceth.ioc.ioc_timer); +timer_shutdown_sync (&bnad->bna.ioceth.ioc.sem_timer); +timer_shutdown_sync (&bnad->bna.ioceth.ioc.hb_timer); +timer_shutdown_sync (&bnad->bna.ioceth.ioc.iocpf_timer);spin_lock_irqsave (&bnad->bna_lock, flags);bna_uninit (bna);spin_unlock_irqrestore (&bnad->bna_lock, flags);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 106/571 tcp: prevent collapsing skbs across boundary in rtx queue
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Willem de Bruijn <[email protected]>
[ Upstream commit fc6d80eb504458d6416b75a94188b268c95c6533 ]
tcp_write_collapse_fence() sets TCP_SKB_CB(skb)->eor = 1 on tcp_write_queue_tail(sk) to prevent skbs queued after a switch to device encryption from being collapsed into earlier skbs.
The fence is a no-op if all earlier data has already been transmitted when the switch happens: sk->sk_write_queue is empty. The not yet acknowledged earlier skbs wait in sk->tcp_rtx_queue with eor 0.
On a subsequent retransmit or SACK shift, tcp_retrans_try_collapse() or tcp_shift_skb_data() can then merge an skb queued after the switch into one queued before it.
Both users of the fence are affected:
- psp: devices only encrypt skbs with skb->decrypted set. The merged skb keeps decrypted = 0 from the earlier skb, so merged data sent after psp_sock_assoc_set_tx() is retransmitted in cleartext.
- tls device offload: the merged skb straddles the start marker set in tls_set_device_offload(). The software fallback (fill_sg_in() returns -EINVAL) and the mlx5, nfp and funeth drivers cannot handle such an skb and drop it. Every retransmit rebuilds the same skb, so the connection stalls.
Fix this in two places, for defense in depth:
1. Fall back to tcp_rtx_queue_tail(sk) in tcp_write_collapse_fence() when tcp_write_queue_tail(sk) is NULL.
2. Check !skb_cmp_decrypted(to, from) in tcp_skb_can_collapse(), as tcp_skb_can_collapse_rx() does on receive. skb_shift(), which both collapse paths call, already has a DEBUG_NET_WARN_ON_ONCE() for this condition.
--- include/net/tcp.h | 4 ++++ net/tls/tls_device.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-)
include/net/tcp.h +4 -0
@@ -974,6 +974,10 @@ static inline bool tcp_skb_can_collapse_to(const struct sk_buff *skb)static inline bool tcp_skb_can_collapse (const struct sk_buff *to,const struct sk_buff *from) { +#ifdef CONFIG_TLS_DEVICE +if (from->decrypted != to->decrypted) +return false; +#endif return likely (tcp_skb_can_collapse_to (to) &&mptcp_skb_can_collapse (to, from)); }
net/tls/tls_device.c +2 -2
@@ -224,7 +224,7 @@ static void tls_device_resync_tx(struct sock *sk, struct tls_context *tls_ctx,int err =0 ;u8 *rcd_sn; - skb =tcp_write_queue_tail (sk); + skb =tcp_write_queue_tail (sk) ?:tcp_rtx_queue_tail (sk);if (skb)TCP_SKB_CB (skb)->eor =1 ;
@@ -1108,7 +1108,7 @@ int tls_set_device_offload(struct sock *sk, struct tls_context *ctx)* SKBs where only part of the payload needs to be encrypted. * So mark the last skb in the write queue as end of record. */ - skb =tcp_write_queue_tail (sk); + skb =tcp_write_queue_tail (sk) ?:tcp_rtx_queue_tail (sk);if (skb)TCP_SKB_CB (skb)->eor =1 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 107/571 drm/amdgpu: Fix runtime PM leak in amdgpu_debugfs_test_ib_show()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
[ Upstream commit 2b86ab1bd6673c525adda88819d7658ba9e784ec ]
amdgpu_debugfs_test_ib_show() resumes the device with pm_runtime_get_sync() before taking the reset domain semaphore with down_write_killable(). If the write lock acquisition is interrupted, the function returns without calling pm_runtime_put_autosuspend(), leaking the runtime PM reference acquired for the device and keeping the GPU awake.
Drop the runtime PM reference on the interrupted down_write_killable() error path before returning.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -1
@@ -1140,8 +1140,10 @@ static int amdgpu_debugfs_test_ib_show(struct seq_file *m, void *unused)/* Avoid accidently unparking the sched thread during GPU reset */ r =down_read_killable (&adev->reset_sem); -if (r) +if (r) { +pm_runtime_put_autosuspend (dev->dev);return r; + }/* hold on the scheduler */ for (i =0 ; i <AMDGPU_MAX_RINGS ; i++) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 108/571 perf/x86/intel: Remove anythread_deprecated bit from perf_capabilities
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dapeng Mi <[email protected]>
[ Upstream commit 8767b4d73018bd3143f4c55b672064fad292f11b ]
AnyThread mode deprecation is enumerated by CPUID.0AH:EDX[15] instead of PERF_CAPABILITIES MSR. It's not a good practice to define a bit to represent "anythread deprecation" in perf_capabilities. It leads to the anythread_deprecated bit could be overwritten by the real value of PERF_CAPABILITIES MSR, just like the below code in update_pmu_cap() does.
if (!intel_pmu_broken_perf_cap()) {
/* Perf Metric (Bit 15) and PEBS via PT (Bit 16) are hybrid enumeration */
rdmsrq(MSR_IA32_PERF_CAPABILITIES, hybrid(pmu, intel_cap).capabilities);
}It leads to the anythread_deprecated bit is cleared to 0 and the "any" attribute is incorrectly shown in the /sys/devices/cpu/format/ folder on these support Perfmon v6 platforms, like Clearwater Forest.
$ grep . /sys/devices/cpu/format/* /sys/devices/cpu/format/acr_mask:config2:0-63 /sys/devices/cpu/format/any:config:21 /sys/devices/cpu/format/cmask:config:24-31
So remove the anythread_deprecated bit from perf_capabilities structure and directly depends on CPUID.0AH:EDX[15] to judge if anythread is deprecated.
--- arch/x86/events/intel/core.c | 10 +++------- arch/x86/events/perf_event.h | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-)
arch/x86/events/intel/core.c +3 -7
@@ -5620,12 +5620,6 @@ __init int intel_pmu_init(void)x86_add_quirk (intel_arch_events_quirk);/* Install first, so it runs last */ -if (version >=5 ) { - x86_pmu.intel_cap.anythread_deprecated = edx.split.anythread_deprecated; -if (x86_pmu.intel_cap.anythread_deprecated) -pr_cont (" AnyThread deprecated, " ); - } -/* * Install the hw-cache-events table: */
@@ -6306,8 +6300,10 @@ __init int intel_pmu_init(void) (u64)fixed_mask);/* AnyThread may be deprecated on arch perfmon v5 or later */ -if (x86_pmu.intel_cap.anythread_deprecated) +if (version >=5 && edx.split.anythread_deprecated) { x86_pmu.format_attrs = intel_arch_formats_attr; +pr_cont ("AnyThread deprecated, " ); + } intel_pmu_check_event_constraints(x86_pmu.event_constraints, x86_pmu.num_counters,
arch/x86/events/perf_event.h +1 -1
@@ -593,7 +593,7 @@ union perf_capabilities { u64 pebs_baseline:1; u64 perf_metrics:1; u64 pebs_output_pt_available:1; - u64 anythread_deprecated:1; + u64 __reserved:1; };u64 capabilities; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 109/571 mm/rmap: fix missing barrier between anon_vma init and vma->anon_vma publish
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjiang Tu <[email protected]>
[ Upstream commit b6ac0b3f6013c168f22cad97e79967accacb08e1 ]
On arm64 server, we find that a task trying to grab the anon_vma lock triggers hungtask.
INFO: task main:2354726 blocked for more than 120 seconds.
Tainted: G E 5.10.0-0021.aarch64 #1
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:main state:D stack: 0 pid:2354726 ppid:2350673 flags:0x00000a01
Call trace:
__switch_to+0x7c/0xbc
__schedule+0x3b4/0x8a0
schedule+0x50/0xe0
rwsem_down_write_slowpath+0x3cc/0x6cc
down_write+0x60/0x260
__anon_vma_prepare+0x6c/0x210
do_anonymous_page+0x258/0x660
handle_pte_fault+0x188/0x214
__handle_mm_fault+0x1b0/0x380
handle_mm_fault+0xf4/0x284
do_page_fault+0x19c/0x494
do_translation_fault+0xcc/0xf8
do_mem_abort+0x48/0xac
el0_da+0x44/0x80
el0_sync_handler+0x88/0xb4
el0_sync+0x160/0x180After analyzing the vmcore, we found the anon_vma->root->rwsem.count is -1. There is another anon_vma whose anon_vma->root->rwsem.count is 1, the anon_vma->root->rwsem.owner shows the lock is held, but the stack of the task shows the task doesn't hold the anon_vma lock.
After adding more debugging info, we found __anon_vma_prepare() reuses anon_vma and triggers the UAF of anon_vma->root due to missing memory barrier, leading to locking and unlocking two different anon_vma->root, thus leading to an anon_vma will never be unlocked, and another anon_vma couldn't be locked anymore.
This race requires two adjacent VMAs that are not merged but are anon_vma-compatible (e.g., they differ in VMA_ACCESS_FLAGS that can be changed by mprotect()). Two threads fault on each VMA concurrently, both calling __anon_vma_prepare() with only mmap_lock held for reading.
THREAD A THREAD B__anon_vma_prepare __anon_vma_prepare
find_mergeable_anon_vma() -> NULL
anon_vma = anon_vma_alloc();
anon_vma->root = anon_vma;
// the two stores may be reordered
vma->anon_vma = anon_vma;
// finds A's anon_vma
anon_vma = find_mergeable_anon_vma(vma);
anon_vma_lock_write(anon_vma);
// may still see the old root
down_write(&anon_vma->root->rwsem);
anon_vma_unlock_write(anon_vma);
// see the new root, never unlock old
up_write(&anon_vma->root->rwsem);thread A triggers page fault and calls __anon_vma_prepare() to prepare anon_vma for the faulting vma. __anon_vma_prepare() allocates and initializes a new anon_vma, and then publishes it to the vma with a plain store. anon_vma_prepare() only requires the mmap_lock to be held for reading, so two threads can fault on adjacent VMAs at the same time. While thread A publishes a new anon_vma, thread B could find the anon_vma via find_mergeable_anon_vma() and then locks anon_vma->root->rwsem.
The store to anon_vma->root in anon_vma_alloc() and the store to vma->anon_vma can be reordered. The anon_vma_lock_write() and spin_lock() only provide acquire semantics, which do not prevent prior stores from being reordered after them. The release semantics of the corresponding spin_unlock() and anon_vma_unlock_write() come too late, the store to vma->anon_vma is already published before they take effect. As a result, thread B can observe the following order:
vma->anon_vma = anon_vma;
anon_vma->root = anon_vma;The anon_vma slab is SLAB_TYPESAFE_BY_RCU, so a newly allocated anon_vma may reuse memory from a previously freed one. The constructor (anon_vma_ctor) does not reset anon_vma->root, and __put_anon_vma() doesn't clear it either, so the old root value persists until anon_vma_alloc() overwrites it. If that store isn't visible, thread B reads a root that points to the old anon_vma and locks it.
As a result, thread B can call anon_vma_lock_write() with the old root, and call anon_vma_unlock_write() with the new root, leading to an anon_vma will never be unlocked, and another anon_vma couldn't be locked anymore (its count is dropped from 0 to -1 due to wrong unlock).
To fix it, change the plain store vma->anon_vma = anon_vma to store release, so that the fields of anon_vma are visible before anon_vma is published to vma->anon_vma.
At read side, the load of anon_vma and anon_vma->root have address dependency. According to Documentation/memory-barriers.txt and some investigations, only Alpha needs address-dependency barriers and it has been handled by READ_ONCE() in reusable_anon_vma().
We reproduced this issue in v5.10 with KSM enabled. The kernel doesn't merge commit cf7e7a3503df ("mm: prevent KSM from breaking VMA merging for new VMAs"), so there are many adjacent VMAs that aren't merged but are compatible for anon_vma.
Without this fix, our production environment could reproduce this issue about 2-5 times each month. After adding a smp_mb() before anon_vma_lock_write(anon_vma) in __anon_vma_prepare(), which is different to this patch, this issue hasn't been reproduced for one month.
--- mm/mmap.c | 8 ++++++++ mm/rmap.c | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-)
mm/mmap.c +8 -0
@@ -1288,6 +1288,13 @@ static int anon_vma_compatible(struct vm_area_struct *a, struct vm_area_struct ** acceptable for merging, so we can do all of this optimistically. But * we do that READ_ONCE() to make sure that we never re-load the pointer. * +* The READ_ONCE() establishes an address dependency between anon_vma and +* any access to its fields, which pairs with the assignment to +* vma->anon_vma performed with release semantics in __anon_vma_prepare(). +* +* This is especially important as anon_vma's are SLAB_TYPESAFE_BY_RCU so +* accessing an uninitialised anon_vma's fields may result in a UAF. +* * IOW: that the "list_is_singular()" test on the anon_vma_chain only * matters for the 'stable anon_vma' case (ie the thing we want to avoid * is to return an anon_vma that is "complex" due to having gone through
@@ -1300,6 +1307,7 @@ static int anon_vma_compatible(struct vm_area_struct *a, struct vm_area_struct *static struct anon_vma *reusable_anon_vma (struct vm_area_struct *old,struct vm_area_struct *a,struct vm_area_struct *b) {if (anon_vma_compatible (a, b)) { +/* Paired with a memory barrier in __anon_vma_prepare(). */ struct anon_vma *anon_vma =READ_ONCE (old->anon_vma);if (anon_vma &&list_is_singular (&old->anon_vma_chain))
mm/rmap.c +5 -1
@@ -207,7 +207,11 @@ int __anon_vma_prepare(struct vm_area_struct *vma)/* page_table_lock to protect against threads */ spin_lock (&mm->page_table_lock);if (likely (!vma->anon_vma)) { - vma->anon_vma = anon_vma; +/* +* Make anon_vma fields visible before anon_vma is published. +* Paired with an address dependency in reusable_anon_vma(). +*/ +smp_store_release (&vma->anon_vma, anon_vma);anon_vma_chain_link (vma, avc, anon_vma); anon_vma->num_active_vmas++; allocated =NULL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 110/571 net: openvswitch: conntrack: fix helper UAF due to extensions realloc
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Maximets <[email protected]>
[ Upstream commit 1a4151e6be57b098b7a5ebfbde58585e83200cdc ]
While calling the helpers, a raw pointer to the extensions area is wired into expectations list:
-> nf_ct_helper()
-> helper->help()
-> nf_ct_expect_related_report()
-> nf_ct_expect_insert()
-> hlist_add_head_rcu(&exp->lnode, &master_help->expectations)In case the connection is not confirmed yet, more extensions can be added afterwards with *_ext_add() calls reallocating the extension space and leaving the now invalid pointer in the expectations list that is later accessed while removing the expectation.
Make sure that helpers are called at the end after all the other extensions are already added.
Note that the helper rejection now leaves the mark and labels set, but that's not different from how the NAT was handled before or how the mark and the labels were handled on confirmation failure. And there are no atomicity guarantees provided by the API anyway.
--- net/openvswitch/conntrack.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
net/openvswitch/conntrack.c +13 -7
@@ -1051,14 +1051,14 @@ static int __ovs_ct_lookup(struct net *net, struct sw_flow_key *key, } } -/* Call the helper only if: -* - nf_conntrack_in() was executed above ("!cached") or a -* helper was just attached ("add_helper") for a confirmed -* connection, or -* - When committing an unconfirmed connection. +/* Call the helper only if nf_conntrack_in() was executed +* above ("!cached") or a helper was just attached ("add_helper"). +* +* For unconfirmed connections it will be called later during +* commit as we need to have all the other extensions allocated +* before the call. */ -if ((nf_ct_is_confirmed (ct) ? !cached || add_helper : - info->commit) && +if (nf_ct_is_confirmed (ct) && (!cached || add_helper) &&ovs_ct_helper (skb, info->family) !=NF_ACCEPT ) {return -EINVAL ; }
@@ -1274,6 +1274,12 @@ static int ovs_ct_commit(struct net *net, struct sw_flow_key *key, &info->labels.mask);if (err)return err; + +/* Call the helpers now. We couldn't do this before as +* all the extensions must be allocated before the call. +*/ +if (ovs_ct_helper (skb, info->family) !=NF_ACCEPT ) +return -EINVAL ; }else if (IS_ENABLED (CONFIG_NF_CONNTRACK_LABELS ) &&labels_nonzero (&info->labels.mask)) { err = ovs_ct_set_labels(ct, key, &info->labels.value,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 111/571 smb3: make query_on_disk_id open context consistent and move to common code
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
[ Upstream commit 1149c8467ddebfb6bb9aab37830f70a49cab7085 ]
cifs and ksmbd were using a slightly different version of the query_on_disk_id struct which could be confusing. Use the ksmbd version of this struct, and move it to common code.
[5.15 dependency adaptation for 67f4c1c6a1b:
Keep the create-context declarations in the existing per-subsystem headers. This tree has not consolidated create_context into smbfs_common, and ksmbd still defines its own SMB2 headers. Moving the response into the common header would require unrelated header conversions.
Retain the client response rename and match ksmbd's 16-byte Reserved array, without changing the packed wire layout. Leave the ksmbd and common headers unchanged and omit the upstream common-header lease comments.
Rename the client's lease-break flag and both existing parser uses to the upstream _LE spelling. This is a value-preserving prerequisite for the target's lease-parser changes; no functions are added.]
[ sashal: Reduced backport -- upstream 1149c8467ddeb touches 4 file(s), this
backport carries 3. Not backported here:
fs/ksmbd/smb2pdu.h
fs/smbfs_common/smb2pdu.h
This note is generated from the file lists only; see the resolution record for the reasoning. ]
Stable-dep-of: 67f4c1c6a1b5 ("smb: client: fix create context out-of-bounds reads")
--- fs/cifs/smb2ops.c | 4 ++-- fs/cifs/smb2pdu.c | 2 +- fs/cifs/smb2pdu.h | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-)
fs/cifs/smb2ops.c +2 -2
@@ -4419,7 +4419,7 @@ smb2_parse_lease_buf(void *buf, unsigned int *epoch, char *lease_key)struct create_lease *lc = (struct create_lease *)buf; *epoch =0 ;/* not used */ -if (lc->lcontext.LeaseFlags &SMB2_LEASE_FLAG_BREAK_IN_PROGRESS ) +if (lc->lcontext.LeaseFlags &SMB2_LEASE_FLAG_BREAK_IN_PROGRESS_LE )return SMB2_OPLOCK_LEVEL_NOCHANGE ;return le32_to_cpu (lc->lcontext.LeaseState); }
@@ -4430,7 +4430,7 @@ smb3_parse_lease_buf(void *buf, unsigned int *epoch, char *lease_key)struct create_lease_v2 *lc = (struct create_lease_v2 *)buf; *epoch =le16_to_cpu (lc->lcontext.Epoch); -if (lc->lcontext.LeaseFlags &SMB2_LEASE_FLAG_BREAK_IN_PROGRESS ) +if (lc->lcontext.LeaseFlags &SMB2_LEASE_FLAG_BREAK_IN_PROGRESS_LE )return SMB2_OPLOCK_LEVEL_NOCHANGE ;if (lease_key)memcpy (lease_key, &lc->lcontext.LeaseKey,SMB2_LEASE_KEY_SIZE );
fs/cifs/smb2pdu.c +1 -1
@@ -2019,7 +2019,7 @@ create_reconnect_durable_buf(struct cifs_fid *fid)static void parse_query_id_ctxt (struct create_context *cc,struct smb2_file_all_info *buf) { -struct create_on_disk_id *pdisk_id = (struct create_on_disk_id *)cc; +struct create_disk_id_rsp *pdisk_id = (struct create_disk_id_rsp *)cc;cifs_dbg (FYI ,"parse query id context 0x%llx 0x%llx\n" , pdisk_id->DiskFileId, pdisk_id->VolumeId);
fs/cifs/smb2pdu.h +3 -3
@@ -571,7 +571,7 @@ struct create_context {#define SMB2_LEASE_HANDLE_CACHING cpu_to_le32(0x02)#define SMB2_LEASE_WRITE_CACHING cpu_to_le32(0x04) -#define SMB2_LEASE_FLAG_BREAK_IN_PROGRESS cpu_to_le32(0x00000002) +#define SMB2_LEASE_FLAG_BREAK_IN_PROGRESS_LE cpu_to_le32(0x00000002)#define SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET cpu_to_le32(0x00000004)#define SMB2_LEASE_KEY_SIZE 16
@@ -653,12 +653,12 @@ struct durable_reconnect_context_v2 { } __packed;/* See MS-SMB2 2.2.14.2.9 */ -struct create_on_disk_id { +struct create_disk_id_rsp {struct create_context ccontext;__u8 Name[8 ];__le64 DiskFileId;__le64 VolumeId; -__u32 Reserved[4 ]; +__u8 Reserved[16 ]; } __packed;/* See MS-SMB2 2.2.14.2.12 */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 112/571 smb: client: fix create context out-of-bounds reads
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zihan Xi <[email protected]>
[ Upstream commit 67f4c1c6a1b51e203d986779299824d1c2c590a6 ]
smb2_parse_contexts() validates the complete create-context area but does not limit each record to its Next field before dispatching it. A malformed chain can therefore expose bytes beyond the current context to a handler. The QFid handler also used a full response-structure cast although it only reads DiskFileId.
The SMB2/SMB3 lease parsers made the same layout assumption: they read LeaseState and LeaseFlags at canonical offsets rather than at DataOffset. A valid non-canonical DataOffset could therefore yield unrelated in-bounds data, while a short DataLength was still accepted.
Limit each context to its Next value, reject offsets before the context header, and reject malformed chains. Bound the name range by the current context and do not dispatch a known handler when DataLength is zero. Read the QFid DiskFileId only when the context data covers that field. Parse the lease context from DataOffset and require DataLength to match the v1 or v2 lease_context size used by ksmbd. A size mismatch skips lease parsing without failing the open.
--- fs/cifs/smb2ops.c | 28 ++++++++++++++++++++-------- fs/cifs/smb2pdu.c | 44 ++++++++++++++++++++++++++++++++++---------- 2 files changed, 54 insertions(+), 18 deletions(-)
fs/cifs/smb2ops.c +20 -8
@@ -4416,25 +4416,37 @@ smb3_create_lease_buf(u8 *lease_key, u8 oplock)static __u8 smb2_parse_lease_buf (void *buf,unsigned int *epoch,char *lease_key) { -struct create_lease *lc = (struct create_lease *)buf; +struct create_context *cc = buf; +struct lease_context lc; *epoch =0 ;/* not used */ -if (lc->lcontext.LeaseFlags &SMB2_LEASE_FLAG_BREAK_IN_PROGRESS_LE ) +if (le32_to_cpu (cc->DataLength) !=sizeof (lc)) +return 0 ; + +memcpy (&lc, (u8 *)cc +le16_to_cpu (cc->DataOffset),sizeof (lc)); +if (lc.LeaseFlags &SMB2_LEASE_FLAG_BREAK_IN_PROGRESS_LE )return SMB2_OPLOCK_LEVEL_NOCHANGE ; -return le32_to_cpu (lc->lcontext.LeaseState); +return le32_to_cpu (lc.LeaseState); }static __u8 smb3_parse_lease_buf (void *buf,unsigned int *epoch,char *lease_key) { -struct create_lease_v2 *lc = (struct create_lease_v2 *)buf; +struct create_context *cc = buf; +struct lease_context_v2 lc; + +if (le32_to_cpu (cc->DataLength) !=sizeof (lc)) { + *epoch =0 ; +return 0 ; + } - *epoch =le16_to_cpu (lc->lcontext.Epoch); -if (lc->lcontext.LeaseFlags &SMB2_LEASE_FLAG_BREAK_IN_PROGRESS_LE ) +memcpy (&lc, (u8 *)cc +le16_to_cpu (cc->DataOffset),sizeof (lc)); + *epoch =le16_to_cpu (lc.Epoch); +if (lc.LeaseFlags &SMB2_LEASE_FLAG_BREAK_IN_PROGRESS_LE )return SMB2_OPLOCK_LEVEL_NOCHANGE ;if (lease_key) -memcpy (lease_key, &lc->lcontext.LeaseKey,SMB2_LEASE_KEY_SIZE ); -return le32_to_cpu (lc->lcontext.LeaseState); +memcpy (lease_key, lc.LeaseKey,SMB2_LEASE_KEY_SIZE ); +return le32_to_cpu (lc.LeaseState); } static unsigned int
fs/cifs/smb2pdu.c +34 -10
93 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 113/571 net: ipconfig: Remove outdated comment and indent code block
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thorsten Blum <[email protected]>
[ Upstream commit e405b3c9d4aaa10972525fe2ea5cf94224020561 ]
The comment has been around ever since commit 1da177e4c3f4 ("Linux-2.6.12-rc2") and can be removed. Remove it and indent the code block accordingly.
Stable-dep-of: e47a1958e12a ("net: ipconfig: bound DHCP option construction")
--- net/ipv4/ipconfig.c | 89 +++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 47 deletions(-)
net/ipv4/ipconfig.c +42 -47
@@ -668,8 +668,18 @@ static const u8 ic_bootp_cookie[4] = { 99, 130, 83, 99 };static void __init ic_dhcp_init_options (u8 *options,struct ic_device *d) { -u8 mt = ((ic_servaddr ==NONE ) - ?DHCPDISCOVER :DHCPREQUEST ); +static const u8 ic_req_params[] = { +1 ,/* Subnet mask */ +3 ,/* Default gateway */ +6 ,/* DNS server */ +12 ,/* Host name */ +15 ,/* Domain name */ +17 ,/* Boot path */ +26 ,/* MTU */ +40 ,/* NIS domain name */ +42 ,/* NTP servers */ + }; +u8 mt = (ic_servaddr ==NONE ) ?DHCPDISCOVER :DHCPREQUEST ;u8 *e = options;int len;
@@ -694,51 +704,36 @@ ic_dhcp_init_options(u8 *options, struct ic_device *d) e +=4 ; } -/* always? */ - { -static const u8 ic_req_params[] = { -1 ,/* Subnet mask */ -3 ,/* Default gateway */ -6 ,/* DNS server */ -12 ,/* Host name */ -15 ,/* Domain name */ -17 ,/* Boot path */ -26 ,/* MTU */ -40 ,/* NIS domain name */ -42 ,/* NTP servers */ - }; - - *e++ =55 ;/* Parameter request list */ - *e++ =sizeof (ic_req_params); -memcpy (e, ic_req_params,sizeof (ic_req_params)); - e +=sizeof (ic_req_params); - -if (ic_host_name_set) { - *e++ =12 ;/* host-name */ - len =strlen (utsname ()->nodename); - *e++ = len; -memcpy (e,utsname ()->nodename, len); - e += len; - } -if (*vendor_class_identifier) { -pr_info ("DHCP: sending class identifier \"%s\"\n" , - vendor_class_identifier); - *e++ =60 ;/* Class-identifier */ - len =strlen (vendor_class_identifier); - *e++ = len; -memcpy (e, vendor_class_identifier, len); - e += len; - } - len =strlen (dhcp_client_identifier +1 ); -/* the minimum length of identifier is 2, include 1 byte type, -* and can not be larger than the length of options -*/ -if (len >=1 && len <312 - (e - options) -1 ) { - *e++ =61 ; - *e++ = len +1 ; -memcpy (e, dhcp_client_identifier, len +1 ); - e += len +1 ; - } + *e++ =55 ;/* Parameter request list */ + *e++ =sizeof (ic_req_params); +memcpy (e, ic_req_params,sizeof (ic_req_params)); + e +=sizeof (ic_req_params); + +if (ic_host_name_set) { + *e++ =12 ;/* host-name */ + len =strlen (utsname ()->nodename); + *e++ = len; +memcpy (e,utsname ()->nodename, len); + e += len; + } +if (*vendor_class_identifier) { +pr_info ("DHCP: sending class identifier \"%s\"\n" , + vendor_class_identifier); + *e++ =60 ;/* Class-identifier */ + len =strlen (vendor_class_identifier); + *e++ = len; +memcpy (e, vendor_class_identifier, len); + e += len; + } + len =strlen (dhcp_client_identifier +1 ); +/* the minimum length of identifier is 2, include 1 byte type, +* and can not be larger than the length of options +*/ +if (len >=1 && len <312 - (e - options) -1 ) { + *e++ =61 ; + *e++ = len +1 ; +memcpy (e, dhcp_client_identifier, len +1 ); + e += len +1 ; } *e++ =255 ;/* End of the list */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 114/571 net: ipconfig: bound DHCP option construction
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuqi Xu <[email protected]>
[ Upstream commit e47a1958e12abc3a17b5231a4f21c8f1bf662e08 ]
ic_dhcp_init_options() appends the hostname (option 12), vendor-class (option 60) and client-ID (option 61) options into the fixed 312-byte bootp_pkt.exten[] buffer. Only the client-ID branch checked the remaining space; the hostname and vendor-class writes were unbounded.
A 64-byte hostname together with the maximum 252-byte dhcpclass= identifier needs 18 + (2 + 64) + (2 + 252) = 338 of the 312 available bytes even before the terminating END marker, so the vendor-class memcpy runs past the end of exten[]. With CONFIG_FORTIFY_SOURCE this is reported as a field-spanning write and, when the kernel is booted with panic_on_warn=1, aborts boot with a panic.
Route the optional options through a common helper that makes sure the option, its 2-byte header and the END marker all fit and drops an option that would not. Configurations with short options keep sending exactly the same bytes as before.
--- net/ipv4/ipconfig.c | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-)
net/ipv4/ipconfig.c +26 -19
@@ -665,6 +665,24 @@ static const u8 ic_bootp_cookie[4] = { 99, 130, 83, 99 };#ifdef IPCONFIG_DHCP +static bool __init +ic_dhcp_add_option (u8 **options,const u8 *end,u8 type,const void *value, +int len) +{ +u8 *e = *options; + +/* leave room for the option header and the END marker */ +if (len >U8_MAX || end - e < len +3 ) +return false; + + *e++ = type; + *e++ = len; +memcpy (e, value, len); + *options = e + len; + +return true; +} +static void __init ic_dhcp_init_options (u8 *options,struct ic_device *d) {
@@ -680,6 +698,7 @@ ic_dhcp_init_options(u8 *options, struct ic_device *d) 42, /* NTP servers */ };u8 mt = (ic_servaddr ==NONE ) ?DHCPDISCOVER :DHCPREQUEST ; +u8 *end = options +sizeof (((struct bootp_pkt *)0 )->exten);u8 *e = options;int len;
@@ -710,31 +729,19 @@ ic_dhcp_init_options(u8 *options, struct ic_device *d) e +=sizeof (ic_req_params);if (ic_host_name_set) { - *e++ =12 ;/* host-name */ len =strlen (utsname ()->nodename); - *e++ = len; -memcpy (e,utsname ()->nodename, len); - e += len; +ic_dhcp_add_option (&e, end,12 ,utsname ()->nodename, len); }if (*vendor_class_identifier) { -pr_info ("DHCP: sending class identifier \"%s\"\n" , - vendor_class_identifier); - *e++ =60 ;/* Class-identifier */ len =strlen (vendor_class_identifier); - *e++ = len; -memcpy (e, vendor_class_identifier, len); - e += len; +if (ic_dhcp_add_option (&e, end,60 , vendor_class_identifier, len)) +pr_info ("DHCP: sending class identifier \"%s\"\n" , + vendor_class_identifier); } len =strlen (dhcp_client_identifier +1 ); -/* the minimum length of identifier is 2, include 1 byte type, -* and can not be larger than the length of options -*/ -if (len >=1 && len <312 - (e - options) -1 ) { - *e++ =61 ; - *e++ = len +1 ; -memcpy (e, dhcp_client_identifier, len +1 ); - e += len +1 ; - } +/* the minimum length of identifier is 2, include 1 byte type */ +if (len >=1 ) +ic_dhcp_add_option (&e, end,61 , dhcp_client_identifier, len +1 ); *e++ =255 ;/* End of the list */ }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 115/571 pinctrl: sunxi: Refactor register/offset calculation
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Samuel Holland <[email protected]>
[ Upstream commit 0bb95ae2672f9e00f471598a515bf4e9c2005046 ]
Starting with the D1/D1s/T113 SoC, Allwinner changed the layout of the pinctrl registers. This new layout widens the drive level field, which affects the pull register offset and the overall bank size.
As a first step to support this, combine the register and offset calculation functions, and refactor the math to depend on one constant for field widths instead of three. This minimizes the code size impact of making some of the factors dynamic.
While rewriting these functions, move them to the implementation file, since that is the only file where they are used. And make the comment more generic, without mentioning specific offsets/sizes.
The callers are updated to expect a shifted mask, and to use consistent terminology (reg/shift/mask/val).
Stable-dep-of: a13f7f5d14af ("pinctrl: sunxi: keep a shadow copy of the data register output latches")
--- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 119 ++++++++++++++++++-------- drivers/pinctrl/sunxi/pinctrl-sunxi.h | 93 +------------------- 2 files changed, 89 insertions(+), 123 deletions(-)
drivers/pinctrl/sunxi/pinctrl-sunxi.c +85 -34
@@ -46,6 +46,63 @@ static struct lock_class_key sunxi_pinctrl_irq_request_class;static struct irq_chip sunxi_pinctrl_edge_irq_chip;static struct irq_chip sunxi_pinctrl_level_irq_chip; +/* +* The sunXi PIO registers are organized as a series of banks, with registers +* for each bank in the following order: +* - Mux config +* - Data value +* - Drive level +* - Pull direction +* +* Multiple consecutive registers are used for fields wider than one bit. +* +* The following functions calculate the register and the bit offset to access. +* They take a pin number which is relative to the start of the current device. +*/ +static void sunxi_mux_reg (u32 pin,u32 *reg,u32 *shift,u32 *mask) +{ +u32 bank = pin /PINS_PER_BANK ; +u32 offset = pin %PINS_PER_BANK *MUX_FIELD_WIDTH ; + + *reg = bank *BANK_MEM_SIZE +MUX_REGS_OFFSET + + offset /BITS_PER_TYPE (u32) *sizeof (u32); + *shift = offset %BITS_PER_TYPE (u32); + *mask = (BIT (MUX_FIELD_WIDTH ) -1 ) << *shift; +} + +static void sunxi_data_reg (u32 pin,u32 *reg,u32 *shift,u32 *mask) +{ +u32 bank = pin /PINS_PER_BANK ; +u32 offset = pin %PINS_PER_BANK *DATA_FIELD_WIDTH ; + + *reg = bank *BANK_MEM_SIZE +DATA_REGS_OFFSET + + offset /BITS_PER_TYPE (u32) *sizeof (u32); + *shift = offset %BITS_PER_TYPE (u32); + *mask = (BIT (DATA_FIELD_WIDTH ) -1 ) << *shift; +} + +static void sunxi_dlevel_reg (u32 pin,u32 *reg,u32 *shift,u32 *mask) +{ +u32 bank = pin /PINS_PER_BANK ; +u32 offset = pin %PINS_PER_BANK *DLEVEL_FIELD_WIDTH ; + + *reg = bank *BANK_MEM_SIZE +DLEVEL_REGS_OFFSET + + offset /BITS_PER_TYPE (u32) *sizeof (u32); + *shift = offset %BITS_PER_TYPE (u32); + *mask = (BIT (DLEVEL_FIELD_WIDTH ) -1 ) << *shift; +} + +static void sunxi_pull_reg (u32 pin,u32 *reg,u32 *shift,u32 *mask) +{ +u32 bank = pin /PINS_PER_BANK ; +u32 offset = pin %PINS_PER_BANK *PULL_FIELD_WIDTH ; + + *reg = bank *BANK_MEM_SIZE +PULL_REGS_OFFSET + + offset /BITS_PER_TYPE (u32) *sizeof (u32); + *shift = offset %BITS_PER_TYPE (u32); + *mask = (BIT (PULL_FIELD_WIDTH ) -1 ) << *shift; +} +static struct sunxi_pinctrl_group *sunxi_pinctrl_find_group_by_name (struct sunxi_pinctrl *pctl,const char *group) {
@@ -457,21 +514,17 @@ static const struct pinctrl_ops sunxi_pctrl_ops = { };static int sunxi_pconf_reg (unsigned pin,enum pin_config_param param, -u32 *offset,u32 *shift,u32 *mask) +u32 *reg,u32 *shift,u32 *mask) {switch (param) {case PIN_CONFIG_DRIVE_STRENGTH : - *offset =sunxi_dlevel_reg (pin); - *shift =sunxi_dlevel_offset (pin); - *mask =DLEVEL_PINS_MASK ; +sunxi_dlevel_reg (pin, reg, shift, mask);break ;case PIN_CONFIG_BIAS_PULL_UP :case PIN_CONFIG_BIAS_PULL_DOWN :case PIN_CONFIG_BIAS_DISABLE : - *offset =sunxi_pull_reg (pin); - *shift =sunxi_pull_offset (pin); - *mask =PULL_PINS_MASK ; +sunxi_pull_reg (pin, reg, shift, mask);break ;default :
@@ -486,17 +539,17 @@ static int sunxi_pconf_get(struct pinctrl_dev *pctldev, unsigned pin, {struct sunxi_pinctrl *pctl =pinctrl_dev_get_drvdata (pctldev);enum pin_config_param param =pinconf_to_config_param (*config); -u32 offset, shift, mask, val; +u32 reg, shift, mask, val;u16 arg;int ret; pin -= pctl->desc->pin_base; - ret =sunxi_pconf_reg (pin, param, &offset, &shift, &mask); + ret =sunxi_pconf_reg (pin, param, ®, &shift, &mask);if (ret <0 )return ret; - val = (readl (pctl->membase + offset) >> shift) & mask; + val = (readl (pctl->membase + reg) & mask) >> shift;switch (pinconf_to_config_param (*config)) {case PIN_CONFIG_DRIVE_STRENGTH :
@@ -552,16 +605,15 @@ static int sunxi_pconf_set(struct pinctrl_dev *pctldev, unsigned pin, pin -= pctl->desc->pin_base;for (i =0 ; i < num_configs; i++) { +u32 arg, reg, shift, mask, val;enum pin_config_param param;unsigned long flags; -u32 offset, shift, mask, reg; -u32 arg, val;int ret; param =pinconf_to_config_param (configs[i]); arg =pinconf_to_config_argument (configs[i]); - ret =sunxi_pconf_reg (pin, param, &offset, &shift, &mask); + ret =sunxi_pconf_reg (pin, param, ®, &shift, &mask);if (ret <0 )return ret;
@@ -598,9 +650,8 @@ static int sunxi_pconf_set(struct pinctrl_dev *pctldev, unsigned pin, }raw_spin_lock_irqsave (&pctl->lock, flags); - reg =readl (pctl->membase + offset); - reg &= ~(mask << shift); -writel (reg | val << shift, pctl->membase + offset); +writel ((readl (pctl->membase + reg) & ~mask) | val << shift, + pctl->membase + reg);raw_spin_unlock_irqrestore (&pctl->lock, flags); }/* for each config */
@@ -716,16 +767,16 @@ static void sunxi_pmx_set(struct pinctrl_dev *pctldev, u8 config) {struct sunxi_pinctrl *pctl =pinctrl_dev_get_drvdata (pctldev); +u32 reg, shift, mask;unsigned long flags; -u32 val, mask; + + pin -= pctl->desc->pin_base; +sunxi_mux_reg (pin, ®, &shift, &mask);raw_spin_lock_irqsave (&pctl->lock, flags); - pin -= pctl->desc->pin_base; - val =readl (pctl->membase +sunxi_mux_reg (pin)); - mask =MUX_PINS_MASK <<sunxi_mux_offset (pin); -writel ((val & ~mask) | config <<sunxi_mux_offset (pin), - pctl->membase +sunxi_mux_reg (pin)); +writel ((readl (pctl->membase + reg) & ~mask) | config << shift, + pctl->membase + reg);raw_spin_unlock_irqrestore (&pctl->lock, flags); }
@@ -856,43 +907,43 @@ static int sunxi_pinctrl_gpio_direction_input(struct gpio_chip *chip,static int sunxi_pinctrl_gpio_get (struct gpio_chip *chip,unsigned offset) {struct sunxi_pinctrl *pctl =gpiochip_get_data (chip); -u32 reg =sunxi_data_reg (offset); -u8 index =sunxi_data_offset (offset);bool set_mux = pctl->desc->irq_read_needs_mux &&gpiochip_line_is_irq (chip, offset);u32 pin = offset + chip->base; -u32 val; +u32 reg, shift, mask, val; + +sunxi_data_reg (offset, ®, &shift, &mask);if (set_mux)sunxi_pmx_set (pctl->pctl_dev, pin,SUN4I_FUNC_INPUT ); - val = (readl (pctl->membase + reg) >> index) &DATA_PINS_MASK ; + val = (readl (pctl->membase + reg) & mask) >> shift;if (set_mux)sunxi_pmx_set (pctl->pctl_dev, pin,SUN4I_FUNC_IRQ ); -return !!val; +return val; }static void sunxi_pinctrl_gpio_set (struct gpio_chip *chip,unsigned offset,int value) {struct sunxi_pinctrl *pctl =gpiochip_get_data (chip); -u32 reg =sunxi_data_reg (offset); -u8 index =sunxi_data_offset (offset); +u32 reg, shift, mask, val;unsigned long flags; -u32 regval; + +sunxi_data_reg (offset, ®, &shift, &mask);raw_spin_lock_irqsave (&pctl->lock, flags); - regval =readl (pctl->membase + reg); + val =readl (pctl->membase + reg);if (value) - regval |=BIT (index); + val |= mask;else - regval &= ~(BIT (index)); + val &= ~mask; -writel (regval, pctl->membase + reg); +writel (val, pctl->membase + reg);raw_spin_unlock_irqrestore (&pctl->lock, flags); }
drivers/pinctrl/sunxi/pinctrl-sunxi.h +4 -89
110 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 116/571 pinctrl: sunxi: Use devm_clk_get_enabled() helpers
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Jianzheng <[email protected]>
[ Upstream commit 7dc92ece32ed87a352e285e3d9f0d392b61443e2 ]
sunxi sunxi_pinctrl_init_with_variant get, enable clk and deinit_device disable and unprepare it.
This simplifes the code and avoids the calls toclk_disable_unprepare().
Stable-dep-of: a13f7f5d14af ("pinctrl: sunxi: keep a shadow copy of the data register output latches")
--- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/pinctrl/sunxi/pinctrl-sunxi.c +4 -10
@@ -1577,30 +1577,26 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev, } ret =of_clk_get_parent_count (node); - clk =devm_clk_get (&pdev->dev, ret ==1 ?NULL :"apb" ); + clk =devm_clk_get_enabled (&pdev->dev, ret ==1 ?NULL :"apb" );if (IS_ERR (clk)) { ret =PTR_ERR (clk); goto gpiochip_error; } - ret =clk_prepare_enable (clk); -if (ret) - goto gpiochip_error; - pctl->irq =devm_kcalloc (&pdev->dev, pctl->desc->irq_banks,sizeof (*pctl->irq),GFP_KERNEL );if (!pctl->irq) { ret = -ENOMEM ; - goto clk_error; + goto gpiochip_error; }for (i =0 ; i < pctl->desc->irq_banks; i++) { pctl->irq[i] =platform_get_irq (pdev, i);if (pctl->irq[i] <0 ) { ret = pctl->irq[i]; - goto clk_error; + goto gpiochip_error; } }
@@ -1611,7 +1607,7 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev,if (!pctl->domain) {dev_err (&pdev->dev,"Couldn't register IRQ domain\n" ); ret = -ENOMEM ; - goto clk_error; + goto gpiochip_error; }for (i =0 ; i < (pctl->desc->irq_banks *IRQ_PER_BANK ); i++) {
@@ -1643,8 +1639,6 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev,return 0 ; -clk_error: -clk_disable_unprepare (clk); gpiochip_error:gpiochip_remove (pctl->chip);return ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 117/571 pinctrl: sunxi: keep a shadow copy of the data register output latches
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Titov <[email protected]>
[ Upstream commit a13f7f5d14af9baf34eb12c25962f8d3542b281d ]
On Allwinner SoCs, reading a bank's data register returns the pin level, not the output latch, for pins that are muxed as inputs. Writing a GPIO therefore corrupts the output latches of all input-muxed pins in the same bank: the read-modify-write in sunxi_pinctrl_gpio_set() reads back their pin levels and writes those into their latches.
This breaks emulated open-drain lines (e.g. a bit-banged I2C bus from i2c-gpio). Such a line is released high by muxing it as input and letting the pull-up raise it, so any concurrent GPIO write in the same bank stores 1 into its latch. Driving the line low afterwards is a non-atomic data-then-mux sequence in sunxi_pinctrl_gpio_direction_output(); if the poisoning write lands between the two steps, the pin actively drives high (push-pull) instead of low.
Observed in practice as sporadic glitches on a T507 board bit-banging I2C on port E while other PE GPIOs are toggled. On a scope the failure is unmistakable: on a clock pulse where SCL should fall to GND, the line instead steps *above* its idle high level for the whole low phase — the pad drives a strong push-pull 3.3 V high, higher than the level the pull-up sustains on the loaded bus — before the next transition recovers it. The same can hit SDA, corrupting data instead of clocks.
Steps to reproduce on any sunxi board with a bit-banged (i2c-gpio) bus:
# background: toggle any other GPIO of the same bank, e.g. line 21 gpioset -c <chip> --toggle 100us 21=0 &
# foreground: keep the bit-banged bus busy
while :; do i2cdetect -y <bus> 0x50 0x57; done
# watch SCL/SDA with a scope or logic analyzer: sporadic clock-low # phases driven high (above the pull-up level) instead of low
The bank spinlock cannot help: the racing write is a perfectly valid whole-register RMW that faithfully writes back what the hardware returned. There are no set/clear registers on this IP to write a single bit atomically.
Fix it the same way gpio-mmio handles hardware whose data register read does not return the output latch: keep a shadow copy of each bank's latches, base the read-modify-write on the shadow, and only write the register. The shadow is seeded from the hardware at probe time so pins left in output mode by the bootloader keep their state. Pins that reach output mode through the gpiolib paths write their value (and thereby their shadow bit) before the mux switch in sunxi_pinctrl_gpio_direction_output(); pins muxed to gpio_out directly through a pinmux node bypass that path, so sunxi_pmx_set() refreshes their shadow bit from the latch (readable once the pin is in output mode) to keep them driving their pre-existing level.
Seeding the shadow reads the PIO registers at probe time, which requires the bus clock to be enabled. The clock was only requested at the very end of probe, after devm_pinctrl_register() had already claimed the pin hogs described in the device tree - which mux pins, and thus access registers, with the clock still gated. Move the request ahead of both. Boards whose bootloader leaves the PIO clock running are unaffected, which is why the pre-existing hog problem has gone unnoticed since commit 950707c0eb5c ("pinctrl: sunxi: add clock support").
--- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 76 +++++++++++++++++++++------ drivers/pinctrl/sunxi/pinctrl-sunxi.h | 7 +++ 2 files changed, 68 insertions(+), 15 deletions(-)
drivers/pinctrl/sunxi/pinctrl-sunxi.c +61 -15
@@ -778,6 +778,21 @@ static void sunxi_pmx_set(struct pinctrl_dev *pctldev,writel ((readl (pctl->membase + reg) & ~mask) | config << shift, pctl->membase + reg); +/* +* A pin muxed to gpio_out directly through a pinmux node bypasses +* sunxi_pinctrl_gpio_set() and drives whatever its output latch +* holds. Now that the pin is in output mode the data register +* reads back the latch, so refresh the shadow to keep such pins +* driving their pre-existing level. +*/ +if (config ==SUN4I_FUNC_OUTPUT ) { +u32 *shadow = &pctl->dat_shadow[pin /PINS_PER_BANK ]; + +sunxi_data_reg (pin, ®, &shift, &mask); + *shadow = (*shadow & ~mask) | + (readl (pctl->membase + reg) & mask); + } +raw_spin_unlock_irqrestore (&pctl->lock, flags); }
@@ -929,21 +944,29 @@ static void sunxi_pinctrl_gpio_set(struct gpio_chip *chip, unsigned offset, int value) {struct sunxi_pinctrl *pctl =gpiochip_get_data (chip); -u32 reg, shift, mask, val; +u32 *shadow = &pctl->dat_shadow[offset /PINS_PER_BANK ]; +u32 reg, shift, mask;unsigned long flags;sunxi_data_reg (offset, ®, &shift, &mask);raw_spin_lock_irqsave (&pctl->lock, flags); - val =readl (pctl->membase + reg); - +/* +* Reading the data register returns the pin level, not the output +* latch, for pins muxed as inputs. A read-modify-write based on +* the register would therefore corrupt the latches of input-muxed +* pins in the same bank (e.g. an emulated open-drain I2C line +* released high), making them drive the wrong level once switched +* to output. Base the read-modify-write on a shadow copy of the +* latches instead. +*/ if (value) - val |= mask; + *shadow |= mask;else - val &= ~mask; + *shadow &= ~mask; -writel (val, pctl->membase + reg); +writel (*shadow, pctl->membase + reg);raw_spin_unlock_irqrestore (&pctl->lock, flags); }
@@ -1464,7 +1487,7 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev,struct pinctrl_pin_desc *pins;struct sunxi_pinctrl *pctl;struct pinmux_ops *pmxops; -int i, ret, last_pin, pin_idx; +int i, ret, last_pin, pin_idx, nbanks;struct clk *clk; pctl =devm_kzalloc (&pdev->dev,sizeof (*pctl),GFP_KERNEL );
@@ -1489,6 +1512,37 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev,if (!pctl->irq_array)return -ENOMEM ; +/* +* The bus clock has to be enabled before the pinctrl device +* registers, as the pin hogs claimed from there access registers. +*/ + ret =of_clk_get_parent_count (node); + clk =devm_clk_get_enabled (&pdev->dev, ret ==1 ?NULL :"apb" ); +if (IS_ERR (clk)) +return PTR_ERR (clk); + +/* +* Seed the output latch shadow from the hardware so pins the +* bootloader left in output mode keep their state; see +* sunxi_pinctrl_gpio_set() for why a shadow is needed. This must +* happen before the pinctrl device registers, as pin hogs can mux +* pins to gpio_out and thereby update the shadow. +*/ + last_pin = pctl->desc->pins[pctl->desc->npins -1 ].pin.number; + nbanks =DIV_ROUND_UP (last_pin +1 - pctl->desc->pin_base, +PINS_PER_BANK ); + pctl->dat_shadow =devm_kcalloc (&pdev->dev, nbanks, +sizeof (*pctl->dat_shadow),GFP_KERNEL ); +if (!pctl->dat_shadow) +return -ENOMEM ; + +for (i =0 ; i < nbanks; i++) { +u32 reg, shift, mask; + +sunxi_data_reg (i *PINS_PER_BANK , ®, &shift, &mask); + pctl->dat_shadow[i] =readl (pctl->membase + reg); + } + ret =sunxi_pinctrl_build_state (pdev);if (ret) {dev_err (&pdev->dev,"dt probe failed: %d\n" , ret);
@@ -1543,7 +1597,6 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev,if (!pctl->chip)return -ENOMEM ; - last_pin = pctl->desc->pins[pctl->desc->npins -1 ].pin.number; pctl->chip->owner =THIS_MODULE ; pctl->chip->request = gpiochip_generic_request; pctl->chip->free = gpiochip_generic_free;
@@ -1576,13 +1629,6 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev, goto gpiochip_error; } - ret =of_clk_get_parent_count (node); - clk =devm_clk_get_enabled (&pdev->dev, ret ==1 ?NULL :"apb" ); -if (IS_ERR (clk)) { - ret =PTR_ERR (clk); - goto gpiochip_error; - } - pctl->irq = devm_kcalloc(&pdev->dev, pctl->desc->irq_banks, sizeof(*pctl->irq),
drivers/pinctrl/sunxi/pinctrl-sunxi.h +7 -0
@@ -76,6 +76,7 @@#define IO_BIAS_MASK GENMASK(3, 0)#define SUN4I_FUNC_INPUT 0 +#define SUN4I_FUNC_OUTPUT 1#define SUN4I_FUNC_IRQ 6#define PINCTRL_SUN5I_A10S BIT(1)
@@ -160,6 +161,12 @@ struct sunxi_pinctrl {int *irq;unsigned *irq_array;raw_spinlock_t lock; +/* +* Output latch shadow, one word per bank. Seeded lockless at +* probe before the pinctrl device registers, protected by @lock +* afterwards. +*/ +u32 *dat_shadow;struct pinctrl_dev *pctl_dev;unsigned long variant; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 118/571 net: ena: Remove autopolling mode
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dr. David Alan Gilbert <[email protected]>
[ Upstream commit b356b9170815f822394667010d478d53901ff581 ]
This manually reverts
commit a4e262cde3cd ("net: ena: allow automatic fallback to polling mode")
which is unused.
(I did it manually because there are other minor comment and function changes surrounding it).
Build tested only.
Stable-dep-of: 9476b4468862 ("net: ena: fix MMIO read buffer leak on probe failure")
--- drivers/net/ethernet/amazon/ena/ena_com.c | 25 +++++------------------ drivers/net/ethernet/amazon/ena/ena_com.h | 14 ------------- 2 files changed, 5 insertions(+), 34 deletions(-)
drivers/net/ethernet/amazon/ena/ena_com.c +5 -20
@@ -763,25 +763,16 @@ static int ena_com_wait_and_process_admin_cq_interrupts(struct ena_comp_ctx *comif (comp_ctx->status ==ENA_CMD_COMPLETED ) {netdev_err (admin_queue->ena_dev->net_device, -"The ena device sent a completion but the driver didn't receive a MSI-X interrupt (cmd %d), autopolling mode is %s\n" , - comp_ctx->cmd_opcode, admin_queue->auto_polling ?"ON" :"OFF" ); -/* Check if fallback to polling is enabled */ -if (admin_queue->auto_polling) - admin_queue->polling = true; +"The ena device sent a completion but the driver didn't receive a MSI-X interrupt (cmd %d)\n" , + comp_ctx->cmd_opcode); }else {netdev_err (admin_queue->ena_dev->net_device,"The ena device didn't send a completion for the admin cmd %d status %d\n" , comp_ctx->cmd_opcode, comp_ctx->status); } -/* Check if shifted to polling mode. -* This will happen if there is a completion without an interrupt -* and autopolling mode is enabled. Continuing normal execution in such case -*/ -if (!admin_queue->polling) { - admin_queue->running_state = false; - ret = -ETIME ; - goto err; - } + admin_queue->running_state = false; + ret = -ETIME ; + goto err; } ret =ena_com_comp_status_to_errno (admin_queue, comp_ctx->comp_status);
@@ -1658,12 +1649,6 @@ void ena_com_set_admin_polling_mode(struct ena_com_dev *ena_dev, bool polling) ena_dev->admin_queue.polling = polling; } -void ena_com_set_admin_auto_polling_mode (struct ena_com_dev *ena_dev, -bool polling) -{ - ena_dev->admin_queue.auto_polling = polling; -} -int ena_com_mmio_reg_read_request_init (struct ena_com_dev *ena_dev) {struct ena_com_mmio_read *mmio_read = &ena_dev->mmio_read;
drivers/net/ethernet/amazon/ena/ena_com.h +0 -14
@@ -227,9 +227,6 @@ struct ena_com_admin_queue {/* Indicate if the admin queue should poll for completion */ bool polling; -/* Define if fallback to polling mode should occur */ -bool auto_polling; -u16 curr_cmd_id;/* Indicate that the ena was initialized and can
@@ -484,17 +481,6 @@ bool ena_com_get_admin_running_state(struct ena_com_dev *ena_dev);*/ void ena_com_set_admin_polling_mode (struct ena_com_dev *ena_dev,bool polling); -/* ena_com_set_admin_auto_polling_mode - Enable autoswitch to polling mode -* @ena_dev: ENA communication layer struct -* @polling: Enable/Disable polling mode -* -* Set the autopolling mode. -* If autopolling is on: -* In case of missing interrupt when data is available switch to polling. -*/ -void ena_com_set_admin_auto_polling_mode (struct ena_com_dev *ena_dev, -bool polling); -/* ena_com_admin_q_comp_intr_handler - admin queue interrupt handler * @ena_dev: ENA communication layer struct *
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 119/571 net: ena: fix MMIO read buffer leak on probe failure
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guangshuo Li <[email protected]>
[ Upstream commit 9476b4468862927297c94c440863cd8ed1e7cc83 ]
ena_device_init() initializes the MMIO read mechanism with ena_com_mmio_reg_read_request_init(), which allocates a coherent DMA buffer for MMIO read responses.
The normal removal path releases this buffer through ena_com_mmio_reg_read_request_destroy(). However, if ena_probe() fails after ena_device_init() succeeds, the error path destroys the admin resources and eventually frees ena_dev without destroying the MMIO read request, leaving the coherent DMA buffer allocated.
Call ena_com_mmio_reg_read_request_destroy() in the probe error path before releasing the remaining device resources.
This issue was found by manual code inspection.
--- drivers/net/ethernet/amazon/ena/ena_netdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/amazon/ena/ena_netdev.c +1 -0
@@ -4517,6 +4517,7 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) err_device_destroy:ena_com_delete_host_info (ena_dev);ena_com_admin_destroy (ena_dev); +ena_com_mmio_reg_read_request_destroy (ena_dev); err_netdev_destroy:free_netdev (netdev); err_free_region:
Signature · 1 line
2.53.0