6.1.176-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 1/522 Input: usbtouchscreen - clamp NEXIO data_len/x_len to URB buffer size
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 2905281cbda52ec9df540113b35b835feb5fafd3 upstream.
nexio_read_data() pulls data_len and x_len from a packed __be16 header in the device's interrupt packet and then walks packet->data[0..x_len) and packet->data[x_len..data_len) comparing each byte against a threshold.
Both fields are 16-bit on the wire (max 65535). The existing adjustments shave at most 0x100 / 0x80 off, so the loop bound can still reach roughly 0xfeff. The URB transfer buffer for NEXIO is rept_size (1024) bytes from usb_alloc_coherent(), with the first 7 occupied by the packed header — so packet->data[] has 1017 valid bytes. read_data() callbacks are not given urb->actual_length, and nothing else bounds the walk.
A device that lies about its length can get a ~64 KiB out-of-bounds read past the coherent DMA allocation. The first index whose byte exceeds NEXIO_THRESHOLD lands in begin_x / begin_y and from there into the reported touch coordinates, so adjacent kernel memory contents leak to userspace as ABS_X / ABS_Y events. Far enough out, the read can also hit an unmapped page and fault.
Fix this all by clamping data_len to the buffer's data[] capacity and x_len to data_len.
--- drivers/input/touchscreen/usbtouchscreen.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/input/touchscreen/usbtouchscreen.c +5 -0
@@ -1061,6 +1061,11 @@ static int nexio_read_data(struct usbtouif (x_len >0xff ) x_len -=0x80 ; +if (data_len > usbtouch->data_size -sizeof (*packet)) + data_len = usbtouch->data_size -sizeof (*packet); +if (x_len > data_len) + x_len = data_len; +/* send ACK */ ret =usb_submit_urb (priv->ack,GFP_ATOMIC );if (ret)
Greg Kroah-Hartman
maintainercover 6.1.176-rc1 review
This is the start of the stable review cycle for the 6.1.176 release. There are 522 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.1.176-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.1.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 6.1.176-rc1
Borislav Petkov (AMD) <[email protected]>
x86/CPU/AMD: Move the Zen3 BTC_NO detection to the Zen3 init function
Ben Hutchings <[email protected]>
apparmor: validate default DFA states are in bounds
Ben Hutchings <[email protected]>
fbdev: vt8500lcdfb: Fix dma_free_coherent() cpu_addr parameter
Petr Machata <[email protected]>
Revert "selftest/ptp: update ptp selftest to exercise the gettimex options"
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
Shanker Donthineni <[email protected]>
arm64: cputype: Add NVIDIA Olympus definitions
Ashutosh Desai <[email protected]>
drm/v3d: Reject empty multisync extension to prevent infinite loop
SeongJae Park <[email protected]>
mm/damon/reclaim: detect and use fresh enabled and kdamond_pid values
SeongJae Park <[email protected]>
mm/damon/lru_sort: detect and use fresh enabled and kdamond_pid values
SeongJae Park <[email protected]>
mm/damon/core: implement damon_kdamond_pid()
Corey Minyard <[email protected]>
ipmi:ssif: NULL thread on error
Corey Minyard <[email protected]>
ipmi:ssif: Remove unnecessary indention
Lukas Wunner <[email protected]>
lib/crypto: mpi: Fix integer underflow in mpi_read_raw_from_sgl()
Amit Sunil Dhamne <[email protected]>
usb: typec: tcpm: reset internal port states on soft reset AMS
SeongJae Park <[email protected]>
mm/damon/core: disallow time-quota setting zero esz
SeongJae Park <[email protected]>
mm/damon/core: use time_in_range_open() for damos quota window start
Corey Minyard <[email protected]>
ipmi:ssif: Clean up kthread on errors
Corey Minyard <[email protected]>
ipmi:ssif: Fix a shutdown race
Marc Zyngier <[email protected]>
KVM: arm64: Wake-up from WFI when iqrchip is in userspace
Arnaldo Carvalho de Melo <[email protected]>
perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0
Arnaldo Carvalho de Melo <[email protected]>
tools build: Add 3-component logical version comparators
Ian Rogers <[email protected]>
perf build: Disable fewer bison warnings
Ian Rogers <[email protected]>
perf parse-events: Make YYDEBUG dependent on doing a debug build
Ian Rogers <[email protected]>
perf build: Conditionally define NDEBUG
Aaron Erhardt <[email protected]>
ALSA: hda/hdmi: Add quirk for TUXEDO IBS14G6
Sven Eckelmann <[email protected]>
batman-adv: tp_meter: fix tp_num leak on kmalloc failure
Jiexun Wang <[email protected]>
batman-adv: stop tp_meter sessions during mesh teardown
Tejun Heo <[email protected]>
blk-cgroup: Fix NULL deref caused by blkg_policy_data being installed before init
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
Wupeng Ma <[email protected]>
mm/memory-failure: fix hugetlb_lock AA deadlock in get_huge_page_for_hwpoison
Jane Chu <[email protected]>
mm/memory-failure: fix missing ->mf_stats count in hugetlb poison
David Hildenbrand <[email protected]>
mm/hugetlb: rename folio_putback_active_hugetlb() to folio_putback_hugetlb()
David Hildenbrand <[email protected]>
mm/migrate: don't call folio_putback_active_hugetlb() on dst hugetlb folio
David Hildenbrand <[email protected]>
mm/hugetlb: rename isolate_hugetlb() to folio_isolate_hugetlb()
Anton Leontev <[email protected]>
hv_netvsc: use kmap_local_page in netvsc_copy_to_send_buf
Davide Ornaghi <[email protected]>
netfilter: nft_fib: fix stale stack leak via the OIFNAME register
Myrrh Periwinkle <[email protected]>
usb: typec: ucsi: Don't update power_supply on power role change if not connected
Michael Bommarito <[email protected]>
scsi: target: iscsi: Fix CRC overread and double-free in iscsit_handle_text_cmd()
Prasanna S <[email protected]>
serial: qcom-geni: fix UART_RX_PAR_EN bit position
Bartosz Golaszewski <[email protected]>
tty: serial: qcom-geni-serial: align #define values
Bartosz Golaszewski <[email protected]>
tty: serial: qcom-geni-serial: remove unused symbols
Michael Bommarito <[email protected]>
thunderbolt: property: Cap recursion depth in __tb_property_parse_dir()
Myrrh Periwinkle <[email protected]>
usb: typec: ucsi: Check if power role change actually happened before handling
Guangshuo Li <[email protected]>
usb: gadget: f_hid: fix device reference leak in hidg_alloc()
John Keeping <[email protected]>
usb: gadget: f_hid: tidy error handling in hidg_alloc
Wentao Liang <[email protected]>
usb: musb: omap2430: Fix use-after-free in omap2430_probe()
Radhey Shyam Pandey <[email protected]>
usb: dwc3: xilinx: fix error handling in zynqmp init error paths
Tudor Ambarus <[email protected]>
tty: serial: samsung: Remove redundant port lock acquisition in rx helpers
Tudor Ambarus <[email protected]>
tty: serial: samsung: use u32 for register interactions
Thomas Gleixner <[email protected]>
serial: samsung_tty: Use port lock wrappers
Cássio Gabriel <[email protected]>
ALSA: firewire-motu: Protect register DSP event queue positions
Rodrigo Alencar <[email protected]>
iio: dac: ad5686: fix ref bit initialization for single-channel parts
Peter Chen <[email protected]>
usb: cdns3: plat: fix leaked usb2_phy initialization on usb3_phy acquisition failure
Antoniu Miclaus <[email protected]>
iio: chemical: scd30: fix division by zero in write_raw
Jonathan Cameron <[email protected]>
iio: chemical: scd30: Use guard(mutex) to allow early returns
Antoniu Miclaus <[email protected]>
iio: gyro: adis16260: fix division by zero in write_raw
David Carlier <[email protected]>
iio: adc: npcm: fix unbalanced clk_disable_unprepare()
Uwe Kleine-König <[email protected]>
iio: adc: npcm: Convert to platform remove callback returning void
Ruan Jinjie <[email protected]>
iio: adc: fix the return value handle for platform_get_irq()
Wayne Chang <[email protected]>
phy: tegra: xusb: Fix per-pad high-speed termination calibration
Wayne Chang <[email protected]>
phy: tegra: xusb: Disable trk clk when not in use
Zeng Heng <[email protected]>
arm64: tlb: Flush walk cache when unsharing PMD tables
Johan Hovold <[email protected]>
spi: qup: fix error pointer deref after DMA setup failure
Yang Yingliang <[email protected]>
spi: qup: switch to use modern name
Dawei Feng <[email protected]>
octeontx2-pf: avoid double free of pool->stack on AQ init failure
Lukas Wunner <[email protected]>
platform/x86/intel/vsec: Fix enable_cnt imbalance on PCIe error recovery
David E. Box <[email protected]>
platform/x86/intel/vsec: Make driver_data info const
David E. Box <[email protected]>
platform/x86/intel/vsec: Create wrapper to walk PCI config space
David E. Box <[email protected]>
platform/x86/intel/vsec: Add private data for per-device data
Shardul Bankar <[email protected]>
mptcp: do not drop partial packets
Paolo Abeni <[email protected]>
mptcp: reset rcv wnd on disconnect
Sam Daly <[email protected]>
octeontx2-af: CGX: add bounds check to cgx_speed_mbps index
Justin Stitt <[email protected]>
octeontx2-af: replace deprecated strncpy with strscpy
Matthieu Baerts (NGI0) <[email protected]>
selftests: mptcp: drop nanoseconds width specifier
Li Xiasong <[email protected]>
mptcp: pm: fix ADD_ADDR timer infinite retry on option space insufficient
Jose Ignacio Tornos Martinez <[email protected]>
ice: fix VF queue configuration with low MTU values
Justin Iurman <[email protected]>
ipv6: ioam: add NULL check for idev in ipv6_hop_ioam()
Michael Bommarito <[email protected]>
net: hsr: defer node table free until after RCU readers
Jiexun Wang <[email protected]>
Bluetooth: serialize accept_q access
Luiz Augusto von Dentz <[email protected]>
Bluetooth: Init sk_peer_* on bt_sock_alloc
Alistair Popple <[email protected]>
mm/memory: fix spurious warning when unmapping device-private/exclusive pages
Shuai Zhang <[email protected]>
Bluetooth: hci_qca: Convert timeout from jiffies to ms
Michael Bommarito <[email protected]>
smb: client: require net admin for CIFS SWN netlink
Ido Schimmel <[email protected]>
genetlink: Use internal flags for multicast groups
Guopeng Zhang <[email protected]>
cgroup/cpuset: Reset DL migration state on can_attach() failure
Johan Hovold <[email protected]>
spi: lantiq-ssc: fix controller deregistration
Johan Hovold <[email protected]>
spi: st-ssc4: fix controller deregistration
Yang Yingliang <[email protected]>
spi: st-ssc4: switch to use modern name
Chao Yu <[email protected]>
f2fs: fix false alarm of lockdep on cp_global_sem lock
Yongpeng Yang <[email protected]>
f2fs: fix incorrect file address mapping when inline inode is unwritten
Matthieu Baerts (NGI0) <[email protected]>
mptcp: pm: ADD_ADDR rtx: resched blocked ADD_ADDR quicker
Matthieu Baerts (NGI0) <[email protected]>
mptcp: pm: ADD_ADDR rtx: fix potential data-race
Matthieu Baerts (NGI0) <[email protected]>
mptcp: pm: ADD_ADDR rtx: allow ID 0
Matthieu Baerts (NGI0) <[email protected]>
mptcp: pm: kernel: correctly retransmit ADD_ADDR ID 0
Matthieu Baerts (NGI0) <[email protected]>
mptcp: pm: prio: skip closed subflows
Matthieu Baerts (NGI0) <[email protected]>
mptcp: fastclose msk when linger time is 0
Filipe Manana <[email protected]>
btrfs: fix missing last_unlink_trans update when removing a directory
Piyush Sachdeva <[email protected]>
smb: client: Use FullSessionKey for AES-256 encryption key derivation
Michael Bommarito <[email protected]>
smb: client: validate dacloffset before building DACL pointers
Ulf Hansson <[email protected]>
pmdomain: core: Fix detach procedure for virtual devices in genpd
Guangshuo Li <[email protected]>
btrfs: fix double free in create_space_info_sub_group() error path
Filipe Manana <[email protected]>
btrfs: remove fs_info argument from btrfs_sysfs_add_space_info_type()
Steven Rostedt <[email protected]>
tracing/probes: Limit size of event probe to 3K
Yochai Eisenrich <[email protected]>
btrfs: fix btrfs_ioctl_space_info() slot_count TOCTOU which can lead to info-leak
Uwe Kleine-König <[email protected]>
spi: topcliff-pch: Convert to platform remove callback returning void
Thomas Zimmermann <[email protected]>
fbcon: Avoid OOB font access if console rotation fails
Johan Hovold <[email protected]>
spi: microchip-core-qspi: fix controller deregistration
Li Zetao <[email protected]>
spi: microchip-core-qspi: Use helper function devm_clk_get_enabled()
Uwe Kleine-König <[email protected]>
spi: microchip-core-qspi: Convert to platform remove callback returning void
Pavitra Jha <[email protected]>
net: wwan: t7xx: validate port_count against message length in t7xx_port_enum_msg_handler
Sang-Heon Jeon <[email protected]>
mm/hugetlb_cma: round up per_node before logging it
Johan Hovold <[email protected]>
spi: uniphier: fix controller deregistration
Pei Xiao <[email protected]>
spi: uniphier: Simplify clock handling with devm_clk_get_enabled()
Yang Yingliang <[email protected]>
spi: uniphier: switch to use modern name
Uwe Kleine-König <[email protected]>
spi: uniphier: Convert to platform remove callback returning void
Johan Hovold <[email protected]>
spi: tegra20-sflash: fix controller deregistration
Johan Hovold <[email protected]>
spi: tegra114: fix controller deregistration
Tudor Ambarus <[email protected]>
mtd: spi-nor: debugfs: fix out-of-bounds read in spi_nor_params_show()
Zeng Heng <[email protected]>
mtd: spi-nor: core: fix implicit declaration warning
Johan Hovold <[email protected]>
spi: s3c64xx: fix NULL-deref on driver unbind
Andi Shyti <[email protected]>
spi: s3c64xx: Use devm_clk_get_enabled()
Johan Hovold <[email protected]>
spi: sun6i: fix controller deregistration
Johan Hovold <[email protected]>
spi: zynq-qspi: fix controller deregistration
Pei Xiao <[email protected]>
spi: zynq-qspi: Simplify clock handling with devm_clk_get_enabled()
Yang Yingliang <[email protected]>
spi: zynq-qspi: switch to use modern name
Ruan Jinjie <[email protected]>
spi: spi-zynq: Do not check for 0 return after calling platform_get_irq()
Uwe Kleine-König <[email protected]>
spi: zynq-qspi: Convert to platform remove callback returning void
Johan Hovold <[email protected]>
spi: ti-qspi: fix controller deregistration
Yang Yingliang <[email protected]>
spi: spi-ti-qspi: switch to use modern name
Uwe Kleine-König <[email protected]>
spi: spi-ti-qspi: Convert to platform remove callback returning void
Andy Shevchenko <[email protected]>
spi: Convert to SPI_CONTROLLER_HALF_DUPLEX
Johan Hovold <[email protected]>
spi: sun4i: fix controller deregistration
Yang Yingliang <[email protected]>
spi: sun4i: switch to use modern name
Uwe Kleine-König <[email protected]>
spi: sun4i: Convert to platform remove callback returning void
Johan Hovold <[email protected]>
spi: syncuacer: fix controller deregistration
Yang Yingliang <[email protected]>
spi: synquacer: switch to use modern name
Uwe Kleine-König <[email protected]>
spi: synquacer: Convert to platform remove callback returning void
Michal Kosiorek <[email protected]>
xfrm: defensively unhash xfrm_state lists in __xfrm_state_delete
Michael Bommarito <[email protected]>
xfrm: ah: account for ESN high bits in async callbacks
Eric Biggers <[email protected]>
net: ipv6: stop checking crypto_ahash_alignmask
Eric Biggers <[email protected]>
net: ipv4: stop checking crypto_ahash_alignmask
Selvarasu Ganesan <[email protected]>
usb: dwc3: Move GUID programming after PHY initialization
Marek Szyprowski <[email protected]>
wifi: brcmfmac: Fix potential use-after-free issue when stopping watchdog task
Johannes Berg <[email protected]>
wifi: mac80211: remove station if connection prep fails
David Carlier <[email protected]>
tracepoint: balance regfunc() on func_add() failure in tracepoint_add_func()
Sam Edwards <[email protected]>
net: stmmac: Prevent NULL deref when RX memory exhausted
Russell King (Oracle) <[email protected]>
net: stmmac: rename STMMAC_GET_ENTRY() -> STMMAC_NEXT_ENTRY()
Russell King (Oracle) <[email protected]>
net: stmmac: avoid shadowing global buf_sz
Thorsten Blum <[email protected]>
crypto: caam - guard HMAC key hex dumps in hash_digest_key
Thorsten Blum <[email protected]>
printk: add print_hex_dump_devel()
Max Kellermann <[email protected]>
ceph: only d_add() negative dentries when they are unhashed
Junrui Luo <[email protected]>
erofs: fix unsigned underflow in z_erofs_lz4_handle_overlap()
Thorsten Blum <[email protected]>
crypto: nx - fix bounce buffer leaks in nx842_crypto_{alloc,free}_ctx
Ard Biesheuvel <[email protected]>
crypto: nx - Migrate to scomp API
Gustavo A. R. Silva <[email protected]>
crypto: nx - Avoid -Wflex-array-member-not-at-end warning
Zilin Guan <[email protected]>
hfsplus: fix held lock freed on hfsplus_fill_super()
Deepanshu Kartikey <[email protected]>
hfsplus: fix uninit-value by validating catalog record size
Seohyeon Maeng <[email protected]>
udf: fix partition descriptor append bookkeeping
Haoxiang Li <[email protected]>
xfs: fix a resource leak in xfs_alloc_buftarg()
Thomas Zimmermann <[email protected]>
fbdev: defio: Disconnect deferred I/O from the lifetime of struct fb_info
Johan Hovold <[email protected]>
spi: fix resource leaks on device setup failure
Zhengchuan Liang <[email protected]>
net: bridge: use a stable FDB dst snapshot in RCU readers
Manivannan Sadhasivam <[email protected]>
net: qrtr: ns: Limit the total number of nodes
Yuan Zhaoming <[email protected]>
net: mctp: fix don't require received header reserved bits to be zero
Manivannan Sadhasivam <[email protected]>
net: qrtr: ns: Free the node during ctrl_cmd_bye()
Vignesh Viswanathan <[email protected]>
net: qrtr: ns: Change servers radix tree to xarray
Manivannan Sadhasivam <[email protected]>
net: qrtr: ns: Limit the maximum number of lookups
Joseph Salisbury <[email protected]>
sched: Use u64 for bandwidth ratio calculations
Oliver Neukum <[email protected]>
media: rc: igorplugusb: heed coherency rules
Thorsten Blum <[email protected]>
ALSA: aoa: Skip devices with no codecs in i2sbus_resume()
Oliver Neukum <[email protected]>
media: rc: ttusbir: respect DMA coherency rules
Cássio Gabriel <[email protected]>
ALSA: aoa: i2sbus: clear stale prepared state
Takashi Iwai <[email protected]>
ALSA: aoa: Use guard() for mutex locks
Rafael J. Wysocki <[email protected]>
thermal: core: Fix thermal zone governor cleanup issues
Johan Hovold <[email protected]>
spi: imx: fix use-after-free on unbind
Uwe Kleine-König <[email protected]>
spi: imx: Convert to platform remove callback returning void
Daniel Hodges <[email protected]>
wifi: mwifiex: fix use-after-free in mwifiex_adapter_cleanup()
Alistair Popple <[email protected]>
lib: test_hmm: evict device pages on file close to avoid use-after-free
Anshuman Khandual <[email protected]>
arm64/mm: Enable batched TLB flush in unmap_hotplug_range()
Greg Kroah-Hartman <[email protected]>
LoongArch: Add spectre boundry for syscall dispatch table
Michael Bommarito <[email protected]>
smb: client: validate the whole DACL before rewriting it in cifsacl
Michael Bommarito <[email protected]>
ksmbd: require minimum ACE size in smb_check_perm_dacl()
Yongpeng Yang <[email protected]>
f2fs: fix UAF caused by decrementing sbi->nr_pages[] in f2fs_write_end_io()
Chao Yu <[email protected]>
f2fs: fix to do sanity check on dcc->discard_cmd_cnt conditionally
Jiazi Li <[email protected]>
f2fs: use kfree() instead of kvfree() to free some memory
Yin Tirui <[email protected]>
mm/huge_memory: update file PMD counter before folio_put()
SeongJae Park <[email protected]>
mm/damon/ops-common: call folio_test_lru() after folio_get()
Lorenzo Stoakes <[email protected]>
mm/hugetlb: avoid false positive lockdep assertion
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 NULL deref and buffer over-read in SDP debugfs
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
Christian König <[email protected]>
drm/amdgpu: restart the CS if some parts of the VM are still invalidated
Bjorn Andersson <[email protected]>
slimbus: qcom-ngd-ctrl: Avoid ABBA on tx_lock/ctrl->lock
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
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
Kamal Dasu <[email protected]>
mmc: core: Fix host controller programming for fixed driver type
Dawei Feng <[email protected]>
octeontx2-af: fix memory leak in rvu_setup_hw_resources()
Yuqi Xu <[email protected]>
net: rds: clear i_sends on setup unwind
Bartosz Golaszewski <[email protected]>
net: mv643xx: fix OF node refcount
ZhaoJinming <[email protected]>
net: bonding: fix NULL pointer dereference in bond_do_ioctl()
Nikolay Kuratov <[email protected]>
net/mlx5: Reorder completion before putting command entry in cmd_work_handler
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
Yilin Zhu <[email protected]>
ipc/shm: serialize orphan cleanup with shm_nattch updates
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()
Jann Horn <[email protected]>
fuse: reject fuse_notify() pagecache ops on directories
Christian Brauner <[email protected]>
pidfd: refuse access to tasks that have started exiting harder
Michael Bommarito <[email protected]>
IB/isert: Reject login PDUs shorter than ISER_HEADERS_LEN
Kyle Meyer <[email protected]>
bnxt_en: Fix NULL pointer dereference
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
Matthieu Baerts (NGI0) <[email protected]>
mptcp: sockopt: check timestamping ret value
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
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
Michael Bommarito <[email protected]>
RDMA/srp: bound SRP_RSP sense copy by the received length
Harry Wentland <[email protected]>
drm/amd/display: Reject gpio_bitshift >= 32 in bios_parser_get_gpio_pin_info()
Takashi Iwai <[email protected]>
ALSA: timer: Fix UAF at snd_timer_user_params()
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()
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
Joonas Lahtinen <[email protected]>
drm/i915/gem: Fix phys BO pread/pwrite with offset
Inochi Amaoto <[email protected]>
mmc: litex_mmc: Use DIV_ROUND_UP for more accurate clock calculation
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
Tristan Madani <[email protected]>
netfilter: nft_tunnel: fix use-after-free on object destroy
Alexander A. Klimov <[email protected]>
drm/vc4: fix krealloc() memory leak
Pablo Neira Ayuso <[email protected]>
netfilter: ctnetlink: ensure safe access to master conntrack
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
Lorenzo Bianconi <[email protected]>
net: mvpp2: Add metadata support for xdp mode
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
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()
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
Michael Bommarito <[email protected]>
sctp: fix uninit-value in __sctp_rcv_asconf_lookup()
Chih Kai Hsu <[email protected]>
r8152: handle the return value of usb_reset_device()
Douglas Anderson <[email protected]>
r8152: Block future register access if register access fails
Hayes Wang <[email protected]>
r8152: reduce the control transfer of rtl8152_get_version()
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
Mingyu Wang <[email protected]>
net: qrtr: fix refcount saturation and potential UAF in qrtr_port_remove
Yao Sang <[email protected]>
net/mlx4: avoid GCC 10 __bad_copy_from() false positive
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
Chenguang Zhao <[email protected]>
netlabel: validate unlabeled address and mask attribute lengths
Sanghyun Park <[email protected]>
xfrm: policy: fix use-after-free on inexact bin in xfrm_policy_bysel_ctx()
Brian Foster <[email protected]>
iomap: don't revert iov_iter on partially completed buffered writes
Mark Rutland <[email protected]>
arm64: tlb: Optimize ARM64_WORKAROUND_REPEAT_TLBI
Mark Rutland <[email protected]>
arm64: tlb: Allow XZR argument to TLBI ops
Marc Zyngier <[email protected]>
KVM: arm64: Remove VPIPT I-cache handling
Weiming Shi <[email protected]>
tap: free page on error paths in tap_get_user_xdp()
Minh Nguyen <[email protected]>
net: skbuff: fix missing zerocopy reference in pskb_carve helpers
Kuen-Han Tsai <[email protected]>
usb: gadget: u_ether: Fix NULL pointer deref in eth_get_drvinfo
Kuen-Han Tsai <[email protected]>
usb: gadget: f_ncm: Fix net_device lifecycle with device_move
Edward Lo <[email protected]>
fs/ntfs3: Return error for inconsistent extended attributes
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
Aleksandr Nogikh <[email protected]>
signal: clear JOBCTL_PENDING_MASK for caller in zap_other_threads()
Rui Qi <[email protected]>
ipmi: Fix rcu_read_unlock to srcu_read_unlock in handle_read_event_rsp
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
Kurt Kanzenbach <[email protected]>
ptp: vclock: Switch from RCU to SRCU
Eric Dumazet <[email protected]>
ipv4: restrict IPOPT_SSRR and IPOPT_LSRR options
Luiz Augusto von Dentz <[email protected]>
Bluetooth: MGMT: Fix backward compatibility with userspace
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()
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]>
net: Annotate sk->sk_write_space() for UDP SOCKMAP.
Oscar Maes <[email protected]>
pcnet32: stop holding device spin lock during napi_complete_done
Yicong Hui <[email protected]>
drm/imx: Fix three kernel-doc warnings in dcss-scaler.c
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
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
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
Nathan Chancellor <[email protected]>
Disable -Wattribute-alias for clang-23 and newer
Vinicius Costa Gomes <[email protected]>
dmaengine: idxd: Fix not releasing workqueue on .release()
Johan Hovold <[email protected]>
USB: serial: mct_u232: fix memory corruption with small endpoint
Kuniyuki Iwashima <[email protected]>
bpf: Free reuseport cBPF prog after RCU grace period.
Michal Pecio <[email protected]>
usb: core: Fix SuperSpeed root hub wMaxPacketSize
Jiayuan Chen <[email protected]>
bpf/bonding: reject vlan+srcmac xmit_hash_policy change when XDP is loaded
Maciej W. Rozycki <[email protected]>
serial: dz: Fix bootconsole handover lockup
Johan Hovold <[email protected]>
USB: serial: cypress_m8: fix memory corruption with small endpoint
Pablo Neira Ayuso <[email protected]>
netfilter: nf_tables: restore set elements when delete set fails
Wei-Cheng Chen <[email protected]>
xhci: tegra: Fix ghost USB device on dual-role port unplug
Johan Hovold <[email protected]>
USB: serial: digi_acceleport: fix memory corruption with small endpoints
Vladislav Nikolaev <[email protected]>
RDMA/rxe: Complete the rxe_cleanup_task backport
Nathan Chancellor <[email protected]>
HID: core: Fix size_t specifier in hid_report_raw_event()
Benjamin Tissoires <[email protected]>
HID: pass the buffer size to hid_report_raw_event
Vicki Pfau <[email protected]>
HID: core: Add printk_ratelimited variants to hid_warn() etc
Maciej W. Rozycki <[email protected]>
serial: zs: Switch to using channel reset
Maciej W. Rozycki <[email protected]>
serial: zs: Fix bootconsole handover lockup
Maciej W. Rozycki <[email protected]>
serial: dz: Fix bootconsole message clobbering at chip reset
David Francis <[email protected]>
drm/amdkfd: Check for pdd drm file first in CRIU restore path
Eric Huang <[email protected]>
drm/amdkfd: fix NULL pointer bug in svm_range_set_attr
Shitalkumar Gandhi <[email protected]>
serial: fsl_lpuart: fix rx buffer and DMA map leaks in start_rx_dma
Maciej W. Rozycki <[email protected]>
serial: zs: Fix swapped RI/DSR modem line transition counting
Hongling Zeng <[email protected]>
serial: sh-sci: fix memory region release in error path
Myeonghun Pak <[email protected]>
serial: altera_jtaguart: handle uart_add_one_port() failures
Timur Kristóf <[email protected]>
drm/amd/pm/si: Disregard vblank time when no displays are connected
Janusz Krzysztofik <[email protected]>
drm/i915: Fix potential UAF in TTM object purge
Berkant Koc <[email protected]>
drm/hyperv: validate VMBus packet size in receive callback
Berkant Koc <[email protected]>
drm/hyperv: validate resolution_count and fix WIN8 fallback
Alexandru Hossu <[email protected]>
scsi: target: iscsi: Validate CHAP_R length before base64 decode
Michael Bommarito <[email protected]>
scsi: target: iscsi: Bound iscsi_encode_text_output() appends to rsp_buf
Michael Bommarito <[email protected]>
scsi: scsi_transport_fc: Widen FPIN pname walker counter to u32
Michael Bommarito <[email protected]>
scsi: fcoe: Reject FIP descriptors with zero fip_dlen in CVL walker
Michael Bommarito <[email protected]>
thunderbolt: property: Reject dir_len < 4 to prevent size_t underflow
Michael Bommarito <[email protected]>
thunderbolt: property: Reject u32 wrap in tb_property_entry_valid()
Michael Bommarito <[email protected]>
usb: gadget: f_fs: copy only received bytes on short ep0 read
Seungjin Bae <[email protected]>
usb: gadget: dummy_hcd: Reject hub port requests for non-existent ports
Guangshuo Li <[email protected]>
usb: gadget: net2280: Fix double free in probe error path
Johan Hovold <[email protected]>
USB: serial: mct_u232: fix missing interrupt-in transfer sanity check
Johan Hovold <[email protected]>
USB: serial: mxuport: fix memory corruption with small endpoint
Johan Hovold <[email protected]>
USB: serial: keyspan: fix missing indat transfer sanity check
Zhang Cen <[email protected]>
USB: serial: cypress_m8: validate interrupt packet headers
Zhang Cen <[email protected]>
USB: serial: belkin_sa: validate interrupt status length
Wanquan Zhong <[email protected]>
USB: serial: option: add missing RSVD(5) flag for Rolling RW135R-GL
Jan Volckaert <[email protected]>
USB: serial: option: add MeiG SRM813Q
Heitor Alves de Siqueira <[email protected]>
usb: usbtmc: reject interrupt endpoints with small wMaxPacketSize
Heitor Alves de Siqueira <[email protected]>
usb: usbtmc: check URB actual_length for interrupt-IN notifications
Michael Bommarito <[email protected]>
usbip: vudc: Fix use after free bug in vudc_remove due to race condition
Sam Burkels <[email protected]>
usb: storage: Add quirks for PNY Elite Portable SSD
Stephen J. Fuhry <[email protected]>
USB: quirks: add NO_LPM for Lenovo ThinkPad USB-C Dock Gen2 hub controllers
Michal Pecio <[email protected]>
usb: core: Fix up Interrupt IN endpoints with bogus wBytesPerInterval
Xu Yang <[email protected]>
usb: chipidea: core: convert ci_role_switch to local variable
Zhaoyang Yu <[email protected]>
tty: serial: pch_uart: add check for dma_alloc_coherent()
Guangshuo Li <[email protected]>
counter: Fix refcount leak in counter_alloc() error path
Ian Abbott <[email protected]>
comedi: comedi_test: Fix limiting of convert_arg in waveform_ai_cmdtest()
Ian Abbott <[email protected]>
comedi: comedi_test: fix check for valid scan_begin_src in waveform_ai_cmdtest()
Nicolás Bazaes <[email protected]>
Input: synaptics - add LEN2058 to SMBus passlist for ThinkPad E490
Dmitry Torokhov <[email protected]>
Input: atmel_mxt_ts - fix boundary check in mxt_prepare_cfg_mem
Jingguo Tan <[email protected]>
xfrm: esp: restore combined single-frag length gate
Srinivas Kandagatla <[email protected]>
ASoC: qcom: q6asm-dai: do not set stream state in event and trigger callbacks
Srinivas Kandagatla <[email protected]>
ASoC: qcom: q6asm-dai: close stream only when running
Hamza Mahfooz <[email protected]>
netfilter: conntrack: tcp: do not force CLOSE on invalid-seq RST without direction check
Michael Bommarito <[email protected]>
xfrm: ah: use skb_to_full_sk in async output callbacks
Maoyi Xie <[email protected]>
xfrm: route MIGRATE notifications to caller's netns
Ashutosh Desai <[email protected]>
nfc: hci: fix out-of-bounds read in HCP header parsing
Arnd Bergmann <[email protected]>
iommu, debugobjects: avoid gcc-16.1 section mismatch warnings
Lee Jones <[email protected]>
HID: wacom: Fix OOB write in wacom_hid_set_device_mode()
Kuniyuki Iwashima <[email protected]>
ip6: vti: Use ip6_tnl.net in vti6_changelink().
Zhengchuan Liang <[email protected]>
xfrm: input: hold netns during deferred transport reinjection
Qi Tang <[email protected]>
ipv6: validate extension header length before copying to cmsg
Maoyi Xie <[email protected]>
ip6: vti: Use ip6_tnl.net in vti6_siocdevprivate().
Zhengchuan Liang <[email protected]>
ipv6: exthdrs: refresh nh after handling HAO option
Srinivas Kandagatla <[email protected]>
ASoC: qcom: q6asm-dai: fix error handling in prepare and set_params
Justin Iurman <[email protected]>
ipv6: exthdrs: refresh nh pointer after ipv6_hop_jumbo()
Junrui Luo <[email protected]>
macsec: fix replay protection at XPN lower-PN wrap
Yuqi Xu <[email protected]>
bpf: sockmap: fix tail fragment offset in bpf_msg_push_data
Dmitry Torokhov <[email protected]>
Input: elan_i2c - validate firmware size before use
Dan Carpenter <[email protected]>
usb: dwc2: Fix use after free in debug code
Peter Chen <[email protected]>
usb: cdns3: plat: fix unbalanced pm_runtime_forbid() call permanently leaks the runtime PM usage counter across bind/unbind cycles
Yongchao Wu <[email protected]>
usb: cdns3: gadget: fix request skipping after clearing halt
Johan Hovold <[email protected]>
USB: serial: omninet: fix memory corruption with small endpoint
Felix Gu <[email protected]>
iio: buffer: hw-consumer: fix use-after-free in error path
Aldo Conte <[email protected]>
iio: light: cm3323: fix reg_conf not being initialized correctly
Advait Dhamorikar <[email protected]>
iio: magnetometer: st_magn: fix default DRDY pin selection for LIS2MDL
Salah Triki <[email protected]>
iio: temperature: tsys01: fix broken PROM checksum validation
Sanjay Chitroda <[email protected]>
iio: ssp_sensors: cancel delayed work_refresh on remove
David Carlier <[email protected]>
iio: gyro: itg3200: fix i2c read into the wrong stack location
Salah Triki <[email protected]>
iio: adc: viperboard: Fix error handling in vprbrd_iio_read_raw
Rodrigo Alencar <[email protected]>
iio: dac: ad5686: acquire lock when doing powerdown control
Rodrigo Alencar <[email protected]>
iio: dac: ad5686: fix input raw value check
Salah Triki <[email protected]>
iio: dac: max5821: fix return value check in powerdown sync
Christofer Jonason <[email protected]>
iio: adc: xilinx-xadc: Fix sequencer mode in postdisable for dual mux
Jason A. Donenfeld <[email protected]>
wireguard: send: append trailer after expanding head
Wentao Guan <[email protected]>
USB: cdc-acm: Fix bit overlap and move quirk definitions to header
Ben Hutchings <[email protected]>
parport: Fix race between port and client registration
Muhammad Bilal <[email protected]>
Bluetooth: ISO: serialize iso_sock_clear_timer with socket lock
Muhammad Bilal <[email protected]>
Bluetooth: ISO: fix UAF in iso_recv_frame
Muhammad Bilal <[email protected]>
Bluetooth: HIDP: fix missing length checks in hidp_input_report()
Siwei Zhang <[email protected]>
Bluetooth: L2CAP: fix chan ref leak in l2cap_chan_timeout() on !conn
Siwei Zhang <[email protected]>
Bluetooth: L2CAP: use chan timer to close channels in cleanup_listen()
Stepan Ionichev <[email protected]>
auxdisplay: line-display: fix OOB read on zero-length message_store()
Linpu Yu <[email protected]>
ipc: limit next_id allocation to the valid ID range
Mikulas Patocka <[email protected]>
hpfs: fix a crash if hpfs_map_dnode_bitmap fails
Shuai Zhang <[email protected]>
Bluetooth: btusb: Allow firmware re-download when version matches
hlleng <[email protected]>
HID: quirks: Add ALWAYS_POLL quirk for SIGMACHIP USB mouse
Thomas Fourier <[email protected]>
Input: ims-pcu - fix usb_free_coherent() size in ims_pcu_buffers_free()
Johan Hovold <[email protected]>
USB: serial: safe_serial: fix memory corruption with small endpoint
Greg Kroah-Hartman <[email protected]>
usb: typec: ucsi: validate connector number in ucsi_connector_change()
Greg Kroah-Hartman <[email protected]>
usb: typec: wcove: don't write past struct pd_message in wcove_read_rx_buffer()
Greg Kroah-Hartman <[email protected]>
usb: typec: altmodes/displayport: validate count before reading Status Update VDO
Greg Kroah-Hartman <[email protected]>
usb: typec: ucsi: displayport: NAK DP_CMD_CONFIGURE without a payload VDO
Greg Kroah-Hartman <[email protected]>
usb: typec: ucsi: ccg: reject firmware images without a ':' record header
Greg Kroah-Hartman <[email protected]>
iio: imu: st_lsm6dsx: fix stack leak in tagged FIFO buffer
Abdurrahman Hussain <[email protected]>
hwmon: (pmbus/adm1266) serialize NVMEM blackbox read with pmbus_lock
Abdurrahman Hussain <[email protected]>
hwmon: (pmbus/adm1266) serialize sequencer_state debugfs read with pmbus_lock
Abdurrahman Hussain <[email protected]>
hwmon: (pmbus/adm1266) serialize GPIO PMBus accesses with pmbus_lock
Horatiu Vultur <[email protected]>
phy: mscc: Use PHY_ID_MATCH_EXACT for VSC8584, VSC8582, VSC8575, VSC856X
Harini Katakam <[email protected]>
phy: mscc: Use PHY_ID_MATCH_VENDOR to minimize PHY ID table
Sabrina Dubroca <[email protected]>
net: gro: don't merge zcopy skbs
Jiasheng Jiang <[email protected]>
RDMA/rxe: Fix double free in rxe_srq_from_init
Ben Hutchings <[email protected]>
Revert "RDMA/rxe: Fix double free in rxe_srq_from_init"
Jouni Högander <[email protected]>
drm/i915/psr: Apply Intel DPCD workaround when SDP on prior line used
Jouni Högander <[email protected]>
drm/i915/psr: Read Intel DPCD workaround register
Suraj Kandpal <[email protected]>
drm/dp: Add eDP 1.5 bit definition
Jouni Högander <[email protected]>
drm/i915/psr: Add defininitions for INTEL_WA_REGISTER_CAPS DPCD register
Bingquan Chen <[email protected]>
net/packet: fix TOCTOU race on mmap'd vnet_hdr in tpacket_snd()
Eric Dumazet <[email protected]>
net/packet: convert po->running to an atomic flag
Eric Dumazet <[email protected]>
net/packet: convert po->has_vnet_hdr to an atomic flag
Eric Dumazet <[email protected]>
net/packet: convert po->tp_loss to an atomic flag
Eric Dumazet <[email protected]>
net/packet: convert po->tp_tx_has_off to an atomic flag
Martin KaFai Lau <[email protected]>
selftests/bpf: S/iptables/iptables-legacy/ in the bpf_nf and xdp_synproxy test
Daniel Borkmann <[email protected]>
selftests/bpf: Fix ARG_PTR_TO_LONG {half-,}uninitialized test
Paul Chaignon <[email protected]>
Revert "selftests/bpf: Add a cgroup prog bpf_get_ns_current_pid_tgid() test"
Andrii Nakryiko <[email protected]>
selftests/bpf: enhance align selftest's expected log matching
Stanislav Fomichev <[email protected]>
selftests/bpf: Update bpf_clone_redirect expected return code
Yonghong Song <[email protected]>
bpf: Fix a few selftest failures due to llvm18 change
Jiri Olsa <[email protected]>
selftests/bpf: Add read_build_id function
Paul Chaignon <[email protected]>
Revert "selftests/bpf: Add tests for _opts variants of bpf_*_get_fd_by_id()"
Paul Chaignon <[email protected]>
Revert "selftests/bpf: Workaround strict bpf_lsm return value check."
Andrii Nakryiko <[email protected]>
selftests/bpf: Convert test_global_funcs test to test_loader framework
Andrii Nakryiko <[email protected]>
selftests/bpf: add generic BPF program tester-loader
Mikhail Gavrilov <[email protected]>
mm/page_alloc: clear page->private in free_pages_prepare()
Sven Eckelmann <[email protected]>
batman-adv: bla: avoid double decrement of bla.num_requests
Sven Eckelmann <[email protected]>
batman-adv: tt: avoid empty VLAN responses
Sven Eckelmann <[email protected]>
batman-adv: tt: fix TOCTOU race for reported vlans
Sven Eckelmann <[email protected]>
batman-adv: tp_meter: directly shut down timer on cleanup
Petr Machata <[email protected]>
selftests: forwarding: lib: Add helpers for checksum handling
Sven Eckelmann <[email protected]>
batman-adv: iv: recover OGM scheduling after forward packet error
Sven Eckelmann <[email protected]>
batman-adv: tvlv: reject oversized TVLV packets
Sven Eckelmann <[email protected]>
batman-adv: bla: avoid NULL-ptr deref for claim via dropped interface
Sven Eckelmann <[email protected]>
batman-adv: tt: reject oversized local TVLV buffers
Sven Eckelmann <[email protected]>
batman-adv: tvlv: abort OGM send on tvlv append failure
Sven Eckelmann <[email protected]>
batman-adv: v: stop OGMv2 on disabled interface
Pavel Begunkov <[email protected]>
net: skbuff: fix pskb_carve leaking zcopy pages
Jiayuan Chen <[email protected]>
ipv6: fix possible infinite loop in fib6_select_path()
Jiayuan Chen <[email protected]>
ipv6: fix possible infinite loop in rt6_fill_node()
Zhenghang Xiao <[email protected]>
sctp: fix race between sctp_wait_for_connect and peeloff
Dipayaan Roy <[email protected]>
net: mana: Add NULL guards in teardown path to prevent panic on attach failure
Marco Scardovi <[email protected]>
gpio: rockchip: convert bank->clk to devm_clk_get_enabled()
Luiz Augusto von Dentz <[email protected]>
Bluetooth: L2CAP: Fix possible crash on l2cap_ecred_conn_rsp
Zhenghang Xiao <[email protected]>
Bluetooth: l2cap: clear chan->ident on ECRED reconfiguration success
Jamal Hadi Salim <[email protected]>
net/sched: Revert "net/sched: Restrict conditions for adding duplicating netems to qdisc tree"
Rahul Chandelkar <[email protected]>
ipv6: rpl: fix hdrlen overflow in ipv6_rpl_srh_decompress()
Jakub Kicinski <[email protected]>
ethtool: eeprom: add more safeties to EEPROM Netlink fallback
Oliver Hartkopp <[email protected]>
bonding: refuse to enslave CAN devices
Zhao Dongdong <[email protected]>
Bluetooth: 6lowpan: check skb_clone() return value in send_mcast_pkt()
Cássio Gabriel <[email protected]>
ASoC: codecs: simple-mux: Fix enum control bounds check
Eric Dumazet <[email protected]>
tunnels: do not assume transport header in iptunnel_pmtud_check_icmp()
Eric Dumazet <[email protected]>
vxlan: do not reuse cached ip_hdr() value after skb_tunnel_check_pmtu()
Eric Dumazet <[email protected]>
tunnels: load network headers after skb_cow() in iptunnel_pmtud_build_icmp[v6]()
Luka Gejak <[email protected]>
net: hsr: fix potential OOB access in supervision frame handling
Cássio Gabriel <[email protected]>
ASoC: Intel: bytcht_es8316: Fix MCLK leak on init errors
Eric Dumazet <[email protected]>
ipv4: free net->ipv4.sysctl_local_reserved_ports after unregister_net_sysctl_table()
Breno Leitao <[email protected]>
net/iucv: fix locking in .getsockopt
Alexandra Winter <[email protected]>
net/smc: Do not re-initialize smc hashtables
Ilya Maximets <[email protected]>
net: netlink: don't set nsid on local notifications
Ilya Maximets <[email protected]>
net: netlink: fix sending unassigned nsid after assigned one
Weiming Shi <[email protected]>
tun: free page on build_skb failure in tun_xdp_one()
Weiming Shi <[email protected]>
tun: free page on short-frame rejection in tun_xdp_one()
Florian Westphal <[email protected]>
netfilter: ebtables: fix OOB read in compat_mtw_from_user
Florian Westphal <[email protected]>
netfilter: xt_cpu: prefer raw_smp_processor_id
Chris Mason <[email protected]>
netfilter: synproxy: refresh tcphdr after skb_ensure_writable
Hongtao Lee <[email protected]>
tools/bootconfig: Fix buf leaks in apply_xbc
Masami Hiramatsu (Google) <[email protected]>
tools/bootconfig: Cleanup bootconfig footer size calculations
Carl Lee <[email protected]>
nfc: nxp-nci: i2c: use rising-edge IRQ on ACPI systems
David Ahern <[email protected]>
xfrm: Check for underflow in xfrm_state_mtu
Lee Jones <[email protected]>
nfc: llcp: Fix use-after-free race in nfc_llcp_recv_cc()
Lee Jones <[email protected]>
nfc: llcp: Fix use-after-free in llcp_sock_release()
Kevin Hao <[email protected]>
net: cpsw_new: Fix potential unregister of netdev that has not been registered yet
Carlos Eduardo Gallo Filho <[email protected]>
drm: Remove plane hsub/vsub alignment requirement for core helpers
Victor Nogueria <[email protected]>
net/sched: sch_sfb: Replace direct dequeue call with peek and qdisc_dequeue_peeked
Jeremy Kerr <[email protected]>
net: mctp: ensure our nlmsg responses are initialised
Davide Caratti <[email protected]>
net/sched: cls_fw: fix NULL dereference of "old" filters before change()
Greg Kroah-Hartman <[email protected]>
Input: usbtouchscreen - clamp NEXIO data_len/x_len to URB buffer size
-------------
Diffstat:
Documentation/arm64/silicon-errata.rst | 46 ++++ Makefile | 4 +- arch/arm/include/asm/io.h | 15 +- arch/arm/kernel/entry-armv.S | 2 +- arch/arm/mach-socfpga/platsmp.c | 1 + arch/arm64/Kconfig | 50 +++++ arch/arm64/include/asm/cputype.h | 6 + arch/arm64/include/asm/kvm_mmu.h | 4 +- arch/arm64/include/asm/tlb.h | 2 +- arch/arm64/include/asm/tlbflush.h | 52 +++-- arch/arm64/kernel/cpu_errata.c | 34 ++- arch/arm64/kernel/sys_compat.c | 2 +- arch/arm64/kvm/arm.c | 5 + arch/arm64/kvm/hyp/nvhe/tlb.c | 41 +--- arch/arm64/kvm/hyp/pgtable.c | 2 +- arch/arm64/kvm/hyp/vhe/tlb.c | 19 +- arch/arm64/mm/mmu.c | 36 ++-- arch/loongarch/kernel/syscall.c | 3 +- arch/x86/kernel/cpu/amd.c | 18 +- block/blk-cgroup.c | 32 +-- drivers/auxdisplay/line-display.c | 2 +- drivers/base/power/domain.c | 10 +- drivers/bluetooth/btusb.c | 8 +- drivers/bluetooth/hci_qca.c | 33 ++- drivers/char/ipmi/ipmi_msghandler.c | 2 +- drivers/char/ipmi/ipmi_ssif.c | 42 ++-- drivers/comedi/drivers/comedi_test.c | 5 +- drivers/counter/counter-core.c | 3 +- drivers/crypto/caam/caamalg_qi2.c | 4 +- drivers/crypto/caam/caamhash.c | 4 +- drivers/crypto/nx/nx-842.c | 47 +++-- drivers/crypto/nx/nx-842.h | 24 ++- drivers/crypto/nx/nx-common-powernv.c | 31 ++- drivers/crypto/nx/nx-common-pseries.c | 33 ++- drivers/dma/idxd/init.c | 1 - drivers/dma/idxd/sysfs.c | 1 + drivers/gpio/gpio-rockchip.c | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 4 +- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 10 +- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 3 + .../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_parser2.c | 54 +++-- .../gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c | 3 +- drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c | 4 + drivers/gpu/drm/hyperv/hyperv_drm_proto.c | 113 ++++++++-- drivers/gpu/drm/i915/display/intel_display_types.h | 1 + drivers/gpu/drm/i915/display/intel_dpcd.h | 15 ++ drivers/gpu/drm/i915/display/intel_psr.c | 34 ++- drivers/gpu/drm/i915/gem/i915_gem_phys.c | 19 +- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 28 +-- drivers/gpu/drm/imx/dcss/dcss-scaler.c | 3 + drivers/gpu/drm/v3d/v3d_gem.c | 5 + drivers/gpu/drm/vc4/vc4_validate_shaders.c | 13 +- drivers/hid/hid-core.c | 33 ++- drivers/hid/hid-gfrm.c | 4 +- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-logitech-hidpp.c | 2 +- drivers/hid/hid-multitouch.c | 2 +- drivers/hid/hid-primax.c | 2 +- drivers/hid/hid-quirks.c | 1 + drivers/hid/hid-vivaldi-common.c | 2 +- drivers/hid/wacom_sys.c | 19 +- drivers/hid/wacom_wac.h | 1 + drivers/hwmon/pmbus/adm1266.c | 56 ++++- 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/iio/adc/bcm_iproc_adc.c | 4 +- drivers/iio/adc/lpc32xx_adc.c | 4 +- drivers/iio/adc/npcm_adc.c | 31 +-- drivers/iio/adc/spear_adc.c | 4 +- drivers/iio/adc/viperboard_adc.c | 4 +- drivers/iio/adc/xilinx-xadc-core.c | 11 +- drivers/iio/buffer/industrialio-hw-consumer.c | 4 +- drivers/iio/chemical/scd30_core.c | 65 +++--- drivers/iio/common/ssp_sensors/ssp_dev.c | 1 + drivers/iio/dac/ad5686.c | 16 +- drivers/iio/dac/ad5686.h | 1 + drivers/iio/dac/max5821.c | 9 +- drivers/iio/gyro/adis16260.c | 3 + drivers/iio/gyro/itg3200_buffer.c | 2 +- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 2 +- drivers/iio/light/cm3323.c | 5 +- drivers/iio/magnetometer/st_magn_core.c | 13 +- drivers/iio/temperature/tsys01.c | 2 +- drivers/infiniband/core/Makefile | 2 +- drivers/infiniband/core/iter.c | 43 ++++ 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/irdma/main.h | 2 +- drivers/infiniband/hw/mlx4/mr.c | 1 + drivers/infiniband/hw/mlx5/mem.c | 1 + 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_qp.c | 4 +- drivers/infiniband/sw/rxe/rxe_srq.c | 3 - drivers/infiniband/ulp/isert/ib_isert.c | 6 + drivers/infiniband/ulp/srp/ib_srp.c | 30 ++- drivers/input/keyboard/atkbd.c | 15 ++ drivers/input/misc/ims-pcu.c | 2 +- drivers/input/mouse/elan_i2c_core.c | 5 + drivers/input/mouse/synaptics.c | 1 + drivers/input/touchscreen/atmel_mxt_ts.c | 2 +- drivers/input/touchscreen/usbtouchscreen.c | 5 + drivers/iommu/io-pgtable-arm-v7s.c | 18 +- drivers/md/dm-cache-policy-smq.c | 12 +- drivers/media/rc/igorplugusb.c | 16 +- drivers/media/rc/ttusbir.c | 13 +- drivers/misc/fastrpc.c | 102 +++++---- drivers/mmc/core/mmc.c | 4 +- drivers/mmc/host/litex_mmc.c | 20 +- drivers/mmc/host/renesas_sdhi_internal_dmac.c | 1 + drivers/mmc/host/sdhci.c | 1 + drivers/mtd/spi-nor/core.c | 1 + drivers/mtd/spi-nor/debugfs.c | 4 +- drivers/net/bonding/bond_main.c | 19 +- drivers/net/bonding/bond_options.c | 2 + drivers/net/ethernet/amd/pcnet32.c | 4 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- drivers/net/ethernet/freescale/fec_main.c | 3 +- drivers/net/ethernet/intel/ice/ice_virtchnl.c | 2 +- drivers/net/ethernet/marvell/mv643xx_eth.c | 2 +- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 75 ++++--- drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 13 +- 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 | 32 +-- .../net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c | 2 +- .../ethernet/marvell/octeontx2/nic/otx2_common.c | 2 + drivers/net/ethernet/mellanox/mlx4/cq.c | 9 +- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 6 +- drivers/net/ethernet/microchip/lan743x_main.c | 32 +++ drivers/net/ethernet/microchip/lan743x_main.h | 1 + drivers/net/ethernet/microsoft/mana/mana_en.c | 72 ++++--- drivers/net/ethernet/stmicro/stmmac/chain_mode.c | 2 +- drivers/net/ethernet/stmicro/stmmac/common.h | 2 +- drivers/net/ethernet/stmicro/stmmac/ring_mode.c | 2 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 47 +++-- drivers/net/ethernet/ti/cpsw_new.c | 4 +- drivers/net/hyperv/netvsc.c | 19 +- drivers/net/macsec.c | 3 +- drivers/net/phy/mscc/mscc.h | 9 +- drivers/net/phy/mscc/mscc_main.c | 38 +--- drivers/net/tap.c | 2 + drivers/net/tun.c | 5 +- drivers/net/usb/r8152.c | 211 ++++++++++++++++--- drivers/net/vxlan/vxlan_core.c | 4 +- drivers/net/vxlan/vxlan_vnifilter.c | 5 +- drivers/net/wireguard/send.c | 20 +- .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 4 + drivers/net/wireless/marvell/mwifiex/init.c | 2 +- drivers/net/wwan/t7xx/t7xx_modem_ops.c | 17 +- drivers/net/wwan/t7xx/t7xx_port_ctrl_msg.c | 18 +- drivers/net/wwan/t7xx/t7xx_port_proxy.h | 2 +- drivers/nfc/nxp-nci/i2c.c | 21 +- drivers/parport/share.c | 11 +- drivers/phy/tegra/xusb-tegra186.c | 38 +++- drivers/phy/tegra/xusb.h | 1 + drivers/platform/x86/intel/vsec.c | 77 +++++-- drivers/platform/x86/intel/vsec.h | 2 +- drivers/ptp/ptp_vclock.c | 14 +- drivers/scsi/fcoe/fcoe_ctlr.c | 2 +- drivers/scsi/scsi_transport_fc.c | 77 +++---- drivers/slimbus/qcom-ngd-ctrl.c | 5 +- drivers/spi/spi-amd.c | 2 +- drivers/spi/spi-cavium-thunderx.c | 2 +- drivers/spi/spi-falcon.c | 2 +- drivers/spi/spi-imx.c | 8 +- drivers/spi/spi-lantiq-ssc.c | 8 +- drivers/spi/spi-lp8841-rtc.c | 2 +- drivers/spi/spi-microchip-core-qspi.c | 47 ++--- drivers/spi/spi-mxs.c | 2 +- drivers/spi/spi-omap-uwire.c | 2 +- drivers/spi/spi-pic32-sqi.c | 2 +- drivers/spi/spi-qcom-qspi.c | 2 +- drivers/spi/spi-qup.c | 169 +++++++-------- drivers/spi/spi-rockchip-sfc.c | 2 +- drivers/spi/spi-s3c64xx.c | 44 +--- drivers/spi/spi-sprd-adi.c | 2 +- drivers/spi/spi-st-ssc4.c | 76 +++---- drivers/spi/spi-sun4i.c | 84 ++++---- drivers/spi/spi-sun6i.c | 9 +- drivers/spi/spi-synquacer.c | 92 ++++---- drivers/spi/spi-tegra114.c | 8 +- drivers/spi/spi-tegra20-sflash.c | 8 +- drivers/spi/spi-ti-qspi.c | 97 +++++---- drivers/spi/spi-topcliff-pch.c | 6 +- drivers/spi/spi-uniphier.c | 216 ++++++++++--------- drivers/spi/spi-xcomm.c | 2 +- drivers/spi/spi-zynq-qspi.c | 89 +++----- drivers/spi/spi-zynqmp-gqspi.c | 4 +- drivers/spi/spi.c | 61 +++--- drivers/staging/greybus/hid.c | 2 +- drivers/target/iscsi/iscsi_target.c | 6 +- drivers/target/iscsi/iscsi_target_auth.c | 19 +- drivers/target/iscsi/iscsi_target_nego.c | 7 +- drivers/target/iscsi/iscsi_target_parameters.c | 62 ++++-- drivers/target/iscsi/iscsi_target_parameters.h | 2 +- drivers/tee/optee/supp.c | 107 +++++++--- drivers/thermal/thermal_core.c | 7 +- drivers/thunderbolt/property.c | 38 +++- drivers/thunderbolt/xdomain.c | 14 +- drivers/tty/serial/altera_jtaguart.c | 7 +- drivers/tty/serial/dz.c | 57 ++--- drivers/tty/serial/fsl_lpuart.c | 15 +- drivers/tty/serial/pch_uart.c | 19 +- drivers/tty/serial/qcom_geni_serial.c | 75 +++---- drivers/tty/serial/samsung_tty.c | 130 ++++++------ drivers/tty/serial/sh-sci.c | 2 +- drivers/tty/serial/zs.c | 40 ++-- drivers/tty/serial/zs.h | 2 +- drivers/usb/cdns3/cdns3-gadget.c | 12 +- drivers/usb/cdns3/cdns3-plat.c | 11 +- drivers/usb/chipidea/core.c | 16 +- drivers/usb/class/cdc-acm.c | 2 - drivers/usb/class/cdc-acm.h | 2 + drivers/usb/class/usbtmc.c | 14 ++ drivers/usb/core/config.c | 9 +- drivers/usb/core/hcd.c | 4 +- drivers/usb/core/quirks.c | 4 + drivers/usb/dwc2/hcd.c | 4 +- drivers/usb/dwc3/core.c | 12 +- drivers/usb/dwc3/dwc3-xilinx.c | 26 +-- drivers/usb/gadget/function/f_fs.c | 2 +- drivers/usb/gadget/function/f_hid.c | 20 +- drivers/usb/gadget/function/f_ncm.c | 33 ++- drivers/usb/gadget/function/u_ether.c | 28 ++- drivers/usb/gadget/function/u_ether.h | 26 +++ drivers/usb/gadget/function/u_ncm.h | 2 +- drivers/usb/gadget/udc/dummy_hcd.c | 4 + drivers/usb/gadget/udc/net2280.c | 4 +- drivers/usb/host/xhci-tegra.c | 76 ++++--- drivers/usb/musb/omap2430.c | 3 +- drivers/usb/serial/belkin_sa.c | 3 + drivers/usb/serial/cypress_m8.c | 20 +- drivers/usb/serial/digi_acceleport.c | 23 +- drivers/usb/serial/io_ti.c | 11 + drivers/usb/serial/keyspan.c | 4 + drivers/usb/serial/kl5kusb105.c | 4 +- drivers/usb/serial/mct_u232.c | 26 ++- drivers/usb/serial/mxuport.c | 8 + drivers/usb/serial/omninet.c | 9 +- drivers/usb/serial/option.c | 12 +- drivers/usb/serial/safe_serial.c | 11 + drivers/usb/storage/unusual_uas.h | 7 + drivers/usb/typec/altmodes/displayport.c | 2 + drivers/usb/typec/tcpm/tcpm.c | 2 + drivers/usb/typec/tcpm/wcove.c | 13 +- drivers/usb/typec/ucsi/displayport.c | 4 + drivers/usb/typec/ucsi/ucsi.c | 24 ++- drivers/usb/typec/ucsi/ucsi_ccg.c | 5 + drivers/usb/usbip/vudc_dev.c | 1 + drivers/usb/usbip/vudc_transfer.c | 3 +- drivers/video/fbdev/core/fb_defio.c | 164 +++++++++++++-- drivers/video/fbdev/core/fbcon_rotate.c | 5 +- drivers/video/fbdev/vt8500lcdfb.c | 2 +- fs/btrfs/inode.c | 2 + fs/btrfs/ioctl.c | 5 +- fs/btrfs/space-info.c | 8 +- fs/btrfs/sysfs.c | 5 +- fs/btrfs/sysfs.h | 3 +- fs/ceph/dir.c | 6 +- fs/erofs/decompressor.c | 1 + fs/f2fs/data.c | 4 +- fs/f2fs/f2fs.h | 5 +- fs/f2fs/inline.c | 13 +- fs/f2fs/node.c | 4 +- fs/f2fs/segment.c | 10 +- fs/f2fs/super.c | 29 ++- fs/fcntl.c | 8 +- fs/fuse/dev.c | 9 +- fs/hfsplus/bfind.c | 51 +++++ fs/hfsplus/catalog.c | 4 +- fs/hfsplus/dir.c | 2 +- fs/hfsplus/hfsplus_fs.h | 9 + fs/hfsplus/super.c | 6 +- fs/hpfs/alloc.c | 2 +- fs/iomap/buffered-io.c | 4 - fs/ntfs3/xattr.c | 1 + fs/smb/client/cifsacl.c | 128 +++++++++-- fs/smb/client/ioctl.c | 2 +- fs/smb/client/netlink.c | 6 +- fs/smb/client/smb2transport.c | 32 ++- fs/smb/server/smb2pdu.c | 11 + fs/smb/server/smbacl.c | 17 +- fs/udf/super.c | 4 +- fs/xfs/xfs_buf.c | 1 + include/drm/display/drm_dp.h | 1 + include/drm/drm_fourcc.h | 5 +- include/linux/compat.h | 4 + include/linux/compiler-clang.h | 6 + include/linux/compiler_attributes.h | 11 + include/linux/compiler_types.h | 4 + include/linux/damon.h | 2 + include/linux/fb.h | 4 +- include/linux/hid.h | 15 +- include/linux/hugetlb.h | 14 +- include/linux/mm.h | 5 - include/linux/parport.h | 1 + include/linux/printk.h | 13 ++ include/linux/syscalls.h | 4 + include/net/act_api.h | 1 + include/net/bluetooth/bluetooth.h | 1 + include/net/bluetooth/l2cap.h | 1 + include/net/bonding.h | 1 + include/net/genetlink.h | 9 +- include/net/ip_vs.h | 3 +- include/net/mctp.h | 3 + include/net/netfilter/nf_conntrack_core.h | 5 + include/net/netfilter/nf_conntrack_helper.h | 1 + include/net/sock.h | 1 + include/net/xfrm.h | 3 +- include/rdma/ib_umem.h | 36 +--- include/rdma/ib_verbs.h | 48 ----- include/rdma/iter.h | 88 ++++++++ ipc/shm.c | 10 +- ipc/util.c | 2 +- kernel/cgroup/cpuset.c | 8 +- kernel/pid.c | 8 +- kernel/sched/core.c | 2 +- kernel/sched/rt.c | 2 +- kernel/sched/sched.h | 2 +- kernel/signal.c | 1 + kernel/time/time.c | 2 +- kernel/trace/trace_probe.c | 6 + kernel/trace/trace_probe.h | 4 +- kernel/tracepoint.c | 2 + lib/debugobjects.c | 2 +- lib/mpi/mpicoder.c | 2 +- lib/test_hmm.c | 86 ++++---- mm/damon/core.c | 37 +++- mm/damon/lru_sort.c | 84 +++++--- mm/damon/ops-common.c | 4 +- mm/damon/reclaim.c | 84 +++++--- mm/gup.c | 2 +- mm/huge_memory.c | 2 + mm/hugetlb.c | 113 +++++++--- mm/memory-failure.c | 92 ++++---- mm/memory.c | 2 +- mm/memory_hotplug.c | 2 +- mm/mempolicy.c | 2 +- mm/migrate.c | 18 +- mm/page_alloc.c | 1 + net/6lowpan/iphc.c | 4 +- net/802/garp.c | 2 +- net/802/mrp.c | 9 + net/batman-adv/bat_iv_ogm.c | 82 ++++++-- net/batman-adv/bat_v_ogm.c | 59 +++--- net/batman-adv/bridge_loop_avoidance.c | 57 +++-- net/batman-adv/main.c | 1 + net/batman-adv/soft-interface.c | 1 + net/batman-adv/tp_meter.c | 109 +++++++--- net/batman-adv/tp_meter.h | 1 + net/batman-adv/translation-table.c | 43 +++- net/batman-adv/tvlv.c | 28 ++- net/batman-adv/tvlv.h | 2 +- net/batman-adv/types.h | 46 +++- net/bluetooth/6lowpan.c | 2 + net/bluetooth/af_bluetooth.c | 113 ++++++++-- net/bluetooth/bnep/core.c | 50 +++-- net/bluetooth/hci_sync.c | 5 + net/bluetooth/hci_sysfs.c | 6 +- net/bluetooth/hidp/core.c | 23 +- net/bluetooth/hidp/sock.c | 10 +- net/bluetooth/iso.c | 12 +- net/bluetooth/l2cap_core.c | 87 +++++++- net/bluetooth/l2cap_sock.c | 35 +--- net/bluetooth/mgmt.c | 17 +- net/bluetooth/rfcomm/core.c | 69 ++++-- net/bluetooth/rfcomm/sock.c | 26 ++- net/bridge/br_arp_nd_proxy.c | 8 +- net/bridge/br_fdb.c | 28 ++- net/bridge/netfilter/ebt_snat.c | 3 + net/bridge/netfilter/ebtables.c | 30 +++ net/core/drop_monitor.c | 2 +- net/core/filter.c | 17 +- net/core/gro.c | 3 + net/core/skbuff.c | 20 +- net/core/sock.c | 13 +- net/ethtool/eeprom.c | 5 +- net/hsr/hsr_forward.c | 4 +- net/hsr/hsr_framereg.c | 6 +- net/ieee802154/6lowpan/tx.c | 5 + net/ipv4/ah4.c | 31 +-- net/ipv4/esp4.c | 4 +- net/ipv4/ip_options.c | 4 + net/ipv4/ip_tunnel_core.c | 22 +- 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/sysctl_net_ipv4.c | 2 +- net/ipv4/udp.c | 8 + net/ipv6/ah6.c | 29 ++- net/ipv6/datagram.c | 54 ++++- net/ipv6/esp6.c | 4 +- net/ipv6/exthdrs.c | 21 +- net/ipv6/ip6_vti.c | 25 ++- net/ipv6/mcast.c | 8 +- net/ipv6/netfilter/ip6_tables.c | 15 +- net/ipv6/netfilter/nft_fib_ipv6.c | 2 +- net/ipv6/route.c | 5 + net/ipv6/sit.c | 1 + net/iucv/af_iucv.c | 20 +- net/key/af_key.c | 6 +- net/mac80211/mlme.c | 4 +- net/mctp/device.c | 1 + net/mctp/neigh.c | 1 + net/mctp/route.c | 9 +- net/mptcp/options.c | 43 ++-- net/mptcp/pm.c | 34 ++- net/mptcp/pm_netlink.c | 45 ++-- net/mptcp/protocol.c | 29 ++- net/mptcp/sockopt.c | 8 +- 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_ecache.c | 2 + net/netfilter/nf_conntrack_expect.c | 10 +- net/netfilter/nf_conntrack_helper.c | 19 ++ net/netfilter/nf_conntrack_irc.c | 4 +- net/netfilter/nf_conntrack_netlink.c | 28 ++- net/netfilter/nf_conntrack_proto_tcp.c | 3 +- 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 | 26 ++- net/netfilter/nf_tables_api.c | 41 +++- net/netfilter/nft_exthdr.c | 3 + net/netfilter/nft_fib.c | 6 + net/netfilter/nft_set_bitmap.c | 4 +- net/netfilter/nft_set_hash.c | 8 +- net/netfilter/nft_set_pipapo.c | 5 +- net/netfilter/nft_set_rbtree.c | 4 +- net/netfilter/nft_tunnel.c | 2 +- net/netfilter/xt_NFQUEUE.c | 2 +- net/netfilter/xt_cpu.c | 2 +- net/netlabel/netlabel_unlabeled.c | 30 +-- net/netlink/af_netlink.c | 11 +- net/netlink/genetlink.c | 4 +- net/nfc/hci/core.c | 10 + net/nfc/llcp_core.c | 11 + net/nfc/llcp_sock.c | 2 + net/nfc/nci/hci.c | 10 + net/openvswitch/datapath.c | 1 + net/packet/af_packet.c | 74 ++++--- net/packet/diag.c | 6 +- net/packet/internal.h | 8 +- net/psample/psample.c | 2 +- net/qrtr/af_qrtr.c | 4 +- net/qrtr/ns.c | 180 ++++++---------- net/rds/ib_cm.c | 1 + net/rds/ib_send.c | 2 + net/rds/info.c | 2 +- net/sched/act_api.c | 7 +- net/sched/cls_fw.c | 6 +- net/sched/sch_netem.c | 40 ---- net/sched/sch_sfb.c | 2 +- net/sctp/diag.c | 17 +- net/sctp/input.c | 8 + net/sctp/sm_statefuns.c | 6 +- net/sctp/socket.c | 2 + net/sctp/stream.c | 6 +- net/smc/af_smc.c | 21 +- net/socket.c | 11 +- net/vmw_vsock/vmci_transport.c | 4 +- net/wireless/nl80211.c | 3 + net/xfrm/espintcp.c | 4 + net/xfrm/xfrm_input.c | 16 +- net/xfrm/xfrm_policy.c | 15 +- net/xfrm/xfrm_state.c | 35 +++- net/xfrm/xfrm_user.c | 5 +- security/apparmor/policy_unpack.c | 27 +-- sound/aoa/codecs/onyx.c | 104 +++------ sound/aoa/codecs/tas.c | 113 ++++------ sound/aoa/core/gpio-feature.c | 20 +- sound/aoa/core/gpio-pmf.c | 26 +-- sound/aoa/soundbus/i2sbus/core.c | 3 + sound/aoa/soundbus/i2sbus/pcm.c | 143 ++++++------- sound/core/pcm_native.c | 7 +- sound/core/timer.c | 1 + .../motu/motu-register-dsp-message-parser.c | 14 +- sound/pci/hda/patch_hdmi.c | 1 + sound/soc/codecs/simple-mux.c | 2 +- sound/soc/codecs/wm_adsp.c | 3 + sound/soc/intel/boards/bytcht_es8316.c | 29 ++- sound/soc/qcom/qdsp6/q6asm-dai.c | 43 ++-- tools/bootconfig/main.c | 23 +- tools/perf/Makefile.config | 1 + tools/perf/util/Build | 32 ++- tools/perf/util/expr.y | 4 +- tools/perf/util/parse-events.y | 3 + tools/perf/util/pmu.y | 3 + tools/scripts/utilities.mak | 20 ++ tools/testing/selftests/bpf/DENYLIST.s390x | 1 - tools/testing/selftests/bpf/Makefile | 2 +- tools/testing/selftests/bpf/prog_tests/align.c | 18 +- tools/testing/selftests/bpf/prog_tests/bpf_nf.c | 6 +- tools/testing/selftests/bpf/prog_tests/empty_skb.c | 12 +- .../bpf/prog_tests/libbpf_get_fd_by_id_opts.c | 87 -------- .../selftests/bpf/prog_tests/ns_current_pid_tgid.c | 73 ------- .../selftests/bpf/prog_tests/test_global_funcs.c | 131 +++--------- .../selftests/bpf/prog_tests/xdp_synproxy.c | 6 +- tools/testing/selftests/bpf/progs/bpf_misc.h | 5 + .../selftests/bpf/progs/test_global_func1.c | 6 +- .../selftests/bpf/progs/test_global_func10.c | 1 + .../selftests/bpf/progs/test_global_func11.c | 4 +- .../selftests/bpf/progs/test_global_func12.c | 4 +- .../selftests/bpf/progs/test_global_func13.c | 4 +- .../selftests/bpf/progs/test_global_func14.c | 4 +- .../selftests/bpf/progs/test_global_func15.c | 4 +- .../selftests/bpf/progs/test_global_func16.c | 4 +- .../selftests/bpf/progs/test_global_func17.c | 5 +- .../selftests/bpf/progs/test_global_func2.c | 43 +++- .../selftests/bpf/progs/test_global_func3.c | 10 +- .../selftests/bpf/progs/test_global_func4.c | 55 ++++- .../selftests/bpf/progs/test_global_func5.c | 4 +- .../selftests/bpf/progs/test_global_func6.c | 4 +- .../selftests/bpf/progs/test_global_func7.c | 4 +- .../selftests/bpf/progs/test_global_func8.c | 4 +- .../selftests/bpf/progs/test_global_func9.c | 4 +- .../bpf/progs/test_libbpf_get_fd_by_id_opts.c | 37 ---- .../selftests/bpf/progs/test_ns_current_pid_tgid.c | 7 - tools/testing/selftests/bpf/test_loader.c | 233 +++++++++++++++++++++ tools/testing/selftests/bpf/test_progs.h | 33 +++ tools/testing/selftests/bpf/trace_helpers.c | 82 ++++++++ tools/testing/selftests/bpf/trace_helpers.h | 5 + tools/testing/selftests/bpf/verifier/int_ptr.c | 6 +- tools/testing/selftests/net/forwarding/lib.sh | 56 +++++ tools/testing/selftests/net/mptcp/mptcp_connect.sh | 6 +- tools/testing/selftests/ptp/testptp.c | 62 +----- tools/testing/selftests/vm/hmm-tests.c | 50 +++++ 543 files changed, 6595 insertions(+), 3687 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 2/522 net/sched: cls_fw: fix NULL dereference of "old" filters before change()
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Davide Caratti <[email protected]>
[ Upstream commit 65782b2db7321d5f97c16718c4c7f6c7205a56be ]
Like pointed out by Sashiko [1], since commit ed76f5edccc9 ("net: sched:
protect filter_chain list with filter_chain_lock mutex") TC filters are added to a shared block and published to datapath before their ->change() function is called. This is a problem for cls_fw: an invalid filter created with the "old" method can still classify some packets before it is destroyed by the validation logic added by Xiang. Therefore, insisting with repeated runs of the following script:
# ip link add dev crash0 type dummy # ip link set dev crash0 up # mausezahn crash0 -c 100000 -P 10 \
Quoted 1 line
-A 4.3.2.1 -B 1.2.3.4 -t udp "dp=1234" -q &
# sleep 1 # tc qdisc add dev crash0 egress_block 1 clsact # tc filter add block 1 protocol ip prio 1 matchall \
Quoted 1 line
action skbedit mark 65536 continue
# tc filter add block 1 protocol ip prio 2 fw # ip link del dev crash0
can still make fw_classify() hit the WARN_ON() in [2]:
WARNING: ./include/net/pkt_cls.h:88 at fw_classify+0x244/0x250 [cls_fw], CPU#18: mausezahn/1399 Modules linked in: cls_fw(E) act_skbedit(E) CPU: 18 UID: 0 PID: 1399 Comm: mausezahn Tainted: G E 7.0.0-rc6-virtme #17 PREEMPT(full) Tainted: [E]=UNSIGNED_MODULE Hardware name: Red Hat KVM, BIOS 1.16.3-2.el9 04/01/2014 RIP: 0010:fw_classify+0x244/0x250 [cls_fw] Code: 5c 49 c7 45 00 00 00 00 00 41 5d 41 5e 41 5f 5d c3 cc cc cc cc 5b b8 ff ff ff ff 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc 90 <0f> 0b 90 eb a0 0f 1f 80 00 00 00 00 90 90 90 90 90 90 90 90 90 90 RSP: 0018:ffffd1b7026bf8a8 EFLAGS: 00010202 RAX: ffff8c5ac9c60800 RBX: ffff8c5ac99322c0 RCX: 0000000000000004 RDX: 0000000000000001 RSI: ffff8c5b74d7a000 RDI: ffff8c5ac8284f40 RBP: ffffd1b7026bf8d0 R08: 0000000000000000 R09: ffffd1b7026bf9b0 R10: 00000000ffffffff R11: 0000000000000000 R12: 0000000000010000 R13: ffffd1b7026bf930 R14: ffff8c5ac8284f40 R15: 0000000000000000 FS: 00007fca40c37740(0000) GS:ffff8c5b74d7a000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fca40e822a0 CR3: 0000000005ca0001 CR4: 0000000000172ef0 Call Trace: <TASK> tcf_classify+0x17d/0x5c0 tc_run+0x9d/0x150 __dev_queue_xmit+0x2ab/0x14d0 ip_finish_output2+0x340/0x8f0 ip_output+0xa4/0x250 raw_sendmsg+0x147d/0x14b0 __sys_sendto+0x1cc/0x1f0 __x64_sys_sendto+0x24/0x30 do_syscall_64+0x126/0xf80 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fca40e822ba Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb b8 0f 1f 00 f3 0f 1e fa 41 89 ca 64 8b 04 25 18 00 00 00 85 c0 75 15 b8 2c 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 7e c3 0f 1f 44 00 00 41 54 48 83 ec 30 44 89 RSP: 002b:00007ffc248a42c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 000055ef233289d0 RCX: 00007fca40e822ba RDX: 000000000000001e RSI: 000055ef23328c30 RDI: 0000000000000003 RBP: 000055ef233289d0 R08: 00007ffc248a42d0 R09: 0000000000000010 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000000001e R13: 00000000000186a0 R14: 0000000000000000 R15: 00007fca41043000 </TASK> irq event stamp: 1045778 hardirqs last enabled at (1045784): [<ffffffff864ec042>] __up_console_sem+0x52/0x60 hardirqs last disabled at (1045789): [<ffffffff864ec027>] __up_console_sem+0x37/0x60 softirqs last enabled at (1045426): [<ffffffff874d48c7>] __alloc_skb+0x207/0x260 softirqs last disabled at (1045434): [<ffffffff874fe8f8>] __dev_queue_xmit+0x78/0x14d0
Then, because of the value in the packet's mark, dereference on 'q->handle' with NULL 'q' occurs:
BUG: kernel NULL pointer dereference, address: 0000000000000038 [...] RIP: 0010:fw_classify+0x1fe/0x250 [cls_fw] [...]
Skip "old-style" classification on shared blocks, so that the NULL dereference is fixed and WARN_ON() is not hit anymore in the short lifetime of invalid cls_fw "old-style" filters.
[1] https://sashiko.dev/#/patchset/20260331050217.504278-1-xmei5%40asu.edu
[2] https://elixir.bootlin.com/linux/v7.0-rc6/source/include/net/pkt_cls.h#L86
--- net/sched/cls_fw.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/sched/cls_fw.c +5 -1
@@ -72,9 +72,13 @@ static int fw_classify(struct sk_buff *skb, const struct tcf_proto *tp, } } }else { -struct Qdisc *q =tcf_block_q (tp->chain->block); +struct Qdisc *q;/* Old method: classify the packet using its skb mark. */ +if (tcf_block_shared (tp->chain->block)) +return -1 ; + + q =tcf_block_q (tp->chain->block);if (id && (TC_H_MAJ (id) ==0 || !(TC_H_MAJ (id ^ q->handle)))) { res->classid = id;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 3/522 net: mctp: ensure our nlmsg responses are initialised
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeremy Kerr <[email protected]>
[ Upstream commit a6a9bc544b675d8b5180f2718ec985ad267b5cbf ]
Syed Faraz Abrar (@farazsth98) from Zellic, and Pumpkin (@u1f383) from DEVCORE Research Team working with Trend Micro Zero Day Initiative report that a RTM_GETNEIGH will return uninitalised data in the pad bytes of the ndmsg data.
Ensure we're initialising the netlink data to zero, in the link, addr and neigh response messages.
--- net/mctp/device.c | 1 + net/mctp/neigh.c | 1 + net/mctp/route.c | 1 + 3 files changed, 3 insertions(+)
net/mctp/device.c +1 -0
@@ -71,6 +71,7 @@ static int mctp_fill_addrinfo(struct sk_buff *skb,return -EMSGSIZE ; hdr =nlmsg_data (nlh); +memset (hdr,0 ,sizeof (*hdr)); hdr->ifa_family =AF_MCTP ; hdr->ifa_prefixlen =0 ; hdr->ifa_flags =0 ;
net/mctp/neigh.c +1 -0
@@ -218,6 +218,7 @@ static int mctp_fill_neigh(struct sk_buff *skb, u32 portid, u32 seq, int event,return -EMSGSIZE ; hdr =nlmsg_data (nlh); +memset (hdr,0 ,sizeof (*hdr)); hdr->ndm_family =AF_MCTP ; hdr->ndm_ifindex = dev->ifindex; hdr->ndm_state =0 ;// TODO other state bits?
net/mctp/route.c +1 -0
@@ -1331,6 +1331,7 @@ static int mctp_fill_rtinfo(struct sk_buff *skb, struct mctp_route *rt,return -EMSGSIZE ; hdr =nlmsg_data (nlh); +memset (hdr,0 ,sizeof (*hdr)); hdr->rtm_family =AF_MCTP ;/* we use the _len fields as a number of EIDs, rather than
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 4/522 net/sched: sch_sfb: Replace direct dequeue call with peek and qdisc_dequeue_peeked
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Victor Nogueria <[email protected]>
[ Upstream commit 1b9bc71153b01dbde8045b9edede4240f4f5520e ]
When sfb has children (eg qfq qdisc) whose peek() callback is qdisc_peek_dequeued(), we could get a kernel panic. When the parent of such qdiscs (eg illustrated in patch #3 as tbf) wants to retrieve an skb from its child (sfb in this case), it will do the following:
1a. do a peek() - and when sensing there's an skb the child can offer, then
- the child in this case(sfb) calls its child's (qfq) peek. qfq does the right thing and will return the gso_skb queue packet.
Note: if there wasnt a gso_skb entry then qfq will store it there.
1b. invoke a dequeue() on the child (sfb). And herein lies the problem.
- sfb will call the child's dequeue() which will essentially just try to grab something of qfq's queue.
[ 127.594489][ T453] KASAN: null-ptr-deref in range [0x0000000000000048-0x000000000000004f] [ 127.594741][ T453] CPU: 2 UID: 0 PID: 453 Comm: ping Not tainted 7.1.0-rc1-00035-gac961974495b-dirty #793 PREEMPT(full) [ 127.595059][ T453] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 [ 127.595254][ T453] RIP: 0010:qfq_dequeue+0x35c/0x1650 [sch_qfq] [ 127.595461][ T453] Code: 00 fc ff df 80 3c 02 00 0f 85 17 0e 00 00 4c 8d 73 48 48 89 9d b8 02 00 00 48 b8 00 00 00 00 00 fc ff df 4c 89 f2 48 c1 ea 03 <80> 3c 02 00 0f 85 76 0c 00 00 48 b8 00 00 00 00 00 fc ff df 4c 8b [ 127.596081][ T453] RSP: 0018:ffff88810e5af440 EFLAGS: 00010216 [ 127.596337][ T453] RAX: dffffc0000000000 RBX: 0000000000000000 RCX: dffffc0000000000 [ 127.596623][ T453] RDX: 0000000000000009 RSI: 0000001880000000 RDI: ffff888104fd82b0 [ 127.596917][ T453] RBP: ffff888104fd8000 R08: ffff888104fd8280 R09: 1ffff110211893a3 [ 127.597165][ T453] R10: 1ffff110211893a6 R11: 1ffff110211893a7 R12: 0000001880000000 [ 127.597404][ T453] R13: ffff888104fd82b8 R14: 0000000000000048 R15: 0000000040000000 [ 127.597644][ T453] FS: 00007fc380cbfc40(0000) GS:ffff88816f2a8000(0000) knlGS:0000000000000000 [ 127.597956][ T453] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 127.598160][ T453] CR2: 00005610aa9890a8 CR3: 000000010369e000 CR4: 0000000000750ef0 [ 127.598390][ T453] PKRU: 55555554 [ 127.598509][ T453] Call Trace: [ 127.598629][ T453] <TASK> [ 127.598718][ T453] ? mark_held_locks+0x40/0x70 [ 127.598890][ T453] ? srso_alias_return_thunk+0x5/0xfbef5 [ 127.599053][ T453] sfb_dequeue+0x88/0x4d0 [ 127.599174][ T453] ? ktime_get+0x137/0x230 [ 127.599328][ T453] ? srso_alias_return_thunk+0x5/0xfbef5 [ 127.599480][ T453] ? qdisc_peek_dequeued+0x7b/0x350 [sch_qfq] [ 127.599670][ T453] ? srso_alias_return_thunk+0x5/0xfbef5 [ 127.599831][ T453] tbf_dequeue+0x6b1/0x1098 [sch_tbf] [ 127.599988][ T453] __qdisc_run+0x169/0x1900
The right thing to do in #1b is to grab the skb off gso_skb queue. This patchset fixes that issue by changing #1b to use qdisc_dequeue_peeked() method instead.
--- net/sched/sch_sfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_sfb.c +1 -1
@@ -439,7 +439,7 @@ static struct sk_buff *sfb_dequeue(struct Qdisc *sch)struct Qdisc *child = q->qdisc;struct sk_buff *skb; - skb = child->dequeue (q->qdisc); + skb =qdisc_dequeue_peeked (child);if (skb) {qdisc_bstats_update (sch, skb);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 5/522 drm: Remove plane hsub/vsub alignment requirement for core helpers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Carlos Eduardo Gallo Filho <[email protected]>
[ Upstream commit f2f455981a34ce8ca88a41458c09494b387d344f ]
The drm_format_info_plane_{height,width} functions was implemented using regular division for the plane size calculation, which cause issues [1][2] when used on contexts where the dimensions are misaligned with relation to the subsampling factors. So, replace the regular division by the DIV_ROUND_UP macro.
This allows these functions to be used in more drivers, making further work to bring more core presence on them possible.
[1] http://patchwork.freedesktop.org/patch/msgid/[email protected]
[2] https://patchwork.freedesktop.org/patch/msgid/[email protected]
--- include/drm/drm_fourcc.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
include/drm/drm_fourcc.h +3 -2
@@ -22,6 +22,7 @@#ifndef __DRM_FOURCC_H__#define __DRM_FOURCC_H__ +#include <linux/math.h> #include <linux/types.h> #include <uapi/drm/drm_fourcc.h>
@@ -279,7 +280,7 @@ int drm_format_info_plane_width(const struct drm_format_info *info, int width,if (plane ==0 )return width; -return width / info->hsub; +return DIV_ROUND_UP (width, info->hsub); }/**
@@ -301,7 +302,7 @@ int drm_format_info_plane_height(const struct drm_format_info *info, int height,if (plane ==0 )return height; -return height / info->vsub; +return DIV_ROUND_UP (height, info->vsub); }const struct drm_format_info *__drm_format_info (u32 format);
Signature · 1 line
2.53.0
# Librecast Test Results
020/020 [ OK ] liblcrq
010/010 [ OK ] libmld
120/120 [ OK ] liblibrecast
CPU/kernel: Linux auntie 6.1.176-rc1-01488-g6db5a9e163ae #1 SMP PREEMPT_DYNAMIC Tue Jun 16 15:53:20 -00 2026 x86_64 AMD Ryzen 9 9950X 16-Core Processor AuthenticAMD GNU/Linux
Greg Kroah-Hartman
maintainerPATCH 7/522 nfc: llcp: Fix use-after-free in llcp_sock_release()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lee Jones <[email protected]>
[ Upstream commit f4268b466190dae95a7585f69b4f1f8ad097632c ]
llcp_sock_release() unconditionally unlinks the socket from the local sockets list. However, if the socket is still in connecting state, it is on the connecting list.
Fix this by checking the socket state and unlinking from the correct list.
--- net/nfc/llcp_sock.c | 2 ++ 1 file changed, 2 insertions(+)
net/nfc/llcp_sock.c +2 -0
@@ -633,6 +633,8 @@ static int llcp_sock_release(struct socket *sock)if (sock->type ==SOCK_RAW )nfc_llcp_sock_unlink (&local->raw_sockets, sk); +else if (sk->sk_state ==LLCP_CONNECTING ) +nfc_llcp_sock_unlink (&local->connecting_sockets, sk);else nfc_llcp_sock_unlink (&local->sockets, sk);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 17/522 tun: free page on build_skb failure in tun_xdp_one()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weiming Shi <[email protected]>
[ Upstream commit aa8963fdce667a42fb7f0bdd2909fadcab02f9a8 ]
When build_skb() fails in tun_xdp_one(), the function sets ret to -ENOMEM and jumps to the out label, which returns without freeing the page that vhost_net_build_xdp() allocated for the frame. As with the short-frame rejection path, tun_sendmsg() discards the per-buffer error and still returns total_len, so vhost_tx_batch() takes the success path and never frees the page. Each build_skb() failure in a batch leaks one page-frag chunk.
Free the page before taking the error path, matching the put_page() the other error exits of tun_xdp_one() already perform.
--- drivers/net/tun.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/tun.c +1 -0
@@ -2494,6 +2494,7 @@ static int tun_xdp_one(struct tun_struct *tun, build: skb =build_skb (xdp->data_hard_start, buflen);if (!skb) { +put_page (virt_to_head_page (xdp->data)); ret = -ENOMEM ; goto out; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 18/522 net: netlink: fix sending unassigned nsid after assigned one
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Maximets <[email protected]>
[ Upstream commit 70f8592ee90585272018a725054b6eb2ab7e99ca ]
If the current skb is not shared, it is re-used directly for all the sockets subscribed to the notification. If we have remote all-nsid socket receiving a message first, then the 'nsid_is_set' will be set to 'true'. If the nsid is NOT_ASSIGNED for the next socket in the list, the 'nsid_is_set' will remain 'true' and the negative value is be delivered to the user space. All subsequent nsid values will be delivered as well, since there is no code path that sets the flag back to 'false'.
Fix that by always dropping the flag to 'false' first.
--- net/netlink/af_netlink.c | 1 + 1 file changed, 1 insertion(+)
net/netlink/af_netlink.c +1 -0
@@ -1473,6 +1473,7 @@ static void do_one_broadcast(struct sock *sk, p->skb2 =NULL ; goto out; } +NETLINK_CB (p->skb2).nsid_is_set = false;NETLINK_CB (p->skb2).nsid =peernet2id (sock_net (sk), p->net);if (NETLINK_CB (p->skb2).nsid !=NETNSA_NSID_NOT_ASSIGNED )NETLINK_CB (p->skb2).nsid_is_set = true;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 19/522 net: netlink: dont set nsid on local notifications
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Maximets <[email protected]>
[ Upstream commit 88b126b39f9757e9debc322d4679239e9af089c7 ]
In most cases, notifications on sockets with NETLINK_LISTEN_ALL_NSID do not contain NSID in their ancillary data in case the event is local to the listener.
However, when a self-referential NSID is allocated for a namespace, every local notification starts sending this ID to the user space.
This is problematic, because the listener cannot tell if those notifications are local or not anymore without making extra requests to figure out if the provided NSID is local or not. The listener can also not figure out the local NSID beforehand as it can be allocated at any point in time by other processes, changing the structure of the future notifications for everyone.
The value is practically not useful, since it's the namespace's own ID that the application has to obtain from other sources in order to figure out if it's the same or not. So, for the application it's just an extra busy work with no benefits. Moreover, applications that do not know about this quirk may be mishandling notifications with NSID set as notifications from remote namespaces. This is the case for ovs-vswitchd and the iproute2's 'ip monitor' that stops printing 'current' and starts printing the nsid number mid-session.
Lack of clear documentation for this behavior is also not helping.
A search though open-source projects doesn't reveal any projects that use NETNSA_NSID_NOT_ASSIGNED and rely on metadata to contain self-referential NSIDs (expected, since the value is not useful). Quite the opposite, as already mentioned, there are few applications that rely on NSID to not be present in local events.
Since the value is not useful and actively harmful in some cases, let's not report it for local events, making the notifications more consistent.
Also adding some blank lines for readability.
--- net/netlink/af_netlink.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
net/netlink/af_netlink.c +7 -3
@@ -1473,10 +1473,14 @@ static void do_one_broadcast(struct sock *sk, p->skb2 =NULL ; goto out; } +NETLINK_CB (p->skb2).nsid_is_set = false; -NETLINK_CB (p->skb2).nsid =peernet2id (sock_net (sk), p->net); -if (NETLINK_CB (p->skb2).nsid !=NETNSA_NSID_NOT_ASSIGNED ) -NETLINK_CB (p->skb2).nsid_is_set = true; +if (!net_eq (sock_net (sk), p->net)) { +NETLINK_CB (p->skb2).nsid =peernet2id (sock_net (sk), p->net); +if (NETLINK_CB (p->skb2).nsid !=NETNSA_NSID_NOT_ASSIGNED ) +NETLINK_CB (p->skb2).nsid_is_set = true; + } + val =netlink_broadcast_deliver (sk, p->skb2);if (val <0 ) {netlink_overrun (sk);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 20/522 net/smc: Do not re-initialize smc hashtables
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandra Winter <[email protected]>
[ Upstream commit 9e4389b0038781f19f97895186ed941ff8ac1678 ]
INIT_HLIST_HEAD(&smc_v*_hashinfo.ht) are called after smc_nl_init(), proto_register() and sock_register(). This can lead to smc_v*_hashinfo.ht being reset even though hash entries already exist and are being used, possibly resulting in a corrupted list.
Remove unnecessary and dangerous re-initialisation of smc_v*_hashinfo.ht in smc_init(); it is implicitly initialised to zero anyhow. Add HLIST_HEAD_INIT to the definitions for clarity.
--- net/smc/af_smc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/smc/af_smc.c +2 -2
@@ -180,10 +180,12 @@ static bool smc_hs_congested(const struct sock *sk)static struct smc_hashinfo smc_v4_hashinfo = { .lock =__RW_LOCK_UNLOCKED (smc_v4_hashinfo.lock), + .ht =HLIST_HEAD_INIT , };static struct smc_hashinfo smc_v6_hashinfo = { .lock =__RW_LOCK_UNLOCKED (smc_v6_hashinfo.lock), + .ht =HLIST_HEAD_INIT , };int smc_hash_sk (struct sock *sk)
@@ -3495,8 +3497,6 @@ static int __init smc_init(void)pr_err ("%s: sock_register fails with %d\n" , __func__, rc); goto out_proto6; } -INIT_HLIST_HEAD (&smc_v4_hashinfo.ht); -INIT_HLIST_HEAD (&smc_v6_hashinfo.ht); rc =smc_ib_register_client ();if (rc) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 21/522 net/iucv: fix locking in .getsockopt
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit 3589d20a666caf30ad100c960a2de7de390fce88 ]
Mirror iucv_sock_setsockopt() and wrap the whole switch in lock_sock()/release_sock(). The pre-existing SO_MSGLIMIT-only lock becomes redundant and is removed.
Any AF_IUCV HIPER user can potentially crash the kernel by racing recvmsg() with getsockopt(SO_MSGSIZE): the SO_MSGSIZE arm dereferences iucv->hs_dev->mtu after iucv_sock_close() (called from the racing recvmsg()) has set hs_dev to NULL, producing a NULL pointer dereference oops.
--- net/iucv/af_iucv.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
net/iucv/af_iucv.c +14 -6
@@ -1539,7 +1539,7 @@ static int iucv_sock_getsockopt(struct socket *sock, int level, int optname,struct sock *sk = sock->sk;struct iucv_sock *iucv =iucv_sk (sk);unsigned int val; -int len; +int len, rc;if (level !=SOL_IUCV )return -ENOPROTOOPT ;
@@ -1552,26 +1552,34 @@ static int iucv_sock_getsockopt(struct socket *sock, int level, int optname, len = min_t(unsigned int, len, sizeof(int)); + rc =0 ; + +lock_sock (sk);switch (optname) {case SO_IPRMDATA_MSG : val = (iucv->flags &IUCV_IPRMDATA ) ?1 :0 ;break ;case SO_MSGLIMIT : -lock_sock (sk); val = (iucv->path !=NULL ) ? iucv->path->msglim/* connected */ : iucv->msglimit;/* default */ -release_sock (sk);break ;case SO_MSGSIZE : -if (sk->sk_state ==IUCV_OPEN ) -return -EBADFD ; +if (sk->sk_state ==IUCV_OPEN ) { + rc = -EBADFD ; +break ; + } val = (iucv->hs_dev) ? iucv->hs_dev->mtu -sizeof (struct af_iucv_trans_hdr ) -ETH_HLEN :0x7fffffff ;break ;default : -return -ENOPROTOOPT ; + rc = -ENOPROTOOPT ; +break ; } +release_sock (sk); + +if (rc) +return rc;if (put_user (len, optlen))return -EFAULT ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 22/522 ipv4: free net->ipv4.sysctl_local_reserved_ports after unregister_net_sysctl_table()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 87a1e0fe7776da7ab411be332b4be58ac8840d10 ]
ipv4_sysctl_exit_net() is currently freeing net->ipv4.sysctl_local_reserved_ports too soon.
Only after unregister_net_sysctl_table() we can be sure no threads can possibly use the sysctls, including /proc/sys/net/ipv4/ip_local_reserved_ports.
--- net/ipv4/sysctl_net_ipv4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/sysctl_net_ipv4.c +1 -1
@@ -1449,10 +1449,10 @@ static __net_exit void ipv4_sysctl_exit_net(struct net *net) {struct ctl_table *table; -kfree (net->ipv4.sysctl_local_reserved_ports); table = net->ipv4.ipv4_hdr->ctl_table_arg;unregister_net_sysctl_table (net->ipv4.ipv4_hdr);kfree (table); +kfree (net->ipv4.sysctl_local_reserved_ports); }static __net_initdata struct pernet_operations ipv4_sysctl_ops = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 23/522 ASoC: Intel: bytcht_es8316: Fix MCLK leak on init errors
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
[ Upstream commit afb2a3a9d8369d18122a0d7cd294eba9a98259c6 ]
byt_cht_es8316_init() enables MCLK before configuring the codec sysclk and creating the headset jack. If either of those later steps fails, the function returns without disabling MCLK, leaving the clock enabled after card registration fails.
Track whether this driver enabled MCLK and disable it on the init error paths. Add the matching DAI link exit callback so the same clock enable is also balanced when ASoC cleans up a successfully initialized link.
--- sound/soc/intel/boards/bytcht_es8316.c | 29 ++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-)
sound/soc/intel/boards/bytcht_es8316.c +27 -2
@@ -39,6 +39,7 @@ struct byt_cht_es8316_private {struct gpio_desc *speaker_en_gpio;struct device *codec_dev;bool speaker_en; +bool mclk_enabled; };enum {
@@ -169,6 +170,15 @@ static struct snd_soc_jack_pin byt_cht_es8316_jack_pins[] = { }, }; +static void byt_cht_es8316_disable_mclk (struct byt_cht_es8316_private *priv) +{ +if (!priv->mclk_enabled) +return ; + +clk_disable_unprepare (priv->mclk); + priv->mclk_enabled = false; +} +static int byt_cht_es8316_init (struct snd_soc_pcm_runtime *runtime) {struct snd_soc_component *codec =asoc_rtd_to_codec (runtime,0 )->component;
@@ -225,12 +235,14 @@ static int byt_cht_es8316_init(struct snd_soc_pcm_runtime *runtime) ret =clk_prepare_enable (priv->mclk);if (ret)dev_err (card->dev,"unable to enable MCLK\n" ); +else + priv->mclk_enabled = true; ret =snd_soc_dai_set_sysclk (asoc_rtd_to_codec (runtime,0 ),0 ,19200000 ,SND_SOC_CLOCK_IN );if (ret <0 ) {dev_err (card->dev,"can't set codec clock %d\n" , ret); -return ret; + goto err_disable_mclk; } ret = snd_soc_card_jack_new_pins(card, "Headset",
@@ -239,13 +251,25 @@ static int byt_cht_es8316_init(struct snd_soc_pcm_runtime *runtime) ARRAY_SIZE(byt_cht_es8316_jack_pins));if (ret) {dev_err (card->dev,"jack creation failed %d\n" , ret); -return ret; + goto err_disable_mclk; }snd_jack_set_key (priv->jack.jack,SND_JACK_BTN_0 ,KEY_PLAYPAUSE );snd_soc_component_set_jack (codec, &priv->jack,NULL );return 0 ; + +err_disable_mclk: +byt_cht_es8316_disable_mclk (priv); +return ret; +} + +static void byt_cht_es8316_exit (struct snd_soc_pcm_runtime *runtime) +{ +struct snd_soc_card *card = runtime->card; +struct byt_cht_es8316_private *priv =snd_soc_card_get_drvdata (card); + +byt_cht_es8316_disable_mclk (priv); } static int byt_cht_es8316_codec_fixup(struct snd_soc_pcm_runtime *rtd,
@@ -355,6 +379,7 @@ static struct snd_soc_dai_link byt_cht_es8316_dais[] = { .dpcm_playback = 1, .dpcm_capture = 1, .init = byt_cht_es8316_init, + .exit = byt_cht_es8316_exit, SND_SOC_DAILINK_REG(ssp2_port, ssp2_codec, platform), }, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 24/522 net: hsr: fix potential OOB access in supervision frame handling
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luka Gejak <[email protected]>
[ Upstream commit f229426072fc865654a60978bb7fda790a051ff3 ]
Ensure the entire TLV header is linearized before access by adding sizeof(struct hsr_sup_tlv) to the pskb_may_pull() calls. Without this, a truncated frame could cause an out-of-bounds access.
--- net/hsr/hsr_forward.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/hsr/hsr_forward.c +2 -2
@@ -84,7 +84,7 @@ static bool is_supervision_frame(struct hsr_priv *hsr, struct sk_buff *skb)/* Get next tlv */ total_length += hsr_sup_tag->tlv.HSR_TLV_length; -if (!pskb_may_pull (skb, total_length)) +if (!pskb_may_pull (skb, total_length +sizeof (struct hsr_sup_tlv )))return false;skb_pull (skb, total_length); hsr_sup_tlv = (struct hsr_sup_tlv *)skb->data;
@@ -100,7 +100,7 @@ static bool is_supervision_frame(struct hsr_priv *hsr, struct sk_buff *skb)/* make sure another tlv follows */ total_length +=sizeof (struct hsr_sup_tlv ) + hsr_sup_tlv->HSR_TLV_length; -if (!pskb_may_pull (skb, total_length)) +if (!pskb_may_pull (skb, total_length +sizeof (struct hsr_sup_tlv )))return false;/* get next tlv */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 25/522 tunnels: load network headers after skb_cow() in iptunnel_pmtud_build_icmp[v6]()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit b4bc94353050b1fa7b702bd4c6600710dd926cff ]
Sashiko found that iptunnel_pmtud_build_icmp() and iptunnel_pmtud_build_icmpv6() were caching ip_hdr() and ipv6_hdr() before an skb_cow() call which can reallocate skb->head.
Fix this possible UAF by initializing the local variables after the skb_cow() call.
Remove skb_reset_network_header() calls which were not needed.
--- net/ipv4/ip_tunnel_core.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
net/ipv4/ip_tunnel_core.c +4 -5
@@ -194,7 +194,7 @@ EXPORT_SYMBOL_GPL(iptunnel_handle_offloads);*/ static int iptunnel_pmtud_build_icmp (struct sk_buff *skb,int mtu) { -const struct iphdr *iph =ip_hdr (skb); +const struct iphdr *iph;struct icmphdr *icmph;struct iphdr *niph;struct ethhdr eh;
@@ -208,7 +208,6 @@ static int iptunnel_pmtud_build_icmp(struct sk_buff *skb, int mtu)skb_copy_bits (skb,skb_mac_offset (skb), &eh,ETH_HLEN );pskb_pull (skb,ETH_HLEN ); -skb_reset_network_header (skb); err =pskb_trim (skb,576 -sizeof (*niph) -sizeof (*icmph));if (err)
@@ -218,7 +217,7 @@ static int iptunnel_pmtud_build_icmp(struct sk_buff *skb, int mtu) err =skb_cow (skb,sizeof (*niph) +sizeof (*icmph) +ETH_HLEN );if (err)return err; - + iph =ip_hdr (skb); icmph =skb_push (skb,sizeof (*icmph)); *icmph = (struct icmphdr ) { .type =ICMP_DEST_UNREACH ,
@@ -290,7 +289,7 @@ static int iptunnel_pmtud_check_icmp(struct sk_buff *skb, int mtu)*/ static int iptunnel_pmtud_build_icmpv6 (struct sk_buff *skb,int mtu) { -const struct ipv6hdr *ip6h =ipv6_hdr (skb); +const struct ipv6hdr *ip6h;struct icmp6hdr *icmp6h;struct ipv6hdr *nip6h;struct ethhdr eh;
@@ -305,7 +304,6 @@ static int iptunnel_pmtud_build_icmpv6(struct sk_buff *skb, int mtu)skb_copy_bits (skb,skb_mac_offset (skb), &eh,ETH_HLEN );pskb_pull (skb,ETH_HLEN ); -skb_reset_network_header (skb); err =pskb_trim (skb,IPV6_MIN_MTU -sizeof (*nip6h) -sizeof (*icmp6h));if (err)
@@ -316,6 +314,7 @@ static int iptunnel_pmtud_build_icmpv6(struct sk_buff *skb, int mtu)if (err)return err; + ip6h =ipv6_hdr (skb); icmp6h =skb_push (skb,sizeof (*icmp6h)); *icmp6h = (struct icmp6hdr ) { .icmp6_type =ICMPV6_PKT_TOOBIG ,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 8/522 nfc: llcp: Fix use-after-free race in nfc_llcp_recv_cc()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lee Jones <[email protected]>
[ Upstream commit b493ea2765cc17cb8aa7e7544a4b6dcb05b6ed77 ]
A race condition exists in the NFC LLCP connection state machine where the connection acceptance packet (CC) can be processed concurrently with socket release. This can lead to a use-after-free of the socket object.
When nfc_llcp_recv_cc() moves the socket from the connecting_sockets list to the sockets list, it does so without holding the socket lock. If llcp_sock_release() is executing concurrently, it might have already unlinked the socket and dropped its references, which can result in nfc_llcp_recv_cc() linking a freed socket into the live list.
Fix this by holding lock_sock() during the state transition and list movement in nfc_llcp_recv_cc(). After acquiring the lock, check if the socket is still hashed to ensure it hasn't already been unlinked and marked for destruction by the release path. This aligns the locking pattern with recv_hdlc() and recv_disc().
--- net/nfc/llcp_core.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
net/nfc/llcp_core.c +11 -0
@@ -1216,6 +1216,15 @@ static void nfc_llcp_recv_cc(struct nfc_llcp_local *local, sk = &llcp_sock->sk; +lock_sock (sk); + +/* Check if socket was destroyed whilst waiting for the lock */ +if (!sk_hashed (sk)) { +release_sock (sk); +nfc_llcp_sock_put (llcp_sock); +return ; + } +/* Unlink from connecting and link to the client array */ nfc_llcp_sock_unlink (&local->connecting_sockets, sk);nfc_llcp_sock_link (&local->sockets, sk);
@@ -1227,6 +1236,8 @@ static void nfc_llcp_recv_cc(struct nfc_llcp_local *local, sk->sk_state =LLCP_CONNECTED ; sk->sk_state_change (sk); +release_sock (sk); +nfc_llcp_sock_put (llcp_sock); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 26/522 vxlan: do not reuse cached ip_hdr() value after skb_tunnel_check_pmtu()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 7d9ef0cb271555d8cf39fefe6c981e1493b25ecf ]
skb_tunnel_check_pmtu() can change skb->head.
Reusing old_iph afer skb_tunnel_check_pmtu() can cause an UAF.
Use instead ip_hdr(skb) as done in drivers/net/bareudp.c and drivers/net/geneve.c.
Found by Sashiko.
--- drivers/net/vxlan/vxlan_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/vxlan/vxlan_core.c +2 -2
@@ -2682,7 +2682,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, goto out_unlock; } - tos =ip_tunnel_ecn_encap (tos, old_iph, skb); + tos =ip_tunnel_ecn_encap (tos,ip_hdr (skb), skb); ttl = ttl ? :ip4_dst_hoplimit (&rt->dst); err =vxlan_build_skb (skb, ndst,sizeof (struct iphdr ), vni, md, flags, udp_sum);
@@ -2745,7 +2745,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, goto out_unlock; } - tos =ip_tunnel_ecn_encap (tos, old_iph, skb); + tos =ip_tunnel_ecn_encap (tos,ip_hdr (skb), skb); ttl = ttl ? :ip6_dst_hoplimit (ndst);skb_scrub_packet (skb, xnet); err = vxlan_build_skb(skb, ndst, sizeof(struct ipv6hdr),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 9/522 xfrm: Check for underflow in xfrm_state_mtu
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Ahern <[email protected]>
[ Upstream commit 742b04d0550b0ec89dcbc99537ec88653bd1ad90 ]
Leo Lin reported OOB write issue in esp component:
xfrm_state_mtu() returns u32 but performs its arithmetic in unsigned modulo-2^32 space using an attacker-influenced "header_len + authsize + net_adj" subtracted from a small "mtu" argument. A nobody user can install an IPv4 ESP tunnel SA with a large authentication key (XFRMA_ALG_AUTH_TRUNC, e.g. hmac(sha512), 64-byte key, 64-byte trunc), configure a small interface MTU (68 bytes), and set XFRMA_TFCPAD to a large value. When a single UDP datagram is then sent through the tunnel, xfrm_state_mtu() underflows to a near-2^32 value, and esp_output() consumes it as a signed int via:
padto = min(x->tfcpad, xfrm_state_mtu(x, mtu_cached))
esp.tfclen = padto - skb->len (assigned to int) esp.tfclen ends up negative (e.g. -207). It is sign-extended to size_t when passed to memset() inside esp_output_fill_trailer(), producing a ~16 EB write of zeroes at skb_tail_pointer(skb). KASAN logs it as "Write of size 18446744073709551537 at addr ffff888...".
Check for underflow and return 1. This causes the sendmsg attempt to fail with ENETUNREACH.
--- net/xfrm/xfrm_state.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
net/xfrm/xfrm_state.c +16 -3
@@ -2577,10 +2577,14 @@ u32 xfrm_state_mtu(struct xfrm_state *x, int mtu)const struct xfrm_type *type =READ_ONCE (x->type);struct crypto_aead *aead;u32 blksize, net_adj =0 ; +u32 overhead, payload_mtu;if (x->km.state !=XFRM_STATE_VALID || - !type || type->proto !=IPPROTO_ESP ) + !type || type->proto !=IPPROTO_ESP ) { +if (mtu <= x->props.header_len) +return 1 ;return mtu - x->props.header_len; + } aead = x->data; blksize =ALIGN (crypto_aead_blocksize (aead),4 );
@@ -2600,8 +2604,17 @@ u32 xfrm_state_mtu(struct xfrm_state *x, int mtu)break ; } -return ((mtu - x->props.header_len -crypto_aead_authsize (aead) - - net_adj) & ~(blksize -1 )) + net_adj -2 ; + overhead = x->props.header_len +crypto_aead_authsize (aead) + net_adj; +if (mtu <= overhead) +return 1 ; + + payload_mtu = mtu - overhead; + payload_mtu &= ~(blksize -1 ); +if (payload_mtu <=2 ) +return 1 ; + +return payload_mtu + net_adj -2 ; + }EXPORT_SYMBOL_GPL (xfrm_state_mtu);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 10/522 nfc: nxp-nci: i2c: use rising-edge IRQ on ACPI systems
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Carl Lee <[email protected]>
[ Upstream commit f23bf992d65a42007c517b060ca35cebdea3525a ]
Some ACPI-based platforms report incorrect IRQ trigger types (e.g. IRQF_TRIGGER_HIGH), which can lead to interrupt storms.
Use the historically working rising-edge trigger on ACPI systems to avoid this regression.
Device Tree-based systems continue to use the firmware-provided trigger type.
--- drivers/nfc/nxp-nci/i2c.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
drivers/nfc/nxp-nci/i2c.c +20 -1
@@ -16,6 +16,7 @@#include <linux/delay.h> #include <linux/i2c.h> #include <linux/interrupt.h> +#include <linux/irq.h> #include <linux/module.h> #include <linux/nfc.h> #include <linux/gpio/consumer.h>
@@ -268,6 +269,7 @@ static int nxp_nci_i2c_probe(struct i2c_client *client, {struct device *dev = &client->dev;struct nxp_nci_i2c_phy *phy; +unsigned long irqflags;int r;if (!i2c_check_functionality (client->adapter,I2C_FUNC_I2C )) {
@@ -304,9 +306,26 @@ static int nxp_nci_i2c_probe(struct i2c_client *client,if (r <0 )return r; +/* +* ACPI platforms may report incorrect IRQ trigger types +* (e.g. level-high), which can lead to interrupt storms. +* +* Use the historically stable rising-edge trigger for ACPI devices. +* +* On non-ACPI systems (e.g. Device Tree), prefer the firmware- +* provided trigger type, falling back to rising-edge if not set. +*/ +if (ACPI_COMPANION (dev)) { + irqflags =IRQF_TRIGGER_RISING ; + }else { + irqflags =irq_get_trigger_type (client->irq); +if (!irqflags) + irqflags =IRQF_TRIGGER_RISING ; + } + r =request_threaded_irq (client->irq,NULL , nxp_nci_i2c_irq_thread_fn, -IRQF_ONESHOT , + irqflags |IRQF_ONESHOT ,NXP_NCI_I2C_DRIVER_NAME , phy);if (r <0 )nfc_err (&client->dev,"Unable to register IRQ handler\n" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 11/522 tools/bootconfig: Cleanup bootconfig footer size calculations
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <[email protected]>
[ Upstream commit 26dda57695090e05c1a99c3e8f802f862d1ac474 ]
There are many same pattern of 8 + BOOTCONFIG_MAGIC_LEN for calculating the size of bootconfig footer. Use BOOTCONFIG_FOOTER_SIZE macro to clean up those magic numbers.
Stable-dep-of: f42d01aadced ("tools/bootconfig: Fix buf leaks in apply_xbc")
--- tools/bootconfig/main.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
tools/bootconfig/main.c +11 -8
@@ -16,6 +16,10 @@#define pr_err (fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__) +/* Bootconfig footer is [size][csum][BOOTCONFIG_MAGIC]. */ +#define BOOTCONFIG_FOOTER_SIZE \ + (sizeof(uint32_t) * 2 + BOOTCONFIG_MAGIC_LEN) +static int xbc_show_value (struct xbc_node *node,bool semicolon) {const char *val, *eol;
@@ -188,7 +192,7 @@ static int load_xbc_from_initrd(int fd, char **buf)if (ret <0 )return -errno; -if (stat.st_size <8 +BOOTCONFIG_MAGIC_LEN ) +if (stat.st_size <BOOTCONFIG_FOOTER_SIZE )return 0 ;if (lseek (fd, -BOOTCONFIG_MAGIC_LEN ,SEEK_END ) <0 )
@@ -201,7 +205,7 @@ static int load_xbc_from_initrd(int fd, char **buf)if (memcmp (magic,BOOTCONFIG_MAGIC ,BOOTCONFIG_MAGIC_LEN ) !=0 )return 0 ; -if (lseek (fd, -(8 +BOOTCONFIG_MAGIC_LEN ),SEEK_END ) <0 ) +if (lseek (fd, -BOOTCONFIG_FOOTER_SIZE ,SEEK_END ) <0 )return pr_errno ("Failed to lseek for size" , -errno);if (read (fd, &size,sizeof (uint32_t )) <0 )
@@ -213,12 +217,12 @@ static int load_xbc_from_initrd(int fd, char **buf) csum =le32toh (csum);/* Wrong size error */ -if (stat.st_size < size +8 +BOOTCONFIG_MAGIC_LEN ) { +if (stat.st_size < size +BOOTCONFIG_FOOTER_SIZE ) {pr_err ("bootconfig size is too big\n" );return -E2BIG ; } -if (lseek (fd, stat.st_size - (size +8 +BOOTCONFIG_MAGIC_LEN ), +if (lseek (fd, stat.st_size - (size +BOOTCONFIG_FOOTER_SIZE ),SEEK_SET ) <0 )return pr_errno ("Failed to lseek" , -errno);
@@ -349,7 +353,7 @@ static int delete_xbc(const char *path) ret =fstat (fd, &stat);if (!ret) ret =ftruncate (fd, stat.st_size - - size -8 -BOOTCONFIG_MAGIC_LEN ); + - size -BOOTCONFIG_FOOTER_SIZE );if (ret) ret = -errno; }/* Ignore if there is no boot config in initrd */
@@ -379,8 +383,7 @@ static int apply_xbc(const char *path, const char *xbc_path) csum =xbc_calc_checksum (buf, size);/* Backup the bootconfig data */ - data =calloc (size +BOOTCONFIG_ALIGN + -sizeof (uint32_t ) +sizeof (uint32_t ) +BOOTCONFIG_MAGIC_LEN ,1 ); + data =calloc (size +BOOTCONFIG_ALIGN +BOOTCONFIG_FOOTER_SIZE ,1 );if (!data)return -ENOMEM ;memcpy (data, buf, size);
@@ -428,7 +431,7 @@ static int apply_xbc(const char *path, const char *xbc_path) }/* To align up the total size to BOOTCONFIG_ALIGN, get padding size */ - total_size = stat.st_size + size +sizeof (uint32_t ) *2 +BOOTCONFIG_MAGIC_LEN ; + total_size = stat.st_size + size +BOOTCONFIG_FOOTER_SIZE ; pad = ((total_size +BOOTCONFIG_ALIGN -1 ) & (~BOOTCONFIG_ALIGN_MASK )) - total_size; size += pad;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 12/522 tools/bootconfig: Fix buf leaks in apply_xbc
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongtao Lee <[email protected]>
[ Upstream commit f42d01aadcedd7bbf4f9a466cabe25c1781dedad ]
If data calloc failed, free the buf before return.
--- tools/bootconfig/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/bootconfig/main.c +3 -1
@@ -384,8 +384,10 @@ static int apply_xbc(const char *path, const char *xbc_path)/* Backup the bootconfig data */ data =calloc (size +BOOTCONFIG_ALIGN +BOOTCONFIG_FOOTER_SIZE ,1 ); -if (!data) +if (!data) { +free (buf);return -ENOMEM ; + }memcpy (data, buf, size);/* Check the data format */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 13/522 netfilter: synproxy: refresh tcphdr after skb_ensure_writable
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <[email protected]>
[ Upstream commit 92170e6afe927ab2792a3f71902845789c8e31b1 ]
synproxy_tstamp_adjust() rewrites the TCP timestamp option in place and then patches the TCP checksum via inet_proto_csum_replace4() on the caller-supplied tcphdr pointer. Both ipv4_synproxy_hook() and ipv6_synproxy_hook() obtain that pointer with skb_header_pointer() before calling in, so it may either alias skb->head directly or point at the caller's on-stack _tcph buffer.
Between obtaining the pointer and using it, the function calls skb_ensure_writable(skb, optend), which on a cloned or non-linear skb invokes pskb_expand_head() and frees the old skb->head. After that point the cached th is stale:
caller (ipv[46]_synproxy_hook)
th = skb_header_pointer(skb, ..., &_tcph)
synproxy_tstamp_adjust(skb, protoff, th, ...)
skb_ensure_writable(skb, optend)
pskb_expand_head() /* kfree(old skb->head) */
...
inet_proto_csum_replace4(&th->check, ...)
/* writes into freed head, or
into the caller's stack copy
leaving the on-wire checksum
stale */The option bytes are written through skb->data and are fine; only the checksum update goes through th and so lands in the wrong place. The result is either a write into freed slab memory or a packet leaving with a checksum that does not match its payload.
Fix by re-deriving th from skb->data + protoff immediately after skb_ensure_writable() succeeds, so the subsequent checksum update targets the linear, writable header.
--- net/netfilter/nf_synproxy_core.c | 2 ++ 1 file changed, 2 insertions(+)
net/netfilter/nf_synproxy_core.c +2 -0
@@ -199,6 +199,8 @@ synproxy_tstamp_adjust(struct sk_buff *skb, unsigned int protoff,if (skb_ensure_writable (skb, optend))return 0 ; + th = (struct tcphdr *)(skb->data + protoff); +while (optoff < optend) {unsigned char *op = skb->data + optoff;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 14/522 netfilter: xt_cpu: prefer raw_smp_processor_id
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit c376f07e16c02239ed44cabb97145d03f65b4d15 ]
With PREEMPT_RCU we get splat:
BUG: using smp_processor_id() in preemptible [..] caller is cpu_mt+0x53/0xd0 net/netfilter/xt_cpu.c:37 CPU: 1 .. Comm: syz.3.1377 #0 PREEMPT(full) Call Trace: <TASK> dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 check_preemption_disabled+0xd3/0xe0 lib/smp_processor_id.c:47 cpu_mt+0x53/0xd0 net/netfilter/xt_cpu.c:37 [..]
Just use raw version instead.
This is similar to 14d14a5d2957 ("netfilter: nft_meta: use raw_smp_processor_id()").
--- net/netfilter/xt_cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/xt_cpu.c +1 -1
@@ -34,7 +34,7 @@ static bool cpu_mt(const struct sk_buff *skb, struct xt_action_param *par) {const struct xt_cpu_info *info = par->matchinfo; -return (info->cpu ==smp_processor_id ()) ^ info->invert; +return (info->cpu ==raw_smp_processor_id ()) ^ info->invert; }static struct xt_match cpu_mt_reg__read_mostly = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 15/522 netfilter: ebtables: fix OOB read in compat_mtw_from_user
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit f438d1786d657d57790c5d138d6db3fc9fdac392 ]
Luxiao Xu says:
The function compat_mtw_from_user() converts ebtables extensions from 32-bit user structures to kernel native structures. However, it lacks proper validation of the user-supplied match_size/target_size.
When certain extensions are processed, the kernel-side translation logic may perform memory accesses based on the extension's expected size. If the user provides a size smaller than what the extension requires, it results in an out-of-bounds read as reported by KASAN.
This fix introduces a check to ensure match_size is at least as large as the extension's required compatsize. This covers matches, watchers, and targets, while maintaining compatibility with standard targets.
AFAIU this is relevant for matches that need to go though match->compat_from_user() call. Those that use plain memcpy with the user-provided size are ok because the caller checks that size vs the start of the next rule entry offset (which itself is checked vs. total size copied from userspace).
The ->compat_from_user() callbacks assume they can read compatsize bytes, so they need this extra check.
Based on an earlier patch from Luxiao Xu.
--- net/bridge/netfilter/ebtables.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
net/bridge/netfilter/ebtables.c +30 -0
@@ -1952,6 +1952,25 @@ enum compat_mwt { EBT_COMPAT_TARGET, }; +static bool match_size_ok (const struct xt_match *match,unsigned int match_size) +{ +u16 csize; + +if (match->matchsize ==-1 )/* cannot validate ebt_among */ +return true; + + csize = match->compatsize ? : match->matchsize; + +return match_size >= csize; +} + +static bool tgt_size_ok (const struct xt_target *tgt,unsigned int tgt_size) +{ +u16 csize = tgt->compatsize ? : tgt->targetsize; + +return tgt_size >= csize; +} + static int compat_mtw_from_user(const struct compat_ebt_entry_mwt *mwt, enum compat_mwt compat_mwt, struct ebt_entries_buf_state *state,
@@ -1977,6 +1996,11 @@ static int compat_mtw_from_user(const struct compat_ebt_entry_mwt *mwt,if (IS_ERR (match))return PTR_ERR (match); +if (!match_size_ok (match, match_size)) { +module_put (match->me); +return -EINVAL ; + } + off =ebt_compat_match_offset (match, match_size);if (dst) {if (match->compat_from_user)
@@ -1996,6 +2020,12 @@ static int compat_mtw_from_user(const struct compat_ebt_entry_mwt *mwt, mwt->u.revision);if (IS_ERR (wt))return PTR_ERR (wt); + +if (!tgt_size_ok (wt, match_size)) { +module_put (wt->me); +return -EINVAL ; + } + off =xt_compat_target_offset (wt);if (dst) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 6/522 net: cpsw_new: Fix potential unregister of netdev that has not been registered yet
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kevin Hao <[email protected]>
[ Upstream commit 9d724b34fbe13b71865ad0906a4be97571f19cf5 ]
If an error occurs during register_netdev() for the first MAC in cpsw_register_ports(), even though cpsw->slaves[0].ndev is set to NULL, cpsw->slaves[1].ndev would remain unchanged. This could later cause cpsw_unregister_ports() to attempt unregistering the second MAC. To address this, add a check for ndev->reg_state before calling unregister_netdev(). With this change, setting cpsw->slaves[i].ndev to NULL becomes unnecessary and can be removed accordingly.
--- drivers/net/ethernet/ti/cpsw_new.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/ti/cpsw_new.c +2 -2
@@ -1437,7 +1437,8 @@ static void cpsw_unregister_ports(struct cpsw_common *cpsw)int i =0 ;for (i =0 ; i < cpsw->data.slaves; i++) { -if (!cpsw->slaves[i].ndev) +if (!cpsw->slaves[i].ndev || + cpsw->slaves[i].ndev->reg_state !=NETREG_REGISTERED )continue ;unregister_netdev (cpsw->slaves[i].ndev);
@@ -1457,7 +1458,6 @@ static int cpsw_register_ports(struct cpsw_common *cpsw)if (ret) {dev_err (cpsw->dev,"cpsw: err registering net device%d\n" , i); - cpsw->slaves[i].ndev =NULL ;break ; } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 28/522 ASoC: codecs: simple-mux: Fix enum control bounds check
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
[ Upstream commit f63ad68e18d774a5d15cd7e405ead63f6b322679 ]
simple_mux_control_put() rejects values greater than e->items, but enum control values are zero based. For the two-entry mux used by this driver, valid values are 0 and 1, so value 2 must be rejected as well.
Accepting e->items can store an invalid mux state, pass it to the GPIO setter, and pass it on to the DAPM mux update path where it is used as an index into the enum text array.
Use the same >= e->items check used by the ASoC enum helpers.
--- sound/soc/codecs/simple-mux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/simple-mux.c +1 -1
@@ -40,7 +40,7 @@ static int simple_mux_control_put(struct snd_kcontrol *kcontrol,struct snd_soc_component *c =snd_soc_dapm_to_component (dapm);struct simple_mux *priv =snd_soc_component_get_drvdata (c); -if (ucontrol->value.enumerated.item[0 ] > e->items) +if (ucontrol->value.enumerated.item[0 ] >= e->items)return -EINVAL ;if (priv->mux == ucontrol->value.enumerated.item[0 ])
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 37/522 net: mana: Add NULL guards in teardown path to prevent panic on attach failure
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dipayaan Roy <[email protected]>
[ Upstream commit 17bfe0a8c014ee1d542ad352cd6a0a505361664a ]
When queue allocation fails partway through, the error cleanup frees and NULLs apc->tx_qp and apc->rxqs. Multiple teardown paths such as mana_remove(), mana_change_mtu() recovery, and internal error handling in mana_alloc_queues() can subsequently call into functions that dereference these pointers without NULL checks:
- mana_chn_setxdp() dereferences apc->rxqs[0], causing a NULL pointer dereference panic (CR2: 0000000000000000 at mana_chn_setxdp+0x26).
- mana_destroy_vport() iterates apc->rxqs without a NULL check.
- mana_fence_rqs() iterates apc->rxqs without a NULL check.
- mana_dealloc_queues() iterates apc->tx_qp without a NULL check.
Add NULL guards for apc->rxqs in mana_fence_rqs(), mana_destroy_vport(), and before the mana_chn_setxdp() call. Add a NULL guard for apc->tx_qp in mana_dealloc_queues() to skip TX queue draining when TX queues were never allocated or already freed.
--- drivers/net/ethernet/microsoft/mana/mana_en.c | 70 +++++++++++-------- 1 file changed, 41 insertions(+), 29 deletions(-)
drivers/net/ethernet/microsoft/mana/mana_en.c +41 -29
@@ -914,6 +914,9 @@ static void mana_fence_rqs(struct mana_port_context *apc)struct mana_rxq *rxq;int err; +if (!apc->rxqs) +return ; +for (rxq_idx =0 ; rxq_idx < apc->num_queues; rxq_idx++) { rxq = apc->rxqs[rxq_idx]; err =mana_fence_rq (apc, rxq);
@@ -1815,13 +1818,16 @@ static void mana_destroy_vport(struct mana_port_context *apc)struct mana_rxq *rxq;u32 rxq_idx; -for (rxq_idx =0 ; rxq_idx < apc->num_queues; rxq_idx++) { - rxq = apc->rxqs[rxq_idx]; -if (!rxq) -continue ; +if (apc->rxqs) { -mana_destroy_rxq (apc, rxq, true); - apc->rxqs[rxq_idx] =NULL ; +for (rxq_idx =0 ; rxq_idx < apc->num_queues; rxq_idx++) { + rxq = apc->rxqs[rxq_idx]; +if (!rxq) +continue ; + +mana_destroy_rxq (apc, rxq, true); + apc->rxqs[rxq_idx] =NULL ; + } }mana_destroy_txq (apc);
@@ -2010,7 +2016,8 @@ static int mana_dealloc_queues(struct net_device *ndev)if (apc->port_is_up)return -EINVAL ; -mana_chn_setxdp (apc,NULL ); +if (apc->rxqs) +mana_chn_setxdp (apc,NULL );if (gd->gdma_context->is_pf)mana_pf_deregister_filter (apc);
@@ -2028,33 +2035,38 @@ static int mana_dealloc_queues(struct net_device *ndev)* number of queues. */ -for (i =0 ; i < apc->num_queues; i++) { - txq = &apc->tx_qp[i].txq; - tsleep =1000 ; -while (atomic_read (&txq->pending_sends) >0 && -time_before (jiffies, timeout)) { -usleep_range (tsleep, tsleep +1000 ); - tsleep <<=1 ; - } -if (atomic_read (&txq->pending_sends)) { - err =pcie_flr (to_pci_dev (gd->gdma_context->dev)); -if (err) { -netdev_err (ndev,"flr failed %d with %d pkts pending in txq %u\n" , - err,atomic_read (&txq->pending_sends), - txq->gdma_txq_id); +if (apc->tx_qp) { +for (i =0 ; i < apc->num_queues; i++) { + txq = &apc->tx_qp[i].txq; + tsleep =1000 ; +while (atomic_read (&txq->pending_sends) >0 && +time_before (jiffies, timeout)) { +usleep_range (tsleep, tsleep +1000 ); + tsleep <<=1 ; + } +if (atomic_read (&txq->pending_sends)) { + err = +pcie_flr (to_pci_dev (gd->gdma_context->dev)); +if (err) { +netdev_err (ndev,"flr failed %d with %d pkts pending in txq %u\n" , + err, +atomic_read (&txq->pending_sends), + txq->gdma_txq_id); + } +break ; } -break ; } - } -for (i =0 ; i < apc->num_queues; i++) { - txq = &apc->tx_qp[i].txq; -while ((skb =skb_dequeue (&txq->pending_skbs))) { -mana_unmap_skb (skb, apc); -dev_kfree_skb_any (skb); +for (i =0 ; i < apc->num_queues; i++) { + txq = &apc->tx_qp[i].txq; +while ((skb =skb_dequeue (&txq->pending_skbs))) { +mana_unmap_skb (skb, apc); +dev_kfree_skb_any (skb); + } +atomic_set (&txq->pending_sends,0 ); } -atomic_set (&txq->pending_sends,0 ); } +/* We're 100% sure the queues can no longer be woken up, because * we're sure now mana_poll_tx_cq() can't be running. */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 38/522 sctp: fix race between sctp_wait_for_connect and peeloff
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhenghang Xiao <[email protected]>
[ Upstream commit f14fe6395a8b3d961a61e138ad7b36ba3626dd4e ]
sctp_wait_for_connect() drops and re-acquires the socket lock while waiting for the association to reach ESTABLISHED state. During this window, another thread can peeloff the association to a new socket via getsockopt(SCTP_SOCKOPT_PEELOFF), changing asoc->base.sk. After re-acquiring the old socket lock, sctp_wait_for_connect() returns success without noticing the migration — the caller then accesses the association under the wrong lock in sctp_datamsg_from_user().
Add the same sk != asoc->base.sk check that sctp_wait_for_sndbuf() already has, returning an error if the association was migrated while we slept.
--- net/sctp/socket.c | 2 ++ 1 file changed, 2 insertions(+)
net/sctp/socket.c +2 -0
@@ -9364,6 +9364,8 @@ static int sctp_wait_for_connect(struct sctp_association *asoc, long *timeo_p)release_sock (sk); current_timeo =schedule_timeout (current_timeo);lock_sock (sk); +if (sk != asoc->base.sk) + goto do_error; *timeo_p = current_timeo; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 39/522 ipv6: fix possible infinite loop in rt6_fill_node()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <[email protected]>
[ Upstream commit 9f72412bcf60144f252b0d6205106abf14344abc ]
Sashiko reported this issue [1]. Apply the same fix as
commit f8d8ce1b515a ("ipv6: fix possible infinite loop in fib6_info_uses_dev()").
Writers holding tb6_lock can list_del_rcu(&rt->fib6_siblings) without waiting for RCU readers; rt->fib6_siblings.next then still points into the old ring and this softirq-side walker never reaches &rt->fib6_siblings, causing a CPU stall. fib6_del_route() always WRITE_ONCE()s rt->fib6_nsiblings to 0 before list_del_rcu(), so an inside-loop check is a reliable detach signal.
[1] https://sashiko.dev/#/patchset/20260526020227.4857-1-jiayuan.chen%40linux.dev
--- net/ipv6/route.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv6/route.c +2 -0
@@ -5790,6 +5790,8 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb, goto nla_put_failure; } +if (!READ_ONCE (rt->fib6_nsiblings)) +break ; }rcu_read_unlock ();
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 40/522 ipv6: fix possible infinite loop in fib6_select_path()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <[email protected]>
[ Upstream commit 9c7da87c2dc860bb17ca1ece942495d28b1ce3b9 ]
Found while auditing the same pattern Sashiko reported in rt6_fill_node() [1]. Apply the same fix as
commit f8d8ce1b515a ("ipv6: fix possible infinite loop in fib6_info_uses_dev()").
Writers holding tb6_lock can list_del_rcu(&first->fib6_siblings) without waiting for RCU readers; first->fib6_siblings.next then still points into the old ring and this softirq-side walker never reaches &first->fib6_siblings as its terminator. fib6_purge_rt() always WRITE_ONCE()s first->fib6_nsiblings to 0 before list_del_rcu(), so an inside-loop check is a reliable detach signal.
[1] https://sashiko.dev/#/patchset/20260526020227.4857-1-jiayuan.chen%40linux.dev
--- net/ipv6/route.c | 3 +++ 1 file changed, 3 insertions(+)
net/ipv6/route.c +3 -0
@@ -486,6 +486,9 @@ void fib6_select_path(const struct net *net, struct fib6_result *res,const struct fib6_nh *nh = sibling->fib6_nh;int nh_upper_bound; +if (!READ_ONCE (first->fib6_nsiblings)) +break ; + nh_upper_bound =atomic_read (&nh->fib_nh_upper_bound);if (hash > nh_upper_bound)continue ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 41/522 net: skbuff: fix pskb_carve leaking zcopy pages
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
[ Upstream commit ff6e798c2eac3ebd0501ad7e796f583fab928de8 ]
When SKBFL_MANAGED_FRAG_REFS is set, frag pages are not refcounted but their lifetime is controlled by the attached ubuf_info. To make a copy of the skb_shared_info, we either should clear the flag and reference the frags, or keep the flag and have frags unreferenced.
pskb_carve_inside_header() and pskb_carve_inside_nonlinear() don't follow the rule and thus can leak page references. Let's clear SKBFL_MANAGED_FRAG_REFS from the original skb to fix it. It's the simplest way to address it, but there are more performant ways to do that if it ever becomes a problem.
--- net/core/skbuff.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
net/core/skbuff.c +10 -0
@@ -6232,6 +6232,11 @@ static int pskb_carve_inside_header(struct sk_buff *skb, const u32 off,skb_copy_from_linear_data_offset (skb, off, data, new_hlen); skb->len -= off; +/* Remove SKBFL_MANAGED_FRAG_REFS instead of trying to honour it +* while refcounting frags below. +*/ +skb_zcopy_downgrade_managed (skb); + memcpy((struct skb_shared_info *)(data + size), skb_shinfo(skb), offsetof(struct skb_shared_info,
@@ -6344,6 +6349,11 @@ static int pskb_carve_inside_nonlinear(struct sk_buff *skb, const u32 off,return -ENOMEM ; size =SKB_WITH_OVERHEAD (size); +/* Remove SKBFL_MANAGED_FRAG_REFS instead of trying to honour it +* while refcounting frags below. +*/ +skb_zcopy_downgrade_managed (skb); +memcpy ((struct skb_shared_info *)(data + size), skb_shinfo(skb), offsetof(struct skb_shared_info, frags[0]));if (skb_orphan_frags (skb, gfp_mask)) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 42/522 batman-adv: v: stop OGMv2 on disabled interface
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
commit f8ce8b8331a1bc44ad4905886a482214d428b253 upstream.
When a batadv_hard_iface is disabled, its mesh_iface pointer is set to NULL. However, batadv_v_ogm_send_meshif() may still dispatch OGMs via batadv_v_ogm_queue_on_if() for interfaces that have since lost their mesh_iface association. This results in a NULL pointer dereference when batadv_v_ogm_queue_on_if() unconditionally calls netdev_priv() on the now NULL hard_iface->mesh_iface to retrieve the batadv_priv.
It is necessary to ensure that the batadv_v_ogm_queue_on_if() checks that it is using the same mesh_iface for which batadv_v_ogm_send_meshif() was called.
--- net/batman-adv/bat_v_ogm.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-)
net/batman-adv/bat_v_ogm.c +21 -12
@@ -116,14 +116,14 @@ static void batadv_v_ogm_start_timer(struct batadv_priv *bat_priv)/** * batadv_v_ogm_send_to_if() - send a batman ogm using a given interface +* @bat_priv: the bat priv with all the mesh interface information * @skb: the OGM to send * @hard_iface: the interface to use to send the OGM */ -static void batadv_v_ogm_send_to_if (struct sk_buff *skb, +static void batadv_v_ogm_send_to_if (struct batadv_priv *bat_priv, +struct sk_buff *skb,struct batadv_hard_iface *hard_iface) { -struct batadv_priv *bat_priv =netdev_priv (hard_iface->soft_iface); -if (hard_iface->if_status !=BATADV_IF_ACTIVE ) {kfree_skb (skb);return ;
@@ -190,6 +190,7 @@ static void batadv_v_ogm_aggr_list_free(struct batadv_hard_iface *hard_iface)/** * batadv_v_ogm_aggr_send() - flush & send aggregation queue +* @bat_priv: the bat priv with all the mesh interface information * @hard_iface: the interface with the aggregation queue to flush * * Aggregates all OGMv2 packets currently in the aggregation queue into a
@@ -199,7 +200,8 @@ static void batadv_v_ogm_aggr_list_free(struct batadv_hard_iface *hard_iface)* * Caller needs to hold the hard_iface->bat_v.aggr_list.lock. */ -static void batadv_v_ogm_aggr_send (struct batadv_hard_iface *hard_iface) +static void batadv_v_ogm_aggr_send (struct batadv_priv *bat_priv, +struct batadv_hard_iface *hard_iface) {unsigned int aggr_len = hard_iface->bat_v.aggr_len;struct sk_buff *skb_aggr;
@@ -229,27 +231,32 @@ static void batadv_v_ogm_aggr_send(struct batadv_hard_iface *hard_iface)consume_skb (skb); } -batadv_v_ogm_send_to_if (skb_aggr, hard_iface); +batadv_v_ogm_send_to_if (bat_priv, skb_aggr, hard_iface); }/** * batadv_v_ogm_queue_on_if() - queue a batman ogm on a given interface +* @bat_priv: the bat priv with all the mesh interface information * @skb: the OGM to queue * @hard_iface: the interface to queue the OGM on */ -static void batadv_v_ogm_queue_on_if (struct sk_buff *skb, +static void batadv_v_ogm_queue_on_if (struct batadv_priv *bat_priv, +struct sk_buff *skb,struct batadv_hard_iface *hard_iface) { -struct batadv_priv *bat_priv =netdev_priv (hard_iface->soft_iface); +if (hard_iface->soft_iface != bat_priv->soft_iface) { +kfree_skb (skb); +return ; + }if (!atomic_read (&bat_priv->aggregated_ogms)) { -batadv_v_ogm_send_to_if (skb, hard_iface); +batadv_v_ogm_send_to_if (bat_priv, skb, hard_iface);return ; }spin_lock_bh (&hard_iface->bat_v.aggr_list.lock);if (!batadv_v_ogm_queue_left (skb, hard_iface)) -batadv_v_ogm_aggr_send (hard_iface); +batadv_v_ogm_aggr_send (bat_priv, hard_iface); hard_iface->bat_v.aggr_len +=batadv_v_ogm_len (skb);__skb_queue_tail (&hard_iface->bat_v.aggr_list, skb);
@@ -348,7 +355,7 @@ static void batadv_v_ogm_send_softif(struct batadv_priv *bat_priv)break ; } -batadv_v_ogm_queue_on_if (skb_tmp, hard_iface); +batadv_v_ogm_queue_on_if (bat_priv, skb_tmp, hard_iface);batadv_hardif_put (hard_iface); }rcu_read_unlock ();
@@ -388,12 +395,14 @@ void batadv_v_ogm_aggr_work(struct work_struct *work) {struct batadv_hard_iface_bat_v *batv;struct batadv_hard_iface *hard_iface; +struct batadv_priv *bat_priv; batv = container_of(work, struct batadv_hard_iface_bat_v, aggr_wq.work); hard_iface = container_of(batv, struct batadv_hard_iface, bat_v); + bat_priv =netdev_priv (hard_iface->soft_iface);spin_lock_bh (&hard_iface->bat_v.aggr_list.lock); -batadv_v_ogm_aggr_send (hard_iface); +batadv_v_ogm_aggr_send (bat_priv, hard_iface);spin_unlock_bh (&hard_iface->bat_v.aggr_list.lock);batadv_v_ogm_start_queue_timer (hard_iface);
@@ -583,7 +592,7 @@ static void batadv_v_ogm_forward(struct batadv_priv *bat_priv, if_outgoing->net_dev->name,ntohl (ogm_forward->throughput), ogm_forward->ttl, if_incoming->net_dev->name); -batadv_v_ogm_queue_on_if (skb, if_outgoing); +batadv_v_ogm_queue_on_if (bat_priv, skb, if_outgoing); out:batadv_orig_ifinfo_put (orig_ifinfo);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 43/522 batman-adv: tvlv: abort OGM send on tvlv append failure
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
commit 501368506563e151b322c8c3f228b796e615b90d upstream.
batadv_tvlv_container_ogm_append() could fail in two ways: a memory allocation failure when resizing the packet buffer, or the tvlv data exceeding U16_MAX bytes. In both cases the function previously returned the old (now stale) tvlv_value_len rather than signalling an error, causing the OGM/OGM2 send path to transmit a packet whose TVLV length field no longer matched the actual buffer contents. And because it also didn't fill in the new TVLV data, sending either uninitialized or corrupted data on the wire.
All errors in batadv_tvlv_container_ogm_append() must be forwarded to the caller. And the caller must abort the send of the OGM2. For B.A.T.M.A.N. IV, it is currently not allowed to abort the send. The non-TVLV part of the OGM must be queued up instead.
--- net/batman-adv/bat_iv_ogm.c | 16 +++++++++++++--- net/batman-adv/bat_v_ogm.c | 26 ++++++++++++++------------ net/batman-adv/tvlv.c | 17 ++++++++++++----- net/batman-adv/tvlv.h | 2 +- 4 files changed, 40 insertions(+), 21 deletions(-)
net/batman-adv/bat_iv_ogm.c +13 -3
@@ -782,6 +782,7 @@ static void batadv_iv_ogm_schedule_buff(struct batadv_hard_iface *hard_iface)u32 seqno;u16 tvlv_len =0 ;unsigned long send_time; +int ret;lockdep_assert_held (&hard_iface->bat_iv.ogm_buff_mutex);
@@ -805,9 +806,18 @@ static void batadv_iv_ogm_schedule_buff(struct batadv_hard_iface *hard_iface)* appended as it may alter the tt tvlv container */ batadv_tt_local_commit_changes (bat_priv); - tvlv_len =batadv_tvlv_container_ogm_append (bat_priv, ogm_buff, - ogm_buff_len, -BATADV_OGM_HLEN ); + ret =batadv_tvlv_container_ogm_append (bat_priv, ogm_buff, + ogm_buff_len, +BATADV_OGM_HLEN ); +if (ret <0 ) { +/* OGMs must be queued even when the buffer allocation for +* TVLVs failed. just fall back to the non-TVLV version +*/ + ret =0 ; + *ogm_buff_len =BATADV_OGM_HLEN ; + } + + tvlv_len = ret; } batadv_ogm_packet = (struct batadv_ogm_packet *)(*ogm_buff);
net/batman-adv/bat_v_ogm.c +14 -12
@@ -272,9 +272,9 @@ static void batadv_v_ogm_send_softif(struct batadv_priv *bat_priv)struct batadv_hard_iface *hard_iface;struct batadv_ogm2_packet *ogm_packet;struct sk_buff *skb, *skb_tmp; -unsigned char *ogm_buff; -int ogm_buff_len; -u16 tvlv_len =0 ; +unsigned char **ogm_buff; +int *ogm_buff_len; +u16 tvlv_len;int ret;lockdep_assert_held (&bat_priv->bat_v.ogm_buff_mutex);
@@ -282,25 +282,27 @@ static void batadv_v_ogm_send_softif(struct batadv_priv *bat_priv)if (atomic_read (&bat_priv->mesh_state) ==BATADV_MESH_DEACTIVATING ) goto out; - ogm_buff = bat_priv->bat_v.ogm_buff; - ogm_buff_len = bat_priv->bat_v.ogm_buff_len; + ogm_buff = &bat_priv->bat_v.ogm_buff; + ogm_buff_len = &bat_priv->bat_v.ogm_buff_len; +/* tt changes have to be committed before the tvlv data is * appended as it may alter the tt tvlv container */ batadv_tt_local_commit_changes (bat_priv); - tvlv_len =batadv_tvlv_container_ogm_append (bat_priv, &ogm_buff, - &ogm_buff_len, -BATADV_OGM2_HLEN ); + ret =batadv_tvlv_container_ogm_append (bat_priv, ogm_buff, + ogm_buff_len, +BATADV_OGM2_HLEN ); +if (ret <0 ) + goto reschedule; - bat_priv->bat_v.ogm_buff = ogm_buff; - bat_priv->bat_v.ogm_buff_len = ogm_buff_len; + tvlv_len = ret; - skb =netdev_alloc_skb_ip_align (NULL ,ETH_HLEN + ogm_buff_len); + skb =netdev_alloc_skb_ip_align (NULL ,ETH_HLEN + *ogm_buff_len);if (!skb) goto reschedule;skb_reserve (skb,ETH_HLEN ); -skb_put_data (skb, ogm_buff, ogm_buff_len); +skb_put_data (skb, *ogm_buff, *ogm_buff_len); ogm_packet = (struct batadv_ogm2_packet *)skb->data; ogm_packet->seqno =htonl (atomic_read (&bat_priv->bat_v.ogm_seqno));
net/batman-adv/tvlv.c +12 -5
@@ -8,6 +8,7 @@#include <linux/byteorder/generic.h> #include <linux/container_of.h> +#include <linux/errno.h> #include <linux/etherdevice.h> #include <linux/gfp.h> #include <linux/if_ether.h>
@@ -306,9 +307,10 @@ static bool batadv_tvlv_realloc_packet_buff(unsigned char **packet_buff,* The ogm packet might be enlarged or shrunk depending on the current size * and the size of the to-be-appended tvlv containers. * -* Return: size of all appended tvlv containers in bytes. +* Return: size of all appended tvlv containers in bytes (max U16_MAX), negative +* if operation failed */ -u16 batadv_tvlv_container_ogm_append (struct batadv_priv *bat_priv, +int batadv_tvlv_container_ogm_append (struct batadv_priv *bat_priv,unsigned char **packet_buff,int *packet_buff_len,int packet_min_len) {
@@ -316,6 +318,7 @@ u16 batadv_tvlv_container_ogm_append(struct batadv_priv *bat_priv,struct batadv_tvlv_hdr *tvlv_hdr;u16 tvlv_value_len;void *tvlv_value; +int tvlv_len_ret;bool ret;spin_lock_bh (&bat_priv->tvlv.container_list_lock);
@@ -323,9 +326,12 @@ u16 batadv_tvlv_container_ogm_append(struct batadv_priv *bat_priv, ret =batadv_tvlv_realloc_packet_buff (packet_buff, packet_buff_len, packet_min_len, tvlv_value_len); - -if (!ret) +if (!ret) { + tvlv_len_ret = -ENOMEM ; goto end; + } + + tvlv_len_ret = tvlv_value_len;if (!tvlv_value_len) goto end;
@@ -344,7 +350,8 @@ u16 batadv_tvlv_container_ogm_append(struct batadv_priv *bat_priv, end:spin_unlock_bh (&bat_priv->tvlv.container_list_lock); -return tvlv_value_len; + +return tvlv_len_ret; }/**
net/batman-adv/tvlv.h +1 -1
@@ -15,7 +15,7 @@void batadv_tvlv_container_register (struct batadv_priv *bat_priv,u8 type,u8 version,void *tvlv_value,u16 tvlv_value_len); -u16 batadv_tvlv_container_ogm_append (struct batadv_priv *bat_priv, +int batadv_tvlv_container_ogm_append (struct batadv_priv *bat_priv,unsigned char **packet_buff,int *packet_buff_len,int packet_min_len); void batadv_tvlv_ogm_receive(struct batadv_priv *bat_priv,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 44/522 batman-adv: tt: reject oversized local TVLV buffers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
commit 1e9fab756f8395096d5bba7be0c373c4c8f5d165 upstream.
The commit 3a359bf5c61d ("batman-adv: reject oversized global TT response buffers") added a check to ensure that a global return buffer size can be stored in an u16. The same buffer handling also exists for the local data buffer but was not touched.
A similar check should be also be in place for the local TVLV buffer. It doesn't have the similar attack surface because it is only generated from locally discovered MAC addresses but the dynamic nature could still cause temporarily to large buffers.
--- net/batman-adv/translation-table.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
net/batman-adv/translation-table.c +5 -3
@@ -924,12 +924,12 @@ batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv, {struct batadv_tvlv_tt_vlan_data *tt_vlan;struct batadv_softif_vlan *vlan; +size_t change_offset;u16 num_vlan =0 ;u16 vlan_entries =0 ;u16 total_entries =0 ;u16 tvlv_len;u8 *tt_change_ptr; -int change_offset;spin_lock_bh (&bat_priv->softif_vlan_list_lock);hlist_for_each_entry (vlan, &bat_priv->softif_vlan_list, list) {
@@ -948,8 +948,10 @@ batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv,if (*tt_len <0 ) *tt_len =batadv_tt_len (total_entries); - tvlv_len = *tt_len; - tvlv_len += change_offset; +if (check_add_overflow (*tt_len, change_offset, &tvlv_len)) { + tvlv_len =0 ; + goto out; + } *tt_data =kmalloc (tvlv_len,GFP_ATOMIC );if (!*tt_data) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 45/522 batman-adv: bla: avoid NULL-ptr deref for claim via dropped interface
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
commit f80d3d98d2ff78d9e2fe5d68b1f45948c4f7bd24 upstream.
Without rtnl_lock held, a hardif might be retrieved as primary interface of a meshif, but then (while operating on this interface) getting decoupled from the mesh interface. In this case, the meshif still exists but the pointer from the primary hardif to the meshif is set to NULL.
The mesh_iface must be checked first to be non-NULL before continuing to send an ARP request using meshif.
--- net/batman-adv/bridge_loop_avoidance.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/batman-adv/bridge_loop_avoidance.c +4 -2
@@ -356,12 +356,14 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, const u8 *mac, sizeof(local_claim_dest)); local_claim_dest.type = claimtype; - soft_iface = primary_if->soft_iface; + soft_iface =READ_ONCE (primary_if->soft_iface); +if (!soft_iface) + goto out; skb = arp_create(ARPOP_REPLY, ETH_P_ARP, /* IP DST: 0.0.0.0 */ zeroip, - primary_if->soft_iface, + soft_iface, /* IP SRC: 0.0.0.0 */ zeroip,/* Ethernet DST: Broadcast */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 46/522 batman-adv: tvlv: reject oversized TVLV packets
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
commit f50487e3566358b2b982b7801945e858c78ad9ab upstream.
batadv_tvlv_container_ogm_append() builds a TVLV packet section from the tvlv.container_list. The total size of this section is computed by batadv_tvlv_container_list_size(), which sums the sizes of all registered containers.
The return type and accumulator in batadv_tvlv_container_list_size() were u16. If the accumulated size exceeds U16_MAX, the value wraps around, causing the subsequent allocation in batadv_tvlv_container_ogm_append() to be undersized. The memcpy-style copy that follows would then write beyond the end of the allocated buffer, corrupting kernel memory.
Fix this by widening the return type of batadv_tvlv_container_list_size() to size_t. In batadv_tvlv_container_ogm_append(), check the computed length against U16_MAX before proceeding, and bail out as if the allocation had failed when the limit is exceeded.
--- net/batman-adv/tvlv.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
net/batman-adv/tvlv.c +8 -3
@@ -13,6 +13,7 @@#include <linux/gfp.h> #include <linux/if_ether.h> #include <linux/kref.h> +#include <linux/limits.h> #include <linux/list.h> #include <linux/lockdep.h> #include <linux/netdevice.h>
@@ -160,10 +161,10 @@ batadv_tvlv_container_get(struct batadv_priv *bat_priv, u8 type, u8 version)* * Return: size of all currently registered tvlv containers in bytes. */ -static u16 batadv_tvlv_container_list_size (struct batadv_priv *bat_priv) +static size_t batadv_tvlv_container_list_size (struct batadv_priv *bat_priv) {struct batadv_tvlv_container *tvlv; -u16 tvlv_len =0 ; +size_t tvlv_len =0 ;lockdep_assert_held (&bat_priv->tvlv.container_list_lock);
@@ -316,13 +317,17 @@ int batadv_tvlv_container_ogm_append(struct batadv_priv *bat_priv, {struct batadv_tvlv_container *tvlv;struct batadv_tvlv_hdr *tvlv_hdr; -u16 tvlv_value_len; +size_t tvlv_value_len;void *tvlv_value;int tvlv_len_ret;bool ret;spin_lock_bh (&bat_priv->tvlv.container_list_lock); tvlv_value_len =batadv_tvlv_container_list_size (bat_priv); +if (tvlv_value_len >U16_MAX ) { + tvlv_len_ret = -E2BIG ; + goto end; + } ret =batadv_tvlv_realloc_packet_buff (packet_buff, packet_buff_len, packet_min_len, tvlv_value_len);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 29/522 Bluetooth: 6lowpan: check skb_clone() return value in send_mcast_pkt()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Dongdong <[email protected]>
[ Upstream commit 3c40d381ce04f9575a5d8b542898183c3b4b38dc ]
The skb_clone() function can return NULL if memory allocation fails. send_mcast_pkt() calls skb_clone() without checking the return value, which can lead to a NULL pointer dereference in send_pkt() when it dereferences skb->data.
Add a NULL check after skb_clone() and skip the peer if the clone fails.
--- net/bluetooth/6lowpan.c | 2 ++ 1 file changed, 2 insertions(+)
net/bluetooth/6lowpan.c +2 -0
@@ -485,6 +485,8 @@ static int send_mcast_pkt(struct sk_buff *skb, struct net_device *netdev)int ret; local_skb =skb_clone (skb,GFP_ATOMIC ); +if (!local_skb) +continue ; BT_DBG("xmit %s to %pMR type %u IP %pI6c chan %p", netdev->name,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 47/522 batman-adv: iv: recover OGM scheduling after forward packet error
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
commit aa3153bd139a6c48667dcd02608d3b2c80bff02c upstream.
When batadv_iv_ogm_schedule_buff() fails to allocate and queue a forward packet for OGM transmission, the work item that drives periodic OGM scheduling is never re-armed. This silently halts transmission of the node's own OGMs on the affected interface — only OGMs from other peers continue to be aggregated and forwarded.
Fix this by tracking whether batadv_iv_ogm_queue_add() (and transitively batadv_iv_ogm_aggregate_new()) successfully scheduled a forward packet. When scheduling fails, batadv_iv_ogm_schedule_buff() falls back to queuing a dedicated recovery work item (reschedule_work) that fires after one originator interval and calls batadv_iv_ogm_schedule() again.
--- net/batman-adv/bat_iv_ogm.c | 76 +++++++++++++++++++++++++++---------- net/batman-adv/types.h | 3 ++ 2 files changed, 60 insertions(+), 19 deletions(-)
net/batman-adv/bat_iv_ogm.c +57 -19
@@ -224,6 +224,8 @@ static void batadv_iv_ogm_iface_disable(struct batadv_hard_iface *hard_iface) hard_iface->bat_iv.ogm_buff =NULL ;mutex_unlock (&hard_iface->bat_iv.ogm_buff_mutex); + +cancel_delayed_work_sync (&hard_iface->bat_iv.reschedule_work); }static void batadv_iv_ogm_iface_update_mac (struct batadv_hard_iface *hard_iface)
@@ -528,8 +530,10 @@ batadv_iv_ogm_can_aggregate(const struct batadv_ogm_packet *new_bat_ogm_packet,* @if_incoming: interface where the packet was received * @if_outgoing: interface for which the retransmission should be considered * @own_packet: true if it is a self-generated ogm +* +* Return: whether forward packet was scheduled */ -static void batadv_iv_ogm_aggregate_new(const unsigned char *packet_buff, +static bool batadv_iv_ogm_aggregate_new(const unsigned char *packet_buff, int packet_len, unsigned long send_time, bool direct_link, struct batadv_hard_iface *if_incoming,
@@ -553,13 +557,13 @@ static void batadv_iv_ogm_aggregate_new(const unsigned char *packet_buff, skb =netdev_alloc_skb_ip_align (NULL , skb_size);if (!skb) -return ; +return false; forw_packet_aggr =batadv_forw_packet_alloc (if_incoming, if_outgoing, queue_left, bat_priv, skb);if (!forw_packet_aggr) {kfree_skb (skb); -return ; +return false; } forw_packet_aggr->skb->priority =TC_PRIO_CONTROL ;
@@ -581,6 +585,8 @@ static void batadv_iv_ogm_aggregate_new(const unsigned char *packet_buff, batadv_iv_send_outstanding_bat_ogm_packet);batadv_forw_packet_ogmv1_queue (bat_priv, forw_packet_aggr, send_time); + +return true; }/* aggregate a new packet into the existing ogm packet */
@@ -610,8 +616,10 @@ static void batadv_iv_ogm_aggregate(struct batadv_forw_packet *forw_packet_aggr,* @if_outgoing: interface for which the retransmission should be considered * @own_packet: true if it is a self-generated ogm * @send_time: timestamp (jiffies) when the packet is to be sent +* +* Return: whether forward packet was scheduled */ -static void batadv_iv_ogm_queue_add(struct batadv_priv *bat_priv, +static bool batadv_iv_ogm_queue_add(struct batadv_priv *bat_priv, unsigned char *packet_buff, int packet_len, struct batadv_hard_iface *if_incoming,
@@ -663,14 +671,16 @@ static void batadv_iv_ogm_queue_add(struct batadv_priv *bat_priv,if (!own_packet &&atomic_read (&bat_priv->aggregated_ogms)) send_time += max_aggregation_jiffies; -batadv_iv_ogm_aggregate_new (packet_buff, packet_len, - send_time, direct_link, - if_incoming, if_outgoing, - own_packet); +return batadv_iv_ogm_aggregate_new (packet_buff, packet_len, + send_time, direct_link, + if_incoming, if_outgoing, + own_packet); }else {batadv_iv_ogm_aggregate (forw_packet_aggr, packet_buff, packet_len, direct_link);spin_unlock_bh (&bat_priv->forw_bat_list_lock); + +return true; } }
@@ -782,6 +792,8 @@ static void batadv_iv_ogm_schedule_buff(struct batadv_hard_iface *hard_iface)u32 seqno;u16 tvlv_len =0 ;unsigned long send_time; +bool reschedule = false; +bool scheduled;int ret;lockdep_assert_held (&hard_iface->bat_iv.ogm_buff_mutex);
@@ -810,11 +822,8 @@ static void batadv_iv_ogm_schedule_buff(struct batadv_hard_iface *hard_iface) ogm_buff_len, BATADV_OGM_HLEN);if (ret <0 ) { -/* OGMs must be queued even when the buffer allocation for -* TVLVs failed. just fall back to the non-TVLV version -*/ - ret =0 ; - *ogm_buff_len =BATADV_OGM_HLEN ; + reschedule = true; + goto out; } tvlv_len = ret;
@@ -836,8 +845,11 @@ static void batadv_iv_ogm_schedule_buff(struct batadv_hard_iface *hard_iface)/* OGMs from secondary interfaces are only scheduled on their * respective interfaces. */ -batadv_iv_ogm_queue_add (bat_priv, *ogm_buff, *ogm_buff_len, - hard_iface, hard_iface,1 , send_time); + scheduled =batadv_iv_ogm_queue_add (bat_priv, *ogm_buff, *ogm_buff_len, + hard_iface, hard_iface,1 , send_time); +if (!scheduled) + reschedule = true; + goto out; }
@@ -852,15 +864,28 @@ static void batadv_iv_ogm_schedule_buff(struct batadv_hard_iface *hard_iface)if (!kref_get_unless_zero (&tmp_hard_iface->refcount))continue ; -batadv_iv_ogm_queue_add (bat_priv, *ogm_buff, - *ogm_buff_len, hard_iface, - tmp_hard_iface,1 , send_time); - + scheduled =batadv_iv_ogm_queue_add (bat_priv, *ogm_buff, + *ogm_buff_len, hard_iface, + tmp_hard_iface,1 , send_time);batadv_hardif_put (tmp_hard_iface); + +if (!scheduled && tmp_hard_iface == hard_iface) + reschedule = true; }rcu_read_unlock (); out: +if (reschedule) { +/* there was a failure scheduling the own forward packet. +* as result, the batadv_iv_send_outstanding_bat_ogm_packet() +* work item is no longer scheduled. it is therefore necessary +* to reschedule it manually +*/ +queue_delayed_work (batadv_event_workqueue, + &hard_iface->bat_iv.reschedule_work, +msecs_to_jiffies (atomic_read (&bat_priv->orig_interval))); + } +batadv_hardif_put (primary_if); }
@@ -875,6 +900,17 @@ static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface)mutex_unlock (&hard_iface->bat_iv.ogm_buff_mutex); } +static void batadv_iv_ogm_reschedule (struct work_struct *work) +{ +struct delayed_work *delayed_work =to_delayed_work (work); +struct batadv_hard_iface *hard_iface; + + hard_iface =container_of (delayed_work, + struct batadv_hard_iface, + bat_iv.reschedule_work); +batadv_iv_ogm_schedule (hard_iface); +} +/** * batadv_iv_orig_ifinfo_sum() - Get bcast_own sum for originator over interface * @orig_node: originator which reproadcasted the OGMs directly
@@ -2278,6 +2314,8 @@ batadv_iv_ogm_neigh_is_sob(struct batadv_neigh_node *neigh1,static void batadv_iv_iface_enabled (struct batadv_hard_iface *hard_iface) { +INIT_DELAYED_WORK (&hard_iface->bat_iv.reschedule_work, batadv_iv_ogm_reschedule); +/* begin scheduling originator messages on that interface */ batadv_iv_ogm_schedule (hard_iface); }
net/batman-adv/types.h +3 -0
@@ -82,6 +82,9 @@ struct batadv_hard_iface_bat_iv {/** @ogm_seqno: OGM sequence number - used to identify each OGM */ atomic_t ogm_seqno; +/** @reschedule_work: recover OGM schedule after schedule error */ +struct delayed_work reschedule_work; +/** @ogm_buff_mutex: lock protecting ogm_buff and ogm_buff_len */ struct mutex ogm_buff_mutex; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 48/522 selftests: forwarding: lib: Add helpers for checksum handling
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Petr Machata <[email protected]>
commit 952e0ee38c7215c45192d8c899acd1830873f28b upstream.
In order to generate IGMPv3 and MLDv2 packets on the fly, we will need helpers to calculate the packet checksum.
The approach presented in this patch revolves around payload templates for mausezahn. These are mausezahn-like payload strings (01:23:45:...) with possibly one 2-byte sequence replaced with the word PAYLOAD. The main function is payload_template_calc_checksum(), which calculates RFC 1071 checksum of the message. There are further helpers to then convert the checksum to the payload format, and to expand it.
For IPv6, MLDv2 message checksum is computed using a pseudoheader that differs from the header used in the payload itself. The fact that the two messages are different means that the checksum needs to be returned as a separate quantity, instead of being expanded in-place in the payload itself. Furthermore, the pseudoheader includes a length of the message. Much like the checksum, this needs to be expanded in mausezahn format. And likewise for number of addresses for (S,G) entries. Thus we have several places where a computed quantity needs to be presented in the payload format. Add a helper u16_to_bytes(), which will be used in all these cases.
Stable-dep-of: 02cb2e6bacbb ("selftests: forwarding: vxlan_bridge_1d: fix test failure with br_netfilter enabled")
--- tools/testing/selftests/net/forwarding/lib.sh | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+)
tools/testing/selftests/net/forwarding/lib.sh +56 -0
@@ -1701,3 +1701,59 @@ hw_stats_monitor_test() log_test "${type}_stats notifications" } + +u16_to_bytes() +{ + local u16=$1; shift + + printf "%04x" $u16 | sed 's/^/000/;s/^.*\(..\)\(..\)$/\1:\2/' +} + +# Given a mausezahn-formatted payload (colon-separated bytes given as %02x), +# possibly with a keyword CHECKSUM stashed where a 16-bit checksum should be, +# calculate checksum as per RFC 1071, assuming the CHECKSUM field (if any) +# stands for 00:00. +payload_template_calc_checksum() +{ + local payload=$1; shift + + ( + # Set input radix. + echo "16i" + # Push zero for the initial checksum. + echo 0 + + # Pad the payload with a terminating 00: in case we get an odd + # number of bytes. + echo "${payload%:}:00:" | + sed 's/CHECKSUM/00:00/g' | + tr '[:lower:]' '[:upper:]' | + # Add the word to the checksum. + sed 's/\(..\):\(..\):/\1\2+\n/g' | + # Strip the extra odd byte we pushed if left unconverted. + sed 's/\(..\):$//' + + echo "10000 ~ +" # Calculate and add carry. + echo "FFFF r - p" # Bit-flip and print. + ) | + dc | + tr '[:upper:]' '[:lower:]' +} + +payload_template_expand_checksum() +{ + local payload=$1; shift + local checksum=$1; shift + + local ckbytes=$(u16_to_bytes $checksum) + + echo "$payload" | sed "s/CHECKSUM/$ckbytes/g" +} + +payload_template_nbytes() +{ + local payload=$1; shift + + payload_template_expand_checksum "${payload%:}" 0 | + sed 's/:/\n/g' | wc -l +}
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 49/522 batman-adv: tp_meter: directly shut down timer on cleanup
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
commit d5487249a81ea658717614009c8f46acc5b7101a upstream.
batadv_tp_sender_cleanup() was calling timer_delete_sync() followed by timer_delete() to guard against the timer handler re-arming itself between the two calls. This double-deletion hack relied on the sending status being set to 0 to suppress re-arming.
Replace both calls with a single timer_shutdown_sync(). This function both waits for any running timer callback to complete (like timer_delete_sync()) and permanently disarms the timer so it cannot be re-armed afterwards, making re-arming prevention unconditional and self-documenting.
The re-arming property is also required because otherwise:
1. context 0 (batadv_tp_recv_ack()) checks in batadv_tp_reset_sender_timer() if sending is still 1 -> it is
2. context 1 changes in batadv_tp_sender_shutdown() sending to 0 and in this process forces the kthread to stop timer in batadv_tp_sender_cleanup()
3. context 0 continues in batadv_tp_reset_sender_timer() and rearms the timer -> but the reference for it is already gone
--- net/batman-adv/tp_meter.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
net/batman-adv/tp_meter.c +1 -7
@@ -384,13 +384,7 @@ static void batadv_tp_sender_cleanup(struct batadv_priv *bat_priv,atomic_dec (&tp_vars->bat_priv->tp_num);/* kill the timer and remove its reference */ -del_timer_sync (&tp_vars->timer); -/* the worker might have rearmed itself therefore we kill it again. Note -* that if the worker should run again before invoking the following -* del_timer(), it would not re-arm itself once again because the status -* is OFF now -*/ -del_timer (&tp_vars->timer); +timer_shutdown_sync (&tp_vars->timer);batadv_tp_vars_put (tp_vars); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 50/522 batman-adv: tt: fix TOCTOU race for reported vlans
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
commit 94d27005016be15ffc638b2ecbc4d58805ad7b48 upstream.
The local TT based TVLV is generated by first checking the number of VLANs which have at least one TT entry. A new buffer with the correct size for the VLANs is then allocated. Only then, the list of VLANs s used to fill the VLAN entries in the buffer. During this time, the meshif_vlan_list_lock is held. But the actual number of TT entries of each VLAN can still increase during this time - just not the number of VLANs in the list.
But the prefilter used in the buffer size calculation might still cause an increase of the number of VLANs which need to be stored. Simply because a VLAN might now suddenly have at least one entry when it had none in the pre-alloc check - and then needs to occupy space which was not allocated.
It is better to overestimate the buffer size at the beginning and then fill the buffer only with the VLANs which are not empty.
--- net/batman-adv/translation-table.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
net/batman-adv/translation-table.c +10 -4
@@ -934,11 +934,8 @@ batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv,spin_lock_bh (&bat_priv->softif_vlan_list_lock);hlist_for_each_entry (vlan, &bat_priv->softif_vlan_list, list) { vlan_entries =atomic_read (&vlan->tt.num_entries); -if (vlan_entries <1 ) -continue ; - - num_vlan++; total_entries += vlan_entries; + num_vlan++; } change_offset =sizeof (**tt_data);
@@ -964,6 +961,7 @@ batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv, (*tt_data)->num_vlan =htons (num_vlan); tt_vlan = (struct batadv_tvlv_tt_vlan_data *)(*tt_data +1 ); + num_vlan =0 ;hlist_for_each_entry (vlan, &bat_priv->softif_vlan_list, list) { vlan_entries =atomic_read (&vlan->tt.num_entries);if (vlan_entries <1 )
@@ -974,8 +972,16 @@ batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv, tt_vlan->reserved =0 ; tt_vlan++; + num_vlan++; } +/* recalculate in case number of VLANs reduced */ + change_offset =sizeof (**tt_data); + change_offset += num_vlan *sizeof (*tt_vlan); + tvlv_len = *tt_len + change_offset; + + (*tt_data)->num_vlan =htons (num_vlan); + tt_change_ptr = (u8 *)*tt_data + change_offset; *tt_change = (struct batadv_tvlv_tt_change *)tt_change_ptr;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 51/522 batman-adv: tt: avoid empty VLAN responses
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
commit fa1bd704940b5bcbc32c0b28db9167405c8ee5e0 upstream.
The commit 16116dac2339 ("batman-adv: prevent TT request storms by not sending inconsistent TT TLVLs") added checks to the local (direct) TT response code. But the response can also be done indirectly by another node using the global TT state. To avoid such inconsistency states reported in the original fix, also avoid sending empty VLANs for replies from the global TT state.
--- net/batman-adv/translation-table.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
net/batman-adv/translation-table.c +18 -3
@@ -843,17 +843,19 @@ batadv_tt_prepare_tvlv_global_data(struct batadv_orig_node *orig_node, s32 *tt_len) {u16 num_vlan =0 ; -u16 num_entries =0 ;u16 tvlv_len =0 ;unsigned int change_offset;struct batadv_tvlv_tt_vlan_data *tt_vlan;struct batadv_orig_node_vlan *vlan; +u16 total_entries =0 ;u8 *tt_change_ptr; +int vlan_entries;spin_lock_bh (&orig_node->vlan_list_lock);hlist_for_each_entry (vlan, &orig_node->vlan_list, list) { + vlan_entries =atomic_read (&vlan->tt.num_entries); + total_entries += vlan_entries; num_vlan++; - num_entries +=atomic_read (&vlan->tt.num_entries); } change_offset =sizeof (**tt_data);
@@ -861,7 +863,7 @@ batadv_tt_prepare_tvlv_global_data(struct batadv_orig_node *orig_node,/* if tt_len is negative, allocate the space needed by the full table */ if (*tt_len <0 ) - *tt_len =batadv_tt_len (num_entries); + *tt_len =batadv_tt_len (total_entries);if (change_offset >U16_MAX || *tt_len >U16_MAX - change_offset) { *tt_len =0 ;
@@ -882,14 +884,27 @@ batadv_tt_prepare_tvlv_global_data(struct batadv_orig_node *orig_node, (*tt_data)->num_vlan =htons (num_vlan); tt_vlan = (struct batadv_tvlv_tt_vlan_data *)(*tt_data +1 ); + num_vlan =0 ;hlist_for_each_entry (vlan, &orig_node->vlan_list, list) { + vlan_entries =atomic_read (&vlan->tt.num_entries); +if (vlan_entries <1 ) +continue ; + tt_vlan->vid =htons (vlan->vid); tt_vlan->crc =htonl (vlan->tt.crc); tt_vlan->reserved =0 ; tt_vlan++; + num_vlan++; } +/* recalculate in case number of VLANs reduced */ + change_offset =sizeof (**tt_data); + change_offset += num_vlan *sizeof (*tt_vlan); + tvlv_len = *tt_len + change_offset; + + (*tt_data)->num_vlan =htons (num_vlan); + tt_change_ptr = (u8 *)*tt_data + change_offset; *tt_change = (struct batadv_tvlv_tt_change *)tt_change_ptr;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 52/522 batman-adv: bla: avoid double decrement of bla.num_requests
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
commit 83ab69bd12b80f6ea169c8bea6977701b53a043d upstream.
The bla.num_requests is increased when no request_sent was in progress. And it is decremented in various places (announcement was received, backbone is purged, periodic work). But the check if the request_sent is actually set to a specific state and the atomic_dec/_inc are not safe because they are not atomic (TOCTOU) and multiple such code portions can run concurrently.
At the same time, it is necessary to modify request_sent (state) and bla.num_requests atomically. Otherwise batadv_bla_send_request() might set request_sent to 1 and is interrupted. batadv_handle_announce() can then set request_sent back to 0 and decrement num_requests before batadv_bla_send_request() incremented it.
The two operations must therefore be locked. And since state (request_sent) and wait_periods are only accessed inside this lock, they can be converted to simpler datatypes. And to avoid that the bla.num_requests is touched by a parallel running context with a valid backbone_gw reference after batadv_bla_purge_backbone_gw() ran, a third state "stopped" is required to correctly signal that a backbone_gw is in the state of being cleaned up.
--- net/batman-adv/bridge_loop_avoidance.c | 51 ++++++++++++++++++-------- net/batman-adv/soft-interface.c | 1 + net/batman-adv/types.h | 39 ++++++++++++++++---- 3 files changed, 67 insertions(+), 24 deletions(-)
net/batman-adv/bridge_loop_avoidance.c +35 -16
@@ -516,8 +516,8 @@ batadv_bla_get_backbone_gw(struct batadv_priv *bat_priv, const u8 *orig, entry->crc =BATADV_BLA_CRC_INIT ; entry->bat_priv = bat_priv;spin_lock_init (&entry->crc_lock); -atomic_set (&entry->request_sent,0 ); -atomic_set (&entry->wait_periods,0 ); + entry->state =BATADV_BLA_BACKBONE_GW_SYNCED ; + entry->wait_periods =0 ;ether_addr_copy (entry->orig, orig);INIT_WORK (&entry->report_work, batadv_bla_loopdetect_report);kref_init (&entry->refcount);
@@ -546,9 +546,13 @@ batadv_bla_get_backbone_gw(struct batadv_priv *bat_priv, const u8 *orig,batadv_bla_send_announce (bat_priv, entry);/* this will be decreased in the worker thread */ -atomic_inc (&entry->request_sent); -atomic_set (&entry->wait_periods,BATADV_BLA_WAIT_PERIODS ); -atomic_inc (&bat_priv->bla.num_requests); +spin_lock_bh (&bat_priv->bla.num_requests_lock); +if (entry->state ==BATADV_BLA_BACKBONE_GW_SYNCED ) { + entry->state =BATADV_BLA_BACKBONE_GW_UNSYNCED ; + entry->wait_periods =BATADV_BLA_WAIT_PERIODS ; +atomic_inc (&bat_priv->bla.num_requests); + } +spin_unlock_bh (&bat_priv->bla.num_requests_lock); }return entry;
@@ -651,10 +655,12 @@ static void batadv_bla_send_request(struct batadv_bla_backbone_gw *backbone_gw) backbone_gw->vid, BATADV_CLAIM_TYPE_REQUEST);/* no local broadcasts should be sent or received, for now. */ -if (!atomic_read (&backbone_gw->request_sent)) { +spin_lock_bh (&backbone_gw->bat_priv->bla.num_requests_lock); +if (backbone_gw->state ==BATADV_BLA_BACKBONE_GW_SYNCED ) { + backbone_gw->state =BATADV_BLA_BACKBONE_GW_UNSYNCED ;atomic_inc (&backbone_gw->bat_priv->bla.num_requests); -atomic_set (&backbone_gw->request_sent,1 ); } +spin_unlock_bh (&backbone_gw->bat_priv->bla.num_requests_lock); }/**
@@ -875,10 +881,12 @@ static bool batadv_handle_announce(struct batadv_priv *bat_priv, u8 *an_addr,/* if we have sent a request and the crc was OK, * we can allow traffic again. */ -if (atomic_read (&backbone_gw->request_sent)) { +spin_lock_bh (&bat_priv->bla.num_requests_lock); +if (backbone_gw->state ==BATADV_BLA_BACKBONE_GW_UNSYNCED ) { + backbone_gw->state =BATADV_BLA_BACKBONE_GW_SYNCED ;atomic_dec (&backbone_gw->bat_priv->bla.num_requests); -atomic_set (&backbone_gw->request_sent,0 ); } +spin_unlock_bh (&bat_priv->bla.num_requests_lock); }batadv_backbone_gw_put (backbone_gw);
@@ -1257,9 +1265,13 @@ static void batadv_bla_purge_backbone_gw(struct batadv_priv *bat_priv, int now) purged = true;/* don't wait for the pending request anymore */ -if (atomic_read (&backbone_gw->request_sent)) +spin_lock_bh (&bat_priv->bla.num_requests_lock); +if (backbone_gw->state ==BATADV_BLA_BACKBONE_GW_UNSYNCED )atomic_dec (&bat_priv->bla.num_requests); + backbone_gw->state =BATADV_BLA_BACKBONE_GW_STOPPED ; +spin_unlock_bh (&bat_priv->bla.num_requests_lock); +batadv_bla_del_backbone_claims (backbone_gw);hlist_del_rcu (&backbone_gw->hash_entry);
@@ -1510,7 +1522,7 @@ static void batadv_bla_periodic_work(struct work_struct *work)batadv_bla_send_loopdetect (bat_priv, backbone_gw); -/* request_sent is only set after creation to avoid +/* state is only set to unsynced after creation to avoid * problems when we are not yet known as backbone gw * in the backbone. *
@@ -1519,14 +1531,21 @@ static void batadv_bla_periodic_work(struct work_struct *work)* some grace time. */ -if (atomic_read (&backbone_gw->request_sent) ==0 ) -continue ; +spin_lock_bh (&bat_priv->bla.num_requests_lock); +if (backbone_gw->state !=BATADV_BLA_BACKBONE_GW_UNSYNCED ) + goto unlock_next; -if (!atomic_dec_and_test (&backbone_gw->wait_periods)) -continue ; +if (backbone_gw->wait_periods >0 ) + backbone_gw->wait_periods--; + +if (backbone_gw->wait_periods >0 ) + goto unlock_next; + backbone_gw->state =BATADV_BLA_BACKBONE_GW_SYNCED ;atomic_dec (&backbone_gw->bat_priv->bla.num_requests); -atomic_set (&backbone_gw->request_sent,0 ); + +unlock_next: +spin_unlock_bh (&bat_priv->bla.num_requests_lock); }rcu_read_unlock (); }
net/batman-adv/soft-interface.c +1 -0
@@ -785,6 +785,7 @@ static int batadv_softif_init_late(struct net_device *dev)atomic_set (&bat_priv->tt.ogm_append_cnt,0 );#ifdef CONFIG_BATMAN_ADV_BLA atomic_set (&bat_priv->bla.num_requests,0 ); +spin_lock_init (&bat_priv->bla.num_requests_lock);#endif atomic_set (&bat_priv->tp_num,0 );
net/batman-adv/types.h +31 -8
@@ -1026,6 +1026,12 @@ struct batadv_priv_bla {/** @num_requests: number of bla requests in flight */ atomic_t num_requests; +/** +* @num_requests_lock: locks update num_requests + +* batadv_backbone_gw::state + batadv_backbone_gw::wait_periods update +*/ +spinlock_t num_requests_lock; +/** * @claim_hash: hash table containing mesh nodes this host has claimed */
@@ -1748,6 +1754,27 @@ struct batadv_priv {#ifdef CONFIG_BATMAN_ADV_BLA +enum batadv_bla_backbone_gw_state { +/** +* @BATADV_BLA_BACKBONE_GW_STOPPED: backbone gw is being removed +* and it must not longer work on requests +*/ +BATADV_BLA_BACKBONE_GW_STOPPED , + +/** +* @BATADV_BLA_BACKBONE_GW_UNSYNCED: backbone was detected out +* of sync and a request was send. No traffic is forwarded until the +* situation is resolved +*/ +BATADV_BLA_BACKBONE_GW_UNSYNCED , + +/** +* @BATADV_BLA_BACKBONE_GW_SYNCED: backbone is consider to be in +* sync. traffic can be forwarded +*/ +BATADV_BLA_BACKBONE_GW_SYNCED , +}; +/** * struct batadv_bla_backbone_gw - batman-adv gateway bridged into the LAN */
@@ -1773,16 +1800,12 @@ struct batadv_bla_backbone_gw {/** * @wait_periods: grace time for bridge forward delays and bla group * forming at bootup phase - no bcast traffic is formwared until it has -* elapsed +* elapsed. Must only be access with num_requests_lock. */ -atomic_t wait_periods; +u8 wait_periods; -/** -* @request_sent: if this bool is set to true we are out of sync with -* this backbone gateway - no bcast traffic is formwared until the -* situation was resolved -*/ -atomic_t request_sent; +/** @state: sync state. Must only be access with num_requests_lock. */ +enum batadv_bla_backbone_gw_state state;/** @crc: crc16 checksum over all claims */ u16 crc;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 53/522 mm/page_alloc: clear page->private in free_pages_prepare()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikhail Gavrilov <[email protected]>
[ Upstream commit ac1ea219590c09572ed5992dc233bbf7bb70fef9 ]
Several subsystems (slub, shmem, ttm, etc.) use page->private but don't clear it before freeing pages. When these pages are later allocated as high-order pages and split via split_page(), tail pages retain stale page->private values.
This causes a use-after-free in the swap subsystem. The swap code uses page->private to track swap count continuations, assuming freshly allocated pages have page->private == 0. When stale values are present, swap_count_continued() incorrectly assumes the continuation list is valid and iterates over uninitialized page->lru containing LIST_POISON values, causing a crash:
KASAN: maybe wild-memory-access in range [0xdead000000000100-0xdead000000000107] RIP: 0010:__do_sys_swapoff+0x1151/0x1860
Fix this by clearing page->private in free_pages_prepare(), ensuring all freed pages have clean state regardless of previous use.
--- mm/page_alloc.c | 1 + 1 file changed, 1 insertion(+)
mm/page_alloc.c +1 -0
@@ -1483,6 +1483,7 @@ static __always_inline bool free_pages_prepare(struct page *page,page_cpupid_reset_last (page); page->flags &= ~PAGE_FLAGS_CHECK_AT_PREP ; + page->private =0 ;reset_page_owner (page, order);page_table_check_free (page, order);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 54/522 selftests/bpf: add generic BPF program tester-loader
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrii Nakryiko <[email protected]>
[ Upstream commit 537c3f66eac137a02ec50a40219d2da6597e5dc9 ]
It's become a common pattern to have a collection of small BPF programs in one BPF object file, each representing one test case. On user-space side of such tests we maintain a table of program names and expected failure or success, along with optional expected verifier log message.
This works, but each set of tests reimplement this mundane code over and over again, which is a waste of time for anyone trying to add a new set of tests. Furthermore, it's quite error prone as it's way too easy to miss some entries in these manually maintained test tables (as evidences by dynptr_fail tests, in which ringbuf_release_uninit_dynptr subtest was accidentally missed; this is fixed in next patch).
So this patch implements generic test_loader, which accepts skeleton name and handles the rest of details: opens and loads BPF object file, making sure each program is tested in isolation. Optionally each test case can specify expected BPF verifier log message. In case of failure, tester makes sure to report verifier log, but it also reports verifier log in verbose mode unconditionally.
Now, the interesting deviation from existing custom implementations is the use of btf_decl_tag attribute to specify expected-to-fail vs expected-to-succeed markers and, optionally, expected log message directly next to BPF program source code, eliminating the need to manually create and update table of tests.
We define few macros wrapping btf_decl_tag with a convention that all values of btf_decl_tag start with "comment:" prefix, and then utilizing a very simple "just_some_text_tag" or "some_key_name=<value>" pattern to define things like expected success/failure, expected verifier message, extra verifier log level (if necessary). This approach is demonstrated by next patch in which two existing sets of failure tests are converted.
Tester supports both expected-to-fail and expected-to-succeed programs, though this patch set didn't convert any existing expected-to-succeed programs yet, as existing tests couple BPF program loading with their further execution through attach or test_prog_run. One way to allow testing scenarios like this would be ability to specify custom callback, executed for each successfully loaded BPF program. This is left for follow up patches, after some more analysis of existing test cases.
This test_loader is, hopefully, a start of a test_verifier-like runner, but integrated into test_progs infrastructure. It will allow much better "user experience" of defining low-level verification tests that can take advantage of all the libbpf-provided nicety features on BPF side: global variables, declarative maps, etc. All while having a choice of defining it in C or as BPF assembly (through __attribute__((naked)) functions and using embedded asm), depending on what makes most sense in each particular case. This will be explored in follow up patches as well.
Stable-dep-of: 95ebb376176c ("selftests/bpf: Convert test_global_funcs test to test_loader framework")
--- tools/testing/selftests/bpf/Makefile | 2 +- tools/testing/selftests/bpf/progs/bpf_misc.h | 5 + tools/testing/selftests/bpf/test_loader.c | 233 +++++++++++++++++++ tools/testing/selftests/bpf/test_progs.h | 33 +++ 4 files changed, 272 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/bpf/test_loader.c
tools/testing/selftests/bpf/Makefile +1 -1
@@ -519,7 +519,7 @@ TRUNNER_BPF_PROGS_DIR := progs TRUNNER_EXTRA_SOURCES := test_progs.c cgroup_helpers.c trace_helpers.c \ network_helpers.c testing_helpers.c \ btf_helpers.c flow_dissector_load.h \ - cap_helpers.c + cap_helpers.c test_loader.c TRUNNER_EXTRA_FILES := $(OUTPUT)/urandom_read $(OUTPUT)/bpf_testmod.ko \ $(OUTPUT)/liburandom_read.so \ $(OUTPUT)/xdp_synproxy \
tools/testing/selftests/bpf/progs/bpf_misc.h +5 -0
@@ -2,6 +2,11 @@#ifndef __BPF_MISC_H__#define __BPF_MISC_H__ +#define __msg (msg) __attribute__((btf_decl_tag("comment:test_expect_msg=" msg))) +#define __failure __attribute__((btf_decl_tag("comment:test_expect_failure"))) +#define __success __attribute__((btf_decl_tag("comment:test_expect_success"))) +#define __log_level (lvl) __attribute__((btf_decl_tag("comment:test_log_level="#lvl))) +#if defined(__TARGET_ARCH_x86)#define SYSCALL_WRAPPER 1#define SYS_PREFIX "__x64_"
tools/testing/selftests/bpf/test_loader.c new file +233 -0
233 lines not on this page · raw message
tools/testing/selftests/bpf/test_progs.h +33 -0
@@ -1,4 +1,7 @@/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __TEST_PROGS_H +#define __TEST_PROGS_H +#include <stdio.h> #include <unistd.h> #include <errno.h>
@@ -210,6 +213,12 @@ int test__join_cgroup(const char *path); #define CHECK_ATTR(condition, tag, format...) \ _CHECK(condition, tag, tattr.duration, format) +#define ASSERT_FAIL(fmt, args...) ({ \ + static int duration = 0; \ + CHECK(false, "", fmt"\n", ##args); \ + false; \ +}) +#define ASSERT_TRUE (actual, name) ({ \ static int duration = 0; \ bool ___ok = (actual); \
@@ -395,3 +404,27 @@ int write_sysctl(const char *sysctl, const char *value);#endif #define BPF_TESTMOD_TEST_FILE "/sys/kernel/bpf_testmod" + +struct test_loader { +char *log_buf; +size_t log_buf_sz; + +struct bpf_object *obj; +}; + +typedef const void *(*skel_elf_bytes_fn )(size_t *sz); + +extern void test_loader__run_subtests (struct test_loader *tester, +const char *skel_name, +skel_elf_bytes_fn elf_bytes_factory); + +extern void test_loader_fini (struct test_loader *tester); + +#define RUN_TESTS (skel) ({ \ + struct test_loader tester = {}; \ + \ + test_loader__run_subtests(&tester, #skel, skel##__elf_bytes); \ + test_loader_fini(&tester); \ +}) + +#endif /* __TEST_PROGS_H */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 55/522 selftests/bpf: Convert test_global_funcs test to test_loader framework
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrii Nakryiko <[email protected]>
[ Upstream commit 95ebb376176c52382293e05e63f142114a5e40ef ]
Convert 17 test_global_funcs subtests into test_loader framework for easier maintenance and more declarative way to define expected failures/successes.
[ Notes: This backport fixes backport commit bbac91d57ac2 ("bpf: Allow
reads from uninit stack"), which broke the BPF selftest build. A minor conflict needed resolution in test_global_func10.c on the error message. ]
--- .../bpf/prog_tests/test_global_funcs.c | 131 +++++------------- .../selftests/bpf/progs/test_global_func1.c | 6 +- .../selftests/bpf/progs/test_global_func10.c | 1 + .../selftests/bpf/progs/test_global_func11.c | 4 +- .../selftests/bpf/progs/test_global_func12.c | 4 +- .../selftests/bpf/progs/test_global_func13.c | 4 +- .../selftests/bpf/progs/test_global_func14.c | 4 +- .../selftests/bpf/progs/test_global_func15.c | 4 +- .../selftests/bpf/progs/test_global_func16.c | 4 +- .../selftests/bpf/progs/test_global_func17.c | 4 +- .../selftests/bpf/progs/test_global_func2.c | 43 +++++- .../selftests/bpf/progs/test_global_func3.c | 10 +- .../selftests/bpf/progs/test_global_func4.c | 55 +++++++- .../selftests/bpf/progs/test_global_func5.c | 4 +- .../selftests/bpf/progs/test_global_func6.c | 4 +- .../selftests/bpf/progs/test_global_func7.c | 4 +- .../selftests/bpf/progs/test_global_func8.c | 4 +- .../selftests/bpf/progs/test_global_func9.c | 4 +- 18 files changed, 172 insertions(+), 122 deletions(-)
tools/testing/selftests/bpf/prog_tests/test_global_funcs.c +34 -97
@@ -1,104 +1,41 @@// SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #include <test_progs.h> - -const char *err_str; -bool found; - -static int libbpf_debug_print (enum libbpf_print_level level, -const char *format,va_list args) -{ -char *log_buf; - -if (level !=LIBBPF_WARN || -strcmp (format,"libbpf: \n%s\n" )) { -vprintf (format, args); -return 0 ; - } - - log_buf = va_arg(args, char *); -if (!log_buf) - goto out; -if (err_str &&strstr (log_buf, err_str) ==0 ) - found = true; -out: -printf (format, log_buf); -return 0 ; -} - -extern int extra_prog_load_log_flags; - -static int check_load (const char *file) -{ -struct bpf_object *obj =NULL ; -struct bpf_program *prog; -int err; - - found = false; - - obj =bpf_object__open_file (file,NULL ); - err =libbpf_get_error (obj); -if (err) -return err; - - prog =bpf_object__next_program (obj,NULL ); -if (!prog) { - err = -ENOENT ; - goto err_out; - } - -bpf_program__set_flags (prog,BPF_F_TEST_RND_HI32 ); -bpf_program__set_log_level (prog, extra_prog_load_log_flags); - - err =bpf_object__load (obj); - -err_out: -bpf_object__close (obj); -return err; -} - -struct test_def { -const char *file; -const char *err_str; -}; +#include "test_global_func1.skel.h" +#include "test_global_func2.skel.h" +#include "test_global_func3.skel.h" +#include "test_global_func4.skel.h" +#include "test_global_func5.skel.h" +#include "test_global_func6.skel.h" +#include "test_global_func7.skel.h" +#include "test_global_func8.skel.h" +#include "test_global_func9.skel.h" +#include "test_global_func10.skel.h" +#include "test_global_func11.skel.h" +#include "test_global_func12.skel.h" +#include "test_global_func13.skel.h" +#include "test_global_func14.skel.h" +#include "test_global_func15.skel.h" +#include "test_global_func16.skel.h" +#include "test_global_func17.skel.h" void test_test_global_funcs (void ) { -struct test_def tests[] = { - {"test_global_func1.bpf.o" ,"combined stack size of 4 calls is 544" }, - {"test_global_func2.bpf.o" }, - {"test_global_func3.bpf.o" ,"the call stack of 8 frames" }, - {"test_global_func4.bpf.o" }, - {"test_global_func5.bpf.o" ,"expected pointer to ctx, but got PTR" }, - {"test_global_func6.bpf.o" ,"modified ctx ptr R2" }, - {"test_global_func7.bpf.o" ,"foo() doesn't return scalar" }, - {"test_global_func8.bpf.o" }, - {"test_global_func9.bpf.o" }, - {"test_global_func10.bpf.o" ,"invalid indirect read from stack" }, - {"test_global_func11.bpf.o" ,"Caller passes invalid args into func#1" }, - {"test_global_func12.bpf.o" ,"invalid mem access 'mem_or_null'" }, - {"test_global_func13.bpf.o" ,"Caller passes invalid args into func#1" }, - {"test_global_func14.bpf.o" ,"reference type('FWD S') size cannot be determined" }, - {"test_global_func15.bpf.o" ,"At program exit the register R0 has value" }, - {"test_global_func16.bpf.o" ,"invalid indirect read from stack" }, - {"test_global_func17.bpf.o" ,"Caller passes invalid args into func#1" }, - }; -libbpf_print_fn_t old_print_fn =NULL ; -int err, i, duration =0 ; - - old_print_fn =libbpf_set_print (libbpf_debug_print); - -for (i =0 ; i <ARRAY_SIZE (tests); i++) { -const struct test_def *test = &tests[i]; - -if (!test__start_subtest (test->file)) -continue ; - - err_str = test->err_str; - err =check_load (test->file); -CHECK_FAIL (!!err ^ !!err_str); -if (err_str) -CHECK (found,"" ,"expected string '%s'" , err_str); - } -libbpf_set_print (old_print_fn); +RUN_TESTS (test_global_func1); +RUN_TESTS (test_global_func2); +RUN_TESTS (test_global_func3); +RUN_TESTS (test_global_func4); +RUN_TESTS (test_global_func5); +RUN_TESTS (test_global_func6); +RUN_TESTS (test_global_func7); +RUN_TESTS (test_global_func8); +RUN_TESTS (test_global_func9); +RUN_TESTS (test_global_func10); +RUN_TESTS (test_global_func11); +RUN_TESTS (test_global_func12); +RUN_TESTS (test_global_func13); +RUN_TESTS (test_global_func14); +RUN_TESTS (test_global_func15); +RUN_TESTS (test_global_func16); +RUN_TESTS (test_global_func17); }
tools/testing/selftests/bpf/progs/test_global_func1.c +3 -3
@@ -3,10 +3,9 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" -#ifndef MAX_STACK #define MAX_STACK (512 - 3 * 32 + 8) -#endif static __attribute__ ((noinline))int f0 (int var,struct __sk_buff *skb)
@@ -39,7 +38,8 @@ int f3(int val, struct __sk_buff *skb, int var) } SEC("tc") -int test_cls (struct __sk_buff *skb) +__failure __msg("combined stack size of 4 calls is 544") +int global_func1(struct __sk_buff *skb) {return f0 (1 , skb) +f1 (skb) +f2 (2 , skb) +f3 (3 , skb,4 ); }
tools/testing/selftests/bpf/progs/test_global_func10.c +1 -0
@@ -2,6 +2,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" struct Small {long x;
tools/testing/selftests/bpf/progs/test_global_func11.c +3 -1
@@ -2,6 +2,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" struct S {int x;
@@ -13,7 +14,8 @@ __noinline int foo(const struct S *s) } SEC("cgroup_skb/ingress") -int test_cls (struct __sk_buff *skb) +__failure __msg("Caller passes invalid args into func#1") +int global_func11(struct __sk_buff *skb) {return foo ((const void *)skb); }
tools/testing/selftests/bpf/progs/test_global_func12.c +3 -1
@@ -2,6 +2,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" struct S {int x;
@@ -13,7 +14,8 @@ __noinline int foo(const struct S *s) } SEC("cgroup_skb/ingress") -int test_cls (struct __sk_buff *skb) +__failure __msg("invalid mem access 'mem_or_null'") +int global_func12(struct __sk_buff *skb) {const struct S s = {.x = skb->len };
tools/testing/selftests/bpf/progs/test_global_func13.c +3 -1
@@ -2,6 +2,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" struct S {int x;
@@ -16,7 +17,8 @@ __noinline int foo(const struct S *s) } SEC("cgroup_skb/ingress") -int test_cls (struct __sk_buff *skb) +__failure __msg("Caller passes invalid args into func#1") +int global_func13(struct __sk_buff *skb) {const struct S *s = (const struct S *)(0xbedabeda );
tools/testing/selftests/bpf/progs/test_global_func14.c +3 -1
@@ -2,6 +2,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" struct S ;
@@ -14,7 +15,8 @@ __noinline int foo(const struct S *s) } SEC("cgroup_skb/ingress") -int test_cls (struct __sk_buff *skb) +__failure __msg("reference type('FWD S') size cannot be determined") +int global_func14(struct __sk_buff *skb) {return foo (NULL );
tools/testing/selftests/bpf/progs/test_global_func15.c +3 -1
@@ -2,6 +2,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" __noinline int foo(unsigned int *v) {
@@ -12,7 +13,8 @@ __noinline int foo(unsigned int *v) } SEC("cgroup_skb/ingress") -int test_cls (struct __sk_buff *skb) +__failure __msg("At program exit the register R0 has value") +int global_func15(struct __sk_buff *skb) {unsigned int v =1 ;
tools/testing/selftests/bpf/progs/test_global_func16.c +3 -1
@@ -2,6 +2,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" __noinline int foo(int (*arr)[10]) {
@@ -12,7 +13,8 @@ __noinline int foo(int (*arr)[10]) } SEC("cgroup_skb/ingress") -int test_cls (struct __sk_buff *skb) +__failure __msg("invalid indirect read from stack") +int global_func16(struct __sk_buff *skb) {int array[10 ];
tools/testing/selftests/bpf/progs/test_global_func17.c +3 -1
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only #include <vmlinux.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" __noinline int foo(int *p) {
@@ -10,7 +11,8 @@ __noinline int foo(int *p)const volatile int i; SEC("tc") -int test_cls (struct __sk_buff *skb) +__failure __msg("Caller passes invalid args into func#1") +int global_func17(struct __sk_buff *skb) {return foo ((int *)&i); }
tools/testing/selftests/bpf/progs/test_global_func2.c +42 -1
46 lines not on this page · raw message
tools/testing/selftests/bpf/progs/test_global_func3.c +3 -7
@@ -3,6 +3,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" __attribute__ ((noinline))int f1 (struct __sk_buff *skb)
@@ -46,20 +47,15 @@ int f7(struct __sk_buff *skb)return f6 (skb); } -#ifndef NO_FN8 __attribute__ ((noinline))int f8 (struct __sk_buff *skb) {return f7 (skb); } -#endif SEC("tc") -int test_cls (struct __sk_buff *skb) +__failure __msg("the call stack of 8 frames") +int global_func3(struct __sk_buff *skb) { -#ifndef NO_FN8 return f8 (skb); -#else -return f7 (skb); -#endif }
tools/testing/selftests/bpf/progs/test_global_func4.c +53 -2
57 lines not on this page · raw message
tools/testing/selftests/bpf/progs/test_global_func5.c +3 -1
@@ -3,6 +3,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" __attribute__ ((noinline))int f1 (struct __sk_buff *skb)
@@ -25,7 +26,8 @@ int f3(int val, struct __sk_buff *skb) } SEC("tc") -int test_cls (struct __sk_buff *skb) +__failure __msg("expected pointer to ctx, but got PTR") +int global_func5(struct __sk_buff *skb) {return f1 (skb) +f2 (2 , skb) +f3 (3 , skb); }
tools/testing/selftests/bpf/progs/test_global_func6.c +3 -1
@@ -3,6 +3,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" __attribute__ ((noinline))int f1 (struct __sk_buff *skb)
@@ -25,7 +26,8 @@ int f3(int val, struct __sk_buff *skb) } SEC("tc") -int test_cls (struct __sk_buff *skb) +__failure __msg("modified ctx ptr R2") +int global_func6(struct __sk_buff *skb) {return f1 (skb) +f2 (2 , skb) +f3 (3 , skb); }
tools/testing/selftests/bpf/progs/test_global_func7.c +3 -1
@@ -3,6 +3,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" __attribute__ ((noinline))void foo (struct __sk_buff *skb)
@@ -11,7 +12,8 @@ void foo(struct __sk_buff *skb) } SEC("tc") -int test_cls (struct __sk_buff *skb) +__failure __msg("foo() doesn't return scalar") +int global_func7(struct __sk_buff *skb) {foo (skb);return 0 ;
tools/testing/selftests/bpf/progs/test_global_func8.c +3 -1
@@ -3,6 +3,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" __noinline int foo(struct __sk_buff *skb) {
@@ -10,7 +11,8 @@ __noinline int foo(struct __sk_buff *skb) } SEC("cgroup_skb/ingress") -int test_cls (struct __sk_buff *skb) +__success +int global_func8 (struct __sk_buff *skb) {if (!foo (skb))return 0 ;
tools/testing/selftests/bpf/progs/test_global_func9.c +3 -1
@@ -2,6 +2,7 @@#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> +#include "bpf_misc.h" struct S {int x;
@@ -74,7 +75,8 @@ __noinline int quuz(int **p) } SEC("cgroup_skb/ingress") -int test_cls (struct __sk_buff *skb) +__success +int global_func9 (struct __sk_buff *skb) {int result =0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 56/522 Revert "selftests/bpf: Workaround strict bpf_lsm return value check."
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Chaignon <[email protected]>
This reverts commit a1914d146622 ("selftests/bpf: Workaround strict bpf_lsm return value check"). It seems it was picked up by mistake.
It applies to a selftest that didn't exist in 6.1. The whole selftest was then backported as a stable-dep in commit 45108a7b4866 ("selftests/bpf: Add tests for _opts variants of bpf_*_get_fd_by_id()") (reverted as well in the next patch).
The new selftest covers the bpf_*_get_fd_by_id structures. Those don't exist in 6.1 so the selftest shouldn't either.
--- .../testing/selftests/bpf/progs/test_libbpf_get_fd_by_id_opts.c | 1 - 1 file changed, 1 deletion(-)
tools/testing/selftests/bpf/progs/test_libbpf_get_fd_by_id_opts.c +0 -1
@@ -31,7 +31,6 @@ int BPF_PROG(check_access, struct bpf_map *map, fmode_t fmode)if (fmode &FMODE_WRITE )return -EACCES ; -barrier ();return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 30/522 bonding: refuse to enslave CAN devices
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Hartkopp <[email protected]>
[ Upstream commit 8ba68464e4787b6a7ec938826e16124df20fd23d ]
syzbot reported a kernel paging request crash in can_rx_unregister() inside net/can/af_can.c. The crash occurs because a virtual CAN device (vxcan) is being enslaved to a bonding master.
During the enslavement process, the bonding driver mutates and modifies the network device states to fit an Ethernet-like aggregation model. However, CAN devices operate on a completely different Layer 2 architecture, relying on the CAN mid-layer private data structure (can_ml_priv) instead of standard Ethernet structures. Since bonding does not initialize or maintain these CAN structures, subsequent operations on the half-enslaved interface (such as closing associated sockets via isotp_release) lead to a null-pointer dereference when accessing the CAN receiver lists.
Bonding CAN interfaces is architecturally invalid as CAN lacks MAC addresses, ARP capabilities, and standard Ethernet link-layer mechanisms. While generic loopback devices are blocked globally in net/core/dev.c, virtual CAN devices bypass this check because they do not carry the IFF_LOOPBACK flag, despite acting as local software-loopbacks.
Fix this by explicitly blocking network devices of type ARPHRD_CAN from being enslaved at the very beginning of bond_enslave(). This prevents illegal state mutations, eliminates the resulting KASAN crashes, and avoids potential memory leaks from incomplete socket cleanups.
As the CAN support has been added a long time after bonding the Fixes-tag points to the introduction of ARPHRD_CAN that would have needed a specific handling in bonding_main.c.
--- drivers/net/bonding/bond_main.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/bonding/bond_main.c +6 -0
@@ -1848,6 +1848,12 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,int link_reporting;int res =0 , i; +if (slave_dev->type ==ARPHRD_CAN ) { +BOND_NL_ERR (bond_dev, extack, +"CAN devices cannot be enslaved" ); +return -EPERM ; + } +if (slave_dev->flags &IFF_MASTER && !netif_is_bond_master (slave_dev)) { BOND_NL_ERR(bond_dev, extack,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 57/522 Revert "selftests/bpf: Add tests for _opts variants of bpf_*_get_fd_by_id()"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Chaignon <[email protected]>
This reverts commit 45108a7b4866 ("selftests/bpf: Add tests for _opts variants of bpf_*_get_fd_by_id()"). As explained in the previous patch, it introduces a new selftest for a feature that doesn't exist in 6.1. It was backported as a stable-dep of a1914d146622 ("selftests/bpf:
Workaround strict bpf_lsm return value check"), also reverted in the previous patch.
--- tools/testing/selftests/bpf/DENYLIST.s390x | 1 - .../bpf/prog_tests/libbpf_get_fd_by_id_opts.c | 87 ------------------- .../bpf/progs/test_libbpf_get_fd_by_id_opts.c | 36 -------- 3 files changed, 124 deletions(-) delete mode 100644 tools/testing/selftests/bpf/prog_tests/libbpf_get_fd_by_id_opts.c delete mode 100644 tools/testing/selftests/bpf/progs/test_libbpf_get_fd_by_id_opts.c
tools/testing/selftests/bpf/DENYLIST.s390x +0 -1
@@ -76,4 +76,3 @@ lookup_key # JIT does not support calling kernel f verify_pkcs7_sig # JIT does not support calling kernel function (kfunc) kfunc_dynptr_param # JIT does not support calling kernel function (kfunc) deny_namespace # failed to attach: ERROR: strerror_r(-524)=22 (trampoline) -libbpf_get_fd_by_id_opts # failed to attach: ERROR: strerror_r(-524)=22 (trampoline)
tools/testing/selftests/bpf/prog_tests/libbpf_get_fd_by_id_opts.c deleted +0 -87
87 lines not on this page · raw message
tools/testing/selftests/bpf/progs/test_libbpf_get_fd_by_id_opts.c deleted +0 -36
@@ -1,36 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 - -/* -* Copyright (C) 2022 Huawei Technologies Duesseldorf GmbH -* -* Author: Roberto Sassu <[email protected]> -*/ - -#include "vmlinux.h" -#include <errno.h> -#include <bpf/bpf_helpers.h> -#include <bpf/bpf_tracing.h> - -/* From include/linux/mm.h. */ -#define FMODE_WRITE 0x2 - -struct { - __uint(type, BPF_MAP_TYPE_ARRAY); - __uint(max_entries, 1); - __type(key, __u32); - __type(value, __u32); -} data_input SEC(".maps"); - -char _license[] SEC("license") = "GPL"; - -SEC("lsm/bpf_map") -int BPF_PROG (check_access ,struct bpf_map *map,fmode_t fmode) -{ -if (map != (struct bpf_map *)&data_input) -return 0 ; - -if (fmode &FMODE_WRITE ) -return -EACCES ; - -return 0 ; -}
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 58/522 selftests/bpf: Add read_build_id function
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <[email protected]>
[ Upstream commit 88dc8b3605b38a440fba45edcc53a6c7a98eee3b ]
Adding read_build_id function that parses out build id from specified binary.
It will replace extract_build_id and also be used in following changes.
--- tools/testing/selftests/bpf/trace_helpers.c | 82 +++++++++++++++++++++ tools/testing/selftests/bpf/trace_helpers.h | 5 ++ 2 files changed, 87 insertions(+)
tools/testing/selftests/bpf/trace_helpers.c +82 -0
@@ -11,6 +11,9 @@#include <linux/perf_event.h> #include <sys/mman.h> #include "trace_helpers.h" +#include <linux/limits.h> +#include <libelf.h> +#include <gelf.h> #define DEBUGFS "/sys/kernel/debug/tracing/"
@@ -224,3 +227,82 @@ ssize_t get_rel_offset(uintptr_t addr)fclose (f);return -EINVAL ; } + +static int +parse_build_id_buf (const void *note_start,Elf32_Word note_size,char *build_id) +{ +Elf32_Word note_offs =0 ; + +while (note_offs +sizeof (Elf32_Nhdr) < note_size) { +Elf32_Nhdr *nhdr = (Elf32_Nhdr *)(note_start + note_offs); + +if (nhdr->n_type ==3 && nhdr->n_namesz ==sizeof ("GNU" ) && + !strcmp ((char *)(nhdr +1 ),"GNU" ) && nhdr->n_descsz >0 && + nhdr->n_descsz <=BPF_BUILD_ID_SIZE ) { +memcpy (build_id, note_start + note_offs + +ALIGN (sizeof ("GNU" ),4 ) +sizeof (Elf32_Nhdr), nhdr->n_descsz); +memset (build_id + nhdr->n_descsz,0 ,BPF_BUILD_ID_SIZE - nhdr->n_descsz); +return (int ) nhdr->n_descsz; + } + + note_offs = note_offs +sizeof (Elf32_Nhdr) + +ALIGN (nhdr->n_namesz,4 ) +ALIGN (nhdr->n_descsz,4 ); + } + +return -ENOENT ; +} + +/* Reads binary from *path* file and returns it in the *build_id* buffer +* with *size* which is expected to be at least BPF_BUILD_ID_SIZE bytes. +* Returns size of build id on success. On error the error value is +* returned. +*/ +int read_build_id (const char *path,char *build_id,size_t size) +{ +int fd, err = -EINVAL ; +Elf *elf =NULL ; +GElf_Ehdr ehdr; +size_t max, i; + +if (size <BPF_BUILD_ID_SIZE ) +return -EINVAL ; + + fd =open (path,O_RDONLY |O_CLOEXEC ); +if (fd <0 ) +return -errno; + + (void )elf_version (EV_CURRENT ); + + elf =elf_begin (fd,ELF_C_READ_MMAP ,NULL ); +if (!elf) + goto out; +if (elf_kind (elf) !=ELF_K_ELF ) + goto out; +if (!gelf_getehdr (elf, &ehdr)) + goto out; + +for (i =0 ; i < ehdr.e_phnum; i++) { +GElf_Phdr mem, *phdr; +char *data; + + phdr =gelf_getphdr (elf, i, &mem); +if (!phdr) + goto out; +if (phdr->p_type !=PT_NOTE ) +continue ; + data =elf_rawfile (elf, &max); +if (!data) + goto out; +if (phdr->p_offset + phdr->p_memsz > max) + goto out; + err =parse_build_id_buf (data + phdr->p_offset, phdr->p_memsz, build_id); +if (err >0 ) +break ; + } + +out: +if (elf) +elf_end (elf); +close (fd); +return err; +}
tools/testing/selftests/bpf/trace_helpers.h +5 -0
@@ -4,6 +4,9 @@#include <bpf/libbpf.h> +#define __ALIGN_MASK (x, mask) (((x)+(mask))&~(mask)) +#define ALIGN (x, a) __ALIGN_MASK(x, (typeof(x))(a)-1) +struct ksym {long addr;char *name;
@@ -21,4 +24,6 @@ void read_trace_pipe(void);ssize_t get_uprobe_offset (const void *addr);ssize_t get_rel_offset (uintptr_t addr); +int read_build_id (const char *path,char *build_id,size_t size); +#endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 59/522 bpf: Fix a few selftest failures due to llvm18 change
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yonghong Song <[email protected]>
[ Upstream commit b16904fd9f01b580db357ef2b1cc9e86d89576c2 ]
With latest upstream llvm18, the following test cases failed:
$ ./test_progs -j #13/2 bpf_cookie/multi_kprobe_link_api:FAIL #13/3 bpf_cookie/multi_kprobe_attach_api:FAIL #13 bpf_cookie:FAIL #77 fentry_fexit:FAIL #78/1 fentry_test/fentry:FAIL #78 fentry_test:FAIL #82/1 fexit_test/fexit:FAIL #82 fexit_test:FAIL #112/1 kprobe_multi_test/skel_api:FAIL #112/2 kprobe_multi_test/link_api_addrs:FAIL [...] #112 kprobe_multi_test:FAIL #356/17 test_global_funcs/global_func17:FAIL #356 test_global_funcs:FAIL
Further analysis shows llvm upstream patch [1] is responsible for the above failures. For example, for function bpf_fentry_test7() in net/bpf/test_run.c, without [1], the asm code is:
0000000000000400 <bpf_fentry_test7>:
400: f3 0f 1e fa endbr64
404: e8 00 00 00 00 callq 0x409 <bpf_fentry_test7+0x9>
409: 48 89 f8 movq %rdi, %rax
40c: c3 retq
40d: 0f 1f 00 nopl (%rax)... and with [1], the asm code is:
0000000000005d20 <bpf_fentry_test7.specialized.1>:
5d20: e8 00 00 00 00 callq 0x5d25 <bpf_fentry_test7.specialized.1+0x5>
5d25: c3 retq
... and <bpf_fentry_test7.specialized.1> is called instead of <bpf_fentry_test7> and this caused test failures for #13/#77 etc. except #356.
For test case #356/17, with [1] (progs/test_global_func17.c)), the main prog looks like:
0000000000000000 <global_func17>:
0: b4 00 00 00 2a 00 00 00 w0 = 0x2a
1: 95 00 00 00 00 00 00 00 exit... which passed verification while the test itself expects a verification failure.
Let us add 'barrier_var' style asm code in both places to prevent function specialization which caused selftests failure.
[1] https://github.com/llvm/llvm-project/pull/72903
[ Note: The change to test_run.c conflicted and was dropped. The related
tests are not failing anyway. ]
--- tools/testing/selftests/bpf/progs/test_global_func17.c | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/progs/test_global_func17.c +1 -0
@@ -5,6 +5,7 @@ __noinline int foo(int *p) { +barrier_var (p);return p ? (*p =42 ) :0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 60/522 selftests/bpf: Update bpf_clone_redirect expected return code
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Fomichev <[email protected]>
[ Upstream commit b772b70b69046c5b76e3f2eda680f692dee5e6d5 ]
Commit 151e887d8ff9 ("veth: Fixing transmit return status for dropped packets") started propagating proper NET_XMIT_DROP error to the caller which means it's now possible to get positive error code when calling bpf_clone_redirect() in this particular test. Update the test to reflect that.
[ Note: Commit 151e887d8ff9 was backported to 6.1 so this fix should be
as well. ]
--- tools/testing/selftests/bpf/prog_tests/empty_skb.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/prog_tests/empty_skb.c +10 -2
@@ -29,6 +29,7 @@ void serial_test_empty_skb(void)int *ifindex;int err;int ret; +int lwt_egress_ret;/* expected retval at lwt/egress */ bool success_on_tc; } tests[] = {/* Empty packets are always rejected. */
@@ -62,6 +63,7 @@ void serial_test_empty_skb(void) .data_size_in = sizeof(eth_hlen), .ifindex = &veth_ifindex, .ret = -ERANGE, + .lwt_egress_ret = -ERANGE, .success_on_tc = true, }, {
@@ -75,6 +77,7 @@ void serial_test_empty_skb(void) .data_size_in = sizeof(eth_hlen), .ifindex = &ipip_ifindex, .ret = -ERANGE, + .lwt_egress_ret = -ERANGE, },/* ETH_HLEN+1-sized packet should be redirected. */
@@ -84,6 +87,7 @@ void serial_test_empty_skb(void) .data_in = eth_hlen_pp, .data_size_in = sizeof(eth_hlen_pp), .ifindex = &veth_ifindex, + .lwt_egress_ret = 1, /* veth_xmit NET_XMIT_DROP */ }, { .msg = "ipip ETH_HLEN+1 packet ingress",
@@ -113,8 +117,12 @@ void serial_test_empty_skb(void)for (i =0 ; i <ARRAY_SIZE (tests); i++) {bpf_object__for_each_program (prog, bpf_obj->obj) { -char buf[128 ]; +bool at_egress =strstr (bpf_program__name (prog),"egress" ) !=NULL ;bool at_tc = !strncmp (bpf_program__section_name (prog),"tc" ,2 ); +int expected_ret; +char buf[128 ]; + + expected_ret = at_egress && !at_tc ? tests[i].lwt_egress_ret : tests[i].ret; tattr.data_in = tests[i].data_in; tattr.data_size_in = tests[i].data_size_in;
@@ -133,7 +141,7 @@ void serial_test_empty_skb(void)if (at_tc && tests[i].success_on_tc)ASSERT_GE (bpf_obj->bss->ret,0 , buf);else -ASSERT_EQ (bpf_obj->bss->ret, tests[i].ret, buf); +ASSERT_EQ (bpf_obj->bss->ret, expected_ret, buf); } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 61/522 selftests/bpf: enhance align selftests expected log matching
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrii Nakryiko <[email protected]>
[ Upstream commit 6f876e75d316a75957f3d43c3a8c2a6fe9bc18b2 ]
Allow to search for expected register state in all the verifier log output that's related to specified instruction number.
See added comment for an example of possible situation that is happening due to a simple enhancement done in the next patch, which fixes handling of env->test_state_freq flag in state checkpointing logic.
[ Note: Backport needed to fix the align selftest where some of the
expected log messages can't be found. This is happening because commit 1a8a315f008a ("bpf: Ensure proper register state printing for cond jumps") was also backported to 6.1. ]
--- tools/testing/selftests/bpf/prog_tests/align.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
tools/testing/selftests/bpf/prog_tests/align.c +12 -6
@@ -660,16 +660,22 @@ static int do_test_single(struct bpf_align_test *test)* func#0 @0 * 0: R1=ctx(off=0,imm=0) R10=fp0 * 0: (b7) r3 = 2 ; R3_w=2 +* +* Sometimes it's actually two lines below, e.g. when +* searching for "6: R3_w=scalar(umax=255,var_off=(0x0; 0xff))": +* from 4 to 6: R0_w=pkt(off=8,r=8,imm=0) R1=ctx(off=0,imm=0) R2_w=pkt(off=0,r=8,imm=0) R3_w=pkt_end(off=0,imm=0) R10=fp0 +* 6: R0_w=pkt(off=8,r=8,imm=0) R1=ctx(off=0,imm=0) R2_w=pkt(off=0,r=8,imm=0) R3_w=pkt_end(off=0,imm=0) R10=fp0 +* 6: (71) r3 = *(u8 *)(r2 +0) ; R2_w=pkt(off=0,r=8,imm=0) R3_w=scalar(umax=255,var_off=(0x0; 0xff)) */ -if (!strstr (line_ptr, m.match)) { +while (!strstr (line_ptr, m.match)) { cur_line =-1 ; line_ptr =strtok (NULL ,"\n" ); -sscanf (line_ptr,"%u: " , &cur_line); +sscanf (line_ptr ?:"" ,"%u: " , &cur_line); +if (!line_ptr || cur_line != m.line) +break ; } -if (cur_line != m.line || !line_ptr || - !strstr (line_ptr, m.match)) { -printf ("Failed to find match %u: %s\n" , - m.line, m.match); +if (cur_line != m.line || !line_ptr || !strstr (line_ptr, m.match)) { +printf ("Failed to find match %u: %s\n" , m.line, m.match); ret =1 ;printf ("%s" , bpf_vlog);break ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 62/522 Revert "selftests/bpf: Add a cgroup prog bpf_get_ns_current_pid_tgid() test"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Chaignon <[email protected]>
This reverts commit 4d8fb7ed7a55 ("selftests/bpf: Add a cgroup prog bpf_get_ns_current_pid_tgid() test").
That commit should have never been backported to 6.1 because it introduces a test for a feature that isn't supported:bpf_get_ns_current_pid_tgid() cannot be called from cgroup BPF programs in 6.1.
--- .../bpf/prog_tests/ns_current_pid_tgid.c | 73 ------------------- .../bpf/progs/test_ns_current_pid_tgid.c | 7 -- 2 files changed, 80 deletions(-)
tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c +0 -73
@@ -12,7 +12,6 @@#include <sys/wait.h> #include <sys/mount.h> #include <fcntl.h> -#include "network_helpers.h" #define STACK_SIZE (1024 * 1024)static char child_stack[STACK_SIZE ];
@@ -75,50 +74,6 @@ static int test_current_pid_tgid_tp(void *args)return ret; } -static int test_current_pid_tgid_cgrp (void *args) -{ -struct test_ns_current_pid_tgid__bss *bss; -struct test_ns_current_pid_tgid *skel; -int server_fd =-1 , ret =-1 , err; -int cgroup_fd = *(int *)args; -pid_t tgid, pid; - - skel =test_ns_current_pid_tgid__open (); -if (!ASSERT_OK_PTR (skel,"test_ns_current_pid_tgid__open" )) -return ret; - -bpf_program__set_autoload (skel->progs.cgroup_bind4, true); - - err =test_ns_current_pid_tgid__load (skel); -if (!ASSERT_OK (err,"test_ns_current_pid_tgid__load" )) - goto cleanup; - - bss = skel->bss; -if (get_pid_tgid (&pid, &tgid, bss)) - goto cleanup; - - skel->links.cgroup_bind4 =bpf_program__attach_cgroup ( - skel->progs.cgroup_bind4, cgroup_fd); -if (!ASSERT_OK_PTR (skel->links.cgroup_bind4,"bpf_program__attach_cgroup" )) - goto cleanup; - - server_fd =start_server (AF_INET ,SOCK_STREAM ,NULL ,0 ,0 ); -if (!ASSERT_GE (server_fd,0 ,"start_server" )) - goto cleanup; - -if (!ASSERT_EQ (bss->user_pid, pid,"pid" )) - goto cleanup; -if (!ASSERT_EQ (bss->user_tgid, tgid,"tgid" )) - goto cleanup; - ret =0 ; - -cleanup: -if (server_fd >=0 ) -close (server_fd); -test_ns_current_pid_tgid__destroy (skel); -return ret; -} -static void test_ns_current_pid_tgid_new_ns (int (*fn)(void *),void *arg) {int wstatus;
@@ -140,25 +95,6 @@ static void test_ns_current_pid_tgid_new_ns(int (*fn)(void *), void *arg)return ; } -static void test_in_netns (int (*fn)(void *),void *arg) -{ -struct nstoken *nstoken =NULL ; - -SYS (cleanup,"ip netns add ns_current_pid_tgid" ); -SYS (cleanup,"ip -net ns_current_pid_tgid link set dev lo up" ); - - nstoken =open_netns ("ns_current_pid_tgid" ); -if (!ASSERT_OK_PTR (nstoken,"open_netns" )) - goto cleanup; - -test_ns_current_pid_tgid_new_ns (fn, arg); - -cleanup: -if (nstoken) -close_netns (nstoken); -SYS_NOFAIL ("ip netns del ns_current_pid_tgid" ); -} -/* TODO: use a different tracepoint */ void serial_test_ns_current_pid_tgid (void ) {
@@ -166,13 +102,4 @@ void serial_test_ns_current_pid_tgid(void)test_current_pid_tgid_tp (NULL );if (test__start_subtest ("new_ns_tp" ))test_ns_current_pid_tgid_new_ns (test_current_pid_tgid_tp,NULL ); -if (test__start_subtest ("new_ns_cgrp" )) { -int cgroup_fd =-1 ; - - cgroup_fd =test__join_cgroup ("/sock_addr" ); -if (ASSERT_GE (cgroup_fd,0 ,"join_cgroup" )) { -test_in_netns (test_current_pid_tgid_cgrp, &cgroup_fd); -close (cgroup_fd); - } - } }
tools/testing/selftests/bpf/progs/test_ns_current_pid_tgid.c +0 -7
@@ -28,11 +28,4 @@ int tp_handler(const void *ctx)return 0 ; } -SEC("?cgroup/bind4") -int cgroup_bind4 (struct bpf_sock_addr *ctx) -{ -get_pid_tgid (); -return 1 ; -} - char _license[] SEC("license") = "GPL";
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 31/522 ethtool: eeprom: add more safeties to EEPROM Netlink fallback
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 67cfdd9210b99f260b3e0afeb9525e0acc7be31e ]
The Netlink fallback path for reading module EEPROM (fallback_set_params()) validates that offset < eeprom_len, but does not check that offset + length stays within eeprom_len. The ioctl equivalent (ethtool_get_any_eeprom() in ioctl.c) has always enforced both bounds:
if (eeprom.offset + eeprom.len > total_len)
return -EINVAL;
This could lead to surprises in both drivers and device FW. Add the missing offset + length validation to fallback_set_params(), mirroring the ioctl.
Similarly - ethtool core in general, and ethtool_get_any_eeprom() in particular tries to zero-init all buffers passed to the drivers to avoid any extra work of zeroing things out. eeprom_fallback() uses a plain kmalloc(), change it to zalloc.
--- net/ethtool/eeprom.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/ethtool/eeprom.c +4 -1
@@ -43,6 +43,9 @@ static int fallback_set_params(struct eeprom_req_info *request,if (offset >= modinfo->eeprom_len)return -EINVAL ; +if (length > modinfo->eeprom_len - offset) +return -EINVAL ; + eeprom->cmd =ETHTOOL_GMODULEEEPROM ; eeprom->len = length; eeprom->offset = offset;
@@ -69,7 +72,7 @@ static int eeprom_fallback(struct eeprom_req_info *request,if (err <0 )return err; - data =kmalloc (eeprom.len,GFP_KERNEL ); + data =kzalloc (eeprom.len,GFP_KERNEL );if (!data)return -ENOMEM ; err =ethtool_get_module_eeprom_call (dev, &eeprom, data);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 32/522 ipv6: rpl: fix hdrlen overflow in ipv6_rpl_srh_decompress()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rahul Chandelkar <[email protected]>
[ Upstream commit 9d5e7a46a9f6d8f503b41bfefef70659845f1679 ]
ipv6_rpl_srh_decompress() computes:
outhdr->hdrlen = (((n + 1) * sizeof(struct in6_addr)) >> 3);
hdrlen is __u8. For n >= 127 the result exceeds 255 and silently truncates. With n=127 (cmpri=15, cmpre=15, pad=0, hdrlen=16):
(128 * 16) >> 3 = 256, truncated to 0 as __u8
The caller in ipv6_rpl_srh_rcv() then places the compressed header at buf + ((ohdr->hdrlen + 1) << 3). With hdrlen=0 this is buf + 8, but the decompressed region occupies buf[0..2055] (8-byte header plus 128 full addresses). The compressed header overlaps the decompressed data, and ipv6_rpl_srh_compress() writes into this overlap, corrupting the routing header of the forwarded packet.
The existing guard at exthdrs.c:546 checks (n + 1) > 255, which prevents n+1 from overflowing unsigned char (the segments_left field), but does not prevent the computed hdrlen from overflowing __u8. n=127 passes because 128 <= 255, yet hdrlen=256 does not fit.
Tighten the bound to (n + 1) > 127. This caps n at 126, giving hdrlen = (127 * 16) >> 3 = 254, which fits in __u8. The compressed header then lands at buf + ((254 + 1) << 3) = buf + 2040, exactly past the decompressed region (buf[0..2039]). No overlap. 127 segments is well beyond any realistic RPL deployment.
--- net/ipv6/exthdrs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/exthdrs.c +1 -1
@@ -564,7 +564,7 @@ static int ipv6_rpl_srh_rcv(struct sk_buff *skb)* unsigned char which is segments_left field. Should not be * higher than that. */ -if (r || (n +1 ) >255 ) { +if (r || (n +1 ) >127 ) {kfree_skb (skb);return -1 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 33/522 net/sched: Revert "net/sched: Restrict conditions for adding duplicating netems to qdisc tree"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit eda0b7f203bb166c98d1418b204135bd566ac83b ]
This reverts commit ec8e0e3d7adef940cdf9475e2352c0680189d14e.
The original patch rejects any tree containing two netems when either has duplication set, even when they sit on unrelated classes of the same classful parent. That broke configurations that have worked since netem was introduced.
The re-entrancy problem the original commit was trying to solve is handled by later patch using tc_depth flag.
Doing this revert will (re)expose the original bug with multiple netem duplication. When this patch is backported make sure and get the full series.
--- net/sched/sch_netem.c | 40 ---------------------------------------- 1 file changed, 40 deletions(-)
net/sched/sch_netem.c +0 -40
@@ -984,41 +984,6 @@ static int parse_attr(struct nlattr *tb[], int maxtype, struct nlattr *nla,return 0 ; } -static const struct Qdisc_class_ops netem_class_ops; - -static int check_netem_in_tree (struct Qdisc *sch,bool duplicates, -struct netlink_ext_ack *extack) -{ -struct Qdisc *root, *q; -unsigned int i; - - root =qdisc_root_sleeping (sch); - -if (sch != root && root->ops->cl_ops == &netem_class_ops) { -if (duplicates || - ((struct netem_sched_data *)qdisc_priv (root))->duplicate) - goto err; - } - -if (!qdisc_dev (root)) -return 0 ; - -hash_for_each (qdisc_dev (root)->qdisc_hash, i, q, hash) { -if (sch != q && q->ops->cl_ops == &netem_class_ops) { -if (duplicates || - ((struct netem_sched_data *)qdisc_priv (q))->duplicate) - goto err; - } - } - -return 0 ; - -err: -NL_SET_ERR_MSG (extack, -"netem: cannot mix duplicating netems with other netems in tree" ); -return -EINVAL ; -} -/* Parse netlink message to set options */ static int netem_change (struct Qdisc *sch,struct nlattr *opt,struct netlink_ext_ack *extack)
@@ -1083,11 +1048,6 @@ static int netem_change(struct Qdisc *sch, struct nlattr *opt, q->gap = qopt->gap; q->counter =0 ; q->loss = qopt->loss; - - ret =check_netem_in_tree (sch, qopt->duplicate, extack); -if (ret) - goto unlock; - q->duplicate = qopt->duplicate;/* for compatibility with earlier versions.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 34/522 Bluetooth: l2cap: clear chan->ident on ECRED reconfiguration success
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhenghang Xiao <[email protected]>
[ Upstream commit 00e1950716c6ed67d74777b2db286b0fa23b4be9 ]
l2cap_ecred_reconf_rsp() returns early on success without clearing chan->ident. Every other L2CAP response handler (l2cap_ecred_conn_rsp, l2cap_le_connect_rsp, l2cap_config_rsp) clears chan->ident after a successful transaction to prevent the channel from matching subsequent responses with the recycled ident value.
A remote attacker that completed a reconfiguration as the peer can replay a failure response with the stale ident, causing the kernel to match and destroy the already-established channel via l2cap_chan_del(chan, ECONNRESET).
Clear chan->ident for all matching channels on success, and harden the failure path by using l2cap_chan_hold_unless_zero() consistent with other L2CAP handlers (l2cap_le_command_rej, __l2cap_get_chan_by_ident).
--- net/bluetooth/l2cap_core.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
net/bluetooth/l2cap_core.c +8 -2
@@ -6454,14 +6454,20 @@ static inline int l2cap_ecred_reconf_rsp(struct l2cap_conn *conn,BT_DBG ("result 0x%4.4x" , result); -if (!result) +if (!result) { +list_for_each_entry (chan, &conn->chan_l, list) { +if (chan->ident == cmd->ident) + chan->ident =0 ; + }return 0 ; + }list_for_each_entry_safe (chan, tmp, &conn->chan_l, list) {if (chan->ident != cmd->ident)continue ; -l2cap_chan_hold (chan); +if (!l2cap_chan_hold_unless_zero (chan)) +continue ;l2cap_chan_lock (chan);l2cap_chan_del (chan,ECONNRESET );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 35/522 Bluetooth: L2CAP: Fix possible crash on l2cap_ecred_conn_rsp
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 41c2713b204e6cb6a94587bc6bf6935107df5479 ]
If dcid is received for an already-assigned destination CID the spec requires that both channels to be discarded, but calling l2cap_chan_del may invalidate the tmp cursor created by list_for_each_entry_safe and in fact it is the wrong procedure as the chan->dcid may be assigned previously it really needs to be disconnected.
Calling l2cap_chan_clone directly may still lead to l2cap_chan_del so instead schedule l2cap_chan_timeout with delay 0 to close the channel asynchronously.
--- net/bluetooth/l2cap_core.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-)
net/bluetooth/l2cap_core.c +22 -5
@@ -6254,6 +6254,7 @@ static inline int l2cap_ecred_conn_rsp(struct l2cap_conn *conn, cmd_len -=sizeof (*rsp);list_for_each_entry_safe (chan, tmp, &conn->chan_l, list) { +struct l2cap_chan *orig;u16 dcid; if (chan->ident != cmd->ident ||
@@ -6275,8 +6276,10 @@ static inline int l2cap_ecred_conn_rsp(struct l2cap_conn *conn,BT_DBG ("dcid[%d] 0x%4.4x" , i, dcid); + orig =__l2cap_get_chan_by_dcid (conn, dcid); +/* Check if dcid is already in use */ -if (dcid &&__l2cap_get_chan_by_dcid (conn, dcid)) { +if (dcid && orig) {/* If a device receives a * L2CAP_CREDIT_BASED_CONNECTION_RSP packet with an * already-assigned Destination CID, then both the
@@ -6285,10 +6288,24 @@ static inline int l2cap_ecred_conn_rsp(struct l2cap_conn *conn,*/ l2cap_chan_del (chan,ECONNREFUSED );l2cap_chan_unlock (chan); - chan =__l2cap_get_chan_by_dcid (conn, dcid); -l2cap_chan_lock (chan); -l2cap_chan_del (chan,ECONNRESET ); -l2cap_chan_unlock (chan); + +/* Check that the dcid channel mode is +* L2CAP_MODE_EXT_FLOWCTL since this procedure is only +* valid for that mode and shouldn't disconnect a dcid +* in other modes. +*/ +if (orig->mode ==L2CAP_MODE_EXT_FLOWCTL ) { +l2cap_chan_lock (orig); +/* Disconnect the original channel as it may be +* considered connected since dcid has already +* been assigned; don't call l2cap_chan_close +* directly since that could lead to +* l2cap_chan_del and then removing the channel +* from the list while we're iterating over it. +*/ +__set_chan_timer (orig,0 ); +l2cap_chan_unlock (orig); + }continue ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 36/522 gpio: rockchip: convert bank->clk to devm_clk_get_enabled()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marco Scardovi <[email protected]>
[ Upstream commit 3e46c18d5d87f063a93ae0fe7662fbf6660459d5 ]
The bank->clk was previously obtained via of_clk_get() and manually prepared/enabled. However, it was missing a corresponding clk_put() in both the error paths and the remove function, leading to a reference leak.
Convert the allocation to devm_clk_get_enabled(), which also properly propagates failures from clk_prepare_enable() that were previously ignored.
The GPIO bank device uses the same OF node as the previous of_clk_get() call, so devm_clk_get_enabled(dev, NULL) correctly resolves the same clock provider entry.
Fix the reference leak and simplify the code by removing the manual clk_disable_unprepare() calls in the probe error paths and in the remove function.
--- drivers/gpio/gpio-rockchip.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpio/gpio-rockchip.c +1 -5
@@ -647,11 +647,10 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank)if (!bank->irq)return -EINVAL ; - bank->clk =of_clk_get (bank->of_node,0 ); + bank->clk =devm_clk_get_enabled (bank->dev,NULL );if (IS_ERR (bank->clk))return PTR_ERR (bank->clk); -clk_prepare_enable (bank->clk); id =readl (bank->reg_base + gpio_regs_v2.version_id);/* If not gpio v2, that is default to v1. */
@@ -661,7 +660,6 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank) bank->db_clk =of_clk_get (bank->of_node,1 );if (IS_ERR (bank->db_clk)) {dev_err (bank->dev,"cannot find debounce clk\n" ); -clk_disable_unprepare (bank->clk);return -EINVAL ; } }else {
@@ -735,7 +733,6 @@ static int rockchip_gpio_probe(struct platform_device *pdev) ret =rockchip_gpiolib_register (bank);if (ret) { -clk_disable_unprepare (bank->clk);mutex_unlock (&bank->deferred_lock);return ret; }
@@ -776,7 +773,6 @@ static int rockchip_gpio_remove(struct platform_device *pdev) {struct rockchip_pin_bank *bank =platform_get_drvdata (pdev); -clk_disable_unprepare (bank->clk);gpiochip_remove (&bank->gpio_chip);return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 27/522 tunnels: do not assume transport header in iptunnel_pmtud_check_icmp()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 509323077ef79a26ba0c60bb556e45c12c398b2d ]
In some cases, iptunnel_pmtud_check_icmp() can be called while skb transport header is not set.
This triggers an out-of-bound access, because
(typeof(skb->transport_header))~0U is 65535.
Access the icmp header based on IPv4 network header, after making sure icmp->type is present in skb linear part.
Note that iptunnel_pmtud_check_icmpv6()) is fine.
--- net/ipv4/ip_tunnel_core.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
net/ipv4/ip_tunnel_core.c +10 -3
@@ -262,7 +262,6 @@ static int iptunnel_pmtud_build_icmp(struct sk_buff *skb, int mtu)*/ static int iptunnel_pmtud_check_icmp (struct sk_buff *skb,int mtu) { -const struct icmphdr *icmph =icmp_hdr (skb);const struct iphdr *iph =ip_hdr (skb);if (mtu <576 || iph->frag_off !=htons (IP_DF ))
@@ -273,9 +272,17 @@ static int iptunnel_pmtud_check_icmp(struct sk_buff *skb, int mtu) ipv4_is_lbcast(iph->saddr) || ipv4_is_multicast(iph->saddr))return 0 ; -if (iph->protocol ==IPPROTO_ICMP &&icmp_is_err (icmph->type)) -return 0 ; +if (iph->protocol ==IPPROTO_ICMP ) { +const struct icmphdr *icmph; +if (!pskb_network_may_pull (skb, iph->ihl *4 + + offsetofend(struct icmphdr, type))) +return 0 ; + iph =ip_hdr (skb); + icmph = (void *)iph + iph->ihl *4 ; +if (icmp_is_err (icmph->type)) +return 0 ; + }return iptunnel_pmtud_build_icmp (skb, mtu); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 64/522 selftests/bpf: S/iptables/iptables-legacy/ in the bpf_nf and xdp_synproxy test
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin KaFai Lau <[email protected]>
[ Upstream commit de9c8d848d90cf2e53aced50b350827442ca5a4f ]
The recent vm image in CI has reported error in selftests that use the iptables command. Manu Bretelle has pointed out the difference in the recent vm image that the iptables is sym-linked to the iptables-nft. With this knowledge, I can also reproduce the CI error by manually running with the 'iptables-nft'.
This patch is to replace the iptables command with iptables-legacy to unblock the CI tests.
--- tools/testing/selftests/bpf/prog_tests/bpf_nf.c | 6 +++--- tools/testing/selftests/bpf/prog_tests/xdp_synproxy.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
tools/testing/selftests/bpf/prog_tests/bpf_nf.c +3 -3
@@ -49,14 +49,14 @@ static int connect_to_server(int srv_fd)static void test_bpf_nf_ct (int mode) { -const char *iptables ="iptables -t raw %s PREROUTING -j CONNMARK --set-mark 42/0" ; +const char *iptables ="iptables-legacy -t raw %s PREROUTING -j CONNMARK --set-mark 42/0" ;int srv_fd =-1 , client_fd =-1 , srv_client_fd =-1 ;struct sockaddr_in peer_addr = {};struct test_bpf_nf *skel;int prog_fd, err;socklen_t len;u16 srv_port; -char cmd[64 ]; +char cmd[128 ]; LIBBPF_OPTS(bpf_test_run_opts, topts, .data_in = &pkt_v4, .data_size_in = sizeof(pkt_v4),
@@ -69,7 +69,7 @@ static void test_bpf_nf_ct(int mode)/* Enable connection tracking */ snprintf (cmd,sizeof (cmd), iptables,"-A" ); -if (!ASSERT_OK (system (cmd),"iptables" )) +if (!ASSERT_OK (system (cmd), cmd)) goto end; srv_port = (mode ==TEST_XDP ) ?5005 :5006 ;
tools/testing/selftests/bpf/prog_tests/xdp_synproxy.c +3 -3
@@ -94,12 +94,12 @@ static void test_synproxy(bool xdp)SYS ("sysctl -w net.ipv4.tcp_syncookies=2" );SYS ("sysctl -w net.ipv4.tcp_timestamps=1" );SYS ("sysctl -w net.netfilter.nf_conntrack_tcp_loose=0" ); -SYS ("iptables -t raw -I PREROUTING \ +SYS ("iptables-legacy -t raw -I PREROUTING \ -i tmp1 -p tcp -m tcp --syn --dport 8080 -j CT --notrack" ); -SYS ("iptables -t filter -A INPUT \ +SYS ("iptables-legacy -t filter -A INPUT \ -i tmp1 -p tcp -m tcp --dport 8080 -m state --state INVALID,UNTRACKED \ -j SYNPROXY --sack-perm --timestamp --wscale 7 --mss 1460" ); -SYS ("iptables -t filter -A INPUT \ +SYS ("iptables-legacy -t filter -A INPUT \ -i tmp1 -m state --state INVALID -j DROP" ); ctrl_file = SYS_OUT("./xdp_synproxy --iface tmp1 --ports 8080 \
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 73/522 drm/i915/psr: Apply Intel DPCD workaround when SDP on prior line used
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jouni Högander <[email protected]>
commit 4703049f768fc1c1caac754134118bee1a3af189 upstream.
There is Intel specific workaround DPCD address containing workaround for case where SDP is on prior line. Apply this workaround according to values in the offset.
--- drivers/gpu/drm/i915/display/intel_psr.c | 27 +++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_psr.c +26 -1
@@ -818,6 +818,30 @@ static bool psr2_granularity_check(struct intel_dp *intel_dp,return true; } +static bool apply_scanline_indication_wa (struct intel_dp *intel_dp, +struct intel_crtc_state *crtc_state) +{ +u8 early_scanline_support = intel_dp->intel_wa_dpcd & +INTEL_DPCD_INTEL_WA_REGISTER_CAPS_PSR2_EARLYSCANLINE_SDP_SUPPORT_MASK ; + +if (intel_dp->edp_dpcd[0 ] >=DP_EDP_15 ) +return true; + +switch (early_scanline_support) { +case INTEL_DPCD_INTEL_WA_REGISTER_CAPS_FALL_BACK_TO_PSR1 : + crtc_state->req_psr2_sdp_prior_scanline = false; +return false; +case INTEL_DPCD_INTEL_WA_REGISTER_CAPS_PSR2_WITH_EARLY_SCANLINE : +return true; +case INTEL_DPCD_INTEL_WA_REGISTER_CAPS_PSR2_WITHOUT_EARLY_SCANLINE : + crtc_state->req_psr2_sdp_prior_scanline = false; +return true; +default : +MISSING_CASE (early_scanline_support); +return false; + } +} +static bool _compute_psr2_sdp_prior_scanline_indication (struct intel_dp *intel_dp,struct intel_crtc_state *crtc_state) {
@@ -839,7 +863,8 @@ static bool _compute_psr2_sdp_prior_scanline_indication(struct intel_dp *intel_dreturn false; crtc_state->req_psr2_sdp_prior_scanline = true; -return true; + +return apply_scanline_indication_wa (intel_dp, crtc_state); } static bool _compute_psr2_wake_times(struct intel_dp *intel_dp,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 74/522 Revert "RDMA/rxe: Fix double free in rxe_srq_from_init"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
This reverts commit d286f0d4e3ad3caf5f0e673cdad7bf89bf37d947, which was commit 0beefd0e15d962f497aad750b2d5e9c3570b66d1 upstream. The backported version did not move but duplicated the problematic assignment, so it did not fix the bug. A proper backport will follow.
--- drivers/infiniband/sw/rxe/rxe_srq.c | 3 --- 1 file changed, 3 deletions(-)
drivers/infiniband/sw/rxe/rxe_srq.c +0 -3
@@ -87,9 +87,6 @@ int rxe_srq_from_init(struct rxe_dev *rxe, struct rxe_srq *srq, } } - srq->rq.queue = q; - init->attr.max_wr = srq->rq.max_wr; -return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 75/522 RDMA/rxe: Fix double free in rxe_srq_from_init
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
commit 0beefd0e15d962f497aad750b2d5e9c3570b66d1 upstream.
In rxe_srq_from_init(), the queue pointer 'q' is assigned to 'srq->rq.queue' before copying the SRQ number to user space. If copy_to_user() fails, the function calls rxe_queue_cleanup() to free the queue, but leaves the now-invalid pointer in 'srq->rq.queue'.
The caller of rxe_srq_from_init() (rxe_create_srq) eventually calls rxe_srq_cleanup() upon receiving the error, which triggers a second rxe_queue_cleanup() on the same memory, leading to a double free.
The call trace looks like this:
kmem_cache_free+0x.../0x... rxe_queue_cleanup+0x1a/0x30 [rdma_rxe] rxe_srq_cleanup+0x42/0x60 [rdma_rxe] rxe_elem_release+0x31/0x70 [rdma_rxe] rxe_create_srq+0x12b/0x1a0 [rdma_rxe] ib_create_srq_user+0x9a/0x150 [ib_core]
Fix this by moving 'srq->rq.queue = q' after copy_to_user.
[bwh: Backported to 6.1: There was no assignment to init->attr.max_wr
here; don't add it]
--- drivers/infiniband/sw/rxe/rxe_srq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/sw/rxe/rxe_srq.c +2 -2
@@ -69,8 +69,6 @@ int rxe_srq_from_init(struct rxe_dev *rxe, struct rxe_srq *srq,return -ENOMEM ; } - srq->rq.queue = q; - err =do_mmap_info (rxe, uresp ? &uresp->mi :NULL , udata, q->buf, q->buf_size, &q->ip);if (err) {
@@ -87,6 +85,8 @@ int rxe_srq_from_init(struct rxe_dev *rxe, struct rxe_srq *srq, } } + srq->rq.queue = q; +return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 76/522 net: gro: dont merge zcopy skbs
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sabrina Dubroca <[email protected]>
[ Upstream commit 4db79a322db8c97f7b73b8a347395ef4d685eb40 ]
skb_gro_receive() can currently copy frags between the source and GRO skb, without checking the zerocopy status, and in particular the SKBFL_MANAGED_FRAG_REFS flag.
When SKBFL_MANAGED_FRAG_REFS is set, the skb doesn't hold a reference on the pages in shinfo->frags. Appending those frags to another skb's frags without fixing up the page refcount can lead to UAF.
When either the last skb in the GRO chain (the one we would append frags to) or the source skb is zerocopy, don't merge the skbs.
[Salvatore Bonaccorso: Adjust for context in 6.1.y series without e8d4d34df715 ("net: Add netif_get_gro_max_size helper for GRO")]
--- net/core/gro.c | 3 +++ 1 file changed, 3 insertions(+)
net/core/gro.c +3 -0
@@ -171,6 +171,9 @@ int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb)if (p->pp_recycle != skb->pp_recycle)return -ETOOMANYREFS ; +if (skb_zcopy (p) ||skb_zcopy (skb)) +return -ETOOMANYREFS ; +/* pairs with WRITE_ONCE() in netif_set_gro_max_size() */ gro_max_size =READ_ONCE (p->dev->gro_max_size);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 77/522 phy: mscc: Use PHY_ID_MATCH_VENDOR to minimize PHY ID table
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harini Katakam <[email protected]>
[ Upstream commit 31605c01fb242806f5b8c9d08abe11328d514206 ]
All the PHY devices variants specified have the same mask and hence can be simplified to one vendor look up for 0x00070400. Any individual config can be identified by PHY_ID_MATCH_EXACT in the respective structure.
Stable-dep-of: 1bc80d673087 ("phy: mscc: Use PHY_ID_MATCH_EXACT for VSC8584, VSC8582, VSC8575, VSC856X")
--- drivers/net/phy/mscc/mscc.h | 1 + drivers/net/phy/mscc/mscc_main.c | 15 +-------------- 2 files changed, 2 insertions(+), 14 deletions(-)
drivers/net/phy/mscc/mscc.h +1 -0
@@ -291,6 +291,7 @@ enum rgmii_clock_delay {#define PHY_ID_VSC8575 0x000707d0#define PHY_ID_VSC8582 0x000707b0#define PHY_ID_VSC8584 0x000707c0 +#define PHY_VENDOR_MSCC 0x00070400#define MSCC_VDDMAC_1500 1500#define MSCC_VDDMAC_1800 1800
drivers/net/phy/mscc/mscc_main.c +1 -14
@@ -2676,20 +2676,7 @@ static struct phy_driver vsc85xx_driver[] = {module_phy_driver (vsc85xx_driver);static struct mdio_device_id __maybe_unused vsc85xx_tbl[] = { - {PHY_ID_VSC8502 ,0xfffffff0 , }, - {PHY_ID_VSC8504 ,0xfffffff0 , }, - {PHY_ID_VSC8514 ,0xfffffff0 , }, - {PHY_ID_VSC8530 ,0xfffffff0 , }, - {PHY_ID_VSC8531 ,0xfffffff0 , }, - {PHY_ID_VSC8540 ,0xfffffff0 , }, - {PHY_ID_VSC8541 ,0xfffffff0 , }, - {PHY_ID_VSC8552 ,0xfffffff0 , }, - {PHY_ID_VSC856X ,0xfffffff0 , }, - {PHY_ID_VSC8572 ,0xfffffff0 , }, - {PHY_ID_VSC8574 ,0xfffffff0 , }, - {PHY_ID_VSC8575 ,0xfffffff0 , }, - {PHY_ID_VSC8582 ,0xfffffff0 , }, - {PHY_ID_VSC8584 ,0xfffffff0 , }, + {PHY_ID_MATCH_VENDOR (PHY_VENDOR_MSCC ) }, { } };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 78/522 phy: mscc: Use PHY_ID_MATCH_EXACT for VSC8584, VSC8582, VSC8575, VSC856X
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Horatiu Vultur <[email protected]>
[ Upstream commit 1bc80d673087e5704adbb3ee8e4b785c14899cce ]
As the PHYs VSC8584, VSC8582, VSC8575 and VSC856X exists only as rev B, we can use PHY_ID_MATCH_EXACT to match exactly on revision B of the PHY. Because of this change then there is not need the check if it is a different revision than rev B in the function vsc8584_probe() as we already know that this will never happen.
These changes are a preparation for the next patch because in that patch we will make the PHYs VSC8574 and VSC8572 to use vsc8584_probe() and these PHYs have multiple revision.
--- drivers/net/phy/mscc/mscc.h | 8 ++++---- drivers/net/phy/mscc/mscc_main.c | 23 ++++------------------- 2 files changed, 8 insertions(+), 23 deletions(-)
drivers/net/phy/mscc/mscc.h +4 -4
@@ -285,12 +285,12 @@ enum rgmii_clock_delay {#define PHY_ID_VSC8540 0x00070760#define PHY_ID_VSC8541 0x00070770#define PHY_ID_VSC8552 0x000704e0 -#define PHY_ID_VSC856X 0x000707e0 +#define PHY_ID_VSC856X 0x000707e1#define PHY_ID_VSC8572 0x000704d0#define PHY_ID_VSC8574 0x000704a0 -#define PHY_ID_VSC8575 0x000707d0 -#define PHY_ID_VSC8582 0x000707b0 -#define PHY_ID_VSC8584 0x000707c0 +#define PHY_ID_VSC8575 0x000707d1 +#define PHY_ID_VSC8582 0x000707b1 +#define PHY_ID_VSC8584 0x000707c1#define PHY_VENDOR_MSCC 0x00070400#define MSCC_VDDMAC_1500 1500
drivers/net/phy/mscc/mscc_main.c +4 -19
@@ -1713,12 +1713,6 @@ static int vsc8584_config_init(struct phy_device *phydev)* in this pre-init function. */ if (phy_package_init_once (phydev)) { -/* The following switch statement assumes that the lowest -* nibble of the phy_id_mask is always 0. This works because -* the lowest nibble of the PHY_ID's below are also 0. -*/ -WARN_ON (phydev->drv->phy_id_mask &0xf ); -switch (phydev->phy_id & phydev->drv->phy_id_mask) {case PHY_ID_VSC8504 :case PHY_ID_VSC8552 :
@@ -2257,11 +2251,6 @@ static int vsc8584_probe(struct phy_device *phydev) VSC8531_DUPLEX_COLLISION};int ret; -if ((phydev->phy_id &MSCC_DEV_REV_MASK ) !=VSC8584_REVB ) { -dev_err (&phydev->mdio.dev,"Only VSC8584 revB is supported.\n" ); -return -ENOTSUPP ; - } - vsc8531 =devm_kzalloc (&phydev->mdio.dev,sizeof (*vsc8531),GFP_KERNEL );if (!vsc8531)return -ENOMEM ;
@@ -2524,9 +2513,8 @@ static struct phy_driver vsc85xx_driver[] = { .get_stats = &vsc85xx_get_stats, }, { - .phy_id = PHY_ID_VSC856X, + PHY_ID_MATCH_EXACT(PHY_ID_VSC856X), .name = "Microsemi GE VSC856X SyncE", - .phy_id_mask = 0xfffffff0,/* PHY_GBIT_FEATURES */ .soft_reset = &genphy_soft_reset, .config_init = &vsc8584_config_init,
@@ -2598,9 +2586,8 @@ static struct phy_driver vsc85xx_driver[] = { .get_stats = &vsc85xx_get_stats, }, { - .phy_id = PHY_ID_VSC8575, + PHY_ID_MATCH_EXACT(PHY_ID_VSC8575), .name = "Microsemi GE VSC8575 SyncE", - .phy_id_mask = 0xfffffff0,/* PHY_GBIT_FEATURES */ .soft_reset = &genphy_soft_reset, .config_init = &vsc8584_config_init,
@@ -2622,9 +2609,8 @@ static struct phy_driver vsc85xx_driver[] = { .get_stats = &vsc85xx_get_stats, }, { - .phy_id = PHY_ID_VSC8582, + PHY_ID_MATCH_EXACT(PHY_ID_VSC8582), .name = "Microsemi GE VSC8582 SyncE", - .phy_id_mask = 0xfffffff0,/* PHY_GBIT_FEATURES */ .soft_reset = &genphy_soft_reset, .config_init = &vsc8584_config_init,
@@ -2646,9 +2632,8 @@ static struct phy_driver vsc85xx_driver[] = { .get_stats = &vsc85xx_get_stats, }, { - .phy_id = PHY_ID_VSC8584, + PHY_ID_MATCH_EXACT(PHY_ID_VSC8584), .name = "Microsemi GE VSC8584 SyncE", - .phy_id_mask = 0xfffffff0,/* PHY_GBIT_FEATURES */ .soft_reset = &genphy_soft_reset, .config_init = &vsc8584_config_init,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 79/522 hwmon: (pmbus/adm1266) serialize GPIO PMBus accesses with pmbus_lock
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdurrahman Hussain <[email protected]>
[ Upstream commit bab8c6fb5af8df7e753d196c1262cb78e92ca872 ]
adm1266_gpio_get(), adm1266_gpio_get_multiple(), and adm1266_gpio_dbg_show() all issue PMBus reads against the device but none of them take pmbus_lock. The pmbus_core framework holds pmbus_lock around its own multi-transaction sequences (notably the "set PAGE, then read paged register" pattern used by hwmon attributes), so an unlocked GPIO accessor can land between a PAGE write and the subsequent paged read in another thread and corrupt either side's view of the device state machine.
Take pmbus_lock at the top of each of the three accessors via the scope-based guard(). The lock is uncontended in the common case and adds only a single mutex round-trip per call.
--- drivers/hwmon/pmbus/adm1266.c | 40 +++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-)
drivers/hwmon/pmbus/adm1266.c +34 -6
@@ -173,7 +173,12 @@ static int adm1266_gpio_get(struct gpio_chip *chip, unsigned int offset)else pmbus_cmd =ADM1266_PDIO_STATUS ; + ret =pmbus_lock_interruptible (data->client); +if (ret) +return ret; + ret =i2c_smbus_read_block_data (data->client, pmbus_cmd, read_buf); +pmbus_unlock (data->client);if (ret <0 )return ret;if (ret <2 )
@@ -195,11 +200,19 @@ static int adm1266_gpio_get_multiple(struct gpio_chip *chip, unsigned long *maskunsigned int gpio_nr;int ret; + ret =pmbus_lock_interruptible (data->client); +if (ret) +return ret; + ret =i2c_smbus_read_block_data (data->client,ADM1266_GPIO_STATUS , read_buf); -if (ret <0 ) +if (ret <0 ) { +pmbus_unlock (data->client);return ret; -if (ret <2 ) + } +if (ret <2 ) { +pmbus_unlock (data->client);return -EIO ; + } status = read_buf[0 ] + (read_buf[1 ] <<8 );
@@ -210,10 +223,14 @@ static int adm1266_gpio_get_multiple(struct gpio_chip *chip, unsigned long *mask } ret =i2c_smbus_read_block_data (data->client,ADM1266_PDIO_STATUS , read_buf); -if (ret <0 ) +if (ret <0 ) { +pmbus_unlock (data->client);return ret; -if (ret <2 ) + } +if (ret <2 ) { +pmbus_unlock (data->client);return -EIO ; + } status = read_buf[0 ] + (read_buf[1 ] <<8 );
@@ -222,6 +239,8 @@ static int adm1266_gpio_get_multiple(struct gpio_chip *chip, unsigned long *maskset_bit (gpio_nr, bits); } +pmbus_unlock (data->client); +return 0 ; }
@@ -236,11 +255,16 @@ static void adm1266_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)int ret;int i; +if (pmbus_lock_interruptible (data->client)) +return ; +for (i =0 ; i <ADM1266_GPIO_NR ; i++) { write_cmd = adm1266_gpio_mapping[i][1 ]; ret =adm1266_pmbus_block_xfer (data,ADM1266_GPIO_CONFIG ,1 , &write_cmd, read_buf); -if (ret !=2 ) +if (ret !=2 ) { +pmbus_unlock (data->client);return ; + } gpio_config = read_buf[0 ];seq_puts (s, adm1266_names[i]);
@@ -262,8 +286,10 @@ static void adm1266_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) write_cmd =0xFF ; ret =adm1266_pmbus_block_xfer (data,ADM1266_PDIO_CONFIG ,1 , &write_cmd, read_buf); -if (ret !=32 ) +if (ret !=32 ) { +pmbus_unlock (data->client);return ; + }for (i =0 ; i <ADM1266_PDIO_NR ; i++) {seq_puts (s, adm1266_names[ADM1266_GPIO_NR + i]);
@@ -286,6 +312,8 @@ static void adm1266_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)seq_puts (s,")\n" ); } + +pmbus_unlock (data->client); }static int adm1266_config_gpio (struct adm1266_data *data)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 80/522 hwmon: (pmbus/adm1266) serialize sequencer_state debugfs read with pmbus_lock
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdurrahman Hussain <[email protected]>
[ Upstream commit 4e4af55aaca7f6d7673d5f9889ad0529db86a048 ]
adm1266_state_read() backs the sequencer_state debugfs entry and issues an i2c_smbus_read_word_data(client, ADM1266_READ_STATE) against the device without taking pmbus_lock. pmbus_core holds pmbus_lock around its own multi-transaction sequences (notably the "set PAGE, then read paged register" pattern used by hwmon attributes), so an unlocked debugfs reader can land between a PAGE write and the subsequent paged read in another thread. READ_STATE itself is not paged, so it cannot corrupt PAGE in flight, but the same defensive serialisation that applies to the GPIO accessors applies here: any direct device access from outside pmbus_core should be ordered with respect to pmbus_core's own.
Take pmbus_lock at the top of adm1266_state_read() via the scope-based guard().
--- drivers/hwmon/pmbus/adm1266.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/hwmon/pmbus/adm1266.c +7 -0
@@ -356,7 +356,14 @@ static int adm1266_state_read(struct seq_file *s, void *pdata)struct i2c_client *client =to_i2c_client (dev);int ret; + ret =pmbus_lock_interruptible (client); +if (ret) +return ret; + ret =i2c_smbus_read_word_data (client,ADM1266_READ_STATE ); + +pmbus_unlock (client); +if (ret <0 )return ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 81/522 hwmon: (pmbus/adm1266) serialize NVMEM blackbox read with pmbus_lock
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdurrahman Hussain <[email protected]>
[ Upstream commit 9f1dd8f9491eb840cbea7ffdf4cad031e25f8ae0 ]
adm1266_nvmem_read() is the reg_read callback the NVMEM core invokes when userspace reads /sys/bus/nvmem/devices/.../nvmem on this chip. On the first byte of every read it does a memset of data->dev_mem, walks the device blackbox through adm1266_nvmem_read_blackbox() (which issues a chain of PMBus block transactions), and then memcpys the refreshed buffer out to userspace. None of that runs under pmbus_lock today.
Two consequences:
- The PMBus traffic the refresh issues is not serialised against pmbus_core's own multi-step PAGE+register sequences. A paged hwmon attribute read from another thread can land between a PAGE write and the paged read in either direction and corrupt one side's view of the device state machine.
- The NVMEM core does not serialise concurrent reg_read calls, so two userspace readers racing at offset 0 can interleave the memset of data->dev_mem with another reader's adm1266_nvmem_read_blackbox() refill or memcpy out, returning torn data to userspace.
Take pmbus_lock at the top of adm1266_nvmem_read() via the scope-based guard(). Patch 5 of this series moves adm1266_config_nvmem() past pmbus_do_probe() so the lock is guaranteed to be live before the callback is reachable from userspace.
--- drivers/hwmon/pmbus/adm1266.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/hwmon/pmbus/adm1266.c +7 -0
@@ -430,18 +430,25 @@ static int adm1266_nvmem_read(void *priv, unsigned int offset, void *val, size_tif (offset + bytes > data->nvmem_config.size)return -EINVAL ; + ret =pmbus_lock_interruptible (data->client); +if (ret) +return ret; +if (offset ==0 ) {memset (data->dev_mem,0 , data->nvmem_config.size); ret =adm1266_nvmem_read_blackbox (data, data->dev_mem);if (ret) {dev_err (&data->client->dev,"Could not read blackbox!" ); +pmbus_unlock (data->client);return ret; } }memcpy (val, data->dev_mem + offset, bytes); +pmbus_unlock (data->client); +return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 82/522 iio: imu: st_lsm6dsx: fix stack leak in tagged FIFO buffer
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit c9d8e9adaa63150ef7e833480b799d0bab83a276 upstream.
The tagged FIFO path declares iio_buff on the stack with __aligned(8) but no initializer, but there is a hole in the structure, which will then leak to userspace as ST_LSM6DSX_SAMPLE_SIZE bytes (6) will be copied, but the space between that and the timestamp are not initialized.
Commit c14edb4d0bdc ("iio:imu:st_lsm6dsx Fix alignment and data leak issues") moved the untagged FIFO path to a kzalloc'd buffer in hw->scan, but for the tagged path it only added the alignment qualifier and not the initializer :(
Fix this by just zero-initializing the structure on the stack.
--- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c +1 -1
@@ -572,7 +572,7 @@ int st_lsm6dsx_read_tagged_fifo(struct s* must be passed a buffer that is aligned to 8 bytes so * as to allow insertion of a naturally aligned timestamp. */ -u8 iio_buff[ST_LSM6DSX_IIO_BUFF_SIZE ]__aligned(8) ; +u8 iio_buff[ST_LSM6DSX_IIO_BUFF_SIZE ]__aligned(8) = { };u8 tag;bool reset_ts = false;int i, err, read_len;
Greg Kroah-Hartman
maintainerPATCH 65/522 net/packet: convert po->tp_tx_has_off to an atomic flag
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 7438344660fa55b33b8234c1797c886eb73667a7 ]
This is to use existing space in po->flags, and reclaim the storage used by the non atomic bit fields.
Stable-dep-of: 2c054e17d9d4 ("net/packet: fix TOCTOU race on mmap'd vnet_hdr in tpacket_snd()")
--- net/packet/af_packet.c | 6 +++--- net/packet/internal.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)
net/packet/af_packet.c +3 -3
@@ -2723,7 +2723,7 @@ static int tpacket_parse_header(struct packet_sock *po, void *frame,return -EMSGSIZE ; } -if (unlikely (po->tp_tx_has_off)) { +if (unlikely (packet_sock_flag (po,PACKET_SOCK_TX_HAS_OFF ))) {int off_min, off_max; off_min = po->tp_hdrlen -sizeof (struct sockaddr_ll );
@@ -4064,7 +4064,7 @@ packet_setsockopt(struct socket *sock, int level, int optname, sockptr_t optval,lock_sock (sk);if (!po->rx_ring.pg_vec && !po->tx_ring.pg_vec) - po->tp_tx_has_off = !!val; +packet_sock_flag_set (po,PACKET_SOCK_TX_HAS_OFF , val);release_sock (sk);return 0 ;
@@ -4191,7 +4191,7 @@ static int packet_getsockopt(struct socket *sock, int level, int optname, lv =sizeof (rstats);break ;case PACKET_TX_HAS_OFF : - val = po->tp_tx_has_off; + val =packet_sock_flag (po,PACKET_SOCK_TX_HAS_OFF );break ;case PACKET_QDISC_BYPASS : val =packet_use_direct_xmit (po);
net/packet/internal.h +2 -2
@@ -119,8 +119,7 @@ struct packet_sock {unsigned long flags;unsigned int running;/* bind_lock must be held */ unsigned int has_vnet_hdr:1, /* writer must hold sock lock */ - tp_loss:1, - tp_tx_has_off:1; + tp_loss:1;int pressure;int ifindex;/* bound device */ __be16 num;
@@ -146,6 +145,7 @@ static inline struct packet_sock *pkt_sk(struct sock *sk)enum packet_sock_flags {PACKET_SOCK_ORIGDEV ,PACKET_SOCK_AUXDATA , +PACKET_SOCK_TX_HAS_OFF , }; static inline void packet_sock_flag_set(struct packet_sock *po,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 83/522 usb: typec: ucsi: ccg: reject firmware images without a : record header
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit d7486952bf74e546ee3748fb14b2d07881fa6273 upstream.
do_flash() locates the first .cyacd record with
p = strnchr(fw->data, fw->size, ':');
while (p < eof) {
s = strnchr(p + 1, eof - p - 1, ':');
...
}If the firmware image contains no ':' byte, strnchr() returns NULL. NULL compares less than the valid kernel pointer eof, so the loop body runs and strnchr() is called with p + 1 == (void *)1 and a length of roughly (unsigned long)eof, causing a wonderful crash.
The not_signed_fw fallthrough earlier in do_flash() and the chip-state branches in ccg_fw_update_needed() allow an unsigned blob to reach this loop, so a root user who can place a crafted file under /lib/firmware and write the do_flash sysfs attribute can trigger the oops.
Bail out with -EINVAL when the initial strnchr() returns NULL.
--- drivers/usb/typec/ucsi/ucsi_ccg.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/typec/ucsi/ucsi_ccg.c +5 -0
@@ -1178,6 +1178,11 @@ not_signed_fw:*****************************************************************/ p =strnchr (fw->data, fw->size,':' ); +if (!p) { +dev_err (dev,"Bad FW format: no ':' record header found\n" ); + err = -EINVAL ; + goto release_mem; + }while (p < eof) { s =strnchr (p +1 , eof - p -1 ,':' );
Greg Kroah-Hartman
maintainerPATCH 84/522 usb: typec: ucsi: displayport: NAK DP_CMD_CONFIGURE without a payload VDO
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 167dd8d12226587ee554f520aed0256b7769cd5d upstream.
ucsi_displayport_vdm() handles a DP_CMD_CONFIGURE by copying the first payload VDO from data[], but unlike the equivalent handler in altmodes/displayport.c it does not check that count covers a VDO beyond the header. A header-only Configure VDM (count == 1) would read one u32 past the caller's array.
In the normal UCSI path the caller controls count, so this is hardening for non-standard delivery paths. NAK and bail when no configuration VDO is present, matching the generic DP altmode driver's existing guard.
--- drivers/usb/typec/ucsi/displayport.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/typec/ucsi/displayport.c +4 -0
@@ -240,6 +240,10 @@ static int ucsi_displayport_vdm(struct t dp->header |=VDO_CMDT (CMDT_RSP_ACK );break ;case DP_CMD_CONFIGURE : +if (count <2 ) { + dp->header |=VDO_CMDT (CMDT_RSP_NAK ); +break ; + } dp->data.conf = *data;if (ucsi_displayport_configure (dp)) { dp->header |=VDO_CMDT (CMDT_RSP_NAK );
Greg Kroah-Hartman
maintainerPATCH 85/522 usb: typec: altmodes/displayport: validate count before reading Status Update VDO
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 8a18f896e667df491331371b55d4ad644dc51d60 upstream.
A broken/malicious device can send the incorrect count for a status update VDO, which will cause the kernel to read uninitialized stack data and send it off elsewhere.
Fix this up by correctly verifying the count for the update object.
--- drivers/usb/typec/altmodes/displayport.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/typec/altmodes/displayport.c +2 -0
@@ -308,6 +308,8 @@ static int dp_altmode_vdm(struct typec_a }break ;case DP_CMD_STATUS_UPDATE : +if (count <2 ) +break ; dp->data.status = *vdo; ret =dp_altmode_status_update (dp);break ;
Greg Kroah-Hartman
maintainerPATCH 86/522 usb: typec: wcove: dont write past struct pd_message in wcove_read_rx_buffer()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 4af7ad0e6d7aa4403dbb1dac7b9659b0421efcaa upstream.
wcove_read_rx_buffer() copies the PD RX FIFO into the caller's struct pd_message with
for (i = 0; i < USBC_RXINFO_RXBYTES(info); i++) regmap_read(wcove->regmap, USBC_RX_DATA + i, msg + i);
which has two problems:
USBC_RXINFO_RXBYTES() is a 5-bit field (max 31) while struct pd_message is 30 bytes (__le16 header + __le32 payload[PD_MAX_PAYLOAD], packed). The byte count latched in RXINFO is the number of bytes the port partner put on the wire, so a malicious partner that transmits a 31-byte frame can drive the loop one byte past the destination if the WCOVE BMC receiver does not enforce the PD object-count limit in hardware. The existing FIXME flagged this as unverified.
Independently, regmap_read() takes an unsigned int * and stores a full unsigned int at the destination. Passing the byte pointer msg + i means each iteration writes four bytes; the high three are zero (val_bits is
8) and are normally overwritten by the next iteration, but the final iteration's high bytes are not. With RXBYTES == 30 the i == 29 iteration already writes three zero bytes past msg, which sits on the IRQ thread's stack in wcove_typec_irq().
Clamp the loop to sizeof(struct pd_message) and read each register into a local before storing only its low byte, so the copy can never exceed the destination regardless of what RXINFO reports.
--- drivers/usb/typec/tcpm/wcove.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/usb/typec/tcpm/wcove.c +8 -5
@@ -444,9 +444,11 @@ static int wcove_start_toggling(struct treturn regmap_write (wcove->regmap,USBC_CONTROL1 , usbc_ctrl); } -static int wcove_read_rx_buffer (struct wcove_typec *wcove,void *msg) +static int wcove_read_rx_buffer (struct wcove_typec *wcove, +struct pd_message *msg) { -unsigned int info; +unsigned int info, val, len; +u8 *buf = (u8 *)msg;int ret;int i;
@@ -454,12 +456,13 @@ static int wcove_read_rx_buffer(struct wif (ret)return ret; -/* FIXME: Check that USBC_RXINFO_RXBYTES(info) matches the header */ + len =min (USBC_RXINFO_RXBYTES (info),sizeof (*msg)); -for (i =0 ; i <USBC_RXINFO_RXBYTES (info); i++) { - ret =regmap_read (wcove->regmap,USBC_RX_DATA + i, msg + i); +for (i =0 ; i < len; i++) { + ret =regmap_read (wcove->regmap,USBC_RX_DATA + i, &val);if (ret)return ret; + buf[i] = val; } return regmap_write(wcove->regmap, USBC_RXSTATUS,
Greg Kroah-Hartman
maintainerPATCH 87/522 usb: typec: ucsi: validate connector number in ucsi_connector_change()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 288a81a8507052bcfbf884d39a463c44c42c5fd9 upstream.
The connector number in a UCSI CCI notification is a 7-bit field supplied by the PPM. ucsi_connector_change() uses it to index the ucsi->connector[] array without checking it against the number of connectors the PPM reported at init time, so a buggy or malicious PPM (EC firmware, or an I2C-attached UCSI controller on the ccg / stm32g0 / glink transports) can drive schedule_work() on memory past the end of the array.
Reject connector numbers that are zero or exceed cap.num_connectors before dereferencing the array.
--- drivers/usb/typec/ucsi/ucsi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/usb/typec/ucsi/ucsi.c +10 -1
@@ -852,13 +852,22 @@ out_unlock:*/ void ucsi_connector_change (struct ucsi *ucsi,u8 num) { -struct ucsi_connector *con = &ucsi->connector[num -1 ]; +struct ucsi_connector *con;if (!(ucsi->ntfy &UCSI_ENABLE_NTFY_CONNECTOR_CHANGE )) {dev_dbg (ucsi->dev,"Early connector change event\n" );return ; } +if (!num || num > ucsi->cap.num_connectors) { +dev_warn_ratelimited (ucsi->dev, +"Bogus connector change on %u (max %u)\n" , + num, ucsi->cap.num_connectors); +return ; + } + + con = &ucsi->connector[num -1 ]; +if (!test_and_set_bit (EVENT_PENDING , &ucsi->flags))schedule_work (&con->work); }
Greg Kroah-Hartman
maintainerPATCH 88/522 USB: serial: safe_serial: fix memory corruption with small endpoint
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 438061ed1ad85e6743e2dce826671772d81089ec upstream.
Make sure that the bulk-out buffer size is at least eight bytes to avoid user-controlled slab corruption in "safe" mode should a malicious device report a smaller size.
--- drivers/usb/serial/safe_serial.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/usb/serial/safe_serial.c +11 -0
@@ -259,6 +259,7 @@ static int safe_prepare_write_buffer(strstatic int safe_startup (struct usb_serial *serial) {struct usb_interface_descriptor *desc; +int bulk_out_size;if (serial->dev->descriptor.bDeviceClass !=CDC_DEVICE_CLASS )return -ENODEV ;
@@ -279,6 +280,16 @@ static int safe_startup(struct usb_seriadefault :return -EINVAL ; } + +/* +* The bulk-out buffer needs to be large enough for the two-byte +* trailer in safe mode, but assume anything smaller than eight bytes +* is broken. +*/ + bulk_out_size = serial->port[0 ]->bulk_out_size; +if (bulk_out_size >0 && bulk_out_size <8 ) +return -EINVAL ; +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 89/522 Input: ims-pcu - fix usb_free_coherent() size in ims_pcu_buffers_free()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <[email protected]>
commit dab48a7e74e6a394f3aa0461a2b1fb0c7b38fcb8 upstream.
The input buffer size is pcu->max_in_size, but pcu->max_out_size is passed to usb_free_coherent().
Change size to match the allocation size.
--- drivers/input/misc/ims-pcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/misc/ims-pcu.c +1 -1
@@ -1598,7 +1598,7 @@ static void ims_pcu_buffers_free(structusb_kill_urb (pcu->urb_in);usb_free_urb (pcu->urb_in); -usb_free_coherent (pcu->udev, pcu->max_out_size, +usb_free_coherent (pcu->udev, pcu->max_in_size, pcu->urb_in_buf, pcu->read_dma);kfree (pcu->urb_out_buf);
Greg Kroah-Hartman
maintainerPATCH 90/522 HID: quirks: Add ALWAYS_POLL quirk for SIGMACHIP USB mouse
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: hlleng <[email protected]>
commit 07466fc91c55532edcfb5c6a7ccd2ea52728d6bd upstream.
The SIGMACHIP USB mouse with VID/PID 1c4f:0034 can disconnect and re-enumerate repeatedly after it has been enumerated if its interrupt endpoint is not continuously polled.
This was observed with the device reporting itself as "SIGMACHIP Usb Mouse". Keeping the input event device open avoids the disconnects.
Add HID_QUIRK_ALWAYS_POLL for this device so the HID core keeps polling it even when there is no userspace input consumer.
--- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-quirks.c | 1 + 2 files changed, 2 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -1167,6 +1167,7 @@#define USB_VENDOR_ID_SIGMA_MICRO 0x1c4f#define USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD 0x0002 +#define USB_DEVICE_ID_SIGMA_MICRO_USB_MOUSE 0x0034#define USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD2 0x0059#define USB_VENDOR_ID_SIGMATEL 0x066F
drivers/hid/hid-quirks.c +1 -0
@@ -175,6 +175,7 @@ static const struct hid_device_id hid_qu { HID_USB_DEVICE(USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD), HID_QUIRK_NO_INIT_REPORTS }, { HID_USB_DEVICE(USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB), HID_QUIRK_NOGET }, { HID_USB_DEVICE(USB_VENDOR_ID_SIGMA_MICRO, USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD), HID_QUIRK_NO_INIT_REPORTS }, + { HID_USB_DEVICE(USB_VENDOR_ID_SIGMA_MICRO, USB_DEVICE_ID_SIGMA_MICRO_USB_MOUSE), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_SIGMATEL, USB_DEVICE_ID_SIGMATEL_STMP3780), HID_QUIRK_NOGET }, { HID_USB_DEVICE(USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS1030_TOUCH), HID_QUIRK_NOGET }, { HID_USB_DEVICE(USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS817_TOUCH), HID_QUIRK_NOGET },
Greg Kroah-Hartman
maintainerPATCH 91/522 Bluetooth: btusb: Allow firmware re-download when version matches
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuai Zhang <[email protected]>
commit 82855073c1081732656734b74d7d1d5e4cfd0da7 upstream.
The Bluetooth host decides whether to download firmware by reading the controller firmware download completion flag and firmware version information.
If a USB error occurs during the firmware download process (for example due to a USB disconnect), the download is aborted immediately. An incomplete firmware transfer does not cause the controller to set the download completion flag, but the firmware version information may be updated at an early stage of the download process.
In this case, after USB reconnection, the host attempts to re-download the firmware because the download completion flag is not set. However, since the controller reports the same firmware version as the target firmware, the download is skipped. This ultimately results in the firmware not being properly updated on the controller.
This change removes the restriction that skips firmware download when the versions are equal. It covers scenarios where the USB connection can be disconnected at any time and ensures that firmware download can be retriggered after USB reconnection, allowing the Bluetooth firmware to be correctly and completely updated.
--- drivers/bluetooth/btusb.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/bluetooth/btusb.c +7 -1
@@ -3440,7 +3440,13 @@ static int btusb_setup_qca_load_rampatch"firmware rome 0x%x build 0x%x" , rver_rom, rver_patch, ver_rom, ver_patch); -if (rver_rom != ver_rom || rver_patch <= ver_patch) { +/* Allow rampatch when the patch version equals the firmware version. +* A firmware download may be aborted by a transient USB error (e.g. +* disconnect) after the controller updates version info but before +* completion. +* Allowing equal versions enables re-flashing during recovery. +*/ +if (rver_rom != ver_rom || rver_patch < ver_patch) {bt_dev_err (hdev,"rampatch file version did not match with firmware" ); err = -EINVAL ; goto done;
Greg Kroah-Hartman
maintainerPATCH 92/522 hpfs: fix a crash if hpfs_map_dnode_bitmap fails
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 974820a59efde7c1a7e1260bcfe9bb81f833cc9f upstream.
If hpfs_map_dnode_bitmap fails, the code would call hpfs_brelse4 on uninitialized quad buffer head, causing a crash.
--- fs/hpfs/alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/hpfs/alloc.c +1 -1
@@ -372,8 +372,8 @@ int hpfs_check_free_dnodes(struct super_return 0 ; } } +hpfs_brelse4 (&qbh); } -hpfs_brelse4 (&qbh); i =0 ;if (hpfs_sb (s)->sb_c_bitmap !=-1 ) { bmp =hpfs_map_bitmap (s, b, &qbh,"chkdn1" );
Greg Kroah-Hartman
maintainerPATCH 66/522 net/packet: convert po->tp_loss to an atomic flag
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 164bddace2e03f6005e650cb88f101a66ebdc05a ]
tp_loss can be read locklessly.
Convert it to an atomic flag to avoid races.
Stable-dep-of: 2c054e17d9d4 ("net/packet: fix TOCTOU race on mmap'd vnet_hdr in tpacket_snd()")
--- net/packet/af_packet.c | 6 +++--- net/packet/diag.c | 2 +- net/packet/internal.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)
net/packet/af_packet.c +3 -3
@@ -2900,7 +2900,7 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)if (unlikely (tp_len <0 )) { tpacket_error: -if (po->tp_loss) { +if (packet_sock_flag (po,PACKET_SOCK_TP_LOSS )) {__packet_set_status (po, ph,TP_STATUS_AVAILABLE );packet_increment_head (&po->tx_ring);
@@ -3957,7 +3957,7 @@ packet_setsockopt(struct socket *sock, int level, int optname, sockptr_t optval,if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) { ret = -EBUSY ; }else { - po->tp_loss = !!val; +packet_sock_flag_set (po,PACKET_SOCK_TP_LOSS , val); ret =0 ; }release_sock (sk);
@@ -4166,7 +4166,7 @@ static int packet_getsockopt(struct socket *sock, int level, int optname, val = po->tp_reserve;break ;case PACKET_LOSS : - val = po->tp_loss; + val =packet_sock_flag (po,PACKET_SOCK_TP_LOSS );break ;case PACKET_TIMESTAMP : val = po->tp_tstamp;
net/packet/diag.c +1 -1
@@ -29,7 +29,7 @@ static int pdiag_put_info(const struct packet_sock *po, struct sk_buff *nlskb) pinfo.pdi_flags |=PDI_ORIGDEV ;if (po->has_vnet_hdr) pinfo.pdi_flags |=PDI_VNETHDR ; -if (po->tp_loss) +if (packet_sock_flag (po,PACKET_SOCK_TP_LOSS )) pinfo.pdi_flags |=PDI_LOSS ;return nla_put (nlskb,PACKET_DIAG_INFO ,sizeof (pinfo), &pinfo);
net/packet/internal.h +2 -2
@@ -118,8 +118,7 @@ struct packet_sock {struct mutex pg_vec_lock;unsigned long flags;unsigned int running;/* bind_lock must be held */ - unsigned int has_vnet_hdr:1, /* writer must hold sock lock */ - tp_loss:1; + unsigned int has_vnet_hdr:1; /* writer must hold sock lock */int pressure;int ifindex;/* bound device */ __be16 num;
@@ -146,6 +145,7 @@ enum packet_sock_flags {PACKET_SOCK_ORIGDEV ,PACKET_SOCK_AUXDATA ,PACKET_SOCK_TX_HAS_OFF , + PACKET_SOCK_TP_LOSS, }; static inline void packet_sock_flag_set(struct packet_sock *po,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 93/522 ipc: limit next_id allocation to the valid ID range
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linpu Yu <[email protected]>
commit fa0b9b2b7ae3539908d69c2b9ac0d144d9bc5139 upstream.
The checkpoint/restore sysctl path can request the next SysV IPC id through ids->next_id. ipc_idr_alloc() currently forwards that request to idr_alloc() with an open-ended upper bound.
If the valid tail of the SysV IPC id space is full, the allocation can spill beyond ipc_mni. The returned SysV IPC id still uses the normal index encoding, so later lookup and removal can target the wrong slot. This leaves the real IDR entry behind and breaks the IDR state for the object.
The bug is in ipc_idr_alloc() in the checkpoint/restore path.
1. ids->next_id is passed to:
idr_alloc(&ids->ipcs_idr, new, ipcid_to_idx(next_id), 0, ...)
2. The zero upper bound makes the allocation effectively open-ended. Once the valid SysV IPC tail is occupied, idr_alloc() can spill past ipc_mni and allocate an entry beyond the valid IPC id range.
3. The new object id is still encoded with the narrower SysV IPC index width:
new->id = (new->seq << ipcmni_seq_shift()) + idx
4. Later removal goes through ipc_rmid(), which uses:
ipcid_to_idx(ipcp->id)
That truncates the real IDR index. An object actually stored at a high index can then be removed as if it lived at a low in-range index.
5. For shared memory, shm_destroy() frees the current object anyway, but the real high IDR slot is left behind as a dangling pointer.
6. A subsequent walk of /proc/sysvipc/shm reaches the stale IDR entry and dereferences freed memory.
Prevent this by bounding the requested allocation to ipc_mni so the checkpoint/restore path fails once the valid range is exhausted.
--- ipc/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ipc/util.c +1 -1
@@ -253,7 +253,7 @@ static inline int ipc_idr_alloc(struct i }else { new->seq =ipcid_to_seqx (next_id); idx =idr_alloc (&ids->ipcs_idr, new,ipcid_to_idx (next_id), -0 ,GFP_NOWAIT ); + ipc_mni,GFP_NOWAIT ); }if (idx >=0 ) new->id = (new->seq <<ipcmni_seq_shift ()) + idx;
Greg Kroah-Hartman
maintainerPATCH 94/522 auxdisplay: line-display: fix OOB read on zero-length message_store()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stepan Ionichev <[email protected]>
commit a7511dcd9dd4bc55d123f9b800c8a4ed2662e5c6 upstream.
linedisp_display() unconditionally reads msg[count - 1] before checking whether count is zero, so a write of zero bytes to the message sysfs attribute hits msg[-1]:
write(fd, "", 0); -> message_store(..., buf, count=0) -> linedisp_display(linedisp, buf, count=0) -> msg[count - 1] == '\n' ; OOB read
The kernfs write buffer for that store is a 1-byte allocation (kernfs_fop_write_iter() does kmalloc(len + 1) with len == 0), so msg[-1] is a 1-byte read before the slab object. On a KASAN-enabled kernel this trips an out-of-bounds report and panics; on stock kernels it silently reads adjacent slab data and, if that byte happens to be '\n', the following count-- wraps ssize_t 0 to -1 and is then passed to kmemdup_nul().
linedisp_display() is reached from the message_store() sysfs callback (drivers/auxdisplay/line-display.c message attribute, mode 0644) and from the in-tree initial-message setup with count == -1, so the OOB path is only userspace-triggerable via zero-byte writes; vfs_write() does not short-circuit on count == 0 and kernfs_fop_write_iter() dispatches the store callback regardless.
Guard the trailing-newline trim with a count check. The existing if (!count) block then takes the clear-display path unchanged.
Affects every auxdisplay driver that registers via linedisp_register() / linedisp_attach(): ht16k33, max6959, img-ascii-lcd, seg-led-gpio.
--- drivers/auxdisplay/line-display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/auxdisplay/line-display.c +1 -1
@@ -80,7 +80,7 @@ static int linedisp_display(struct lined count =strlen (msg);/* if the string ends with a newline, trim it */ -if (msg[count -1 ] =='\n' ) +if (count && msg[count -1 ] =='\n' ) count--;if (!count) {
Greg Kroah-Hartman
maintainerPATCH 95/522 Bluetooth: L2CAP: use chan timer to close channels in cleanup_listen()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Siwei Zhang <[email protected]>
commit 8c8e620467a7b51562dbcefbd1f09f288d7d710d upstream.
l2cap_chan_close() removes the channel from conn->chan_l, which must be done under conn->lock. cleanup_listen() runs under the parent sk_lock, so acquiring conn->lock would invert the established conn->lock -> chan->lock -> sk_lock order.
Instead of calling l2cap_chan_close() directly, schedule l2cap_chan_timeout with delay 0 to close the channel asynchronously. The timeout handler already acquires conn->lock and chan->lock in the correct order.
The timer is only armed when chan->conn is still set: if it is already NULL, l2cap_conn_del() has already processed this channel (l2cap_chan_del + l2cap_sock_teardown_cb + l2cap_sock_close_cb), so there is nothing left to do. If l2cap_conn_del() races in after the timer is armed, __clear_chan_timer() inside l2cap_chan_del() cancels it; if the timer has already fired, the handler returns harmlessly because chan->conn was cleared.
--- net/bluetooth/l2cap_sock.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
net/bluetooth/l2cap_sock.c +9 -7
@@ -1501,6 +1501,10 @@ static void l2cap_sock_cleanup_listen(st* pin it (hold_unless_zero() additionally skips a chan already past * its last reference). We then drop the sk lock before taking * chan->lock, so sk and chan locks are never held together. +* +* Since we cannot call l2cap_chan_close() without conn->lock, +* schedule l2cap_chan_timeout to close the channel; it already +* acquires conn->lock -> chan->lock in the correct order. */ while ((sk =bt_accept_dequeue (parent,NULL ))) {struct l2cap_chan *chan;
@@ -1518,14 +1522,12 @@ static void l2cap_sock_cleanup_listen(st state_to_string(chan->state));l2cap_chan_lock (chan); -__clear_chan_timer (chan); -l2cap_chan_close (chan,ECONNRESET ); -/* l2cap_conn_del() may already have killed this socket -* (it sets SOCK_DEAD); skip the duplicate to avoid a -* double sock_put()/l2cap_chan_put(). +/* Since we cannot call l2cap_chan_close() without +* conn->lock, schedule its timer to trigger the close +* and cleanup of this channel. */ -if (!sock_flag (sk,SOCK_DEAD )) -l2cap_sock_kill (sk); +if (chan->conn) +__set_chan_timer (chan,0 );l2cap_chan_unlock (chan);l2cap_chan_put (chan);
Greg Kroah-Hartman
maintainerPATCH 96/522 Bluetooth: L2CAP: fix chan ref leak in l2cap_chan_timeout() on !conn
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Siwei Zhang <[email protected]>
commit 9dbd84990394c51f5cee1e8871bb5ff8af5ed939 upstream.
__set_chan_timer() takes a l2cap_chan reference via l2cap_chan_hold() before scheduling the delayed work. The normal path in l2cap_chan_timeout() drops this reference with l2cap_chan_put() at the end, but the early return when chan->conn is NULL skips the put, leaking the reference.
Add the missing l2cap_chan_put() before the early return.
--- net/bluetooth/l2cap_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/bluetooth/l2cap_core.c +3 -1
@@ -435,8 +435,10 @@ static void l2cap_chan_timeout(struct woBT_DBG ("chan %p state %s" , chan,state_to_string (chan->state)); -if (!conn) +if (!conn) { +l2cap_chan_put (chan);return ; + }mutex_lock (&conn->chan_lock);/* __set_chan_timer() calls l2cap_chan_hold(chan) while scheduling
Greg Kroah-Hartman
maintainerPATCH 97/522 Bluetooth: HIDP: fix missing length checks in hidp_input_report()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muhammad Bilal <[email protected]>
commit 2a3ac9ee11dbb9845f3947cef4a79dba658cf6f6 upstream.
hidp_input_report() reads keyboard and mouse payload data from an skb without first verifying that skb->len contains enough data.
hidp_recv_intr_frame() pulls the 1-byte HIDP header before dispatching to hidp_input_report(). If a paired device sends a truncated packet, the handler reads beyond the valid skb data, resulting in an out-of-bounds read of skb data. The OOB bytes may be interpreted as phantom key presses or spurious mouse movement.
Replace the open-coded length tracking and pointer arithmetic with skb_pull_data() calls. skb_pull_data() returns NULL if the requested bytes are not present, eliminating the need for a manual size variable and the separate skb->len guard.
--- net/bluetooth/hidp/core.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
net/bluetooth/hidp/core.c +18 -5
@@ -179,12 +179,21 @@ static void hidp_input_report(struct hid {struct input_dev *dev = session->input;unsigned char *keys = session->keys; -unsigned char *udata = skb->data +1 ; -signed char *sdata = skb->data +1 ; -int i, size = skb->len -1 ; +unsigned char *udata; +signed char *sdata; +u8 *hdr; +int i; + + hdr =skb_pull_data (skb,1 ); +if (!hdr) +return ; -switch (skb->data[0 ]) { +switch (*hdr) {case 0x01 :/* Keyboard report */ + udata =skb_pull_data (skb,8 ); +if (!udata) +break ; +for (i =0 ; i <8 ; i++)input_report_key (dev, hidp_keycode[i +224 ], (udata[0 ] >> i) &1 );
@@ -213,6 +222,10 @@ static void hidp_input_report(struct hidbreak ;case 0x02 :/* Mouse report */ + sdata =skb_pull_data (skb,3 ); +if (!sdata) +break ; +input_report_key (dev,BTN_LEFT , sdata[0 ] &0x01 );input_report_key (dev,BTN_RIGHT , sdata[0 ] &0x02 );input_report_key (dev,BTN_MIDDLE , sdata[0 ] &0x04 );
@@ -222,7 +235,7 @@ static void hidp_input_report(struct hidinput_report_rel (dev,REL_X , sdata[1 ]);input_report_rel (dev,REL_Y , sdata[2 ]); -if (size >3 ) +if (skb->len >0 )input_report_rel (dev,REL_WHEEL , sdata[3 ]);break ; }
Greg Kroah-Hartman
maintainerPATCH 98/522 Bluetooth: ISO: fix UAF in iso_recv_frame
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muhammad Bilal <[email protected]>
commit 47f23a259517abbdb8032c057a1e8a6bf3734878 upstream.
iso_recv_frame reads conn->sk under iso_conn_lock but releases the lock before using sk, with no reference held. A concurrent iso_sock_kill() can free sk in that window, causing use-after-free on sk->sk_state and sock_queue_rcv_skb().
Fix by replacing the bare pointer read with iso_sock_hold(conn), which calls sock_hold() while the spinlock is held, atomically elevating the refcount before the lock drops. Add a drop_put label so sock_put() is called on all exit paths where the hold succeeded.
--- net/bluetooth/iso.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
net/bluetooth/iso.c +7 -3
@@ -445,7 +445,7 @@ static void iso_recv_frame(struct iso_costruct sock *sk;iso_conn_lock (conn); - sk = conn->sk; + sk =iso_sock_hold (conn);iso_conn_unlock (conn);if (!sk)
@@ -454,11 +454,15 @@ static void iso_recv_frame(struct iso_coBT_DBG ("sk %p len %d" , sk, skb->len);if (sk->sk_state !=BT_CONNECTED ) - goto drop; + goto drop_put; -if (!sock_queue_rcv_skb (sk, skb)) +if (!sock_queue_rcv_skb (sk, skb)) { +sock_put (sk);return ; + } +drop_put: +sock_put (sk); drop:kfree_skb (skb); }
Greg Kroah-Hartman
maintainerPATCH 67/522 net/packet: convert po->has_vnet_hdr to an atomic flag
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 50d935eafee292fc432d5ac8c8715a6492961abc ]
po->has_vnet_hdr can be read locklessly.
Stable-dep-of: 2c054e17d9d4 ("net/packet: fix TOCTOU race on mmap'd vnet_hdr in tpacket_snd()")
--- net/packet/af_packet.c | 19 ++++++++++--------- net/packet/diag.c | 2 +- net/packet/internal.h | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-)
net/packet/af_packet.c +10 -9
@@ -2357,7 +2357,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, netoff =TPACKET_ALIGN (po->tp_hdrlen + (maclen <16 ?16 : maclen)) + po->tp_reserve; -if (po->has_vnet_hdr) { +if (packet_sock_flag (po,PACKET_SOCK_HAS_VNET_HDR )) { netoff +=sizeof (struct virtio_net_hdr ); do_vnet = true; }
@@ -2831,7 +2831,8 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) size_max = po->tx_ring.frame_size - (po->tp_hdrlen -sizeof (struct sockaddr_ll )); -if ((size_max > dev->mtu + reserve +VLAN_HLEN ) && !po->has_vnet_hdr) +if ((size_max > dev->mtu + reserve +VLAN_HLEN ) && + !packet_sock_flag (po,PACKET_SOCK_HAS_VNET_HDR )) size_max = dev->mtu + reserve +VLAN_HLEN ; timeo =sock_sndtimeo (&po->sk, msg->msg_flags &MSG_DONTWAIT );
@@ -2866,7 +2867,7 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) status =TP_STATUS_SEND_REQUEST ; hlen =LL_RESERVED_SPACE (dev); tlen = dev->needed_tailroom; -if (po->has_vnet_hdr) { +if (packet_sock_flag (po,PACKET_SOCK_HAS_VNET_HDR )) { vnet_hdr = data; data +=sizeof (*vnet_hdr); tp_len -=sizeof (*vnet_hdr);
@@ -2894,7 +2895,7 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) addr, hlen, copylen, &sockc);if (likely (tp_len >=0 ) && tp_len > dev->mtu + reserve && - !po->has_vnet_hdr && + !packet_sock_flag (po,PACKET_SOCK_HAS_VNET_HDR ) && !packet_extra_vlan_len_allowed (dev, skb)) tp_len = -EMSGSIZE ;
@@ -2913,7 +2914,7 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) } } -if (po->has_vnet_hdr) { +if (packet_sock_flag (po,PACKET_SOCK_HAS_VNET_HDR )) {if (virtio_net_hdr_to_skb (skb, vnet_hdr,vio_le ())) { tp_len = -EINVAL ; goto tpacket_error;
@@ -3041,7 +3042,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)if (sock->type ==SOCK_RAW ) reserve = dev->hard_header_len; -if (po->has_vnet_hdr) { +if (packet_sock_flag (po,PACKET_SOCK_HAS_VNET_HDR )) { err =packet_snd_vnet_parse (msg, &len, &vnet_hdr);if (err) goto out_unlock;
@@ -3506,7 +3507,7 @@ static int packet_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,packet_rcv_try_clear_pressure (pkt_sk (sk)); -if (pkt_sk (sk)->has_vnet_hdr) { +if (packet_sock_flag (pkt_sk (sk),PACKET_SOCK_HAS_VNET_HDR )) { err =packet_rcv_vnet (msg, skb, &len);if (err) goto out_free;
@@ -4002,7 +4003,7 @@ packet_setsockopt(struct socket *sock, int level, int optname, sockptr_t optval,if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) { ret = -EBUSY ; }else { - po->has_vnet_hdr = !!val; +packet_sock_flag_set (po,PACKET_SOCK_HAS_VNET_HDR , val); ret =0 ; }release_sock (sk);
@@ -4136,7 +4137,7 @@ static int packet_getsockopt(struct socket *sock, int level, int optname, val =packet_sock_flag (po,PACKET_SOCK_ORIGDEV );break ;case PACKET_VNET_HDR : - val = po->has_vnet_hdr; + val =packet_sock_flag (po,PACKET_SOCK_HAS_VNET_HDR );break ;case PACKET_VERSION : val = po->tp_version;
net/packet/diag.c +1 -1
@@ -27,7 +27,7 @@ static int pdiag_put_info(const struct packet_sock *po, struct sk_buff *nlskb) pinfo.pdi_flags |=PDI_AUXDATA ;if (packet_sock_flag (po,PACKET_SOCK_ORIGDEV )) pinfo.pdi_flags |=PDI_ORIGDEV ; -if (po->has_vnet_hdr) +if (packet_sock_flag (po,PACKET_SOCK_HAS_VNET_HDR )) pinfo.pdi_flags |=PDI_VNETHDR ;if (packet_sock_flag (po,PACKET_SOCK_TP_LOSS )) pinfo.pdi_flags |=PDI_LOSS ;
net/packet/internal.h +1 -1
@@ -118,7 +118,6 @@ struct packet_sock {struct mutex pg_vec_lock;unsigned long flags;unsigned int running;/* bind_lock must be held */ - unsigned int has_vnet_hdr:1; /* writer must hold sock lock */int pressure;int ifindex;/* bound device */ __be16 num;
@@ -146,6 +145,7 @@ enum packet_sock_flags {PACKET_SOCK_AUXDATA ,PACKET_SOCK_TX_HAS_OFF ,PACKET_SOCK_TP_LOSS , + PACKET_SOCK_HAS_VNET_HDR, }; static inline void packet_sock_flag_set(struct packet_sock *po,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 68/522 net/packet: convert po->running to an atomic flag
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 61edf479818e63978cabd243b82ca80f8948a313 ]
Instead of consuming 32 bits for po->running, use
one available bit in po->flags.
Stable-dep-of: 2c054e17d9d4 ("net/packet: fix TOCTOU race on mmap'd vnet_hdr in tpacket_snd()")
--- net/packet/af_packet.c | 20 ++++++++++---------- net/packet/diag.c | 2 +- net/packet/internal.h | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-)
net/packet/af_packet.c +10 -10
@@ -340,14 +340,14 @@ static void __register_prot_hook(struct sock *sk) {struct packet_sock *po =pkt_sk (sk); -if (!po->running) { +if (!packet_sock_flag (po,PACKET_SOCK_RUNNING )) {if (po->fanout)__fanout_link (sk, po);else dev_add_pack (&po->prot_hook);sock_hold (sk); - po->running =1 ; +packet_sock_flag_set (po,PACKET_SOCK_RUNNING ,1 ); } }
@@ -369,7 +369,7 @@ static void __unregister_prot_hook(struct sock *sk, bool sync)lockdep_assert_held_once (&po->bind_lock); - po->running =0 ; +packet_sock_flag_set (po,PACKET_SOCK_RUNNING ,0 );if (po->fanout)__fanout_unlink (sk, po);
@@ -389,7 +389,7 @@ static void unregister_prot_hook(struct sock *sk, bool sync) {struct packet_sock *po =pkt_sk (sk); -if (po->running) +if (packet_sock_flag (po,PACKET_SOCK_RUNNING ))__unregister_prot_hook (sk, sync); }
@@ -1834,7 +1834,7 @@ static int fanout_add(struct sock *sk, struct fanout_args *args) err = -EINVAL ;spin_lock (&po->bind_lock); -if (po->running && +if (packet_sock_flag (po,PACKET_SOCK_RUNNING ) && match->type == type && match->prot_hook.type == po->prot_hook.type && match->prot_hook.dev == po->prot_hook.dev) {
@@ -3277,7 +3277,7 @@ static int packet_do_bind(struct sock *sk, const char *name, int ifindex,if (need_rehook) {dev_hold (dev); -if (po->running) { +if (packet_sock_flag (po,PACKET_SOCK_RUNNING )) {rcu_read_unlock ();/* prevents packet_notifier() from calling * register_prot_hook()
@@ -3290,7 +3290,7 @@ static int packet_do_bind(struct sock *sk, const char *name, int ifindex, dev->ifindex); } -BUG_ON (po->running); +BUG_ON (packet_sock_flag (po,PACKET_SOCK_RUNNING ));WRITE_ONCE (po->num, proto); po->prot_hook.type = proto;
@@ -4230,7 +4230,7 @@ static int packet_notifier(struct notifier_block *this,case NETDEV_DOWN :if (dev->ifindex == po->ifindex) {spin_lock (&po->bind_lock); -if (po->running) { +if (packet_sock_flag (po,PACKET_SOCK_RUNNING )) {__unregister_prot_hook (sk, false); sk->sk_err =ENETDOWN ;if (!sock_flag (sk,SOCK_DEAD ))
@@ -4541,7 +4541,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,/* Detach socket from network */ spin_lock (&po->bind_lock); - was_running = po->running; + was_running =packet_sock_flag (po,PACKET_SOCK_RUNNING ); num = po->num;WRITE_ONCE (po->num,0 );if (was_running)
@@ -4752,7 +4752,7 @@ static int packet_seq_show(struct seq_file *seq, void *v) s->sk_type,ntohs (READ_ONCE (po->num)),READ_ONCE (po->ifindex), - po->running, +packet_sock_flag (po,PACKET_SOCK_RUNNING ),atomic_read (&s->sk_rmem_alloc),from_kuid_munged (seq_user_ns (seq),sock_i_uid (s)), sock_i_ino(s));
net/packet/diag.c +1 -1
@@ -21,7 +21,7 @@ static int pdiag_put_info(const struct packet_sock *po, struct sk_buff *nlskb) pinfo.pdi_tstamp = po->tp_tstamp; pinfo.pdi_flags =0 ; -if (po->running) +if (packet_sock_flag (po,PACKET_SOCK_RUNNING )) pinfo.pdi_flags |=PDI_RUNNING ;if (packet_sock_flag (po,PACKET_SOCK_AUXDATA )) pinfo.pdi_flags |=PDI_AUXDATA ;
net/packet/internal.h +1 -1
@@ -117,7 +117,6 @@ struct packet_sock {spinlock_t bind_lock;struct mutex pg_vec_lock;unsigned long flags; -unsigned int running;/* bind_lock must be held */ int pressure;int ifindex;/* bound device */ __be16 num;
@@ -146,6 +145,7 @@ enum packet_sock_flags {PACKET_SOCK_TX_HAS_OFF ,PACKET_SOCK_TP_LOSS ,PACKET_SOCK_HAS_VNET_HDR , + PACKET_SOCK_RUNNING, }; static inline void packet_sock_flag_set(struct packet_sock *po,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 69/522 net/packet: fix TOCTOU race on mmapd vnet_hdr in tpacket_snd()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bingquan Chen <[email protected]>
[ Upstream commit 2c054e17d9d41f1020376806c7f750834ced4dc5 ]
In tpacket_snd(), when PACKET_VNET_HDR is enabled, vnet_hdr points directly into the mmap'd TX ring buffer shared with userspace. The kernel validates the header via __packet_snd_vnet_parse() but then re-reads all fields later in virtio_net_hdr_to_skb(). A concurrent userspace thread can modify the vnet_hdr fields between validation and use, bypassing all safety checks.
The non-TPACKET path (packet_snd()) already correctly copies vnet_hdr to a stack-local variable. All other vnet_hdr consumers in the kernel (tun.c, tap.c, virtio_net.c) also use stack copies. The TPACKET TX path is the only caller of virtio_net_hdr_to_skb() that reads directly from user-controlled shared memory.
Fix this by copying vnet_hdr from the mmap'd ring buffer to a stack-local variable before validation and use, consistent with the approach used in packet_snd() and all other callers.
--- net/packet/af_packet.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-)
net/packet/af_packet.c +15 -10
@@ -2767,7 +2767,8 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) {struct sk_buff *skb =NULL ;struct net_device *dev; -struct virtio_net_hdr *vnet_hdr =NULL ; +struct virtio_net_hdr vnet_hdr; +bool has_vnet_hdr = false;struct sockcm_cookie sockc;__be16 proto;int err, reserve =0 ;
@@ -2868,16 +2869,20 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) hlen =LL_RESERVED_SPACE (dev); tlen = dev->needed_tailroom;if (packet_sock_flag (po,PACKET_SOCK_HAS_VNET_HDR )) { - vnet_hdr = data; - data +=sizeof (*vnet_hdr); - tp_len -=sizeof (*vnet_hdr); -if (tp_len <0 || -__packet_snd_vnet_parse (vnet_hdr, tp_len)) { + data +=sizeof (vnet_hdr); + tp_len -=sizeof (vnet_hdr); +if (tp_len <0 ) { + tp_len = -EINVAL ; + goto tpacket_error; + } +memcpy (&vnet_hdr, data -sizeof (vnet_hdr),sizeof (vnet_hdr)); +if (__packet_snd_vnet_parse (&vnet_hdr, tp_len)) { tp_len = -EINVAL ; goto tpacket_error; } copylen =__virtio16_to_cpu (vio_le (), - vnet_hdr->hdr_len); + vnet_hdr.hdr_len); + has_vnet_hdr = true; } copylen =max_t (int, copylen, dev->hard_header_len); skb = sock_alloc_send_skb(&po->sk,
@@ -2914,12 +2919,12 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) } } -if (packet_sock_flag (po,PACKET_SOCK_HAS_VNET_HDR )) { -if (virtio_net_hdr_to_skb (skb, vnet_hdr,vio_le ())) { +if (has_vnet_hdr) { +if (virtio_net_hdr_to_skb (skb, &vnet_hdr,vio_le ())) { tp_len = -EINVAL ; goto tpacket_error; } -virtio_net_hdr_set_proto (skb, vnet_hdr); +virtio_net_hdr_set_proto (skb, &vnet_hdr); } skb->destructor = tpacket_destruct_skb;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 70/522 drm/i915/psr: Add defininitions for INTEL_WA_REGISTER_CAPS DPCD register
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jouni Högander <[email protected]>
commit fbceb39b536e40c2f7cc47ab42037bb7c2b7ced9 upstream.
EDP specification says:
"If either VSC SDP is unable to be transmitted 100 ns before the SU region, the Source device may optionally transmit the VSC SDP during the prior video scan line’s HBlank period There is a Intel specific drm dp register currently containing bits related how TCON can support PSR2 with SDP on prior line."
Unfortunately many panels are having problems in implementing this. So there is a custom Intel specific DPCD register (INTEL_WA_REGISTER_CAPS) to figure out if this is properly implemented on a panel or if panel doesn't require that 100 ns delay before the SU region. Here are the definitions in this custom DPCD address:
0 = Panel doesn't support SDP on prior line
1 = Panel supports SDP on prior line
2 = Panel doesn't have 100ns requirement
3 = Reserved
Add definitions for this new register and it's values into new header intel_dpcd.h.
v2: add INTEL_DPCD_ prefix to definitions
Bspec: 74741
--- drivers/gpu/drm/i915/display/intel_dpcd.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 drivers/gpu/drm/i915/display/intel_dpcd.h
drivers/gpu/drm/i915/display/intel_dpcd.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2026 Intel Corporation +*/ + +#ifndef __INTEL_DPCD_H__ +#define __INTEL_DPCD_H__ + +#define INTEL_DPCD_INTEL_WA_REGISTER_CAPS 0x3f0 +# define INTEL_DPCD_INTEL_WA_REGISTER_CAPS_PSR2_EARLYSCANLINE_SDP_SUPPORT_MASK REG_GENMASK(1, 0) +# define INTEL_DPCD_INTEL_WA_REGISTER_CAPS_FALL_BACK_TO_PSR1 0 +# define INTEL_DPCD_INTEL_WA_REGISTER_CAPS_PSR2_WITH_EARLY_SCANLINE 1 +# define INTEL_DPCD_INTEL_WA_REGISTER_CAPS_PSR2_WITHOUT_EARLY_SCANLINE 2 + +#endif /* __INTEL_DPCD_H__ */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 71/522 drm/dp: Add eDP 1.5 bit definition
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suraj Kandpal <[email protected]>
commit 5dfc37a6b77bf6beedbd30d70184b54e1a08ccac upstream.
Add the eDP revision bit value for 1.5.
Spec: eDPv1.5 Table 16-5
--- include/drm/display/drm_dp.h | 1 + 1 file changed, 1 insertion(+)
include/drm/display/drm_dp.h +1 -0
@@ -955,6 +955,7 @@# define DP_EDP_14 0x03# define DP_EDP_14a 0x04/* eDP 1.4a */ # define DP_EDP_14b 0x05/* eDP 1.4b */ +# define DP_EDP_15 0x06/* eDP 1.5 */ #define DP_EDP_GENERAL_CAP_1 0x701# define DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP (1 << 0)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 72/522 drm/i915/psr: Read Intel DPCD workaround register
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jouni Högander <[email protected]>
commit f30bece421a4ae34359254e1dc2a187a42b6af9b upstream.
Read Intel DPCD workaround register and store it into intel_connector->dp.psr_caps. psr_caps was chosen as currently it contains only PSR workaround for PSR2 SDP on prior scanline implementation.
--- drivers/gpu/drm/i915/display/intel_display_types.h | 1 + drivers/gpu/drm/i915/display/intel_psr.c | 7 +++++++ 2 files changed, 8 insertions(+)
drivers/gpu/drm/i915/display/intel_display_types.h +1 -0
@@ -1637,6 +1637,7 @@ struct intel_dp {u8 lttpr_phy_caps[DP_MAX_LTTPR_COUNT ][DP_LTTPR_PHY_CAP_SIZE ];u8 fec_capable;u8 pcon_dsc_dpcd[DP_PCON_DSC_ENCODER_CAP_SIZE ]; +u8 intel_wa_dpcd;/* source rates */ int num_source_rates;const int *source_rates;
drivers/gpu/drm/i915/display/intel_psr.c +7 -0
@@ -31,6 +31,7 @@#include "intel_crtc.h" #include "intel_de.h" #include "intel_display_types.h" +#include "intel_dpcd.h" #include "intel_dp_aux.h" #include "intel_hdmi.h" #include "intel_psr.h"
@@ -388,6 +389,12 @@ void intel_psr_init_dpcd(struct intel_dp *intel_dp)intel_dp_get_su_granularity (intel_dp); } } + +if (intel_dp->psr.sink_psr2_support) +drm_dp_dpcd_read (&intel_dp->aux, +INTEL_DPCD_INTEL_WA_REGISTER_CAPS , + &intel_dp->intel_wa_dpcd, +sizeof (intel_dp->intel_wa_dpcd)); }static void intel_psr_enable_sink (struct intel_dp *intel_dp)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 63/522 selftests/bpf: Fix ARG_PTR_TO_LONG {half-,}uninitialized test
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit b8e188f023e07a733b47d5865311ade51878fe40 ]
The assumption of 'in privileged mode reads from uninitialized stack locations are permitted' is not quite correct since the verifier was probing for read access rather than write access. Both tests need to be annotated as __success for privileged and unprivileged.
[ Note: The format of logs completely changed since 6.1 so this change
had to be reapplied to the old test file. This commit needs to be backported because it fixes a test broken by commit 32556ce93bc4 ("bpf: Fix helper writes to read-only maps") from the same patchset. ]
--- tools/testing/selftests/bpf/verifier/int_ptr.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
tools/testing/selftests/bpf/verifier/int_ptr.c +1 -5
@@ -25,9 +25,8 @@BPF_MOV64_IMM (BPF_REG_0 ,1 ), BPF_EXIT_INSN(), }, - .result =REJECT , + .result =ACCEPT , .prog_type = BPF_PROG_TYPE_CGROUP_SYSCTL, - .errstr = "invalid indirect read from stack R4 off -16+0 size 8", }, { "ARG_PTR_TO_LONG half-uninitialized",
@@ -57,9 +56,6 @@BPF_MOV64_IMM (BPF_REG_0 ,0 ), BPF_EXIT_INSN(), }, - .result_unpriv =REJECT , - .errstr_unpriv = "invalid indirect read from stack R4 off -16+4 size 8", -/* in privileged mode reads from uninitialized stack locations are permitted */ .result = ACCEPT, }, {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 100/522 parport: Fix race between port and client registration
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
commit ef15ccbb3e8640a723c42ad90eaf81d66ae02017 upstream.
The parport subsystem registers port devices before they are fully initialised, resulting in a race condition where client drivers such as lp can attach to ports that are not completely initialised or even being torn down.
When the port and client drivers are built as modules and loaded around the same time during boot, this occasionally results in a crash. I was able to make this happen reliably in a VM with a PC-style parallel port by patching parport_pc to fail probing:
drivers/parport/parport_pc.c static struct parport *__parport_pc_probe_port(unsigned long int base, · line 2075
Quoted 11 lines
drivers/parport/parport_pc.c +1
-1@@ -2069,7 +2069,7 @@ static struct parport *__parport_pc_probe_port(unsigned long int base,if (!p) goto out3; - base_res =request_region (base,3 , p->name); + base_res =NULL ;if (!base_res) goto out4;
and then running:
while true; do
modprobe lp & modprobe parport_pc
wait
rmmod lp parport_pc
done
for a few seconds.
In the long term I think port registration should be changed to put the call to device_add() inside parport_announce_port(), but since the latter currently cannot fail this will require changing all port drivers.
For now, add a flag to indicate whether a port has been "announced" and only try to attach client drivers to ports when the flag is set.
--- drivers/parport/share.c | 11 +++++++++-- include/linux/parport.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-)
drivers/parport/share.c +9 -2
@@ -223,10 +223,14 @@ static void get_lowlevel_driver(void)static int port_check (struct device *dev,void *dev_drv) {struct parport_driver *drv = dev_drv; +struct parport *port;/* only send ports, do not send other devices connected to bus */ -if (is_parport (dev)) - drv->match_port (to_parport_dev (dev)); +if (is_parport (dev)) { + port =to_parport_dev (dev); +if (test_bit (PARPORT_ANNOUNCED , &port->devflags)) + drv->match_port (port); + }return 0 ; }
@@ -553,6 +557,7 @@ void parport_announce_port(struct parporif (slave)attach_driver_chain (slave); } +set_bit (PARPORT_ANNOUNCED , &port->devflags);mutex_unlock (®istration_lock); }EXPORT_SYMBOL (parport_announce_port);
@@ -582,6 +587,8 @@ void parport_remove_port(struct parportmutex_lock (®istration_lock); +clear_bit (PARPORT_ANNOUNCED , &port->devflags); +/* Spread the word. */ detach_driver_chain (port);
include/linux/parport.h +1 -0
@@ -245,6 +245,7 @@ struct parport {unsigned long devflags;#define PARPORT_DEVPROC_REGISTERED 0 +#define PARPORT_ANNOUNCED 1struct pardevice *proc_device;/* Currently register proc device */ struct list_head full_list;
Greg Kroah-Hartman
maintainerPATCH 109/522 iio: ssp_sensors: cancel delayed work_refresh on remove
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sanjay Chitroda <[email protected]>
commit eedf7602fbd929e97e0c480da501dc7a34beb2a8 upstream.
The work_refresh may still be pending or running when the device is removed, cancel the delayed work_refresh in remove path.
--- drivers/iio/common/ssp_sensors/ssp_dev.c | 1 + 1 file changed, 1 insertion(+)
drivers/iio/common/ssp_sensors/ssp_dev.c +1 -0
@@ -590,6 +590,7 @@ static void ssp_remove(struct spi_devicessp_clean_pending_list (data);free_irq (data->spi->irq, data); +cancel_delayed_work_sync (&data->work_refresh);del_timer_sync (&data->wdt_timer);cancel_work_sync (&data->work_wdt);
Greg Kroah-Hartman
maintainerPATCH 110/522 iio: temperature: tsys01: fix broken PROM checksum validation
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Salah Triki <[email protected]>
commit 4701e471c16866e7aa8f5e6a3a6b0d31e097e2c9 upstream.
The current implementation of tsys01_crc_valid() incorrectly sums the first word (n_prom[0]) repeatedly instead of iterating over the 8 words retrieved from the PROM. This leads to a checksum mismatch and probe failure on hardware.
According to the TSYS01 datasheet, the PROM consists of 8 words. A valid check must iterate through all 8 words to verify the integrity of the calibration data. The current driver only checks the first word 8 times.
Note: This fix was identified during a code audit and is based on datasheet specifications. It has not been tested on real hardware.
--- drivers/iio/temperature/tsys01.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/temperature/tsys01.c +1 -1
@@ -119,7 +119,7 @@ static bool tsys01_crc_valid(u16 *n_promu8 sum =0 ;for (cnt =0 ; cnt <TSYS01_PROM_WORDS_NB ; cnt++) - sum += ((n_prom[0 ] >>8 ) + (n_prom[0 ] &0xFF )); + sum += ((n_prom[cnt] >>8 ) + (n_prom[cnt] &0xFF ));return (sum ==0 ); }
Greg Kroah-Hartman
maintainerPATCH 111/522 iio: magnetometer: st_magn: fix default DRDY pin selection for LIS2MDL
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Advait Dhamorikar <[email protected]>
commit 49f79cd28f1e3333cbe0d616ce59ead0b24bf34e upstream.
The device tree binding for st,lis2mdl does not support st,drdy-int-pin property. However, when no platform data is provided and the property is absent, the driver falls back to default_magn_pdata which hardcodes drdy_int_pin = 2. This causes st_sensors_set_drdy_int_pin to fail with -EINVAL because the LIS2MDL sensor settings have no INT2 DRDY mask defined.
Fix this by checking the sensor's INT2 DRDY mask availability at probe time and selecting the appropriate default pin. Sensors that do not support INT2 DRDY will default to INT1, while all others retain the existing default of INT2.
--- drivers/iio/magnetometer/st_magn_core.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/iio/magnetometer/st_magn_core.c +11 -2
@@ -504,6 +504,11 @@ static const struct st_sensors_platform_ .drdy_int_pin = 2, }; +/* LIS2MDL only supports DRDY on INT1 */ +static const struct st_sensors_platform_data alt_magn_pdata = { + .drdy_int_pin =1 , +}; +static int st_magn_read_raw (struct iio_dev *indio_dev,struct iio_chan_spec const *ch,int *val,int *val2,long mask)
@@ -626,8 +631,12 @@ int st_magn_common_probe(struct iio_dev mdata->current_fullscale = &mdata->sensor_settings->fs.fs_avl[0 ]; mdata->odr = mdata->sensor_settings->odr.odr_avl[0 ].hz; -if (!pdata) - pdata = (struct st_sensors_platform_data *)&default_magn_pdata; +if (!pdata) { +if (mdata->sensor_settings->drdy_irq.int2.mask) + pdata = (struct st_sensors_platform_data *)&default_magn_pdata; +else + pdata = (struct st_sensors_platform_data *)&alt_magn_pdata; + } err =st_sensors_init_sensor (indio_dev, pdata);if (err <0 )
Greg Kroah-Hartman
maintainerPATCH 112/522 iio: light: cm3323: fix reg_conf not being initialized correctly
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aldo Conte <[email protected]>
commit 1f4f0bcc5255dec5c4c3a1551bf49d8c33b69b20 upstream.
The code stores the return value of i2c_smbus_write_word_data() in data->reg_conf; however, this value represents the result of the write operation and not the value actually written to the configuration register. This meant that the contents of data->reg_conf did not truly reflect the contents
of the hardware register.
Instead, save the value of the register before the write and use this value in the I2C write.
The bug was found by code inspection: i2c_smbus_write_word_data() returns 0 on success, not the value written to the register.
Tested using i2c-stub on a Raspberry Pi 3B running a custom 6.19.10 kernel. Before loading the driver, the configuration register 0x00 CM3323_CMD_CONF was populated with 0x0030 usingi2cset -y 11 0x10 0x00 0x0030 w, encoding an integration time of 320ms in bits[6:4].
Due to incorrect initialization of data->reg_conf in cm3323_init(), the print of integration_time returns 0.040000 instead of the expected 0.320000. This happens because the read of the integration_time depends on cm3323_get_it_bits() that is based on the value of data->reg_conf, which is erroneously set to 0.
With this fix applied, data->reg_conf correctly saves 0x0030 after init and the successive integration_time reports 0.320000 as expected.
--- drivers/iio/light/cm3323.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/light/cm3323.c +2 -3
@@ -89,15 +89,14 @@ static int cm3323_init(struct iio_dev *i/* enable sensor and set auto force mode */ ret &= ~(CM3323_CONF_SD_BIT |CM3323_CONF_AF_BIT ); + data->reg_conf = ret; - ret =i2c_smbus_write_word_data (data->client,CM3323_CMD_CONF , ret); + ret =i2c_smbus_write_word_data (data->client,CM3323_CMD_CONF , data->reg_conf);if (ret <0 ) {dev_err (&data->client->dev,"Error writing reg_conf\n" );return ret; } - data->reg_conf = ret; -return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 113/522 iio: buffer: hw-consumer: fix use-after-free in error path
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Gu <[email protected]>
commit 6f5ed4f2c7c83f33344e0ba179f72a12e5dad4a4 upstream.
In the err_put_buffers cleanup path of iio_hw_consumer_alloc(), the code was using list_for_each_entry() to iterate through buffers while calling iio_buffer_put() which can free the current buffer if refcount drops to 0. The list_for_each_entry() loop macro then evaluates buf->head.next to continue iteration, accessing the freed buffer.
Fix this by using list_for_each_entry_safe().
--- drivers/iio/buffer/industrialio-hw-consumer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/buffer/industrialio-hw-consumer.c +2 -2
@@ -82,7 +82,7 @@ static struct hw_consumer_buffer *iio_hw*/ struct iio_hw_consumer *iio_hw_consumer_alloc (struct device *dev) { -struct hw_consumer_buffer *buf; +struct hw_consumer_buffer *buf, *tmp;struct iio_hw_consumer *hwc;struct iio_channel *chan;int ret;
@@ -113,7 +113,7 @@ struct iio_hw_consumer *iio_hw_consumer_return hwc; err_put_buffers: -list_for_each_entry (buf, &hwc->buffers, head) +list_for_each_entry_safe (buf, tmp, &hwc->buffers, head)iio_buffer_put (&buf->buffer);iio_channel_release_all (hwc->channels); err_free_hwc:
Greg Kroah-Hartman
maintainerPATCH 114/522 USB: serial: omninet: fix memory corruption with small endpoint
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 60df93d30f9bdd27db17c4d80ed80ef718d7226b upstream.
Make sure that the bulk-out buffers are at least as large as the hardcoded transfer size to avoid user-controlled slab corruption should a malicious device report a smaller endpoint max packet size than expected.
--- drivers/usb/serial/omninet.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/usb/serial/omninet.c +5 -4
@@ -30,6 +30,10 @@/* This one seems to be a re-branded ZyXEL device */ #define BT_IGNITIONPRO_ID 0x2000 +#define OMNINET_HEADERLEN 4 +#define OMNINET_BULKOUTSIZE 64 +#define OMNINET_PAYLOADSIZE (OMNINET_BULKOUTSIZE - OMNINET_HEADERLEN) +/* function prototypes */ static void omninet_process_read_urb (struct urb *urb); static int omninet_prepare_write_buffer(struct usb_serial_port *port,
@@ -55,6 +59,7 @@ static struct usb_serial_driver zyxel_om .description = "ZyXEL - omni.net usb", .id_table = id_table, .num_bulk_out = 2, + .bulk_out_size = OMNINET_BULKOUTSIZE, .calc_num_ports = omninet_calc_num_ports, .port_probe = omninet_port_probe, .port_remove = omninet_port_remove,
@@ -131,10 +136,6 @@ static void omninet_port_remove(struct ukfree (od); } -#define OMNINET_HEADERLEN 4 -#define OMNINET_BULKOUTSIZE 64 -#define OMNINET_PAYLOADSIZE (OMNINET_BULKOUTSIZE - OMNINET_HEADERLEN) -static void omninet_process_read_urb (struct urb *urb) {struct usb_serial_port *port = urb->context;
Greg Kroah-Hartman
maintainerPATCH 115/522 usb: cdns3: gadget: fix request skipping after clearing halt
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yongchao Wu <[email protected]>
commit c8778ff817a7047d6848fefba99dcb27b1bf01fe upstream.
According to the cdns3 datasheet, the EPRST (Endpoint Reset) command causes the DMA engine to reposition its internal pointer to the next Transfer Descriptor (TD) if it was already processing one.
This issue is consistently observed during the ADB identification process on macOS hosts, where the host issues a Clear_Halt. Although commit 4bf2dd65135a ("usb: cdns3: gadget: toggle cycle bit before reset endpoint") attempted to avoid DMA advance by toggling the cycle bit, trace logs show that on certain hosts like macOS, the DMA pointer (EP_TRADDR) still shifts after EPRST:
cdns3_ctrl_req: Clear Endpoint Feature(Halt ep1out)
cdns3_doorbell_epx: ep1out, ep_trbaddr f9c04030 <-- Should be f9c04000
cdns3_gadget_giveback: ep1out: req: ... length: 16384/16384
As shown above, the DMA pointer jumped to the next TD, causing the controller to skip the initial TRBs of the request. This leads to data misalignment and ADB protocol hangs on macOS.
Fix this by manually restoring the EP_TRADDR register to the starting physical address of the current request after the EPRST operation is complete.
--- drivers/usb/cdns3/cdns3-gadget.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/usb/cdns3/cdns3-gadget.c +11 -1
@@ -2812,9 +2812,19 @@ int __cdns3_gadget_ep_clear_halt(struct priv_ep->flags &= ~(EP_STALLED |EP_STALL_PENDING );if (request) { -if (trb) +if (trb) { *trb = trb_tmp; +/* +* Per datasheet, EPRST causes DMA to reposition to the next TD. +* Manually reset EP_TRADDR to the current TRB to prevent +* the hardware from skipping the interrupted request. +*/ +writel (EP_TRADDR_TRADDR (priv_ep->trb_pool_dma + + priv_req->start_trb *TRB_SIZE ), + &priv_dev->regs->ep_traddr); + } +cdns3_rearm_transfer (priv_ep,1 ); }
Greg Kroah-Hartman
maintainerPATCH 116/522 usb: cdns3: plat: fix unbalanced pm_runtime_forbid() call permanently leaks the runtime PM usage counter across bind/unbind cycles
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Chen <[email protected]>
commit ae6f3b82324e4f39ad8443c9020787e6fc889637 upstream.
Call pm_runtime_allow(dev) conditionally at cdns3_plat_remove.
--- drivers/usb/cdns3/cdns3-plat.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/cdns3/cdns3-plat.c +3 -0
@@ -181,6 +181,9 @@ static int cdns3_plat_remove(struct platstruct device *dev = cdns->dev;pm_runtime_get_sync (dev); +if (!(cdns->pdata && (cdns->pdata->quirks &CDNS3_DEFAULT_PM_RUNTIME_ALLOW ))) +pm_runtime_allow (dev); +pm_runtime_disable (dev);pm_runtime_put_noidle (dev);cdns_remove (cdns);
Greg Kroah-Hartman
maintainerPATCH 117/522 usb: dwc2: Fix use after free in debug code
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 9ea06a3fbf9f16e0d98c52cb3b99642be15ec281 upstream.
We're not allowed to dereference "urb" after calling usb_hcd_giveback_urb() so save the urb->status ahead of time.
--- drivers/usb/dwc2/hcd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/dwc2/hcd.c +3 -1
@@ -4804,6 +4804,7 @@ static int _dwc2_hcd_urb_dequeue(structstruct dwc2_hsotg *hsotg =dwc2_hcd_to_hsotg (hcd);int rc;unsigned long flags; +int urb_status;dev_dbg (hsotg->dev,"DWC OTG HCD URB Dequeue\n" );dwc2_dump_urb_info (hcd, urb,"urb_dequeue" );
@@ -4828,11 +4829,12 @@ static int _dwc2_hcd_urb_dequeue(struct/* Higher layer software sets URB status */ spin_unlock (&hsotg->lock); + urb_status = urb->status;usb_hcd_giveback_urb (hcd, urb, status);spin_lock (&hsotg->lock);dev_dbg (hsotg->dev,"Called usb_hcd_giveback_urb()\n" ); -dev_dbg (hsotg->dev," urb->status = %d\n" , urb->status); +dev_dbg (hsotg->dev," urb->status = %d\n" , urb_status); out:spin_unlock_irqrestore (&hsotg->lock, flags);
Greg Kroah-Hartman
maintainerPATCH 118/522 Input: elan_i2c - validate firmware size before use
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <[email protected]>
commit 76b0d0baa9ae9c60e726bbe1b6ff0bec2c993634 upstream.
Ensure that the firmware file is large enough to contain the expected number of pages and the signature (which resides at the end of the firmware blob) before accessing them to prevent potential out-of-bounds reads.
--- drivers/input/mouse/elan_i2c_core.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/input/mouse/elan_i2c_core.c +5 -0
@@ -646,6 +646,11 @@ static ssize_t elan_sysfs_update_fw(strureturn error; } +if (fw->size < data->fw_signature_address +sizeof (signature)) { +dev_err (dev,"firmware file too small\n" ); +return -EBADF ; + } +/* Firmware file must match signature data */ fw_signature = &fw->data[data->fw_signature_address];if (memcmp (fw_signature, signature,sizeof (signature)) !=0 ) {
Greg Kroah-Hartman
maintainerPATCH 101/522 USB: cdc-acm: Fix bit overlap and move quirk definitions to header
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Guan <[email protected]>
commit 5eb070769ea5e18405535609d1d3f6886f3755bd upstream.
The VENDOR_CLASS_DATA_IFACE and ALWAYS_POLL_CTRL quirk flags added in commit f58752ebcb35 ("USB: cdc-acm: Add quirks for Yoga Book 9 14IAH10 INGENIC touchscreen") were placed inside the acm_ctrl_msg() function rather than in the header with the other quirk flags. Then, their values (BIT(9) and BIT(10)) collided with NO_UNION_12 which is already BIT(9).
Move the definitions to drivers/usb/class/cdc-acm.h where they belong and shift them to BIT(10) and BIT(11) to avoid the overlap.
--- drivers/usb/class/cdc-acm.c | 2 -- drivers/usb/class/cdc-acm.h | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/class/cdc-acm.c +0 -2
@@ -113,8 +113,6 @@ static int acm_ctrl_msg(struct acm *acm,int retval; retval =usb_autopm_get_interface (acm->control); -#define VENDOR_CLASS_DATA_IFACE BIT(9)/* data interface uses vendor-specific class */ -#define ALWAYS_POLL_CTRL BIT(10)/* keep ctrl URB active even without an open TTY */ if (retval)return retval;
drivers/usb/class/cdc-acm.h +2 -0
@@ -115,3 +115,5 @@ struct acm {#define DISABLE_ECHO BIT(7)#define MISSING_CAP_BRK BIT(8)#define NO_UNION_12 BIT(9) +#define VENDOR_CLASS_DATA_IFACE BIT(10)/* data interface uses vendor-specific class */ +#define ALWAYS_POLL_CTRL BIT(11)/* keep ctrl URB active even without an open TTY */
Greg Kroah-Hartman
maintainerPATCH 119/522 bpf: sockmap: fix tail fragment offset in bpf_msg_push_data
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuqi Xu <[email protected]>
commit f72eed9b84fb771019a955908132410a9ba9ea3f upstream.
When bpf_msg_push_data() inserts data in the middle of a scatterlist entry, it splits the original entry into a left fragment and a right fragment.
The right fragment offset is page-local, but the code advances it with start, which is the message-global insertion point. For inserts into a non-first SG entry, this over-advances the offset and leaves the split layout inconsistent.
Advance the right fragment offset by the fragment-local delta, start - offset, which matches the length removed from the front of the original entry.
--- net/core/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/filter.c +1 -1
@@ -2841,7 +2841,7 @@ BPF_CALL_4(bpf_msg_push_data, struct sk_ psge->length = start - offset; rsge.length -= psge->length; - rsge.offset += start; + rsge.offset += start - offset;sk_msg_iter_var_next (i);sg_unmark_end (psge);
Greg Kroah-Hartman
maintainerPATCH 120/522 macsec: fix replay protection at XPN lower-PN wrap
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junrui Luo <[email protected]>
commit e68842b3356471ba56c882209f324613dac47f64 upstream.
In macsec_post_decrypt(), when pn is U32_MAX, pn + 1 overflows u32 to 0 and the first branch never fires. If next_pn_halves.lower is also in the upper half, pn_same_half(pn, lower) is true and the XPN else-if does not fire either, leaving next_pn_halves unchanged. An attacker that captures the legitimate frame carrying pn == 0xFFFFFFFF on an XPN association can then replay it indefinitely, since lowest_pn never rises above the captured pn and macsec_decrypt() reconstructs the same IV.
Extend the XPN else-if to also fire when pn + 1 wraps to 0, so receipt of pn == U32_MAX advances next_pn_halves to (upper + 1, 0).
--- drivers/net/macsec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/macsec.c +2 -1
@@ -806,7 +806,8 @@ static bool macsec_post_decrypt(struct sif (pn +1 > rx_sa->next_pn_halves.lower) { rx_sa->next_pn_halves.lower = pn +1 ; }else if (secy->xpn && - !pn_same_half (pn, rx_sa->next_pn_halves.lower)) { + (pn +1 ==0 || + !pn_same_half (pn, rx_sa->next_pn_halves.lower))) { rx_sa->next_pn_halves.upper++; rx_sa->next_pn_halves.lower = pn +1 ; }
Greg Kroah-Hartman
maintainerPATCH 121/522 ipv6: exthdrs: refresh nh pointer after ipv6_hop_jumbo()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Justin Iurman <[email protected]>
commit d47548a36639095939f4747d4c43f2271366f565 upstream.
ipv6_hop_jumbo() calls pskb_trim_rcsum(), which can change skb pointers. Let's recompute nh pointer to make sure any change won't mess things up.
--- net/ipv6/exthdrs.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv6/exthdrs.c +2 -0
@@ -186,6 +186,8 @@ static bool ip6_parse_tlv(bool hopbyhop,case IPV6_TLV_JUMBO :if (!ipv6_hop_jumbo (skb, off))return false; + + nh =skb_network_header (skb);break ;case IPV6_TLV_CALIPSO :if (!ipv6_hop_calipso (skb, off))
Greg Kroah-Hartman
maintainerPATCH 122/522 ASoC: qcom: q6asm-dai: fix error handling in prepare and set_params
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Kandagatla <[email protected]>
commit 4b4db09f283df65d780bc7cee66cb4a7e9bf4770 upstream.
Fix error handling in q6asm_dai_compr_set_params() and q6asm_dai_prepare() for both CMD_CLOSE and q6asm_unmap_memory_regions().
In both the functions, we are doing q6asm_audio_client_free in failure cases, which means if prepare or set_params fail, we can never recover. Now open and close are done in respective dai_open/close functions.
--- sound/soc/qcom/qdsp6/q6asm-dai.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
sound/soc/qcom/qdsp6/q6asm-dai.c +16 -8
@@ -239,9 +239,19 @@ static int q6asm_dai_prepare(struct snd_/* rate and channels are sent to audio driver */ if (prtd->state ==Q6ASM_STREAM_RUNNING ) {/* clear the previous setup if any */ -q6asm_cmd (prtd->audio_client, prtd->stream_id,CMD_CLOSE ); -q6asm_unmap_memory_regions (substream->stream, - prtd->audio_client); + ret =q6asm_cmd (prtd->audio_client, prtd->stream_id,CMD_CLOSE ); +if (ret <0 ) { +dev_err (dev,"Failed to close q6asm stream %d\n" , prtd->stream_id); +return ret; + } + + ret =q6asm_unmap_memory_regions (substream->stream, prtd->audio_client); +if (ret <0 ) { +dev_err (dev,"Failed to unmap memory regions for q6asm stream %d\n" , + prtd->stream_id); +return ret; + } +q6routing_stream_close (soc_prtd->dai_link->id, substream->stream); prtd->state =Q6ASM_STREAM_STOPPED ;
@@ -309,8 +319,6 @@ routing_err:q6asm_cmd (prtd->audio_client, prtd->stream_id,CMD_CLOSE ); open_err:q6asm_unmap_memory_regions (substream->stream, prtd->audio_client); -q6asm_audio_client_free (prtd->audio_client); - prtd->audio_client =NULL ;return ret; }
@@ -912,7 +920,7 @@ static int q6asm_dai_compr_set_params(st prtd->session_id, dir);if (ret) {dev_err (dev,"Stream reg failed ret:%d\n" , ret); - goto q6_err; + goto routing_err; } ret = __q6asm_dai_compr_set_codec_params(component, stream,
@@ -938,11 +946,11 @@ static int q6asm_dai_compr_set_params(streturn 0 ; q6_err: +q6routing_stream_close (rtd->dai_link->id, dir); +routing_err:q6asm_cmd (prtd->audio_client, prtd->stream_id,CMD_CLOSE ); open_err: -q6asm_audio_client_free (prtd->audio_client); - prtd->audio_client =NULL ;return ret; }
Greg Kroah-Hartman
maintainerPATCH 123/522 ipv6: exthdrs: refresh nh after handling HAO option
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhengchuan Liang <[email protected]>
commit f7b52afe3592eae66e160586b45a3f2242972c63 upstream.
ip6_parse_tlv() caches skb_network_header(skb) in nh while walking IPv6 TLVs.
ipv6_dest_hao() may call pskb_expand_head() for a cloned skb, which can move the skb head and invalidate the cached network header pointer. Refresh nh after ipv6_dest_hao() returns so any trailing padding or TLVs are parsed from the current skb head.
This matches the existing pattern used in ip6_parse_tlv() after helpers that can modify skb header storage.
--- net/ipv6/exthdrs.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv6/exthdrs.c +2 -0
@@ -205,6 +205,8 @@ static bool ip6_parse_tlv(bool hopbyhop,case IPV6_TLV_HAO :if (!ipv6_dest_hao (skb, off))return false; + + nh =skb_network_header (skb);break ;#endif default :
Greg Kroah-Hartman
maintainerPATCH 124/522 ip6: vti: Use ip6_tnl.net in vti6_siocdevprivate().
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maoyi Xie <[email protected]>
commit 8b484efd5cb4eeef9021a661e198edc5349dacf6 upstream.
After patch 1/2 in this series, vti6_update() unlinks and relinks the tunnel through t->net. vti6_siocdevprivate() still uses dev_net(dev) for the collision lookup. For a tunnel moved through IFLA_NET_NS_FD, dev_net(dev) is the new netns, not t->net.
SIOCCHGTUNNEL on a migrated tunnel then runs:
net = dev_net(dev) /* migrated netns */
t = vti6_locate(net, &p1, false) /* misses target in t->net */
...
t = netdev_priv(dev)
vti6_update(t, &p1, false) /* mutates t->net's hash */
A caller in the migrated netns picks params that match a tunnel in the creation netns. The lookup in dev_net(dev) finds nothing. vti6_update() prepends the migrated tunnel at the head of the creation netns hash bucket for those params. Later lookups in the creation netns resolve to the migrated device. xfrm receive delivers the matched packets through a device the caller controls.
Reachable from an unprivileged user namespace (unshare --user --map-root-user --net). Cross tenant scope on container hosts.
Switch the SIOCCHGTUNNEL path on a non fallback device to use t->net for the lookup. The lookup now matches the netns vti6_update() operates on.
Also add ns_capable(self->net->user_ns, CAP_NET_ADMIN) before the lookup. The check at the top of the case is against dev_net(dev)->user_ns, which after migration is the attacker's netns. A caller there can pick params absent from self->net, the lookup returns NULL, t becomes self, and vti6_update() inserts the device into the creation netns hash. The new check requires CAP_NET_ADMIN in the creation netns user_ns too.
SIOCADDTUNNEL and SIOCCHGTUNNEL on the fallback device keep dev_net(dev), which equals init_net there.
--- net/ipv6/ip6_vti.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
net/ipv6/ip6_vti.c +9 -2
@@ -840,17 +840,24 @@ vti6_siocdevprivate(struct net_device *dif (p.proto !=IPPROTO_IPV6 && p.proto !=0 )break ;vti6_parm_from_user (&p1, &p); - t =vti6_locate (net, &p1, cmd ==SIOCADDTUNNEL );if (dev != ip6n->fb_tnl_dev && cmd ==SIOCCHGTUNNEL ) { +struct ip6_tnl *self =netdev_priv (dev); + + err = -EPERM ; +if (!ns_capable (self->net->user_ns,CAP_NET_ADMIN )) +break ; + t =vti6_locate (self->net, &p1, false);if (t) {if (t->dev != dev) { err = -EEXIST ;break ; } }else - t =netdev_priv (dev); + t = self; err =vti6_update (t, &p1, false); + }else { + t =vti6_locate (net, &p1, cmd ==SIOCADDTUNNEL ); }if (t) { err =0 ;
Greg Kroah-Hartman
maintainerPATCH 125/522 ipv6: validate extension header length before copying to cmsg
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qi Tang <[email protected]>
commit dd433671fef381fdaf7b530c631e6b782d66e224 upstream.
ip6_datagram_recv_specific_ctl() builds IPV6_{HOPOPTS,DSTOPTS,RTHDR} cmsgs (and their IPV6_2292* legacy counterparts) by trusting the on-wire hdrlen byte (ptr[1]) when computing the put_cmsg() length. The length was validated only at parse time (ipv6_parse_hopopts(), etc.). An nftables payload-write expression can rewrite hdrlen after parsing and before the skb reaches recvmsg; the write itself is in-bounds but put_cmsg() then reads up to ((hdrlen+1) << 3) = 2040 bytes from an 8-byte header. nftables is reachable from an unprivileged user namespace, so this is an unprivileged slab-out-of-bounds read:
BUG: KASAN: slab-out-of-bounds in put_cmsg+0x3ac/0x540 put_cmsg+0x3ac/0x540 udpv6_recvmsg+0xca0/0x1250 sock_recvmsg+0xdf/0x190 ____sys_recvmsg+0x1b1/0x620
Add ipv6_get_exthdr_len() which validates that at least two bytes are accessible before reading the hdrlen field, then checks the computed length against skb_tail_pointer(skb), returning 0 on failure. Extension headers are kept in the linear skb area by pskb_may_pull() during input, so skb_tail_pointer() is the correct bound.
Use ipv6_get_exthdr_len() at all non-AH call sites: the five standalone cmsg blocks (HbH, 2292HbH, 2292DSTOPTS x2, 2292RTHDR) and the three standard cases in the extension-header walk loop (DSTOPTS, ROUTING, default). AH retains an inline bounds check because its length formula differs ((ptr[1]+2)<<2).
The walk loop also gets a pre-read bounds check at the top to validate ptr before any case accesses ptr[0] or ptr[1].
When the walk loop detects a corrupted header, return from the function instead of continuing to process later socket options.
--- net/ipv6/datagram.c | 54 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 8 deletions(-)
net/ipv6/datagram.c +46 -8
@@ -616,6 +616,18 @@ void ip6_datagram_recv_common_ctl(struct } } +static u16 ipv6_get_exthdr_len (const struct sk_buff *skb,const u8 *ptr) +{ +u16 len; + +if (ptr +2 >skb_tail_pointer (skb)) +return 0 ; + + len = (ptr[1 ] +1 ) <<3 ; + +return (len <=skb_tail_pointer (skb) - ptr) ? len :0 ; +} +void ip6_datagram_recv_specific_ctl (struct sock *sk,struct msghdr *msg,struct sk_buff *skb) {
@@ -642,7 +654,10 @@ void ip6_datagram_recv_specific_ctl(stru/* HbH is allowed only once */ if (np->rxopt.bits.hopopts && (opt->flags &IP6SKB_HOPBYHOP )) {u8 *ptr = nh +sizeof (struct ipv6hdr ); -put_cmsg (msg,SOL_IPV6 ,IPV6_HOPOPTS , (ptr[1 ]+1 )<<3 , ptr); +u16 len =ipv6_get_exthdr_len (skb, ptr); + +if (len) +put_cmsg (msg,SOL_IPV6 ,IPV6_HOPOPTS , len, ptr); } if (opt->lastopt &&
@@ -663,26 +678,37 @@ void ip6_datagram_recv_specific_ctl(struunsigned int len;u8 *ptr = nh + off; +if (ptr +2 >skb_tail_pointer (skb)) +return ; +switch (nexthdr) {case IPPROTO_DSTOPTS : nexthdr = ptr[0 ]; - len = (ptr[1 ] +1 ) <<3 ; + len =ipv6_get_exthdr_len (skb, ptr); +if (!len) +return ;if (np->rxopt.bits.dstopts)put_cmsg (msg,SOL_IPV6 ,IPV6_DSTOPTS , len, ptr);break ;case IPPROTO_ROUTING : nexthdr = ptr[0 ]; - len = (ptr[1 ] +1 ) <<3 ; + len =ipv6_get_exthdr_len (skb, ptr); +if (!len) +return ;if (np->rxopt.bits.srcrt)put_cmsg (msg,SOL_IPV6 ,IPV6_RTHDR , len, ptr);break ;case IPPROTO_AH : nexthdr = ptr[0 ]; len = (ptr[1 ] +2 ) <<2 ; +if (ptr + len >skb_tail_pointer (skb)) +return ;break ;default : nexthdr = ptr[0 ]; - len = (ptr[1 ] +1 ) <<3 ; + len =ipv6_get_exthdr_len (skb, ptr); +if (!len) +return ;break ; }
@@ -704,19 +730,31 @@ void ip6_datagram_recv_specific_ctl(stru }if (np->rxopt.bits.ohopopts && (opt->flags &IP6SKB_HOPBYHOP )) {u8 *ptr = nh +sizeof (struct ipv6hdr ); -put_cmsg (msg,SOL_IPV6 ,IPV6_2292HOPOPTS , (ptr[1 ]+1 )<<3 , ptr); +u16 len =ipv6_get_exthdr_len (skb, ptr); + +if (len) +put_cmsg (msg,SOL_IPV6 ,IPV6_2292HOPOPTS , len, ptr); }if (np->rxopt.bits.odstopts && opt->dst0) {u8 *ptr = nh + opt->dst0; -put_cmsg (msg,SOL_IPV6 ,IPV6_2292DSTOPTS , (ptr[1 ]+1 )<<3 , ptr); +u16 len =ipv6_get_exthdr_len (skb, ptr); + +if (len) +put_cmsg (msg,SOL_IPV6 ,IPV6_2292DSTOPTS , len, ptr); }if (np->rxopt.bits.osrcrt && opt->srcrt) {struct ipv6_rt_hdr *rthdr = (struct ipv6_rt_hdr *)(nh + opt->srcrt); -put_cmsg (msg,SOL_IPV6 ,IPV6_2292RTHDR , (rthdr->hdrlen+1 ) <<3 , rthdr); +u16 len =ipv6_get_exthdr_len (skb, (u8 *)rthdr); + +if (len) +put_cmsg (msg,SOL_IPV6 ,IPV6_2292RTHDR , len, rthdr); }if (np->rxopt.bits.odstopts && opt->dst1) {u8 *ptr = nh + opt->dst1; -put_cmsg (msg,SOL_IPV6 ,IPV6_2292DSTOPTS , (ptr[1 ]+1 )<<3 , ptr); +u16 len =ipv6_get_exthdr_len (skb, ptr); + +if (len) +put_cmsg (msg,SOL_IPV6 ,IPV6_2292DSTOPTS , len, ptr); }if (np->rxopt.bits.rxorigdstaddr) {struct sockaddr_in6 sin6;
Greg Kroah-Hartman
maintainerPATCH 126/522 xfrm: input: hold netns during deferred transport reinjection
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhengchuan Liang <[email protected]>
commit c16f74dc1d75d0e2e7670076d5375deda110ebeb upstream.
Transport-mode reinjection stores a struct net pointer in skb->cb and uses it later from xfrm_trans_reinject(). That pointer must stay valid until the deferred callback runs.
Take a netns reference when queueing deferred reinjection work and drop it after the callback completes. Use maybe_get_net() so the queueing path does not revive a namespace that is already being torn down.
This keeps the existing workqueue design and fixes the netns lifetime handling in one place for all users of xfrm_trans_queue_net().
--- net/xfrm/xfrm_input.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
net/xfrm/xfrm_input.c +12 -4
@@ -759,9 +759,12 @@ static void xfrm_trans_reinject(struct wspin_unlock_bh (&trans->queue_lock);local_bh_disable (); -while ((skb =__skb_dequeue (&queue))) -XFRM_TRANS_SKB_CB (skb)->finish (XFRM_TRANS_SKB_CB (skb)->net, -NULL , skb); +while ((skb =__skb_dequeue (&queue))) { +struct net *net =XFRM_TRANS_SKB_CB (skb)->net; + +XFRM_TRANS_SKB_CB (skb)->finish (net,NULL , skb); +put_net (net); + }local_bh_enable (); }
@@ -770,6 +773,7 @@ int xfrm_trans_queue_net(struct net *net struct sk_buff *)) {struct xfrm_trans_tasklet *trans; +struct net *hold_net; trans =this_cpu_ptr (&xfrm_trans_tasklet);
@@ -778,8 +782,12 @@ int xfrm_trans_queue_net(struct net *netBUILD_BUG_ON (sizeof (struct xfrm_trans_cb ) >sizeof (skb->cb)); + hold_net =maybe_get_net (net); +if (!hold_net) +return -ENODEV ; +XFRM_TRANS_SKB_CB (skb)->finish = finish; -XFRM_TRANS_SKB_CB (skb)->net = net; +XFRM_TRANS_SKB_CB (skb)->net = hold_net;spin_lock_bh (&trans->queue_lock);__skb_queue_tail (&trans->queue, skb);spin_unlock_bh (&trans->queue_lock);
Greg Kroah-Hartman
maintainerPATCH 127/522 ip6: vti: Use ip6_tnl.net in vti6_changelink().
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
commit 11b326fb0a374f4654f9be22d0f0f7abd9f7d3fe upstream.
ip netns add ns1
ip netns add ns2
ip -n ns1 link add vti6_test type vti6 remote ::1 local ::2 key 7 ip -n ns1 link set vti6_test netns ns2
ip -n ns2 link set vti6_test type vti6 remote ::3 local ::4 key 9 ip netns del ns2
ip netns del ns1
[ 132.495484] ------------[ cut here ]------------ [ 132.497609] kernel BUG at net/core/dev.c:12376!
Commit 61220ab34948 ("vti6: Enable namespace changing") dropped NETIF_F_NETNS_LOCAL from vti6 devices. A vti6 tunnel can then move through IFLA_NET_NS_FD. After the move dev_net(dev) points at the new netns while t->net stays at the creation netns.
vti6_changelink() and vti6_update() still use dev_net(dev) and dev_net(t->dev). They unlink from one per netns hash and relink into another. The creation netns is left with a stale entry. cleanup_net() of that netns later walks freed memory.
Reachable from an unprivileged user namespace (unshare --user --map-root-user --net). Cross tenant scope on container hosts.
--- net/ipv6/ip6_vti.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
net/ipv6/ip6_vti.c +7 -5
@@ -728,10 +728,11 @@ vti6_tnl_change(struct ip6_tnl *t, conststatic int vti6_update (struct ip6_tnl *t,struct __ip6_tnl_parm *p,bool keep_mtu) { -struct net *net =dev_net (t->dev); -struct vti6_net *ip6n =net_generic (net, vti6_net_id); +struct net *net = t->net; +struct vti6_net *ip6n;int err; + ip6n =net_generic (net, vti6_net_id);vti6_tnl_unlink (ip6n, t);synchronize_net (); err =vti6_tnl_change (t, p, keep_mtu);
@@ -1045,11 +1046,12 @@ static int vti6_changelink(struct net_destruct nlattr *data[], struct netlink_ext_ack *extack) { - struct ip6_tnl *t; + struct ip6_tnl *t = netdev_priv(dev); +struct net *net = t->net;struct __ip6_tnl_parm p; -struct net *net =dev_net (dev); -struct vti6_net *ip6n =net_generic (net, vti6_net_id); +struct vti6_net *ip6n; + ip6n =net_generic (net, vti6_net_id);if (dev == ip6n->fb_tnl_dev)return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 128/522 HID: wacom: Fix OOB write in wacom_hid_set_device_mode()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lee Jones <[email protected]>
commit c0a8899e02ddebd51e2589835182c239c2e224ae upstream.
wacom_hid_set_device_mode() currently assumes that the HID_DG_INPUTMODE usage is always located in the first field (field[0]) of the feature report. However, a device can specify HID_DG_INPUTMODE in a different field.
If HID_DG_INPUTMODE is in a field other than the first one and the first field has a report_count smaller than the usage_index of HID_DG_INPUTMODE, this leads to an out-of-bounds write to r->field[0]->value.
Fix this by storing the field index of HID_DG_INPUTMODE in 'struct hid_data' during feature mapping. In wacom_hid_set_device_mode(), use this stored field index to access the correct field and add bounds checks to ensure both the field index and the value index are within valid ranges before writing.
--- drivers/hid/wacom_sys.c | 13 ++++++++++--- drivers/hid/wacom_wac.h | 1 + 2 files changed, 11 insertions(+), 3 deletions(-)
drivers/hid/wacom_sys.c +10 -3
@@ -341,6 +341,7 @@ static void wacom_feature_mapping(struct hid_data->inputmode = field->report->id; hid_data->inputmode_index = usage->usage_index; + hid_data->inputmode_field_index = field->index;break ;case HID_UP_DIGITIZER :
@@ -556,9 +557,14 @@ static int wacom_hid_set_device_mode(str re = &(hdev->report_enum[HID_FEATURE_REPORT ]); r = re->report_id_hash[hid_data->inputmode]; -if (r) { - r->field[0 ]->value[hid_data->inputmode_index] =2 ; -hid_hw_request (hdev, r,HID_REQ_SET_REPORT ); +if (r && hid_data->inputmode_field_index >=0 && + hid_data->inputmode_field_index < r->maxfield) { +struct hid_field *field = r->field[hid_data->inputmode_field_index]; + +if (field && hid_data->inputmode_index < field->report_count) { + field->value[hid_data->inputmode_index] =2 ; +hid_hw_request (hdev, r,HID_REQ_SET_REPORT ); + } }return 0 ; }
@@ -2813,6 +2819,7 @@ static int wacom_probe(struct hid_devicereturn error; wacom_wac->hid_data.inputmode =-1 ; + wacom_wac->hid_data.inputmode_field_index =-1 ; wacom_wac->mode_report =-1 ;if (hid_is_usb (hdev)) {
drivers/hid/wacom_wac.h +1 -0
@@ -297,6 +297,7 @@ struct wacom_shared {struct hid_data {__s16 inputmode;/* InputMode HID feature, -1 if non-existent */ __s16 inputmode_index;/* InputMode HID feature index in the report */ +__s16 inputmode_field_index;/* InputMode HID feature field index in the report */ bool sense_state;bool inrange_state;bool invert_state;
Greg Kroah-Hartman
maintainerPATCH 102/522 wireguard: send: append trailer after expanding head
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason A. Donenfeld <[email protected]>
commit f75e3eb08fe31d30a9af6ed80cdd22e6772837e2 upstream.
With how this is currently written, we add the trailer, zero it out, and then add the header space on. If that header space requires a reallocation + copy, the zeros in the trailer aren't copied, because the skb len hasn't actually been yet expanded to cover that. Instead add the padding at the end of the process rather than at the beginning.
--- drivers/net/wireguard/send.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/net/wireguard/send.c +10 -10
@@ -177,16 +177,6 @@ static bool encrypt_packet(struct sk_buf trailer_len = padding_len +noise_encrypted_len (0 ); plaintext_len = skb->len + padding_len; -/* Expand data section to have room for padding and auth tag. */ - num_frags =skb_cow_data (skb, trailer_len, &trailer); -if (unlikely (num_frags <0 || num_frags >ARRAY_SIZE (sg))) -return false; - -/* Set the padding to zeros, and make sure it and the auth tag are part -* of the skb. -*/ -memset (skb_tail_pointer (trailer),0 , padding_len); -/* Expand head section to have room for our header and the network * stack's headers. */
@@ -198,6 +188,16 @@ static bool encrypt_packet(struct sk_buf skb_checksum_help(skb)))return false; +/* Expand data section to have room for padding and auth tag. */ + num_frags =skb_cow_data (skb, trailer_len, &trailer); +if (unlikely (num_frags <0 || num_frags >ARRAY_SIZE (sg))) +return false; + +/* Set the padding to zeros, and make sure it and the auth tag are part +* of the skb. +*/ +memset (skb_tail_pointer (trailer),0 , padding_len); +/* Only after checksumming can we safely add on the padding at the end * and the header. */
Greg Kroah-Hartman
maintainerPATCH 129/522 iommu, debugobjects: avoid gcc-16.1 section mismatch warnings
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 4c9ad387aa2d6785299722e54224d34764edaeb3 upstream.
gcc-16 has gained some more advanced inter-procedual optimization techniques that enable it to inline the dummy_tlb_add_page() and dummy_tlb_flush() function pointers into a specialized version of __arm_v7s_unmap:
WARNING: modpost: vmlinux: section mismatch in reference: __arm_v7s_unmap+0x2cc (section: .text) -> dummy_tlb_add_page (section: .init.text)
ERROR: modpost: Section mismatches detected.
Quoted 1 line
From what I can tell, the transformation is correct, as this is only
called when __arm_v7s_unmap() is called from arm_v7s_do_selftests(), which is also __init. Since __arm_v7s_unmap() however is not __init, gcc cannot inline the inner function calls directly.
In debug_objects_selftest(), the same thing happens. Both the caller and the leaf function are __init, but the IPA pulls it into a non-init one:
WARNING: modpost: vmlinux: section mismatch in reference: lookup_object_or_alloc+0x7c (section: .text.lookup_object_or_alloc) -> is_static_object (section: .init.text)
Marking the affected functions as not "__init" would reliably avoid this issue but is not a good solution because it removes an otherwise correct annotation. I tried marking the functions as 'noinline', but that ended up not covering all the affected configurations.
With some more experimenting, I found that marking these functions as __attribute__((noipa)) is both logical and reliable.
In order to keep the syntax readable, add a custom macro for this in include/linux/compiler_attributes.h next to other related macros and use it to annotate both files.
--- drivers/iommu/io-pgtable-arm-v7s.c | 18 ++++++++++++------ include/linux/compiler_attributes.h | 11 +++++++++++ lib/debugobjects.c | 2 +- 3 files changed, 24 insertions(+), 7 deletions(-)
drivers/iommu/io-pgtable-arm-v7s.c +12 -6
@@ -909,21 +909,27 @@ struct io_pgtable_init_fns io_pgtable_arstatic struct io_pgtable_cfg *cfg_cookie__initdata ; -static void __init dummy_tlb_flush_all (void *cookie) +/* +* __noipa prevents gcc from turning indirect iommu_flush_ops calls +* into direct calls from a specialized __arm_v7s_unmap() that triggers +* a build time section mismatch assertion. +*/ +static __noipa void __init dummy_tlb_flush_all(void *cookie) {WARN_ON (cookie != cfg_cookie); } -static void __init dummy_tlb_flush (unsigned long iova,size_t size, -size_t granule,void *cookie) +static __noipa void __init dummy_tlb_flush(unsigned long iova, size_t size, +size_t granule,void *cookie) {WARN_ON (cookie != cfg_cookie);WARN_ON (!(size & cfg_cookie->pgsize_bitmap)); } -static void __init dummy_tlb_add_page (struct iommu_iotlb_gather *gather, -unsigned long iova,size_t granule, -void *cookie) +static __noipa void __init dummy_tlb_add_page(struct iommu_iotlb_gather *gather, +unsigned long iova, +size_t granule, +void *cookie) {dummy_tlb_flush (iova, granule, granule, cookie); }
include/linux/compiler_attributes.h +11 -0
@@ -385,6 +385,17 @@#endif /* +* Optional: not supported by clang +* +* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Attributes.html#index-noipa +*/ +#if __has_attribute (noipa) +# define __noipa __attribute__((noipa)) +#else +# define __noipa +#endif + +/* * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-weak-function-attribute * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-weak-variable-attribute */
lib/debugobjects.c +1 -1
@@ -1065,7 +1065,7 @@ struct self_test {static __initconst const struct debug_obj_descr descr_type_test; -static bool __init is_static_object (void *addr) +static __noipa bool __init is_static_object(void *addr) {struct self_test *obj = addr;
Greg Kroah-Hartman
maintainerPATCH 130/522 nfc: hci: fix out-of-bounds read in HCP header parsing
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ashutosh Desai <[email protected]>
commit f040e590c035bfd9553fe79ee9585caf1b14d67b upstream.
Both nfc_hci_recv_from_llc() and nci_hci_data_received_cb() read packet->header from skb->data at function entry without first checking that the buffer holds at least one byte. A malicious NFC peer can send a 0-byte HCP frame that passes through the SHDLC layer and reaches these functions, causing an out-of-bounds heap read of packet->header. The same 0-byte frame, if queued as a non-final fragment, also causes the reassembly loop to underflow msg_len to UINT_MAX, triggering skb_over_panic() when the reassembled skb is written.
Fix this by adding a pskb_may_pull() check at the entry of each function before packet->header is first accessed. The existing pskb_may_pull() checks before the reassembled hcp_skb is cast to struct hcp_packet remain in place to guard the 2-byte HCP message header.
--- net/nfc/hci/core.c | 10 ++++++++++ net/nfc/nci/hci.c | 10 ++++++++++ 2 files changed, 20 insertions(+)
net/nfc/hci/core.c +10 -0
@@ -861,6 +861,11 @@ static void nfc_hci_recv_from_llc(structstruct sk_buff *frag_skb;int msg_len; +if (!pskb_may_pull (skb,NFC_HCI_HCP_PACKET_HEADER_LEN )) { +kfree_skb (skb); +return ; + } + packet = (struct hcp_packet *)skb->data;if ((packet->header & ~NFC_HCI_FRAGMENT ) ==0 ) {skb_queue_tail (&hdev->rx_hcp_frags, skb);
@@ -904,6 +909,11 @@ static void nfc_hci_recv_from_llc(struct* unblock waiting cmd context. Otherwise, enqueue to dispatch * in separate context where handler can also execute command. */ +if (!pskb_may_pull (hcp_skb,NFC_HCI_HCP_HEADER_LEN )) { +kfree_skb (hcp_skb); +return ; + } + packet = (struct hcp_packet *)hcp_skb->data; type =HCP_MSG_GET_TYPE (packet->message.header);if (type ==NFC_HCI_HCP_RESPONSE ) {
net/nfc/nci/hci.c +10 -0
@@ -437,6 +437,11 @@ void nci_hci_data_received_cb(void *contreturn ; } +if (!pskb_may_pull (skb,NCI_HCI_HCP_PACKET_HEADER_LEN )) { +kfree_skb (skb); +return ; + } + packet = (struct nci_hcp_packet *)skb->data;if ((packet->header & ~NCI_HCI_FRAGMENT ) ==0 ) {skb_queue_tail (&ndev->hci_dev->rx_hcp_frags, skb);
@@ -480,6 +485,11 @@ void nci_hci_data_received_cb(void *cont* unblock waiting cmd context. Otherwise, enqueue to dispatch * in separate context where handler can also execute command. */ +if (!pskb_may_pull (hcp_skb,NCI_HCI_HCP_HEADER_LEN )) { +kfree_skb (hcp_skb); +return ; + } + packet = (struct nci_hcp_packet *)hcp_skb->data; type =NCI_HCP_MSG_GET_TYPE (packet->message.header);if (type ==NCI_HCI_HCP_RESPONSE ) {