6.18.36-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainercover 6.18.36-rc1 review
This is the start of the stable review cycle for the 6.18.36 release. There are 325 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 18 Jun 2026 14:49:57 +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/v6.x/stable-review/patch-6.18.36-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-6.18.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 6.18.36-rc1
Damien Le Moal <[email protected]>
block: fix handling of dead zone write plugs
Will Deacon <[email protected]>
arm64: errata: Mitigate TLBI errata on Microsoft Azure Cobalt 100 CPU
Shanker Donthineni <[email protected]>
arm64: errata: Mitigate TLBI errata on NVIDIA Olympus CPU
Mark Rutland <[email protected]>
arm64: errata: Mitigate TLBI errata on various Arm CPUs
Mark Rutland <[email protected]>
arm64: cputype: Add C1-Premium definitions
Mark Rutland <[email protected]>
arm64: cputype: Add C1-Ultra definitions
Stefano Garzarella <[email protected]>
vsock/virtio: fix skb overhead accounting to preserve full buf_alloc
Eric Dumazet <[email protected]>
vsock/virtio: fix potential unbounded skb queue
Julian Anastasov <[email protected]>
ipvs: skip ipv6 extension headers for csum checks
Jason Gunthorpe <[email protected]>
RDMA/umem: Fix truncation for block sizes >= 4G
Leon Romanovsky <[email protected]>
RDMA: Move DMA block iterator logic into dedicated files
Randy Dunlap <[email protected]>
RDMA/umem: fix kernel-doc warnings
Davide Ornaghi <[email protected]>
netfilter: nft_fib: fix stale stack leak via the OIFNAME register
Jason Gunthorpe <[email protected]>
RDMA: During rereg_mr ensure that REREG_ACCESS is compatible
Jacob Moroni <[email protected]>
RDMA/umem: Add helpers for umem dmabuf revoke lock
Jacob Moroni <[email protected]>
RDMA/umem: Move umem dmabuf revoke logic into helper function
Jacob Moroni <[email protected]>
RDMA/umem: Add ib_umem_dmabuf_get_pinned_and_lock helper
Tejun Heo <[email protected]>
sched_ext: Don't warn on NULL cgrp_moving_from in scx_cgroup_move_task()
Johannes Berg <[email protected]>
wifi: mac80211: tests: mark HT check strict
Rio Liu <[email protected]>
wifi: mac80211: skip ieee80211_verify_sta_ht_mcs_support check in non-strict mode
Johan Hovold <[email protected]>
driver core: reject devices with unregistered buses
Mingyu Wang <[email protected]>
fs/fcntl: fix SOFTIRQ-unsafe lock order in fasync signaling
Harry Wentland <[email protected]>
drm/amd/display: Use krealloc_array() in dal_vector_reserve()
Harry Wentland <[email protected]>
drm/amd/display: Fix out-of-bounds read in dp_get_eq_aux_rd_interval()
Harry Wentland <[email protected]>
drm/amd/display: Fix NULL deref and buffer over-read in SDP debugfs
Leorize <[email protected]>
drm/amd/display: add missing CSC entries for BT.2020 for DCE IPs
Harry Wentland <[email protected]>
drm/amd/display: Clamp VBIOS HDMI retimer register count to array size
Harry Wentland <[email protected]>
drm/amd/display: Clamp HDMI HDCP2 rx_id_list read to buffer size
Harry Wentland <[email protected]>
drm/amd/display: Bound VBIOS record-chain walk loops
Priya Hosur <[email protected]>
drm/amd/pm: smu_v14_0_0: use SoftMin for gfxclk in set_soft_freq_limited_range
Yang Wang <[email protected]>
drm/amd/pm: mark metrics.energy_accumulator is invalid for smu 14.0.2
Yang Wang <[email protected]>
drm/amd/pm: fix smu13 power limit default/cap calculation
Vitaly Prosyak <[email protected]>
drm/amdgpu: set noretry=1 as default for GFX 10.1.x (Navi10/12/14)
Christian König <[email protected]>
drm/amdgpu: restart the CS if some parts of the VM are still invalidated
Christian König <[email protected]>
drm/amdgpu: fix waiting for all submissions for userptrs
Maíra Canal <[email protected]>
drm/v3d: Skip CSD when it has zeroed workgroups
Maíra Canal <[email protected]>
drm/v3d: Fix vaddr leak when indirect CSD has zeroed workgroups
Maíra Canal <[email protected]>
drm/v3d: Fix global performance monitor reference counting
Maíra Canal <[email protected]>
drm/v3d: Wait for pending L2T flush before cleaning caches
Tangudu Tilak Tirumalesh <[email protected]>
drm/xe: Clear pending_disable before signaling suspend fence
Jani Nikula <[email protected]>
drm/xe/display: fix oops in suspend/shutdown without display
Andrew Martin <[email protected]>
drm/amdkfd: Fix buffer overflow in SDMA queue checkpoint/restore on GFX11
Muhammad Bilal <[email protected]>
drm/amdkfd: fix NULL dereference in get_queue_ids()
Simona Vetter <[email protected]>
drm/gem: Try to fix change_handle ioctl, attempt 4
Bjorn Andersson <[email protected]>
slimbus: qcom-ngd-ctrl: Avoid ABBA on tx_lock/ctrl->lock
Bjorn Andersson <[email protected]>
slimbus: qcom-ngd-ctrl: Balance pm_runtime enablement for NGD
Bjorn Andersson <[email protected]>
slimbus: qcom-ngd-ctrl: Correct PDR and SSR cleanup ownership
Bjorn Andersson <[email protected]>
slimbus: qcom-ngd-ctrl: Initialize controller resources in controller
Bjorn Andersson <[email protected]>
slimbus: qcom-ngd-ctrl: Register callbacks after creating the ngd
Bjorn Andersson <[email protected]>
slimbus: qcom-ngd-ctrl: Fix probe error path ordering
Bjorn Andersson <[email protected]>
slimbus: qcom-ngd-ctrl: Fix up platform_driver registration
Bartosz Golaszewski <[email protected]>
slimbus: qcom-ngd-ctrl: fix OF node refcount
Michael Bommarito <[email protected]>
thunderbolt: Limit XDomain response copy to actual frame size
Michael Bommarito <[email protected]>
thunderbolt: Validate XDomain request packet size before type cast
Michael Bommarito <[email protected]>
thunderbolt: Clamp XDomain response data copy to allocation size
Michael Bommarito <[email protected]>
thunderbolt: Bound root directory content to block size
Michael Bommarito <[email protected]>
thunderbolt: Reject zero-length property entries in validator
Wyatt Feng <[email protected]>
sctp: stream: fully roll back denied add-stream state
Zhao Zhang <[email protected]>
sctp: diag: reject stale associations in dump_one path
David Howells <[email protected]>
rxrpc: Fix the ACK parser to extract the SACK table for parsing
Justin Lai <[email protected]>
rtase: Reset TX subqueue when clearing TX ring
Justin Lai <[email protected]>
rtase: Avoid sleeping in get_stats64()
Kendall Willis <[email protected]>
pmdomain: ti_sci: add wakeup constraint to parent devices of wakeup source
Bartosz Golaszewski <[email protected]>
pmdomain: imx: fix OF node refcount
Jisheng Zhang <[email protected]>
mmc: sdhci: add signal voltage switch in sdhci_resume_host
Lad Prabhakar <[email protected]>
mmc: renesas_sdhi: Add OF entry for RZ/G2H SoC
Inochi Amaoto <[email protected]>
mmc: litex_mmc: Set mandatory idle clocks before CMD0
Heiko Stuebner <[email protected]>
mmc: dw_mmc-rockchip: Add missing private data for very old controllers
Kamal Dasu <[email protected]>
mmc: core: Fix host controller programming for fixed driver type
Usama Arif <[email protected]>
mm/mincore: handle non-swap entries before !CONFIG_SWAP guard
Shakeel Butt <[email protected]>
mm/list_lru: drain before clearing xarray entry on reparent
David Carlier <[email protected]>
mm/hugetlb: restore reservation on error in hugetlb folio copy paths
Lorenzo Stoakes <[email protected]>
mm/hugetlb: avoid false positive lockdep assertion
SeongJae Park <[email protected]>
mm/damon/reclaim: handle ctx allocation failure
SeongJae Park <[email protected]>
mm/damon/lru_sort: handle ctx allocation failure
Muchun Song <[email protected]>
mm/cma_debug: fix invalid accesses for inactive CMA areas
Muchun Song <[email protected]>
mm/cma: fix reserved page leak on activation failure
Christian A. Ehrhardt <[email protected]>
io_uring/wait: fix min_timeout behavior
Jens Axboe <[email protected]>
io_uring/kbuf: don't truncate end buffer for bundles
Judith Mendez <[email protected]>
pinctrl: mcp23s08: Read spi-present-mask as u8 not u32
Dawei Feng <[email protected]>
octeontx2-af: fix memory leak in rvu_setup_hw_resources()
Andre Heider <[email protected]>
nvmem: layouts: onie-tlv: fix hang on unknown types
Bartosz Golaszewski <[email protected]>
nvmem: core: fix use-after-free bugs in error paths
Jonas Jelonek <[email protected]>
net: sfp: initialize i2c_block_size at adapter configure time
Yuqi Xu <[email protected]>
net: rds: clear i_sends on setup unwind
Santosh Kalluri <[email protected]>
net: phonet: free phonet_device after RCU grace period
Bartosz Golaszewski <[email protected]>
net: mv643xx: fix OF node refcount
ZhaoJinming <[email protected]>
net: bonding: fix NULL pointer dereference in bond_do_ioctl()
ZhaoJinming <[email protected]>
net: airoha: Add NULL check for of_reserved_mem_lookup() in airoha_qdma_init_hfwd_queues()
Nikolay Kuratov <[email protected]>
net/mlx5: Reorder completion before putting command entry in cmd_work_handler
Tudor Ambarus <[email protected]>
firmware: samsung: acpm: Fix mailbox channel leak on probe error
Mukesh Ojha <[email protected]>
misc: fastrpc: Fix NULL pointer dereference in rpmsg callback
Junrui Luo <[email protected]>
misc: fastrpc: fix DMA address corruption due to find_vma misuse
Zhenghang Xiao <[email protected]>
misc: fastrpc: fix use-after-free race in fastrpc_map_create
Anandu Krishnan E <[email protected]>
misc: fastrpc: fix use-after-free of fastrpc_user in workqueue context
Shakeel Butt <[email protected]>
memcg: use round-robin victim selection in refill_stock
Davidlohr Bueso <[email protected]>
locking/rtmutex: Skip remove_waiter() when waiter is not enqueued
Yilin Zhu <[email protected]>
ipc/shm: serialize orphan cleanup with shm_nattch updates
Jason Gunthorpe <[email protected]>
iommu/dma: Do not try to iommu_map a 0 length region in swiotlb
Cryolitia PukNgae <[email protected]>
Input: atkbd - skip deactivate for HONOR BCC-N's internal keyboard
Zeyu WANG <[email protected]>
Input: atkbd - add DMI quirk for Lenovo Yoga Air 14 (83QK)
Akhil R <[email protected]>
i2c: tegra: Fix NOIRQ suspend/resume
Guillermo Rodríguez <[email protected]>
i2c: stm32f7: fix timing computation ignoring i2c-analog-filter
Vladimir Zapolskiy <[email protected]>
i2c: qcom-cci: Fix NULL pointer dereference in cci_remove()
Carlos Song <[email protected]>
i2c: imx: fix clock and pinctrl state inconsistency in runtime PM
Carlos Song <[email protected]>
i2c: imx-lpi2c: fix resource leaks switching to devm_dma_request_chan()
Ji'an Zhou <[email protected]>
futex/requeue: Prevent NULL pointer dereference in remove_waiter() on self-deadlock
Jann Horn <[email protected]>
fuse: limit FUSE_NOTIFY_RETRIEVE to uptodate folios
Jann Horn <[email protected]>
fuse: reject fuse_notify() pagecache ops on directories
Arpith Kalaginanavoor <[email protected]>
fs/qnx6: fix pointer arithmetic in directory iteration
Christian Brauner <[email protected]>
pidfd: refuse access to tasks that have started exiting harder
Hyunwoo Kim <[email protected]>
inet: frags: fix use-after-free caused by the fqdir_pre_exit() flush
Michael Bommarito <[email protected]>
IB/isert: Reject login PDUs shorter than ISER_HEADERS_LEN
Jann Horn <[email protected]>
fhandle: fix UAF due to unlocked ->mnt_ns read in may_decode_fh()
Kyle Meyer <[email protected]>
bnxt_en: Fix NULL pointer dereference
Chancel Liu <[email protected]>
ASoC: fsl_sai: Fix 32 slots TDM broken by integer shift UB in xMR write
Salman Alghamdi <[email protected]>
staging: rtl8723bs: fix buffer over-read in rtw_update_protection
Amit Matityahu <[email protected]>
timers/migration: Fix livelock in tmigr_handle_remote_up()
Raf Dickson <[email protected]>
vsock/vmci: fix sk_ack_backlog leak on failed handshake
Yuqi Xu <[email protected]>
wifi: nl80211: reject oversized EMA RNR lists
Emmanuel Grumbach <[email protected]>
wifi: iwlwifi: pcie: simplify the resume flow if fast resume is not used
Yingjie Gao <[email protected]>
xfs: fix rtgroup cleanup in CoW fork repair
Yingjie Gao <[email protected]>
xfs: fix error returns in CoW fork repair
Matthieu Baerts (NGI0) <[email protected]>
mptcp: add-addr: always drop other suboptions
Tao Cui <[email protected]>
selftests: mptcp: add test for extra_subflows underflow on userspace PM
Matthieu Baerts (NGI0) <[email protected]>
mptcp: sockopt: set sockopt on all subflows
Matthieu Baerts (NGI0) <[email protected]>
mptcp: sockopt: check timestamping ret value
Tao Cui <[email protected]>
mptcp: pm: fix extra_subflows underflow on userspace PM subflow creation
Paolo Abeni <[email protected]>
mptcp: allow subflow rcv wnd to shrink
Paolo Abeni <[email protected]>
mptcp: close TOCTOU race while computing rcv_wnd
Paolo Abeni <[email protected]>
mptcp: fix retransmission loop when csum is enabled
Alistair Popple <[email protected]>
arm64: mm: call pagetable dtor when freeing hot-removed page tables
Karl Mehltretter <[email protected]>
ARM: 9475/1: entry: use byte load for KASAN VMAP stack shadow
Karl Mehltretter <[email protected]>
ARM: 9474/1: io: avoid KASAN instrumentation of raw halfword I/O
Yuho Choi <[email protected]>
ARM: socfpga: Fix OF node refcount leak in SMP setup
Sechang Lim <[email protected]>
udp: clear skb->dev before running a sockmap verdict
Cunlong Li <[email protected]>
zram: fix use-after-free in zram_bvec_write_partial()
Michael Bommarito <[email protected]>
RDMA/srp: bound SRP_RSP sense copy by the received length
Yishai Hadas <[email protected]>
RDMA/core: Validate cpu_id against nr_cpu_ids in DMAH alloc
Jason Gunthorpe <[email protected]>
RDMA/core: Validate the passed in fops for ib_get_ucaps()
Yin Tirui <[email protected]>
mm/huge_memory: update file PUD counter before folio_put()
SeongJae Park <[email protected]>
mm/damon/ops-common: call folio_test_lru() after folio_get()
Yin Tirui <[email protected]>
mm/huge_memory: update file PMD counter before folio_put()
Harry Wentland <[email protected]>
drm/amd/display: Reject gpio_bitshift >= 32 in bios_parser_get_gpio_pin_info()
Wentao Liang <[email protected]>
drm/virtio: fix dma_fence refcount leak on error in virtio_gpu_dma_fence_wait()
Clément Léger <[email protected]>
io_uring/net: inherit IORING_CQE_F_BUF_MORE across bundle recv retries
Takashi Iwai <[email protected]>
ALSA: timer: Fix UAF at snd_timer_user_params()
Takashi Iwai <[email protected]>
ALSA: timer: Forcibly close timer instances at closing
HyeongJun An <[email protected]>
USB: serial: kl5kusb105: fix bulk-out buffer overflow
Jack Wu <[email protected]>
USB: serial: option: add usb-id for Dell Wireless DW5826e-m
Adrian Korwel <[email protected]>
USB: serial: io_ti: fix heap overflow in build_i2c_fw_hdr()
Adrian Korwel <[email protected]>
USB: serial: io_ti: fix heap overflow in get_manuf_info()
Tristan Madani <[email protected]>
xfrm: iptfs: fix ABBA deadlock in iptfs_destroy_state()
Takao Sato <[email protected]>
xfrm: iptfs: preserve shared-frag marker in iptfs_consume_frags()
Wyatt Feng <[email protected]>
xfrm: espintcp: do not reuse an in-progress partial send
Gil Portnoy <[email protected]>
ksmbd: fix use-after-free of a deferred file_lock on double SMB2_CANCEL
Anton Leontev <[email protected]>
hv_netvsc: use kmap_local_page in netvsc_copy_to_send_buf
Joonas Lahtinen <[email protected]>
drm/i915/gem: Fix phys BO pread/pwrite with offset
Joey Gouly <[email protected]>
KVM: arm64: Restore POR_EL0 access to host EL0
Sean Christopherson <[email protected]>
KVM: SEV: Decouple the need to sync the GHCB SA from the need to free the SA
Sean Christopherson <[email protected]>
KVM: Don't WARN if memory is dirtied without a vCPU when the VM is dying
Wei Liu <[email protected]>
mshv: add a missing padding field
Inochi Amaoto <[email protected]>
mmc: litex_mmc: Use DIV_ROUND_UP for more accurate clock calculation
Alice Ryhl <[email protected]>
rust: kasan/kbuild: fix rustc-option when cross-compiling
Alice Ryhl <[email protected]>
rust: arm64: set uwtable llvm module flag for CONFIG_UNWIND_TABLES
Nathan Chancellor <[email protected]>
ARM: Do not select HAVE_RUST when KASAN is enabled
Miguel Ojeda <[email protected]>
rust: x86: support Rust >= 1.98.0 target spec
Masami Hiramatsu (Google) <[email protected]>
tracing/probes: Point the error offset correctly for eprobe argument error
Eva Kurchatova <[email protected]>
tracing: Fix CFI violation in probestub being called by tprobes
Andrzej Kacprowski <[email protected]>
accel/ivpu: Fix signed integer truncation in IPC receive
Andrzej Kacprowski <[email protected]>
accel/ivpu: Add buffer overflow check in MS get_info_ioctl
Andrzej Kacprowski <[email protected]>
accel/ivpu: Add bounds checks for firmware log indices
Wupeng Ma <[email protected]>
mm/memory-failure: fix hugetlb_lock AA deadlock in get_huge_page_for_hwpoison
Manivannan Sadhasivam <[email protected]>
soc: qcom: ice: Fix race between qcom_ice_probe() and of_qcom_ice_get()
Michael Bommarito <[email protected]>
Bluetooth: L2CAP: reject BR/EDR signaling packets over MTUsig
Yuqi Xu <[email protected]>
Bluetooth: hci_sync: reject oversized Broadcast Announcement prepend
Georgiy Osokin <[email protected]>
tee: shm: fix shm leak in register_shm_helper()
Davide Ornaghi <[email protected]>
netfilter: nft_meta_bridge: fix stale stack leak via IIFHWADDR register
Tristan Madani <[email protected]>
netfilter: nft_tunnel: fix use-after-free on object destroy
Lizhi Hou <[email protected]>
accel/amdxdna: Fix mm_struct reference leak in aie2_populate_range()
Wentao Liang <[email protected]>
drm/xe: fix refcount leak in xe_range_fence_insert()
Alexander A. Klimov <[email protected]>
drm/vc4: fix krealloc() memory leak
Dmitry Osipenko <[email protected]>
drm/virtio: Fix driver removal with disabled KMS
Nikita Zhandarovich <[email protected]>
drm/i915/edp: Check supported link rates DPCD read
Pengyu Luo <[email protected]>
clk: qcom: dispcc-sc8280xp: Don't park mdp_clk_src at registration time
Kuan-Wei Chiu <[email protected]>
clk: samsung: gs101: Fix missing USI7_USI DIV clock in peric0_clk_regs
Hans de Goede <[email protected]>
clk: qcom: x1e80100-dispcc: Stop disp_cc_mdss_mdp_clk_src from getting parked
Dongli Zhang <[email protected]>
KVM: VMX: Update SVI during runtime APICv activation
Ido Schimmel <[email protected]>
ipv6: Fix a potential NPD in cleanup_prefix_route()
Jiawen Wu <[email protected]>
net: txgbe: initialize module info buffer
Jiawen Wu <[email protected]>
net: txgbe: rename the SFP related
Jiawen Wu <[email protected]>
net: txgbe: support CR modules for AML devices
Jiawen Wu <[email protected]>
net: txgbe: optimize the flow to setup PHY for AML devices
Til Kaiser <[email protected]>
net: mvpp2: build skb from XDP-adjusted data on XDP_PASS
Til Kaiser <[email protected]>
net: mvpp2: refill RX buffers before XDP or skb use
Til Kaiser <[email protected]>
net: mvpp2: limit XDP frame size to the RX buffer
Til Kaiser <[email protected]>
net: mvpp2: sync RX data at the hardware packet offset
Florian Westphal <[email protected]>
netfilter: nft_exthdr: fix register tracking for F_PRESENT flag
Xiang Mei <[email protected]>
netfilter: nf_log: validate MAC header was set before dumping it
Kyle Zeng <[email protected]>
netfilter: x_tables: avoid leaking percpu counter pointers
Weiming Shi <[email protected]>
netfilter: nf_conntrack: destroy stale expectfn expectations on unregister
Florian Westphal <[email protected]>
netfilter: revalidate bridge ports
Felix Gu <[email protected]>
spi: rzv2h-rspi: Fix SPDR read access width for 16-bit RX
Breno Leitao <[email protected]>
rds: mark snapshot pages dirty in rds_info_getsockopt()
Eric Dumazet <[email protected]>
ip6_vti: fix incorrect tunnel matching in vti6_tnl_lookup()
Xiang Mei <[email protected]>
tun: zero the whole vnet header in tun_put_user()
Weiming Shi <[email protected]>
net/rds: fix NULL deref in rds_ib_send_cqe_handler() on masked atomic completion
Kyle Zeng <[email protected]>
net: guard timestamp cmsgs to real error queue skbs
Xin Long <[email protected]>
sctp: validate embedded INIT chunk and address list lengths in cookie
Eric Dumazet <[email protected]>
ip6_vti: set netns_immutable on the fallback device.
Michael Bommarito <[email protected]>
sctp: fix uninit-value in __sctp_rcv_asconf_lookup()
Vijendar Mukunda <[email protected]>
ASoC: SOF: amd: fix for ipc flags check
Jeremy Kerr <[email protected]>
net: mctp: usb: don't fail mctp_usb_rx_queue on a deferred submission
Jeremy Kerr <[email protected]>
net: mctp: usb: fix race between urb completion and rx_retry cancellation
Marco Scardovi <[email protected]>
gpio: rockchip: fix generic IRQ chip leak on remove
Ruoyu Wang <[email protected]>
gpio: zynq: fix runtime PM leak on remove
Chih Kai Hsu <[email protected]>
r8152: handle the return value of usb_reset_device()
Adrian Moreno <[email protected]>
net: openvswitch: fix possible kfree_skb of ERR_PTR
Kyle Zeng <[email protected]>
ipv6: sit: reload inner IPv6 header after GSO offloads
Fushuai Wang <[email protected]>
net/mlx5: Use effective affinity mask for IRQ selection
Dragos Tatulea <[email protected]>
net/mlx5e: xsk: Fix DMA and xdp_frame leak on XDP_TX xmit failure
Dragos Tatulea <[email protected]>
net/mlx5: Fix slab-out-of-bounds in mlx5_query_nic_vport_mac_list
Mingyu Wang <[email protected]>
net: qrtr: fix refcount saturation and potential UAF in qrtr_port_remove
Maxime Chevallier <[email protected]>
net: phy: clean the sfp upstream if phy probing fails
Jakub Kicinski <[email protected]>
netdev: fix double-free in netdev_nl_bind_rx_doit()
Rosen Penev <[email protected]>
net: ibm: emac: Fix use-after-free during device removal
Yao Sang <[email protected]>
net/mlx4: avoid GCC 10 __bad_copy_from() false positive
HanQuan <[email protected]>
net: add pskb_may_pull() to skb_gro_receive_list()
Eric Dumazet <[email protected]>
tcp: restrict SO_ATTACH_FILTER to priv users
Richard Fitzgerald <[email protected]>
ASoC: wm_adsp: Fix NULL dereference when removing firmware controls
Yun Zhou <[email protected]>
gpio: mvebu: fix NULL pointer dereference in suspend/resume
Chenguang Zhao <[email protected]>
netlabel: validate unlabeled address and mask attribute lengths
Vikas Gupta <[email protected]>
bnge: fix context mem iteration
Arthur Kiyanovski <[email protected]>
net: ena: PHC: Add missing barrier
Alok Tiwari <[email protected]>
idpf: fix mailbox capability for set device clock time
Petr Oros <[email protected]>
ice: fix missing priority callbacks for U.FL DPLL pins
Sanghyun Park <[email protected]>
xfrm: policy: fix use-after-free on inexact bin in xfrm_policy_bysel_ctx()
Li RongQing <[email protected]>
dma-debug: fix physical address retrieval in debug_dma_sync_sg_for_device
Li RongQing <[email protected]>
dma-mapping: direct: fix missing mapping for THRU_HOST_BRIDGE segments
Zhenghang Xiao <[email protected]>
xfrm: iptfs: fix use-after-free on first_skb in __input_process_payload
Weiming Shi <[email protected]>
tap: free page on error paths in tap_get_user_xdp()
Gabriele Monaco <[email protected]>
verification/rvgen: Fix ltl2k writing True as a literal
Gabriele Monaco <[email protected]>
verification/rvgen: Fix options shared among commands
Gabriele Monaco <[email protected]>
tools/rv: Fix cleanup after failed trace setup
Gabriele Monaco <[email protected]>
tools/rv: Fix substring match when listing container monitors
Gabriele Monaco <[email protected]>
tools/rv: Fix substring match bug in monitor name search
Gabriele Monaco <[email protected]>
tools/rv: Ensure monitor name and desc are NUL-terminated
Zhan Xusheng <[email protected]>
cpufreq/amd-pstate: drop stale @epp_cached kdoc
Johan Hovold <[email protected]>
spi: cadence-quadspi: fix unclocked access on unbind
Kyle Zeng <[email protected]>
ALSA: seq: dummy: fix UMP event stack overread
Ji'an Zhou <[email protected]>
ALSA: PCM: Fix wait queue list corruption in snd_pcm_drain() on linked streams
Naveen Kumar Chaudhary <[email protected]>
time: Fix off-by-one in settimeofday() usec validation
Dexuan Cui <[email protected]>
hyperv: Clean up and fix the guest ID comment in hvgdk.h
Aleksandr Nogikh <[email protected]>
signal: clear JOBCTL_PENDING_MASK for caller in zap_other_threads()
Geliang Tang <[email protected]>
selftests: harness: fix pidfd leak in __wait_for_test
Michael Kelley <[email protected]>
drm/hyperv: During panic do VMBus unload after frame buffer is flushed
Michael Kelley <[email protected]>
Drivers: hv: vmbus: Provide option to skip VMBus unload on panic
Roman Kisel <[email protected]>
Drivers: hv: VMBus protocol version 6.0
Xin Long <[email protected]>
sctp: purge outqueue on stale COOKIE-ECHO handling
Yizhou Zhao <[email protected]>
net/802/mrp: fix vector attribute parsing in mrp_pdu_parse_vecattr
Eric Dumazet <[email protected]>
ieee802154: 6lowpan: only accept IPv6 packets in lowpan_xmit()
Andy Roulin <[email protected]>
vxlan: vnifilter: fix spurious notification on VNI update
Andy Roulin <[email protected]>
vxlan: vnifilter: send notification on VNI add
Nithin Dabilpuram <[email protected]>
octeontx2-af: npc: Fix CPT channel mask in npc_install_flow
Xin Long <[email protected]>
sctp: validate cached peer INIT chunk length in COOKIE_ECHO processing
Rajat Gupta <[email protected]>
net/sched: fix pedit partial COW leading to page cache corruption
Lorenzo Bianconi <[email protected]>
net: ethernet: mtk_eth_soc: Fix use-after-free in metadata dst teardown
Lorenzo Bianconi <[email protected]>
net: airoha: Fix use-after-free in metadata dst teardown
Kurt Kanzenbach <[email protected]>
ptp: vclock: Switch from RCU to SRCU
Eric Dumazet <[email protected]>
ipv4: restrict IPOPT_SSRR and IPOPT_LSRR options
Jianyu Li <[email protected]>
af_unix: Fix inq_len update problem in partial read
Suman Ghosh <[email protected]>
octeontx2-af: Fix initialization of mcam's entry2target_pffunc field
Geetha sowjanya <[email protected]>
octeontx2-pf: Fix NDC sync operation errors
Jason Xing <[email protected]>
xsk: cache csum_start/csum_offset to fix TOCTOU in xsk_skb_metadata()
Luiz Augusto von Dentz <[email protected]>
Bluetooth: MGMT: Fix backward compatibility with userspace
SeungJu Cheon <[email protected]>
Bluetooth: SCO: Fix data-race on sco_pi fields in sco_connect
SeungJu Cheon <[email protected]>
Bluetooth: ISO: Fix data-race on iso_pi fields in hci_get_route calls
Luiz Augusto von Dentz <[email protected]>
Bluetooth: ISO: Fix not releasing hdev reference on iso_conn_big_sync
Bharath Reddy <[email protected]>
Bluetooth: fix memory leak in error path of hci_alloc_dev()
Zhang Cen <[email protected]>
Bluetooth: bnep: reject short frames before parsing
Dudu Lu <[email protected]>
Bluetooth: bnep: fix incorrect length parsing in bnep_rx_frame() extension handling
SeungJu Cheon <[email protected]>
Bluetooth: RFCOMM: validate skb length in MCC handlers
Zhang Cen <[email protected]>
Bluetooth: MGMT: validate advertising TLV before type checks
Zhang Cen <[email protected]>
Bluetooth: RFCOMM: hold listener socket in rfcomm_connect_ind()
Fedor Pchelkin <[email protected]>
wifi: fix leak if split 6 GHz scanning fails
Jiayuan Chen <[email protected]>
ipv6: anycast: insert aca into global hash under idev->lock
Tapio Reijonen <[email protected]>
net: fec: fix pinctrl default state restore order on resume
David Thompson <[email protected]>
net: lan743x: permit VLAN-tagged packets up to configured MTU
Yizhou Zhao <[email protected]>
net: garp: fix unsigned integer underflow in garp_pdu_parse_attr
Kuniyuki Iwashima <[email protected]>
hsr: Remove WARN_ONCE() in hsr_addr_is_self().
Kuniyuki Iwashima <[email protected]>
net: Annotate sk->sk_write_space() for UDP SOCKMAP.
Oscar Maes <[email protected]>
pcnet32: stop holding device spin lock during napi_complete_done
Deepanshu Kartikey <[email protected]>
wifi: mac80211: limit injected antenna index in ieee80211_parse_tx_radiotap
Yicong Hui <[email protected]>
drm/imx: Fix three kernel-doc warnings in dcss-scaler.c
Mark Bloch <[email protected]>
devlink: Release nested relation on devlink free
Lee Jones <[email protected]>
l2tp: pppol2tp: hold reference to session in pppol2tp_ioctl()
Yizhou Zhao <[email protected]>
6lowpan: fix off-by-one in multicast context address compression
Jamal Hadi Salim <[email protected]>
net/sched: act_api: use RCU with deferred freeing for action lifecycle
Guangshuo Li <[email protected]>
dm cache policy smq: check allocation under invalidate lock
Yiming Qian <[email protected]>
netfilter: bridge: make ebt_snat ARP rewrite writable
Jiayuan Chen <[email protected]>
netfilter: nft_ct: bail out on template ct in get eval
Florian Westphal <[email protected]>
netfilter: conntrack_irc: fix possible out-of-bounds read
Fernando Fernandez Mancera <[email protected]>
netfilter: synproxy: add mutex to guard hook reference counting
Julian Anastasov <[email protected]>
ipvs: clear the svc scheduler ptr early on edit
Fernando Fernandez Mancera <[email protected]>
netfilter: xt_NFQUEUE: prefer raw_smp_processor_id
Gil Portnoy <[email protected]>
ksmbd: fix NULL-deref of opinfo->conn in oplock/lease break notifiers
Emmanuel Grumbach <[email protected]>
wifi: iwlwifi: mvm: don't support the reset handshake for old firmwares
Gao Xiang <[email protected]>
erofs: fix use-after-free on sbi->sync_decompress
Gao Xiang <[email protected]>
erofs: tidy up synchronous decompression
Robertus Diawan Chris <[email protected]>
tee: qcomtee: add missing va_end in early return qcomtee_object_user_init()
Arnd Bergmann <[email protected]>
tee: fix tee_ioctl_object_invoke_arg padding
Manivannan Sadhasivam <[email protected]>
soc: qcom: ice: Return -ENODEV if the ICE platform device is not found
Mihai Sain <[email protected]>
ARM: dts: microchip: sam9x7: fix GMAC clock configuration
Val Packett <[email protected]>
arm64: dts: qcom: x1-dell-thena: remove i2c20 (battery SMBus) and reserve its pins
Harshal Dev <[email protected]>
soc: qcom: ice: Allow explicit votes on 'iface' clock for ICE
Amirreza Zarrabi <[email protected]>
tee: optee: prevent use-after-free when the client exits before the supplicant
Nicolò Coccia <[email protected]>
net/smc: fix sleep-inside-lock in __smc_setsockopt() causing local DoS
Ido Schimmel <[email protected]>
ipv6: mcast: Fix use-after-free when processing MLD queries
Mingyu Wang <[email protected]>
i2c: dev: prevent integer overflow in I2C_TIMEOUT ioctl
Hyunwoo Kim <[email protected]>
KVM: arm64: Take the SRCU lock for page table walks in fault injection and AT emulation
Russell King (Oracle) <[email protected]>
ARM: fix branch predictor hardening
Russell King (Oracle) <[email protected]>
ARM: fix hash_name() fault
Russell King (Oracle) <[email protected]>
ARM: allow __do_kernel_fault() to report execution of memory faults
Russell King (Oracle) <[email protected]>
ARM: group is_permission_fault() with is_translation_fault()
Kuniyuki Iwashima <[email protected]>
bpf: Free reuseport cBPF prog after RCU grace period.
-------------
Diffstat:
Documentation/ABI/testing/sysfs-fs-erofs | 14 ++- Documentation/arch/arm64/silicon-errata.rst | 46 +++++++ Makefile | 7 +- arch/arm/Kconfig | 2 +- arch/arm/boot/dts/microchip/sam9x7.dtsi | 6 +- arch/arm/include/asm/io.h | 15 ++- arch/arm/kernel/entry-armv.S | 2 +- arch/arm/mach-socfpga/platsmp.c | 1 + arch/arm/mm/alignment.c | 6 +- arch/arm/mm/fault.c | 100 +++++++++++---- arch/arm64/Kconfig | 38 ++++++ arch/arm64/Makefile | 3 + arch/arm64/boot/dts/qcom/x1-dell-thena.dtsi | 7 +- arch/arm64/include/asm/cputype.h | 4 + arch/arm64/kernel/cpu_errata.c | 34 ++++- arch/arm64/kvm/at.c | 6 +- arch/arm64/kvm/hyp/include/hyp/switch.h | 2 + arch/arm64/mm/mmu.c | 1 + arch/x86/Makefile | 4 + arch/x86/Makefile.um | 8 ++ arch/x86/kvm/svm/sev.c | 27 ++-- arch/x86/kvm/vmx/vmx.c | 9 -- arch/x86/kvm/x86.c | 7 ++ block/blk-zoned.c | 32 ++++- drivers/accel/amdxdna/aie2_ctx.c | 3 + drivers/accel/ivpu/ivpu_fw_log.c | 5 + drivers/accel/ivpu/ivpu_ipc.c | 2 +- drivers/accel/ivpu/ivpu_ms.c | 7 ++ drivers/base/bus.c | 11 +- drivers/block/zram/zram_drv.c | 2 +- drivers/clk/qcom/dispcc-sc8280xp.c | 4 +- drivers/clk/qcom/dispcc-x1e80100.c | 2 +- drivers/clk/samsung/clk-gs101.c | 2 +- drivers/cpufreq/amd-pstate.h | 1 - drivers/firmware/samsung/exynos-acpm.c | 13 +- drivers/gpio/gpio-mvebu.c | 4 +- drivers/gpio/gpio-rockchip.c | 4 +- drivers/gpio/gpio-zynq.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c | 6 +- .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c | 49 ++++++-- .../drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 5 + drivers/gpu/drm/amd/display/dc/basics/vector.c | 4 +- drivers/gpu/drm/amd/display/dc/bios/bios_parser.c | 15 ++- drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 81 ++++++++---- .../drm/amd/display/dc/bios/bios_parser_helper.h | 5 + drivers/gpu/drm/amd/display/dc/dc_dp_types.h | 2 +- drivers/gpu/drm/amd/display/dc/dce/dce_transform.c | 10 +- .../drm/amd/display/dc/dce110/dce110_opp_csc_v.c | 10 +- .../gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c | 3 +- .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 32 ++--- .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 32 ++--- .../gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c | 3 +- .../gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c | 1 - drivers/gpu/drm/drm_gem.c | 73 +++++------ drivers/gpu/drm/drm_ioctl.c | 3 +- drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 5 + drivers/gpu/drm/hyperv/hyperv_drm_modeset.c | 15 +-- drivers/gpu/drm/i915/display/intel_dp.c | 11 +- drivers/gpu/drm/i915/gem/i915_gem_phys.c | 19 ++- drivers/gpu/drm/imx/dcss/dcss-scaler.c | 3 + drivers/gpu/drm/v3d/v3d_gem.c | 8 ++ drivers/gpu/drm/v3d/v3d_perfmon.c | 24 +++- drivers/gpu/drm/v3d/v3d_sched.c | 17 ++- drivers/gpu/drm/vc4/vc4_validate_shaders.c | 13 +- drivers/gpu/drm/virtio/virtgpu_drv.c | 5 +- drivers/gpu/drm/virtio/virtgpu_submit.c | 4 +- drivers/gpu/drm/xe/display/xe_display.c | 11 +- drivers/gpu/drm/xe/xe_guc_submit.c | 2 +- drivers/gpu/drm/xe/xe_range_fence.c | 2 + drivers/hv/channel_mgmt.c | 1 + drivers/hv/hyperv_vmbus.h | 3 +- drivers/hv/vmbus_drv.c | 37 ++++-- drivers/i2c/busses/i2c-imx-lpi2c.c | 53 ++++---- drivers/i2c/busses/i2c-imx.c | 15 ++- drivers/i2c/busses/i2c-qcom-cci.c | 2 +- drivers/i2c/busses/i2c-stm32f7.c | 6 +- drivers/i2c/busses/i2c-tegra.c | 53 ++++---- drivers/i2c/i2c-dev.c | 9 +- drivers/infiniband/core/Makefile | 2 +- drivers/infiniband/core/iter.c | 43 +++++++ drivers/infiniband/core/ucaps.c | 8 +- drivers/infiniband/core/umem.c | 16 +++ drivers/infiniband/core/umem_dmabuf.c | 77 +++++++++--- drivers/infiniband/core/uverbs_std_types_dmah.c | 5 + drivers/infiniband/core/verbs.c | 38 ------ drivers/infiniband/hw/bnxt_re/qplib_res.c | 2 +- drivers/infiniband/hw/cxgb4/mem.c | 2 +- drivers/infiniband/hw/efa/efa_verbs.c | 2 +- drivers/infiniband/hw/erdma/erdma_verbs.c | 2 +- drivers/infiniband/hw/hns/hns_roce_alloc.c | 2 +- drivers/infiniband/hw/hns/hns_roce_mr.c | 4 + drivers/infiniband/hw/ionic/ionic_ibdev.h | 2 +- drivers/infiniband/hw/irdma/main.h | 2 +- drivers/infiniband/hw/irdma/verbs.c | 4 + drivers/infiniband/hw/mana/mana_ib.h | 2 +- drivers/infiniband/hw/mlx4/mr.c | 5 + drivers/infiniband/hw/mlx5/mem.c | 1 + drivers/infiniband/hw/mlx5/mr.c | 4 + drivers/infiniband/hw/mlx5/umr.c | 1 + drivers/infiniband/hw/mthca/mthca_provider.c | 2 +- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 2 +- drivers/infiniband/hw/qedr/verbs.c | 2 +- drivers/infiniband/hw/vmw_pvrdma/pvrdma.h | 2 +- drivers/infiniband/sw/rxe/rxe_verbs.c | 5 + drivers/infiniband/ulp/isert/ib_isert.c | 6 + drivers/infiniband/ulp/srp/ib_srp.c | 30 ++++- drivers/input/keyboard/atkbd.c | 15 +++ drivers/iommu/dma-iommu.c | 19 ++- drivers/md/dm-cache-policy-smq.c | 12 +- drivers/misc/fastrpc.c | 107 ++++++++++------ drivers/mmc/core/mmc.c | 4 +- drivers/mmc/host/dw_mmc-rockchip.c | 17 +++ drivers/mmc/host/litex_mmc.c | 20 ++- drivers/mmc/host/renesas_sdhi_internal_dmac.c | 1 + drivers/mmc/host/sdhci.c | 1 + drivers/net/bonding/bond_main.c | 4 +- drivers/net/ethernet/airoha/airoha_eth.c | 5 +- drivers/net/ethernet/amazon/ena/ena_com.c | 5 + drivers/net/ethernet/amd/pcnet32.c | 4 +- drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c | 14 ++- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- drivers/net/ethernet/freescale/fec_main.c | 3 +- drivers/net/ethernet/ibm/emac/core.c | 9 +- drivers/net/ethernet/intel/ice/ice_dpll.c | 2 + drivers/net/ethernet/intel/idpf/idpf_ptp.c | 2 +- drivers/net/ethernet/marvell/mv643xx_eth.c | 2 +- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 67 ++++++---- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 2 +- drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 1 + .../net/ethernet/marvell/octeontx2/af/rvu_npc.c | 36 +++--- .../net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c | 2 +- .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 2 +- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 +- drivers/net/ethernet/mellanox/mlx4/cq.c | 9 +- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 6 +- drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c | 10 +- drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 13 +- .../net/ethernet/mellanox/mlx5/core/irq_affinity.c | 5 +- drivers/net/ethernet/mellanox/mlx5/core/vport.c | 72 ++++++++--- drivers/net/ethernet/microchip/lan743x_main.c | 32 +++++ drivers/net/ethernet/microchip/lan743x_main.h | 1 + drivers/net/ethernet/realtek/rtase/rtase_main.c | 7 +- drivers/net/ethernet/wangxun/libwx/wx_type.h | 4 +- drivers/net/ethernet/wangxun/txgbe/txgbe_aml.c | 140 +++++++++++---------- drivers/net/ethernet/wangxun/txgbe/txgbe_aml.h | 2 +- drivers/net/ethernet/wangxun/txgbe/txgbe_ethtool.c | 5 +- drivers/net/ethernet/wangxun/txgbe/txgbe_main.c | 12 +- drivers/net/ethernet/wangxun/txgbe/txgbe_type.h | 13 +- drivers/net/hyperv/netvsc.c | 19 ++- drivers/net/mctp/mctp-usb.c | 28 +++-- drivers/net/phy/phy_device.c | 6 + drivers/net/phy/sfp.c | 1 + drivers/net/tap.c | 2 + drivers/net/tun.c | 1 + drivers/net/usb/r8152.c | 7 +- drivers/net/vxlan/vxlan_vnifilter.c | 5 +- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 6 + drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 56 +++++---- drivers/nvmem/core.c | 12 +- drivers/nvmem/layouts/onie-tlv.c | 3 +- drivers/pinctrl/pinctrl-mcp23s08_spi.c | 6 +- drivers/pmdomain/imx/gpc.c | 2 +- drivers/pmdomain/ti/ti_sci_pm_domains.c | 2 +- drivers/ptp/ptp_vclock.c | 14 ++- drivers/slimbus/qcom-ngd-ctrl.c | 122 +++++++++++------- drivers/soc/qcom/ice.c | 57 +++++++-- drivers/spi/spi-cadence-quadspi.c | 5 +- drivers/spi/spi-rzv2h-rspi.c | 3 +- drivers/staging/rtl8723bs/core/rtw_mlme.c | 10 +- drivers/tee/optee/supp.c | 107 +++++++++++----- drivers/tee/qcomtee/core.c | 6 +- drivers/tee/tee_shm.c | 2 +- drivers/thunderbolt/property.c | 6 + drivers/thunderbolt/xdomain.c | 14 ++- drivers/usb/serial/io_ti.c | 11 ++ drivers/usb/serial/kl5kusb105.c | 4 +- drivers/usb/serial/option.c | 3 + fs/erofs/internal.h | 5 +- fs/erofs/super.c | 3 +- fs/erofs/sysfs.c | 2 +- fs/erofs/zdata.c | 35 ++---- fs/fcntl.c | 8 +- fs/fhandle.c | 16 ++- fs/fuse/dev.c | 13 +- fs/mount.h | 10 +- fs/namespace.c | 6 +- fs/qnx6/dir.c | 8 +- fs/smb/server/oplock.c | 15 ++- fs/smb/server/smb2pdu.c | 11 ++ fs/xfs/scrub/cow_repair.c | 12 +- include/hyperv/hvgdk.h | 10 +- include/hyperv/hvgdk_mini.h | 1 + include/hyperv/hvhdk.h | 1 + include/linux/hugetlb.h | 8 -- include/linux/hyperv.h | 72 ++++++++--- include/linux/mlx5/vport.h | 4 +- include/linux/mm.h | 8 -- include/linux/tracepoint.h | 8 ++ include/net/act_api.h | 1 + include/net/bluetooth/l2cap.h | 1 + include/net/ip_vs.h | 3 +- include/net/netfilter/nf_conntrack_helper.h | 1 + include/net/sock.h | 1 + include/net/tc_act/tc_pedit.h | 1 - include/rdma/ib_umem.h | 48 +++---- include/rdma/ib_verbs.h | 48 ------- include/rdma/iter.h | 88 +++++++++++++ include/uapi/linux/tee.h | 1 + io_uring/io_uring.c | 2 +- io_uring/kbuf.c | 1 - io_uring/net.c | 3 +- ipc/shm.c | 10 +- kernel/dma/debug.c | 2 +- kernel/dma/direct.c | 2 +- kernel/futex/requeue.c | 6 + kernel/locking/rtmutex.c | 3 + kernel/locking/rtmutex_api.c | 2 +- kernel/pid.c | 8 +- kernel/sched/ext.c | 10 +- kernel/signal.c | 1 + kernel/time/time.c | 2 +- kernel/time/timer_migration.c | 8 +- kernel/trace/trace_probe.c | 2 - mm/cma.c | 7 +- mm/cma_debug.c | 3 +- mm/damon/lru_sort.c | 4 + mm/damon/ops-common.c | 4 +- mm/damon/reclaim.c | 4 + mm/huge_memory.c | 4 +- mm/hugetlb.c | 69 +++++----- mm/list_lru.c | 21 ++-- mm/memcontrol.c | 5 +- mm/memory-failure.c | 19 +-- mm/mincore.c | 10 +- net/6lowpan/iphc.c | 4 +- net/802/garp.c | 2 +- net/802/mrp.c | 9 ++ net/bluetooth/bnep/core.c | 50 +++++--- net/bluetooth/hci_sync.c | 5 + net/bluetooth/hci_sysfs.c | 6 +- net/bluetooth/iso.c | 61 ++++++--- net/bluetooth/l2cap_core.c | 46 +++++++ net/bluetooth/mgmt.c | 17 +-- net/bluetooth/rfcomm/core.c | 69 +++++++--- net/bluetooth/rfcomm/sock.c | 26 +++- net/bluetooth/sco.c | 20 ++- net/bridge/netfilter/ebt_dnat.c | 4 +- net/bridge/netfilter/ebt_redirect.c | 16 ++- net/bridge/netfilter/ebt_snat.c | 3 + net/bridge/netfilter/nft_meta_bridge.c | 2 + net/core/filter.c | 15 ++- net/core/gro.c | 5 + net/core/netdev-genl.c | 4 +- net/core/skbuff.c | 6 +- net/core/sock.c | 13 +- net/devlink/core.c | 2 + net/hsr/hsr_framereg.c | 4 +- net/ieee802154/6lowpan/tx.c | 5 + net/ipv4/inet_fragment.c | 3 + net/ipv4/ip_fragment.c | 3 - net/ipv4/ip_options.c | 4 + net/ipv4/netfilter/arp_tables.c | 15 +-- net/ipv4/netfilter/ip_tables.c | 15 +-- net/ipv4/netfilter/nf_nat_h323.c | 2 + net/ipv4/netfilter/nft_fib_ipv4.c | 2 +- net/ipv4/udp.c | 8 ++ net/ipv6/addrconf.c | 6 +- net/ipv6/anycast.c | 16 +-- net/ipv6/ip6_vti.c | 3 + net/ipv6/mcast.c | 8 +- net/ipv6/netfilter/ip6_tables.c | 15 +-- net/ipv6/netfilter/nft_fib_ipv6.c | 2 +- net/ipv6/sit.c | 1 + net/l2tp/l2tp_ppp.c | 92 ++++++++------ net/mac80211/mlme.c | 9 ++ net/mac80211/tests/chan-mode.c | 1 + net/mac80211/tx.c | 4 +- net/mptcp/options.c | 73 +++++------ net/mptcp/pm.c | 15 +-- net/mptcp/pm_userspace.c | 14 ++- net/mptcp/protocol.c | 4 + net/mptcp/protocol.h | 7 +- net/mptcp/sockopt.c | 15 ++- net/netfilter/ipvs/ip_vs_ctl.c | 13 +- net/netfilter/ipvs/ip_vs_proto_sctp.c | 18 +-- net/netfilter/ipvs/ip_vs_proto_tcp.c | 21 ++-- net/netfilter/ipvs/ip_vs_proto_udp.c | 20 ++- net/netfilter/ipvs/ip_vs_sched.c | 14 +-- net/netfilter/nf_conntrack_helper.c | 19 +++ net/netfilter/nf_conntrack_irc.c | 4 +- net/netfilter/nf_log_syslog.c | 4 +- net/netfilter/nf_nat_core.c | 2 + net/netfilter/nf_nat_sip.c | 1 + net/netfilter/nf_synproxy_core.c | 24 +++- net/netfilter/nfnetlink_log.c | 23 +++- net/netfilter/nfnetlink_queue.c | 64 ++++++++-- net/netfilter/nft_ct.c | 8 +- net/netfilter/nft_ct_fast.c | 2 +- net/netfilter/nft_exthdr.c | 3 + net/netfilter/nft_fib.c | 6 + net/netfilter/nft_tunnel.c | 2 +- net/netfilter/xt_NFQUEUE.c | 2 +- net/netlabel/netlabel_unlabeled.c | 30 ++--- net/openvswitch/datapath.c | 1 + net/phonet/pn_dev.c | 2 +- net/qrtr/af_qrtr.c | 4 +- net/rds/ib_cm.c | 1 + net/rds/ib_send.c | 2 + net/rds/info.c | 2 +- net/rxrpc/input.c | 26 ++-- net/sched/act_api.c | 7 +- net/sched/act_pedit.c | 77 ++++++------ net/sctp/bind_addr.c | 11 +- net/sctp/diag.c | 17 +-- net/sctp/input.c | 8 ++ net/sctp/sm_make_chunk.c | 12 +- net/sctp/sm_statefuns.c | 6 +- net/sctp/stream.c | 6 +- net/smc/af_smc.c | 17 ++- net/socket.c | 11 +- net/unix/af_unix.c | 11 +- net/vmw_vsock/virtio_transport_common.c | 11 +- net/vmw_vsock/vmci_transport.c | 4 +- net/wireless/nl80211.c | 3 + net/wireless/scan.c | 9 +- net/xdp/xsk.c | 11 +- net/xfrm/espintcp.c | 4 + net/xfrm/xfrm_iptfs.c | 11 +- net/xfrm/xfrm_policy.c | 13 +- scripts/Makefile.compiler | 2 +- scripts/generate_rust_target.rs | 8 +- sound/core/pcm_native.c | 7 +- sound/core/seq/seq_dummy.c | 15 ++- sound/core/timer.c | 17 +-- sound/soc/codecs/wm_adsp.c | 3 + sound/soc/fsl/fsl_sai.c | 2 +- sound/soc/sof/amd/acp-ipc.c | 4 +- sound/soc/sof/amd/acp.h | 2 + .../test.d/dynevent/eprobes_syntax_errors.tc | 2 +- tools/testing/selftests/kselftest_harness.h | 1 + tools/testing/selftests/net/mptcp/mptcp_join.sh | 4 + tools/verification/rv/src/in_kernel.c | 67 +++++----- tools/verification/rvgen/__main__.py | 10 +- tools/verification/rvgen/rvgen/ltl2ba.py | 9 +- virt/kvm/kvm_main.c | 3 +- 348 files changed, 3127 insertions(+), 1574 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/325 bpf: Free reuseport cBPF prog after RCU grace period.
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 18fc650ccd7fe3376eca89203668cfb8268f60df ]
Eulgyu Kim reported the splat below with a repro. [0]
The repro sets up a UDP reuseport group with a cBPF prog and replaces it with a new one while another thread is sending a UDP packet to the group.
The reuseport prog is freed by sk_reuseport_prog_free(). bpf_prog_put() is called for "e"BPF prog to destruct through multiple stages while cBPF prog is freed immediately by bpf_release_orig_filter() and bpf_prog_free().
If a reuseport prog is detached from the setsockopt() path (reuseport_attach_prog() or reuseport_detach_prog()), sk_reuseport_prog_free() is called without waiting for RCU readers to complete, resulting in various bugs.
Let's defer freeing the reuseport cBPF prog after one RCU grace period.
Note "e"BPF prog is safe as is unless the fast path starts to touch fields destroyed in bpf_prog_put_deferred() and __bpf_prog_put_noref().
[0]:
BUG: KASAN: vmalloc-out-of-bounds in reuseport_select_sock+0xedc/0x1220 net/core/sock_reuseport.c:596 Read of size 4 at addr ffffc9000051e004 by task slowme/10208 CPU: 6 UID: 1000 PID: 10208 Comm: slowme Not tainted 7.0.0-geb7ac95ff75e #32 PREEMPT(full) Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: <IRQ> dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xca/0x240 mm/kasan/report.c:482 kasan_report+0x118/0x150 mm/kasan/report.c:595 reuseport_select_sock+0xedc/0x1220 net/core/sock_reuseport.c:596 udp4_lib_lookup2+0x3bc/0x950 net/ipv4/udp.c:495 __udp4_lib_lookup+0x768/0xe20 net/ipv4/udp.c:723 __udp4_lib_lookup_skb+0x297/0x390 net/ipv4/udp.c:752 __udp4_lib_rcv+0x1312/0x2620 net/ipv4/udp.c:2752 ip_protocol_deliver_rcu+0x282/0x440 net/ipv4/ip_input.c:207 ip_local_deliver_finish+0x3bb/0x6f0 net/ipv4/ip_input.c:241 NF_HOOK+0x30c/0x3a0 include/linux/netfilter.h:318 NF_HOOK+0x30c/0x3a0 include/linux/netfilter.h:318 __netif_receive_skb_one_core net/core/dev.c:6181 [inline] __netif_receive_skb net/core/dev.c:6294 [inline] process_backlog+0xaa4/0x1960 net/core/dev.c:6645 __napi_poll+0xae/0x340 net/core/dev.c:7709 napi_poll net/core/dev.c:7772 [inline] net_rx_action+0x5d7/0xf50 net/core/dev.c:7929 handle_softirqs+0x22b/0x870 kernel/softirq.c:622 do_softirq+0x76/0xd0 kernel/softirq.c:523 </IRQ> <TASK> __local_bh_enable_ip+0xf8/0x130 kernel/softirq.c:450 local_bh_enable include/linux/bottom_half.h:33 [inline] rcu_read_unlock_bh include/linux/rcupdate.h:924 [inline] __dev_queue_xmit+0x1dd7/0x3710 net/core/dev.c:4890 neigh_output include/net/neighbour.h:556 [inline] ip_finish_output2+0xca9/0x1070 net/ipv4/ip_output.c:237 NF_HOOK_COND include/linux/netfilter.h:307 [inline] ip_output+0x29f/0x450 net/ipv4/ip_output.c:438 ip_send_skb+0x45/0xc0 net/ipv4/ip_output.c:1508 udp_send_skb+0xb04/0x1510 net/ipv4/udp.c:1195 udp_sendmsg+0x1a71/0x2350 net/ipv4/udp.c:1485 sock_sendmsg_nosec net/socket.c:727 [inline] __sock_sendmsg net/socket.c:742 [inline] __sys_sendto+0x554/0x680 net/socket.c:2206 __do_sys_sendto net/socket.c:2213 [inline] __se_sys_sendto net/socket.c:2209 [inline] __x64_sys_sendto+0xde/0x100 net/socket.c:2209 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x160/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x415a2d Code: b3 66 2e 0f 1f 84 00 00 00 00 00 66 90 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f6bc31e41e8 EFLAGS: 00000212 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 00007f6bc31e4cdc RCX: 0000000000415a2d RDX: 0000000000000001 RSI: 00007f6bc31e421f RDI: 0000000000000003 RBP: 00007f6bc31e4240 R08: 00007f6bc31e4220 R09: 0000000000000010 R10: 0000000000000000 R11: 0000000000000212 R12: 00007f6bc31e46c0 R13: ffffffffffffffb8 R14: 0000000000000000 R15: 00007ffc9b0d70b0 </TASK>
--- net/core/filter.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
net/core/filter.c +12 -3
@@ -1660,15 +1660,24 @@ int sk_reuseport_attach_bpf(u32 ufd, struct sock *sk)return err; } +static void sk_reuseport_prog_free_rcu (struct rcu_head *rcu) +{ + struct bpf_prog_aux *aux = container_of(rcu, struct bpf_prog_aux, rcu); +struct bpf_prog *prog = aux->prog; + +bpf_release_orig_filter (prog); +bpf_prog_free (prog); +} +void sk_reuseport_prog_free (struct bpf_prog *prog) {if (!prog)return ; -if (prog->type ==BPF_PROG_TYPE_SK_REUSEPORT ) -bpf_prog_put (prog); +if (bpf_prog_was_classic (prog)) +call_rcu (&prog->aux->rcu, sk_reuseport_prog_free_rcu);else -bpf_prog_destroy (prog); +bpf_prog_put (prog); } static inline int __bpf_try_make_writable(struct sk_buff *skb,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2/325 ARM: group is_permission_fault() with is_translation_fault()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King (Oracle) <[email protected]>
commit dea20281ac88226615761c570c8ff7adc18e6ac2 upstream.
Group is_permission_fault() with is_translation_fault(), which is needed to use is_permission_fault() in __do_kernel_fault(). As this is static inline, there is no need for this to be under CONFIG_MMU.
--- arch/arm/mm/fault.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
arch/arm/mm/fault.c +13 -13
@@ -128,6 +128,19 @@ static inline bool is_translation_fault(unsigned int fsr)return false; } +static inline bool is_permission_fault (unsigned int fsr) +{ +int fs =fsr_fs (fsr); +#ifdef CONFIG_ARM_LPAE +if ((fs &FS_MMU_NOLL_MASK ) ==FS_PERM_NOLL ) +return true; +#else +if (fs ==FS_L1_PERM || fs ==FS_L2_PERM ) +return true; +#endif +return false; +} +static void die_kernel_fault (const char *msg,struct mm_struct *mm,unsigned long addr,unsigned int fsr,struct pt_regs *regs)
@@ -225,19 +238,6 @@ void do_bad_area(unsigned long addr, unsigned int fsr, struct pt_regs *regs) } #ifdef CONFIG_MMU -static inline bool is_permission_fault(unsigned int fsr) -{ - int fs = fsr_fs(fsr); -#ifdef CONFIG_ARM_LPAE - if ((fs & FS_MMU_NOLL_MASK) == FS_PERM_NOLL) - return true; -#else - if (fs == FS_L1_PERM || fs == FS_L2_PERM) - return true; -#endif - return false; -} - #ifdef CONFIG_CPU_TTBR0_PAN static inline bool ttbr0_usermode_access_allowed(struct pt_regs *regs) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 3/325 ARM: allow __do_kernel_fault() to report execution of memory faults
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King (Oracle) <[email protected]>
commit 40b466db1dffb41f0529035c59c5739636d0e5b8 upstream.
Allow __do_kernel_fault() to detect the execution of memory, so we can provide the same fault message as do_page_fault() would do. This is required when we split the kernel address fault handling from the main do_page_fault() code path.
--- arch/arm/mm/fault.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mm/fault.c +2 -0
@@ -175,6 +175,8 @@ __do_kernel_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,*/ if (addr <PAGE_SIZE ) { msg ="NULL pointer dereference" ; + }else if (is_permission_fault (fsr) && fsr &FSR_LNX_PF ) { + msg ="execution of memory" ; }else {if (is_translation_fault (fsr) &&kfence_handle_page_fault (addr,is_write_fault (fsr), regs))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 4/325 ARM: fix hash_name() fault
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King (Oracle) <[email protected]>
commit 7733bc7d299d682f2723dc38fc7f370b9bf973e9 upstream.
Zizhi Wo reports:
"During the execution of hash_name()->load_unaligned_zeropad(), a
potential memory access beyond the PAGE boundary may occur. For example, when the filename length is near the PAGE_SIZE boundary. This triggers a page fault, which leads to a call to do_page_fault()->mmap_read_trylock(). If we can't acquire the lock, we have to fall back to the mmap_read_lock() path, which calls might_sleep(). This breaks RCU semantics because path lookup occurs under an RCU read-side critical section."
This is seen with CONFIG_DEBUG_ATOMIC_SLEEP=y and CONFIG_KFENCE=y.
Kernel addresses (with the exception of the vectors/kuser helper page) do not have VMAs associated with them. If the vectors/kuser helper page faults, then there are two possibilities:
1. if the fault happened while in kernel mode, then we're basically dead, because the CPU won't be able to vector through this page to handle the fault.
2. if the fault happened while in user mode, that means the page was protected from user access, and we want to fault anyway.
Thus, we can handle kernel addresses from any context entirely separately without going anywhere near the mmap lock. This gives us an entirely non-sleeping path for all kernel mode kernel address faults.
As we handle the kernel address faults before interrupts are enabled, this change has the side effect of improving the branch predictor hardening, but does not completely solve the issue.
--- arch/arm/mm/fault.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
arch/arm/mm/fault.c +35 -0
@@ -261,6 +261,35 @@ static inline bool ttbr0_usermode_access_allowed(struct pt_regs *regs) }#endif +static int __kprobes +do_kernel_address_page_fault (struct mm_struct *mm,unsigned long addr, +unsigned int fsr,struct pt_regs *regs) +{ +if (user_mode (regs)) { +/* +* Fault from user mode for a kernel space address. User mode +* should not be faulting in kernel space, which includes the +* vector/khelper page. Send a SIGSEGV. +*/ +__do_user_fault (addr, fsr,SIGSEGV ,SEGV_MAPERR , regs); + }else { +/* +* Fault from kernel mode. Enable interrupts if they were +* enabled in the parent context. Section (upper page table) +* translation faults are handled via do_translation_fault(), +* so we will only get here for a non-present kernel space +* PTE or PTE permission fault. This may happen in exceptional +* circumstances and need the fixup tables to be walked. +*/ +if (interrupts_enabled (regs)) +local_irq_enable (); + +__do_kernel_fault (mm, addr, fsr, regs); + } + +return 0 ; +} +static int __kprobes do_page_fault (unsigned long addr,unsigned int fsr,struct pt_regs *regs) {
@@ -274,6 +303,12 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)if (kprobe_page_fault (regs, fsr))return 0 ; +/* +* Handle kernel addresses faults separately, which avoids touching +* the mmap lock from contexts that are not able to sleep. +*/ +if (addr >=TASK_SIZE ) +return do_kernel_address_page_fault (mm, addr, fsr, regs);/* Enable interrupts if they were enabled in the parent context. */ if (interrupts_enabled (regs))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 5/325 ARM: fix branch predictor hardening
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King (Oracle) <[email protected]>
commit fd2dee1c6e2256f726ba33fd3083a7be0efc80d3 upstream.
__do_user_fault() may be called with indeterminent interrupt enable state, which means we may be preemptive at this point. This causes problems when calling harden_branch_predictor(). For example, when called from a data abort, do_alignment_fault()->do_bad_area().
Move harden_branch_predictor() out of __do_user_fault() and into the calling contexts.
Moving it into do_kernel_address_page_fault(), we can be sure that interrupts will be disabled here.
Converting do_translation_fault() to use do_kernel_address_page_fault() rather than do_bad_area() means that we keep branch predictor handling for translation faults. Interrupts will also be disabled at this call site.
do_sect_fault() needs special handling, so detect user mode accesses to kernel-addresses, and add an explicit call to branch predictor hardening.
Finally, add branch predictor hardening to do_alignment() for the faulting case (user mode accessing kernel addresses) before interrupts are enabled.
This should cover all cases where harden_branch_predictor() is called, ensuring that it is always has interrupts disabled, also ensuring that it is called early in each call path.
--- arch/arm/mm/alignment.c | 6 +++++- arch/arm/mm/fault.c | 39 ++++++++++++++++++++++++++------------- 2 files changed, 31 insertions(+), 14 deletions(-)
arch/arm/mm/alignment.c +5 -1
@@ -19,10 +19,11 @@#include <linux/init.h> #include <linux/sched/signal.h> #include <linux/uaccess.h> +#include <linux/unaligned.h> #include <asm/cp15.h> #include <asm/system_info.h> -#include <linux/unaligned.h> +#include <asm/system_misc.h> #include <asm/opcodes.h> #include "fault.h"
@@ -809,6 +810,9 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)int thumb2_32b =0 ;int fault; +if (addr >=TASK_SIZE &&user_mode (regs)) +harden_branch_predictor (); +if (interrupts_enabled (regs))local_irq_enable ();
arch/arm/mm/fault.c +26 -13
@@ -198,9 +198,6 @@ __do_user_fault(unsigned long addr, unsigned int fsr, unsigned int sig, {struct task_struct *tsk = current; -if (addr >TASK_SIZE ) -harden_branch_predictor (); -#ifdef CONFIG_DEBUG_USER if (((user_debug &UDBG_SEGV ) && (sig ==SIGSEGV )) || ((user_debug &UDBG_BUS ) && (sig ==SIGBUS ))) {
@@ -269,8 +266,10 @@ do_kernel_address_page_fault(struct mm_struct *mm, unsigned long addr,/* * Fault from user mode for a kernel space address. User mode * should not be faulting in kernel space, which includes the -* vector/khelper page. Send a SIGSEGV. +* vector/khelper page. Handle the branch predictor hardening +* while interrupts are still disabled, then send a SIGSEGV. */ +harden_branch_predictor ();__do_user_fault (addr, fsr,SIGSEGV ,SEGV_MAPERR , regs); }else {/*
@@ -485,16 +484,20 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)* We enter here because the first level page table doesn't contain * a valid entry for the address. * -* If the address is in kernel space (>= TASK_SIZE), then we are -* probably faulting in the vmalloc() area. +* If this is a user address (addr < TASK_SIZE), we handle this as a +* normal page fault. This leaves the remainder of the function to handle +* kernel address translation faults. * -* If the init_task's first level page tables contains the relevant -* entry, we copy the it to this task. If not, we send the process -* a signal, fixup the exception, or oops the kernel. +* Since user mode is not permitted to access kernel addresses, pass these +* directly to do_kernel_address_page_fault() to handle. * -* NOTE! We MUST NOT take any locks for this case. We may be in an -* interrupt or a critical region, and should only copy the information -* from the master page table, nothing more. +* Otherwise, we're probably faulting in the vmalloc() area, so try to fix +* that up. Note that we must not take any locks or enable interrupts in +* this case. +* +* If vmalloc() fixup fails, that means the non-leaf page tables did not +* contain an entry for this address, so handle this via +* do_kernel_address_page_fault(). */ #ifdef CONFIG_MMU static int __kprobes
@@ -560,7 +563,8 @@ do_translation_fault(unsigned long addr, unsigned int fsr,return 0 ; bad_area: -do_bad_area (addr, fsr, regs); +do_kernel_address_page_fault (current->mm, addr, fsr, regs); + return 0; }#else /* CONFIG_MMU */
@@ -580,7 +584,16 @@ do_translation_fault(unsigned long addr, unsigned int fsr,static int do_sect_fault (unsigned long addr,unsigned int fsr,struct pt_regs *regs) { +/* +* If this is a kernel address, but from user mode, then userspace +* is trying bad stuff. Invoke the branch predictor handling. +* Interrupts are disabled here. +*/ +if (addr >=TASK_SIZE &&user_mode (regs)) +harden_branch_predictor (); +do_bad_area (addr, fsr, regs); +return 0 ; }#endif /* CONFIG_ARM_LPAE */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 6/325 KVM: arm64: Take the SRCU lock for page table walks in fault injection and AT emulation
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hyunwoo Kim <[email protected]>
commit f2ca45b50d4216c9cc7ffabf50d9ad1932209251 upstream.
walk_s1() and kvm_walk_nested_s2() expect to be called while holding kvm->srcu to guard against memslot changes. While this is generally the case, __kvm_at_s12() and __kvm_find_s1_desc_level() call into the respective walkers without taking kvm->srcu.
Fix by acquiring kvm->srcu prior to the table walk in both instances.
[ Hyunwoo Kim: __kvm_at_s12() still returns void in 6.18.y, so the
surrounding context differs from upstream (return; instead of return ret;); the added scoped_guard() is unchanged. ]
--- arch/arm64/kvm/at.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm64/kvm/at.c +4 -2
@@ -1528,7 +1528,8 @@ void __kvm_at_s12(struct kvm_vcpu *vcpu,/* Do the stage-2 translation */ ipa = (par &GENMASK_ULL (47 ,12 )) | (vaddr &GENMASK_ULL (11 ,0 )); out.esr =0 ; - ret =kvm_walk_nested_s2 (vcpu, ipa, &out); +scoped_guard (srcu, &vcpu->kvm->srcu) + ret = kvm_walk_nested_s2(vcpu, ipa, &out);if (ret <0 )return ;
@@ -1623,7 +1624,8 @@ int __kvm_find_s1_desc_level(struct kvm_ }/* Walk the guest's PT, looking for a match along the way */ - ret =walk_s1 (vcpu, &wi, &wr, va); +scoped_guard (srcu, &vcpu->kvm->srcu) + ret = walk_s1(vcpu, &wi, &wr, va);switch (ret) {case -EINTR :/* We interrupted the walk on a match, return the level */
Greg Kroah-Hartman
maintainerPATCH 7/325 i2c: dev: prevent integer overflow in I2C_TIMEOUT ioctl
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mingyu Wang <[email protected]>
commit 617eb7c0961a8dfcfc811844a6396e406b2923ea upstream.
While fuzzing with Syzkaller, a persistent schedule_timeout: wrong timeout value warning was observed, accompanied by SMBus controller state machine corruption.
The I2C_TIMEOUT ioctl accepts a user-provided timeout in multiples of 10 ms. The user argument is checked against INT_MAX, but it is subsequently multiplied by 10 before being passed to msecs_to_jiffies().
A malicious user can pass a large value (e.g., 429496729) that passes the arg > INT_MAX check but overflows when multiplied by 10. This results in a truncated 32-bit unsigned value that bypasses the internal (int)m < 0 check in msecs_to_jiffies().
The truncated value is then assigned to client->adapter->timeout (a signed 32-bit int), which is reinterpreted as a negative number. When passed to wait_for_completion_timeout(), this negative value undergoes sign extension to a 64-bit unsigned long, triggering the schedule_timeout warning and causing premature returns. This leaves the SMBus state machine in an unrecoverable state, constituting a local Denial of Service (DoS).
Fix this by bounding the user argument to INT_MAX / 10.
--- drivers/i2c/i2c-dev.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/i2c/i2c-dev.c +5 -4
@@ -487,12 +487,13 @@ static long i2cdev_ioctl(struct file *fi client->adapter->retries = arg;break ;case I2C_TIMEOUT : -if (arg >INT_MAX ) +/* +* For historical reasons, user-space sets the timeout value in +* units of 10 ms. +*/ +if (arg >INT_MAX /10 )return -EINVAL ; -/* For historical reasons, user-space sets the timeout -* value in units of 10 ms. -*/ client->adapter->timeout =msecs_to_jiffies (arg *10 );break ;default :
Greg Kroah-Hartman
maintainerPATCH 8/325 ipv6: mcast: Fix use-after-free when processing MLD queries
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
commit 791c91dc7a9dfb2457d5e29b8216a6484b9c4b40 upstream.
When processing an MLD query, a pointer to the multicast group address is retrieved when initially parsing the packet. This pointer is later dereferenced without being reloaded despite the fact that the skb header might have been reallocated following the pskb_may_pull() calls, leading to a use-after-free [1].
Fix by copying the multicast group address when the packet is initially parsed.
[1]
BUG: KASAN: slab-use-after-free in __mld_query_work (net/ipv6/mcast.c:1512) Read of size 8 at addr ffff8881154b8e90 by task kworker/4:1/118 Workqueue: mld mld_query_work Call Trace: <TASK> dump_stack_lvl (lib/dump_stack.c:94 lib/dump_stack.c:120)
print_address_description.constprop.0 (mm/kasan/report.c:378) print_report (mm/kasan/report.c:482)kasan_report (mm/kasan/report.c:595)__mld_query_work (net/ipv6/mcast.c:1512) mld_query_work (net/ipv6/mcast.c:1563) process_one_work (kernel/workqueue.c:3314) worker_thread (kernel/workqueue.c:3397 kernel/workqueue.c:3478) 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>
[...]
Freed by task 118: kasan_save_stack (mm/kasan/common.c:57) kasan_save_track (mm/kasan/common.c:78) kasan_save_free_info (mm/kasan/generic.c:584) __kasan_slab_free (mm/kasan/common.c:253 mm/kasan/common.c:285) kfree (./include/linux/kasan.h:235 mm/slub.c:2689 mm/slub.c:6251 mm/slub.c:6566) pskb_expand_head (net/core/skbuff.c:2335) __pskb_pull_tail (net/core/skbuff.c:2878 (discriminator 4)) __mld_query_work (net/ipv6/mcast.c:1495 (discriminator 1))
mld_query_work (net/ipv6/mcast.c:1563) process_one_work (kernel/workqueue.c:3314) worker_thread (kernel/workqueue.c:3397 kernel/workqueue.c:3478) 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)
--- net/ipv6/mcast.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/ipv6/mcast.c +4 -4
@@ -1424,9 +1424,9 @@ out:static void __mld_query_work (struct sk_buff *skb) {struct mld2_query *mlh2 =NULL ; -const struct in6_addr *group;unsigned long max_delay;struct inet6_dev *idev; +struct in6_addr group;struct ifmcaddr6 *ma;struct mld_msg *mld;int group_type;
@@ -1458,8 +1458,8 @@ static void __mld_query_work(struct sk_b goto kfree_skb; mld = (struct mld_msg *)icmp6_hdr (skb); - group = &mld->mld_mca; - group_type =ipv6_addr_type (group); + group = mld->mld_mca; + group_type =ipv6_addr_type (&group);if (group_type !=IPV6_ADDR_ANY && !(group_type&IPV6_ADDR_MULTICAST ))
@@ -1509,7 +1509,7 @@ static void __mld_query_work(struct sk_b } }else {for_each_mc_mclock (idev, ma) { -if (!ipv6_addr_equal (group, &ma->mca_addr)) +if (!ipv6_addr_equal (&group, &ma->mca_addr))continue ;if (ma->mca_flags &MAF_TIMER_RUNNING ) {/* gsquery <- gsquery && mark */
Greg Kroah-Hartman
maintainerPATCH 9/325 net/smc: fix sleep-inside-lock in __smc_setsockopt() causing local DoS
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolò Coccia <[email protected]>
commit a3fdd924d88c30b9f488636ce0e4696012cf5511 upstream.
A logic flaw in __smc_setsockopt() allows a local unprivileged user to cause a Denial of Service (DoS) by holding the socket lock indefinitely.
The function __smc_setsockopt() calls copy_from_sockptr() while holding lock_sock(sk). By passing a userfaultfd-monitored memory page (or FUSE-backed memory on systems where unprivileged userfaultfd is disabled) as the optval, an attacker can halt execution during the copy operation, keeping the lock held.
Combined with asynchronous tear-down operations like shutdown(), this exhausts the kernel wq (kworkers) and triggers the hung task watchdog.
[ 240.123456] INFO: task kworker/u8:2 blocked for more than 120 seconds. [ 240.123489] Call Trace: [ 240.123501] smc_shutdown+... [ 240.123512] lock_sock_nested+...
This patch moves the user-space copy outside the lock_sock() critical section to prevent the issue.
--- net/smc/af_smc.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
net/smc/af_smc.c +8 -9
@@ -3061,18 +3061,17 @@ static int __smc_setsockopt(struct socke smc =smc_sk (sk); +/* pre-fetch user data outside the lock */ +if (optname ==SMC_LIMIT_HS ) { +if (optlen <sizeof (int )) +return -EINVAL ; +if (copy_from_sockptr (&val, optval,sizeof (int ))) +return -EFAULT ; + } +lock_sock (sk);switch (optname) {case SMC_LIMIT_HS : -if (optlen <sizeof (int )) { - rc = -EINVAL ; -break ; - } -if (copy_from_sockptr (&val, optval,sizeof (int ))) { - rc = -EFAULT ; -break ; - } - smc->limit_smc_hs = !!val; rc =0 ;break ;
Greg Kroah-Hartman
maintainerPATCH 10/325 tee: optee: prevent use-after-free when the client exits before the supplicant
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amirreza Zarrabi <[email protected]>
[ Upstream commit 387a926ee166814611acecb960207fe2f3c4fd3e ]
Commit 70b0d6b0a199 ("tee: optee: Fix supplicant wait loop") made the client wait as killable so it can be interrupted during shutdown or after a supplicant crash. This changes the original lifetime expectations:
the client task can now terminate while the supplicant is still processing its request.
If the client exits first it removes the request from its queue and kfree()s it, while the request ID remains in supp->idr. A subsequent lookup on the supplicant path then dereferences freed memory, leading to a use-after-free.
Serialise access to the request with supp->mutex:
* Hold supp->mutex in optee_supp_recv() and optee_supp_send() while looking up and touching the request.
* Let optee_supp_thrd_req() notice that the client has terminated and signal optee_supp_send() accordingly.
With these changes the request cannot be freed while the supplicant still has a reference, eliminating the race.
--- drivers/tee/optee/supp.c | 107 +++++++++++++++++++++++++++------------ 1 file changed, 74 insertions(+), 33 deletions(-)
drivers/tee/optee/supp.c +74 -33
@@ -10,7 +10,11 @@struct optee_supp_req {struct list_head link; +int id; +bool in_queue; +bool processed; +u32 func;u32 ret;size_t num_params;
@@ -19,6 +23,9 @@ struct optee_supp_req {struct completion c; }; +/* It is temporary request used for revoked pending request in supp->idr. */ +#define INVALID_REQ_PTR ((struct optee_supp_req *)ERR_PTR(-EBADF)) +void optee_supp_init (struct optee_supp *supp) {memset (supp,0 ,sizeof (*supp));
@@ -39,21 +46,23 @@ void optee_supp_release(struct optee_supp *supp) {int id;struct optee_supp_req *req; -struct optee_supp_req *req_tmp;mutex_lock (&supp->mutex); -/* Abort all request retrieved by supplicant */ +/* Abort all request */ idr_for_each_entry (&supp->idr, req, id) {idr_remove (&supp->idr, id); - req->ret =TEEC_ERROR_COMMUNICATION ; -complete (&req->c); - } +/* Skip if request was already marked invalid */ +if (IS_ERR (req)) +continue ; -/* Abort all queued requests */ -list_for_each_entry_safe (req, req_tmp, &supp->reqs, link) { -list_del (&req->link); - req->in_queue = false; +/* For queued requests where supplicant has not seen it */ +if (req->in_queue) { +list_del (&req->link); + req->in_queue = false; + } + + req->processed = true; req->ret =TEEC_ERROR_COMMUNICATION ;complete (&req->c); }
@@ -100,8 +109,16 @@ u32 optee_supp_thrd_req(struct tee_context *ctx, u32 func, size_t num_params,/* Insert the request in the request list */ mutex_lock (&supp->mutex); + req->id =idr_alloc (&supp->idr, req,1 ,0 ,GFP_KERNEL ); +if (req->id <0 ) { +mutex_unlock (&supp->mutex); +kfree (req); +return TEEC_ERROR_OUT_OF_MEMORY ; + } +list_add_tail (&req->link, &supp->reqs); req->in_queue = true; + req->processed = false;mutex_unlock (&supp->mutex);/* Tell an eventual waiter there's a new request */
@@ -117,21 +134,43 @@ u32 optee_supp_thrd_req(struct tee_context *ctx, u32 func, size_t num_params,if (wait_for_completion_killable (&req->c)) {mutex_lock (&supp->mutex);if (req->in_queue) { +/* Supplicant has not seen this request yet. */ +idr_remove (&supp->idr, req->id);list_del (&req->link); req->in_queue = false; + + ret =TEEC_ERROR_COMMUNICATION ; + }else if (req->processed) { +/* +* Supplicant has processed this request. Ignore the +* kill signal for now and submit the result. req is not +* in supp->reqs (removed by supp_pop_entry()) nor in +* supp->idr (removed by supp_pop_req()). +*/ + ret = req->ret; + }else { +/* +* Supplicant is in the middle of processing this +* request. Replace req with INVALID_REQ_PTR so that +* the ID remains busy, causing optee_supp_send() to +* fail on the next call to supp_pop_req() with this ID. +*/ +idr_replace (&supp->idr,INVALID_REQ_PTR , req->id); + ret =TEEC_ERROR_COMMUNICATION ; } +mutex_unlock (&supp->mutex); - req->ret =TEEC_ERROR_COMMUNICATION ; + }else { + ret = req->ret; } - ret = req->ret;kfree (req);return ret; }static struct optee_supp_req *supp_pop_entry (struct optee_supp *supp, -int num_params,int *id) +int num_params) {struct optee_supp_req *req;
@@ -153,10 +192,6 @@ static struct optee_supp_req *supp_pop_entry(struct optee_supp *supp,return ERR_PTR (-EINVAL ); } - *id =idr_alloc (&supp->idr, req,1 ,0 ,GFP_KERNEL ); -if (*id <0 ) -return ERR_PTR (-ENOMEM ); -list_del (&req->link); req->in_queue = false;
@@ -214,7 +249,6 @@ int optee_supp_recv(struct tee_context *ctx, u32 *func, u32 *num_params,struct optee *optee =tee_get_drvdata (teedev);struct optee_supp *supp = &optee->supp;struct optee_supp_req *req =NULL ; -int id;size_t num_meta;int rc;
@@ -224,15 +258,11 @@ int optee_supp_recv(struct tee_context *ctx, u32 *func, u32 *num_params,while (true) {mutex_lock (&supp->mutex); - req =supp_pop_entry (supp, *num_params - num_meta, &id); + req =supp_pop_entry (supp, *num_params - num_meta); +if (req) +break ;/* Keep mutex held. */ mutex_unlock (&supp->mutex); -if (req) { -if (IS_ERR (req)) -return PTR_ERR (req); -break ; - } -/* * If we didn't get a request we'll block in * wait_for_completion() to avoid needless spinning.
@@ -245,6 +275,13 @@ int optee_supp_recv(struct tee_context *ctx, u32 *func, u32 *num_params,return -ERESTARTSYS ; } +/* supp->mutex held and req != NULL. */ + +if (IS_ERR (req)) { +mutex_unlock (&supp->mutex); +return PTR_ERR (req); + } +if (num_meta) {/* * tee-supplicant support meta parameters -> requsts can be
@@ -252,13 +289,11 @@ int optee_supp_recv(struct tee_context *ctx, u32 *func, u32 *num_params,*/ param->attr =TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INOUT |TEE_IOCTL_PARAM_ATTR_META ; - param->u.value.a = id; + param->u.value.a = req->id; param->u.value.b =0 ; param->u.value.c =0 ; }else { -mutex_lock (&supp->mutex); - supp->req_id = id; -mutex_unlock (&supp->mutex); + supp->req_id = req->id; } *func = req->func;
@@ -266,6 +301,7 @@ int optee_supp_recv(struct tee_context *ctx, u32 *func, u32 *num_params,memcpy (param + num_meta, req->param,sizeof (struct tee_param ) * req->num_params); +mutex_unlock (&supp->mutex);return 0 ; }
@@ -297,12 +333,17 @@ static struct optee_supp_req *supp_pop_req(struct optee_supp *supp,if (!req)return ERR_PTR (-ENOENT ); +/* optee_supp_thrd_req() already returned to optee. */ +if (IS_ERR (req)) + goto failed_req; +if ((num_params - nm) != req->num_params)return ERR_PTR (-EINVAL ); + *num_meta = nm; +failed_req:idr_remove (&supp->idr, id); supp->req_id =-1 ; - *num_meta = nm;return req; }
@@ -328,10 +369,9 @@ int optee_supp_send(struct tee_context *ctx, u32 ret, u32 num_params,mutex_lock (&supp->mutex); req =supp_pop_req (supp, num_params, param, &num_meta); -mutex_unlock (&supp->mutex); -if (IS_ERR (req)) { -/* Something is wrong, let supplicant restart. */ +mutex_unlock (&supp->mutex); +/* Something is wrong, let supplicant handel it. */ return PTR_ERR (req); }
@@ -355,9 +395,10 @@ int optee_supp_send(struct tee_context *ctx, u32 ret, u32 num_params, } } req->ret = ret; - + req->processed = true;/* Let the requesting thread continue */ complete (&req->c); +mutex_unlock (&supp->mutex);return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 11/325 soc: qcom: ice: Allow explicit votes on iface clock for ICE
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harshal Dev <[email protected]>
[ Upstream commit 0d5dc5818191b55e4364d04b1b898a14a2ccac38 ]
Since Qualcomm inline-crypto engine (ICE) is now a dedicated driver de-coupled from the QCOM UFS driver, it explicitly votes for its required clocks during probe. For scenarios where the 'clk_ignore_unused' flag is not passed on the kernel command line, to avoid potential unclocked ICE hardware register access during probe the ICE driver should additionally vote on the 'iface' clock.
Also update the suspend and resume callbacks to handle un-voting and voting on the 'iface' clock.
--- drivers/soc/qcom/ice.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/soc/qcom/ice.c +15 -2
@@ -95,6 +95,7 @@ struct qcom_ice {void __iomem *base;struct clk *core_clk; +struct clk *iface_clk;bool use_hwkm;bool hwkm_init_complete; };
@@ -278,8 +279,13 @@ int qcom_ice_resume(struct qcom_ice *ice) err =clk_prepare_enable (ice->core_clk);if (err) { -dev_err (dev,"failed to enable core clock (%d)\n" , - err); +dev_err (dev,"Failed to enable core clock: %d\n" , err); +return err; + } + + err =clk_prepare_enable (ice->iface_clk); +if (err) { +dev_err (dev,"Failed to enable iface clock: %d\n" , err);return err; }qcom_ice_hwkm_init (ice);
@@ -289,6 +295,7 @@ EXPORT_SYMBOL_GPL(qcom_ice_resume);int qcom_ice_suspend (struct qcom_ice *ice) { +clk_disable_unprepare (ice->iface_clk);clk_disable_unprepare (ice->core_clk); ice->hwkm_init_complete = false;
@@ -544,11 +551,17 @@ static struct qcom_ice *qcom_ice_create(struct device *dev, engine->core_clk =devm_clk_get_optional_enabled (dev,"ice_core_clk" );if (!engine->core_clk) engine->core_clk =devm_clk_get_optional_enabled (dev,"ice" ); +if (!engine->core_clk) + engine->core_clk =devm_clk_get_optional_enabled (dev,"core" );if (!engine->core_clk) engine->core_clk =devm_clk_get_enabled (dev,NULL );if (IS_ERR (engine->core_clk))return ERR_CAST (engine->core_clk); + engine->iface_clk =devm_clk_get_optional_enabled (dev,"iface" ); +if (IS_ERR (engine->iface_clk)) +return ERR_CAST (engine->iface_clk); +if (!qcom_ice_check_supported (engine))return ERR_PTR (-EOPNOTSUPP );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 12/325 arm64: dts: qcom: x1-dell-thena: remove i2c20 (battery SMBus) and reserve its pins
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Val Packett <[email protected]>
[ Upstream commit 4b15b03166cc5d28e9912287b1f9b6607c8710ec ]
i2c20 is used by the battmgr service on the ADSP to communicate with the SBS interface of the battery. Initializing it from Linux would break the battmgr functionality when booted in EL2. Mark those pins as reserved.
--- arch/arm64/boot/dts/qcom/x1-dell-thena.dtsi | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
arch/arm64/boot/dts/qcom/x1-dell-thena.dtsi +1 -6
@@ -982,12 +982,6 @@ &i2c8 { status = "okay"; }; -&i2c20 { - clock-frequency = <400000>; - - status = "okay"; -}; - &lpass_tlmm { spkr_01_sd_n_active: spkr-01-sd-n-active-state { pins = "gpio12";
@@ -1306,6 +1300,7 @@ right_tweeter: speaker@0,1 { &tlmm { gpio-reserved-ranges = <44 4>, /* SPI11 (TPM) */ <76 4>, /* SPI19 (TZ Protected) */ + <80 2>, /* I2C20 (Battery SMBus) */ <238 1>; /* UFS Reset */ cam_rgb_default: cam-rgb-default-state {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 13/325 ARM: dts: microchip: sam9x7: fix GMAC clock configuration
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mihai Sain <[email protected]>
[ Upstream commit 765aaba18413a66f6c8fe8416336ca9b3dd98a79 ]
The GMAC node incorrectly listed four clocks, including a separate tx_clk and a TSU GCK clock sourced from ID 67. According to the SAM9X7 clocking scheme, the GMAC uses only three clocks: HCLK, PCLK, and the TSU GCK derived from the GMAC peripheral clock (ID 24).
Remove the unused tx_clk, update the clock-names accordingly, and correct the assigned clock to use GCK 24 instead of GCK 67. This aligns the device tree with the actual hardware clock topology and prevents misconfiguration of the GMAC clock tree.
[root@SAM9X75 ~]$ cat /sys/kernel/debug/clk/clk_summary | grep gmac
gmac_gclk 1 1 1 266666666 0 0 50000 Y f802c000.ethernet tsu_clk
f802c000.ethernet tsu_clk
gmac_clk 2 2 0 266666666 0 0 50000 Y f802c000.ethernet hclk
f802c000.ethernet pclk--- arch/arm/boot/dts/microchip/sam9x7.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/microchip/sam9x7.dtsi +3 -3
@@ -990,9 +990,9 @@ gmac: ethernet@f802c000 { <62 IRQ_TYPE_LEVEL_HIGH 3>, /* Queue 3 */ <63 IRQ_TYPE_LEVEL_HIGH 3>, /* Queue 4 */ <64 IRQ_TYPE_LEVEL_HIGH 3>; /* Queue 5 */ - clocks = <&pmc PMC_TYPE_PERIPHERAL 24>, <&pmc PMC_TYPE_PERIPHERAL 24>, <&pmc PMC_TYPE_GCK 24>, <&pmc PMC_TYPE_GCK 67>; - clock-names = "hclk", "pclk", "tx_clk", "tsu_clk"; - assigned-clocks = <&pmc PMC_TYPE_GCK 67>; + clocks = <&pmc PMC_TYPE_PERIPHERAL 24>, <&pmc PMC_TYPE_PERIPHERAL 24>, <&pmc PMC_TYPE_GCK 24>; + clock-names = "hclk", "pclk", "tsu_clk"; + assigned-clocks = <&pmc PMC_TYPE_GCK 24>; assigned-clock-rates = <266666666>; status = "disabled"; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 14/325 soc: qcom: ice: Return -ENODEV if the ICE platform device is not found
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 5a4dc805a80e6fe303d6a4748cd451ea15987ffd ]
By the time the consumer driver calls devm_of_qcom_ice_get(), all the platform devices for ICE nodes would've been created by of_platform_default_populate().
So for the absence of any platform device, -ENODEV should not returned, not -EPROBE_DEFER.
--- drivers/soc/qcom/ice.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/ice.c +1 -1
@@ -622,7 +622,7 @@ static struct qcom_ice *of_qcom_ice_get(struct device *dev) pdev =of_find_device_by_node (node);if (!pdev) {dev_err (dev,"Cannot find device node %s\n" , node->name); -return ERR_PTR (-EPROBE_DEFER ); +return ERR_PTR (-ENODEV ); } ice =platform_get_drvdata (pdev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 15/325 tee: fix tee_ioctl_object_invoke_arg padding
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit c15d7a2a11ea055bcecc0b538ae8ba79475637f9 ]
The tee_ioctl_object_invoke_arg structure has padding on some architectures but not on x86-32 and a few others:
include/linux/tee.h:474:32: error: padding struct to align 'params' [-Werror=padded]
I expect that all current users of this are on architectures that do have implicit padding here (arm64, arm, x86, riscv), so make the padding explicit in order to avoid surprises if this later gets used elsewhere.
--- include/uapi/linux/tee.h | 1 + 1 file changed, 1 insertion(+)
include/uapi/linux/tee.h +1 -0
@@ -470,6 +470,7 @@ struct tee_ioctl_object_invoke_arg {__u32 op;__u32 ret;__u32 num_params; + __u32 :32 ;/* num_params tells the actual number of element in params */ struct tee_ioctl_param params[]; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 16/325 tee: qcomtee: add missing va_end in early return qcomtee_object_user_init()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robertus Diawan Chris <[email protected]>
[ Upstream commit 471c18323dfdfe7844e193b896a9267ae23a1026 ]
qcomtee_object_user_init() is a variadic function and when the function return because there's no dispatch callback in QCOMTEE_OBJECT_TYPE_CB case, there's no va_end to cleanup "ap" object initialized by va_start and that can cause undefined behavior. So make sure to use va_end before returning the error code when there's no dispatch callback.
This is reported by Coverity Scan as "Missing varargs init or cleanup".
--- drivers/tee/qcomtee/core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/tee/qcomtee/core.c +4 -2
@@ -306,8 +306,10 @@ int qcomtee_object_user_init(struct qcomtee_object *object,break ;case QCOMTEE_OBJECT_TYPE_CB : object->ops = ops; -if (!object->ops->dispatch) -return -EINVAL ; +if (!object->ops->dispatch) { + ret = -EINVAL ; +break ; + }/* If failed, "no-name". */ object->name =kvasprintf_const (GFP_KERNEL , fmt, ap);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 17/325 erofs: tidy up synchronous decompression
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gao Xiang <[email protected]>
[ Upstream commit cc831ab33644088c1eef78936de24701014d520a ]
- Get rid of sbi->opt.max_sync_decompress_pages since it's fixed as 3 all the time;
- Add Z_EROFS_MAX_SYNC_DECOMPRESS_BYTES in bytes instead of in pages, since for non-4K pages, 3-page limitation makes no sense;
- Move sync_decompress to sbi to avoid unexpected remount impact;
- Fold z_erofs_is_sync_decompress() into its caller;
- Better description of sysfs entry sync_decompress.
Stable-dep-of: 1aee05e814d2 ("erofs: fix use-after-free on sbi->sync_decompress")
--- Documentation/ABI/testing/sysfs-fs-erofs | 14 ++++++---- fs/erofs/internal.h | 5 +--- fs/erofs/super.c | 3 +- fs/erofs/sysfs.c | 2 +- fs/erofs/zdata.c | 35 +++++++++--------------- 5 files changed, 25 insertions(+), 34 deletions(-)
Documentation/ABI/testing/sysfs-fs-erofs +9 -5
@@ -10,12 +10,16 @@ Description: Shows all enabled kernel features. What: /sys/fs/erofs/<disk>/sync_decompress Date: November 2021 Contact: "Huang Jianan" <[email protected]> -Description: Control strategy of sync decompression: +Description: Control strategy of synchronous decompression. Synchronous + decompression tries to decompress in the reader thread for + synchronous reads and small asynchronous reads (<= 12 KiB): - - 0 (default, auto): enable for readpage, and enable for - readahead on atomic contexts only. - - 1 (force on): enable for readpage and readahead. - - 2 (force off): disable for all situations. + - 0 (auto, default): apply to synchronous reads only, but will + switch to 1 (force on) if any decompression + request is detected in atomic contexts; + - 1 (force on): apply to synchronous reads and small + asynchronous reads; + - 2 (force off): disable synchronous decompression completely. What: /sys/fs/erofs/<disk>/drop_caches Date: November 2024
fs/erofs/internal.h +1 -4
@@ -59,10 +59,6 @@ enum {struct erofs_mount_opts {/* current strategy of how to use managed cache */ unsigned char cache_strategy; -/* strategy of sync decompression (0 - auto, 1 - force on, 2 - force off) */ -unsigned int sync_decompress; -/* threshold for decompression synchronously */ -unsigned int max_sync_decompress_pages;unsigned int mount_opt; };
@@ -116,6 +112,7 @@ struct erofs_sb_info {/* managed XArray arranged in physical block number */ struct xarray managed_pslots; +unsigned int sync_decompress;/* strategy for sync decompression */ unsigned int shrinker_run_no;u16 available_compr_algs;
fs/erofs/super.c +1 -2
@@ -379,8 +379,7 @@ static void erofs_default_options(struct erofs_sb_info *sbi) {#ifdef CONFIG_EROFS_FS_ZIP sbi->opt.cache_strategy =EROFS_ZIP_CACHE_READAROUND ; - sbi->opt.max_sync_decompress_pages =3 ; - sbi->opt.sync_decompress =EROFS_SYNC_DECOMPRESS_AUTO ; + sbi->sync_decompress =EROFS_SYNC_DECOMPRESS_AUTO ;#endif #ifdef CONFIG_EROFS_FS_XATTR set_opt (&sbi->opt,XATTR_USER );
fs/erofs/sysfs.c +1 -1
@@ -59,7 +59,7 @@ static struct erofs_attr erofs_attr_##_name = { \#define ATTR_LIST (name) (&erofs_attr_##name.attr)#ifdef CONFIG_EROFS_FS_ZIP -EROFS_ATTR_RW_UI (sync_decompress, erofs_mount_opts); +EROFS_ATTR_RW_UI (sync_decompress, erofs_sb_info);EROFS_ATTR_FUNC (drop_caches,0200 );#endif #ifdef CONFIG_EROFS_FS_ZIP_ACCEL
fs/erofs/zdata.c +13 -22
@@ -9,6 +9,7 @@#include <linux/cpuhotplug.h> #include <trace/events/erofs.h> +#define Z_EROFS_MAX_SYNC_DECOMPRESS_BYTES 12288#define Z_EROFS_PCLUSTER_MAX_PAGES (Z_EROFS_PCLUSTER_MAX_SIZE / PAGE_SIZE)#define Z_EROFS_INLINE_BVECS 2
@@ -1097,21 +1098,6 @@ static int z_erofs_scan_folio(struct z_erofs_frontend *f,return err; } -static bool z_erofs_is_sync_decompress (struct erofs_sb_info *sbi, -unsigned int readahead_pages) -{ -/* auto: enable for read_folio, disable for readahead */ -if ((sbi->opt.sync_decompress ==EROFS_SYNC_DECOMPRESS_AUTO ) && - !readahead_pages) -return true; - -if ((sbi->opt.sync_decompress ==EROFS_SYNC_DECOMPRESS_FORCE_ON ) && - (readahead_pages <= sbi->opt.max_sync_decompress_pages)) -return true; - -return false; -} -static bool z_erofs_page_is_invalidated (struct page *page) {return !page_folio (page)->mapping && !z_erofs_is_shortlived_page (page);
@@ -1473,9 +1459,9 @@ static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io,#else queue_work (z_erofs_workqueue, &io->u.work);#endif -/* enable sync decompression for readahead */ -if (sbi->opt.sync_decompress ==EROFS_SYNC_DECOMPRESS_AUTO ) - sbi->opt.sync_decompress =EROFS_SYNC_DECOMPRESS_FORCE_ON ; +/* See `sync_decompress` in sysfs-fs-erofs for more details */ +if (sbi->sync_decompress ==EROFS_SYNC_DECOMPRESS_AUTO ) + sbi->sync_decompress =EROFS_SYNC_DECOMPRESS_FORCE_ON ;return ; } gfp_flag =memalloc_noio_save ();
@@ -1795,16 +1781,21 @@ static void z_erofs_submit_queue(struct z_erofs_frontend *f,z_erofs_decompress_kickoff (q[JQ_SUBMIT ], nr_bios); } -static int z_erofs_runqueue (struct z_erofs_frontend *f,unsigned int rapages) +static int z_erofs_runqueue (struct z_erofs_frontend *f,unsigned int rabytes) {struct z_erofs_decompressqueue io[NR_JOBQUEUES ];struct erofs_sb_info *sbi =EROFS_I_SB (f->inode); -bool force_fg =z_erofs_is_sync_decompress (sbi, rapages); +int syncmode = sbi->sync_decompress; +bool force_fg;int err; + force_fg = (syncmode ==EROFS_SYNC_DECOMPRESS_AUTO && !rabytes) || + (syncmode ==EROFS_SYNC_DECOMPRESS_FORCE_ON && + (rabytes <=Z_EROFS_MAX_SYNC_DECOMPRESS_BYTES )); +if (f->head ==Z_EROFS_PCLUSTER_TAIL )return 0 ; -z_erofs_submit_queue (f, io, &force_fg, !!rapages); +z_erofs_submit_queue (f, io, &force_fg, !!rabytes);/* handle bypass queue (no i/o pclusters) immediately */ err =z_erofs_decompress_queue (&io[JQ_BYPASS ], &f->pagepool);
@@ -1925,7 +1916,7 @@ static void z_erofs_readahead(struct readahead_control *rac)z_erofs_pcluster_readmore (&f, rac, false);z_erofs_pcluster_end (&f); - (void )z_erofs_runqueue (&f, nrpages); + (void )z_erofs_runqueue (&f, nrpages <<PAGE_SHIFT );erofs_put_metabuf (&f.map.buf);erofs_release_pages (&f.pagepool); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 18/325 erofs: fix use-after-free on sbi->sync_decompress
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gao Xiang <[email protected]>
[ Upstream commit 1aee05e814d292064bf5fa15733741040cdc48ba ]
z_erofs_decompress_kickoff() can race with filesystem unmount, causing a use-after-free on sbi->sync_decompress.
When I/O completes, z_erofs_endio() calls z_erofs_decompress_kickoff() to queue z_erofs_decompressqueue_work() asynchronously. Then, after all folios are unlocked, unmount workflow can proceed and sbi will be freed before accessing to sbi->sync_decompress.
Thread (unmount) I/O completion kworker
queue_work
z_erofs_decompressqueue_work
(all folios are unlocked)cleanup_mnt
..
erofs_kill_sb
erofs_sb_free
kfree(sbi)
access sbi->sync_decompress // UAF!!
--- fs/erofs/zdata.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/erofs/zdata.c +3 -3
@@ -1443,6 +1443,9 @@ static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io,if (atomic_add_return (bios, &io->pending_bios))return ;if (z_erofs_in_atomic ()) { +/* See `sync_decompress` in sysfs-fs-erofs for more details */ +if (sbi->sync_decompress ==EROFS_SYNC_DECOMPRESS_AUTO ) + sbi->sync_decompress =EROFS_SYNC_DECOMPRESS_FORCE_ON ;#ifdef CONFIG_EROFS_FS_PCPU_KTHREAD struct kthread_worker *worker;
@@ -1459,9 +1462,6 @@ static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io,#else queue_work (z_erofs_workqueue, &io->u.work);#endif -/* See `sync_decompress` in sysfs-fs-erofs for more details */ -if (sbi->sync_decompress ==EROFS_SYNC_DECOMPRESS_AUTO ) - sbi->sync_decompress =EROFS_SYNC_DECOMPRESS_FORCE_ON ;return ; } gfp_flag =memalloc_noio_save ();
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 19/325 wifi: iwlwifi: mvm: dont support the reset handshake for old firmwares
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
[ Upstream commit 0eaa1f245ac03ed0c6394159360532726f666811 ]
-77.ucode doesn't contain the fixes for this flow it seems. Don't use the firmware reset handshake even if the firmware claims support for it.
--- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/ops.c +6 -0
@@ -1416,6 +1416,12 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_rf_cfg *cfg,fw_has_capa (&mvm->fw->ucode_capa,IWL_UCODE_TLV_CAPA_FW_RESET_HANDSHAKE ); +/* Those firmware versions claim to support the fw_reset_handshake +* but they are buggy. +*/ +if (IWL_UCODE_MAJOR (mvm->fw->ucode_ver) <=77 ) + trans->conf.fw_reset_handshake = false; + trans->conf.queue_alloc_cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, WIDE_ID(DATA_PATH_GROUP,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 20/325 ksmbd: fix NULL-deref of opinfo->conn in oplock/lease break notifiers
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gil Portnoy <[email protected]>
[ Upstream commit b003086d76968298f22e7cf62239833b5a3a06b1 ]
smb2_oplock_break_noti() and smb2_lease_break_noti() read opinfo->conn into a local with neither READ_ONCE() nor a NULL check. Both run from oplock_break() after opinfo_get_list() has dropped ci->m_lock, so a concurrent SMB2 LOGOFF (session_fd_check()) can set op->conn = NULL under ci->m_lock within that window. ksmbd_conn_r_count_inc(conn) then writes through NULL at offset 0xc4 -- a remotely triggerable oops.
Guard both reads the way compare_guid_key() already does: read opinfo->conn with READ_ONCE() and return early if it is NULL, before allocating the work struct so nothing leaks. A NULL conn means the client is gone and the break is moot, so return 0; oplock_break() treats that as success and runs the normal teardown.
--- fs/smb/server/oplock.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
fs/smb/server/oplock.c +12 -3
@@ -714,11 +714,16 @@ static void __smb2_oplock_break_noti(struct work_struct *wk)*/ static int smb2_oplock_break_noti (struct oplock_info *opinfo) { -struct ksmbd_conn *conn = opinfo->conn; +struct ksmbd_conn *conn;struct oplock_break_info *br_info;int ret =0 ; -struct ksmbd_work *work =ksmbd_alloc_work_struct (); +struct ksmbd_work *work; + + conn =READ_ONCE (opinfo->conn); +if (!conn) +return 0 ; + work =ksmbd_alloc_work_struct ();if (!work)return -ENOMEM ;
@@ -818,11 +823,15 @@ static void __smb2_lease_break_noti(struct work_struct *wk)*/ static int smb2_lease_break_noti (struct oplock_info *opinfo) { -struct ksmbd_conn *conn = opinfo->conn; +struct ksmbd_conn *conn;struct ksmbd_work *work;struct lease_break_info *br_info;struct lease *lease = opinfo->o_lease; + conn =READ_ONCE (opinfo->conn); +if (!conn) +return 0 ; + work =ksmbd_alloc_work_struct ();if (!work)return -ENOMEM ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 21/325 netfilter: xt_NFQUEUE: prefer raw_smp_processor_id
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fernando Fernandez Mancera <[email protected]>
[ Upstream commit c6c5327dd18bec1e1bbf139b2cf5ae53608a9d30 ]
With PREEMPT_RCU this triggers a splat because smp_processor_id() can be preempted while inside a RCU critical section. If xt_NFQUEUE target is invoked via nft_compat_eval() path, we are inside a RCU critical section.
Just use the raw version instead.
--- net/netfilter/xt_NFQUEUE.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/xt_NFQUEUE.c +1 -1
@@ -91,7 +91,7 @@ nfqueue_tg_v3(struct sk_buff *skb, const struct xt_action_param *par)if (info->queues_total >1 ) {if (info->flags &NFQ_FLAG_CPU_FANOUT ) { -int cpu =smp_processor_id (); +int cpu =raw_smp_processor_id (); queue = info->queuenum + cpu % info->queues_total; }else {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 22/325 ipvs: clear the svc scheduler ptr early on edit
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julian Anastasov <[email protected]>
[ Upstream commit 193989cc6d80dd8e0460fb3992e69fa03bf0ff9b ]
ip_vs_edit_service() while unbinding the old scheduler clears the svc->scheduler ptr after the scheduler module initiates RCU callbacks. This can cause packets to use the old scheduler at the time when svc->sched_data is already freed after RCU grace period.
Fix it by clearing the ptr early in ip_vs_unbind_scheduler(), before the done_service method schedules any RCU callbacks.
Also, if the new scheduler fails to initialize when replacing the old scheduler, try to restore the old scheduler while still returning the error code.
--- include/net/ip_vs.h | 3 +-- net/netfilter/ipvs/ip_vs_ctl.c | 13 ++++++++----- net/netfilter/ipvs/ip_vs_sched.c | 14 +++++++------- 3 files changed, 16 insertions(+), 14 deletions(-)
include/net/ip_vs.h +1 -2
@@ -1519,8 +1519,7 @@ int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler);int unregister_ip_vs_scheduler (struct ip_vs_scheduler *scheduler);int ip_vs_bind_scheduler (struct ip_vs_service *svc,struct ip_vs_scheduler *scheduler); -void ip_vs_unbind_scheduler (struct ip_vs_service *svc, -struct ip_vs_scheduler *sched); +void ip_vs_unbind_scheduler (struct ip_vs_service *svc);struct ip_vs_scheduler *ip_vs_scheduler_get (const char *sched_name);void ip_vs_scheduler_put (struct ip_vs_scheduler *scheduler); struct ip_vs_conn *
net/netfilter/ipvs/ip_vs_ctl.c +8 -5
@@ -1497,7 +1497,7 @@ ip_vs_add_service(struct netns_ipvs *ipvs, struct ip_vs_service_user_kern *u,if (ret_hooks >=0 )ip_vs_unregister_hooks (ipvs, u->af);if (svc !=NULL ) { -ip_vs_unbind_scheduler (svc, sched); +ip_vs_unbind_scheduler (svc);ip_vs_service_free (svc); }ip_vs_scheduler_put (sched);
@@ -1559,9 +1559,8 @@ ip_vs_edit_service(struct ip_vs_service *svc, struct ip_vs_service_user_kern *u) old_sched =rcu_dereference_protected (svc->scheduler,1 );if (sched != old_sched) {if (old_sched) { -ip_vs_unbind_scheduler (svc, old_sched); -RCU_INIT_POINTER (svc->scheduler,NULL ); -/* Wait all svc->sched_data users */ +ip_vs_unbind_scheduler (svc); +/* Wait all svc->scheduler/sched_data users */ synchronize_rcu (); }/* Bind the new scheduler */
@@ -1569,6 +1568,10 @@ ip_vs_edit_service(struct ip_vs_service *svc, struct ip_vs_service_user_kern *u) ret =ip_vs_bind_scheduler (svc, sched);if (ret) {ip_vs_scheduler_put (sched); +/* Try to restore the old_sched */ +if (old_sched && + !ip_vs_bind_scheduler (svc, old_sched)) + old_sched =NULL ; goto out; } }
@@ -1625,7 +1628,7 @@ static void __ip_vs_del_service(struct ip_vs_service *svc, bool cleanup)/* Unbind scheduler */ old_sched =rcu_dereference_protected (svc->scheduler,1 ); -ip_vs_unbind_scheduler (svc, old_sched); +ip_vs_unbind_scheduler (svc);ip_vs_scheduler_put (old_sched);/* Unbind persistence engine, keep svc->pe */
net/netfilter/ipvs/ip_vs_sched.c +7 -7
@@ -57,19 +57,19 @@ int ip_vs_bind_scheduler(struct ip_vs_service *svc,/* * Unbind a service with its scheduler */ -void ip_vs_unbind_scheduler (struct ip_vs_service *svc, -struct ip_vs_scheduler *sched) +void ip_vs_unbind_scheduler (struct ip_vs_service *svc) { -struct ip_vs_scheduler *cur_sched; +struct ip_vs_scheduler *sched; - cur_sched =rcu_dereference_protected (svc->scheduler,1 ); -/* This check proves that old 'sched' was installed */ -if (!cur_sched) + sched =rcu_dereference_protected (svc->scheduler,1 ); +if (!sched)return ; +/* Reset the scheduler before initiating any RCU callbacks */ +rcu_assign_pointer (svc->scheduler,NULL ); +smp_wmb ();/* paired with smp_rmb() in ip_vs_schedule() */ if (sched->done_service) sched->done_service (svc); -/* svc->scheduler can be set to NULL only by caller */ }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 23/325 netfilter: synproxy: add mutex to guard hook reference counting
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fernando Fernandez Mancera <[email protected]>
[ Upstream commit 2fcba19caaeb2a33017459d3430f057967bb91b6 ]
As the synproxy infrastructure register netfilter hooks on-demand when a user adds the first iptables target or nftables expression, if done concurrently they can race each other.
Introduce a mutex to serialize the refcount control blocks access from both frontends. While a per namespace mutex might be more efficient, it is not needed for target/expression like SYNPROXY.
--- net/netfilter/nf_synproxy_core.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)
net/netfilter/nf_synproxy_core.c +18 -6
@@ -21,6 +21,8 @@#include <net/netfilter/nf_conntrack_zones.h> #include <net/netfilter/nf_synproxy.h> +static DEFINE_MUTEX (synproxy_mutex); +unsigned int synproxy_net_id;EXPORT_SYMBOL_GPL (synproxy_net_id);
@@ -768,26 +770,31 @@ static const struct nf_hook_ops ipv4_synproxy_ops[] = {int nf_synproxy_ipv4_init (struct synproxy_net *snet,struct net *net) { -int err; +int err =0 ; +mutex_lock (&synproxy_mutex);if (snet->hook_ref4 ==0 ) { err =nf_register_net_hooks (net, ipv4_synproxy_ops,ARRAY_SIZE (ipv4_synproxy_ops));if (err) -return err; + goto out; } snet->hook_ref4++; -return 0 ; +out: +mutex_unlock (&synproxy_mutex); +return err; }EXPORT_SYMBOL_GPL (nf_synproxy_ipv4_init);void nf_synproxy_ipv4_fini (struct synproxy_net *snet,struct net *net) { +mutex_lock (&synproxy_mutex); snet->hook_ref4--;if (snet->hook_ref4 ==0 )nf_unregister_net_hooks (net, ipv4_synproxy_ops,ARRAY_SIZE (ipv4_synproxy_ops)); +mutex_unlock (&synproxy_mutex); }EXPORT_SYMBOL_GPL (nf_synproxy_ipv4_fini);
@@ -1192,27 +1199,32 @@ static const struct nf_hook_ops ipv6_synproxy_ops[] = {int nf_synproxy_ipv6_init (struct synproxy_net *snet,struct net *net) { -int err; +int err =0 ; +mutex_lock (&synproxy_mutex);if (snet->hook_ref6 ==0 ) { err =nf_register_net_hooks (net, ipv6_synproxy_ops,ARRAY_SIZE (ipv6_synproxy_ops));if (err) -return err; + goto out; } snet->hook_ref6++; -return 0 ; +out: +mutex_unlock (&synproxy_mutex); +return err; }EXPORT_SYMBOL_GPL (nf_synproxy_ipv6_init);void nf_synproxy_ipv6_fini (struct synproxy_net *snet,struct net *net) { +mutex_lock (&synproxy_mutex); snet->hook_ref6--;if (snet->hook_ref6 ==0 )nf_unregister_net_hooks (net, ipv6_synproxy_ops,ARRAY_SIZE (ipv6_synproxy_ops)); +mutex_unlock (&synproxy_mutex); }EXPORT_SYMBOL_GPL (nf_synproxy_ipv6_fini);#endif /* CONFIG_IPV6 */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 24/325 netfilter: conntrack_irc: fix possible out-of-bounds read
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit 66eba0ffce3b7e11449946b4cbbef8ea36112f56 ]
When parsing fails after we've matched the command string we should bail out instead of trying to match a different command.
This helper should be deprecated, given prevalence of TLS I doubt it has any relevance in 2026.
--- net/netfilter/nf_conntrack_irc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nf_conntrack_irc.c +2 -2
@@ -208,7 +208,7 @@ static int help(struct sk_buff *skb, unsigned int protoff,if (parse_dcc (data, data_limit, &dcc_ip, &dcc_port, &addr_beg_p, &addr_end_p)) {pr_debug ("unable to parse dcc command\n" ); -continue ; + goto out; } pr_debug("DCC bound ip/port: %pI4:%u\n",
@@ -222,7 +222,7 @@ static int help(struct sk_buff *skb, unsigned int protoff,net_warn_ratelimited ("Forged DCC command from %pI4: %pI4:%u\n" , &tuple->src.u3.ip, &dcc_ip, dcc_port); -continue ; + goto out; } exp =nf_ct_expect_alloc (ct);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 25/325 netfilter: nft_ct: bail out on template ct in get eval
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <[email protected]>
[ Upstream commit 3027ecbdb5fdf9200251c21d4818e4c447ef78e1 ]
I noticed this issue while looking at a historic syzbot report [1].
A rule like the one below is enough to trigger the bug:
table ip t {
chain pre {
type filter hook prerouting priority raw;
ct zone set 1
ct original saddr 1.2.3.4 accept
}
}The first expression attaches a per-cpu template ct via nft_ct_set_zone_eval() (nf_ct_tmpl_alloc -> kzalloc, tuple is all zero, nf_ct_l3num(ct) == 0). The next expression then calls nft_ct_get_eval() on the same skb, treats the template as a real ct and hits the 16-byte memcpy path. With dreg at NFT_REG32_15 this overflows past struct nft_regs on the kernel stack; with smaller dreg values it silently clobbers adjacent registers.
Reject template ct at the eval entry and in nft_ct_get_fast_eval(), mirroring the check nft_ct_set_eval() already has. Additionally, bound the address copy in NFT_CT_SRC / NFT_CT_DST by priv->len instead of by nf_ct_l3num(ct): nf_ct_get_tuple() zeroes the tuple before pkt_to_tuple() fills in only the protocol-relevant leading bytes, so the trailing bytes of tuple->{src,dst}.u3.all are well-defined zero. priv->len is validated at rule load, so the copy size is now bounded by the destination register rather than by an untrusted field on the conntrack.
[1]: https://syzkaller.appspot.com/bug?id=389cf09cb72926114fce90dc85a2c3231dcb647c
--- net/netfilter/nft_ct.c | 8 +++----- net/netfilter/nft_ct_fast.c | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-)
net/netfilter/nft_ct.c +3 -5
@@ -78,7 +78,7 @@ static void nft_ct_get_eval(const struct nft_expr *expr,break ; } -if (ct ==NULL ) +if (!ct ||nf_ct_is_template (ct)) goto err;switch (priv->key) {
@@ -180,12 +180,10 @@ static void nft_ct_get_eval(const struct nft_expr *expr, tuple = &ct->tuplehash[priv->dir].tuple;switch (priv->key) {case NFT_CT_SRC : -memcpy (dest, tuple->src.u3.all, -nf_ct_l3num (ct) ==NFPROTO_IPV4 ?4 :16 ); +memcpy (dest, tuple->src.u3.all, priv->len);return ;case NFT_CT_DST : -memcpy (dest, tuple->dst.u3.all, -nf_ct_l3num (ct) ==NFPROTO_IPV4 ?4 :16 ); +memcpy (dest, tuple->dst.u3.all, priv->len);return ;case NFT_CT_PROTO_SRC :nft_reg_store16 (dest, (__force u16 )tuple->src.u.all);
net/netfilter/nft_ct_fast.c +1 -1
@@ -30,7 +30,7 @@ void nft_ct_get_fast_eval(const struct nft_expr *expr,break ; } -if (!ct) { +if (!ct ||nf_ct_is_template (ct)) { regs->verdict.code =NFT_BREAK ;return ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 26/325 netfilter: bridge: make ebt_snat ARP rewrite writable
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yiming Qian <[email protected]>
[ Upstream commit 67ba971ae02514d85818fe0c32549ab4bfa3bf49 ]
The ebtables SNAT target keeps the Ethernet source address rewrite behind skb_ensure_writable(skb, 0). This is intentional: at the bridge ebtables hooks the Ethernet header is addressed through skb_mac_header()/eth_hdr(), while skb->data points at the Ethernet payload. Asking skb_ensure_writable() for ETH_HLEN bytes would check the payload, not the Ethernet header, and would reintroduce the small packet regression fixed by commit 63137bc5882a.
However, the optional ARP sender hardware address rewrite is different. It writes through skb_store_bits() at an offset relative to skb->data:
skb_store_bits(skb, sizeof(struct arphdr), info->mac, ETH_ALEN)
skb_header_pointer() only safely reads the ARP header; it does not make the later sender hardware address range writable. If that range is still held in a nonlinear skb fragment backed by a splice-imported file page, skb_store_bits() maps the frag page and copies the new MAC address directly into it.
Ensure the ARP SHA range is writable before reading the ARP header and before calling skb_store_bits().
--- net/bridge/netfilter/ebt_snat.c | 3 +++ 1 file changed, 3 insertions(+)
net/bridge/netfilter/ebt_snat.c +3 -0
@@ -31,6 +31,9 @@ ebt_snat_tg(struct sk_buff *skb, const struct xt_action_param *par)const struct arphdr *ap;struct arphdr _ah; +if (skb_ensure_writable (skb,sizeof (_ah) +ETH_ALEN )) +return EBT_DROP ; + ap =skb_header_pointer (skb,0 ,sizeof (_ah), &_ah);if (ap ==NULL )return EBT_DROP ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 27/325 dm cache policy smq: check allocation under invalidate lock
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guangshuo Li <[email protected]>
[ Upstream commit d3f0a606b9f278ece8a0df626ded9c4044071235 ]
commit 2d1f7b65f5de ("dm cache policy smq: fix missing locks in invalidating cache blocks") added mq->lock around the destructive part of smq_invalidate_mapping(), but left the e->allocated check outside the critical section.
That leaves a check-then-act race. Two concurrent invalidators can both observe e->allocated as true before either of them takes mq->lock. The first invalidator that acquires the lock removes the entry from the queues and hash table and then calls free_entry(), which clears e->allocated and puts the entry back on the free list. The second invalidator can then acquire mq->lock and continue with the stale result of the unlocked check.
This can corrupt the SMQ queues or hash table by deleting an entry that is no longer on those structures. It can also hit the allocation check in free_entry() when the same entry is freed again.
Move the allocation check under mq->lock so the predicate and the destructive operations are serialized by the same lock.
--- drivers/md/dm-cache-policy-smq.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/md/dm-cache-policy-smq.c +8 -4
@@ -1590,18 +1590,22 @@ static int smq_invalidate_mapping(struct dm_cache_policy *p, dm_cblock_t cblock)struct smq_policy *mq =to_smq_policy (p);struct entry *e =get_entry (&mq->cache_alloc,from_cblock (cblock));unsigned long flags; - -if (!e->allocated) -return -ENODATA ; +int r =0 ;spin_lock_irqsave (&mq->lock, flags); +if (!e->allocated) { + r = -ENODATA ; + goto out; + }// FIXME: what if this block has pending background work? del_queue (mq, e);h_remove (&mq->table, e);free_entry (&mq->cache_alloc, e); + +out:spin_unlock_irqrestore (&mq->lock, flags); -return 0 ; +return r; }static uint32_t smq_get_hint (struct dm_cache_policy *p,dm_cblock_t cblock)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 28/325 net/sched: act_api: use RCU with deferred freeing for action lifecycle
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit 5057e1aca011e51ef51498c940ef96f3d3e8a305 ]
When NEWTFILTER and DELFILTER are run concurrently it is possible to create a race with an associated action.
Let's illustrate with CPU0 running NEWTFILTER and CPU1 running DELFILTER:
0: mutex_lock() <-- holds the idr lock
0: rcu_read_lock()
0: p = idr_find(idr, index) <-- action p is valid (RCU protects IDR) 0: mutex_unlock() <-- releases the idr lock
1: refcount_dec_and_mutex_lock() <-- refcnt 1->0, mutex held
1: idr_remove(idr, index) <-- Action removed from IDR
1: mutex_unlock() <-- mutex released allowing us to delete the action 1: tcf_action_cleanup(p); kfree(p) <-- Kfrees p immediately, no deferral 0: refcount_inc_not_zero(&p->tcfa_refcnt) <-- ouch, UAF p points to freed memory
This patch fixes the race condition between NEWTFILTER and DELFILTER by adding struct rcu_head to tc_action used in the deferral and introducing a call_rcu() in the delete path to defer the final kfree().
Note: this is a revert of commit d7fb60b9cafb ("net_sched: get rid of tcfa_rcu") but also modernization/simplification to directly use kfree_rcu().
Let's illustrate the new restored code path:
0: rcu_read_lock()
1: refcount_dec_and_mutex_lock() <-- refcnt 1->0, mutex held
1: idr_remove(idr, index)
1: mutex_unlock()
1: call_rcu(&p->tcfa_rcu, tcf_action_rcu_free) <-- defer kfree after grace period 0: p = idr_find(idr, index)
0: refcount_inc_not_zero(&p->tcfa_refcnt) <-- fails, refcnt already 0 1: rcu_read_unlock() <-- release so freeing can run after grace period
After CPU1 calls idr_remove(), the object is no longer reachable through the IDR. CPU0's subsequent idr_find() will return NULL, and even if it still held a stale pointer, the immediate kfree() is now deferred until after the RCU grace period, so no UAF can occur.
--- include/net/act_api.h | 1 + net/sched/act_api.c | 7 +------ 2 files changed, 2 insertions(+), 6 deletions(-)
include/net/act_api.h +1 -0
@@ -45,6 +45,7 @@ struct tc_action {struct tc_cookie __rcu *user_cookie;struct tcf_chain __rcu *goto_chain;u32 tcfa_flags; +struct rcu_head tcfa_rcu;u8 hw_stats;u8 used_hw_stats;bool used_hw_stats_valid;
net/sched/act_api.c +1 -6
@@ -112,11 +112,6 @@ struct tcf_chain *tcf_action_set_ctrlact(struct tc_action *a, int action, }EXPORT_SYMBOL (tcf_action_set_ctrlact); -/* XXX: For standalone actions, we don't need a RCU grace period either, because -* actions are always connected to filters and filters are already destroyed in -* RCU callbacks, so after a RCU grace period actions are already disconnected -* from filters. Readers later can not find us. -*/ static void free_tcf (struct tc_action *p) {struct tcf_chain *chain =rcu_dereference_protected (p->goto_chain,1 );
@@ -129,7 +124,7 @@ static void free_tcf(struct tc_action *p)if (chain)tcf_chain_put_by_act (chain); -kfree (p); +kfree_rcu (p, tcfa_rcu); } static void offload_action_hw_count_set(struct tc_action *act,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 29/325 6lowpan: fix off-by-one in multicast context address compression
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yizhou Zhao <[email protected]>
[ Upstream commit 2a58899d11009bffc7b4b32a571858f381121837 ]
The second memcpy in lowpan_iphc_mcast_ctx_addr_compress() uses &data[1] as destination and &ipaddr->s6_addr[11] as source, but both should be offset by one: &data[2] and &ipaddr->s6_addr[12] respectively.
This off-by-one has two consequences:
1. data[1] is overwritten with s6_addr[11], corrupting the RIID field in the compressed multicast address
2. data[5] is never written, so uninitialized kernel stack memory is transmitted over the network via lowpan_push_hc_data(), leaking kernel stack contents
The correct inline data layout must match what the decompression function lowpan_uncompress_multicast_ctx_daddr() expects:
data[0..1] = s6_addr[1..2] (flags/scope + RIID) data[2..5] = s6_addr[12..15] (group ID)
Also zero-initialize the data array as a defensive measure against similar bugs in the future.
--- net/6lowpan/iphc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/6lowpan/iphc.c +2 -2
@@ -1086,12 +1086,12 @@ static u8 lowpan_iphc_mcast_ctx_addr_compress(u8 **hc_ptr,const struct lowpan_iphc_ctx *ctx, const struct in6_addr *ipaddr) { - u8 data[6]; + u8 data[6] = {};/* flags/scope, reserved (RIID) */ memcpy (data, &ipaddr->s6_addr[1 ],2 );/* group ID */ -memcpy (&data[1 ], &ipaddr->s6_addr[11 ],4 ); +memcpy (&data[2 ], &ipaddr->s6_addr[12 ],4 );lowpan_push_hc_data (hc_ptr, data,6 );return LOWPAN_IPHC_DAM_00 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 30/325 l2tp: pppol2tp: hold reference to session in pppol2tp_ioctl()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lee Jones <[email protected]>
[ Upstream commit a213a8950414c684999dcf03edeea6c46ede172e ]
pppol2tp_ioctl() read sock->sk->sk_user_data directly without any locks or reference counting. If a controllable sleep was induced during copy_from_user() (e.g. via a userfaultfd page fault sleep), a concurrent socket close could trigger pppol2tp_session_close() asynchronously. This frees the l2tp_session structure via the l2tp_session_del_work workqueue. Upon resuming, the ioctl thread dereferences the stale session pointer, resulting in a Use-After-Free (UAF).
Fix this by securely fetching the session reference using the RCU-safe, refcounted helper pppol2tp_sock_to_session(sk) on entry. This locks the session's refcount across the sleep. We structured the function to exit via standard err breaks, guaranteeing that l2tp_session_put() is cleanly called on all return paths to drop the reference.
To preserve existing behavior we validate the session and its magic signature only for the specific L2TP commands that require it. This ensures that generic/unknown ioctls called on an unconnected socket still return -ENOIOCTLCMD and correctly fall back to generic handlers (e.g. in sock_do_ioctl()).
--- net/l2tp/l2tp_ppp.c | 82 +++++++++++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 32 deletions(-)
net/l2tp/l2tp_ppp.c +50 -32
@@ -1044,64 +1044,76 @@ static int pppol2tp_ioctl(struct socket *sock, unsigned int cmd, {struct pppol2tp_ioc_stats stats;struct l2tp_session *session; +int err =0 ; + + session =pppol2tp_sock_to_session (sock->sk); +/* Validate session presence and magic integrity ONLY for commands +* that belong to L2TP and require a valid session. +*/ switch (cmd) {case PPPIOCGMRU :case PPPIOCGFLAGS : - session = sock->sk->sk_user_data; +case PPPIOCSMRU : +case PPPIOCSFLAGS : +case PPPIOCGL2TPSTATS :if (!session)return -ENOTCONN ; -if (WARN_ON (session->magic !=L2TP_SESSION_MAGIC )) +if (session->magic !=L2TP_SESSION_MAGIC ) { +l2tp_session_put (session);return -EBADF ; + } +break ; +default : +break ; + } +switch (cmd) { +case PPPIOCGMRU : +case PPPIOCGFLAGS :/* Not defined for tunnels */ -if (!session->session_id && !session->peer_session_id) -return -ENOSYS ; +if (!session->session_id && !session->peer_session_id) { + err = -ENOSYS ; +break ; + } -if (put_user (0 , (int __user *)arg)) -return -EFAULT ; +if (put_user (0 , (int __user *)arg)) { + err = -EFAULT ; +break ; + }break ;case PPPIOCSMRU :case PPPIOCSFLAGS : - session = sock->sk->sk_user_data; -if (!session) -return -ENOTCONN ; - -if (WARN_ON (session->magic !=L2TP_SESSION_MAGIC )) -return -EBADF ; -/* Not defined for tunnels */ -if (!session->session_id && !session->peer_session_id) -return -ENOSYS ; +if (!session->session_id && !session->peer_session_id) { + err = -ENOSYS ; +break ; + } -if (!access_ok ((int __user *)arg,sizeof (int ))) -return -EFAULT ; +if (!access_ok ((int __user *)arg,sizeof (int ))) { + err = -EFAULT ; +break ; + }break ;case PPPIOCGL2TPSTATS : - session = sock->sk->sk_user_data; -if (!session) -return -ENOTCONN ; - -if (WARN_ON (session->magic !=L2TP_SESSION_MAGIC )) -return -EBADF ; -/* Session 0 represents the parent tunnel */ if (!session->session_id && !session->peer_session_id) {u32 session_id; -int err;if (copy_from_user (&stats, (void __user *)arg, -sizeof (stats))) -return -EFAULT ; +sizeof (stats))) { + err = -EFAULT ; +break ; + } session_id = stats.session_id; err =pppol2tp_tunnel_copy_stats (&stats, session->tunnel);if (err <0 ) -return err; +break ; stats.session_id = session_id; }else {
@@ -1111,15 +1123,21 @@ static int pppol2tp_ioctl(struct socket *sock, unsigned int cmd, stats.tunnel_id = session->tunnel->tunnel_id; stats.using_ipsec =l2tp_tunnel_uses_xfrm (session->tunnel); -if (copy_to_user ((void __user *)arg, &stats,sizeof (stats))) -return -EFAULT ; +if (copy_to_user ((void __user *)arg, &stats,sizeof (stats))) { + err = -EFAULT ; +break ; + }break ;default : -return -ENOIOCTLCMD ; + err = -ENOIOCTLCMD ; +break ; } -return 0 ; +if (session) +l2tp_session_put (session); + +return err; }/*****************************************************************************
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 31/325 devlink: Release nested relation on devlink free
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Bloch <[email protected]>
[ Upstream commit 3522b21fd7e1863d0734537737bd59f1b90d0190 ]
devlink relation state is normally released from devl_unregister(), which calls devlink_rel_put(). This misses devlink instances that get a nested relation before registration and then fail probe before devl_register() is reached.
That flow can happen for SFs. The child devlink gets linked to its parent before registration, then a later probe error calls devlink_free() directly. Since the instance was never registered, devl_unregister() is not called and devlink->rel is leaked.
Release any pending relation from devlink_free() as well. The registered path is unchanged because devl_unregister() already clears devlink->rel before devlink_free() runs.
--- net/devlink/core.c | 2 ++ 1 file changed, 2 insertions(+)
net/devlink/core.c +2 -0
@@ -469,6 +469,8 @@ void devlink_free(struct devlink *devlink) {ASSERT_DEVLINK_NOT_REGISTERED (devlink); +devlink_rel_put (devlink); +WARN_ON (!list_empty (&devlink->trap_policer_list));WARN_ON (!list_empty (&devlink->trap_group_list));WARN_ON (!list_empty (&devlink->trap_list));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 32/325 drm/imx: Fix three kernel-doc warnings in dcss-scaler.c
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yicong Hui <[email protected]>
[ Upstream commit ae0383e5a9a4b12d68c76c4769857def4665deff ]
Fix the following W=1 kerneldoc warnings by adding the missing parameter descriptions for @phase0_identity and @nn_interpolation in dcss_scaler_filter_design() and @phase0_identity in dcss_scaler_gaussian_filter()
Warning: drivers/gpu/drm/imx/dcss/dcss-scaler.c:173 function parameter 'phase0_identity' not described in 'dcss_scaler_gaussian_filter'
Warning: drivers/gpu/drm/imx/dcss/dcss-scaler.c:270 function parameter 'phase0_identity' not described in 'dcss_scaler_filter_design'
Warning: drivers/gpu/drm/imx/dcss/dcss-scaler.c:270 function parameter 'nn_interpolation' not described in 'dcss_scaler_filter_design'
--- drivers/gpu/drm/imx/dcss/dcss-scaler.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/imx/dcss/dcss-scaler.c +3 -0
@@ -166,6 +166,7 @@ static int exp_approx_q(int x)* dcss_scaler_gaussian_filter() - Generate gaussian prototype filter. * @fc_q: fixed-point cutoff frequency normalized to range [0, 1] * @use_5_taps: indicates whether to use 5 taps or 7 taps +* @phase0_identity: whether to override phase 0 coefficients with identity filter * @coef: output filter coefficients */ static void dcss_scaler_gaussian_filter(int fc_q, bool use_5_taps,
@@ -262,7 +263,9 @@ static void dcss_scaler_nearest_neighbor_filter(bool use_5_taps,* @src_length: length of input * @dst_length: length of output * @use_5_taps: 0 for 7 taps per phase, 1 for 5 taps +* @phase0_identity: whether to override phase 0 coefficients with identity filter * @coef: output coefficients +* @nn_interpolation: whether to use nearest neighbor instead of gaussian filter */ static void dcss_scaler_filter_design(int src_length, int dst_length, bool use_5_taps, bool phase0_identity,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 33/325 wifi: mac80211: limit injected antenna index in ieee80211_parse_tx_radiotap
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Deepanshu Kartikey <[email protected]>
[ Upstream commit 6c0cf89f36ac0c0fd8687a4ccdce2efb23a9c663 ]
When parsing the radiotap header of an injected frame, ieee80211_parse_tx_radiotap() uses the IEEE80211_RADIOTAP_ANTENNA value directly as a shift count:
info->control.antennas |= BIT(*iterator.this_arg);
*iterator.this_arg is an 8-bit value taken straight from the frame supplied by userspace, so BIT() can be asked to shift by up to 255. That is undefined behaviour on the unsigned long and is reported by UBSAN:
UBSAN: shift-out-of-bounds in net/mac80211/tx.c:2174:30 shift exponent 235 is too large for 64-bit type 'unsigned long' Call Trace: ieee80211_parse_tx_radiotap+0xadb/0x1950 net/mac80211/tx.c:2174 ieee80211_monitor_start_xmit+0xb1f/0x1250 net/mac80211/tx.c:2451 ... packet_sendmsg+0x3eb6/0x50f0 net/packet/af_packet.c:3109
info->control.antennas is a 2-bit bitmap (u8 antennas:2), so only antenna indices 0 and 1 can ever be represented. Ignore any larger value instead of shifting out of bounds.
--- net/mac80211/tx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/mac80211/tx.c +3 -1
@@ -2169,7 +2169,9 @@ bool ieee80211_parse_tx_radiotap(struct sk_buff *skb,case IEEE80211_RADIOTAP_ANTENNA :/* this can appear multiple times, keep a bitmap */ - info->control.antennas |=BIT (*iterator.this_arg); +/* control.antennas is only a 2-bit bitmap */ +if (*iterator.this_arg <2 ) + info->control.antennas |=BIT (*iterator.this_arg);break ;case IEEE80211_RADIOTAP_DATA_RETRIES :
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 34/325 pcnet32: stop holding device spin lock during napi_complete_done
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oscar Maes <[email protected]>
[ Upstream commit 73bf3cca7de6a73f53b6a52dc3b1c82ae5667a4d ]
napi_complete_done may call gro_flush_normal (though not currently, as GRO is unsupported at the moment), which may result in packet TX. This will eventually result in calling pcnet32_start_xmit - resulting in a deadlock while trying to re-acquire the already locked spin lock.
It is safe to split the spinlock block into two, because the hardware registers are still protected from concurrent access, and the two blocks perform unrelated operations that don't need to happen atomically.
--- drivers/net/ethernet/amd/pcnet32.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/amd/pcnet32.c +3 -1
@@ -1407,8 +1407,10 @@ static int pcnet32_poll(struct napi_struct *napi, int budget)pcnet32_restart (dev,CSR0_START );netif_wake_queue (dev); } +spin_unlock_irqrestore (&lp->lock, flags);if (work_done < budget &&napi_complete_done (napi, work_done)) { +spin_lock_irqsave (&lp->lock, flags);/* clear interrupt masks */ val = lp->a->read_csr (ioaddr,CSR3 ); val &=0x00ff ;
@@ -1416,9 +1418,9 @@ static int pcnet32_poll(struct napi_struct *napi, int budget)/* Set interrupt enable. */ lp->a->write_csr (ioaddr,CSR0 ,CSR0_INTEN ); +spin_unlock_irqrestore (&lp->lock, flags); } -spin_unlock_irqrestore (&lp->lock, flags);return work_done; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 35/325 net: Annotate sk->sk_write_space() for UDP SOCKMAP.
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit b748765019fe9e9234660327090fc1a9665cdbdd ]
UDP TX skb->destructor() is sock_wfree(), and UDP holds lock_sock() only for UDP_CORK / MSG_MORE sendmsg().
Otherwise, sk->sk_write_space() may be read locklessly while SOCKMAP rewrites sk->sk_write_space().
Let's use WRITE_ONCE() and READ_ONCE() for sk->sk_write_space().
Note that the write side is annotated by commit 2ef2b20cf4e0 ("net: annotate data-races around sk->sk_{data_ready,write_space}").
--- net/core/sock.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/core/sock.c +6 -2
@@ -2654,8 +2654,12 @@ void sock_wfree(struct sk_buff *skb)bool free;if (!sock_flag (sk,SOCK_USE_WRITE_QUEUE )) { +void (*sk_write_space)(struct sock *sk); + + sk_write_space =READ_ONCE (sk->sk_write_space); +if (sock_flag (sk,SOCK_RCU_FREE ) && - sk->sk_write_space == sock_def_write_space) { + sk_write_space == sock_def_write_space) {rcu_read_lock (); free =refcount_sub_and_test (len, &sk->sk_wmem_alloc);sock_def_write_space_wfree (sk);
@@ -2670,7 +2674,7 @@ void sock_wfree(struct sk_buff *skb)* after sk_write_space() call */ WARN_ON (refcount_sub_and_test (len -1 , &sk->sk_wmem_alloc)); - sk->sk_write_space (sk); +sk_write_space (sk); len =1 ; }/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 36/325 hsr: Remove WARN_ONCE() in hsr_addr_is_self().
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit afd0f17ca46258cec3a5cc48b8df9327fe772490 ]
syzbot reported the warning [0] in hsr_addr_is_self(), whose assumption is simply wrong.
hsr->self_node is cleared in hsr_del_self_node(), which is called from hsr_dellink().
Since dev->rtnl_link_ops->dellink() is called before unregister_netdevice_many(), there is a window when user can find the device but without hsr->self_node.
Let's remove WARN_ONCE() in hsr_addr_is_self().
[0]:
HSR: No self node
WARNING: net/hsr/hsr_framereg.c:39 at hsr_addr_is_self+0x211/0x3f0 net/hsr/hsr_framereg.c:39, CPU#0: syz.4.16848/17220
Modules linked in:
CPU: 0 UID: 0 PID: 17220 Comm: syz.4.16848 Tainted: G L syzkaller #0 PREEMPT_{RT,(full)}
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/18/2026
RIP: 0010:hsr_addr_is_self+0x211/0x3f0 net/hsr/hsr_framereg.c:39
Code: 33 2f 41 0f b7 dd 89 ee 09 de 31 ff e8 c8 b4 c6 f6 09 dd 74 54 e8 0f b0 c6 f6 31 ed eb 53 e8 06 b0 c6 f6 48 8d 3d 2f 50 9c 04 <67> 48 0f b9 3a 31 ed eb 42 e8 c1 13 1f 00 89 c5 31 ff 89 c6 e8 96
RSP: 0018:ffffc900041c70e0 EFLAGS: 00010283
RAX: ffffffff8afdc6ca RBX: ffffffff8afdc4e6 RCX: 0000000000080000
RDX: ffffc90010493000 RSI: 0000000000000948 RDI: ffffffff8f9a1700
RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000000
R10: ffffc900041c71e8 R11: fffff52000838e3f R12: dffffc0000000000
R13: ffff888041f9e3c0 R14: ffff888086ee3802 R15: 0000000000000000
FS: 00007f6fe985d6c0(0000) GS:ffff888126176000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f80bd437dac CR3: 0000000025096000 CR4: 00000000003526f0
DR0: ffffffffffffffff DR1: 00000000000001f8 DR2: 0000000000000002
DR3: ffffffffefffff15 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
check_local_dest net/hsr/hsr_forward.c:592 [inline]
fill_frame_info net/hsr/hsr_forward.c:728 [inline]
hsr_forward_skb+0xa11/0x2a80 net/hsr/hsr_forward.c:739
hsr_dev_xmit+0x253/0x370 net/hsr/hsr_device.c:236
__netdev_start_xmit include/linux/netdevice.h:5368 [inline]
netdev_start_xmit include/linux/netdevice.h:5377 [inline]
xmit_one net/core/dev.c:3888 [inline]
dev_hard_start_xmit+0x2df/0x860 net/core/dev.c:3904
__dev_queue_xmit+0x1428/0x3900 net/core/dev.c:4870
neigh_output include/net/neighbour.h:556 [inline]
ip_finish_output2+0xcec/0x10b0 net/ipv4/ip_output.c:237
ip_send_skb net/ipv4/ip_output.c:1510 [inline]
ip_push_pending_frames+0x8b/0x110 net/ipv4/ip_output.c:1530
raw_sendmsg+0x1547/0x1a50 net/ipv4/raw.c:659
sock_sendmsg_nosec net/socket.c:787 [inline]
__sock_sendmsg net/socket.c:802 [inline]
____sys_sendmsg+0x7da/0x9c0 net/socket.c:2698
___sys_sendmsg+0x2a5/0x360 net/socket.c:2752
__sys_sendmsg net/socket.c:2784 [inline]
__do_sys_sendmsg net/socket.c:2789 [inline]
__se_sys_sendmsg net/socket.c:2787 [inline]
__x64_sys_sendmsg+0x1c3/0x2a0 net/socket.c:2787
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x15f/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f6feb62ce59
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f6fe985d028 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f6feb8a6090 RCX: 00007f6feb62ce59
RDX: 0000000000000000 RSI: 0000200000000000 RDI: 0000000000000004
RBP: 00007f6feb6c2d6f R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f6feb8a6128 R14: 00007f6feb8a6090 R15: 00007ffcf01cc488
</TASK>--- net/hsr/hsr_framereg.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
net/hsr/hsr_framereg.c +1 -3
@@ -52,10 +52,8 @@ bool hsr_addr_is_self(struct hsr_priv *hsr, unsigned char *addr)rcu_read_lock (); sn =rcu_dereference (hsr->self_node); -if (!sn) { -WARN_ONCE (1 ,"HSR: No self node\n" ); +if (!sn) goto out; - }if (ether_addr_equal (addr, sn->macaddress_A) ||ether_addr_equal (addr, sn->macaddress_B))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 37/325 net: garp: fix unsigned integer underflow in garp_pdu_parse_attr
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yizhou Zhao <[email protected]>
[ Upstream commit 16e408e607a94b646fb14a2a98422c6877ae4b3c ]
The receive-side GARP attribute parser computes dlen with reversed operands:
dlen = sizeof(*ga) - ga->len;
ga->len is the on-wire attribute length and includes the GARP attribute header. For normal attributes with data, ga->len is larger than sizeof(*ga), so the subtraction underflows in unsigned arithmetic.
The resulting value is later passed to garp_attr_lookup(), whose length argument is u8. After truncation, the parsed data length usually no longer matches the length stored for locally registered attributes, so received Join/Leave events are ignored. This breaks the GARP receive path for common attributes, such as GVRP VLAN registration attributes.
Compute the data length as the attribute length minus the header length.
--- net/802/garp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/802/garp.c +1 -1
@@ -453,7 +453,7 @@ static int garp_pdu_parse_attr(struct garp_applicant *app, struct sk_buff *skb,if (!pskb_may_pull (skb, ga->len))return -1 ;skb_pull (skb, ga->len); - dlen =sizeof (*ga) - ga->len; + dlen = ga->len -sizeof (*ga);if (attrtype > app->app->maxattr)return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 38/325 net: lan743x: permit VLAN-tagged packets up to configured MTU
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Thompson <[email protected]>
[ Upstream commit 8173d22b211f615015f7b35f48ab11a6dd78dc99 ]
VLAN-tagged interfaces on lan743x devices were previously unreachable via SSH and failed to respond to large ping packets (e.g. "ping -s 1469" given MTU=1500). In these scenarios, "ethtool -S" reports non-zero "RX Oversize Frame Errors". According to Microchip AN2948, the MAC_RX FSE (VLAN field size enforcement) bit determines whether frames with VLAN tags exceeding the base MTU plus tag length are discarded.
The driver must set the MAC_RX.FSE bit before setting MAC_RX.RXEN to allow VLAN-tagged frames up to the interface MTU, preventing them from being treated as oversized. As a result, both the base and VLAN-tagged interfaces can use the same MTU without receive errors.
--- drivers/net/ethernet/microchip/lan743x_main.c | 32 +++++++++++++++++++ drivers/net/ethernet/microchip/lan743x_main.h | 1 + 2 files changed, 33 insertions(+)
drivers/net/ethernet/microchip/lan743x_main.c +32 -0
@@ -1212,6 +1212,36 @@ static void lan743x_mac_set_address(struct lan743x_adapter *adapter, "MAC address set to %pM\n", addr); } +static void lan743x_mac_rx_enable_fse (struct lan743x_adapter *adapter) +{ +u32 mac_rx; +bool rxen; + + mac_rx =lan743x_csr_read (adapter,MAC_RX ); +if (mac_rx &MAC_RX_FSE_ ) +return ; + + rxen = mac_rx &MAC_RX_RXEN_ ; +if (rxen) { + mac_rx &= ~MAC_RX_RXEN_ ; +lan743x_csr_write (adapter,MAC_RX , mac_rx); +lan743x_csr_wait_for_bit (adapter,MAC_RX ,MAC_RX_RXD_ , +1 ,1000 ,20000 ,100 ); + } + +/* Per AN2948, hardware prevents modification of the FSE bit while the +* MAC receiver is enabled (RXEN bit set). Use separate register write +* to assert the FSE bit before enabling the RXEN bit in MAC_RX +*/ + mac_rx |=MAC_RX_FSE_ ; +lan743x_csr_write (adapter,MAC_RX , mac_rx); + +if (rxen) { + mac_rx |=MAC_RX_RXEN_ ; +lan743x_csr_write (adapter,MAC_RX , mac_rx); + } +} +static int lan743x_mac_init (struct lan743x_adapter *adapter) {bool mac_address_valid = true;
@@ -1251,6 +1281,8 @@ static int lan743x_mac_init(struct lan743x_adapter *adapter)lan743x_mac_set_address (adapter, adapter->mac_address);eth_hw_addr_set (netdev, adapter->mac_address); +lan743x_mac_rx_enable_fse (adapter); +return 0 ; }
drivers/net/ethernet/microchip/lan743x_main.h +1 -0
@@ -181,6 +181,7 @@#define MAC_RX (0x104)#define MAC_RX_MAX_SIZE_SHIFT_ (16)#define MAC_RX_MAX_SIZE_MASK_ (0x3FFF0000) +#define MAC_RX_FSE_ BIT(2)#define MAC_RX_RXD_ BIT(1)#define MAC_RX_RXEN_ BIT(0)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 39/325 net: fec: fix pinctrl default state restore order on resume
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tapio Reijonen <[email protected]>
[ Upstream commit b455410146bf723c7ebcb49ecd5becc0d6611482 ]
In fec_resume(), fec_enet_clk_enable() is called before pinctrl_pm_select_default_state() in the non-WoL path, inverting the ordering used in fec_suspend() which correctly switches to the sleep pinctrl state before disabling clocks.
For PHYs with the PHY_RST_AFTER_CLK_EN flag (e.g. TI DP83848 or SMSC LAN87xx), fec_enet_clk_enable() triggers a hardware reset pulse via the phy-reset GPIO. With the GPIO pin still in sleep pinctrl state at that point, the GPIO write has no physical effect and the PHY never receives the required reset after clock enable, leading to unreliable link establishment after system resume.
Fix by restoring the default pinctrl state before enabling clocks, making resume the proper mirror of suspend. The call is made
unconditionally: fec_suspend() only switches to the sleep pinctrl state on the non-WoL path and leaves the pins in the default state when WoL is enabled, so on a WoL resume the device is already in the default state and pinctrl_pm_select_default_state() is a no-op.
--- drivers/net/ethernet/freescale/fec_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/freescale/fec_main.c +1 -2
@@ -4772,6 +4772,7 @@ static int fec_resume(struct device *dev)if (fep->rpm_active)pm_runtime_force_resume (dev); +pinctrl_pm_select_default_state (&fep->pdev->dev); ret =fec_enet_clk_enable (ndev, true);if (ret) {rtnl_unlock ();
@@ -4788,8 +4789,6 @@ static int fec_resume(struct device *dev) val &= ~(FEC_ECR_MAGICEN |FEC_ECR_SLEEP );writel (val, fep->hwp +FEC_ECNTRL ); fep->wol_flag &= ~FEC_WOL_FLAG_SLEEP_ON ; - }else { -pinctrl_pm_select_default_state (&fep->pdev->dev); }fec_restart (ndev);netif_tx_lock_bh (ndev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 40/325 ipv6: anycast: insert aca into global hash under idev->lock
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <[email protected]>
[ Upstream commit f723ccaff2fb72b71ae8a9fd283f0dee4d9ae7a3 ]
syzbot reported a splat [1]: a slab-use-after-free in ipv6_chk_acast_addr(), which walks the global inet6_acaddr_lst[] hash under RCU and dereferences a struct ifacaddr6 that has already been freed while still linked in the hash, so a later reader walks into a dangling node.
In __ipv6_dev_ac_inc() the aca is allocated with refcount 1, then aca_get() bumps it to 2 to keep it alive across the unlocked region. It is published to idev->ac_list under idev->lock, but ipv6_add_acaddr_hash() runs after write_unlock_bh(). A concurrent teardown (ipv6_ac_destroy_dev() from addrconf_ifdown(), under RTNL) can slip into that window:
CPU0 __ipv6_dev_ac_inc CPU1 ipv6_ac_destroy_dev (RTNL)
------------------------------ ------------------------------------
aca_alloc() refcnt 1
aca_get() refcnt 2
write_lock_bh(idev->lock)
add aca to ac_list
write_unlock_bh(idev->lock)
write_lock_bh(idev->lock)
pull aca off ac_list
write_unlock_bh(idev->lock) ipv6_del_acaddr_hash(aca)
hlist_del_init_rcu() is a no-op, aca is not in the hash yet
aca_put() refcnt 2->1
ipv6_add_acaddr_hash(aca)
aca now inserted into the hash
aca_put() refcnt 1->0
call_rcu(aca_free_rcu) -> kfree(aca)
The hash removal becomes a no-op because the insertion has not happened yet, so once CPU0 inserts and drops the last reference, the aca is freed while still linked in inet6_acaddr_lst[], and readers dereference freed memory after the slab slot is reused.
This window opened once RTNL stopped serializing the join path against device teardown. Move ipv6_add_acaddr_hash() inside the idev->lock section so the ac_list and hash insertions are atomic with respect to
teardown: a racing remover now either misses the aca entirely or finds it in both lists.
acaddr_hash_lock is now nested under idev->lock, which is acquired in softirq context, so switch all acaddr_hash_lock sites to spin_lock_bh() to avoid the irq lock inversion reported in [2].
[1] https://syzkaller.appspot.com/bug?extid=a01df04303c131efbf3a
[2] https://lore.kernel.org/netdev/[email protected]/
--- net/ipv6/anycast.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
net/ipv6/anycast.c +8 -8
@@ -243,16 +243,16 @@ static void ipv6_add_acaddr_hash(struct net *net, struct ifacaddr6 *aca) {unsigned int hash =inet6_acaddr_hash (net, &aca->aca_addr); -spin_lock (&acaddr_hash_lock); +spin_lock_bh (&acaddr_hash_lock);hlist_add_head_rcu (&aca->aca_addr_lst, &inet6_acaddr_lst[hash]); -spin_unlock (&acaddr_hash_lock); +spin_unlock_bh (&acaddr_hash_lock); }static void ipv6_del_acaddr_hash (struct ifacaddr6 *aca) { -spin_lock (&acaddr_hash_lock); +spin_lock_bh (&acaddr_hash_lock);hlist_del_init_rcu (&aca->aca_addr_lst); -spin_unlock (&acaddr_hash_lock); +spin_unlock_bh (&acaddr_hash_lock); }static void aca_get (struct ifacaddr6 *aca)
@@ -371,10 +371,10 @@ int __ipv6_dev_ac_inc(struct inet6_dev *idev, const struct in6_addr *addr) aca->aca_next = idev->ac_list;rcu_assign_pointer (idev->ac_list, aca); -write_unlock_bh (&idev->lock); -ipv6_add_acaddr_hash (net, aca); +write_unlock_bh (&idev->lock); +ip6_ins_rt (net, f6i);addrconf_join_solict (idev->dev, &aca->aca_addr);
@@ -649,8 +649,8 @@ void ipv6_anycast_cleanup(void) {int i; -spin_lock (&acaddr_hash_lock); +spin_lock_bh (&acaddr_hash_lock);for (i =0 ; i <IN6_ADDR_HSIZE ; i++)WARN_ON (!hlist_empty (&inet6_acaddr_lst[i])); -spin_unlock (&acaddr_hash_lock); +spin_unlock_bh (&acaddr_hash_lock); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 41/325 wifi: fix leak if split 6 GHz scanning fails
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
[ Upstream commit e8694f7cc29287e843648d1075177b9a2000d957 ]
rdev->int_scan_req is leaked if cfg80211_scan() fails. Note that it's supposed to be released at ___cfg80211_scan_done() but this doesn't happen as rdev->scan_req is NULL at that point, too, leading to the early return from the freeing function.
unreferenced object 0xffff8881161d0800 (size 512):
comm "wpa_supplicant", pid 379, jiffies 4294749765 hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 f0 81 13 16 81 88 ff ff ................
backtrace (crc c867fdb6):
kmemleak_alloc+0x89/0x90
__kmalloc_noprof+0x2fd/0x410
cfg80211_scan+0x133/0x730
nl80211_trigger_scan+0xc69/0x1cc0
genl_family_rcv_msg_doit+0x204/0x2f0
genl_rcv_msg+0x431/0x6b0
netlink_rcv_skb+0x143/0x3f0
genl_rcv+0x27/0x40
netlink_unicast+0x4f6/0x820
netlink_sendmsg+0x797/0xce0
__sock_sendmsg+0xc4/0x160
____sys_sendmsg+0x5e4/0x890
___sys_sendmsg+0xf8/0x180
__sys_sendmsg+0x136/0x1e0
__x64_sys_sendmsg+0x76/0xc0
x64_sys_call+0x13f0/0x17d0Found by Linux Verification Center (linuxtesting.org).
--- net/wireless/scan.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
net/wireless/scan.c +8 -1
@@ -1071,6 +1071,7 @@ int cfg80211_scan(struct cfg80211_registered_device *rdev)struct cfg80211_scan_request_int *request;struct cfg80211_scan_request_int *rdev_req = rdev->scan_req;u32 n_channels =0 , idx, i; +int err;if (!(rdev->wiphy.flags &WIPHY_FLAG_SPLIT_SCAN_6GHZ )) { rdev_req->req.first_part = true;
@@ -1101,8 +1102,14 @@ int cfg80211_scan(struct cfg80211_registered_device *rdev) rdev_req->req.scan_6ghz = false; rdev_req->req.first_part = true; + err =rdev_scan (rdev, request); +if (err) { +kfree (request); +return err; + } + rdev->int_scan_req = request; -return rdev_scan (rdev, request); +return 0 ; } void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 42/325 Bluetooth: RFCOMM: hold listener socket in rfcomm_connect_ind()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Cen <[email protected]>
[ Upstream commit 43c441edacf953b39517a44f5e5e10a93618b226 ]
rfcomm_get_sock_by_channel() scans rfcomm_sk_list under the list lock, but returns the selected listener after dropping that lock without taking a reference. rfcomm_connect_ind() then locks the listener, queues a child socket on it, and may notify it after unlocking it.
The buggy scenario involves two paths, with each column showing the order within that path:
rfcomm_connect_ind(): listener close:
1. Find parent in 1. close() enters
rfcomm_get_sock_by_channel() rfcomm_sock_release().
2. Drop rfcomm_sk_list.lock 2. rfcomm_sock_shutdown()
without pinning parent. closes the listener.
3. Call lock_sock(parent) and 3. rfcomm_sock_kill()
bt_accept_enqueue(parent, unlinks and puts parent.
sk, true).
4. Read parent flags and may 4. parent can be freed.
call sk_state_change().
If close wins the race, parent can be freed before rfcomm_connect_ind() reaches lock_sock(), bt_accept_enqueue(), or the deferred-setup callback.
Take a reference on the listener before leaving rfcomm_sk_list.lock. After lock_sock() succeeds, recheck that it is still in BT_LISTEN before queueing a child, cache the deferred-setup bit while the parent is locked, and drop the reference after the last parent use.
KASAN reported a slab-use-after-free in lock_sock_nested() from rfcomm_connect_ind(), with the freeing stack going through rfcomm_sock_kill() and rfcomm_sock_release().
--- net/bluetooth/rfcomm/sock.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-)
net/bluetooth/rfcomm/sock.c +22 -4
@@ -122,7 +122,7 @@ static struct sock *__rfcomm_get_listen_sock_by_addr(u8 channel, bdaddr_t *src) }/* Find socket with channel and source bdaddr. -* Returns closest match. +* Returns closest match with an extra reference held. */ static struct sock *rfcomm_get_sock_by_channel (int state,u8 channel,bdaddr_t *src) {
@@ -136,15 +136,25 @@ static struct sock *rfcomm_get_sock_by_channel(int state, u8 channel, bdaddr_t *if (rfcomm_pi (sk)->channel == channel) {/* Exact match. */ -if (!bacmp (&rfcomm_pi (sk)->src, src)) +if (!bacmp (&rfcomm_pi (sk)->src, src)) { +sock_hold (sk);break ; + }/* Closest match */ -if (!bacmp (&rfcomm_pi (sk)->src,BDADDR_ANY )) +if (!bacmp (&rfcomm_pi (sk)->src,BDADDR_ANY )) { +if (sk1) +sock_put (sk1); + sk1 = sk; +sock_hold (sk1); + } } } +if (sk && sk1) +sock_put (sk1); +read_unlock (&rfcomm_sk_list.lock);return sk ? sk : sk1;
@@ -940,6 +950,7 @@ int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, struct rfcomm_dlc * {struct sock *sk, *parent;bdaddr_t src, dst; +bool defer_setup = false;int result =0 ;BT_DBG ("session %p channel %d" , s, channel);
@@ -953,6 +964,11 @@ int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, struct rfcomm_dlc *lock_sock (parent); +if (parent->sk_state !=BT_LISTEN ) + goto done; + + defer_setup =test_bit (BT_SK_DEFER_SETUP , &bt_sk (parent)->flags); +/* Check for backlog size */ if (sk_acceptq_is_full (parent)) {BT_DBG ("backlog full %d" , parent->sk_ack_backlog);
@@ -980,9 +996,11 @@ int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, struct rfcomm_dlc * done:release_sock (parent); -if (test_bit (BT_SK_DEFER_SETUP , &bt_sk (parent)->flags)) +if (defer_setup) parent->sk_state_change (parent); +sock_put (parent); +return result; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 43/325 Bluetooth: MGMT: validate advertising TLV before type checks
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Cen <[email protected]>
[ Upstream commit de23fb62259aa01d294f77238ae3b835eb674413 ]
tlv_data_is_valid() reads each advertising data field length from data[i], then inspects data[i + 1] for managed EIR types before checking that the current field still fits inside the supplied buffer.
A malformed field whose length byte is the last byte of the buffer can therefore make the parser read one byte past the advertising data.
KASAN reported the following when a malformed MGMT_OP_ADD_ADVERTISING request reached that path:
BUG: KASAN: vmalloc-out-of-bounds in tlv_data_is_valid()
Read of size 1
Call trace:
tlv_data_is_valid()
add_advertising()
hci_mgmt_cmd()
hci_sock_sendmsg()Move the existing element-length check before any type-octet inspection so each non-empty element is proven to contain its type byte before the parser looks at data[i + 1].
--- net/bluetooth/mgmt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
net/bluetooth/mgmt.c +6 -6
@@ -8622,6 +8622,12 @@ static bool tlv_data_is_valid(struct hci_dev *hdev, u32 adv_flags, u8 *data,if (!cur_len)continue ; +/* If the current field length would exceed the total data +* length, then it's invalid. +*/ +if (i + cur_len >= len) +return false; +if (data[i +1 ] ==EIR_FLAGS && (!is_adv_data ||flags_managed (adv_flags)))return false;
@@ -8638,12 +8644,6 @@ static bool tlv_data_is_valid(struct hci_dev *hdev, u32 adv_flags, u8 *data,if (data[i +1 ] ==EIR_APPEARANCE &&appearance_managed (adv_flags))return false; - -/* If the current field length would exceed the total data -* length, then it's invalid. -*/ -if (i + cur_len >= len) -return false; }return true;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 44/325 Bluetooth: RFCOMM: validate skb length in MCC handlers
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeungJu Cheon <[email protected]>
[ Upstream commit 23882b828c3c8c51d0c946446a396b10abb3b16b ]
The RFCOMM MCC handlers cast skb->data to protocol-specific structs without validating skb->len first. A malicious remote device can send truncated MCC frames and trigger out-of-bounds reads in these handlers.
Fix this by using skb_pull_data() to validate and access the required data before dereferencing it.
rfcomm_recv_rpn() requires special handling since ETSI TS 07.10 allows 1-byte RPN requests. Handle this by validating only the DLCI byte first, and validating the full struct only when len > 1.
--- net/bluetooth/rfcomm/core.c | 67 +++++++++++++++++++++++++++---------- 1 file changed, 49 insertions(+), 18 deletions(-)
net/bluetooth/rfcomm/core.c +49 -18
@@ -1431,10 +1431,15 @@ static int rfcomm_apply_pn(struct rfcomm_dlc *d, int cr, struct rfcomm_pn *pn)static int rfcomm_recv_pn (struct rfcomm_session *s,int cr,struct sk_buff *skb) { -struct rfcomm_pn *pn = (void *) skb->data; +struct rfcomm_pn *pn;struct rfcomm_dlc *d; -u8 dlci = pn->dlci; +u8 dlci; + + pn =skb_pull_data (skb,sizeof (*pn)); +if (!pn) +return -EILSEQ ; + dlci = pn->dlci;BT_DBG ("session %p state %ld dlci %d" , s, s->state, dlci);if (!dlci)
@@ -1483,8 +1488,8 @@ static int rfcomm_recv_pn(struct rfcomm_session *s, int cr, struct sk_buff *skb)static int rfcomm_recv_rpn (struct rfcomm_session *s,int cr,int len,struct sk_buff *skb) { -struct rfcomm_rpn *rpn = (void *) skb->data; -u8 dlci =__get_dlci (rpn->dlci); +struct rfcomm_rpn *rpn; +u8 dlci;u8 bit_rate =0 ;u8 data_bits =0 ;
@@ -1495,15 +1500,16 @@ static int rfcomm_recv_rpn(struct rfcomm_session *s, int cr, int len, struct sk_u8 xoff_char =0 ;u16 rpn_mask =RFCOMM_RPN_PM_ALL ; -BT_DBG ("dlci %d cr %d len 0x%x bitr 0x%x line 0x%x flow 0x%x xonc 0x%x xoffc 0x%x pm 0x%x" , - dlci, cr, len, rpn->bit_rate, rpn->line_settings, rpn->flow_ctrl, - rpn->xon_char, rpn->xoff_char, rpn->param_mask); +if (len ==1 ) { + rpn =skb_pull_data (skb,1 ); +if (!rpn) +return -EILSEQ ; -if (!cr) -return 0 ; + dlci =__get_dlci (rpn->dlci); + +if (!cr) +return 0 ; -if (len ==1 ) { -/* This is a request, return default (according to ETSI TS 07.10) settings */ bit_rate =RFCOMM_RPN_BR_9600 ; data_bits =RFCOMM_RPN_DATA_8 ; stop_bits =RFCOMM_RPN_STOP_1 ;
@@ -1514,6 +1520,19 @@ static int rfcomm_recv_rpn(struct rfcomm_session *s, int cr, int len, struct sk_ goto rpn_out; } + rpn =skb_pull_data (skb,sizeof (*rpn)); +if (!rpn) +return -EILSEQ ; + + dlci =__get_dlci (rpn->dlci); + +BT_DBG ("dlci %d cr %d len 0x%x bitr 0x%x line 0x%x flow 0x%x xonc 0x%x xoffc 0x%x pm 0x%x" , + dlci, cr, len, rpn->bit_rate, rpn->line_settings, rpn->flow_ctrl, + rpn->xon_char, rpn->xoff_char, rpn->param_mask); + +if (!cr) +return 0 ; +/* Check for sane values, ignore/accept bit_rate, 8 bits, 1 stop bit, * no parity, no flow control lines, normal XON/XOFF chars */
@@ -1589,9 +1608,14 @@ static int rfcomm_recv_rpn(struct rfcomm_session *s, int cr, int len, struct sk_static int rfcomm_recv_rls (struct rfcomm_session *s,int cr,struct sk_buff *skb) { -struct rfcomm_rls *rls = (void *) skb->data; -u8 dlci =__get_dlci (rls->dlci); +struct rfcomm_rls *rls; +u8 dlci; + rls =skb_pull_data (skb,sizeof (*rls)); +if (!rls) +return -EILSEQ ; + + dlci =__get_dlci (rls->dlci);BT_DBG ("dlci %d cr %d status 0x%x" , dlci, cr, rls->status);if (!cr)
@@ -1608,10 +1632,15 @@ static int rfcomm_recv_rls(struct rfcomm_session *s, int cr, struct sk_buff *skbstatic int rfcomm_recv_msc (struct rfcomm_session *s,int cr,struct sk_buff *skb) { -struct rfcomm_msc *msc = (void *) skb->data; +struct rfcomm_msc *msc;struct rfcomm_dlc *d; -u8 dlci =__get_dlci (msc->dlci); +u8 dlci; + + msc =skb_pull_data (skb,sizeof (*msc)); +if (!msc) +return -EILSEQ ; + dlci =__get_dlci (msc->dlci);BT_DBG ("dlci %d cr %d v24 0x%x" , dlci, cr, msc->v24_sig); d =rfcomm_dlc_get (s, dlci);
@@ -1644,17 +1673,19 @@ static int rfcomm_recv_msc(struct rfcomm_session *s, int cr, struct sk_buff *skbstatic int rfcomm_recv_mcc (struct rfcomm_session *s,struct sk_buff *skb) { -struct rfcomm_mcc *mcc = (void *) skb->data; +struct rfcomm_mcc *mcc;u8 type, cr, len; + mcc =skb_pull_data (skb,sizeof (*mcc)); +if (!mcc) +return -EILSEQ ; + cr =__test_cr (mcc->type); type =__get_mcc_type (mcc->type); len =__get_mcc_len (mcc->len);BT_DBG ("%p type 0x%x cr %d" , s, type, cr); -skb_pull (skb,2 ); -switch (type) {case RFCOMM_PN :rfcomm_recv_pn (s, cr, skb);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 45/325 Bluetooth: bnep: fix incorrect length parsing in bnep_rx_frame() extension handling
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dudu Lu <[email protected]>
[ Upstream commit 72b8deccff17a7644e0367e1aaf1a36cfb014324 ]
In bnep_rx_frame(), the BNEP_FILTER_NET_TYPE_SET and BNEP_FILTER_MULTI_ADDR_SET extension header parsing has two bugs:
1) The 2-byte length field is read with *(u16 *)(skb->data + 1), which performs a native-endian read. The BNEP protocol specifies this field in big-endian (network byte order), and the same file correctly uses get_unaligned_be16() for the identical fields in bnep_ctrl_set_netfilter() and bnep_ctrl_set_mcfilter().
2) The length is multiplied by 2, but unlike BNEP_SETUP_CONN_REQ where the length byte counts UUID pairs (requiring * 2 for two UUIDs per entry), the filter extension length field already represents the total data size in bytes. This is confirmed by bnep_ctrl_set_netfilter() which reads the same field as a byte count and divides by 4 to get the number of filter entries.
The bogus * 2 means skb_pull advances twice as far as it should, either dropping valid data from the next header or causing the pull to fail entirely when the doubled length exceeds the remaining skb.
Fix by splitting the pull into two steps: first use skb_pull_data() to safely pull and validate the 3-byte fixed header (ctrl type + length), then pull the variable-length data using the properly decoded length.
--- net/bluetooth/bnep/core.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
net/bluetooth/bnep/core.c +10 -3
@@ -330,11 +330,18 @@ static int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb) goto badframe;break ;case BNEP_FILTER_MULTI_ADDR_SET : -case BNEP_FILTER_NET_TYPE_SET : -/* Pull: ctrl type (1 b), len (2 b), data (len bytes) */ -if (!skb_pull (skb,3 + *(u16 *)(skb->data +1 ) *2 )) +case BNEP_FILTER_NET_TYPE_SET : { +u8 *hdr; + +/* Pull ctrl type (1 b) + len (2 b) */ + hdr =skb_pull_data (skb,3 ); +if (!hdr) + goto badframe; +/* Pull data (len bytes); length is big-endian */ +if (!skb_pull (skb,get_unaligned_be16 (&hdr[1 ]))) goto badframe;break ; + }default :kfree_skb (skb);return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 46/325 Bluetooth: bnep: reject short frames before parsing
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Cen <[email protected]>
[ Upstream commit 6770d3a8acdf9151769180cc3710346c4cfbe6f0 ]
A BNEP peer can send a short BNEP SDU. bnep_rx_frame() reads the packet type byte immediately and, for control packets, reads the control opcode and setup UUID-size byte before proving that those bytes are present. bnep_rx_control() also dereferences the control opcode without rejecting an empty control payload.
Use skb_pull_data() for the fixed fields in bnep_rx_frame() so a NULL return gates each dereference. Split the control handler so the frame path can pass an opcode that has already been pulled, and keep the byte-buffer wrapper for extension control payloads.
For BNEP_SETUP_CONN_REQ, name the UUID-size byte before pulling the setup payload. struct bnep_setup_conn_req carries destination and source service UUIDs after that byte, each uuid_size bytes, so the parser now documents that tuple explicitly instead of leaving the pull length as an opaque multiplication.
Validation reproduced this kernel report:
KASAN slab-out-of-bounds in bnep_rx_frame.isra.0+0x130c/0x1790
The buggy address belongs to the object at ffff88800c0f7908 which belongs to the cache kmalloc-8 of size 8 The buggy address is located 0 bytes to the right of allocated 1-byte region [ffff88800c0f7908, ffff88800c0f7909) Read of size 1 Call trace: dump_stack_lvl+0xb3/0x140 (?:?) print_address_description+0x57/0x3a0 (?:?) bnep_rx_frame+0x130c/0x1790 (net/bluetooth/bnep/core.c:306) print_report+0xb9/0x2b0 (?:?) __virt_addr_valid+0x1ba/0x3a0 (?:?) srso_alias_return_thunk+0x5/0xfbef5 (?:?) kasan_addr_to_slab+0x21/0x60 (?:?) kasan_report+0xe0/0x110 (?:?) process_one_work+0xfce/0x17e0 (kernel/workqueue.c:3200) worker_thread+0x65c/0xe40 (?:?) __kthread_parkme+0x184/0x230 (?:?) kthread+0x35e/0x470 (?:?) _raw_spin_unlock_irq+0x28/0x50 (?:?) ret_from_fork+0x586/0x870 (?:?) __switch_to+0x74f/0xdc0 (?:?) ret_from_fork_asm+0x1a/0x30 (?:?)
--- net/bluetooth/bnep/core.c | 57 ++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 21 deletions(-)
net/bluetooth/bnep/core.c +36 -21
@@ -206,14 +206,11 @@ static int bnep_ctrl_set_mcfilter(struct bnep_session *s, u8 *data, int len)return 0 ; } -static int bnep_rx_control (struct bnep_session *s,void *data,int len) +static int bnep_rx_control_cmd (struct bnep_session *s,u8 cmd,void *data, +int len) { -u8 cmd = *(u8 *)data;int err =0 ; - data++; - len--; -switch (cmd) {case BNEP_CMD_NOT_UNDERSTOOD :case BNEP_SETUP_CONN_RSP :
@@ -254,6 +251,14 @@ static int bnep_rx_control(struct bnep_session *s, void *data, int len)return err; } +static int bnep_rx_control (struct bnep_session *s,void *data,int len) +{ +if (len <1 ) +return -EILSEQ ; + +return bnep_rx_control_cmd (s, *(u8 *)data, data +1 , len -1 ); +} +static int bnep_rx_extension (struct bnep_session *s,struct sk_buff *skb) {struct bnep_ext_hdr *h;
@@ -299,19 +304,26 @@ static int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb) {struct net_device *dev = s->dev;struct sk_buff *nskb; +u8 *data;u8 type, ctrl_type; dev->stats.rx_bytes += skb->len; - type = *(u8 *) skb->data; -skb_pull (skb,1 ); - ctrl_type = *(u8 *)skb->data; + data =skb_pull_data (skb,sizeof (type)); +if (!data) + goto badframe; + type = *data;if ((type &BNEP_TYPE_MASK ) >=sizeof (__bnep_rx_hlen)) goto badframe;if ((type &BNEP_TYPE_MASK ) ==BNEP_CONTROL ) { -if (bnep_rx_control (s, skb->data, skb->len) <0 ) { + data =skb_pull_data (skb,sizeof (ctrl_type)); +if (!data) + goto badframe; + ctrl_type = *data; + +if (bnep_rx_control_cmd (s, ctrl_type, skb->data, skb->len) <0 ) { dev->stats.tx_errors++;kfree_skb (skb);return 0 ;
@@ -324,24 +336,27 @@ static int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb)/* Verify and pull ctrl message since it's already processed */ switch (ctrl_type) { -case BNEP_SETUP_CONN_REQ : -/* Pull: ctrl type (1 b), len (1 b), data (len bytes) */ -if (!skb_pull (skb,2 + *(u8 *)(skb->data +1 ) *2 )) +case BNEP_SETUP_CONN_REQ : { +u8 uuid_size; + +/* Pull uuid_size and the dst/src service UUIDs. */ + data =skb_pull_data (skb,sizeof (uuid_size)); +if (!data) + goto badframe; + uuid_size = *data; +if (!skb_pull (skb, uuid_size + uuid_size)) goto badframe;break ; + }case BNEP_FILTER_MULTI_ADDR_SET : -case BNEP_FILTER_NET_TYPE_SET : { -u8 *hdr; - -/* Pull ctrl type (1 b) + len (2 b) */ - hdr =skb_pull_data (skb,3 ); -if (!hdr) +case BNEP_FILTER_NET_TYPE_SET : +/* Pull: len (2 b), data (len bytes) */ + data =skb_pull_data (skb,sizeof (u16)); +if (!data) goto badframe; -/* Pull data (len bytes); length is big-endian */ -if (!skb_pull (skb,get_unaligned_be16 (&hdr[1 ]))) +if (!skb_pull (skb,get_unaligned_be16 (data))) goto badframe;break ; - }default :kfree_skb (skb);return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 47/325 Bluetooth: fix memory leak in error path of hci_alloc_dev()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bharath Reddy <[email protected]>
[ Upstream commit 37b3009bf5976e8ab77c8b9a9bc3bbd7ff49e37f ]
Early failures in Bluetooth HCI UART configuration leak SRCU percpu memory.
When device initialization fails before hci_register_dev() completes, the HCI_UNREGISTER flag is never set. As a result, when the device reference count reaches zero, bt_host_release() evaluates this flag as false and falls back to a direct kfree(hdev).
Because hci_release_dev() is bypassed, the SRCU struct initialized early in hci_alloc_dev() is never cleaned up, resulting in a leak of percpu memory.
Fix the leak by explicitly calling cleanup_srcu_struct() in the fallback (unregistered) branch of bt_host_release() before freeing the device.
--- net/bluetooth/hci_sysfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/bluetooth/hci_sysfs.c +4 -2
@@ -83,10 +83,12 @@ static void bt_host_release(struct device *dev) {struct hci_dev *hdev =to_hci_dev (dev); -if (hci_dev_test_flag (hdev,HCI_UNREGISTER )) +if (hci_dev_test_flag (hdev,HCI_UNREGISTER )) {hci_release_dev (hdev); -else + }else { +cleanup_srcu_struct (&hdev->srcu);kfree (hdev); + }module_put (THIS_MODULE ); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 48/325 Bluetooth: ISO: Fix not releasing hdev reference on iso_conn_big_sync
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 5cbf290b79351971f20c7a533247e8d58a3f970c ]
hci_get_route() returns a reference-counted hci_dev pointer via hci_dev_hold(). The function exits normally or with an error without ever releasing it.
--- net/bluetooth/iso.c | 1 + 1 file changed, 1 insertion(+)
net/bluetooth/iso.c +1 -0
@@ -1521,6 +1521,7 @@ static void iso_conn_big_sync(struct sock *sk)release_sock (sk);hci_dev_unlock (hdev); +hci_dev_put (hdev); } static int iso_sock_recvmsg(struct socket *sock, struct msghdr *msg,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 49/325 Bluetooth: ISO: Fix data-race on iso_pi fields in hci_get_route calls
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeungJu Cheon <[email protected]>
[ Upstream commit 9ca7053d6215d89c33f28893bfd1625a32919d3f ]
iso_connect_bis(), iso_connect_cis(), iso_listen_bis(), and iso_conn_big_sync() call hci_get_route() using iso_pi(sk)->dst, iso_pi(sk)->src, and iso_pi(sk)->src_type without holding lock_sock().
These fields may be modified concurrently by connect() or setsockopt() on the same socket, resulting in data-races reported by KCSAN.
Fix this by snapshotting the required fields under lock_sock() before calling hci_get_route().
BUG: KCSAN: data-race in memcmp+0x45/0xb0
race at unknown origin, with read to 0xffff8880122135cf of 1 bytes by task 333 on cpu 1:
memcmp+0x45/0xb0 hci_get_route+0x27e/0x490 iso_connect_cis+0x4c/0xa10 iso_sock_connect+0x60e/0xb30 __sys_connect_file+0xbd/0xe0 __sys_connect+0xe0/0x110 __x64_sys_connect+0x40/0x50 x64_sys_call+0xcad/0x1c60 do_syscall_64+0x133/0x590 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- net/bluetooth/iso.c | 60 +++++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 16 deletions(-)
net/bluetooth/iso.c +44 -16
@@ -336,12 +336,20 @@ static int iso_connect_bis(struct sock *sk)struct iso_conn *conn;struct hci_conn *hcon;struct hci_dev *hdev; +bdaddr_t src, dst; +u8 src_type, bc_sid;int err; -BT_DBG ("%pMR (SID 0x%2.2x)" , &iso_pi (sk)->src,iso_pi (sk)->bc_sid); +lock_sock (sk); +bacpy (&src, &iso_pi (sk)->src); +bacpy (&dst, &iso_pi (sk)->dst); + src_type =iso_pi (sk)->src_type; + bc_sid =iso_pi (sk)->bc_sid; +release_sock (sk); - hdev =hci_get_route (&iso_pi (sk)->dst, &iso_pi (sk)->src, -iso_pi (sk)->src_type); +BT_DBG ("%pMR (SID 0x%2.2x)" , &src, bc_sid); + + hdev =hci_get_route (&dst, &src, src_type);if (!hdev)return -EHOSTUNREACH ;
@@ -433,12 +441,19 @@ static int iso_connect_cis(struct sock *sk)struct iso_conn *conn;struct hci_conn *hcon;struct hci_dev *hdev; +bdaddr_t src, dst; +u8 src_type;int err; -BT_DBG ("%pMR -> %pMR" , &iso_pi (sk)->src, &iso_pi (sk)->dst); +lock_sock (sk); +bacpy (&src, &iso_pi (sk)->src); +bacpy (&dst, &iso_pi (sk)->dst); + src_type =iso_pi (sk)->src_type; +release_sock (sk); + +BT_DBG ("%pMR -> %pMR" , &src, &dst); - hdev =hci_get_route (&iso_pi (sk)->dst, &iso_pi (sk)->src, -iso_pi (sk)->src_type); + hdev =hci_get_route (&dst, &src, src_type);if (!hdev)return -EHOSTUNREACH ;
@@ -1138,18 +1153,25 @@ static int iso_sock_connect(struct socket *sock, struct sockaddr *addr,static int iso_listen_bis (struct sock *sk) { -struct hci_dev *hdev; -int err =0 ;struct iso_conn *conn;struct hci_conn *hcon; +struct hci_dev *hdev; +bdaddr_t src, dst; +u8 src_type, bc_sid; +int err =0 ; + +lock_sock (sk); +bacpy (&src, &iso_pi (sk)->src); +bacpy (&dst, &iso_pi (sk)->dst); + src_type =iso_pi (sk)->src_type; + bc_sid =iso_pi (sk)->bc_sid; +release_sock (sk); -BT_DBG ("%pMR -> %pMR (SID 0x%2.2x)" , &iso_pi (sk)->src, - &iso_pi (sk)->dst,iso_pi (sk)->bc_sid); +BT_DBG ("%pMR -> %pMR (SID 0x%2.2x)" , &src, &dst, bc_sid);write_lock (&iso_sk_list.lock); -if (__iso_get_sock_listen_by_sid (&iso_pi (sk)->src, &iso_pi (sk)->dst, -iso_pi (sk)->bc_sid)) +if (__iso_get_sock_listen_by_sid (&src, &dst, bc_sid)) err = -EADDRINUSE ;write_unlock (&iso_sk_list.lock);
@@ -1157,8 +1179,7 @@ static int iso_listen_bis(struct sock *sk)if (err)return err; - hdev =hci_get_route (&iso_pi (sk)->dst, &iso_pi (sk)->src, -iso_pi (sk)->src_type); + hdev =hci_get_route (&dst, &src, src_type);if (!hdev)return -EHOSTUNREACH ;
@@ -1494,9 +1515,16 @@ static void iso_conn_big_sync(struct sock *sk) {int err;struct hci_dev *hdev; +bdaddr_t src, dst; +u8 src_type; + +lock_sock (sk); +bacpy (&src, &iso_pi (sk)->src); +bacpy (&dst, &iso_pi (sk)->dst); + src_type =iso_pi (sk)->src_type; +release_sock (sk); - hdev =hci_get_route (&iso_pi (sk)->dst, &iso_pi (sk)->src, -iso_pi (sk)->src_type); + hdev =hci_get_route (&dst, &src, src_type);if (!hdev)return ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 50/325 Bluetooth: SCO: Fix data-race on sco_pi fields in sco_connect
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeungJu Cheon <[email protected]>
[ Upstream commit 4847c5bca22227100ae69e96af86618b6fd2671f ]
sco_sock_connect() copies the destination address into sco_pi(sk)->dst under lock_sock(), then releases the lock and calls sco_connect(), which reads dst, src, setting, and codec without holding lock_sock() in hci_get_route() and hci_connect_sco().
These fields may be modified concurrently by connect(), bind(), or setsockopt() on the same socket, resulting in data-races reported by KCSAN.
Fix this by snapshotting dst, src, setting, and codec under lock_sock() at the start of sco_connect() before passing them to hci_get_route() and hci_connect_sco().
BUG: KCSAN: data-race in memcmp+0x45/0xb0
race at unknown origin, with read to 0xffff88800e6b0dd0 of 1 bytes by task 315 on cpu 0:
memcmp+0x45/0xb0 hci_connect_acl+0x1b7/0x6b0 hci_connect_sco+0x4d/0xb30 sco_sock_connect+0x27b/0xd60 __sys_connect_file+0xbd/0xe0 __sys_connect+0xe0/0x110 __x64_sys_connect+0x40/0x50 x64_sys_call+0xcad/0x1c60 do_syscall_64+0x133/0x590 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- net/bluetooth/sco.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
net/bluetooth/sco.c +15 -5
@@ -312,11 +312,21 @@ static int sco_connect(struct sock *sk)struct sco_conn *conn;struct hci_conn *hcon;struct hci_dev *hdev; +bdaddr_t src, dst; +struct bt_codec codec; +__u16 setting;int err, type; -BT_DBG ("%pMR -> %pMR" , &sco_pi (sk)->src, &sco_pi (sk)->dst); +lock_sock (sk); +bacpy (&src, &sco_pi (sk)->src); +bacpy (&dst, &sco_pi (sk)->dst); + setting =sco_pi (sk)->setting; + codec =sco_pi (sk)->codec; +release_sock (sk); + +BT_DBG ("%pMR -> %pMR" , &src, &dst); - hdev =hci_get_route (&sco_pi (sk)->dst, &sco_pi (sk)->src,BDADDR_BREDR ); + hdev =hci_get_route (&dst, &src,BDADDR_BREDR );if (!hdev)return -EHOSTUNREACH ;
@@ -327,7 +337,7 @@ static int sco_connect(struct sock *sk)else type =SCO_LINK ; -switch (sco_pi (sk)->setting &SCO_AIRMODE_MASK ) { +switch (setting &SCO_AIRMODE_MASK ) {case SCO_AIRMODE_TRANSP :if (!lmp_transp_capable (hdev) || !lmp_esco_capable (hdev)) { err = -EOPNOTSUPP ;
@@ -336,8 +346,8 @@ static int sco_connect(struct sock *sk)break ; } - hcon =hci_connect_sco (hdev, type, &sco_pi (sk)->dst, -sco_pi (sk)->setting, &sco_pi (sk)->codec, + hcon =hci_connect_sco (hdev, type, &dst, + setting, &codec,READ_ONCE (sk->sk_sndtimeo));if (IS_ERR (hcon)) { err =PTR_ERR (hcon);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 51/325 Bluetooth: MGMT: Fix backward compatibility with userspace
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 149324fc762c2a7acef9c26790566f81f475e51f ]
bluetoothd has a bug with makes it send extra bytes as part of MGMT_OP_ADD_EXT_ADV_DATA which are now being checked to be the exact the expected length, relax this so only when the expected length is greater than the data length to cause an error since that would result in accessing invalid memory, otherwise just ignore the extra bytes.
--- net/bluetooth/mgmt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/bluetooth/mgmt.c +3 -2
@@ -9098,8 +9098,9 @@ static int add_ext_adv_data(struct sock *sk, struct hci_dev *hdev, void *data,BT_DBG ("%s" , hdev->name); - expected_len =struct_size (cp, data, cp->adv_data_len + cp->scan_rsp_len); -if (expected_len != data_len) + expected_len =struct_size (cp, data, cp->adv_data_len + + cp->scan_rsp_len); +if (expected_len > data_len)return mgmt_cmd_status (sk, hdev->id,MGMT_OP_ADD_EXT_ADV_DATA ,MGMT_STATUS_INVALID_PARAMS );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 52/325 xsk: cache csum_start/csum_offset to fix TOCTOU in xsk_skb_metadata()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Xing <[email protected]>
[ Upstream commit 22ba97ea9cc1f63a0d0244fae38057ed452b6ac7 ]
The TX metadata area resides in the UMEM buffer which is memory-mapped and concurrently writable by userspace. In xsk_skb_metadata(), csum_start and csum_offset are read from shared memory for bounds validation, then read again for skb assignment. A malicious userspace application can race to overwrite these values between the two reads, bypassing the bounds check and causing out-of-bounds memory access during checksum computation in the transmit path.
Fix this by reading csum_start and csum_offset into local variables once, then using the local copies for both validation and assignment.
Note that other metadata fields (flags, launch_time) and the cached csum fields may be mutually inconsistent due to concurrent userspace writes, but this is benign: the only security-critical invariant is that each field's validated value is the same one used, which local caching guarantees.
--- net/xdp/xsk.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
net/xdp/xsk.c +7 -4
@@ -685,6 +685,7 @@ static int xsk_skb_metadata(struct sk_buff *skb, void *buffer, u32 hr) {struct xsk_tx_metadata *meta =NULL ; +u16 csum_start, csum_offset;if (unlikely (pool->tx_metadata_len ==0 ))return -EINVAL ;
@@ -694,13 +695,15 @@ static int xsk_skb_metadata(struct sk_buff *skb, void *buffer,return -EINVAL ;if (meta->flags &XDP_TXMD_FLAGS_CHECKSUM ) { -if (unlikely (meta->request.csum_start + - meta->request.csum_offset + + csum_start =READ_ONCE (meta->request.csum_start); + csum_offset =READ_ONCE (meta->request.csum_offset); + +if (unlikely (csum_start + csum_offset +sizeof (__sum16) > desc->len))return -EINVAL ; - skb->csum_start = hr + meta->request.csum_start; - skb->csum_offset = meta->request.csum_offset; + skb->csum_start = hr + csum_start; + skb->csum_offset = csum_offset; skb->ip_summed =CHECKSUM_PARTIAL ;if (unlikely (pool->tx_sw_csum)) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 53/325 octeontx2-pf: Fix NDC sync operation errors
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geetha sowjanya <[email protected]>
[ Upstream commit a910fb8f7b9e4c566db363e6c2ec378dc7153995 ]
On system reboot "rvu_nicpf 0002:03:00.0: NDC sync operation failed" error messages are shown, even if the operations is successful. This is due to wrong if error check in ndc_syc() function.
--- drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +1 -1
@@ -3481,7 +3481,7 @@ static void otx2_ndc_sync(struct otx2_nic *pf) req->nix_lf_rx_sync =1 ; req->npa_lf_sync =1 ; -if (!otx2_sync_mbox_msg (mbox)) +if (otx2_sync_mbox_msg (mbox))dev_err (pf->dev,"NDC sync operation failed\n" );mutex_unlock (&mbox->lock);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 54/325 octeontx2-af: Fix initialization of mcams entry2target_pffunc field
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suman Ghosh <[email protected]>
[ Upstream commit 9a85ec3dc28b6df246801c19e4d9bae6297a25b0 ]
NPC mcam entry stores a mapping between mcam entry and target pcifunc. During initialization of this field, API kmalloc_array has been used which caused some junk values to array. Whereas, the array is expected to be initialized by 0. This patch fixes the same by using kcalloc instead of kmalloc_array.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +2 -2
@@ -1932,8 +1932,8 @@ int npc_mcam_rsrcs_init(struct rvu *rvu, int blkaddr) goto free_entry_cntr_map;/* Alloc memory for saving target device of mcam rule */ - mcam->entry2target_pffunc =kmalloc_array (mcam->total_entries, -sizeof (u16),GFP_KERNEL ); + mcam->entry2target_pffunc =kcalloc (mcam->total_entries, +sizeof (u16),GFP_KERNEL );if (!mcam->entry2target_pffunc) goto free_cntr_refcnt;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 55/325 af_unix: Fix inq_len update problem in partial read
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jianyu Li <[email protected]>
[ Upstream commit c1f07a7f2d47aeb9878301e7bb36bc1c2bc2be8e ]
Currently inq_len is updated only when the whole skb is consumed. If only part of the data is read, following SIOCINQ query would get value greater than what actually left.
This change update inq_len timely in unix_stream_read_generic(), and adjust unix_stream_read_skb() accordingly to prevent repetitive update.
--- net/unix/af_unix.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
net/unix/af_unix.c +6 -5
@@ -2891,7 +2891,7 @@ static int unix_stream_read_skb(struct sock *sk, skb_read_actor_t recv_actor)return -EAGAIN ; } -WRITE_ONCE (u->inq_len, u->inq_len - skb->len); +WRITE_ONCE (u->inq_len, u->inq_len -unix_skb_len (skb));#if IS_ENABLED (CONFIG_AF_UNIX_OOB )if (skb == u->oob_skb) {
@@ -3065,11 +3065,12 @@ static int unix_stream_read_generic(struct unix_stream_read_state *state,unix_detach_fds (&scm, skb); } -if (unix_skb_len (skb)) -break ; -spin_lock (&sk->sk_receive_queue.lock); -WRITE_ONCE (u->inq_len, u->inq_len - skb->len); +WRITE_ONCE (u->inq_len, u->inq_len - chunk); +if (unix_skb_len (skb)) { +spin_unlock (&sk->sk_receive_queue.lock); +break ; + }__skb_unlink (skb, &sk->sk_receive_queue);spin_unlock (&sk->sk_receive_queue.lock);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 56/325 ipv4: restrict IPOPT_SSRR and IPOPT_LSRR options
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit d3915a1f5a4bc0ac911032903c3c6ab8df9fcc7c ]
This patch restricts setting Loose Source and Record Route (LSRR) and Strict Source and Record Route (SSRR) IP options to users with CAP_NET_RAW capability.
This prevents unprivileged applications from forcing packets to route through attacker-controlled nodes to leak TCP ISN and possibly other protocol information.
While LSRR and SSRR are commonly filtered in many network environments, they may still be supported and forwarded along some network paths.
RFC 7126 (Recommendations on Filtering of IPv4 Packets Containing IPv4 Options) recommend to drop these options in 4.3 and 4.4.
--- net/ipv4/ip_options.c | 4 ++++ 1 file changed, 4 insertions(+)
net/ipv4/ip_options.c +4 -0
@@ -530,6 +530,10 @@ int ip_options_get(struct net *net, struct ip_options_rcu **optp,kfree (opt);return -EINVAL ; } +if (opt->opt.srr && !ns_capable (net->user_ns,CAP_NET_RAW )) { +kfree (opt); +return -EPERM ; + }kfree (*optp); *optp = opt;return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 57/325 ptp: vclock: Switch from RCU to SRCU
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kurt Kanzenbach <[email protected]>
[ Upstream commit 672bd0519e27c357c43b7f8c0d653fce3817d06e ]
The usage of PTP vClocks leads immediately to the following issues with ptp4l with LOCKDEP and DEBUG_ATOMIC_SLEEP enabled: "BUG: sleeping function called from invalid context".
ptp_convert_timestamp() acquires a mutex_t within a RCU read section. This is illegal, because acquiring a mutex_t can result in voluntary scheduling request which is not allowed within a RCU read section.
Replace the RCU usage with SRCU where sleeping is allowed.
--- drivers/ptp/ptp_vclock.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/ptp/ptp_vclock.c +9 -5
@@ -19,6 +19,8 @@ static DEFINE_SPINLOCK(vclock_hash_lock); static DEFINE_READ_MOSTLY_HASHTABLE(vclock_hash, 8); +DEFINE_STATIC_SRCU (vclock_srcu); +static void ptp_vclock_hash_add (struct ptp_vclock *vclock) {spin_lock (&vclock_hash_lock);
@@ -37,7 +39,7 @@ static void ptp_vclock_hash_del(struct ptp_vclock *vclock)spin_unlock (&vclock_hash_lock); -synchronize_rcu (); +synchronize_srcu (&vclock_srcu); }static int ptp_vclock_adjfine (struct ptp_clock_info *ptp,long scaled_ppm)
@@ -276,14 +278,16 @@ ktime_t ptp_convert_timestamp(const ktime_t *hwtstamp, int vclock_index) {unsigned int hash = vclock_index %HASH_SIZE (vclock_hash);struct ptp_vclock *vclock; -u64 ns;u64 vclock_ns =0 ; +int srcu_idx; +u64 ns; ns =ktime_to_ns (*hwtstamp); -rcu_read_lock (); + srcu_idx =srcu_read_lock (&vclock_srcu); -hlist_for_each_entry_rcu (vclock, &vclock_hash[hash], vclock_hash_node) { +hlist_for_each_entry_srcu (vclock, &vclock_hash[hash], vclock_hash_node, +srcu_read_lock_held (&vclock_srcu)) {if (vclock->clock->index != vclock_index)continue ;
@@ -294,7 +298,7 @@ ktime_t ptp_convert_timestamp(const ktime_t *hwtstamp, int vclock_index)break ; } -rcu_read_unlock (); +srcu_read_unlock (&vclock_srcu, srcu_idx);return ns_to_ktime (vclock_ns); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 58/325 net: airoha: Fix use-after-free in metadata dst teardown
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <[email protected]>
[ Upstream commit b38cae85d1c45ff189d7ecb6ac36f41cdc3d84d0 ]
airoha_metadata_dst_free() runs metadata_dst_free() which frees the metadata_dst with kfree() immediately, bypassing the RCU grace period. In the RX path, skb_dst_set_noref() sets a non-refcounted pointer from the skb to the metadata_dst. This function requires RCU read-side protection and the dst must remain valid until all RCU readers complete. Since metadata_dst_free() calls kfree() directly, an use-after-free can occur if any skb still holds a noref pointer to the dst when the driver tears it down.
Replace metadata_dst_free() with dst_release() which properly goes through the refcount path: when the refcount drops to zero, it schedules the actual free via call_rcu_hurry(), ensuring all RCU readers have completed before the memory is freed.
--- drivers/net/ethernet/airoha/airoha_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/airoha/airoha_eth.c +1 -1
@@ -2933,7 +2933,7 @@ static void airoha_metadata_dst_free(struct airoha_gdm_port *port)if (!port->dsa_meta[i])continue ; -metadata_dst_free (port->dsa_meta[i]); +dst_release (&port->dsa_meta[i]->dst); } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 59/325 net: ethernet: mtk_eth_soc: Fix use-after-free in metadata dst teardown
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <[email protected]>
[ Upstream commit 80df409e1a483676826a6c66e693dba6ac507751 ]
mtk_free_dev() calls metadata_dst_free() which frees the metadata_dst with kfree() immediately, bypassing the RCU grace period.
In the RX path, skb_dst_set_noref() sets a non-refcounted pointer from the skb to the metadata_dst. This function requires RCU read-side protection and the dst must remain valid until all RCU readers complete. Since metadata_dst_free() calls kfree() directly, a use-after-free can occur if any skb still holds a noref pointer to the dst when the driver tears it down.
Replace metadata_dst_free() with dst_release() which properly goes through the refcount path: when the refcount drops to zero, it schedules the actual free via call_rcu_hurry(), ensuring all RCU readers have completed before the memory is freed.
--- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mediatek/mtk_eth_soc.c +1 -1
@@ -4470,7 +4470,7 @@ static int mtk_free_dev(struct mtk_eth *eth)for (i =0 ; i <ARRAY_SIZE (eth->dsa_meta); i++) {if (!eth->dsa_meta[i])break ; -metadata_dst_free (eth->dsa_meta[i]); +dst_release (ð->dsa_meta[i]->dst); }return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 60/325 net/sched: fix pedit partial COW leading to page cache corruption
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rajat Gupta <[email protected]>
[ Upstream commit 899ee91156e57784090c5565e4f31bd7dbffbc5a ]
tcf_pedit_act() computes the COW range for skb_ensure_writable() once before the key loop using tcfp_off_max_hint, but the hint does not account for the runtime header offset added by typed keys. This can leave part of the write region un-COW'd.
Fix by moving skb_ensure_writable() inside the per-key loop where the actual write offset is known, and add overflow checking on the offset arithmetic. For negative offsets (e.g. Ethernet header edits at ingress), use skb_cow() to COW the headroom instead. Guard offset_valid() against INT_MIN, where negation is undefined.
--- include/net/tc_act/tc_pedit.h | 1 - net/sched/act_pedit.c | 77 +++++++++++++++++++---------------- 2 files changed, 41 insertions(+), 37 deletions(-)
include/net/tc_act/tc_pedit.h +0 -1
@@ -15,7 +15,6 @@ struct tcf_pedit_parms {struct tc_pedit_key *tcfp_keys;struct tcf_pedit_key_ex *tcfp_keys_ex;int action; -u32 tcfp_off_max_hint;unsigned char tcfp_nkeys;unsigned char tcfp_flags;struct rcu_head rcu;
net/sched/act_pedit.c +41 -36
155 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 61/325 sctp: validate cached peer INIT chunk length in COOKIE_ECHO processing
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
[ Upstream commit 0861615c28de668669d748ef4eb913ea9262d13b ]
When a listening SCTP server processes a COOKIE_ECHO chunk, the cached peer INIT chunk embedded after the cookie is parsed and its parameters are later walked by sctp_process_init() using sctp_walk_params().
However, the chunk header length of this cached INIT chunk was not validated against the remaining buffer in the COOKIE_ECHO payload. If the length field is inflated, the parameter walk can run beyond the actual received data, leading to out-of-bounds reads and potential memory corruption during later parameter handling (e.g. STATE_COOKIE processing and kmemdup() copies).
Add a bounds check in sctp_unpack_cookie() to ensure the cached INIT chunk length does not exceed the available data in the COOKIE_ECHO buffer before it is used.
--- net/sctp/sm_make_chunk.c | 5 +++++ 1 file changed, 5 insertions(+)
net/sctp/sm_make_chunk.c +5 -0
@@ -1730,6 +1730,7 @@ struct sctp_association *sctp_unpack_cookie(struct sctp_signed_cookie *cookie;struct sk_buff *skb = chunk->skb;struct sctp_cookie *bear_cookie; +struct sctp_chunkhdr *ch;enum sctp_scope scope;unsigned int len;ktime_t kt;
@@ -1759,6 +1760,10 @@ struct sctp_association *sctp_unpack_cookie( cookie = chunk->subh.cookie_hdr; bear_cookie = &cookie->c; + ch = (struct sctp_chunkhdr *)(bear_cookie +1 ); +if (ntohs (ch->length) > len - fixed_size) + goto malformed; +/* Verify the cookie's MAC, if cookie authentication is enabled. */ if (sctp_sk (ep->base.sk)->cookie_auth_enable) {u8 mac[SHA256_DIGEST_SIZE ];
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 62/325 octeontx2-af: npc: Fix CPT channel mask in npc_install_flow
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nithin Dabilpuram <[email protected]>
[ Upstream commit 1d31eb27e570daa04f5373345f9ac98c95863be9 ]
Use the CPT-aware NIX channel mask in the npc_install_flow path so that when the host PF installs steering rules in kernel for a VF used from userspace (e.g. DPDK), MCAM entries see the same channel mask semantics as other RX paths.
--- .../net/ethernet/marvell/octeontx2/af/rvu.h | 1 + .../ethernet/marvell/octeontx2/af/rvu_npc.c | 32 +++++++++---------- .../marvell/octeontx2/af/rvu_npc_fs.c | 2 +- 3 files changed, 18 insertions(+), 17 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +1 -0
@@ -1124,6 +1124,7 @@ int rvu_cpt_lf_teardown(struct rvu *rvu, u16 pcifunc, int blkaddr, int lf, int slot);int rvu_cpt_ctx_flush (struct rvu *rvu,u16 pcifunc);int rvu_cpt_init (struct rvu *rvu); +u32 rvu_get_cpt_chan_mask (struct rvu *rvu);#define NDC_AF_BANK_MASK GENMASK_ULL(7, 0)#define NDC_AF_BANK_LINE_MASK GENMASK_ULL(31, 16)
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +16 -16
@@ -599,6 +599,19 @@ void npc_set_mcam_action(struct rvu *rvu, struct npc_mcam *mcam, NPC_AF_MCAMEX_BANKX_ACTION(index, bank), cfg); } +u32 rvu_get_cpt_chan_mask (struct rvu *rvu) +{ +/* For cn10k the upper two bits of the channel number are +* cpt channel number. with masking out these bits in the +* mcam entry, same entry used for NIX will allow packets +* received from cpt for parsing. +*/ +if (!is_rvu_otx2 (rvu)) +return NIX_CHAN_CPT_X2P_MASK ; +else +return 0xFFFu ; +} +void rvu_npc_install_ucast_entry (struct rvu *rvu,u16 pcifunc,int nixlf,u64 chan,u8 *mac_addr) {
@@ -642,7 +655,7 @@ void rvu_npc_install_ucast_entry(struct rvu *rvu, u16 pcifunc,eth_broadcast_addr ((u8 *)&req.mask.dmac); req.features =BIT_ULL (NPC_DMAC ); req.channel = chan; - req.chan_mask =0xFFFU ; + req.chan_mask =rvu_get_cpt_chan_mask (rvu); req.intf = pfvf->nix_rx_intf; req.op = action.op; req.hdr.pcifunc =0 ;/* AF is requester */
@@ -712,11 +725,7 @@ void rvu_npc_install_promisc_entry(struct rvu *rvu, u16 pcifunc,* mcam entry, same entry used for NIX will allow packets * received from cpt for parsing. */ -if (!is_rvu_otx2 (rvu)) { - req.chan_mask =NIX_CHAN_CPT_X2P_MASK ; - }else { - req.chan_mask =0xFFFU ; - } + req.chan_mask =rvu_get_cpt_chan_mask (rvu);if (chan_cnt >1 ) {if (!is_power_of_2 (chan_cnt)) {
@@ -887,16 +896,7 @@ void rvu_npc_install_allmulti_entry(struct rvu *rvu, u16 pcifunc, int nixlf,ether_addr_copy (req.mask.dmac, mac_addr); req.features =BIT_ULL (NPC_DMAC ); -/* For cn10k the upper two bits of the channel number are -* cpt channel number. with masking out these bits in the -* mcam entry, same entry used for NIX will allow packets -* received from cpt for parsing. -*/ -if (!is_rvu_otx2 (rvu)) - req.chan_mask =NIX_CHAN_CPT_X2P_MASK ; -else - req.chan_mask =0xFFFU ; - + req.chan_mask =rvu_get_cpt_chan_mask (rvu); req.channel = chan; req.intf = pfvf->nix_rx_intf; req.entry = index;
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c +1 -1
@@ -1470,7 +1470,7 @@ int rvu_mbox_handler_npc_install_flow(struct rvu *rvu,/* ignore chan_mask in case pf func is not AF, revisit later */ if (!is_pffunc_af (req->hdr.pcifunc)) - req->chan_mask =0xFFF ; + req->chan_mask =rvu_get_cpt_chan_mask (rvu); err =npc_check_unsupported_flows (rvu, req->features, req->intf);if (err)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 63/325 vxlan: vnifilter: send notification on VNI add
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Roulin <[email protected]>
[ Upstream commit aa6ca1c5c338907817374b59f7551fd855a88754 ]
When a new VNI is added to a vxlan device with vnifilter enabled, no RTM_NEWTUNNEL notification is sent to userspace. This means 'bridge monitor vni' never shows VNI add events, even though VNI delete events are reported correctly.
The bug is in vxlan_vni_add(), where the notification is guarded by 'if (changed)'. The 'changed' flag is set by vxlan_vni_update_group() only when the multicast group or remote IP is modified, but for a new VNI added without a group (e.g. in L3 VxLAN interface scenarios), the function returns early without setting changed=true. Since this is a new VNI, the notification should be sent unconditionally.
The notification is not guarded by the return value of vxlan_vni_update_group() because, at this point, the VNI has already been inserted into the hash table and list with no rollback on error. The VNI will be visible in 'bridge vni show' regardless, so userspace should be informed. This is consistent with vxlan_vni_del() which also notifies unconditionally.
The 'if (changed)' guard remains correct in vxlan_vni_update(), which handles the case where a VNI already exists and is being re-added -- there, we only want to notify if the group/remote actually changed.
Reproducer:
# ip link add vxlan100 type vxlan dstport 4789 local 10.0.0.1 \
nolearning external vnifilter
# ip link set vxlan100 up
# bridge monitor vni &
# bridge vni add vni 1000 dev vxlan100 # no notification
# bridge vni delete vni 1000 dev vxlan100 # notification received--- drivers/net/vxlan/vxlan_vnifilter.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/vxlan/vxlan_vnifilter.c +1 -2
@@ -759,8 +759,7 @@ static int vxlan_vni_add(struct vxlan_dev *vxlan, err =vxlan_vni_update_group (vxlan, vninode, group, true, &changed, extack); -if (changed) -vxlan_vnifilter_notify (vxlan, vninode,RTM_NEWTUNNEL ); +vxlan_vnifilter_notify (vxlan, vninode,RTM_NEWTUNNEL );return err; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 64/325 vxlan: vnifilter: fix spurious notification on VNI update
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Roulin <[email protected]>
[ Upstream commit 84683b5b60c7274e2c8f7f413d39d78d3db5540f ]
When a VNI is re-added with the same attributes (e.g. same group or no group), vxlan_vni_update() sends a spurious RTM_NEWTUNNEL notification even though nothing changed.
The bug is that 'if (changed)' tests whether the pointer is non-NULL, not the bool value it points to. Since every caller passes a valid pointer, the condition is always true and the notification fires unconditionally.
Fix by dereferencing the pointer: 'if (*changed)'.
Reproducer:
# ip link add vxlan100 type vxlan dstport 4789 local 10.0.0.1 \
nolearning external vnifilter
# ip link set vxlan100 up
# bridge monitor vni &
# bridge vni add vni 1000 dev vxlan100
# bridge vni add vni 1000 dev vxlan100 # spurious notification--- drivers/net/vxlan/vxlan_vnifilter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/vxlan/vxlan_vnifilter.c +1 -1
@@ -661,7 +661,7 @@ static int vxlan_vni_update(struct vxlan_dev *vxlan,if (ret)return ret; -if (changed) +if (*changed)vxlan_vnifilter_notify (vxlan, vninode,RTM_NEWTUNNEL );return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 65/325 ieee802154: 6lowpan: only accept IPv6 packets in lowpan_xmit()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 3a5f3f7aff18bcc36a57839cf50cf0cc8de707f3 ]
The aoe driver (or similar) generates a non-IPv6 packet (e.g., ETH_P_AOE) and queues it for transmission via dev_queue_xmit() on a 6LoWPAN interface (configured by the user or test case).
Since the packet is not IPv6, the 6LoWPAN header_ops->create function (lowpan_header_create or header_create) returns early without initializing the lowpan_addr_info structure in the skb headroom.
In the transmit function (lowpan_xmit), the driver calls lowpan_header (or setup_header) which unconditionally copies and uses the lowpan_addr_info from the headroom, which contains uninitialized data.
Fix this by dropping non IPv6 packets.
A similar fix is needed in net/bluetooth/6lowpan.c bt_xmit().
--- net/ieee802154/6lowpan/tx.c | 5 +++++ 1 file changed, 5 insertions(+)
net/ieee802154/6lowpan/tx.c +5 -0
@@ -255,6 +255,11 @@ netdev_tx_t lowpan_xmit(struct sk_buff *skb, struct net_device *ldev)pr_debug ("package xmit\n" ); +if (skb->protocol !=htons (ETH_P_IPV6 )) { +kfree_skb (skb); +return NET_XMIT_DROP ; + } +WARN_ON_ONCE (skb->len >IPV6_MIN_MTU );/* We must take a copy of the skb before we modify/replace the ipv6
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 66/325 net/802/mrp: fix vector attribute parsing in mrp_pdu_parse_vecattr
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yizhou Zhao <[email protected]>
[ Upstream commit 7561c7fbc694308da73300f036719e63e42bf0b4 ]
In mrp_pdu_parse_vecattr(), vector attribute events are encoded three per byte and valen tracks the number of events left to process.
The parser decrements valen after processing the first and second events from each event byte, but not after processing the third one. When valen is exactly a multiple of three, the loop continues after the last valid event and consumes the next byte as a new event byte, applying a spurious event to the MRP applicant state.
Additionally, when valen is zero the parser unconditionally consumes attrlen bytes as FirstValue and advances the offset, even though per IEEE 802.1ak a VectorAttribute with only a LeaveAllEvent has valen of zero and no FirstValue or Vector fields. This corrupts the offset for subsequent PDU parsing.
Also, when valen exceeds three the loop crosses byte boundaries but the attribute value is not incremented between the last event of one byte and the first event of the next. This causes the first event of the next byte to use the same attribute value as the third event rather than the next consecutive value.
Decrement valen after processing the third event, skip FirstValue consumption when valen is zero, and increment the attribute value at the end of each loop iteration.
--- net/802/mrp.c | 9 +++++++++ 1 file changed, 9 insertions(+)
net/802/mrp.c +9 -0
@@ -703,6 +703,12 @@ static int mrp_pdu_parse_vecattr(struct mrp_applicant *app, valen =be16_to_cpu (get_unaligned (&mrp_cb (skb)->vah->lenflags) &MRP_VECATTR_HDR_LEN_MASK ); +/* If valen is 0, only a LeaveAllEvent is present; FirstValue and +* Vector fields are absent per IEEE 802.1ak. +*/ +if (valen ==0 ) +return 0 ; +/* The VectorAttribute structure in a PDU carries event information * about one or more attributes having consecutive values. Only the * value for the first attribute is contained in the structure. So
@@ -753,6 +759,9 @@ static int mrp_pdu_parse_vecattr(struct mrp_applicant *app, vaevents %= __MRP_VECATTR_EVENT_MAX; vaevent = vaevents;mrp_pdu_parse_vecattr_event (app, skb, vaevent); + valen--; +mrp_attrvalue_inc (mrp_cb (skb)->attrvalue, +mrp_cb (skb)->mh->attrlen); }return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 67/325 sctp: purge outqueue on stale COOKIE-ECHO handling
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
[ Upstream commit e374b22e9b07b72a25909621464ff74096151bfb ]
sctp_stream_update() is only invoked when the association is moved into COOKIE_WAIT during association setup/reconfiguration. In this path, the outbound stream scheduler state (stream->out_curr) is expected to be clean, since no user data should have been transmitted yet unless the state machine has already partially progressed.
However, a corner case exists in sctp_sf_do_5_2_6_stale(): when a Stale Cookie ERROR is received, the association is rolled back from COOKIE_ECHOED to COOKIE_WAIT. In this scenario, user data may already have been queued and even bundled with the COOKIE-ECHO chunk.
During the rollback, sctp_stream_update() frees the old stream table and installs a new one, but it does not invalidate stream->out_curr. As a result, out_curr may still point to a freed sctp_stream_out entry from the previous stream state.
Later, SCTP scheduler dequeue paths (FCFS, RR, PRIO, etc.) rely on stream->out_curr->ext, which can lead to use-after-free once the old stream state has been released via sctp_stream_free().
This results in crashes such as (reported by Yuqi):
BUG: KASAN: slab-use-after-free in sctp_sched_fcfs_dequeue+0x13a/0x140
Read of size 8 at addr ff1100004d4d3208 by task mini_poc/9312
CPU: 1 UID: 1001 PID: 9312 Comm: mini_poc Not tainted
7.1.0-rc1-00305-gbd3a4795d574 #5 PREEMPT(full)
sctp_sched_fcfs_dequeue+0x13a/0x140
sctp_outq_flush+0x1603/0x33e0
sctp_do_sm+0x31c9/0x5d30
sctp_assoc_bh_rcv+0x392/0x6f0
sctp_inq_push+0x1db/0x270
sctp_rcv+0x138d/0x3c10Fix this by fully purging the association outqueue when handling the Stale Cookie case. This ensures all pending transmit and retransmit state is dropped, and any scheduler cached pointers are invalidated, making it safe to rebuild stream state during COOKIE_WAIT restart.
Updating only stream->out_curr would be insufficient, since queued and retransmittable data would still reference the old stream state and trigger later use-after-free in dequeue paths.
--- net/sctp/sm_statefuns.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
net/sctp/sm_statefuns.c +1 -5
@@ -2598,11 +2598,7 @@ static enum sctp_disposition sctp_sf_do_5_2_6_stale(*/ sctp_add_cmd_sf (commands,SCTP_CMD_DEL_NON_PRIMARY ,SCTP_NULL ()); -/* If we've sent any data bundled with COOKIE-ECHO we will need to -* resend -*/ -sctp_add_cmd_sf (commands,SCTP_CMD_T1_RETRAN , -SCTP_TRANSPORT (asoc->peer.primary_path)); +sctp_add_cmd_sf (commands,SCTP_CMD_PURGE_OUTQUEUE ,SCTP_NULL ());/* Cast away the const modifier, as we want to just * rerun it through as a sideffect.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 68/325 Drivers: hv: VMBus protocol version 6.0
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roman Kisel <[email protected]>
[ Upstream commit 6802d8af47d1dccd9a74a1f708fb9129244ef843 ]
The confidential VMBus is supported starting from the protocol version 6.0 onwards.
Provide the required definitions. No functional changes.
Stable-dep-of: c5c3ef8d49e1 ("Drivers: hv: vmbus: Provide option to skip VMBus unload on panic")
--- drivers/hv/hyperv_vmbus.h | 2 ++ drivers/hv/vmbus_drv.c | 12 +++++++ include/hyperv/hvgdk_mini.h | 1 + include/linux/hyperv.h | 69 +++++++++++++++++++++++++++---------- 4 files changed, 65 insertions(+), 19 deletions(-)
drivers/hv/hyperv_vmbus.h +2 -0
@@ -333,6 +333,8 @@ extern const struct vmbus_channel_message_table_entry/* General vmbus interface */ +bool vmbus_is_confidential (void ); +struct hv_device *vmbus_device_create (const guid_t *type,const guid_t *instance,struct vmbus_channel *channel);
drivers/hv/vmbus_drv.c +12 -0
@@ -57,6 +57,18 @@ static long __percpu *vmbus_evt;int vmbus_irq;int vmbus_interrupt; +/* +* If the Confidential VMBus is used, the data on the "wire" is not +* visible to either the host or the hypervisor. +*/ +static bool is_confidential; + +bool vmbus_is_confidential (void ) +{ +return is_confidential; +} +EXPORT_SYMBOL_GPL (vmbus_is_confidential); +/* * The panic notifier below is responsible solely for unloading the * vmbus connection, which is necessary in a panic event.
include/hyperv/hvgdk_mini.h +1 -0
@@ -260,6 +260,7 @@ union hv_hypervisor_version_info {#define HYPERV_CPUID_VIRT_STACK_PROPERTIES 0x40000082/* Support for the extended IOAPIC RTE format */ #define HYPERV_VS_PROPERTIES_EAX_EXTENDED_IOAPIC_RTE BIT(2) +#define HYPERV_VS_PROPERTIES_EAX_CONFIDENTIAL_VMBUS_AVAILABLE BIT(3)#define HYPERV_HYPERVISOR_PRESENT_BIT 0x80000000#define HYPERV_CPUID_MIN 0x40000005
include/linux/hyperv.h +50 -19
105 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 69/325 Drivers: hv: vmbus: Provide option to skip VMBus unload on panic
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Kelley <[email protected]>
[ Upstream commit c5c3ef8d49e15d2fc1cec4ad7c91d81b99977440 ]
Currently, VMBus code initiates a VMBus unload in the panic path so that if a kdump kernel is loaded, it can start fresh in setting up its own VMBus connection. However, a driver for the VMBus virtual frame buffer may need to flush dirty portions of the frame buffer back to the Hyper-V host so that panic information is visible in the graphics console. To support such flushing, provide exported functions for the frame buffer driver to specify that the VMBus unload should not be done by the VMBus driver, and to initiate the VMBus unload itself. Together these allow a frame buffer driver to delay the VMBus unload until after it has completed the flush.
Ideally, the VMBus driver could use its own panic-path callback to do the unload after all frame buffer drivers have finished. But DRM frame buffer drivers use the kmsg dump callback, and there are no callbacks after that in the panic path. Hence this somewhat messy approach to properly sequencing the frame buffer flush and the VMBus unload.
--- drivers/hv/channel_mgmt.c | 1 + drivers/hv/hyperv_vmbus.h | 1 - drivers/hv/vmbus_drv.c | 25 ++++++++++++++++++------- include/linux/hyperv.h | 3 +++ 4 files changed, 22 insertions(+), 8 deletions(-)
drivers/hv/channel_mgmt.c +1 -0
@@ -944,6 +944,7 @@ void vmbus_initiate_unload(bool crash)else vmbus_wait_for_unload (); } +EXPORT_SYMBOL_GPL (vmbus_initiate_unload);static void vmbus_setup_channel_state (struct vmbus_channel *channel,struct vmbus_channel_offer_channel *offer)
drivers/hv/hyperv_vmbus.h +0 -1
@@ -376,7 +376,6 @@ void hv_vss_deinit(void);int hv_vss_pre_suspend (void );int hv_vss_pre_resume (void );void hv_vss_onchannelcallback (void *context); -void vmbus_initiate_unload (bool crash);static inline void hv_poll_channel (struct vmbus_channel *channel,void (*cb)(void *))
drivers/hv/vmbus_drv.c +18 -7
@@ -69,19 +69,29 @@ bool vmbus_is_confidential(void) }EXPORT_SYMBOL_GPL (vmbus_is_confidential); +static bool skip_vmbus_unload; + +/* +* Allow a VMBus framebuffer driver to specify that in the case of a panic, +* it will do the VMbus unload operation once it has flushed any dirty +* portions of the framebuffer to the Hyper-V host. +*/ +void vmbus_set_skip_unload (bool skip) +{ + skip_vmbus_unload = skip; +} +EXPORT_SYMBOL_GPL (vmbus_set_skip_unload); +/* * The panic notifier below is responsible solely for unloading the * vmbus connection, which is necessary in a panic event. -* -* Notice an intrincate relation of this notifier with Hyper-V -* framebuffer panic notifier exists - we need vmbus connection alive -* there in order to succeed, so we need to order both with each other -* [see hvfb_on_panic()] - this is done using notifiers' priorities. */ static int hv_panic_vmbus_unload (struct notifier_block *nb,unsigned long val,void *args) { -vmbus_initiate_unload (true); +if (!skip_vmbus_unload) +vmbus_initiate_unload (true); +return NOTIFY_DONE ; }static struct notifier_block hyperv_panic_vmbus_unload_block = {
@@ -2862,7 +2872,8 @@ static void hv_crash_handler(struct pt_regs *regs) {int cpu; -vmbus_initiate_unload (true); +if (!skip_vmbus_unload) +vmbus_initiate_unload (true);/* * In crash handler we can't schedule synic cleanup for all CPUs, * doing the cleanup for current CPU only. This should be sufficient
include/linux/hyperv.h +3 -0
@@ -1334,6 +1334,9 @@ int vmbus_allocate_mmio(struct resource **new, struct hv_device *device_obj, bool fb_overlap_ok);void vmbus_free_mmio (resource_size_t start,resource_size_t size); +void vmbus_initiate_unload (bool crash); +void vmbus_set_skip_unload (bool skip); +/* * GUID definitions of various offer types - services offered to the guest. */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 70/325 drm/hyperv: During panic do VMBus unload after frame buffer is flushed
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Kelley <[email protected]>
[ Upstream commit 8b35874f56ded0cc1a90a25b87411249a86246cd ]
In a VM, Linux panic information (reason for the panic, stack trace, etc.) may be written to a serial console and/or a virtual frame buffer for a graphics console. The latter may need to be flushed back to the host hypervisor for display.
The current Hyper-V DRM driver for the frame buffer does the flushing *after* the VMBus connection has been unloaded, such that panic messages are not displayed on the graphics console. A user with a Hyper-V graphics console is left with just a hung empty screen after a panic. The enhanced control that DRM provides over the panic display in the graphics console is similarly non-functional.
Commit 3671f3777758 ("drm/hyperv: Add support for drm_panic") added the Hyper-V DRM driver support to flush the virtual frame buffer. It provided necessary functionality but did not handle the sequencing problem with VMBus unload.
Fix the full problem by using VMBus functions to suppress the VMBus unload that is normally done by the VMBus driver in the panic path. Then after the frame buffer has been flushed, do the VMBus unload so that a kdump kernel can start cleanly. As expected, CONFIG_DRM_PANIC must be selected for these changes to have effect. As a side benefit, the enhanced features of the DRM panic path are also functional.
--- drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 5 +++++ drivers/gpu/drm/hyperv/hyperv_drm_modeset.c | 15 ++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-)
drivers/gpu/drm/hyperv/hyperv_drm_drv.c +5 -0
@@ -149,6 +149,10 @@ static int hyperv_vmbus_probe(struct hv_device *hdev, goto err_free_mmio; } +/* If DRM panic path is stubbed out VMBus code must do the unload */ +if (IS_ENABLED (CONFIG_DRM_PANIC )) +vmbus_set_skip_unload (true); +drm_client_setup (dev,NULL );return 0 ;
@@ -168,6 +172,7 @@ static void hyperv_vmbus_remove(struct hv_device *hdev)struct drm_device *dev =hv_get_drvdata (hdev);struct hyperv_drm_device *hv =to_hv (dev); +vmbus_set_skip_unload (false);drm_dev_unplug (dev);drm_atomic_helper_shutdown (dev);vmbus_close (hdev->channel);
drivers/gpu/drm/hyperv/hyperv_drm_modeset.c +8 -7
@@ -204,15 +204,16 @@ static void hyperv_plane_panic_flush(struct drm_plane *plane)struct hyperv_drm_device *hv =to_hv (plane->dev);struct drm_rect rect; -if (!plane->state || !plane->state->fb) -return ; +if (plane->state && plane->state->fb) { + rect.x1 =0 ; + rect.y1 =0 ; + rect.x2 = plane->state->fb->width; + rect.y2 = plane->state->fb->height; - rect.x1 =0 ; - rect.y1 =0 ; - rect.x2 = plane->state->fb->width; - rect.y2 = plane->state->fb->height; +hyperv_update_dirt (hv->hdev, &rect); + } -hyperv_update_dirt (hv->hdev, &rect); +vmbus_initiate_unload (true); }static const struct drm_plane_helper_funcs hyperv_plane_helper_funcs = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 71/325 selftests: harness: fix pidfd leak in __wait_for_test
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geliang Tang <[email protected]>
[ Upstream commit 0eb307d61317b42b120ab02099b597226318358a ]
Fix the pidfd leak in kselftest_harness.h's __wait_for_test() where childfd = syscall(__NR_pidfd_open, t->pid, 0) is never closed.
--- tools/testing/selftests/kselftest_harness.h | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/kselftest_harness.h +1 -0
@@ -996,6 +996,7 @@ static void __wait_for_test(struct __test_metadata *t) poll_child.fd = childfd; poll_child.events =POLLIN ; ret =poll (&poll_child,1 , t->timeout *1000 ); +close (childfd);if (ret ==-1 ) { t->exit_code =KSFT_FAIL ; fprintf(TH_LOG_STREAM,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 72/325 signal: clear JOBCTL_PENDING_MASK for caller in zap_other_threads()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Nogikh <[email protected]>
[ Upstream commit 90918794a4e2c3b440f8fcf3847765a8b1d81b25 ]
When a multi-threaded process receives a stop signal (e.g., SIGSTOP), do_signal_stop() sets JOBCTL_STOP_PENDING and JOBCTL_STOP_CONSUME on all threads and sets signal->group_stop_count to the number of threads. If one of the threads concurrently calls execve(), de_thread() invokes zap_other_threads() to kill all other threads. zap_other_threads() aborts the pending group stop by resetting signal->group_stop_count to 0 and clears the JOBCTL_PENDING_MASK for all other threads. However, it fails to clear the job control flags for the calling thread.
When execve() completes, the calling thread returns to user mode and checks for pending signals. Seeing the stale JOBCTL_STOP_PENDING flag, it calls do_signal_stop(), which invokes task_participate_group_stop(). Since JOBCTL_STOP_CONSUME is still set, it attempts to decrement the already-zero signal->group_stop_count, triggering a warning:
sig->group_stop_count == 0
WARNING: CPU: 1 PID: 6475 at kernel/signal.c:373 task_participate_group_stop+0x215/0x2d0 Call Trace: <TASK> do_signal_stop+0x3be/0x5c0 kernel/signal.c:2619 get_signal+0xa8c/0x1330 kernel/signal.c:2884 arch_do_signal_or_restart+0xbc/0x840 arch/x86/kernel/signal.c:337 exit_to_user_mode_loop+0x8c/0x4d0 kernel/entry/common.c:98 do_syscall_64+0x33e/0xf80 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f </TASK>
Fix this race condition by clearing the JOBCTL_PENDING_MASK for the calling thread in zap_other_threads(), ensuring it does not retain any stale job control state after the thread group is destroyed. This aligns with other functions that tear down a thread group and abort group stops, such as zap_process() and complete_signal(), which correctly clear these flags for all threads including the current one.
--- kernel/signal.c | 1 + 1 file changed, 1 insertion(+)
kernel/signal.c +1 -0
@@ -1340,6 +1340,7 @@ int zap_other_threads(struct task_struct *p)int count =0 ; p->signal->group_stop_count =0 ; +task_clear_jobctl_pending (p,JOBCTL_PENDING_MASK ); for_other_threads(p, t) {task_clear_jobctl_pending (t,JOBCTL_PENDING_MASK );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 73/325 hyperv: Clean up and fix the guest ID comment in hvgdk.h
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dexuan Cui <[email protected]>
[ Upstream commit 83eb00f31eb1b10735d48e469df72cc2b0e06f6d ]
Change the "64 bit" to "64-bit", and the "Os" to "OS".
Remove the obsolete paragraph since the guideline has been published in the Hypervisor Top Level Functional Specification for many years.
The "OS Type" is 0x1 for Linux, not 0x100.
No functional change.
--- include/hyperv/hvgdk.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
include/hyperv/hvgdk.h +2 -8
@@ -10,18 +10,12 @@/* * The guest OS needs to register the guest ID with the hypervisor. -* The guest ID is a 64 bit entity and the structure of this ID is +* The guest ID is a 64-bit entity and the structure of this ID is * specified in the Hyper-V TLFS specification. * -* While the current guideline does not specify how Linux guest ID(s) -* need to be generated, our plan is to publish the guidelines for -* Linux and other guest operating systems that currently are hosted -* on Hyper-V. The implementation here conforms to this yet -* unpublished guidelines. -* * Bit(s) * 63 - Indicates if the OS is Open Source or not; 1 is Open Source -* 62:56 - Os Type; Linux is 0x100 +* 62:56 - OS Type; Linux is 0x1 * 55:48 - Distro specific identification * 47:16 - Linux kernel version number * 15:0 - Distro specific identification
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 74/325 time: Fix off-by-one in settimeofday() usec validation
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Naveen Kumar Chaudhary <[email protected]>
[ Upstream commit ce4abda5e12622f33450159e76c8f56d28d7f03d ]
The validation check uses '>' instead of '>=' when comparing tv_usec against USEC_PER_SEC, allowing the value 1000000 through. After conversion to nanoseconds (*= 1000), this produces tv_nsec == NSEC_PER_SEC, violating the timespec invariant that tv_nsec must be less than NSEC_PER_SEC.
Use '>=' to reject tv_usec values that are not in the valid range of 0 to 999999.
--- kernel/time/time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/time.c +1 -1
@@ -207,7 +207,7 @@ SYSCALL_DEFINE2(settimeofday, struct __kernel_old_timeval __user *, tv, get_user(new_ts.tv_nsec, &tv->tv_usec))return -EFAULT ; -if (new_ts.tv_nsec >USEC_PER_SEC || new_ts.tv_nsec <0 ) +if (new_ts.tv_nsec >=USEC_PER_SEC || new_ts.tv_nsec <0 )return -EINVAL ; new_ts.tv_nsec *=NSEC_PER_USEC ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 75/325 ALSA: PCM: Fix wait queue list corruption in snd_pcm_drain() on linked streams
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ji'an Zhou <[email protected]>
[ Upstream commit 88fe2e3658726cb21ff2dcf9770bf672f9b9d31b ]
snd_pcm_drain() uses init_waitqueue_entry which does not clear entry.prev/next, and add_wait_queue with a conditional remove_wait_queue that is skipped when to_check is no longer in the group after concurrent UNLINK. The orphaned wait entry remains on the unlinked substream sleep queue. On the next drain iteration, add_wait_queue adds the entry to a new queue while still linked on the old one, corrupting both lists. A subsequent wake_up dereferences NULL at the func pointer (mapped from the spinlock at offset 0 of the misinterpreted wait_queue_head_t), causing a kernel panic.
Replace init_waitqueue_entry/add_wait_queue/conditional remove_wait_queue with init_wait_entry/prepare_to_wait/ finish_wait. init_wait_entry clears prev/next via INIT_LIST_HEAD on each iteration and sets autoremove_wake_function which auto-removes the entry on wake-up. finish_wait safely handles both the already-removed and still-queued cases.
--- sound/core/pcm_native.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
sound/core/pcm_native.c +3 -4
@@ -2176,9 +2176,8 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream, drain_no_period_wakeup = to_check->no_period_wakeup; drain_rate = to_check->rate; drain_bufsz = to_check->buffer_size; -init_waitqueue_entry (&wait, current); -set_current_state (TASK_INTERRUPTIBLE ); -add_wait_queue (&to_check->sleep, &wait); +init_wait_entry (&wait,0 ); +prepare_to_wait (&to_check->sleep, &wait,TASK_INTERRUPTIBLE );snd_pcm_stream_unlock_irq (substream);if (drain_no_period_wakeup) tout =MAX_SCHEDULE_TIMEOUT ;
@@ -2196,7 +2195,7 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream, group =snd_pcm_stream_group_ref (substream);snd_pcm_group_for_each_entry (s, substream) {if (s->runtime == to_check) { -remove_wait_queue (&to_check->sleep, &wait); +finish_wait (&to_check->sleep, &wait);break ; } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 76/325 ALSA: seq: dummy: fix UMP event stack overread
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <[email protected]>
[ Upstream commit 2b5ff4db5d7aa5b981d966df02e687f79ad7b311 ]
The dummy sequencer port forwards events by copying an incoming struct snd_seq_event into a stack temporary, rewriting source and destination, and dispatching the temporary to subscribers. That legacy event storage is smaller than struct snd_seq_ump_event.
When a UMP event reaches the dummy client, the copy leaves the UMP flag set but only provides legacy-sized stack storage. The subscriber delivery path then uses snd_seq_event_packet_size() and copies a UMP-sized packet from that stack object, reading past the end of the temporary.
Use the existing union __snd_seq_event storage and copy the packet size reported for the incoming event before rewriting the common routing fields. This preserves the full UMP packet for UMP events while keeping legacy event handling unchanged.
--- sound/core/seq/seq_dummy.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
sound/core/seq/seq_dummy.c +9 -6
@@ -9,6 +9,7 @@#include <linux/module.h> #include <sound/core.h> #include "seq_clientmgr.h" +#include "seq_memory.h" #include <sound/initval.h> #include <sound/asoundef.h>
@@ -81,19 +82,21 @@ dummy_input(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop) {struct snd_seq_dummy_port *p; -struct snd_seq_event tmpev; +union __snd_seq_event tmpev; +size_t size; p = private_data;if (ev->source.client ==SNDRV_SEQ_CLIENT_SYSTEM || ev->type ==SNDRV_SEQ_EVENT_KERNEL_ERROR )return 0 ;/* ignore system messages */ - tmpev = *ev; + size =snd_seq_event_packet_size (ev); +memcpy (&tmpev, ev, size);if (p->duplex) - tmpev.source.port = p->connect; + tmpev.legacy.source.port = p->connect;else - tmpev.source.port = p->port; - tmpev.dest.client =SNDRV_SEQ_ADDRESS_SUBSCRIBERS ; -return snd_seq_kernel_client_dispatch (p->client, &tmpev, atomic, hop); + tmpev.legacy.source.port = p->port; + tmpev.legacy.dest.client =SNDRV_SEQ_ADDRESS_SUBSCRIBERS ; +return snd_seq_kernel_client_dispatch (p->client, &tmpev.legacy, atomic, hop); }/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 77/325 spi: cadence-quadspi: fix unclocked access on unbind
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
[ Upstream commit 233db2cb14db8b1935dda52a6affd97276462b82 ]
Make sure that the controller is runtime resumed before disabling it during driver unbind to avoid an unclocked register access.
This issue was flagged by Sashiko when reviewing a controller deregistration fix.
--- drivers/spi/spi-cadence-quadspi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/spi/spi-cadence-quadspi.c +3 -2
@@ -2055,7 +2055,6 @@ static void cqspi_remove(struct platform_device *pdev)cqspi_wait_idle (cqspi);spi_unregister_controller (cqspi->host); -cqspi_controller_enable (cqspi,0 );if (cqspi->rx_chan)dma_release_channel (cqspi->rx_chan);
@@ -2063,8 +2062,10 @@ static void cqspi_remove(struct platform_device *pdev)if (!(ddata && (ddata->quirks &CQSPI_DISABLE_RUNTIME_PM ))) ret =pm_runtime_get_sync (&pdev->dev); -if (ret >=0 ) +if (ret >=0 ) { +cqspi_controller_enable (cqspi,0 );clk_disable (cqspi->clk); + }if (cqspi->is_jh7110)cqspi_jh7110_disable_clk (pdev, cqspi);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 78/325 cpufreq/amd-pstate: drop stale @epp_cached kdoc
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhan Xusheng <[email protected]>
[ Upstream commit 3cd07ee35a66038fd1a643632bfc057645e07c9a ]
Commit 4e16c1175238 ("cpufreq/amd-pstate: Stop caching EPP") removed the epp_cached field from struct amd_cpudata in favour of always reading from cppc_req_cached, but the kdoc above the struct still documents @epp_cached.
Drop the now-stale @epp_cached entry.
--- drivers/cpufreq/amd-pstate.h | 1 - 1 file changed, 1 deletion(-)
drivers/cpufreq/amd-pstate.h +0 -1
@@ -76,7 +76,6 @@ struct amd_aperf_mperf {* @hw_prefcore: check whether HW supports preferred core featue. * Only when hw_prefcore and early prefcore param are true, * AMD P-State driver supports preferred core featue. -* @epp_cached: Cached CPPC energy-performance preference value * @policy: Cpufreq policy value * * The amd_cpudata is key private data for each CPU thread in AMD P-State, and
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 79/325 tools/rv: Ensure monitor name and desc are NUL-terminated
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabriele Monaco <[email protected]>
[ Upstream commit 08904765bb941f98306ae6841c33cfd299343faf ]
ikm_fill_monitor_definition() copies monitor name and description with strncpy(), but does not guarantee NUL termination when source strings are equal to or longer than the destination buffers.
Clamp copies to sizeof(dst) - 1 and explicitly append '\0' for both fields to keep them safe for later string operations.
--- tools/verification/rv/src/in_kernel.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
tools/verification/rv/src/in_kernel.c +4 -3
@@ -215,10 +215,11 @@ static int ikm_fill_monitor_definition(char *name, struct monitor *ikm, char *coreturn -1 ; } -strncpy (ikm->name, nested_name,MAX_DA_NAME_LEN ); +strncpy (ikm->name, nested_name,sizeof (ikm->name) -1 ); + ikm->name[sizeof (ikm->name) -1 ] ='\0' ; ikm->enabled = enabled; -strncpy (ikm->desc, desc,MAX_DESCRIPTION ); - +strncpy (ikm->desc, desc,sizeof (ikm->desc) -1 ); + ikm->desc[sizeof (ikm->desc) -1 ] ='\0' ;free (desc);return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 80/325 tools/rv: Fix substring match bug in monitor name search
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabriele Monaco <[email protected]>
[ Upstream commit a963fbf3166f2e178ac38b6c3c186a0c98092fb9 ]
__ikm_find_monitor_name() relies on strstr() to find a monitor by name, which fails if the target monitor is a substring of a previously listed monitor.
Fix it by tokenizing the available_monitors file and matching full tokens instead.
--- tools/verification/rv/src/in_kernel.c | 48 ++++++++++++++------------- 1 file changed, 25 insertions(+), 23 deletions(-)
tools/verification/rv/src/in_kernel.c +25 -23
@@ -58,38 +58,40 @@ static int __ikm_read_enable(char *monitor_name)*/ static int __ikm_find_monitor_name (char *monitor_name,char *out_name) { -char *available_monitors, container[MAX_DA_NAME_LEN +1 ], *cursor, *end; -int retval =1 ; +char *available_monitors, *cursor, *line; +int len =strlen (monitor_name); +int found =0 ; available_monitors =tracefs_instance_file_read (NULL ,"rv/available_monitors" ,NULL );if (!available_monitors)return -1 ; - cursor =strstr (available_monitors, monitor_name); -if (!cursor) { - retval =0 ; - goto out_free; - } + config_is_container =0 ; + cursor = available_monitors; +while ((line =strsep (&cursor,"\n" ))) { +char *colon =strchr (line,':' ); -for (; cursor > available_monitors; cursor--) -if (*(cursor-1 ) =='\n' ) -break ; - end =strstr (cursor,"\n" ); -memcpy (out_name, cursor, end-cursor); - out_name[end-cursor] ='\0' ; - - cursor =strstr (out_name,":" ); -if (cursor) - *cursor ='/' ; -else { -sprintf (container,"%s:" , monitor_name); -if (strstr (available_monitors, container)) - config_is_container =1 ; +if (strcmp (line, monitor_name) && (!colon ||strcmp (colon +1 , monitor_name))) +continue ; + +strncpy (out_name, line,2 *MAX_DA_NAME_LEN ); + out_name[2 *MAX_DA_NAME_LEN -1 ] ='\0' ; + +if (colon) { + out_name[colon - line] ='/' ; + }else { +/* If there are children, they are on the next line. */ + line =strsep (&cursor,"\n" ); +if (line && !strncmp (line, monitor_name, len) && line[len] ==':' ) + config_is_container =1 ; + } + + found =1 ; +break ; } -out_free:free (available_monitors); -return retval; +return found; }/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 81/325 tools/rv: Fix substring match when listing container monitors
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabriele Monaco <[email protected]>
[ Upstream commit ba0247c5aa3fcb2890a92a97a88c70fe5ce704a6 ]
When listing monitors within a specific container (rv list <container>), the tool incorrectly matched monitors if the requested container name was only a prefix of the actual container (e.g., 'rv list sche' would incorrectly list monitors from 'sched:').
Fix this by ensuring the container name is an exact match and is immediately followed by the ':' separator.
--- tools/verification/rv/src/in_kernel.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
tools/verification/rv/src/in_kernel.c +6 -2
@@ -193,8 +193,12 @@ static int ikm_fill_monitor_definition(char *name, struct monitor *ikm, char *co nested_name =strstr (name,":" );if (nested_name) {/* it belongs in container if it starts with "container:" */ -if (container &&strstr (name, container) != name) -return 1 ; +if (container) { +int len =strlen (container); + +if (strncmp (name, container, len) || name[len] !=':' ) +return 1 ; + } *nested_name ='/' ; ++nested_name; ikm->nested =1 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 82/325 tools/rv: Fix cleanup after failed trace setup
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabriele Monaco <[email protected]>
[ Upstream commit 33ec2269a4155cad7e9e42c92327dcaa9aee59a7 ]
Currently if ikm_setup_trace_instance() fails, the tool returns without any cleanup, if rv was called with both -t and -r, this means the reactor is not going to be cleared.
Jump to the cleanup label to restore the reactor if necessary.
--- tools/verification/rv/src/in_kernel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/verification/rv/src/in_kernel.c +1 -1
@@ -810,7 +810,7 @@ int ikm_run_monitor(char *monitor_name, int argc, char **argv)if (config_trace) { inst =ikm_setup_trace_instance (nested_name);if (!inst) -return -1 ; + goto out_free_instance; } retval =ikm_enable (full_name);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 83/325 verification/rvgen: Fix options shared among commands
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabriele Monaco <[email protected]>
[ Upstream commit 5f845ad706c0b394ae274e9a930044f78bef782e ]
After rvgen was refactored to use subparsers, the common options (-a and -D) were left in the main parser. This meant that they needed to be called /before/ the subcommand and using them without subcommand was allowed. This is not the original intent.
rvgen -D "some description" container -n name
Define the options as parent in the subparsers to allow them to be used from both subcommands together with other options.
rvgen container -n name -D "some description"
--- tools/verification/rvgen/__main__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
tools/verification/rvgen/__main__.py +6 -4
@@ -17,14 +17,16 @@ if __name__ == '__main__': import sys parser = argparse.ArgumentParser(description='Generate kernel rv monitor') - parser.add_argument("-D", "--description", dest="description", required=False) - parser.add_argument("-a", "--auto_patch", dest="auto_patch", + + parent_parser = argparse.ArgumentParser(add_help=False) + parent_parser.add_argument("-D", "--description", dest="description", required=False) + parent_parser.add_argument("-a", "--auto_patch", dest="auto_patch", action="store_true", required=False, help="Patch the kernel in place") subparsers = parser.add_subparsers(dest="subcmd", required=True) - monitor_parser = subparsers.add_parser("monitor") + monitor_parser = subparsers.add_parser("monitor", parents=[parent_parser]) monitor_parser.add_argument('-n', "--model_name", dest="model_name") monitor_parser.add_argument("-p", "--parent", dest="parent", required=False, help="Create a monitor nested to parent")
@@ -34,7 +36,7 @@ if __name__ == '__main__': monitor_parser.add_argument('-t', "--monitor_type", dest="monitor_type", help=f"Available options: {', '.join(Monitor.monitor_types.keys())}") - container_parser = subparsers.add_parser("container") + container_parser = subparsers.add_parser("container", parents=[parent_parser]) container_parser.add_argument('-n', "--model_name", dest="model_name", required=True) params = parser.parse_args()
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 84/325 verification/rvgen: Fix ltl2k writing True as a literal
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabriele Monaco <[email protected]>
[ Upstream commit df996599cc69a9b74ff437c67751cf8a61f62e39 ]
The rvgen parser for LTL stores literal true values in the python representation (capitalised True), this doesn't build in C. The Literal class should already handle this case but ASTNode skips its strigification method and converts the value (true/false) directly.
Fix by delegating ASTNode stringification to the Literal and Variable classes instead of bypassing them.
--- tools/verification/rvgen/rvgen/ltl2ba.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
tools/verification/rvgen/rvgen/ltl2ba.py +5 -4
@@ -121,10 +121,8 @@ class ASTNode: return self.op.expand(self, node, node_set) def __str__(self): - if isinstance(self.op, Literal): - return str(self.op.value) - if isinstance(self.op, Variable): - return self.op.name.lower() + if isinstance(self.op, (Literal, Variable)): + return str(self.op) return "val" + str(self.id) def normalize(self):
@@ -381,6 +379,9 @@ class Variable: def __iter__(self): yield from () + def __str__(self): + return self.name.lower() + def negate(self): new = ASTNode(self) return NotOp(new)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 85/325 tap: free page on error paths in tap_get_user_xdp()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weiming Shi <[email protected]>
[ Upstream commit 3bcf7aec6a9d16438f2cec29f5d7c8d5b8edf9b2 ]
tap_get_user_xdp() rejects a frame shorter than ETH_HLEN with -EINVAL, and returns -ENOMEM when build_skb() fails. Both paths jump to the err label without freeing the page that vhost_net_build_xdp() allocated for the frame. tap_sendmsg() discards the per-buffer return value and always returns 0, so vhost_tx_batch() takes the success path and never frees the page; each rejected frame in a batch leaks one page-frag chunk.
Free the page on both error paths, before the skb is built. This is the tap counterpart of the same leak in tun_xdp_one().
--- drivers/net/tap.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/tap.c +2 -0
@@ -1052,6 +1052,7 @@ static int tap_get_user_xdp(struct tap_queue *q, struct xdp_buff *xdp)int err, depth;if (unlikely (xdp->data_end - xdp->data <ETH_HLEN )) { +put_page (virt_to_head_page (xdp->data)); err = -EINVAL ; goto err; }
@@ -1061,6 +1062,7 @@ static int tap_get_user_xdp(struct tap_queue *q, struct xdp_buff *xdp) skb =build_skb (xdp->data_hard_start, buflen);if (!skb) { +put_page (virt_to_head_page (xdp->data)); err = -ENOMEM ; goto err; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 86/325 xfrm: iptfs: fix use-after-free on first_skb in __input_process_payload
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhenghang Xiao <[email protected]>
[ Upstream commit eb48730bb827d1550401a5d391903f9d90b493c8 ]
__input_process_payload() stores first_skb into xtfs->ra_newskb under drop_lock when starting partial reassembly, then unlocks and breaks out of the processing loop. The post-loop check reads xtfs->ra_newskb without the lock to decide whether first_skb is still owned:
if (first_skb && first_iplen && !defer && first_skb != xtfs->ra_newskb)
Between spin_unlock and this read, a concurrent CPU running iptfs_reassem_cont() (or the drop_timer hrtimer) can complete reassembly, NULL xtfs->ra_newskb, and free the skb. The check then evaluates first_skb != NULL as true, and pskb_trim/ip_summed/consume_skb operate on the freed skb — a use-after-free in skbuff_head_cache.
Replace the unlocked read with a local bool that records whether first_skb was handed to the reassembly state in the current call. The flag is set after the existing spin_unlock, before the break, using the pointer equality that is stable at that point (first_skb == skb iff first_skb was stored in ra_newskb).
--- net/xfrm/xfrm_iptfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/xfrm/xfrm_iptfs.c +3 -1
@@ -954,6 +954,7 @@ static bool __input_process_payload(struct xfrm_state *x, u32 data,u32 first_iplen, iphlen, iplen, remaining, tail;u32 capturelen;u64 seq; +bool first_skb_partial = false; xtfs = x->mode_data; net =xs_net (x);
@@ -1161,6 +1162,7 @@ static bool __input_process_payload(struct xfrm_state *x, u32 data,spin_unlock (&xtfs->drop_lock); + first_skb_partial = (first_skb == skb);break ; }
@@ -1172,7 +1174,7 @@ static bool __input_process_payload(struct xfrm_state *x, u32 data,/* this should not happen from the above code */ XFRM_INC_STATS (net,LINUX_MIB_XFRMINIPTFSERROR ); -if (first_skb && first_iplen && !defer && first_skb != xtfs->ra_newskb) { +if (first_skb && first_iplen && !defer && !first_skb_partial) {/* first_skb is queued b/c !defer and not partial */ if (pskb_trim (first_skb, first_iplen)) {/* error trimming */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 87/325 dma-mapping: direct: fix missing mapping for THRU_HOST_BRIDGE segments
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li RongQing <[email protected]>
[ Upstream commit 560000d619ef162568746ce287f0c725e24ea967 ]
In dma_direct_map_sg(), the case PCI_P2PDMA_MAP_THRU_HOST_BRIDGE incorrectly used 'break' instead of falling through to MAP_NONE. As a result, segments traversing the host bridge skipped the required dma_direct_map_phys() call entirely, leaving sg->dma_address uninitialized and leading to DMA failures. Fix this by using 'fallthrough;'.
--- kernel/dma/direct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/dma/direct.c +1 -1
@@ -469,7 +469,7 @@ int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents,* must be mapped with CPU physical address and not PCI * bus addresses. */ -break ; + fallthrough;case PCI_P2PDMA_MAP_NONE : sg->dma_address =dma_direct_map_phys (dev,sg_phys (sg), sg->length, dir, attrs);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 88/325 dma-debug: fix physical address retrieval in debug_dma_sync_sg_for_device
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li RongQing <[email protected]>
[ Upstream commit 9bfaa86b405381326c971984fd6da184c289713f ]
In debug_dma_sync_sg_for_device(), when iterating over a scatterlist, the debug entry population mistakenly uses the head of the scatterlist 'sg' to fetch the physical address via sg_phys(), instead of using the current iterator variable 's'.
This causes dma-debug to track the physical address of the very first scatterlist entry for all subsequent entries in the list.
Fix this by passing the correct loop iterator 's' to sg_phys()
--- kernel/dma/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/dma/debug.c +1 -1
@@ -1555,7 +1555,7 @@ void debug_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,struct dma_debug_entry ref = { .type = dma_debug_sg, .dev = dev, - .paddr =sg_phys (sg), + .paddr =sg_phys (s), .dev_addr =sg_dma_address (s), .size =sg_dma_len (s), .direction = direction,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 89/325 xfrm: policy: fix use-after-free on inexact bin in xfrm_policy_bysel_ctx()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sanghyun Park <[email protected]>
[ Upstream commit 7f2d76c9c03257c0782afef9d95321fa04096f60 ]
Fix the race by pruning the bin while still holding xfrm_policy_lock, before dropping it. Use __xfrm_policy_inexact_prune_bin() directly since the lock is already held. The wrapper xfrm_policy_inexact_prune_bin() becomes unused and is removed.
Race:
CPU0 (XFRM_MSG_DELPOLICY) CPU1 (XFRM_MSG_NEWSPDINFO)
========================== ==========================
xfrm_policy_bysel_ctx():
spin_lock_bh(xfrm_policy_lock)
bin = xfrm_policy_inexact_lookup()
__xfrm_policy_unlink(pol)
spin_unlock_bh(xfrm_policy_lock)
xfrm_policy_kill(ret)
// wide window, lock not held
xfrm_hash_rebuild():
spin_lock_bh(xfrm_policy_lock)
__xfrm_policy_inexact_flush():
kfree_rcu(bin) // bin freed
spin_unlock_bh(xfrm_policy_lock)
xfrm_policy_inexact_prune_bin(bin)
// UAF: bin is freed--- net/xfrm/xfrm_policy.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
net/xfrm/xfrm_policy.c +2 -11
@@ -1156,15 +1156,6 @@ static void __xfrm_policy_inexact_prune_bin(struct xfrm_pol_inexact_bin *b, bool } } -static void xfrm_policy_inexact_prune_bin (struct xfrm_pol_inexact_bin *b) -{ -struct net *net =read_pnet (&b->k.net); - -spin_lock_bh (&net->xfrm.xfrm_policy_lock); -__xfrm_policy_inexact_prune_bin (b, false); -spin_unlock_bh (&net->xfrm.xfrm_policy_lock); -} -static void __xfrm_policy_inexact_flush (struct net *net) {struct xfrm_pol_inexact_bin *bin, *t;
@@ -1707,12 +1698,12 @@ xfrm_policy_bysel_ctx(struct net *net, const struct xfrm_mark *mark, u32 if_id, } ret = pol; } +if (bin && delete) +__xfrm_policy_inexact_prune_bin (bin, false);spin_unlock_bh (&net->xfrm.xfrm_policy_lock);if (ret && delete)xfrm_policy_kill (ret); -if (bin && delete) -xfrm_policy_inexact_prune_bin (bin);return ret; }EXPORT_SYMBOL (xfrm_policy_bysel_ctx);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 90/325 ice: fix missing priority callbacks for U.FL DPLL pins
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Petr Oros <[email protected]>
[ Upstream commit f1fa677e428e8873486938086bd934dc18169b47 ]
The U.FL2 input pin advertises DPLL_PIN_CAPABILITIES_PRIORITY_CAN_CHANGE in its capability mask, but ice_dpll_pin_ufl_ops does not provide .prio_get and .prio_set callbacks. As a result the DPLL subsystem cannot report or accept priority for U.FL pins: pin-get omits the prio field on U.FL2 and pin-set with prio is rejected as invalid, even though the capability is present. This prevents user space from using priority to select or disable U.FL2 as a DPLL input source.
Reproducer with iproute2 (dpll command):
# dpll pin show board-label U.FL2
pin id 16:
module-name ice
board-label U.FL2
type ext
capabilities priority-can-change|state-can-change
parent-device:
id 0 direction input state selectable phase-offset 0
/* note: no "prio" between "direction" and "state",
even though priority-can-change is advertised */# dpll pin set id 16 parent-device 0 prio 5 RTNETLINK answers: Operation not supported
After the fix the prio field is reported by pin show and pin set with prio is accepted on U.FL2.
Add the missing .prio_get and .prio_set callbacks to ice_dpll_pin_ufl_ops, reusing ice_dpll_sw_input_prio_{get,set}. The same ops struct is shared by U.FL1 and U.FL2: U.FL2 (input) delegates to the backing hardware input pin, while U.FL1 (output) does not advertise DPLL_PIN_CAPABILITIES_PRIORITY_CAN_CHANGE so the dpll core capability gate never invokes prio_set for it, and prio_get reports the OUTPUT sentinel (ICE_DPLL_PIN_PRIO_OUTPUT) on the output side exactly like the SMA path does today.
--- drivers/net/ethernet/intel/ice/ice_dpll.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/ice/ice_dpll.c +2 -0
@@ -2481,6 +2481,8 @@ static const struct dpll_pin_ops ice_dpll_pin_ufl_ops = { .state_on_dpll_set = ice_dpll_ufl_pin_state_set, .state_on_dpll_get = ice_dpll_sw_pin_state_get, .direction_get = ice_dpll_pin_sw_direction_get, + .prio_get = ice_dpll_sw_input_prio_get, + .prio_set = ice_dpll_sw_input_prio_set, .frequency_get = ice_dpll_sw_pin_frequency_get, .frequency_set = ice_dpll_sw_pin_frequency_set, .esync_set = ice_dpll_sw_esync_set,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 91/325 idpf: fix mailbox capability for set device clock time
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alok Tiwari <[email protected]>
[ Upstream commit 85b0cbc1f38bc1e38956a9e6d7b04d309b435697 ]
The current code incorrectly uses VIRTCHNL2_CAP_PTP_SET_DEVICE_CLK_TIME for both direct and mailbox capabilities, causing mailbox-only support to be ignored and potentially reporting IDPF_PTP_NONE.
--- drivers/net/ethernet/intel/idpf/idpf_ptp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/idpf/idpf_ptp.c +1 -1
@@ -51,7 +51,7 @@ void idpf_ptp_get_features_access(const struct idpf_adapter *adapter)/* Set the device clock time */ direct =VIRTCHNL2_CAP_PTP_SET_DEVICE_CLK_TIME ; - mailbox =VIRTCHNL2_CAP_PTP_SET_DEVICE_CLK_TIME ; + mailbox =VIRTCHNL2_CAP_PTP_SET_DEVICE_CLK_TIME_MB ; ptp->set_dev_clk_time_access =idpf_ptp_get_access (adapter, direct, mailbox);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 92/325 net: ena: PHC: Add missing barrier
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arthur Kiyanovski <[email protected]>
[ Upstream commit 954981dbbfbd78f21d2fbac1ac0742dbf38b4e69 ]
Add dma_rmb() barrier after req_id completion check in ena_com_phc_get_timestamp(). On weakly-ordered architectures, payload fields may be read before req_id is observed as updated.
--- drivers/net/ethernet/amazon/ena/ena_com.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/amazon/ena/ena_com.c +5 -0
@@ -1880,6 +1880,11 @@ int ena_com_phc_get_timestamp(struct ena_com_dev *ena_dev, u64 *timestamp)continue ; } +/* Ensure PHC payload (timestamp, error_flags) is read +* after req_id update is observed +*/ +dma_rmb (); +/* req_id was updated by the device which indicates that * PHC timestamp and error_flags are updated too, * checking errors before retrieving timestamp
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 93/325 bnge: fix context mem iteration
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vikas Gupta <[email protected]>
[ Upstream commit 3847d94783c0b893c27ff0b26a3325796d9444c6 ]
The firmware advertises context memory (backing store) types through a linked list, with BNGE_CTX_INV serving as the end-of-list sentinel.
However, the driver incorrectly assumes that the list is strictly ordered and prematurely terminates traversal when it encounters an unrecognized type (>=BNGE_CTX_V2_MAX). As a result, any valid context types that appear later in the chain are silently skipped, leading to incomplete memory configuration and eventual driver load failure.
Fix this by traversing the entire list until the BNGE_CTX_INV sentinel is reached, while safely ignoring only those context types that fall outside the supported range.
--- drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c +10 -4
@@ -259,7 +259,7 @@ int bnge_hwrm_func_backing_store_qcaps(struct bnge_dev *bd)struct hwrm_func_backing_store_qcaps_v2_output *resp;struct hwrm_func_backing_store_qcaps_v2_input *req;struct bnge_ctx_mem_info *ctx; -u16 type; +u16 type, next_type;int rc;if (bd->ctx)
@@ -276,8 +276,8 @@ int bnge_hwrm_func_backing_store_qcaps(struct bnge_dev *bd) resp =bnge_hwrm_req_hold (bd, req); -for (type =0 ; type <BNGE_CTX_V2_MAX ; ) { -struct bnge_ctx_mem_type *ctxm = &ctx->ctx_arr[type]; +for (type =0 ; type <BNGE_CTX_INV ; type = next_type) { +struct bnge_ctx_mem_type *ctxm;u8 init_val, init_off, i;__le32 *p;u32 flags;
@@ -286,8 +286,14 @@ int bnge_hwrm_func_backing_store_qcaps(struct bnge_dev *bd) rc =bnge_hwrm_req_send (bd, req);if (rc) goto ctx_done; + + next_type =le16_to_cpu (resp->next_valid_type); +if (type >=BNGE_CTX_V2_MAX ) +continue ; + + ctxm = &ctx->ctx_arr[type]; flags =le32_to_cpu (resp->flags); - type =le16_to_cpu (resp->next_valid_type); +if (!(flags &FUNC_BACKING_STORE_QCAPS_V2_RESP_FLAGS_TYPE_VALID ))continue ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 94/325 netlabel: validate unlabeled address and mask attribute lengths
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chenguang Zhao <[email protected]>
[ Upstream commit 9772589b57e44aedc240211c5c3f7a684a034d3a ]
netlbl_unlabel_addrinfo_get() used the address attribute length to determine whether the attribute data could be read as an IPv4 or IPv6 address, but did not independently validate the corresponding mask attribute length. A crafted Generic Netlink request could therefore provide a valid IPv4/IPv6 address attribute with a shorter mask attribute, which would later be read as a full struct in_addr or struct in6_addr.
NLA_BINARY policy lengths are maximum lengths by default, so use NLA_POLICY_EXACT_LEN() for the unlabeled IPv4/IPv6 address and mask attributes. This rejects short attributes during policy validation and also exposes the exact length requirements through policy introspection.
--- net/netlabel/netlabel_unlabeled.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-)
net/netlabel/netlabel_unlabeled.c +10 -20
@@ -114,14 +114,14 @@ static struct genl_family netlbl_unlabel_gnl_family;/* NetLabel Netlink attribute policy */ static const struct nla_policy netlbl_unlabel_genl_policy[NLBL_UNLABEL_A_MAX +1 ] = { [NLBL_UNLABEL_A_ACPTFLG ] = { .type =NLA_U8 }, - [NLBL_UNLABEL_A_IPV6ADDR ] = { .type =NLA_BINARY , - .len =sizeof (struct in6_addr ) }, - [NLBL_UNLABEL_A_IPV6MASK ] = { .type =NLA_BINARY , - .len =sizeof (struct in6_addr ) }, - [NLBL_UNLABEL_A_IPV4ADDR ] = { .type =NLA_BINARY , - .len =sizeof (struct in_addr ) }, - [NLBL_UNLABEL_A_IPV4MASK ] = { .type =NLA_BINARY , - .len =sizeof (struct in_addr ) }, + [NLBL_UNLABEL_A_IPV6ADDR ] = +NLA_POLICY_EXACT_LEN (sizeof (struct in6_addr )), + [NLBL_UNLABEL_A_IPV6MASK ] = +NLA_POLICY_EXACT_LEN (sizeof (struct in6_addr )), + [NLBL_UNLABEL_A_IPV4ADDR ] = +NLA_POLICY_EXACT_LEN (sizeof (struct in_addr )), + [NLBL_UNLABEL_A_IPV4MASK ] = +NLA_POLICY_EXACT_LEN (sizeof (struct in_addr )), [NLBL_UNLABEL_A_IFACE ] = { .type =NLA_NUL_STRING , .len =IFNAMSIZ -1 }, [NLBL_UNLABEL_A_SECCTX ] = { .type =NLA_BINARY }
@@ -757,24 +757,14 @@ static int netlbl_unlabel_addrinfo_get(struct genl_info *info, void **mask, u32 *len) { - u32 addr_len; -if (info->attrs[NLBL_UNLABEL_A_IPV4ADDR ] && info->attrs[NLBL_UNLABEL_A_IPV4MASK ]) { - addr_len =nla_len (info->attrs[NLBL_UNLABEL_A_IPV4ADDR ]); -if (addr_len !=sizeof (struct in_addr ) && - addr_len !=nla_len (info->attrs[NLBL_UNLABEL_A_IPV4MASK ])) -return -EINVAL ; - *len = addr_len; + *len =sizeof (struct in_addr ); *addr =nla_data (info->attrs[NLBL_UNLABEL_A_IPV4ADDR ]); *mask =nla_data (info->attrs[NLBL_UNLABEL_A_IPV4MASK ]);return 0 ; }else if (info->attrs[NLBL_UNLABEL_A_IPV6ADDR ]) { - addr_len =nla_len (info->attrs[NLBL_UNLABEL_A_IPV6ADDR ]); -if (addr_len !=sizeof (struct in6_addr ) && - addr_len !=nla_len (info->attrs[NLBL_UNLABEL_A_IPV6MASK ])) -return -EINVAL ; - *len = addr_len; + *len =sizeof (struct in6_addr ); *addr =nla_data (info->attrs[NLBL_UNLABEL_A_IPV6ADDR ]); *mask =nla_data (info->attrs[NLBL_UNLABEL_A_IPV6MASK ]);return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 95/325 gpio: mvebu: fix NULL pointer dereference in suspend/resume
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yun Zhou <[email protected]>
[ Upstream commit b9ad50d7505ebd48282ec3630258dc820fc85c81 ]
mvebu_pwm_suspend() and mvebu_pwm_resume() are called for all GPIO banks during suspend/resume, but not all banks have PWM functionality. GPIO banks without PWM have mvchip->mvpwm set to NULL.
Calling mvebu_pwm_suspend() with mvpwm == NULL causes a NULL pointer dereference when it tries to access mvpwm->blink_select.
Unable to handle kernel NULL pointer dereference at virtual address 00000020 when write [00000020] *pgd=00000000 Internal error: Oops: 815 [#1] PREEMPT ARM Modules linked in: CPU: 0 UID: 0 PID: 406 Comm: sh Not tainted 6.12.74-rt12-yocto-standard-g4e96f98fb7db-dirty #353 Hardware name: Marvell Armada 370/XP (Device Tree) PC is at regmap_mmio_read+0x38/0x54 LR is at regmap_mmio_read+0x38/0x54 pc : [<c05fd2ac>] lr : [<c05fd2ac>] psr: 200f0013 sp : f0c11d10 ip : 00000000 fp : c100d2f0 r10: c14fb854 r9 : 00000000 r8 : 00000000 r7 : c1799c00 r6 : 00000020 r5 : 00000020 r4 : c179c7c0 r3 : f0a231a0 r2 : 00000020 r1 : 00000020 r0 : 00000000 Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none Control: 10c5387d Table: 135ec059 DAC: 00000051 Call trace: regmap_mmio_read from _regmap_bus_reg_read+0x78/0xac _regmap_bus_reg_read from _regmap_read+0x60/0x154 _regmap_read from regmap_read+0x3c/0x60 regmap_read from mvebu_gpio_suspend+0xa4/0x14c mvebu_gpio_suspend from dpm_run_callback+0x54/0x180 dpm_run_callback from device_suspend+0x124/0x630 device_suspend from dpm_suspend+0x124/0x270 dpm_suspend from dpm_suspend_start+0x64/0x6c dpm_suspend_start from suspend_devices_and_enter+0x140/0x8e8 suspend_devices_and_enter from pm_suspend+0x2fc/0x308 pm_suspend from state_store+0x6c/0xc8 state_store from kernfs_fop_write_iter+0x10c/0x1f8 kernfs_fop_write_iter from vfs_write+0x270/0x468 vfs_write from ksys_write+0x70/0xf0 ksys_write from ret_fast_syscall+0x0/0x54
Add a NULL check for mvchip->mvpwm before calling the PWM suspend/resume functions.
--- drivers/gpio/gpio-mvebu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-mvebu.c +2 -2
@@ -997,7 +997,7 @@ static int mvebu_gpio_suspend(struct platform_device *pdev, pm_message_t state)BUG (); } -if (IS_REACHABLE (CONFIG_PWM )) +if (IS_REACHABLE (CONFIG_PWM ) && mvchip->mvpwm)mvebu_pwm_suspend (mvchip);return 0 ;
@@ -1049,7 +1049,7 @@ static int mvebu_gpio_resume(struct platform_device *pdev)BUG (); } -if (IS_REACHABLE (CONFIG_PWM )) +if (IS_REACHABLE (CONFIG_PWM ) && mvchip->mvpwm)mvebu_pwm_resume (mvchip);return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 96/325 ASoC: wm_adsp: Fix NULL dereference when removing firmware controls
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Fitzgerald <[email protected]>
[ Upstream commit 7d3fb78b550301e43fdc60312aed733069694426 ]
In wm_adsp_control_remove() check that the priv pointer is not NULL before attempting to cleanup what it points to.
When cs_dsp creates a control it calls wm_adsp_control_add_cb() so that wm_adsp can create its own private control data. There are two cases where private data is not created:
1. The control is a SYSTEM control, so an ALSA control is not created.
2. The codec driver has registered a control_add() callback that hides the control, so wm_adsp_control_add() is not called.
When cs_dsp_remove destroys its control list it calls wm_adsp_control_remove() for each control. But wm_adsp_control_remove() was attempting to cleanup the private data pointed to by cs_ctl->priv without checking the pointer for NULL.
--- sound/soc/codecs/wm_adsp.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/codecs/wm_adsp.c +3 -0
@@ -666,6 +666,9 @@ static void wm_adsp_control_remove(struct cs_dsp_coeff_ctl *cs_ctl) {struct wm_coeff_ctl *ctl = cs_ctl->priv; +if (!ctl) +return ; +cancel_work_sync (&ctl->work);kfree (ctl->name);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 97/325 tcp: restrict SO_ATTACH_FILTER to priv users
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 5d39580f68e6ddeedd15e587282207489dfb3da2 ]
This patch restricts the use of SO_ATTACH_FILTER (cBPF) on TCP sockets to users with CAP_NET_ADMIN capability.
This blocks potential side-channel attack where an unprivileged application attaches a filter to leak TCP sequence/acknowledgment numbers.
--- net/core/sock.c | 5 +++++ 1 file changed, 5 insertions(+)
net/core/sock.c +5 -0
@@ -1457,6 +1457,11 @@ int sk_setsockopt(struct sock *sk, int level, int optname,case SO_ATTACH_FILTER : {struct sock_fprog fprog; +if (sk_is_tcp (sk) && + !sockopt_ns_capable (sock_net (sk)->user_ns,CAP_NET_ADMIN )) { + ret = -EPERM ; +break ; + } ret =copy_bpf_fprog_from_user (&fprog, optval, optlen);if (!ret) ret =sk_attach_filter (&fprog, sk);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 98/325 net: add pskb_may_pull() to skb_gro_receive_list()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: HanQuan <[email protected]>
[ Upstream commit f2bb3434544454099a5b6dec213567267b05d79d ]
skb_gro_receive_list() calls skb_pull(skb, skb_gro_offset(skb)) without first ensuring the data is in the linear area via pskb_may_pull(). When the skb arrives via napi_gro_frags(), skb_headlen can be 0 (all data in page fragments) while skb_gro_offset is non-zero (after IP+TCP header parsing). The skb_pull() then decrements skb->len by skb_gro_offset but skb->data_len stays unchanged, hitting BUG_ON(skb->len < skb->data_len) in __skb_pull().
The UDP fraglist GRO path already contains this guard at udp_offload.c:749. Adding it to skb_gro_receive_list() itself provides centralized protection for all callers (TCP, UDP, and any future protocols), and ensures the precondition of skb_pull() is satisfied before it is called.
On pskb_may_pull() failure, set NAPI_GRO_CB(skb)->flush = 1 so the skb is not held as a new GRO head and is instead delivered through the normal receive path, matching the UDP handling.
--- net/core/gro.c | 5 +++++ 1 file changed, 5 insertions(+)
net/core/gro.c +5 -0
@@ -234,6 +234,11 @@ int skb_gro_receive_list(struct sk_buff *p, struct sk_buff *skb)if (unlikely (p->len + skb->len >=65536 ))return -E2BIG ; +if (!pskb_may_pull (skb,skb_gro_offset (skb))) { +NAPI_GRO_CB (skb)->flush =1 ; +return -ENOMEM ; + } +if (NAPI_GRO_CB (p)->last == p)skb_shinfo (p)->frag_list = skb;else
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 99/325 net/mlx4: avoid GCC 10 __bad_copy_from() false positive
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yao Sang <[email protected]>
[ Upstream commit 2365343f4aad3e1b1e7a2e87e98cf66d5e590589 ]
mlx4_init_user_cqes() fills a scratch buffer with the CQE initialization pattern and then copies from that buffer to userspace.
In the single-copy path, the copy length is array_size(entries, cqe_size), but the scratch buffer is allocated with PAGE_SIZE. GCC 10 does not carry the branch invariant strongly enough through the object size checks and falsely triggers __bad_copy_from().
Size the scratch buffer to the actual copy length for the active path, keep array_size() for the single-copy case, and retain a WARN_ON_ONCE() guard for the PAGE_SIZE invariant before allocating the buffer.
--- drivers/net/ethernet/mellanox/mlx4/cq.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx4/cq.c +8 -1
@@ -290,6 +290,7 @@ static void mlx4_cq_free_icm(struct mlx4_dev *dev, int cqn)static int mlx4_init_user_cqes (void *buf,int entries,int cqe_size) {int entries_per_copy =PAGE_SIZE / cqe_size; +size_t copy_bytes;void *init_ents;int err =0 ;int i;
@@ -314,8 +315,14 @@ static int mlx4_init_user_cqes(void *buf, int entries, int cqe_size) buf +=PAGE_SIZE ; } }else { + copy_bytes =array_size (entries, cqe_size); +if (WARN_ON_ONCE (copy_bytes >PAGE_SIZE )) { + err = -EINVAL ; + goto out; + } + err =copy_to_user ((void __user *)buf, init_ents, -array_size (entries, cqe_size)) ? + copy_bytes) ? -EFAULT :0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 100/325 net: ibm: emac: Fix use-after-free during device removal
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit a0130d682222ae21afc395aead7cd2d87e1a8358 ]
The driver was using devm_register_netdev() which causes unregister_netdev() to be deferred until the devres cleanup phase, which runs after emac_remove() returns. This creates a use-after-free window where:
1. emac_remove() is called, which tears down hardware (cancels work, detaches modules, unregisters from MAL)
2. emac_remove() returns
3. devres cleanup runs and finally calls unregister_netdev()
During step 3, the network stack might still process packets, triggering emac_irq(), emac_poll(), or other handlers that access now-freed hardware resources (dev->emacp, dev->mal, etc.).
Fix this by replacing devm_register_netdev() with manual register_netdev() and calling unregister_netdev() at the beginning of emac_remove(), before any hardware teardown. This ensures the network device is fully stopped and unregistered before hardware resources are released.
The change is safe because:
- dev->ndev is assigned very early in probe (before any error paths that could bypass emac_remove)
- platform_set_drvdata() is only called after successful registration, so emac_remove() only runs for fully registered devices
- unregister_netdev() is idempotent and safe to call on any registered device
--- drivers/net/ethernet/ibm/emac/core.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/ethernet/ibm/emac/core.c +8 -1
@@ -3144,7 +3144,7 @@ static int emac_probe(struct platform_device *ofdev)netif_carrier_off (ndev); - err =devm_register_netdev (&ofdev->dev, ndev); + err =register_netdev (ndev);if (err) {printk (KERN_ERR "%pOF: failed to register net device (%d)!\n" , np, err);
@@ -3197,6 +3197,13 @@ static void emac_remove(struct platform_device *ofdev)DBG (dev,"remove" NL ); +/* Unregister network device before tearing down hardware +* to prevent use-after-free during deferred cleanup. This ensures +* the network stack stops all operations before hardware resources +* are released. +*/ +unregister_netdev (dev->ndev); +cancel_work_sync (&dev->reset_work);if (emac_has_feature (dev,EMAC_FTR_HAS_TAH ))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 101/325 netdev: fix double-free in netdev_nl_bind_rx_doit()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit c849de7d8757a7af801fc4a4058f71d481d367f2 ]
Sashiko flags that genlmsg_reply() always consumes the skb. The error path calls nlmsg_free(rsp) so we can't jump directly to it. Let's not unbind, just propagate the error to the user. This is the typical way of handling genlmsg_reply() failures. They shouldn't happen unless user does something silly like calling the kernel with an already-full rcvbuf.
--- net/core/netdev-genl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
net/core/netdev-genl.c +1 -3
@@ -1019,8 +1019,6 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info)genlmsg_end (rsp, hdr); err =genlmsg_reply (rsp, info); -if (err) - goto err_unbind;bitmap_free (rxq_bitmap);
@@ -1028,7 +1026,7 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info)mutex_unlock (&priv->lock); -return 0 ; +return err <0 ? err :0 ; err_unbind:net_devmem_unbind_dmabuf (binding);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 102/325 net: phy: clean the sfp upstream if phy probing fails
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Chevallier <[email protected]>
[ Upstream commit 48774e87bbaa0056819d4b52301e4692e50e3252 ]
Sashiko reported that we don't call sfp_bus_del_upstream() in the probe failure path, so let's add it, otherwise the sfp-bus is left with a dangling 'upstream' field, that may be used later on during SFP events.
This issue existed before the generic phylib sfp support, back when drivers were calling phy_sfp_probe themselves.
--- drivers/net/phy/phy_device.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/phy/phy_device.c +6 -0
@@ -1598,6 +1598,9 @@ int phy_sfp_probe(struct phy_device *phydev, ret =sfp_bus_add_upstream (bus, phydev, ops);sfp_bus_put (bus); + +if (ret) + phydev->sfp_bus =NULL ; }return ret; }
@@ -3513,6 +3516,9 @@ static int phy_probe(struct device *dev)return 0 ; out: +sfp_bus_del_upstream (phydev->sfp_bus); + phydev->sfp_bus =NULL ; +if (!phydev->is_on_sfp_module)phy_led_triggers_unregister (phydev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 103/325 net: qrtr: fix refcount saturation and potential UAF in qrtr_port_remove
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mingyu Wang <[email protected]>
[ Upstream commit a2171131ecda1ed61a594a1eb715e75fdad0fef5 ]
In qrtr_port_remove(), the socket reference count is decremented via __sock_put() before the port is removed from the qrtr_ports XArray and before the RCU grace period elapses.
This breaks the fundamental RCU update paradigm. It exposes a race window where a concurrent RCU reader (such as qrtr_reset_ports() or qrtr_port_lookup()) can obtain a pointer to the socket from the XArray, and attempt to call sock_hold() on a socket whose reference count has already dropped to zero.
This exact race condition was hit during syzkaller fuzzing, leading to the following refcount saturation warning and a potential Use-After-Free:
refcount_t: saturated; leaking memory.
WARNING: CPU: 3 PID: 1273 at lib/refcount.c:22 refcount_warn_saturate+0xae/0x1d0 Modules linked in: qrtr(+) bochs drm_shmem_helper ... Call Trace: <TASK> qrtr_reset_ports net/qrtr/af_qrtr.c:768 [inline] [qrtr] __qrtr_bind.isra.0+0x48b/0x570 net/qrtr/af_qrtr.c:805 [qrtr] qrtr_bind+0x17d/0x210 net/qrtr/af_qrtr.c:901 [qrtr] kernel_bind+0xe4/0x120 net/socket.c:3592 qrtr_ns_init+0x1a6/0x380 net/qrtr/ns.c:715 [qrtr] qrtr_proto_init+0x3b/0xff0 net/qrtr/af_qrtr.c:169 [qrtr] do_one_initcall+0xf5/0x5e0 init/main.c:1283 ... </TASK>
Fix this by deferring the reference count decrement until after the xa_erase() and the synchronize_rcu() complete.
(Note: The v1 of this patch incorrectly replaced __sock_put() with sock_put(). As Simon Horman pointed out, the callers of qrtr_port_remove() still hold a reference to the socket, so freeing the socket memory here would lead to a subsequent UAF in the caller. Thus, the __sock_put() is kept, but only repositioned to close the RCU race.)
--- net/qrtr/af_qrtr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/qrtr/af_qrtr.c +2 -2
@@ -707,13 +707,13 @@ static void qrtr_port_remove(struct qrtr_sock *ipc)if (port ==QRTR_PORT_CTRL ) port =0 ; -__sock_put (&ipc->sk); -xa_erase (&qrtr_ports, port);/* Ensure that if qrtr_port_lookup() did enter the RCU read section we * wait for it to up increment the refcount */ synchronize_rcu (); + +__sock_put (&ipc->sk); }/* Assign port number to socket.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 104/325 net/mlx5: Fix slab-out-of-bounds in mlx5_query_nic_vport_mac_list
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dragos Tatulea <[email protected]>
[ Upstream commit 894e036a24a26a6dd7b17d8d3fb5c53ab48a6074 ]
mlx5_query_nic_vport_mac_list() sizes its firmware command buffer using the PF's log_max_current_uc/mc_list capabilities. When querying a VF vport with a larger configured max (via devlink), the firmware response can overflow this buffer:
BUG: KASAN: slab-out-of-bounds in mlx5_query_nic_vport_mac_list+0x453/0x4c0 [mlx5_core] Read of size 4 at addr ff1100013ffc8a12 by task kworker/u96:2/385 CPU: 12 UID: 0 PID: 385 Comm: kworker/u96:2 Not tainted 7.0.0-rc6+ #1 PREEMPT Hardware name: QEMU Standard PC (Q35 + ICH9, 2009) Workqueue: mlx5_esw_wq esw_vport_change_handler [mlx5_core] Call Trace: <TASK> dump_stack_lvl+0x69/0xa0 print_report+0x176/0x4e4 kasan_report+0xc8/0x100 mlx5_query_nic_vport_mac_list+0x453/0x4c0 [mlx5_core] esw_update_vport_addr_list+0x2e3/0xda0 [mlx5_core] esw_vport_change_handle_locked+0xa1f/0x1060 [mlx5_core] esw_vport_change_handler+0x6a/0x90 [mlx5_core] process_one_work+0x87f/0x15e0 worker_thread+0x62b/0x1020 kthread+0x375/0x490 ret_from_fork+0x4dc/0x810 ret_from_fork_asm+0x11/0x20 </TASK>
Fix by querying the vport's own HCA caps to size the buffer correctly. Refactor the function to allocate and return the MAC list internally, removing the caller's dependency on knowing the correct max.
--- .../net/ethernet/mellanox/mlx5/core/eswitch.c | 13 +--- .../net/ethernet/mellanox/mlx5/core/vport.c | 72 ++++++++++++++----- include/linux/mlx5/vport.h | 4 +- 3 files changed, 59 insertions(+), 30 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +3 -10
@@ -533,23 +533,16 @@ static void esw_update_vport_addr_list(struct mlx5_eswitch *esw, struct mlx5_vport *vport, int list_type) { bool is_uc = list_type == MLX5_NVPRT_LIST_TYPE_UC; -u8 (*mac_list)[ETH_ALEN ]; +u8 (*mac_list)[ETH_ALEN ] =NULL ;struct l2addr_node *node;struct vport_addr *addr;struct hlist_head *hash;struct hlist_node *tmp; -int size; +int size =0 ;int err;int hi;int i; - size = is_uc ?MLX5_MAX_UC_PER_VPORT (esw->dev) : -MLX5_MAX_MC_PER_VPORT (esw->dev); - - mac_list =kcalloc (size,ETH_ALEN ,GFP_KERNEL ); -if (!mac_list) -return ; - hash = is_uc ? vport->uc_list : vport->mc_list;for_each_l2hash_node (node, tmp, hash, hi) {
@@ -561,7 +554,7 @@ static void esw_update_vport_addr_list(struct mlx5_eswitch *esw, goto out; err =mlx5_query_nic_vport_mac_list (esw->dev, vport->vport, list_type, - mac_list, &size); + &mac_list, &size);if (err) goto out; esw_debug(esw->dev, "vport[%d] context update %s list size (%d)\n",
drivers/net/ethernet/mellanox/mlx5/core/vport.c +54 -18
105 lines not on this page · raw message
include/linux/mlx5/vport.h +2 -2
@@ -95,8 +95,8 @@ int mlx5_query_hca_vport_node_guid(struct mlx5_core_dev *dev,int mlx5_query_nic_vport_mac_list (struct mlx5_core_dev *dev,u16 vport,enum mlx5_list_type list_type, -u8 addr_list[][ETH_ALEN ], -int *list_size); +u8 (**mac_list)[ETH_ALEN ], +int *mac_list_size); int mlx5_modify_nic_vport_mac_list(struct mlx5_core_dev *dev, enum mlx5_list_type list_type, u8 addr_list[][ETH_ALEN],
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 105/325 net/mlx5e: xsk: Fix DMA and xdp_frame leak on XDP_TX xmit failure
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dragos Tatulea <[email protected]>
[ Upstream commit b69004f5a6ad32da84d8aa5b23b9c0caafe6252e ]
In the XSK branch of mlx5e_xmit_xdp_buff(), when sq->xmit_xdp_frame() returns false (e.g. XDPSQ is full), the function returns without unmapping the DMA address or freeing the xdp_frame allocated by xdp_convert_zc_to_xdp_frame(). The xdpi_fifo push only happens on success, so the completion path cannot recover these entries.
With CONFIG_DMA_API_DEBUG=y, the leak surfaces on driver unbind:
DMA-API: pci 0000:08:00.0: device driver has pending DMA allocations while released from device [count=1116]
One of leaked entries details: [device address=0x000000010ffd7028] [size=1534 bytes] [mapped with DMA_TO_DEVICE] [mapped as phy]
WARNING: kernel/dma/debug.c:881 at dma_debug_device_change+0x127/0x180 ... DMA-API: Mapped at: debug_dma_map_phys+0x4b/0xd0 dma_map_phys+0xfd/0x2d0 mlx5e_xdp_handle+0x5ae/0xac0 [mlx5_core] mlx5e_xsk_skb_from_cqe_mpwrq_linear+0xc4/0x170 [mlx5_core] mlx5e_handle_rx_cqe_mpwrq+0xc1/0x290 [mlx5_core]
Add the missing unmap + xdp_return_frame, matching the cleanup already done in mlx5e_xdp_xmit(). has_frags is rejected earlier in this branch, so no per-frag unmap is needed.
--- drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c +8 -2
@@ -102,9 +102,15 @@ mlx5e_xmit_xdp_buff(struct mlx5e_xdpsq *sq, struct mlx5e_rq *rq, xdptxd->dma_addr = dma_addr; -if (unlikely (!INDIRECT_CALL_2 (sq->xmit_xdp_frame, mlx5e_xmit_xdp_frame_mpwqe, - mlx5e_xmit_xdp_frame, sq, xdptxd,0 ,NULL ))) +if (unlikely (!INDIRECT_CALL_2 (sq->xmit_xdp_frame, + mlx5e_xmit_xdp_frame_mpwqe, + mlx5e_xmit_xdp_frame, + sq, xdptxd,0 ,NULL ))) { +dma_unmap_single (sq->pdev, dma_addr, xdptxd->len, +DMA_TO_DEVICE ); +xdp_return_frame (xdpf);return false; + }/* xmit_mode == MLX5E_XDP_XMIT_MODE_FRAME */ mlx5e_xdpi_fifo_push(&sq->db.xdpi_fifo,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 106/325 net/mlx5: Use effective affinity mask for IRQ selection
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fushuai Wang <[email protected]>
[ Upstream commit a7767290e77ca2e926b49f8bfa29daa12262c612 ]
When a sf is created after a CPU has been taken offline, the IRQ pool may contain IRQs with affinity masks that include the offline CPU. Since only online CPUs should be considered for IRQ placement, cpumask_subset() check would fail because the iter_mask contains offline CPUs that are not present in req_mask, causing sf creation to fail.
This is an example:
1. When mlx5 driver loads, it initializes the IRQ pools. For sf_ctrl_pool with ≤64 sf:
- xa_num_irqs = {N, N} (There is only one slot)
2. When the first SF is created:
- The ctrl IRQ is allocated with mask=cpu_online_mask={0-191}
2. We take CPU 20 offline
3. Existing ctl irq still have mask={0-191}
4. Create a new SF:
- req_mask={0-19,21-191}
- iter_mask={0-191}
- {0-191} is NOT a subset of {0-19,21-191}
- least_loaded_irq=NULL
5. Try to allocate a new irq via irq_pool_request_irq()
6. xa_alloc() fails because the pool is full(There is only one slot)
7. sf creation fails with error
Use irq_get_effective_affinity_mask() instead, which returns the IRQ's actual effective affinity that already excludes offline CPUs.
--- drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c +4 -1
@@ -105,9 +105,12 @@ irq_pool_find_least_loaded(struct mlx5_irq_pool *pool, const struct cpumask *reqlockdep_assert_held (&pool->lock);xa_for_each_range (&pool->irqs, index, iter, start, end) { -struct cpumask *iter_mask =mlx5_irq_get_affinity_mask (iter);int iter_refcount =mlx5_irq_read_locked (iter); +const struct cpumask *iter_mask; + iter_mask =irq_get_effective_affinity_mask (mlx5_irq_get_irq (iter)); +if (!iter_mask) +continue ;if (!cpumask_subset (iter_mask, req_mask))/* skip IRQs with a mask which is not subset of req_mask */ continue ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 107/325 ipv6: sit: reload inner IPv6 header after GSO offloads
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <[email protected]>
[ Upstream commit f0e42f0c4337b1f220de1ddd63f47197c7dee4de ]
ipip6_tunnel_xmit() caches the inner IPv6 header pointer at function entry and continues using it after iptunnel_handle_offloads().
For GSO skbs, iptunnel_handle_offloads() calls skb_header_unclone(). When the skb header is cloned, skb_header_unclone() can call pskb_expand_head(), which may move the skb head. The pskb_expand_head() contract requires pointers into the skb header to be reloaded after the call.
If the later skb_realloc_headroom() branch is not taken, SIT uses the stale iph6 pointer to read the inner hop limit and DS field. That can read from a freed skb head after the old head's remaining clone is released.
Reload iph6 after the offload helper succeeds and before subsequent reads from the inner IPv6 header. Keep the existing reload after skb_realloc_headroom(), since that branch can also replace the skb.
--- net/ipv6/sit.c | 1 + 1 file changed, 1 insertion(+)
net/ipv6/sit.c +1 -0
@@ -960,6 +960,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,ip_rt_put (rt); goto tx_error; } + iph6 =ipv6_hdr (skb);if (df) { mtu =dst_mtu (&rt->dst) - t_hlen;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 108/325 net: openvswitch: fix possible kfree_skb of ERR_PTR
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Moreno <[email protected]>
[ Upstream commit ee30dd2909d8b98619f4341c70ec8dc8e155ab02 ]
After the patch in the "Fixes" tag, the allocation of the "reply" skb can happen either before or after locking the ovs_mutex.
However, error cleanups still follow the classical reversed order, assuming "reply" is allocated before locking: it is freed after unlocking.
If "reply" allocation happens after locking the mutex and it fails, "reply" is left with an ERR_PTR, and execution jumps to the correspondent cleanup stage which will try to free an invalid pointer.
Fix this by setting the pointer to NULL after having saved its error value.
--- net/openvswitch/datapath.c | 1 + 1 file changed, 1 insertion(+)
net/openvswitch/datapath.c +1 -0
@@ -1316,6 +1316,7 @@ static int ovs_flow_cmd_set(struct sk_buff *skb, struct genl_info *info)if (IS_ERR (reply)) { error =PTR_ERR (reply); + reply =NULL ; goto err_unlock_ovs; } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 109/325 r8152: handle the return value of usb_reset_device()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chih Kai Hsu <[email protected]>
[ Upstream commit 19440600e729d4f74a42591a872099cf25c7d28a ]
If usb_reset_device() returns a negative error code, stop the process of probing.
--- drivers/net/usb/r8152.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/usb/r8152.c +6 -1
@@ -9781,7 +9781,12 @@ static int rtl8152_probe_once(struct usb_interface *intf,struct net_device *netdev;int ret; -usb_reset_device (udev); + ret =usb_reset_device (udev); +if (ret <0 ) { +dev_err (&intf->dev,"USB reset failed, errno=%d\n" , ret); +return ret; + } + netdev =alloc_etherdev (sizeof (struct r8152 ));if (!netdev) {dev_err (&intf->dev,"Out of memory\n" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 110/325 gpio: zynq: fix runtime PM leak on remove
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruoyu Wang <[email protected]>
[ Upstream commit 6edb934de9bda3b7abcec856eaee6fc8b4278dd1 ]
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error. zynq_gpio_remove() uses it to keep the controller active while removing the GPIO chip, but never drops the usage counter again.
Balance the get with pm_runtime_put_noidle() after disabling runtime PM.
--- drivers/gpio/gpio-zynq.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpio/gpio-zynq.c +1 -0
@@ -1017,6 +1017,7 @@ static void zynq_gpio_remove(struct platform_device *pdev)gpiochip_remove (&gpio->chip);device_set_wakeup_capable (&pdev->dev,0 );pm_runtime_disable (&pdev->dev); +pm_runtime_put_noidle (&pdev->dev); }static struct platform_driver zynq_gpio_driver = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 111/325 gpio: rockchip: fix generic IRQ chip leak on remove
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marco Scardovi <[email protected]>
[ Upstream commit 1c1e0fc88d6ef65bf15d517853251f75ab9d18c3 ]
The driver allocates domain generic chips using irq_alloc_domain_generic_chips() during probe. However, on driver remove/teardown, the generic chips are not automatically freed when the IRQ domain is removed because the domain flags do not include IRQ_DOMAIN_FLAG_DESTROY_GC.
This causes both the domain generic chips structure and the associated generic chips to be leaked. Additionally, the generic chips remain on the global gc_list and may later be visited by generic IRQ chip suspend, resume, or shutdown callbacks after the GPIO bank has been removed, potentially resulting in a use-after-free and kernel crash.
Fix the resource leak by explicitly calling irq_domain_remove_generic_chips() before removing the IRQ domain in rockchip_gpio_remove().
--- drivers/gpio/gpio-rockchip.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpio/gpio-rockchip.c +3 -1
@@ -802,8 +802,10 @@ static void rockchip_gpio_remove(struct platform_device *pdev)struct rockchip_pin_bank *bank =platform_get_drvdata (pdev);irq_set_chained_handler_and_data (bank->irq,NULL ,NULL ); -if (bank->domain) +if (bank->domain) { +irq_domain_remove_generic_chips (bank->domain);irq_domain_remove (bank->domain); + }gpiochip_remove (&bank->gpio_chip); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 112/325 net: mctp: usb: fix race between urb completion and rx_retry cancellation
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeremy Kerr <[email protected]>
[ Upstream commit 54665dce982689e2fd99b32e9a0dcc204fda8a51 ]
It's possible that sequencing between setting ->stopped and cancelling the rx_retry work (in ndo_stop) could leave us with an urb queued:
T1: ndo_stop T2: rx_retry_work
------------ ----------------
LD: ->stopped => false
ST: ->stopped <= true
usb_kill_urb()
mctp_usb_rx_queue()
usb_submit_urb()
cancel_delayed_work_sync()That urb completion can then re-schedule rx_retry_work.
Strenghen the sequencing between the stop (preventing another requeue) and the cancel by updating both atomically under a new rx lock. After setting ->rx_stopped, and cancelling pending work, we know that the requeue cannot occur, so all that's left is killing any pending urb.
--- drivers/net/mctp/mctp-usb.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-)
drivers/net/mctp/mctp-usb.c +17 -9
@@ -22,7 +22,6 @@struct mctp_usb {struct usb_device *usbdev;struct usb_interface *intf; -bool stopped;struct net_device *netdev;
@@ -32,6 +31,9 @@ struct mctp_usb {struct urb *tx_urb;struct urb *rx_urb; +/* enforces atomic access to rx_stopped and requeuing the retry work */ +spinlock_t rx_lock; +bool rx_stopped;struct delayed_work rx_retry_work; };
@@ -122,6 +124,7 @@ static const unsigned long RX_RETRY_DELAY = HZ / 4;static int mctp_usb_rx_queue (struct mctp_usb *mctp_usb,gfp_t gfp) { +unsigned long flags;struct sk_buff *skb;int rc;
@@ -147,7 +150,10 @@ static int mctp_usb_rx_queue(struct mctp_usb *mctp_usb, gfp_t gfp)return rc; err_retry: -schedule_delayed_work (&mctp_usb->rx_retry_work,RX_RETRY_DELAY ); +spin_lock_irqsave (&mctp_usb->rx_lock, flags); +if (!mctp_usb->rx_stopped) +schedule_delayed_work (&mctp_usb->rx_retry_work,RX_RETRY_DELAY ); +spin_unlock_irqrestore (&mctp_usb->rx_lock, flags);return rc; }
@@ -248,9 +254,6 @@ static void mctp_usb_rx_retry_work(struct work_struct *work) struct mctp_usb *mctp_usb = container_of(work, struct mctp_usb, rx_retry_work.work); -if (READ_ONCE (mctp_usb->stopped)) -return ; -mctp_usb_rx_queue (mctp_usb,GFP_KERNEL ); }
@@ -258,7 +261,7 @@ static int mctp_usb_open(struct net_device *dev) {struct mctp_usb *mctp_usb =netdev_priv (dev); -WRITE_ONCE (mctp_usb->stopped, false); +WRITE_ONCE (mctp_usb->rx_stopped, false);netif_start_queue (dev);
@@ -268,17 +271,21 @@ static int mctp_usb_open(struct net_device *dev)static int mctp_usb_stop (struct net_device *dev) {struct mctp_usb *mctp_usb =netdev_priv (dev); +unsigned long flags;netif_stop_queue (dev);/* prevent RX submission retry */ -WRITE_ONCE (mctp_usb->stopped, true); +spin_lock_irqsave (&mctp_usb->rx_lock, flags); + mctp_usb->rx_stopped = true; +cancel_delayed_work (&mctp_usb->rx_retry_work); +spin_unlock_irqrestore (&mctp_usb->rx_lock, flags); + +flush_delayed_work (&mctp_usb->rx_retry_work);usb_kill_urb (mctp_usb->rx_urb);usb_kill_urb (mctp_usb->tx_urb); -cancel_delayed_work_sync (&mctp_usb->rx_retry_work); -return 0 ; }
@@ -331,6 +338,7 @@ static int mctp_usb_probe(struct usb_interface *intf, dev->netdev = netdev; dev->usbdev =interface_to_usbdev (intf); dev->intf = intf; +spin_lock_init (&dev->rx_lock);usb_set_intfdata (intf, dev); dev->ep_in = ep_in->bEndpointAddress;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 113/325 net: mctp: usb: dont fail mctp_usb_rx_queue on a deferred submission
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeremy Kerr <[email protected]>
[ Upstream commit 881a3113b74964918cdd72747e3bc119c02b0c0c ]
In the ndo_open path, a deferred queue open will report a failure, and so the netdev will not be ndo_stop()ed, leaving us with the rx_retry work potentially pending.
Don't report a deferred queue as an error, as we are still operational. This means we use the ndo_stop() path for future cleanup, which handles rx_retry_work cancellation.
--- drivers/net/mctp/mctp-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mctp/mctp-usb.c +1 -1
@@ -154,7 +154,7 @@ static int mctp_usb_rx_queue(struct mctp_usb *mctp_usb, gfp_t gfp)if (!mctp_usb->rx_stopped)schedule_delayed_work (&mctp_usb->rx_retry_work,RX_RETRY_DELAY );spin_unlock_irqrestore (&mctp_usb->rx_lock, flags); -return rc; +return 0 ; }static void mctp_usb_in_complete (struct urb *urb)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 114/325 ASoC: SOF: amd: fix for ipc flags check
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vijendar Mukunda <[email protected]>
[ Upstream commit 6042c91df60e825625bc7d5c5c3b5a87b91d5805 ]
Firmware will set dsp_ack to 1 when firmware sends response for the IPC command issued by host. Similarly dsp_msg flag will be updated to 1.
During ACP D0 entry, the value read from the sof_dsp_ack_write scratch flag can be uninitialized. A non-zero garbage value is treated as a pending DSP IPC ack before SOF_FW_BOOT_COMPLETE, causing a spurious "IPC reply before FW_BOOT_COMPLETE" log.
Fix the condition checks for ipc flags.
--- sound/soc/sof/amd/acp-ipc.c | 4 ++-- sound/soc/sof/amd/acp.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-)
sound/soc/sof/amd/acp-ipc.c +2 -2
@@ -181,14 +181,14 @@ irqreturn_t acp_sof_ipc_irq_thread(int irq, void *context) } dsp_msg =snd_sof_dsp_read (sdev,ACP_DSP_BAR ,ACP_SCRATCH_REG_0 + dsp_msg_write); -if (dsp_msg) { +if (dsp_msg ==ACP_DSP_MSG_SET ) {snd_sof_ipc_msgs_rx (sdev);acp_dsp_ipc_host_done (sdev); ipc_irq = true; } dsp_ack =snd_sof_dsp_read (sdev,ACP_DSP_BAR ,ACP_SCRATCH_REG_0 + dsp_ack_write); -if (dsp_ack) { +if (dsp_ack ==ACP_DSP_ACK_SET ) {if (likely (sdev->fw_state ==SOF_FW_BOOT_COMPLETE )) {spin_lock_irq (&sdev->ipc_lock);
sound/soc/sof/amd/acp.h +2 -0
@@ -116,6 +116,8 @@#define ACP_SRAM_PAGE_COUNT 128#define ACP6X_SDW_MAX_MANAGER_COUNT 2#define ACP70_SDW_MAX_MANAGER_COUNT ACP6X_SDW_MAX_MANAGER_COUNT +#define ACP_DSP_MSG_SET 1 +#define ACP_DSP_ACK_SET 1enum clock_source {ACP_CLOCK_96M =0 ,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 115/325 sctp: fix uninit-value in __sctp_rcv_asconf_lookup()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Bommarito <[email protected]>
[ Upstream commit f8373d7090b745728de66308deeecc67e8d319ce ]
__sctp_rcv_asconf_lookup() in net/sctp/input.c only checks that the ASCONF chunk can hold the ADDIP header and a parameter header, then calls af->from_addr_param(), which reads the full address (16 bytes for IPv6) trusting the parameter's declared length.
An unauthenticated peer can send a truncated trailing ASCONF chunk that declares an IPv6 address parameter but stops after the 4-byte parameter header; reached from the no-association lookup path, from_addr_param() then reads uninitialized bytes past the parameter.
Impact: an unauthenticated SCTP peer makes the receive path read up to 16 bytes of uninitialized memory past a truncated ASCONF address parameter.
The sibling __sctp_rcv_init_lookup() bounds parameters with sctp_walk_params(); this path open-codes the fetch and omits the bound. Verify the whole address parameter lies within the chunk before from_addr_param() reads it, the same class of fix as commit 51e5ad549c43 ("net: sctp: fix KMSAN uninit-value in sctp_inq_pop").
--- net/sctp/input.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/sctp/input.c +8 -0
@@ -1204,6 +1204,14 @@ static struct sctp_association *__sctp_rcv_asconf_lookup(/* Skip over the ADDIP header and find the Address parameter */ param = (union sctp_addr_param *)(asconf +1 ); +/* The whole address parameter must lie within the chunk before +* af->from_addr_param() reads the variable-length address; otherwise a +* truncated trailing ASCONF chunk lets it read uninitialized bytes past +* the parameter. +*/ +if (sizeof (*asconf) +ntohs (param->p.length) >ntohs (ch->length)) +return NULL ; + af =sctp_get_af_specific (param_type2af (param->p.type));if (unlikely (!af))return NULL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 116/325 ip6_vti: set netns_immutable on the fallback device.
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit d289d5307762d1838aaece22c6b6fcad9e8865f9 ]
john1988 and Noam Rathaus reported that vti6_init_net() does not set the netns_immutable flag on the per-netns fallback tunnel device (ip6_vti0).
Other similar tunnel drivers (like ip6_tunnel, sit, ip6_gre, and ip_tunnel) correctly set this flag during their fallback device initialization to prevent them from being moved to another network namespace.
--- net/ipv6/ip6_vti.c | 1 + 1 file changed, 1 insertion(+)
net/ipv6/ip6_vti.c +1 -0
@@ -1159,6 +1159,7 @@ static int __net_init vti6_init_net(struct net *net) goto err_alloc_dev;dev_net_set (ip6n->fb_tnl_dev, net); ip6n->fb_tnl_dev->rtnl_link_ops = &vti6_link_ops; + ip6n->fb_tnl_dev->netns_immutable = true; err =vti6_fb_tnl_dev_init (ip6n->fb_tnl_dev);if (err <0 )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 117/325 sctp: validate embedded INIT chunk and address list lengths in cookie
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
[ Upstream commit 6f4c80a2a7e6d06753b89a578b710a2499a5e62b ]
sctp_unpack_cookie() only checked that the embedded INIT chunk length did not exceed the remaining cookie payload, but did not ensure that the INIT chunk is large enough to contain a complete INIT header.
A malformed COOKIE_ECHO can therefore carry a truncated INIT chunk whose length field is smaller than sizeof(struct sctp_init_chunk). Later, sctp_process_init() accesses INIT parameters unconditionally, which may lead to out-of-bounds reads.
In addition, raw_addr_list_len is not fully validated against the remaining cookie payload. When cookie authentication is disabled, an attacker can supply an oversized raw_addr_list_len and cause sctp_raw_to_bind_addrs() to read beyond the end of the cookie. The address parser also lacks sufficient bounds checks for parameter headers and lengths, allowing malformed address parameters to trigger out-of-bounds reads.
Fix this by:
- requiring the embedded INIT chunk length to be at least sizeof(struct sctp_init_chunk);
- validating that the INIT chunk and raw address list together fit within the cookie payload;
- verifying sufficient data exists for each address parameter header and payload before parsing it.
Note that sctp_verify_init() must be called after sctp_unpack_cookie() and before sctp_process_init() when cookie authentication is disabled. This will be addressed in a separate patch.
--- net/sctp/bind_addr.c | 11 ++++++++++- net/sctp/sm_make_chunk.c | 9 +++++++-- 2 files changed, 17 insertions(+), 3 deletions(-)
net/sctp/bind_addr.c +10 -1
@@ -275,6 +275,16 @@ int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw_addr_list, param = (struct sctp_paramhdr *)raw_addr_list; rawaddr = (union sctp_addr_param *)raw_addr_list; +if (addrs_len <sizeof (*param)) { + retval = -EINVAL ; + goto out_err; + } + len =ntohs (param->length); +if (addrs_len < len) { + retval = -EINVAL ; + goto out_err; + } + af =sctp_get_af_specific (param_type2af (param->type));if (unlikely (!af) || !af->from_addr_param (&addr, rawaddr,htons (port),0 )) {
@@ -291,7 +301,6 @@ int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw_addr_list, goto out_err; next: - len =ntohs (param->length); addrs_len -= len; raw_addr_list += len; }
net/sctp/sm_make_chunk.c +7 -2
@@ -1731,8 +1731,8 @@ struct sctp_association *sctp_unpack_cookie(struct sk_buff *skb = chunk->skb;struct sctp_cookie *bear_cookie;struct sctp_chunkhdr *ch; +unsigned int len, chlen;enum sctp_scope scope; -unsigned int len;ktime_t kt;/* Header size is static data prior to the actual cookie, including
@@ -1761,7 +1761,12 @@ struct sctp_association *sctp_unpack_cookie( bear_cookie = &cookie->c; ch = (struct sctp_chunkhdr *)(bear_cookie +1 ); -if (ntohs (ch->length) > len - fixed_size) + chlen =ntohs (ch->length); +if (chlen <sizeof (struct sctp_init_chunk )) + goto malformed; +if (chlen > len - fixed_size) + goto malformed; +if (bear_cookie->raw_addr_list_len > len - fixed_size - chlen) goto malformed;/* Verify the cookie's MAC, if cookie authentication is enabled. */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 118/325 net: guard timestamp cmsgs to real error queue skbs
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <[email protected]>
[ Upstream commit 1ee90b77b727df903033db873c75caac5c27ec98 ]
skb_is_err_queue() treats PACKET_OUTGOING as the sole marker for an skb from sk_error_queue. That assumption is not true for AF_PACKET sockets:
outgoing packet taps are also delivered to packet sockets with skb->pkt_type == PACKET_OUTGOING, but their skb->cb is owned by AF_PACKET instead of struct sock_exterr_skb.
If such an skb is received with timestamping enabled, the generic timestamp cmsg path can read AF_PACKET control-buffer state as sock_exterr_skb::opt_stats. With SO_RXQ_OVFL enabled, the packet drop counter overlaps opt_stats. An odd drop count makes the path emit SCM_TIMESTAMPING_OPT_STATS with skb->len and skb->data. For non-linear skbs this copies past the linear head and can trigger hardened usercopy or disclose adjacent heap contents.
Keep skb_is_err_queue() local to net/socket.c, but make it verify that the PACKET_OUTGOING marker is paired with the sock_rmem_free destructor installed by sock_queue_err_skb(). AF_PACKET receive skbs use normal receive ownership and no longer pass as error-queue skbs, while legitimate sk_error_queue entries keep the PACKET_OUTGOING marker and sock_rmem_free ownership.
--- include/net/sock.h | 1 + net/core/skbuff.c | 6 +++--- net/socket.c | 11 ++++++----- 3 files changed, 10 insertions(+), 8 deletions(-)
include/net/sock.h +1 -0
@@ -1818,6 +1818,7 @@ struct sk_buff *sock_omalloc(struct sock *sk, unsigned long size, gfp_t priority);void skb_orphan_partial (struct sk_buff *skb);void sock_rfree (struct sk_buff *skb); +void sock_rmem_free (struct sk_buff *skb);void sock_efree (struct sk_buff *skb);#ifdef CONFIG_INET void sock_edemux (struct sk_buff *skb);
net/core/skbuff.c +3 -3
@@ -5399,7 +5399,7 @@ int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer) }EXPORT_SYMBOL_GPL (skb_cow_data); -static void sock_rmem_free (struct sk_buff *skb) +void sock_rmem_free (struct sk_buff *skb) {struct sock *sk = skb->sk;
@@ -5408,8 +5408,8 @@ static void sock_rmem_free(struct sk_buff *skb)static void skb_set_err_queue (struct sk_buff *skb) { -/* pkt_type of skbs received on local sockets is never PACKET_OUTGOING. -* So, it is safe to (mis)use it to mark skbs on the error queue. +/* The error-queue test in skb_is_err_queue() matches this marker +* with the sock_rmem_free destructor installed by sock_queue_err_skb(). */ skb->pkt_type =PACKET_OUTGOING ;BUILD_BUG_ON (PACKET_OUTGOING ==0 );
net/socket.c +6 -5
@@ -792,12 +792,13 @@ EXPORT_SYMBOL(kernel_sendmsg);static bool skb_is_err_queue (const struct sk_buff *skb) { -/* pkt_type of skbs enqueued on the error queue are set to -* PACKET_OUTGOING in skb_set_err_queue(). This is only safe to do -* in recvmsg, since skbs received on a local socket will never -* have a pkt_type of PACKET_OUTGOING. +/* Error-queue skbs are marked as PACKET_OUTGOING in +* skb_set_err_queue() and use the destructor installed by +* sock_queue_err_skb(). PACKET_OUTGOING alone is not unique: +* AF_PACKET outgoing taps use the same pkt_type. */ -return skb->pkt_type ==PACKET_OUTGOING ; +return skb->pkt_type ==PACKET_OUTGOING && + skb->destructor == sock_rmem_free; }/* On transmit, software and hardware timestamps are returned independently.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 119/325 net/rds: fix NULL deref in rds_ib_send_cqe_handler() on masked atomic completion
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weiming Shi <[email protected]>
[ Upstream commit 34080db3e70ddf94c38512ad2331e3c3afca6cc1 ]
rds_ib_xmit_atomic() always programs a masked atomic opcode (IB_WR_MASKED_ATOMIC_CMP_AND_SWP or IB_WR_MASKED_ATOMIC_FETCH_AND_ADD) for every RDS atomic cmsg. But the completion-side switch in rds_ib_send_unmap_op() only handles the non-masked opcodes, so a masked atomic completion falls through to default and returns rm == NULL while send->s_op is left set. rds_ib_send_cqe_handler() then dereferences the NULL rm via rm->m_final_op, oopsing in softirq context. An unprivileged AF_RDS sendmsg() of an atomic cmsg over an active RDS/IB connection triggers it; on hardware that natively accepts masked atomics (mlx4, mlx5) no extra setup is needed.
RDS/IB: rds_ib_send_unmap_op: unexpected opcode 0xd in WR!
Oops: general protection fault [#1] SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000190-0x0000000000000197] RIP: rds_ib_send_cqe_handler+0x25c/0xb10 (net/rds/ib_send.c:282) Call Trace: <IRQ> rds_ib_send_cqe_handler (net/rds/ib_send.c:282) poll_scq (net/rds/ib_cm.c:274) rds_ib_tasklet_fn_send (net/rds/ib_cm.c:294) tasklet_action_common (kernel/softirq.c:943) handle_softirqs (kernel/softirq.c:573) run_ksoftirqd (kernel/softirq.c:479) </IRQ> Kernel panic - not syncing: Fatal exception in interrupt
Handle the masked atomic opcodes in the same case as the non-masked
ones: they map to the same struct rds_message.atomic union member, so the existing container_of()/rds_ib_send_unmap_atomic() body is correct for them.
--- net/rds/ib_send.c | 2 ++ 1 file changed, 2 insertions(+)
net/rds/ib_send.c +2 -0
@@ -170,6 +170,8 @@ static struct rds_message *rds_ib_send_unmap_op(struct rds_ib_connection *ic,break ;case IB_WR_ATOMIC_FETCH_AND_ADD :case IB_WR_ATOMIC_CMP_AND_SWP : +case IB_WR_MASKED_ATOMIC_FETCH_AND_ADD : +case IB_WR_MASKED_ATOMIC_CMP_AND_SWP :if (send->s_op) { rm = container_of(send->s_op, struct rds_message, atomic);rds_ib_send_unmap_atomic (ic, send->s_op, wc_status);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 120/325 tun: zero the whole vnet header in tun_put_user()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiang Mei <[email protected]>
[ Upstream commit 7f2fcff15e99bb852f6967396ed12b38376e2c8d ]
tun_put_user() declares an on-stack struct virtio_net_hdr_v1_hash_tunnel without zeroing it. For a non-tunnel skb, virtio_net_hdr_tnl_from_skb() only initializes the first 10 bytes (sizeof(struct virtio_net_hdr)), leaving bytes 10..23 (num_buffers and the hash/tunnel fields) as stack garbage.
An unprivileged user can set the vnet header size to 24 with TUNSETVNETHDRSZ, so __tun_vnet_hdr_put() copies all 24 bytes of the partially-initialized struct to userspace, leaking 14 bytes of kernel stack on every read of a non-tunnel packet.
Fix it the same way tun_get_user() already does by zeroing the whole header right after declaration.
--- drivers/net/tun.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/tun.c +1 -0
@@ -2068,6 +2068,7 @@ static ssize_t tun_put_user(struct tun_struct *tun,struct virtio_net_hdr_v1_hash_tunnel hdr;struct virtio_net_hdr *gso; +memset (&hdr,0 ,sizeof (hdr)); ret =tun_vnet_hdr_tnl_from_skb (tun->flags, tun->dev, skb, &hdr);if (ret)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 121/325 ip6_vti: fix incorrect tunnel matching in vti6_tnl_lookup()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit a5c0359f5cbc51a2e2b114d6041e0f3c73f903e9 ]
In vti6_tnl_lookup(), when an exact match for a tunnel fails, the code falls back to searching for wildcard tunnels:
- Tunnels matching the packet's local address, with any remote address wildcard remote).
- Tunnels matching the packet's remote address, with any local address (wildcard local).
However, vti6 stores all these different types of tunnels in the same hash table (ip6n->tnls_r_l) prone to hash collisions.
The bug is that the fallback search loops in vti6_tnl_lookup() were missing checks to ensure that the candidate tunnel actually has a wildcard address.
--- net/ipv6/ip6_vti.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv6/ip6_vti.c +2 -0
@@ -106,6 +106,7 @@ vti6_tnl_lookup(struct net *net, const struct in6_addr *remote, hash =HASH (&any, local);for_each_vti6_tunnel_rcu (ip6n->tnls_r_l[hash]) {if (ipv6_addr_equal (local, &t->parms.laddr) && +ipv6_addr_any (&t->parms.raddr) && (t->dev->flags &IFF_UP ))return t; }
@@ -113,6 +114,7 @@ vti6_tnl_lookup(struct net *net, const struct in6_addr *remote, hash =HASH (remote, &any);for_each_vti6_tunnel_rcu (ip6n->tnls_r_l[hash]) {if (ipv6_addr_equal (remote, &t->parms.raddr) && +ipv6_addr_any (&t->parms.laddr) && (t->dev->flags &IFF_UP ))return t; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 122/325 rds: mark snapshot pages dirty in rds_info_getsockopt()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit 512db8267b73a220a64180d95ab5eebe7c4964a8 ]
rds_info_getsockopt() pins the destination user pages with FOLL_WRITE and the RDS_INFO_* producers memcpy the snapshot into them through kmap_atomic(). Because that copy goes through the kernel direct map, the dirty bit on the user PTE is never set, so unpin_user_pages() releases the pages without marking them dirty. A file-backed destination page can then be reclaimed without writeback, silently discarding the copied data.
Use unpin_user_pages_dirty_lock() with make_dirty=true so the modified pages are marked dirty before they are unpinned.
--- net/rds/info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/rds/info.c +1 -1
@@ -235,7 +235,7 @@ int rds_info_getsockopt(struct socket *sock, int optname, char __user *optval, out:if (pages) -unpin_user_pages (pages, nr_pages); +unpin_user_pages_dirty_lock (pages, nr_pages, true);kfree (pages);return ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 123/325 spi: rzv2h-rspi: Fix SPDR read access width for 16-bit RX
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Gu <[email protected]>
[ Upstream commit 310628484ef06f95c5589374fade917a5689787b ]
The RZ/V2H hardware manual (section 7.5.2.2.1) specifies that read access size for the SPI Data Register (SPDR) are fixed at 32 bits. The RZV2H_RSPI_RX macro for the 16-bit data path used readw(), violating this requirement.
Switch to readl() for the 16-bit RX path to conform to the hardware specification.
--- drivers/spi/spi-rzv2h-rspi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spi/spi-rzv2h-rspi.c +2 -1
@@ -105,8 +105,9 @@ static inline void rzv2h_rspi_rx_##type(struct rzv2h_rspi_priv *rspi, \ RZV2H_RSPI_TX(writel, u32) RZV2H_RSPI_TX(writew, u16)RZV2H_RSPI_TX (writeb, u8) +/* The read access size for RSPI_SPDR is fixed at 32 bits */ RZV2H_RSPI_RX(readl, u32) -RZV2H_RSPI_RX(readw, u16) +RZV2H_RSPI_RX(readl, u16) RZV2H_RSPI_RX(readl, u8) static void rzv2h_rspi_reg_rmw(const struct rzv2h_rspi_priv *rspi,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 124/325 netfilter: revalidate bridge ports
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit ccb9fd4b87538ccf19ccff78ee26700526d94867 ]
ebt_redirect_tg() dereferences br_port_get_rcu() return without a NULL check, causing a kernel panic when the bridge port has been removed between the original hook invocation and an NFQUEUE reinject.
A mere NULL check isn't sufficient, however. As sashiko review points out userspace can not only remove the port from the bridge, it could also place the device in a different virtual device, e.g. macvlan.
If this happens, we must drop the packet, there is no way for us to reinject it into the bridge path.
Switch to _upper API, we don't need the bridge port structure. Also, this fix keeps another bug intact:
Both nfnetlink_log and nfnetlink_queue use CONFIG_BRIDGE_NETFILTER too aggressive, which prevents certain logging features when queueing in bridge family: NETFILTER_FAMILY_BRIDGE can be enabled while the old CONFIG_BRIDGE_NETFILTER cruft is off.
Fixes tag is a common ancestor, this was always broken.
--- net/bridge/netfilter/ebt_dnat.c | 4 +- net/bridge/netfilter/ebt_redirect.c | 16 +++++--- net/netfilter/nfnetlink_log.c | 23 +++++++++-- net/netfilter/nfnetlink_queue.c | 64 +++++++++++++++++++++++++---- 4 files changed, 89 insertions(+), 18 deletions(-)
net/bridge/netfilter/ebt_dnat.c +3 -1
@@ -39,7 +39,9 @@ ebt_dnat_tg(struct sk_buff *skb, const struct xt_action_param *par) dev =xt_in (par);break ;case NF_BR_PRE_ROUTING : - dev =br_port_get_rcu (xt_in (par))->br->dev; + dev =netdev_master_upper_dev_get_rcu (xt_in (par)); +if (!dev)/* bridge port removed? */ +return EBT_DROP ;break ;default : dev =NULL ;
net/bridge/netfilter/ebt_redirect.c +11 -5
@@ -24,12 +24,18 @@ ebt_redirect_tg(struct sk_buff *skb, const struct xt_action_param *par)if (skb_ensure_writable (skb,0 ))return EBT_DROP ; -if (xt_hooknum (par) !=NF_BR_BROUTING ) -/* rcu_read_lock()ed by nf_hook_thresh */ -ether_addr_copy (eth_hdr (skb)->h_dest, -br_port_get_rcu (xt_in (par))->br->dev->dev_addr); -else +if (xt_hooknum (par) !=NF_BR_BROUTING ) { +const struct net_device *dev; + + dev =netdev_master_upper_dev_get_rcu (xt_in (par)); +if (!dev) +return EBT_DROP ; + +ether_addr_copy (eth_hdr (skb)->h_dest, dev->dev_addr); + }else {ether_addr_copy (eth_hdr (skb)->h_dest,xt_in (par)->dev_addr); + } + skb->pkt_type =PACKET_HOST ;return info->target; }
net/netfilter/nfnetlink_log.c +19 -4
@@ -450,6 +450,23 @@ static int nfulnl_put_bridge(struct nfulnl_instance *inst, const struct sk_buffreturn -1 ; } +#if IS_ENABLED (CONFIG_BRIDGE_NETFILTER ) +static int nflog_put_master_ifindex (struct sk_buff *nlskb,int attr, +const struct net_device *dev) +{ +const struct net_device *upper; + +if (dev && !netif_is_bridge_port (dev)) +return 0 ; + + upper =netdev_master_upper_dev_get_rcu ((struct net_device *)dev); +if (upper &&nla_put_be32 (nlskb, attr,htonl (upper->ifindex))) +return -EMSGSIZE ; + +return 0 ; +} +#endif +/* This is an inline function, we don't really care about a long * list of arguments */ static inline int
@@ -504,8 +521,7 @@ __build_packet_message(struct nfnl_log_net *log,/* rcu_read_lock()ed by nf_hook_thresh or * nf_log_packet. */ - nla_put_be32(inst->skb, NFULA_IFINDEX_INDEV, - htonl(br_port_get_rcu(indev)->br->dev->ifindex))) + nflog_put_master_ifindex(inst->skb, NFULA_IFINDEX_INDEV, indev)) goto nla_put_failure; }else {int physinif;
@@ -541,8 +557,7 @@ __build_packet_message(struct nfnl_log_net *log,/* rcu_read_lock()ed by nf_hook_thresh or * nf_log_packet. */ - nla_put_be32(inst->skb, NFULA_IFINDEX_OUTDEV, - htonl(br_port_get_rcu(outdev)->br->dev->ifindex))) + nflog_put_master_ifindex(inst->skb, NFULA_IFINDEX_OUTDEV, outdev)) goto nla_put_failure; }else {struct net_device *physoutdev;
net/netfilter/nfnetlink_queue.c +56 -8
92 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 125/325 netfilter: nf_conntrack: destroy stale expectfn expectations on unregister
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weiming Shi <[email protected]>
[ Upstream commit c3009418f9fa1dcb3eb86f4d8c92583537b5faa3 ]
NAT helpers such as nf_nat_h323 store a raw pointer to module text in exp->expectfn (e.g. ip_nat_q931_expect). nf_ct_helper_expectfn_unregister() only unlinks the callback descriptor and never walks the expectation table, so an expectation pending at module removal survives with a dangling exp->expectfn into freed module text.
When the expected connection arrives, init_conntrack() invokes exp->expectfn(), now a stale pointer into the unloaded module. Reproduced on a KASAN build by loading the H.323 helpers, creating a Q.931 expectation, unloading nf_nat_h323, then connecting to the expected port:
Oops: int3: 0000 [#1] SMP KASAN NOPTI RIP: 0010:0xffffffffa06102d1 init_conntrack.isra.0 (net/netfilter/nf_conntrack_core.c:1862) nf_conntrack_in (net/netfilter/nf_conntrack_core.c:2049) ipv4_conntrack_local (net/netfilter/nf_conntrack_proto.c:223) nf_hook_slow (net/netfilter/core.c:619) __ip_local_out (net/ipv4/ip_output.c:120) __tcp_transmit_skb (net/ipv4/tcp_output.c:1715) tcp_connect (net/ipv4/tcp_output.c:4374) tcp_v4_connect (net/ipv4/tcp_ipv4.c:345) __sys_connect (net/socket.c:2167) Modules linked in: nf_conntrack_h323 [last unloaded: nf_nat_h323]
Reaching the dangling state requires CAP_SYS_MODULE in the initial user namespace to remove a NAT helper that still has live expectations, so this is a robustness fix; leaving an expectation pointing at freed text is wrong regardless.
Add nf_ct_helper_expectfn_destroy(), which walks the expectation table and drops every expectation whose ->expectfn matches the descriptor being torn down. Call it from each NAT helper's exit path after the existing RCU grace period, so no expectation outlives the code it points at and no extra synchronize_rcu() is introduced. With the fix, the same reproducer runs to completion without the Oops.
--- include/net/netfilter/nf_conntrack_helper.h | 1 + net/ipv4/netfilter/nf_nat_h323.c | 2 ++ net/netfilter/nf_conntrack_helper.c | 19 +++++++++++++++++++ net/netfilter/nf_nat_core.c | 2 ++ net/netfilter/nf_nat_sip.c | 1 + 5 files changed, 25 insertions(+)
include/net/netfilter/nf_conntrack_helper.h +1 -0
@@ -155,6 +155,7 @@ void nf_ct_helper_log(struct sk_buff *skb, const struct nf_conn *ct,void nf_ct_helper_expectfn_register (struct nf_ct_helper_expectfn *n);void nf_ct_helper_expectfn_unregister (struct nf_ct_helper_expectfn *n); +void nf_ct_helper_expectfn_destroy (const struct nf_ct_helper_expectfn *n);struct nf_ct_helper_expectfn *nf_ct_helper_expectfn_find_by_name (const char *name); struct nf_ct_helper_expectfn *
net/ipv4/netfilter/nf_nat_h323.c +2 -0
@@ -555,6 +555,8 @@ static void __exit nf_nat_h323_fini(void)nf_ct_helper_expectfn_unregister (&q931_nat);nf_ct_helper_expectfn_unregister (&callforwarding_nat);synchronize_rcu (); +nf_ct_helper_expectfn_destroy (&q931_nat); +nf_ct_helper_expectfn_destroy (&callforwarding_nat); }/****************************************************************************/
net/netfilter/nf_conntrack_helper.c +19 -0
@@ -283,6 +283,25 @@ void nf_ct_helper_expectfn_unregister(struct nf_ct_helper_expectfn *n) }EXPORT_SYMBOL_GPL (nf_ct_helper_expectfn_unregister); +static bool expect_iter_expectfn (struct nf_conntrack_expect *exp,void *data) +{ +const struct nf_ct_helper_expectfn *n = data; + +/* Relies on registered expectfn descriptors having unique ->expectfn +* pointers, which holds for the in-tree NAT helpers. +*/ +return exp->expectfn == n->expectfn; +} + +/* Destroy expectations still pointing at @n->expectfn; call after the +* caller's RCU grace period so none outlives the (often modular) callback. +*/ +void nf_ct_helper_expectfn_destroy (const struct nf_ct_helper_expectfn *n) +{ +nf_ct_expect_iterate_destroy (expect_iter_expectfn, (void *)n); +} +EXPORT_SYMBOL_GPL (nf_ct_helper_expectfn_destroy); +/* Caller should hold the rcu lock */ struct nf_ct_helper_expectfn *nf_ct_helper_expectfn_find_by_name (const char *name)
net/netfilter/nf_nat_core.c +2 -0
@@ -1347,6 +1347,7 @@ static int __init nf_nat_init(void)RCU_INIT_POINTER (nf_nat_hook,NULL );nf_ct_helper_expectfn_unregister (&follow_master_nat);synchronize_net (); +nf_ct_helper_expectfn_destroy (&follow_master_nat);unregister_pernet_subsys (&nat_net_ops);kvfree (nf_nat_bysource); }
@@ -1364,6 +1365,7 @@ static void __exit nf_nat_cleanup(void)RCU_INIT_POINTER (nf_nat_hook,NULL );synchronize_net (); +nf_ct_helper_expectfn_destroy (&follow_master_nat);kvfree (nf_nat_bysource);unregister_pernet_subsys (&nat_net_ops); }
net/netfilter/nf_nat_sip.c +1 -0
@@ -655,6 +655,7 @@ static void __exit nf_nat_sip_fini(void)RCU_INIT_POINTER (nf_nat_sip_hooks,NULL );nf_ct_helper_expectfn_unregister (&sip_nat);synchronize_rcu (); +nf_ct_helper_expectfn_destroy (&sip_nat); }static const struct nf_nat_sip_hooks sip_hooks = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 126/325 netfilter: x_tables: avoid leaking percpu counter pointers
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <[email protected]>
[ Upstream commit f7f2fbb0e893a0238dc464f8d8c0f5609bec584f ]
The native and compat get-entries paths copy the fixed rule entry header from the kernelized rule blob to userspace before overwriting the entry's counter fields with a sanitized counter snapshot.
On SMP kernels, entry->counters.pcnt contains the percpu allocation address used by x_tables rule counters. A caller can provide a userspace buffer that faults during the initial fixed-header copy after pcnt has been copied but before the later sanitized counter copy runs. The syscall then returns -EFAULT while leaving the raw percpu pointer in userspace.
Copy only the fixed entry prefix before counters from the kernelized rule blob, then copy the sanitized counter snapshot into the counter field. Apply this ordering to the IPv4, IPv6, and ARP native and compat get-entries implementations so a fault cannot expose the internal percpu counter pointer.
--- net/ipv4/netfilter/arp_tables.c | 15 ++++++--------- net/ipv4/netfilter/ip_tables.c | 15 ++++++--------- net/ipv6/netfilter/ip6_tables.c | 15 ++++++--------- 3 files changed, 18 insertions(+), 27 deletions(-)
net/ipv4/netfilter/arp_tables.c +6 -9
@@ -702,14 +702,12 @@ static int copy_entries_to_user(unsigned int total_size,const struct xt_entry_target *t; e = loc_cpu_entry + off; -if (copy_to_user (userptr + off, e,sizeof (*e))) { - ret = -EFAULT ; - goto free_counters; - } -if (copy_to_user (userptr + off +if (copy_to_user (userptr + off, e, + offsetof(struct arpt_entry , counters)) || +copy_to_user (userptr + off + offsetof(struct arpt_entry , counters), &counters[num], -sizeof (counters[num])) !=0 ) { +sizeof (counters[num]))) { ret = -EFAULT ; goto free_counters; }
@@ -1327,9 +1325,8 @@ static int compat_copy_entry_to_user(struct arpt_entry *e, void __user **dstptr, origsize = *size; ce = *dstptr; -if (copy_to_user (ce, e,sizeof (struct arpt_entry )) !=0 || -copy_to_user (&ce->counters, &counters[i], -sizeof (counters[i])) !=0 ) +if (copy_to_user (ce, e, offsetof(struct compat_arpt_entry , counters)) || +copy_to_user (&ce->counters, &counters[i],sizeof (counters[i])))return -EFAULT ; *dstptr +=sizeof (struct compat_arpt_entry );
net/ipv4/netfilter/ip_tables.c +6 -9
@@ -832,14 +832,12 @@ copy_entries_to_user(unsigned int total_size,const struct xt_entry_target *t; e = loc_cpu_entry + off; -if (copy_to_user (userptr + off, e,sizeof (*e))) { - ret = -EFAULT ; - goto free_counters; - } -if (copy_to_user (userptr + off +if (copy_to_user (userptr + off, e, + offsetof(struct ipt_entry , counters)) || +copy_to_user (userptr + off + offsetof(struct ipt_entry , counters), &counters[num], -sizeof (counters[num])) !=0 ) { +sizeof (counters[num]))) { ret = -EFAULT ; goto free_counters; }
@@ -1228,9 +1226,8 @@ compat_copy_entry_to_user(struct ipt_entry *e, void __user **dstptr, origsize = *size; ce = *dstptr; -if (copy_to_user (ce, e,sizeof (struct ipt_entry )) !=0 || -copy_to_user (&ce->counters, &counters[i], -sizeof (counters[i])) !=0 ) +if (copy_to_user (ce, e, offsetof(struct compat_ipt_entry , counters)) || +copy_to_user (&ce->counters, &counters[i],sizeof (counters[i])))return -EFAULT ; *dstptr +=sizeof (struct compat_ipt_entry );
net/ipv6/netfilter/ip6_tables.c +6 -9
@@ -848,14 +848,12 @@ copy_entries_to_user(unsigned int total_size,const struct xt_entry_target *t; e = loc_cpu_entry + off; -if (copy_to_user (userptr + off, e,sizeof (*e))) { - ret = -EFAULT ; - goto free_counters; - } -if (copy_to_user (userptr + off +if (copy_to_user (userptr + off, e, + offsetof(struct ip6t_entry , counters)) || +copy_to_user (userptr + off + offsetof(struct ip6t_entry , counters), &counters[num], -sizeof (counters[num])) !=0 ) { +sizeof (counters[num]))) { ret = -EFAULT ; goto free_counters; }
@@ -1244,9 +1242,8 @@ compat_copy_entry_to_user(struct ip6t_entry *e, void __user **dstptr, origsize = *size; ce = *dstptr; -if (copy_to_user (ce, e,sizeof (struct ip6t_entry )) !=0 || -copy_to_user (&ce->counters, &counters[i], -sizeof (counters[i])) !=0 ) +if (copy_to_user (ce, e, offsetof(struct compat_ip6t_entry , counters)) || +copy_to_user (&ce->counters, &counters[i],sizeof (counters[i])))return -EFAULT ; *dstptr +=sizeof (struct compat_ip6t_entry );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 127/325 netfilter: nf_log: validate MAC header was set before dumping it
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiang Mei <[email protected]>
[ Upstream commit a84b6fedbc97078788be78dbdd7517d143ad1a77 ]
The fallback path of dump_mac_header() guards the MAC header access only with "skb->mac_header != skb->network_header", without checking skb_mac_header_was_set(). When the MAC header is unset, mac_header is 0xffff, so the test passes and skb_mac_header(skb) returns skb->head + 0xffff, ~64 KiB past the buffer; the loop then reads dev->hard_header_len bytes out of bounds into the kernel log.
This is reachable via the netdev logger: nf_log_unknown_packet() calls dump_mac_header() unconditionally, and an skb sent through AF_PACKET with PACKET_QDISC_BYPASS reaches the egress hook with mac_header still unset (__dev_queue_xmit(), which would reset it, is bypassed).
Add the skb_mac_header_was_set() check the ARPHRD_ETHER path already uses, and replace the open-coded MAC header length test with skb_mac_header_len(). Only skbs with an unset MAC header are affected; valid ones are dumped as before.
BUG: KASAN: slab-out-of-bounds in dump_mac_header (net/netfilter/nf_log_syslog.c:831) Read of size 1 at addr ffff88800ea49d3f by task exploit/148 Call Trace: kasan_report (mm/kasan/report.c:595) dump_mac_header (net/netfilter/nf_log_syslog.c:831) nf_log_netdev_packet (net/netfilter/nf_log_syslog.c:938 net/netfilter/nf_log_syslog.c:963) nf_log_packet (net/netfilter/nf_log.c:260) nft_log_eval (net/netfilter/nft_log.c:60) nft_do_chain (net/netfilter/nf_tables_core.c:285) nft_do_chain_netdev (net/netfilter/nft_chain_filter.c:307) nf_hook_slow (net/netfilter/core.c:619) nf_hook_direct_egress (net/packet/af_packet.c:257) packet_xmit (net/packet/af_packet.c:280) packet_sendmsg (net/packet/af_packet.c:3114) __sys_sendto (net/socket.c:2265)
--- net/netfilter/nf_log_syslog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nf_log_syslog.c +2 -2
@@ -801,8 +801,8 @@ static void dump_mac_header(struct nf_log_buf *m, fallback:nf_log_buf_add (m,"MAC=" ); -if (dev->hard_header_len && - skb->mac_header != skb->network_header) { +if (dev->hard_header_len &&skb_mac_header_was_set (skb) && +skb_mac_header_len (skb) !=0 ) {const unsigned char *p =skb_mac_header (skb);unsigned int i;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 128/325 netfilter: nft_exthdr: fix register tracking for F_PRESENT flag
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit 772cecf198da732faebb5dcfc46d66a505be8495 ]
nft_exthdr_init() passes user-controlled priv->len to nft_parse_register_store(), which marks that many bytes in the register bitmap as initialized. However, when NFT_EXTHDR_F_PRESENT is set, the eval paths write only 1 byte (nft_reg_store8) or 4 bytes (*dest = 0 on TCP/DCCP error path). When len > 4, registers beyond the first are never written, retaining uninitialized stack data from nft_regs.
Bail out if userspace requests too much data when F_PRESENT is set.
--- net/netfilter/nft_exthdr.c | 3 +++ 1 file changed, 3 insertions(+)
net/netfilter/nft_exthdr.c +3 -0
@@ -532,6 +532,9 @@ static int nft_exthdr_init(const struct nft_ctx *ctx,return err; } +if ((flags &NFT_EXTHDR_F_PRESENT ) && len !=1 ) +return -EINVAL ; + priv->type =nla_get_u8 (tb[NFTA_EXTHDR_TYPE ]); priv->offset = offset; priv->len = len;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 129/325 net: mvpp2: sync RX data at the hardware packet offset
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Til Kaiser <[email protected]>
[ Upstream commit 180235600934bef6add3be637c296d6cf3272e67 ]
mvpp2 programs the RX queue packet offset, so hardware writes received data at dma_addr + MVPP2_SKB_HEADROOM. The current CPU sync starts at dma_addr and only covers rx_bytes + MVPP2_MH_SIZE bytes, which syncs the unused headroom and misses the same number of bytes at the packet tail.
On non-coherent DMA systems this can leave the CPU reading stale cache contents for the end of the received frame.
Use dma_sync_single_range_for_cpu() with MVPP2_SKB_HEADROOM as the range offset so the sync covers the Marvell header and packet data actually written by hardware.
--- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +4 -3
@@ -3948,9 +3948,10 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi, dma_dir =DMA_FROM_DEVICE ; } -dma_sync_single_for_cpu (dev->dev.parent, dma_addr, - rx_bytes +MVPP2_MH_SIZE , - dma_dir); +dma_sync_single_range_for_cpu (dev->dev.parent, dma_addr, +MVPP2_SKB_HEADROOM , + rx_bytes +MVPP2_MH_SIZE , + dma_dir);/* Buffer header not supported */ if (rx_status &MVPP2_RXD_BUF_HDR )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 130/325 net: mvpp2: limit XDP frame size to the RX buffer
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Til Kaiser <[email protected]>
[ Upstream commit f3c6aa078927e6fe8121c9c591ddee8716c5305a ]
mvpp2 has short and long BM pools, and short pool buffers can be smaller than PAGE_SIZE. The XDP path nevertheless initializes every xdp_buff with PAGE_SIZE as frame size.
XDP helpers use frame_sz to validate tail growth and to derive the hard end of the data area. Advertising PAGE_SIZE for short buffers can let bpf_xdp_adjust_tail() grow a packet past the real allocation, corrupting memory or later tripping skb tailroom checks.
Initialize the XDP buffer with bm_pool->frag_size so XDP tailroom matches the actual buffer backing the packet.
--- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +1 -1
@@ -3981,7 +3981,7 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,else xdp_rxq = &rxq->xdp_rxq_long; -xdp_init_buff (&xdp,PAGE_SIZE , xdp_rxq); +xdp_init_buff (&xdp, bm_pool->frag_size, xdp_rxq);xdp_prepare_buff (&xdp, data,MVPP2_MH_SIZE +MVPP2_SKB_HEADROOM , rx_bytes, true);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 131/325 net: mvpp2: refill RX buffers before XDP or skb use
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Til Kaiser <[email protected]>
[ Upstream commit 5e8e2a9624df72fca7c736b2966b2cbf6c9c3ff6 ]
The RX error path returns the current descriptor buffer to the hardware BM pool. That is only valid while the driver still owns the buffer.
mvpp2_rx_refill() can fail after the current buffer has been handed to XDP or attached to an skb. In those cases mvpp2_run_xdp() may have recycled, redirected, or queued the page for XDP_TX, and an skb free also retires the data buffer. Returning such a buffer to BM lets hardware DMA into memory that is no longer owned by the RX ring.
Refill the BM pool before handing the current buffer to XDP or to the skb. If the allocation fails there, drop the packet and return the still-owned current buffer to BM, preserving the pool depth. Once the refill succeeds, later local drops retire/free the current buffer instead of returning it to BM.
Stable-dep-of: 77a6b90ce56b ("net: mvpp2: build skb from XDP-adjusted data on XDP_PASS")
--- .../net/ethernet/marvell/mvpp2/mvpp2_main.c | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +24 -19
@@ -3973,6 +3973,12 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,else frag_size = bm_pool->frag_size; + err =mvpp2_rx_refill (port, bm_pool, pp, pool); +if (err) { +netdev_err (port->dev,"failed to refill BM pools\n" ); + goto err_drop_frame; + } +if (xdp_prog) {struct xdp_rxq_info *xdp_rxq;
@@ -3990,12 +3996,6 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,if (ret) { xdp_ret |= ret; - err =mvpp2_rx_refill (port, bm_pool, pp, pool); -if (err) { -netdev_err (port->dev,"failed to refill BM pools\n" ); - goto err_drop_frame; - } - ps.rx_packets++; ps.rx_bytes += rx_bytes;continue ;
@@ -4010,8 +4010,21 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi, skb =slab_build_skb (data);if (!skb) {netdev_warn (port->dev,"skb build failed\n" ); - goto err_drop_frame; +if (pp) { +page_pool_put_page (pp,virt_to_head_page (data), + rx_bytes +MVPP2_MH_SIZE , + true); + }else { +dma_unmap_single_attrs (dev->dev.parent, dma_addr, + bm_pool->buf_size, +DMA_FROM_DEVICE , +DMA_ATTR_SKIP_CPU_SYNC ); +mvpp2_frag_free (bm_pool, pp, data); + } + goto err_drop_frame_retired; } +if (pp) +skb_mark_for_recycle (skb);/* If we have RX hardware timestamping enabled, grab the * timestamp from the queue and convert.
@@ -4022,16 +4035,7 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi, skb_hwtstamps(skb)); } - err =mvpp2_rx_refill (port, bm_pool, pp, pool); -if (err) { -netdev_err (port->dev,"failed to refill BM pools\n" ); -dev_kfree_skb_any (skb); - goto err_drop_frame; - } - -if (pp) -skb_mark_for_recycle (skb); -else +if (!pp)dma_unmap_single_attrs (dev->dev.parent, dma_addr, bm_pool->buf_size,DMA_FROM_DEVICE ,DMA_ATTR_SKIP_CPU_SYNC );
@@ -4050,13 +4054,14 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,continue ; err_drop_frame: - dev->stats.rx_errors++; -mvpp2_rx_error (port, rx_desc);/* Return the buffer to the pool */ if (rx_status &MVPP2_RXD_BUF_HDR )mvpp2_buff_hdr_pool_put (port, rx_desc, pool, rx_status);else mvpp2_bm_pool_put (port, pool, dma_addr, phys_addr); +err_drop_frame_retired: + dev->stats.rx_errors++; +mvpp2_rx_error (port, rx_desc); }if (xdp_ret &MVPP2_XDP_REDIR )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 132/325 net: mvpp2: build skb from XDP-adjusted data on XDP_PASS
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Til Kaiser <[email protected]>
[ Upstream commit 77a6b90ce56bc982dcfa94229b8e28e6abb16e95 ]
When an XDP program uses bpf_xdp_adjust_head() or bpf_xdp_adjust_tail() and then returns XDP_PASS, mvpp2 still builds the skb from fixed offsets derived from the original RX descriptor. Packet geometry changes made by the XDP program are therefore discarded before the skb reaches the stack.
Update rx_offset and rx_bytes from xdp.data and xdp.data_end for XDP_PASS. This makes skb_reserve() and skb_put() reflect the packet seen by XDP, and makes RX byte accounting for XDP_PASS follow the length of the skb passed to the network stack.
Keep a separate rx_sync_size for page-pool recycling on skb allocation failure, which must stay tied to the received buffer range.
Non-PASS verdicts continue to account the descriptor length because no skb is passed up in those cases.
--- .../net/ethernet/marvell/mvpp2/mvpp2_main.c | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +15 -6
@@ -3919,10 +3919,10 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,struct mvpp2_bm_pool *bm_pool;struct page_pool *pp =NULL ;struct sk_buff *skb; -unsigned int frag_size; +unsigned int frag_size, rx_sync_size;dma_addr_t dma_addr;phys_addr_t phys_addr; -int pool, rx_bytes, err, ret; +int pool, rx_bytes, rx_offset, err, ret;struct page *page;void *data;
@@ -3935,6 +3935,8 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi, rx_status =mvpp2_rxdesc_status_get (port, rx_desc); rx_bytes =mvpp2_rxdesc_size_get (port, rx_desc); rx_bytes -=MVPP2_MH_SIZE ; + rx_sync_size = rx_bytes +MVPP2_MH_SIZE ; + rx_offset =MVPP2_MH_SIZE +MVPP2_SKB_HEADROOM ; dma_addr =mvpp2_rxdesc_dma_addr_get (port, rx_desc); pool = (rx_status & MVPP2_RXD_BM_POOL_ID_MASK) >>
@@ -3950,7 +3952,7 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,dma_sync_single_range_for_cpu (dev->dev.parent, dma_addr,MVPP2_SKB_HEADROOM , - rx_bytes +MVPP2_MH_SIZE , + rx_sync_size, dma_dir);/* Buffer header not supported */
@@ -4001,6 +4003,14 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,continue ; } + rx_sync_size = max_t(unsigned int, rx_sync_size, + xdp.data_end - xdp.data_hard_start - +MVPP2_SKB_HEADROOM ); + +/* Update offset and length to reflect any XDP adjustments. */ + rx_offset = xdp.data - data; + rx_bytes = xdp.data_end - xdp.data; + metasize = xdp.data - xdp.data_meta; }
@@ -4012,8 +4022,7 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,netdev_warn (port->dev,"skb build failed\n" );if (pp) {page_pool_put_page (pp,virt_to_head_page (data), - rx_bytes +MVPP2_MH_SIZE , - true); + rx_sync_size, true); }else { dma_unmap_single_attrs(dev->dev.parent, dma_addr, bm_pool->buf_size,
@@ -4043,7 +4052,7 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi, ps.rx_packets++; ps.rx_bytes += rx_bytes; -skb_reserve (skb,MVPP2_MH_SIZE +MVPP2_SKB_HEADROOM ); +skb_reserve (skb, rx_offset);skb_put (skb, rx_bytes);if (metasize)skb_metadata_set (skb, metasize);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 133/325 net: txgbe: optimize the flow to setup PHY for AML devices
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiawen Wu <[email protected]>
[ Upstream commit 1f863ce5c71276710a7689c88bf4003fa5173998 ]
To adapt to new firmware for AML devices, the driver should send the "SET_LINK_CMD" to the firmware only once when switching PHY interface mode, and no longer needs to re-trigger PHY configuration based on the RX signal interrupt (TXGBE_GPIOBIT_3).
In previous firmware versions, the PHY was configured only after receiving "SET_LINK_CMD", and might remain incomplete if the RX signal was lost. To handle this case, the driver used TXGBE_GPIOBIT_3 interrupt to resend the command. This workaround is no longer necessary with the new firmware.
And the unknown link speed is permitted in the mailbox buffer.
Stable-dep-of: 0487cfca4651 ("net: txgbe: initialize module info buffer")
--- drivers/net/ethernet/wangxun/libwx/wx_type.h | 2 - .../net/ethernet/wangxun/txgbe/txgbe_aml.c | 50 ++++++------------- .../net/ethernet/wangxun/txgbe/txgbe_type.h | 1 + 3 files changed, 15 insertions(+), 38 deletions(-)
drivers/net/ethernet/wangxun/libwx/wx_type.h +0 -2
@@ -1271,8 +1271,6 @@ struct wx {/* PHY stuff */ bool notify_down; -int adv_speed; -int adv_duplex;unsigned int link;int speed;int duplex;
drivers/net/ethernet/wangxun/txgbe/txgbe_aml.c +14 -36
95 lines not on this page · raw message
drivers/net/ethernet/wangxun/txgbe/txgbe_type.h +1 -0
@@ -314,6 +314,7 @@ void txgbe_up(struct wx *wx);int txgbe_setup_tc (struct net_device *dev,u8 tc);void txgbe_do_reset (struct net_device *netdev); +#define TXGBE_LINK_SPEED_UNKNOWN 0#define TXGBE_LINK_SPEED_10GB_FULL 4#define TXGBE_LINK_SPEED_25GB_FULL 0x10
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 134/325 net: txgbe: support CR modules for AML devices
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiawen Wu <[email protected]>
[ Upstream commit 354d128aa7212c53ffc7127877953264a445f5af ]
Support to identify 25G/10G CR modules for AML devices. Autoneg is enbaled by default in CR mode.
Stable-dep-of: 0487cfca4651 ("net: txgbe: initialize module info buffer")
--- .../net/ethernet/wangxun/txgbe/txgbe_aml.c | 59 +++++++++++++------ .../ethernet/wangxun/txgbe/txgbe_ethtool.c | 3 +- 2 files changed, 44 insertions(+), 18 deletions(-)
drivers/net/ethernet/wangxun/txgbe/txgbe_aml.c +42 -17
@@ -104,7 +104,8 @@ static int txgbe_set_phy_link_hostif(struct wx *wx, int speed, int autoneg, int WX_HI_COMMAND_TIMEOUT, false); } -static void txgbe_get_link_capabilities (struct wx *wx,int *speed,int *duplex) +static void txgbe_get_link_capabilities (struct wx *wx,int *speed, +int *autoneg,int *duplex) {struct txgbe *txgbe = wx->priv;
@@ -115,6 +116,7 @@ static void txgbe_get_link_capabilities(struct wx *wx, int *speed, int *duplex)else *speed =SPEED_UNKNOWN ; + *autoneg =phylink_test (txgbe->advertising, Autoneg); *duplex = *speed ==SPEED_UNKNOWN ?DUPLEX_HALF :DUPLEX_FULL ; }
@@ -135,11 +137,11 @@ static void txgbe_get_phy_link(struct wx *wx, int *speed)int txgbe_set_phy_link (struct wx *wx) { -int speed, duplex, err; +int speed, autoneg, duplex, err; -txgbe_get_link_capabilities (wx, &speed, &duplex); +txgbe_get_link_capabilities (wx, &speed, &autoneg, &duplex); - err =txgbe_set_phy_link_hostif (wx, speed,0 , duplex); + err =txgbe_set_phy_link_hostif (wx, speed, autoneg, duplex);if (err) {wx_err (wx,"Failed to setup link\n" );return err;
@@ -154,19 +156,43 @@ static int txgbe_sfp_to_linkmodes(struct wx *wx, struct txgbe_sfp_id *id)DECLARE_PHY_INTERFACE_MASK (interfaces);struct txgbe *txgbe = wx->priv; -if (id->com_25g_code & (TXGBE_SFF_25GBASESR_CAPABLE | -TXGBE_SFF_25GBASEER_CAPABLE | -TXGBE_SFF_25GBASELR_CAPABLE )) { - phylink_set(modes, 25000baseSR_Full); +if (id->cable_tech &TXGBE_SFF_DA_PASSIVE_CABLE ) { + txgbe->link_port =PORT_DA ; +phylink_set (modes, Autoneg); +if (id->com_25g_code ==TXGBE_SFF_25GBASECR_91FEC || + id->com_25g_code ==TXGBE_SFF_25GBASECR_74FEC || + id->com_25g_code ==TXGBE_SFF_25GBASECR_NOFEC ) { + phylink_set(modes, 25000baseCR_Full); + phylink_set(modes, 10000baseCR_Full); +__set_bit (PHY_INTERFACE_MODE_25GBASER , interfaces); +__set_bit (PHY_INTERFACE_MODE_10GBASER , interfaces); + }else { + phylink_set(modes, 10000baseCR_Full); +__set_bit (PHY_INTERFACE_MODE_10GBASER , interfaces); + } + }else if (id->cable_tech &TXGBE_SFF_DA_ACTIVE_CABLE ) { + txgbe->link_port =PORT_DA ; +phylink_set (modes, Autoneg); + phylink_set(modes, 25000baseCR_Full);__set_bit (PHY_INTERFACE_MODE_25GBASER , interfaces); - } -if (id->com_10g_code &TXGBE_SFF_10GBASESR_CAPABLE ) { - phylink_set(modes, 10000baseSR_Full); -__set_bit (PHY_INTERFACE_MODE_10GBASER , interfaces); - } -if (id->com_10g_code &TXGBE_SFF_10GBASELR_CAPABLE ) { - phylink_set(modes, 10000baseLR_Full); -__set_bit (PHY_INTERFACE_MODE_10GBASER , interfaces); + }else { +if (id->com_25g_code ==TXGBE_SFF_25GBASESR_CAPABLE || + id->com_25g_code ==TXGBE_SFF_25GBASEER_CAPABLE || + id->com_25g_code ==TXGBE_SFF_25GBASELR_CAPABLE ) { + txgbe->link_port =PORT_FIBRE ; + phylink_set(modes, 25000baseSR_Full); +__set_bit (PHY_INTERFACE_MODE_25GBASER , interfaces); + } +if (id->com_10g_code &TXGBE_SFF_10GBASESR_CAPABLE ) { + txgbe->link_port =PORT_FIBRE ; + phylink_set(modes, 10000baseSR_Full); +__set_bit (PHY_INTERFACE_MODE_10GBASER , interfaces); + } +if (id->com_10g_code &TXGBE_SFF_10GBASELR_CAPABLE ) { + txgbe->link_port =PORT_FIBRE ; + phylink_set(modes, 10000baseLR_Full); +__set_bit (PHY_INTERFACE_MODE_10GBASER , interfaces); + } }if (phy_interface_empty (interfaces)) {
@@ -177,7 +203,6 @@ static int txgbe_sfp_to_linkmodes(struct wx *wx, struct txgbe_sfp_id *id)phylink_set (modes, Pause);phylink_set (modes, Asym_Pause);phylink_set (modes,FIBRE ); - txgbe->link_port =PORT_FIBRE ;if (!linkmode_equal (txgbe->sfp_support, modes)) {linkmode_copy (txgbe->sfp_support, modes);
drivers/net/ethernet/wangxun/txgbe/txgbe_ethtool.c +2 -1
@@ -30,7 +30,8 @@ int txgbe_get_link_ksettings(struct net_device *netdev,return 0 ; cmd->base.port = txgbe->link_port; - cmd->base.autoneg =AUTONEG_DISABLE ; + cmd->base.autoneg =phylink_test (txgbe->advertising, Autoneg) ? +AUTONEG_ENABLE :AUTONEG_DISABLE ;linkmode_copy (cmd->link_modes.supported, txgbe->sfp_support);linkmode_copy (cmd->link_modes.advertising, txgbe->advertising);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 135/325 net: txgbe: rename the SFP related
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiawen Wu <[email protected]>
[ Upstream commit dbba6b7a47cba914d48890da7233a64c7b9f3ccc ]
QSFP supported will be introduced for AML 40G devices, the code related to identify various modules should be renamed to more appropriate names.
And struct txgbe_hic_i2c_read used to get module information is renamed as struct txgbe_hic_get_module_info, because another SW-FW command to read I2C will be added later.
Stable-dep-of: 0487cfca4651 ("net: txgbe: initialize module info buffer")
--- drivers/net/ethernet/wangxun/libwx/wx_type.h | 2 +- .../net/ethernet/wangxun/txgbe/txgbe_aml.c | 39 ++++++++++--------- .../net/ethernet/wangxun/txgbe/txgbe_aml.h | 2 +- .../ethernet/wangxun/txgbe/txgbe_ethtool.c | 2 +- .../net/ethernet/wangxun/txgbe/txgbe_main.c | 12 +++--- .../net/ethernet/wangxun/txgbe/txgbe_type.h | 12 +++--- 6 files changed, 35 insertions(+), 34 deletions(-)
drivers/net/ethernet/wangxun/libwx/wx_type.h +1 -1
@@ -1229,7 +1229,7 @@ enum wx_pf_flags {WX_FLAG_RX_HWTSTAMP_IN_REGISTER ,WX_FLAG_PTP_PPS_ENABLED ,WX_FLAG_NEED_LINK_CONFIG , -WX_FLAG_NEED_SFP_RESET , +WX_FLAG_NEED_MODULE_RESET ,WX_FLAG_NEED_UPDATE_LINK ,WX_FLAG_NEED_DO_RESET ,WX_PF_FLAGS_NBITS /* must be last */
drivers/net/ethernet/wangxun/txgbe/txgbe_aml.c +20 -19
@@ -38,7 +38,7 @@ irqreturn_t txgbe_gpio_irq_handler_aml(int irq, void *data)wr32 (wx,WX_GPIO_INTMASK ,0xFF ); status =rd32 (wx,WX_GPIO_INTSTATUS );if (status &TXGBE_GPIOBIT_2 ) { -set_bit (WX_FLAG_NEED_SFP_RESET , wx->flags); +set_bit (WX_FLAG_NEED_MODULE_RESET , wx->flags);wr32 (wx,WX_GPIO_EOI ,TXGBE_GPIOBIT_2 );wx_service_event_schedule (wx); }
@@ -63,15 +63,16 @@ int txgbe_test_hostif(struct wx *wx) WX_HI_COMMAND_TIMEOUT, false); } -static int txgbe_identify_sfp_hostif (struct wx *wx,struct txgbe_hic_i2c_read *buffer) +static int txgbe_identify_module_hostif (struct wx *wx, +struct txgbe_hic_get_module_info *buffer) { - buffer->hdr.cmd =FW_READ_SFP_INFO_CMD ; - buffer->hdr.buf_len =sizeof (struct txgbe_hic_i2c_read ) - + buffer->hdr.cmd =FW_GET_MODULE_INFO_CMD ; + buffer->hdr.buf_len =sizeof (struct txgbe_hic_get_module_info ) -sizeof (struct wx_hic_hdr ); buffer->hdr.cmd_or_resp.cmd_resv =FW_CEM_CMD_RESERVED ;return wx_host_interface_command (wx, (u32 *)buffer, -sizeof (struct txgbe_hic_i2c_read ), +sizeof (struct txgbe_hic_get_module_info ),WX_HI_COMMAND_TIMEOUT , true); }
@@ -109,9 +110,9 @@ static void txgbe_get_link_capabilities(struct wx *wx, int *speed, {struct txgbe *txgbe = wx->priv; -if (test_bit (PHY_INTERFACE_MODE_25GBASER , txgbe->sfp_interfaces)) +if (test_bit (PHY_INTERFACE_MODE_25GBASER , txgbe->link_interfaces)) *speed =SPEED_25000 ; -else if (test_bit (PHY_INTERFACE_MODE_10GBASER , txgbe->sfp_interfaces)) +else if (test_bit (PHY_INTERFACE_MODE_10GBASER , txgbe->link_interfaces)) *speed =SPEED_10000 ;else *speed =SPEED_UNKNOWN ;
@@ -150,7 +151,7 @@ int txgbe_set_phy_link(struct wx *wx)return 0 ; } -static int txgbe_sfp_to_linkmodes (struct wx *wx,struct txgbe_sfp_id *id) +static int txgbe_sfp_to_linkmodes (struct wx *wx,struct txgbe_sff_id *id) {__ETHTOOL_DECLARE_LINK_MODE_MASK (modes) = {0 , };DECLARE_PHY_INTERFACE_MASK (interfaces);
@@ -204,9 +205,9 @@ static int txgbe_sfp_to_linkmodes(struct wx *wx, struct txgbe_sfp_id *id)phylink_set (modes, Asym_Pause);phylink_set (modes,FIBRE ); -if (!linkmode_equal (txgbe->sfp_support, modes)) { -linkmode_copy (txgbe->sfp_support, modes); -phy_interface_and (txgbe->sfp_interfaces, +if (!linkmode_equal (txgbe->link_support, modes)) { +linkmode_copy (txgbe->link_support, modes); +phy_interface_and (txgbe->link_interfaces, wx->phylink_config.supported_interfaces, interfaces);linkmode_copy (txgbe->advertising, modes);
@@ -217,10 +218,10 @@ static int txgbe_sfp_to_linkmodes(struct wx *wx, struct txgbe_sfp_id *id)return 0 ; } -int txgbe_identify_sfp (struct wx *wx) +int txgbe_identify_module (struct wx *wx) { -struct txgbe_hic_i2c_read buffer; -struct txgbe_sfp_id *id; +struct txgbe_hic_get_module_info buffer; +struct txgbe_sff_id *id;int err =0 ;u32 gpio;
@@ -228,9 +229,9 @@ int txgbe_identify_sfp(struct wx *wx)if (gpio &TXGBE_GPIOBIT_2 )return -ENODEV ; - err =txgbe_identify_sfp_hostif (wx, &buffer); + err =txgbe_identify_module_hostif (wx, &buffer);if (err) { -wx_err (wx,"Failed to identify SFP module\n" ); +wx_err (wx,"Failed to identify module\n" );return err; }
@@ -247,10 +248,10 @@ void txgbe_setup_link(struct wx *wx) {struct txgbe *txgbe = wx->priv; -phy_interface_zero (txgbe->sfp_interfaces); -linkmode_zero (txgbe->sfp_support); +phy_interface_zero (txgbe->link_interfaces); +linkmode_zero (txgbe->link_support); -txgbe_identify_sfp (wx); +txgbe_identify_module (wx); } static void txgbe_get_link_state(struct phylink_config *config,
drivers/net/ethernet/wangxun/txgbe/txgbe_aml.h +1 -1
@@ -8,7 +8,7 @@ void txgbe_gpio_init_aml(struct wx *wx);irqreturn_t txgbe_gpio_irq_handler_aml (int irq,void *data);int txgbe_test_hostif (struct wx *wx);int txgbe_set_phy_link (struct wx *wx); -int txgbe_identify_sfp (struct wx *wx); +int txgbe_identify_module (struct wx *wx);void txgbe_setup_link (struct wx *wx);int txgbe_phylink_init_aml (struct txgbe *txgbe);
drivers/net/ethernet/wangxun/txgbe/txgbe_ethtool.c +1 -1
@@ -32,7 +32,7 @@ int txgbe_get_link_ksettings(struct net_device *netdev, cmd->base.port = txgbe->link_port; cmd->base.autoneg =phylink_test (txgbe->advertising, Autoneg) ?AUTONEG_ENABLE :AUTONEG_DISABLE ; -linkmode_copy (cmd->link_modes.supported, txgbe->sfp_support); +linkmode_copy (cmd->link_modes.supported, txgbe->link_support);linkmode_copy (cmd->link_modes.advertising, txgbe->advertising);return 0 ;
drivers/net/ethernet/wangxun/txgbe/txgbe_main.c +6 -6
@@ -89,21 +89,21 @@ static int txgbe_enumerate_functions(struct wx *wx)return physfns; } -static void txgbe_sfp_detection_subtask (struct wx *wx) +static void txgbe_module_detection_subtask (struct wx *wx) {int err; -if (!test_bit (WX_FLAG_NEED_SFP_RESET , wx->flags)) +if (!test_bit (WX_FLAG_NEED_MODULE_RESET , wx->flags))return ; -/* wait for SFP module ready */ +/* wait for SFF module ready */ msleep (200 ); - err =txgbe_identify_sfp (wx); + err =txgbe_identify_module (wx);if (err)return ; -clear_bit (WX_FLAG_NEED_SFP_RESET , wx->flags); +clear_bit (WX_FLAG_NEED_MODULE_RESET , wx->flags); }static void txgbe_link_config_subtask (struct wx *wx)
@@ -128,7 +128,7 @@ static void txgbe_service_task(struct work_struct *work) { struct wx *wx = container_of(work, struct wx, service_task); -txgbe_sfp_detection_subtask (wx); +txgbe_module_detection_subtask (wx);txgbe_link_config_subtask (wx);wx_service_event_complete (wx);
drivers/net/ethernet/wangxun/txgbe/txgbe_type.h +6 -6
@@ -341,9 +341,9 @@ void txgbe_do_reset(struct net_device *netdev);#define FW_PHY_GET_LINK_CMD 0xC0#define FW_PHY_SET_LINK_CMD 0xC1 -#define FW_READ_SFP_INFO_CMD 0xC5 +#define FW_GET_MODULE_INFO_CMD 0xC5 -struct txgbe_sfp_id { +struct txgbe_sff_id {u8 identifier;/* A0H 0x00 */ u8 com_1g_code;/* A0H 0x06 */ u8 com_10g_code;/* A0H 0x03 */
@@ -356,9 +356,9 @@ struct txgbe_sfp_id {u8 reserved[3 ]; }; -struct txgbe_hic_i2c_read { +struct txgbe_hic_get_module_info {struct wx_hic_hdr hdr; -struct txgbe_sfp_id id; +struct txgbe_sff_id id; };struct txgbe_hic_ephy_setlink {
@@ -449,8 +449,8 @@ struct txgbe {int fdir_filter_count;spinlock_t fdir_perfect_lock;/* spinlock for FDIR */ -DECLARE_PHY_INTERFACE_MASK (sfp_interfaces); -__ETHTOOL_DECLARE_LINK_MODE_MASK (sfp_support); +DECLARE_PHY_INTERFACE_MASK (link_interfaces); +__ETHTOOL_DECLARE_LINK_MODE_MASK (link_support);__ETHTOOL_DECLARE_LINK_MODE_MASK (advertising);u8 link_port; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 136/325 net: txgbe: initialize module info buffer
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiawen Wu <[email protected]>
[ Upstream commit 0487cfca46517ff6699c72dc1a8872b0af3c31a9 ]
The module info buffer should be initialized to 0 before the firmware returns information. Otherwise, there is a risk that the buffer field not filled by the firmware is random value.
--- drivers/net/ethernet/wangxun/txgbe/txgbe_aml.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/wangxun/txgbe/txgbe_aml.c +1 -1
@@ -220,7 +220,7 @@ static int txgbe_sfp_to_linkmodes(struct wx *wx, struct txgbe_sff_id *id)int txgbe_identify_module (struct wx *wx) { -struct txgbe_hic_get_module_info buffer; +struct txgbe_hic_get_module_info buffer = {0 };struct txgbe_sff_id *id;int err =0 ;u32 gpio;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 137/325 ipv6: Fix a potential NPD in cleanup_prefix_route()
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit b70c687b7cf267fb08586667a3946c8851cad672 ]
addrconf_get_prefix_route() can return the fib6_null_entry sentinel entry which has a NULL fib6_table pointer. Therefore, before setting the route's expiration time, check that we are not working with this entry, as otherwise a NPD will be triggered [1].
Note that the other callers of addrconf_get_prefix_route() are not susceptible to this bug:
1. addrconf_prefix_rcv(): Requests a route with the 'RTF_ADDRCONF | RTF_PREFIX_RT' flags which are not set on fib6_null_entry.
2. modify_prefix_route(): Fixed by commit a747e02430df ("ipv6: avoid possible NULL deref in modify_prefix_route()").
3. __ipv6_ifa_notify(): Calls ip6_del_rt() which specifically checks for fib6_null_entry and returns an error.
[1]
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000006: 0000 [#1] SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000030-0x0000000000000037] [...] Call Trace: <TASK> __kasan_check_byte (mm/kasan/common.c:573) lock_acquire.part.0 (kernel/locking/lockdep.c:5842 (discriminator 1)) _raw_spin_lock_bh (kernel/locking/spinlock.c:182 (discriminator 1))
cleanup_prefix_route (net/ipv6/addrconf.c:1280)ipv6_del_addr (net/ipv6/addrconf.c:1342)
inet6_addr_del.isra.0 (net/ipv6/addrconf.c:3119) inet6_rtm_deladdr (net/ipv6/addrconf.c:4812)rtnetlink_rcv_msg (net/core/rtnetlink.c:6997)netlink_rcv_skb (net/netlink/af_netlink.c:2555)netlink_unicast (net/netlink/af_netlink.c:1344)netlink_sendmsg (net/netlink/af_netlink.c:1899)__sock_sendmsg (net/socket.c:802 (discriminator 4)) ____sys_sendmsg (net/socket.c:2698)___sys_sendmsg (net/socket.c:2752)__sys_sendmsg (net/socket.c:2784)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)
--- net/ipv6/addrconf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/ipv6/addrconf.c +4 -2
@@ -1265,6 +1265,7 @@ static void cleanup_prefix_route(struct inet6_ifaddr *ifp, unsigned long expires, bool del_rt, bool del_peer) { + struct net *net = dev_net(ifp->idev->dev);struct fib6_table *table;struct fib6_info *f6i;
@@ -1273,9 +1274,10 @@ cleanup_prefix_route(struct inet6_ifaddr *ifp, unsigned long expires, ifp->idev->dev, 0, RTF_DEFAULT, true);if (f6i) {if (del_rt) -ip6_del_rt (dev_net (ifp->idev->dev), f6i, false); +ip6_del_rt (net, f6i, false);else { -if (!(f6i->fib6_flags &RTF_EXPIRES )) { +if (f6i != net->ipv6.fib6_null_entry && + !(f6i->fib6_flags &RTF_EXPIRES )) { table = f6i->fib6_table;spin_lock_bh (&table->tb6_lock);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 138/325 KVM: VMX: Update SVI during runtime APICv activation
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dongli Zhang <[email protected]>
commit b2849bec936be642b5420801f902337f2507648e upstream.
The APICv (apic->apicv_active) can be activated or deactivated at runtime, for instance, because of APICv inhibit reasons. Intel VMX employs different mechanisms to virtualize LAPIC based on whether APICv is active.
When APICv is activated at runtime, GUEST_INTR_STATUS is used to configure and report the current pending IRR and ISR states. Unless a specific vector is explicitly included in EOI_EXIT_BITMAP, its EOI will not be trapped to KVM. Intel VMX automatically clears the corresponding ISR bit based on the GUEST_INTR_STATUS.SVI field.
When APICv is deactivated at runtime, the VM_ENTRY_INTR_INFO_FIELD is used to specify the next interrupt vector to invoke upon VM-entry. The VMX IDT_VECTORING_INFO_FIELD is used to report un-invoked vectors on VM-exit. EOIs are always trapped to KVM, so the software can manually clear pending ISR bits.
There are scenarios where, with APICv activated at runtime, a guest-issued EOI may not be able to clear the pending ISR bit.
Taking vector 236 as an example, here is one scenario.
1. Suppose APICv is inactive. Vector 236 is pending in the IRR.
2. To handle KVM_REQ_EVENT, KVM moves vector 236 from the IRR to the ISR, and configures the VM_ENTRY_INTR_INFO_FIELD via vmx_inject_irq().
3. After VM-entry, vector 236 is invoked through the guest IDT. At this point, the data in VM_ENTRY_INTR_INFO_FIELD is no longer valid. The guest interrupt handler for vector 236 is invoked.
4. Suppose a VM exit occurs very early in the guest interrupt handler, before the EOI is issued.
5. Nothing is reported through the IDT_VECTORING_INFO_FIELD because vector 236 has already been invoked in the guest.
6. Now, suppose APICv is activated. Before the next VM-entry, KVM calls kvm_vcpu_update_apicv() to activate APICv.
7. Unfortunately, GUEST_INTR_STATUS.SVI is not configured, although vector 236 is still pending in the ISR.
8. After VM-entry, the guest finally issues the EOI for vector 236. However, because SVI is not configured, vector 236 is not cleared.
9. ISR is stalled forever on vector 236.
Here is another scenario.
1. Suppose APICv is inactive. Vector 236 is pending in the IRR.
2. To handle KVM_REQ_EVENT, KVM moves vector 236 from the IRR to the ISR, and configures the VM_ENTRY_INTR_INFO_FIELD via vmx_inject_irq().
3. VM-exit occurs immediately after the next VM-entry. The vector 236 is not invoked through the guest IDT. Instead, it is saved to the IDT_VECTORING_INFO_FIELD during the VM-exit.
4. KVM calls kvm_queue_interrupt() to re-queue the un-invoked vector 236 into vcpu->arch.interrupt. A KVM_REQ_EVENT is requested.
5. Now, suppose APICv is activated. Before the next VM-entry, KVM calls kvm_vcpu_update_apicv() to activate APICv.
6. Although APICv is now active, KVM still uses the legacy VM_ENTRY_INTR_INFO_FIELD to re-inject vector 236. GUEST_INTR_STATUS.SVI is not configured.
7. After the next VM-entry, vector 236 is invoked through the guest IDT. Finally, an EOI occurs. However, due to the lack of GUEST_INTR_STATUS.SVI configuration, vector 236 is not cleared from the ISR.
8. ISR is stalled forever on vector 236.
Using QEMU as an example, vector 236 is stuck in ISR forever.
(qemu) info lapic 1
dumping local APIC state for CPU 1
LVT0 0x00010700 active-hi edge masked ExtINT (vec 0) LVT1 0x00010400 active-hi edge masked NMI
LVTPC 0x00000400 active-hi edge NMI
LVTERR 0x000000fe active-hi edge Fixed (vec 254)
LVTTHMR 0x00010000 active-hi edge masked Fixed (vec 0)
LVTT 0x000400ec active-hi edge tsc-deadline Fixed (vec 236)
Timer DCR=0x0 (divide by 2) initial_count = 0 current_count = 0
SPIV 0x000001ff APIC enabled, focus=off, spurious vec 255
ICR 0x000000fd physical edge de-assert no-shorthand
ICR2 0x00000000 cpu 0 (X2APIC ID)
ESR 0x00000000
ISR 236
IRR 37(level) 236
The issue isn't applicable to AMD SVM as KVM simply writes vmcb01 directly irrespective of whether L1 (vmcs01) or L2 (vmcb02) is active (unlike VMX, there is no need/cost to switch between VMCBs). In addition, APICV_INHIBIT_REASON_IRQWIN ensures AMD SVM AVIC is not activated until the last interrupt is EOI'd.
Fix the bug by configuring Intel VMX GUEST_INTR_STATUS.SVI if APICv is activated at runtime.
--- arch/x86/kvm/vmx/vmx.c | 9 --------- arch/x86/kvm/x86.c | 7 +++++++ 2 files changed, 7 insertions(+), 9 deletions(-)
arch/x86/kvm/vmx/vmx.c +0 -9
@@ -6886,15 +6886,6 @@ void vmx_hwapic_isr_update(struct kvm_vcpu *vcpu, int max_isr)* VM-Exit, otherwise L1 with run with a stale SVI. */ if (is_guest_mode (vcpu)) { -/* -* KVM is supposed to forward intercepted L2 EOIs to L1 if VID -* is enabled in vmcs12; as above, the EOIs affect L2's vAPIC. -* Note, userspace can stuff state while L2 is active; assert -* that VID is disabled if and only if the vCPU is in KVM_RUN -* to avoid false positives if userspace is setting APIC state. -*/ -WARN_ON_ONCE (vcpu->wants_to_run && -nested_cpu_has_vid (get_vmcs12 (vcpu)));to_vmx (vcpu)->nested.update_vmcs01_hwapic_isr = true;return ; }
arch/x86/kvm/x86.c +7 -0
@@ -10950,9 +10950,16 @@ void __kvm_vcpu_update_apicv(struct kvm_vcpu *vcpu)* pending. At the same time, KVM_REQ_EVENT may not be set as APICv was * still active when the interrupt got accepted. Make sure * kvm_check_and_inject_events() is called to check for that. +* +* Update SVI when APICv gets enabled, otherwise SVI won't reflect the +* highest bit in vISR and the next accelerated EOI in the guest won't +* be virtualized correctly (the CPU uses SVI to determine which vISR +* vector to clear). */ if (!apic->apicv_active)kvm_make_request (KVM_REQ_EVENT , vcpu); +else +kvm_apic_update_hwapic_isr (vcpu); out:preempt_enable ();
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 139/325 clk: qcom: x1e80100-dispcc: Stop disp_cc_mdss_mdp_clk_src from getting parked
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit bc27dbefae6ed11376d991a2921eff806ffef67c ]
Parking disp_cc_mdss_mdp_clk_src at 19.2MHz causing the EFI GOP framebuffer to stop functioning. The EFI GOP framebuffer should keep working until the msm display driver loads, to help with boot debugging and to ensure display output when the msm module is not in the initramfs.
Switch disp_cc_mdss_mdp_clk_src over to clk_rcg2_shared_no_init_park_ops to keep the EFI GOP working after binding the x1e80100-dispcc driver.
--- drivers/clk/qcom/dispcc-x1e80100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/dispcc-x1e80100.c +1 -1
@@ -580,7 +580,7 @@ static struct clk_rcg2 disp_cc_mdss_mdp_clk_src = { .parent_data = disp_cc_parent_data_6, .num_parents = ARRAY_SIZE(disp_cc_parent_data_6), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_shared_ops, + .ops = &clk_rcg2_shared_no_init_park_ops, }, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 140/325 clk: samsung: gs101: Fix missing USI7_USI DIV clock in peric0_clk_regs
In reply to Greg Kroah-Hartman6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuan-Wei Chiu <[email protected]>
[ Upstream commit 78ee734b36284d82454e87a92094fdb926985b47 ]
In the peric0_clk_regs array, the divider register offset for USI6 was accidentally listed twice, while the divider for USI7 was omitted.
Missing this DIV register causes the USI7 clock divider setting to be lost and reset to its hardware default value during a suspend/resume cycle.
Replace the duplicated USI6 DIV entry with the correct USI7 DIV register.
--- drivers/clk/samsung/clk-gs101.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/samsung/clk-gs101.c +1 -1
@@ -3602,7 +3602,7 @@ static const unsigned long peric0_clk_regs[] __initconst = {CLK_CON_DIV_DIV_CLK_PERIC0_USI4_USI ,CLK_CON_DIV_DIV_CLK_PERIC0_USI5_USI ,CLK_CON_DIV_DIV_CLK_PERIC0_USI6_USI , -CLK_CON_DIV_DIV_CLK_PERIC0_USI6_USI , +CLK_CON_DIV_DIV_CLK_PERIC0_USI7_USI ,CLK_CON_DIV_DIV_CLK_PERIC0_USI8_USI ,CLK_CON_BUF_CLKBUF_PERIC0_IP , CLK_CON_GAT_CLK_BLK_PERIC0_UID_PERIC0_CMU_PERIC0_IPCLKPORT_PCLK,
Signature · 1 line
2.53.0