5.10.258-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainercover 5.10.258-rc1 review
This is the start of the stable review cycle for the 5.10.258 release. There are 589 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 Mon, 01 Jun 2026 16:01:34 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.258-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.10.258-rc1
Oleksij Rempel <[email protected]>
net: usb: lan78xx: Fix double free issue with interrupt buffer allocation
Bartosz Golaszewski <[email protected]>
gpio: cdev: check if uAPI v2 config attributes are correctly zeroed
Andy Shevchenko <[email protected]>
gpiolib: cdev: use !mem_is_zero() instead of memchr_inv(s, 0, n)
Jani Nikula <[email protected]>
string: add mem_is_zero() helper to check if memory area is all zeros
Rosen Penev <[email protected]>
net: ag71xx: check error for platform_get_irq
David Carlier <[email protected]>
tracing: Avoid NULL return from hist_field_name() on truncation
Rafael J. Wysocki <[email protected]>
platform/x86: intel-hid: Check ACPI_HANDLE() against NULL
Jakub Kicinski <[email protected]>
net: tls: prevent chain-after-chain in plain text SG
Jakub Kicinski <[email protected]>
net: tls: fix off-by-one in sg_chain entry count for wrapped sk_msg ring
Chenguang Zhao <[email protected]>
ethtool: fix ethnl_bitmap32_not_zero() bit interval semantics
Lukas Bulwahn <[email protected]>
HID: quirks: really enable the intended work around for appledisplay
Ethan Nelson-Moore <[email protected]>
net: ethernet: cs89x0: remove stale CONFIG_MACH_MX31ADS reference
Linus Walleij <[email protected]>
net: ethernet: cortina: Carry over frag counter
Andreas Haarmann-Thiemann <[email protected]>
net: ethernet: cortina: Drop half-assembled SKB
Linus Walleij <[email protected]>
net: ethernet: cortina: Make RX SKB per-port
Rosen Penev <[email protected]>
irqchip/ath79-cpu: Remove unused function
Gabor Juhos <[email protected]>
phy: marvell: mvebu-a3700-utmi: fix incorrect USB2_PHY_CTRL register access
Bart Van Assche <[email protected]>
ice: fix locking in ice_dcb_rebuild()
Guenter Roeck <[email protected]>
ARM: integrator: Fix early initialization
David Gow <[email protected]>
kunit: config: KUNIT_DEBUGFS should depend on DEBUG_FS
David Gow <[email protected]>
kunit: config: Enable KUNIT_DEBUGFS by default
Abdurrahman Hussain <[email protected]>
hwmon: (pmbus/adm1266) reject short block-read responses in the GPIO accessors
Abdurrahman Hussain <[email protected]>
hwmon: (pmbus/adm1266) register the nvmem device after pmbus_do_probe()
Abdurrahman Hussain <[email protected]>
hwmon: (pmbus/adm1266) register the gpio_chip after pmbus_do_probe()
Abdurrahman Hussain <[email protected]>
hwmon: (pmbus/adm1266) don't clobber GPIO bits before PDIO read in get_multiple
Abdurrahman Hussain <[email protected]>
hwmon: (pmbus/adm1266) cap PDIO scan in get_multiple at ADM1266_PDIO_NR
Abdurrahman Hussain <[email protected]>
hwmon: (pmbus/adm1266) bounce blackbox records through a protocol-sized buffer
Abdurrahman Hussain <[email protected]>
hwmon: (pmbus/adm1266) include PEC byte in pmbus_block_xfer read buffer
Abdurrahman Hussain <[email protected]>
hwmon: (pmbus/adm1266) reject implausible blackbox record_count
Abdurrahman Hussain <[email protected]>
hwmon: (pmbus/adm1266) seed timestamp from the real-time clock
Sven Eckelmann <[email protected]>
batman-adv: tt: fix negative tt_buff_len
Sven Eckelmann <[email protected]>
batman-adv: tt: fix negative last_changeset_len
Sven Eckelmann <[email protected]>
batman-adv: tp_meter: avoid use of uninit sender vars
Sven Eckelmann <[email protected]>
batman-adv: bla: fix report_work leak on backbone_gw purge
Sven Eckelmann <[email protected]>
batman-adv: frag: disallow unicast fragment in fragment
Luxiao Xu <[email protected]>
batman-adv: fix tp_meter counter underflow during shutdown
Ruide Cao <[email protected]>
batman-adv: fix fragment reassembly length accounting
Sven Eckelmann <[email protected]>
batman-adv: dat: handle forward allocation error
Ruijie Li <[email protected]>
batman-adv: clear current gateway during teardown
Sven Eckelmann <[email protected]>
batman-adv: mcast: fix use-after-free in orig_node RCU release
Harry Wentland <[email protected]>
drm/amd/display: Fix integer overflow in bios_get_image()
Osama Abdelkader <[email protected]>
drm/bridge: megachips: remove bridge when irq request fails
Michael Bommarito <[email protected]>
RDMA/siw: Reject MPA FPDU length underflow before signed receive math
Johan Hovold <[email protected]>
spi: ti-qspi: fix use-after-free after DMA setup failure
Johan Hovold <[email protected]>
spi: sprd: fix error pointer deref after DMA setup failure
Michael Bommarito <[email protected]>
scsi: isci: Fix use-after-free in device removal path
Masami Hiramatsu (Google) <[email protected]>
tracing: Do not call map->ops->elt_free() if elt_alloc() fails
John Walker <[email protected]>
wifi: cfg80211: advance loop vars in cfg80211_merge_profile()
Michael Bommarito <[email protected]>
ixgbevf: fix use-after-free in VEPA multicast source pruning
Michael Bommarito <[email protected]>
ipv4: raw: reject IP_HDRINCL packets with ihl < 5
Kyle Farnung <[email protected]>
wifi: ath11k: clear shared SRNG pointer state on restart
Minh Nguyen <[email protected]>
vsock/vmci: fix UAF when peer resets connection during handshake
Steven Rostedt <[email protected]>
ring-buffer: Fix reporting of missed events in iterator
Nan Li <[email protected]>
netfilter: ipset: stop hash:* range iteration at end
Zhengchuan Liang <[email protected]>
netfilter: ip6t_hbh: reject oversized option lists
Nicolai Buchwitz <[email protected]>
net: bcmgenet: keep RBUF EEE/PM disabled
Zijing Yin <[email protected]>
phonet/pep: disable BH around forwarded sk_receive_skb()
Mingyu Wang <[email protected]>
Bluetooth: hci_uart: fix UAFs and race conditions in close and init paths
Jann Horn <[email protected]>
Bluetooth: bnep: Fix UAF read of dev->name
Takashi Iwai <[email protected]>
ALSA: asihpi: Fix potential OOB array access at reading cache
Cássio Gabriel <[email protected]>
ALSA: ua101: Reject too-short USB descriptors
Abdurrahman Hussain <[email protected]>
hwmon: (pmbus/adm1266) widen blackbox-info buffer to I2C_SMBUS_BLOCK_MAX
Greg Kroah-Hartman <[email protected]>
sysfs: don't remove existing directory on update failure
Asim Viladi Oglu Manizada <[email protected]>
smb: client: reject userspace cifs.spnego descriptions
Ben Hutchings <[email protected]>
Revert "s390/cio: Fix device lifecycle handling in css_alloc_subchannel()"
Vladimir Oltean <[email protected]>
net: dsa: sja1105: fix kasan out-of-bounds warning in sja1105_table_delete_entry()
Sasha Levin <[email protected]>
Revert "x86/vdso: Fix output operand size of RDPID"
Kees Cook <[email protected]>
selftests: lib.mk: Also install "config" and "settings"
Pengpeng Hou <[email protected]>
s390/debug: Reject zero-length input before trimming a newline
Allison Henderson <[email protected]>
net/rds: reset op_nents when zerocopy page pin fails
Nicholas Carlini <[email protected]>
io-wq: check that the predecessor is hashed in io_wq_remove_pending()
Johan Hovold <[email protected]>
drm/gma500/oaktrail_hdmi: fix i2c adapter leak on setup
Gyeyoung Baek <[email protected]>
drm/panfrost: Fix wait_bo ioctl leaking positive return from dma_resv_wait_timeout()
Naval Alcalá <[email protected]>
iommu/vt-d: Disable DMAR for Intel Q35 IGFX
Raphael Zimmer <[email protected]>
libceph: handle rbtree insertion error in decode_choose_args()
Raphael Zimmer <[email protected]>
libceph: Fix potential out-of-bounds access in crush_decode()
Raphael Zimmer <[email protected]>
libceph: Fix potential null-ptr-deref in decode_choose_args()
Raphael Zimmer <[email protected]>
libceph: Fix potential out-of-bounds access in osdmap_decode()
Ma Ke <[email protected]>
powerpc/warp: Fix error handling in pika_dtm_thread
Viacheslav Dubeyko <[email protected]>
ceph: fix a buffer leak in __ceph_setxattr()
Cássio Gabriel <[email protected]>
ALSA: usb-audio: Bound MIDI endpoint descriptor scans
Chaitanya Kumar Borah <[email protected]>
drm/i915/dp: Fix VSC dynamic range signaling for RGB formats
Sergio Correia <[email protected]>
audit: enforce AUDIT_LOCKED for AUDIT_TRIM and AUDIT_MAKE_EQUIV
Zoran Ilievski <[email protected]>
net: atlantic: preserve PCI wake-from-D3 on shutdown when WOL enabled
Li Xiasong <[email protected]>
netfilter: nft_ct: fix missing expect put in obj eval
Sergio Correia <[email protected]>
audit: fix incorrect inheritable capability in CAPSET records
Herbert Xu <[email protected]>
crypto: af_alg - Cap AEAD AD length to 0x80000000
Alexandre Belloni <[email protected]>
alarmtimer: Check RTC features instead of ops
Alexandre Belloni <[email protected]>
rtc: allow rtc_read_alarm without read_alarm callback
Eric Dumazet <[email protected]>
net/sched: sch_pie: annotate more data-races in pie_dump_stats()
Qingqing Yang <[email protected]>
flow_dissector: Do not count vlan tags inside tunnel payload
Qingfang Deng <[email protected]>
flow_dissector: do not dissect PPPoE PFC frames
Yannick Vignon <[email protected]>
net/sched: taprio: Fix init procedure
Filipe Manana <[email protected]>
btrfs: tracepoints: fix sleep while in atomic context in btrfs_sync_file()
Timur Kristóf <[email protected]>
drm/amd/display: Read EDID from VBIOS embedded panel info
Timur Kristóf <[email protected]>
drm/amd/display: Allow DCE link encoder without AUX registers
Eric Dumazet <[email protected]>
net/sched: sch_cake: annotate data-races in cake_dump_stats() (V)
Weiming Shi <[email protected]>
bareudp: fix NULL pointer dereference in bareudp_fill_metadata_dst()
Beniamino Galvani <[email protected]>
ipv6: rename and move ip6_dst_lookup_tunnel()
Beniamino Galvani <[email protected]>
ipv4: add new arguments to udp_tunnel_dst_lookup()
Beniamino Galvani <[email protected]>
ipv4: remove "proto" argument from udp_tunnel_dst_lookup()
Beniamino Galvani <[email protected]>
ipv4: rename and move ip_route_output_tunnel()
Xin Long <[email protected]>
sctp: discard stale INIT after handshake completion
Xin Long <[email protected]>
netfilter: skip recording stale or retransmitted INIT
Christian A. Ehrhardt <[email protected]>
ASoC: codecs: ab8500: Fix casting of private data
Heiko Schocher <[email protected]>
net: phy: dp83869: fix setting CLK_O_SEL field.
Paul Geurts <[email protected]>
NFC: trf7970a: Ignore antenna noise when checking for RF field
Morduan Zang <[email protected]>
net: usb: rtl8150: free skb on usb_submit_urb() failure in xmit
Zhan Jun <[email protected]>
net: usb: rtl8150: fix use-after-free in rtl8150_start_xmit()
Ido Schimmel <[email protected]>
vrf: Fix a potential NPD when removing a port from a VRF
Eric Dumazet <[email protected]>
net/sched: sch_fq_pie: annotate data-races in fq_pie_dump_stats()
Eric Dumazet <[email protected]>
net/sched: sch_choke: annotate data-races in choke_dump_stats()
Zhengchao Shao <[email protected]>
net: sched: choke: remove unused variables in struct choke_sched_data
Stephen Hemminger <[email protected]>
net/sched: netem: validate slot configuration
Stephen Hemminger <[email protected]>
net/sched: netem: fix queue limit check to include reordered packets
Stephen Hemminger <[email protected]>
net/sched: netem: fix probability gaps in 4-state loss model
Harshit Mogalapalli <[email protected]>
net: sched: sch_netem: Refactor code in 4-state loss generator
Nikola Z. Ivanov <[email protected]>
netdevsim: zero initialize struct iphdr in dummy sk_buff
Daan De Meyer <[email protected]>
cdrom, scsi: sr: propagate read-only status to block layer via set_disk_ro()
Enze Li <[email protected]>
scsi: sr: Add memory allocation failure handling for get_capabilities()
Florian Westphal <[email protected]>
netfilter: nf_conntrack_sip: don't use simple_strtoul
Jiexun Wang <[email protected]>
netfilter: xt_policy: fix strict mode inbound policy matching
Timur Kristóf <[email protected]>
drm/amdgpu/gfx6: Support harvested SI chips with disabled TCCs (v2)
Pablo Neira Ayuso <[email protected]>
netfilter: arp_tables: fix IEEE1394 ARP payload parsing
Breno Leitao <[email protected]>
tracing: branch: Fix inverted check on stat tracer registration
Mark Harmstone <[email protected]>
btrfs: fix double-decrement of bytes_may_use in submit_one_async_extent()
Qu Wenruo <[email protected]>
btrfs: merge PAGE_CLEAR_DIRTY and PAGE_SET_WRITEBACK to PAGE_START_WRITEBACK
Wolfram Sang <[email protected]>
mailbox: mailbox-test: make data_ready a per-instance variable
Wolfram Sang <[email protected]>
mailbox: mailbox-test: initialize struct earlier
Wolfram Sang <[email protected]>
mailbox: mailbox-test: don't free the reused channel
Wolfram Sang <[email protected]>
mailbox: add sanity check for channel array
cuitao <[email protected]>
cgroup/rdma: fix integer overflow in rdmacg_try_charge()
Wolfram Sang <[email protected]>
mailbox: mailbox-test: free channels on probe error
Yuho Choi <[email protected]>
fbdev: offb: fix PCI device reference leak on probe failure
Anthony Pighin (Nokia) <[email protected]>
rtc: abx80x: Disable alarm feature if no interrupt attached
Alexandre Belloni <[email protected]>
rtc: introduce features bitfield
Bae Yeonju <[email protected]>
fs/adfs: validate nzones in adfs_validate_bblk()
Kohei Enju <[email protected]>
vhost_net: fix sleeping with preempt-disabled in vhost_net_busy_poll()
Lee Jones <[email protected]>
tipc: fix double-free in tipc_buf_append()
Alexey Kodanev <[email protected]>
nfp: fix swapped arguments in nfp_encode_basic_qdr() calls
Eric Dumazet <[email protected]>
net/sched: sch_sfb: annotate data-races in sfb_dump_stats()
Eric Dumazet <[email protected]>
net/sched: sch_red: annotate data-races in red_dump_stats()
Zhengchao Shao <[email protected]>
net: sched: gred/red: remove unused variables in struct red_stats
Eric Dumazet <[email protected]>
net/sched: sch_fq_codel: remove data-races from fq_codel_dump_stats()
Eric Dumazet <[email protected]>
net/sched: sch_pie: annotate data-races in pie_dump_stats()
Eric Dumazet <[email protected]>
net_sched: sch_hhf: annotate data-races in hhf_dump_stats()
Michael Bommarito <[email protected]>
net/rds: zero per-item info buffer before handing it to visitors
Jun Yan <[email protected]>
arm64: dts: meson-gxl-p230: fix ethernet PHY interrupt number
Weiming Shi <[email protected]>
slip: bound decode() reads against the compressed packet length
Weiming Shi <[email protected]>
slip: reject VJ receive packets on instances with no rstate array
Fernando Fernandez Mancera <[email protected]>
netfilter: nfnetlink_osf: fix potential NULL dereference in ttl check
Fernando Fernandez Mancera <[email protected]>
netfilter: nfnetlink_osf: fix out-of-bounds read on option matching
Yingnan Zhang <[email protected]>
ipvs: fix MTU check for GSO packets in tunnel mode
Pablo Neira Ayuso <[email protected]>
netfilter: xtables: restrict several matches to inet family
Florian Westphal <[email protected]>
netfilter: conntrack: remove sprintf usage
Xiang Mei <[email protected]>
netfilter: nfnetlink_osf: fix divide-by-zero in OSF_WSS_MODULO
Pablo Neira Ayuso <[email protected]>
netfilter: nft_osf: restrict it to ipv4
Weiming Shi <[email protected]>
openvswitch: cap upcall PID array size and pre-size vport replies
Qingfang Deng <[email protected]>
pppoe: drop PFC frames
Wojciech Drewek <[email protected]>
flow_dissector: Add PPPoE dissectors
Boris Sukholitko <[email protected]>
flow_dissector: Add number of vlan tags dissector
Boris Sukholitko <[email protected]>
dissector: do not set invalid PPP protocol
Michael Bommarito <[email protected]>
sctp: fix OOB write to userspace in sctp_getsockopt_peer_auth_chunks
Eric Dumazet <[email protected]>
ipv6: fix possible UAF in icmpv6_rcv()
Matt Vollrath <[email protected]>
e1000e: Unroll PTP in probe error handling
Kohei Enju <[email protected]>
i40e: don't advertise IFF_SUPP_NOFCS
Eric Dumazet <[email protected]>
tcp: annotate data-races around (tp->write_seq - tp->snd_nxt)
Vinicius Costa Gomes <[email protected]>
net/sched: taprio: fix use-after-free in advance_sched() on schedule switch
Vladimir Oltean <[email protected]>
net/sched: taprio: rename close_time to end_time
Vladimir Oltean <[email protected]>
net/sched: taprio: refactor one skb dequeue from TXQ to separate function
Vladimir Oltean <[email protected]>
net/sched: taprio: continue with other TXQs if one dequeue() failed
Vladimir Oltean <[email protected]>
net/sched: taprio: replace safety precautions with comments
Vladimir Oltean <[email protected]>
net/sched: taprio: stop going through private ops for dequeue and peek
Yannick Vignon <[email protected]>
net: taprio offload: enforce qdisc to netdev queue mapping
Kurt Kanzenbach <[email protected]>
taprio: Handle short intervals and large packets
Jiayuan Chen <[email protected]>
nexthop: fix IPv6 route referencing IPv4 nexthop
Ido Schimmel <[email protected]>
nexthop: Emit a notification when a nexthop group is modified
Dudu Lu <[email protected]>
net/sched: sch_cake: fix NAT destination port not being updated in cake_update_flowkeys
René Rebe <[email protected]>
PCMCIA: Fix garbled log messages for KERN_CONT
Paul Moses <[email protected]>
crypto: ccp - copy IV using skcipher ivsize
T Pratham <[email protected]>
crypto: sa2ul - Fix AEAD fallback algorithm names
Geert Uytterhoeven <[email protected]>
lib/hexdump: print_hex_dump_bytes() calls print_hex_dump_debug()
Konrad Dybcio <[email protected]>
clk: qcom: dispcc-sc7180: Add missing MDSS resets
Konrad Dybcio <[email protected]>
dt-bindings: clock: qcom,dispcc-sc7180: Define MDSS resets
Geert Uytterhoeven <[email protected]>
clk: xgene: Fix mapping leak in xgene_pllclk_init()
Arnd Bergmann <[email protected]>
clk: qoriq: avoid format string warning
Sebastian Krzyszkowiak <[email protected]>
clk: imx8mq: Correct the CSI PHY sels
Felix Gu <[email protected]>
clk: imx: imx6q: Fix device node reference leak in of_assigned_ldb_sels()
Felix Gu <[email protected]>
clk: imx: imx6q: Fix device node reference leak in pll6_bypassed()
Val Packett <[email protected]>
clk: qcom: dispcc-sm8250: Enable parents for pixel clocks
Val Packett <[email protected]>
clk: qcom: dispcc-sm8250: Use shared ops on the mdss vsync clk
Junrui Luo <[email protected]>
scsi: target: core: Fix integer overflow in UNMAP bounds check
Yang Erkun <[email protected]>
scsi: sg: Resolve soft lockup issue when opening /dev/sgX
Florian Westphal <[email protected]>
RDMA/core: Prefer NLA_NUL_STRING
Fedor Pchelkin <[email protected]>
platform/x86: dell_rbu: avoid uninit value usage in packet_size_write()
Andy Shevchenko <[email protected]>
nfs/blocklayout: Fix compilation error (make W=1) in bl_write_pagelist()
Abdun Nihaal <[email protected]>
mfd: mc13xxx-core: Fix memory leak in mc13xxx_add_subdevice_pdata()
Randy Dunlap <[email protected]>
tty: hvc_iucv: fix off-by-one in number of supported devices
наб <[email protected]>
tty: hvc: remove HVC_IUCV_MAGIC
Rafael J. Wysocki <[email protected]>
platform/surface: surfacepro3_button: Drop wakeup source on remove
Chen Ni <[email protected]>
backlight: sky81452-backlight: Check return value of devm_gpiod_get_optional() in sky81452_bl_parse_dt()
Nuno Sa <[email protected]>
dev_printk: add new dev_err_probe() helpers
Andy Shevchenko <[email protected]>
driver core: Move dev_err_probe() to where it belogs
Greg Kroah-Hartman <[email protected]>
driver core: device.h: remove extern from function prototypes
Arnaldo Carvalho de Melo <[email protected]>
perf util: Kill die() prototype, dead for a long time
Leo Yan <[email protected]>
perf expr: Return -EINVAL for syntax error in expr__find_ids()
Yu-Chun Lin <[email protected]>
pinctrl: abx500: Fix type of 'argument' variable
Ian Rogers <[email protected]>
perf branch: Avoid incrementing NULL
Ethan Tidmore <[email protected]>
pinctrl: pinctrl-pic32: Fix resource leak
Daniel Borkmann <[email protected]>
bpf: Fix precedence bug in convert_bpf_ld_abs alignment check
Oliver Neukum <[email protected]>
HID: usbhid: fix deadlock in hid_post_reset()
Richard Genoud <[email protected]>
mtd: rawnand: sunxi: fix sunxi_nfc_hw_ecc_read_extra_oob
Chen Ni <[email protected]>
mtd: physmap_of_gemini: Fix disabled pinctrl state check
Denis Benato <[email protected]>
HID: asus: do not abort probe when not necessary
Denis Benato <[email protected]>
HID: asus: make asus_resume adhere to linux kernel coding standards
Daniel Hodges <[email protected]>
ima: check return value of crypto_shash_final() in boot aggregate
Pengpeng Hou <[email protected]>
tracing: Rebuild full_name on each hist_field_name() call
Frank Li <[email protected]>
dmaengine: mxs-dma: Fix missing return value from of_dma_controller_register()
ZhengYuan Huang <[email protected]>
ocfs2: validate group add input before caching
ZhengYuan Huang <[email protected]>
ocfs2: validate bg_bits during freefrag scan
ZhengYuan Huang <[email protected]>
ocfs2: fix listxattr handling when the buffer is full
Alok Tiwari <[email protected]>
soc: qcom: aoss: compare against normalized cooling state
Junrui Luo <[email protected]>
ocfs2/dlm: fix off-by-one in dlm_match_regions() region comparison
Junrui Luo <[email protected]>
ocfs2/dlm: validate qr_numregions in dlm_match_regions()
David Heidelberg <[email protected]>
arm64: dts: qcom: sdm845-xiaomi-beryllium: Mark l1a regulator as powered during boot
Sumit Semwal <[email protected]>
arm64: dts: qcom: sdm845-xiaomi-beryllium: Add DSI and panel bits
Dmitry Baryshkov <[email protected]>
soc: qcom: ocmem: return -EPROBE_DEFER is ocmem is not available
Mikko Perttunen <[email protected]>
memory: tegra30-emc: Fix dll_change check
Mikko Perttunen <[email protected]>
memory: tegra124-emc: Fix dll_change check
Rafał Miłecki <[email protected]>
ARM: dts: mediatek: mt7623: fix efuse fallback compatible
Thomas Huth <[email protected]>
efi/capsule-loader: fix incorrect sizeof in phys array reallocation
Jan Kara <[email protected]>
quota: Fix race of dquot_scan_active() with quota deactivation
Ricardo B. Marlière <[email protected]>
ktest: Run POST_KTEST hooks on failure and cancellation
Ricardo B. Marlière <[email protected]>
ktest: Honor empty per-test option overrides
Ricardo B. Marlière <[email protected]>
ktest: Avoid undef warning when WARNINGS_FILE is unset
Vidya Sagar <[email protected]>
PCI: tegra194: Disable direct speed change for Endpoint mode
Vidya Sagar <[email protected]>
PCI: tegra194: Use devm_gpiod_get_optional() to parse "nvidia,refclk-select"
Waiman Long <[email protected]>
selftest: memcg: skip memcg_sock test if address family not supported
Jane Chu <[email protected]>
Documentation: fix a hugetlbfs reservation statement
Gerd Bayer <[email protected]>
PCI: Enable AtomicOps only if Root Port supports them
Shengjiu Wang <[email protected]>
ASoC: fsl_easrc: Change the type for iec958 channel status controls
Shengjiu Wang <[email protected]>
ASoC: fsl_easrc: Fix value type in fsl_easrc_iec958_get_bits()
Shengjiu Wang <[email protected]>
ASoC: fsl_easrc: Check the variable range in fsl_easrc_iec958_put_bits()
Felix Gu <[email protected]>
pmdomain: ti: omap_prm: Fix a reference leak on device node
Akhil P Oommen <[email protected]>
drm/msm/a6xx: Use barriers while updating HFI Q headers
Rob Clark <[email protected]>
drm/msm/a6xx: Fix HLSQ register dumping
Lei Huang <[email protected]>
ALSA: hda/realtek: fix code style (ERROR: else should follow close brace '}')
Luke D. Jones <[email protected]>
ALSA: hda/realtek: Whitespace fix
Timur Kristóf <[email protected]>
drm/amd/pm/ci: Fill DW8 fields from SMC
Timur Kristóf <[email protected]>
drm/amd/pm/ci: Clear EnabledForActivity field for memory levels
Timur Kristóf <[email protected]>
drm/amd/pm/ci: Fix powertune defaults for Hawaii 0x67B0
Timur Kristóf <[email protected]>
drm/amd/pm/ci: Disable MCLK DPM on problematic CI ASICs
Timur Kristóf <[email protected]>
drm/amd/pm/ci: Use highest MCLK on CI when MCLK DPM is disabled
Cássio Gabriel <[email protected]>
ALSA: core: Validate compress device numbers without dynamic minors
Takashi Iwai <[email protected]>
ALSA: compress: Drop unused functions
Sebastian Reichel <[email protected]>
drm/panel: simple: Correct G190EAN01 prepare timing
Alexander Koskovich <[email protected]>
drm/msm/dsi: rename MSM8998 DSI version from V2_2_0 to V2_0_0
Andy Shevchenko <[email protected]>
fbdev: matroxfb: Mark variable with __maybe_unused to avoid W=1 build break
Ethan Tidmore <[email protected]>
drm/sun4i: Fix resource leaks
Felix Gu <[email protected]>
spi: fsl-qspi: Use reinit_completion() for repeated operations
Junrui Luo <[email protected]>
dm log: fix out-of-bounds write due to region_count overflow
Ming-Hung Tsai <[email protected]>
dm cache metadata: fix memory leak on metadata abort retry
Ming-Hung Tsai <[email protected]>
dm cache: fix dirty mapping checking in passthrough mode switching
Ming-Hung Tsai <[email protected]>
dm cache: support shrinking the origin device
Ming-Hung Tsai <[email protected]>
dm cache: fix concurrent write failure in passthrough mode
Ming-Hung Tsai <[email protected]>
dm cache policy smq: fix missing locks in invalidating cache blocks
Ming-Hung Tsai <[email protected]>
dm cache: fix write path cache coherency in passthrough mode
Ming-Hung Tsai <[email protected]>
dm cache: fix null-deref with concurrent writes in passthrough mode
Sander Vanheule <[email protected]>
ASoC: sti: use managed regmap_field allocations
Sander Vanheule <[email protected]>
ASoC: sti: Return errors from regmap_field_alloc()
Alexander Konyukhov <[email protected]>
drm/komeda: fix integer overflow in AFBC framebuffer size check
Dudu Lu <[email protected]>
Bluetooth: l2cap: Add missing chan lock in l2cap_ecred_reconf_rsp
Pauli Virtanen <[email protected]>
Bluetooth: fix locking in hci_conn_request_evt() with HCI_PROTO_DEFER
Jonathan Rissanen <[email protected]>
Bluetooth: hci_ldisc: Clear HCI_UART_PROTO_INIT on error
Luiz Augusto von Dentz <[email protected]>
Bluetooth: L2CAP: Fix printing wrong information if SDU length exceeds MTU
Sun Jian <[email protected]>
bpf: reject short IPv4/IPv6 inputs in bpf_prog_test_run_skb
Taegu Ha <[email protected]>
ppp: require CAP_NET_ADMIN in target netns for unattached ioctls
Greg Jumper <[email protected]>
net/rds: Restrict use of RDS/IB to the initial network namespace
Håkon Bugge <[email protected]>
net/rds: Optimize rds_ib_laddr_check
Jamal Hadi Salim <[email protected]>
net/sched: act_ct: Only release RCU read lock after ct_ft
Mashiro Chen <[email protected]>
net: hamradio: 6pack: fix uninit-value in sixpack_receive_buf
Jiri Slaby (SUSE) <[email protected]>
6pack: propagage new tty types
Florian Westphal <[email protected]>
netfilter: nft_fwd_netdev: check ttl/hl before forwarding
Justin Chen <[email protected]>
net: bcmgenet: fix off-by-one in bcmgenet_put_txcb
Ethan Tidmore <[email protected]>
wifi: brcmfmac: Fix error pointer dereference
Arend van Spriel <[email protected]>
brcmfmac: support chipsets with different core enumeration space
Weiming Shi <[email protected]>
bpf: fix end-of-list detection in cgroup_storage_get_next_key()
Sourabh Jain <[email protected]>
powerpc/crash: fix backup region offset update to elfcorehdr
Duoming Zhou <[email protected]>
wifi: rtlwifi: pci: fix possible use-after-free caused by unfinished irq_prepare_bcn_tasklet
Zilin Guan <[email protected]>
wifi: mwifiex: Fix memory leak in mwifiex_11n_aggregate_pkt()
Mario Limonciello (AMD) <[email protected]>
firmware: dmi: Correct an indexing error in dmi.h
Bart Van Assche <[email protected]>
locking: Fix rwlock support in <linux/spinlock_up.h>
Brian Masney <[email protected]>
irqchip/irq-pic32-evic: Address warning related to wrong printf() formatter
Gopi Krishna Menon <[email protected]>
thermal/drivers/spear: Fix error condition for reading st,thermal-flags
Danilo Krummrich <[email protected]>
devres: fix missing node debug info in devm_krealloc()
Cole Leavitt <[email protected]>
pstore/ram: fix resource leak when ioremap() fails
Deepanshu Kartikey <[email protected]>
nilfs2: reject zero bd_oblocknr in nilfs_ioctl_mark_blocks_dirty()
Bart Van Assche <[email protected]>
drbd: Balance RCU calls in drbd_adm_dump_devices()
HyungJung Joo <[email protected]>
fs/omfs: reject s_sys_blocksize smaller than OMFS_DIR_START
Mingzhe Zou <[email protected]>
bcache: fix uninitialized closure object
Dudu Lu <[email protected]>
vsock/virtio: fix accept queue count leak on transport mismatch
Norbert Szetei <[email protected]>
vsock: fix buffer size clamping order
Siwei Zhang <[email protected]>
Bluetooth: L2CAP: Fix null-ptr-deref in l2cap_sock_get_sndtimeo_cb()
Sven Eckelmann <[email protected]>
batman-adv: bla: put backbone reference on failed claim hash insert
Sven Eckelmann <[email protected]>
batman-adv: bla: only purge non-released claims
Sven Eckelmann <[email protected]>
batman-adv: bla: prevent use-after-free when deleting claims
Jiexun Wang <[email protected]>
batman-adv: stop caching unowned originator pointers in BAT IV
Jiexun Wang <[email protected]>
batman-adv: reject new tp_meter sessions during teardown
Lyes Bourennani <[email protected]>
batman-adv: fix integer overflow on buff_pos
Ben Morris <[email protected]>
sctp: revalidate list cursor after sctp_sendmsg_to_asoc() in SCTP_SENDALL
Alex Deucher <[email protected]>
drm/amdgpu/pm: align Hawaii mclk workaround with radeon
Alex Deucher <[email protected]>
drm/amdgpu/pm: add missing revision check for CI
John B. Moore <[email protected]>
drm/amdgpu/sdma4: replace BUG_ON with WARN_ON in fence emission
John B. Moore <[email protected]>
drm/amdgpu/gfx9: drop unnecessary 64-bit fence flag check in KIQ
Alex Deucher <[email protected]>
drm/radeon: add missing revision check for CI
Ashutosh Desai <[email protected]>
drm/gem: Fix inconsistent plane dimension calculation in drm_gem_fb_init_with_funcs()
Johan Hovold <[email protected]>
spi: mpc52xx: fix use-after-free on unbind
Johan Hovold <[email protected]>
spi: orion: fix clock imbalance on registration failure
Johan Hovold <[email protected]>
spi: imx: fix runtime pm leak on probe deferral
Johan Hovold <[email protected]>
spi: mtk-nor: fix controller deregistration
Sergey Shtylyov <[email protected]>
media: dib8000: avoid division by 0 in dib8000_set_dds()
Johan Hovold <[email protected]>
regulator: act8945a: fix OF node reference imbalance
Oliver Neukum <[email protected]>
media: rc: streamzap: Error handling in probe
Oliver Neukum <[email protected]>
media: rc: xbox_remote: heed DMA restrictions
Johan Hovold <[email protected]>
regulator: max77650: fix OF node reference imbalance
Sakari Ailus <[email protected]>
staging: media: atomisp: Disallow all private IOCTLs
Ricardo Ribalda <[email protected]>
media: uvcvideo: Enable VB2_DMABUF for metadata stream
Jason Gunthorpe <[email protected]>
RDMA/vmw_pvrdma: Fix double free on pvrdma_alloc_ucontext() error path
Michael Bommarito <[email protected]>
RDMA/rxe: Reject unknown opcodes before ICRC processing
Jason Gunthorpe <[email protected]>
RDMA/ocrdma: Don't NULL deref uctx on errors in ocrdma_copy_pd_uresp()
Jason Gunthorpe <[email protected]>
RDMA/mlx4: Fix resource leak on error in mlx4_ib_create_srq()
André Draszik <[email protected]>
power: supply: max17042: avoid overflow when determining health
Lukas Wunner <[email protected]>
PCI/AER: Stop ruling out unbound devices as error source
Shuai Xue <[email protected]>
PCI/AER: Clear only error bits in PCIe Device Status
Vasily Gorbik <[email protected]>
s390/debug: Reject zero-length input in debug_input_flush_fn()
Chaitanya Kulkarni <[email protected]>
nvmet: avoid recursive nvmet-wq flush in nvmet_ctrl_free
Junrui Luo <[email protected]>
md/raid10: fix divide-by-zero in setup_geo() with zero far_copies
Michael Bommarito <[email protected]>
isofs: validate block number from NFS file handle in isofs_export_iget
Michael Bommarito <[email protected]>
isofs: validate Rock Ridge CE continuation extent against volume size
Eric Biggers <[email protected]>
dm-verity-fec: correctly reject too-small hash devices
Eric Biggers <[email protected]>
dm-verity-fec: correctly reject too-small FEC devices
Mikulas Patocka <[email protected]>
dm: fix a buffer overflow in ioctl processing
Mikulas Patocka <[email protected]>
dm: don't report warning when doing deferred remove
Joseph Salisbury <[email protected]>
ASoC: fsl_easrc: fix comment typo
Shrikanth Hegde <[email protected]>
cpuidle: powerpc: avoid double clear when breaking snooze
Johan Hovold <[email protected]>
spi: topcliff-pch: fix use-after-free on unbind
Thorsten Blum <[email protected]>
thermal/drivers/sprd: Fix raw temperature clamping in sprd_thm_rawdata_to_temp
Thorsten Blum <[email protected]>
thermal/drivers/sprd: Fix temperature clamping in sprd_thm_temp_to_rawdata
Michael Bommarito <[email protected]>
udf: reject descriptors with oversized CRC length
Mingming Cao <[email protected]>
ibmveth: Disable GSO for packets with small MSS
Hamza Mahfooz <[email protected]>
hv_sock: fix ARM64 support
Hongling Zeng <[email protected]>
parisc: Fix IRQ leak in LASI driver
Nan Li <[email protected]>
net/rds: handle zerocopy send cleanup before the message is queued
Maoyi Xie <[email protected]>
ip6_gre: Use cached t->net in ip6erspan_changelink().
SeungJu Cheon <[email protected]>
sound: ua101: fix division by zero at probe
Kai Zen <[email protected]>
net: rtnetlink: zero ifla_vf_broadcast to avoid stack infoleak in rtnl_fill_vfinfo
Miklos Szeredi <[email protected]>
fanotify: fix false positive on permission events
Johan Hovold <[email protected]>
spi: zynqmp-gqspi: fix controller deregistration
Siwei Zhang <[email protected]>
Bluetooth: L2CAP: Fix null-ptr-deref in l2cap_sock_state_change_cb()
Siwei Zhang <[email protected]>
Bluetooth: L2CAP: Fix null-ptr-deref in l2cap_sock_new_connection_cb()
Yilin Zhu <[email protected]>
ipv6: xfrm6: release dst on error in xfrm6_rcv_encap()
Ruijie Li <[email protected]>
xfrm: provide message size for XFRM_MSG_MAPPING
Cássio Gabriel <[email protected]>
ALSA: firewire-tascam: Do not drop unread control events
Felix Gu <[email protected]>
usb: ulpi: fix memory leak on ulpi_register() error paths
Fabio Porcedda <[email protected]>
USB: serial: option: add Telit Cinterion LE910Cx compositions
Aaro Koskinen <[email protected]>
USB: omap_udc: DMA: Don't enable burst 4 mode
Cássio Gabriel <[email protected]>
ALSA: usb-audio: Fix UAC3 cluster descriptor size check
Takashi Iwai <[email protected]>
ALSA: usb-audio: Avoid potential endless loop in convert_chmap_v3()
Greg Kroah-Hartman <[email protected]>
usb: usblp: fix uninitialized heap leak via LPGETSTATUS ioctl
Greg Kroah-Hartman <[email protected]>
usb: usblp: fix heap leak in IEEE 1284 device ID via short response
Tristan Madani <[email protected]>
wifi: b43: enforce bounds check on firmware key index in b43_rx()
Jiri Slaby (SUSE) <[email protected]>
wifi: ath5k: do not access array OOB
Jeongjun Park <[email protected]>
wifi: rsi: fix kthread lifetime race between self-exit and external-stop
Tristan Madani <[email protected]>
wifi: b43legacy: enforce bounds check on firmware key index in RX path
Corey Minyard <[email protected]>
ipmi:ssif: NULL thread on error
Corey Minyard <[email protected]>
ipmi:ssif: Remove unnecessary indention
Corey Minyard <[email protected]>
ipmi:ssif: Clean up kthread on errors
Corey Minyard <[email protected]>
ipmi:ssif: Fix a shutdown race
Jamal Hadi Salim <[email protected]>
net/sched: sch_red: Replace direct dequeue call with peek and qdisc_dequeue_peeked
Johan Hovold <[email protected]>
spi: rockchip: fix controller deregistration
Shivam Kalra <[email protected]>
ACPI: video: force native backlight on HP OMEN 16 (8A44)
Rajat Gupta <[email protected]>
fbdev: udlfb: add vm_ops to dlfb_ops_mmap to prevent use-after-free
Corey Minyard <[email protected]>
ipmi:si: Return state to normal if message allocation fails
Corey Minyard <[email protected]>
ipmi: Check event message buffer response for bad data
Corey Minyard <[email protected]>
ipmi: Add limits to event and receive message requests
Greg Kroah-Hartman <[email protected]>
scsi: target: configfs: Bound snprintf() return in tg_pt_gp_members_show()
Kai Ma <[email protected]>
netfilter: reject zero shift in nft_bitwise
Deepanshu Kartikey <[email protected]>
ALSA: caiaq: fix usb_dev refcount leak on probe failure
Arjan van de Ven <[email protected]>
drm/amdgpu: fix zero-size GDS range init on RDNA4
Greg Kroah-Hartman <[email protected]>
ipv6: rpl: reserve mac_len headroom when recompressed SRH grows
Takashi Iwai <[email protected]>
ALSA: caiaq: Don't abort when no input device is available
Takashi Iwai <[email protected]>
ALSA: caiaq: Fix potentially leftover ep1_in_urb at error path
Douglas Anderson <[email protected]>
driver core: Add kernel-doc for DEV_FLAG_COUNT enum value
Yucheng Lu <[email protected]>
crypto: authencesn - reject short ahash digests during instance creation
Chen Zhao <[email protected]>
IB/core: Fix zero dmac race in neighbor resolution
Junrui Luo <[email protected]>
dm mirror: fix integer overflow in create_dirty_log()
Thorsten Blum <[email protected]>
crypto: atmel-tdes - fix DMA sync direction
Haoxiang Li <[email protected]>
crypto: ccree - fix a memory leak in cc_mac_digest()
Thomas Fourier <[email protected]>
crypto: hisilicon - Fix dma_unmap_single() direction
Thorsten Blum <[email protected]>
crypto: atmel-ecc - Release client on allocation failure
Thorsten Blum <[email protected]>
crypto: atmel-aes - Fix 3-page memory leak in atmel_aes_buff_cleanup
Yiyang Chen <[email protected]>
taskstats: set version in TGID exit notifications
Chia-Ming Chang <[email protected]>
inotify: fix watch count leak when fsnotify_add_inode_mark_locked() fails
Junrui Luo <[email protected]>
md/raid5: validate payload size before accessing journal metadata
Chia-Ming Chang <[email protected]>
md/raid5: fix soft lockup in retry_aligned_read()
Sohei Koyama <[email protected]>
ext4: fix missing brelse() in ext4_xattr_inode_dec_ref_all()
James Kim <[email protected]>
mtd: docg3: fix use-after-free in docg3_release()
Jens Axboe <[email protected]>
io_uring/poll: fix backport of io_poll_add() changes
Jens Axboe <[email protected]>
io_uring/poll: fix EPOLL_URING_WAKE sometimes not being honored
Yosry Ahmed <[email protected]>
KVM: nSVM: Clear GIF on nested #VMEXIT(INVALID)
Yosry Ahmed <[email protected]>
KVM: nSVM: Ensure AVIC is inhibited when restoring a vCPU to guest mode
Yosry Ahmed <[email protected]>
KVM: nSVM: Sync interrupt shadow to cached vmcb12 after VMRUN of L2
Yosry Ahmed <[email protected]>
KVM: nSVM: Sync NextRIP to cached vmcb12 after VMRUN of L2
Yosry Ahmed <[email protected]>
KVM: nSVM: Mark all of vmcb02 dirty when restoring nested state
Denis M. Karpov <[email protected]>
userfaultfd: allow registration of ranges below mmap_min_addr
Jacqueline Wong <[email protected]>
tpm: tpm_tis: add error logging for data transfer
Bin Liu <[email protected]>
mmc: block: use single block write in retry
Arnd Bergmann <[email protected]>
tpm: avoid -Wunused-but-set-variable
hkbinbin <[email protected]>
RDMA/rxe: Validate pad and ICRC before payload_size() in rxe_rcv
Ruijie Li <[email protected]>
net/smc: avoid early lgr access in smc_clc_wait_msg
Ao Zhou <[email protected]>
net: rds: fix MR cleanup on copy error
Jonathan Santos <[email protected]>
iio: adc: ad7768-1: fix one-shot mode data acquisition
Cássio Gabriel <[email protected]>
ALSA: 6fire: Fix input volume change detection
Takashi Iwai <[email protected]>
ALSA: caiaq: Handle probe errors properly
Cássio Gabriel <[email protected]>
ALSA: caiaq: Fix control_put() result and cache rollback
Simon Liebold <[email protected]>
selftests/mqueue: Fix incorrectly named file
Helge Deller <[email protected]>
parisc: _llseek syscall is only available for 32-bit userspace
Cássio Gabriel <[email protected]>
ALSA: seq_oss: return full count for successful SEQ_FULLSIZE writes
Harin Lee <[email protected]>
ALSA: ctxfi: Add fallback to default RSR for S/PDIF
Cássio Gabriel <[email protected]>
ALSA: aoa: i2sbus: fix OF node lifetime handling
Vasiliy Kovalev <[email protected]>
ext2: reject inodes with zero i_nlink and valid mode in ext2_iget()
Manivannan Sadhasivam <[email protected]>
net: qrtr: ns: Fix use-after-free in driver remove()
Chen Ni <[email protected]>
media: i2c: imx219: Check return value of devm_gpiod_get_optional() in imx219_probe()
Josh Law <[email protected]>
lib/ts_kmp: fix integer overflow in pattern length calculation
Rong Zhang <[email protected]>
Revert "ALSA: usb: Increase volume range that triggers a warning"
Luxiao Xu <[email protected]>
net: strparser: fix skb_head leak in strp_abort_strp()
Zhengchuan Liang <[email protected]>
net: caif: clear client service pointer on teardown
Ziqing Chen <[email protected]>
ALSA: control: Validate buf_len before strnlen() in snd_ctl_elem_init_enum_names()
Herbert Xu <[email protected]>
crypto: pcrypt - Fix handling of MAY_BACKLOG requests
Michael Bommarito <[email protected]>
um: drivers: call kernel_strrchr() explicitly in cow_user.c
Douglas Anderson <[email protected]>
driver core: Don't let a device probe until it's ready
Herbert Xu <[email protected]>
padata: Remove comment for reorder_work
Herbert Xu <[email protected]>
padata: Fix pd UAF once and for all
Heming Zhao <[email protected]>
ocfs2: split transactions in dio completion to avoid credit exhaustion
Sasha Levin <[email protected]>
Revert "riscv: Sparse-Memory/vmemmap out-of-bounds fix"
Thomas Zimmermann <[email protected]>
firmware: google: framebuffer: Do not mark framebuffer as busy
Tyllis Xu <[email protected]>
ibmasm: fix heap over-read in ibmasm_send_i2o_message()
Tyllis Xu <[email protected]>
ibmasm: fix OOB reads in command_file_write due to missing size checks
Tyllis Xu <[email protected]>
misc: ibmasm: fix OOB MMIO read in ibmasm_handle_mouse_interrupt()
Michal Pecio <[email protected]>
usb: xhci: Make usb_host_endpoint.hcpriv survive endpoint_disable()
Cássio Gabriel <[email protected]>
ALSA: usb-audio: Fix Audio Advantage Micro II SPDIF switch
Cássio Gabriel <[email protected]>
ALSA: usb-audio: Avoid false E-MU sample-rate notifications
Cássio Gabriel <[email protected]>
ALSA: usb-audio: stop parsing UAC2 rates at MAX_NR_RATES
Anderson Nascimento <[email protected]>
rxrpc: Fix missing validation of ticket length in non-XDR key preparsing
Sean Christopherson <[email protected]>
crypto: ccp: Don't attempt to copy ID to userspace if PSP command failed
Sean Christopherson <[email protected]>
crypto: ccp: Don't attempt to copy PDH cert to userspace if PSP command failed
Sean Christopherson <[email protected]>
crypto: ccp: Don't attempt to copy CSR to userspace if PSP command failed
Berk Cem Goksel <[email protected]>
ALSA: caiaq: take a reference on the USB device in create_card()
Cryolitia PukNgae <[email protected]>
ALSA: usb-audio: apply quirk for MOONDROP JU Jiu
Darrick J. Wong <[email protected]>
fuse: quiet down complaints in fuse_conn_limit_write
Samuel Page <[email protected]>
fuse: reject oversized dirents in page cache
David Howells <[email protected]>
rxrpc: Fix anonymous key handling
Wang Jie <[email protected]>
rxrpc: only handle RESPONSE during service challenge
Zhang Xiaoxu <[email protected]>
cifs: Fix connections leak when tlink setup failed
David Howells <[email protected]>
rxrpc: Fix recvmsg() unconditional requeue
Sasha Levin <[email protected]>
Revert "scsi: ufs: core: Improve SCSI abort handling"
Jamie Iles <[email protected]>
i3c: fix uninitialized variable use in i2c setup
Nathan Chancellor <[email protected]>
scripts/dtc: Remove unused dts_version in dtc-lexer.l
Nathan Chancellor <[email protected]>
drm/amd/display: Do not add '-mhard-float' to calcs, dsc, and dcn30 FP files for clang
Andrew Price <[email protected]>
gfs2: Validate i_depth for exhash directories
Sebastian Krzyszkowiak <[email protected]>
arm64: dts: imx8mq-librem5: Bump BUCK1 suspend voltage up to 0.85V
Sebastian Krzyszkowiak <[email protected]>
Revert "arm64: dts: imx8mq-librem5: Set the DVS voltages lower"
Sebastian Krzyszkowiak <[email protected]>
arm64: dts: imx8mq-librem5: Bump BUCK1 suspend voltage to 0.81V
Sebastian Krzyszkowiak <[email protected]>
arm64: dts: imx8mq-librem5: Set the DVS voltages lower
Martin Kepplinger <[email protected]>
arm64: dts: imx8mq-librem5: set regulators boot-on
Guido Günther <[email protected]>
arm64: dts: imx8mq-librem5: Don't mark buck3 as always on
Martin Kepplinger <[email protected]>
arm64: dts: imx8mq-librem5-r3: workaround i2c1 issue with 1GHz cpu voltage
Breno Leitao <[email protected]>
mm: blk-cgroup: fix use-after-free in cgwb_release_workfn()
Joseph Qi <[email protected]>
ocfs2: fix possible deadlock between unlink and dio_end_io_write
hongnanli <[email protected]>
fs/ocfs2: fix comments mentioning i_mutex
Oleg Nesterov <[email protected]>
x86/uprobes: Fix XOL allocation failure for 32-bit tasks
David Gow <[email protected]>
drivers: base: Free devm resources when unregistering a device
Keith Busch <[email protected]>
blk-mq: use quiesced elevator switch when reinitializing queues
Yuqi Xu <[email protected]>
rxrpc: reject undecryptable rxkad response tickets
Joseph Qi <[email protected]>
ocfs2: fix out-of-bounds write in ocfs2_write_end_inline
Deepanshu Kartikey <[email protected]>
ocfs2: validate inline data i_size during inode read
Dmitry Antipov <[email protected]>
ocfs2: add inline inode consistency check to ocfs2_validate_inode_block()
Yasuaki Torimaru <[email protected]>
xfrm: clear trailing padding in build_polexpire()
David Howells <[email protected]>
rxrpc: Fix key quota calculation for multitoken keys
Luxiao Xu <[email protected]>
rxrpc: fix reference count leak in rxrpc_server_keyring()
Joonwon Kang <[email protected]>
mailbox: Prevent out-of-bounds access in of_mbox_index_xlate()
Hari Bathini <[email protected]>
powerpc64/bpf: do not increment tailcall count when prog is NULL
Leonid Ravich <[email protected]>
IB/mad: Don't call to function that might sleep while in atomic context
Bart Van Assche <[email protected]>
scsi: ufs: core: Improve SCSI abort handling
Chengfeng Ye <[email protected]>
ALSA: usb-audio: fix null pointer dereference on pointer cs_desc
Waiman Long <[email protected]>
blk-cgroup: Reinit blkg_iostat_set after clearing in blkcg_reset_stats()
Lee, Chun-Yi <[email protected]>
thermal/int340x_thermal: handle data_vault when the value is ZERO_SIZE_PTR
Yongzhi Liu <[email protected]>
drm/amd/display: Fix memory leak
Felix Fietkau <[email protected]>
wifi: mac80211: always free skb on ieee80211_tx_prepare_skb() failure
Alex Hung <[email protected]>
drm/amd/display: Add null checker before passing variables
Minhong He <[email protected]>
ipv6: add NULL checks for idev in SRv6 paths
Liu Jian <[email protected]>
bpf, sockmap: Fix an infinite loop error when len is 0 in tcp_bpf_recvmsg_parser()
Marcelo Ricardo Leitner <[email protected]>
net/sched: act_ct: fix ref leak when switching zones
Arun Easi <[email protected]>
scsi: qla2xxx: Fix crash when I/O abort times out
Quinn Tran <[email protected]>
scsi: qla2xxx: Fix warning message due to adisc being flushed
Cezar Bulinaru <[email protected]>
net: tap: NULL pointer derefence in dev_parse_header_protocol when skb->dev is null
Jeongjun Park <[email protected]>
media: hackrf: fix to not free memory after the device is registered in hackrf_probe()
Abd-Alrhman Masalkhi <[email protected]>
media: vidtv: fix pass-by-value structs causing MSAN warnings
Deepanshu Kartikey <[email protected]>
nilfs2: fix NULL i_assoc_inode dereference in nilfs_mdt_save_to_shadow_map
Jeongjun Park <[email protected]>
media: as102: fix to not free memory after the device is registered in as102_usb_probe()
Mingzhe Zou <[email protected]>
bcache: fix cached_dev.sb_bio use-after-free and crash
Berk Cem Goksel <[email protected]>
ALSA: 6fire: fix use-after-free on disconnect
Abhishek Kumar <[email protected]>
media: em28xx: fix use-after-free in em28xx_v4l2_open()
Ruslan Valiyev <[email protected]>
media: vidtv: fix nfeeds state corruption on start_streaming failure
Ritesh Harjani (IBM) <[email protected]>
mm/kasan: fix double free for kasan pXds
Sean Christopherson <[email protected]>
KVM: x86: Use scratch field in MMIO fragment to hold small write values
Sasha Levin <[email protected]>
checkpatch: add support for Assisted-by tag
Ricardo Ribalda <[email protected]>
media: uvcvideo: Use heuristic to find stream entity
Thadeu Lima de Souza Cascardo <[email protected]>
media: uvcvideo: Mark invalid entities with id UVC_INVALID_ENTITY_ID
Ricardo Ribalda <[email protected]>
media: uvcvideo: Allow extra entities
Guocai He <[email protected]>
Revert "wifi: cfg80211: stop NAN and P2P in cfg80211_leave"
Pengpeng Hou <[email protected]>
rxrpc: proc: size address buffers for %pISpc output
David Howells <[email protected]>
rxrpc: Fix call removal to use RCU safe deletion
Andy Shevchenko <[email protected]>
ACPI: property: Constify stubs for CONFIG_ACPI=n case
Sean Christopherson <[email protected]>
KVM: SEV: Drop WARN on large size for KVM_MEMORY_ENCRYPT_REG_REGION
ZhengYuan Huang <[email protected]>
ocfs2: handle invalid dinode in ocfs2_group_extend
Tejas Bharambe <[email protected]>
ocfs2: fix use-after-free in ocfs2_fault() when VM_FAULT_RETRY
Ruslan Valiyev <[email protected]>
media: vidtv: fix NULL pointer dereference in vidtv_channel_pmt_match_sections
Harin Lee <[email protected]>
ALSA: ctxfi: Limit PTP to a single page
Fabio Porcedda <[email protected]>
USB: serial: option: add Telit Cinterion FN990A MBIM composition
Junrui Luo <[email protected]>
staging: sm750fb: fix division by zero in ps_to_hz()
Greg Kroah-Hartman <[email protected]>
fbdev: udlfb: avoid divide-by-zero on FBIOPUT_VSCREENINFO
Daniel Brát <[email protected]>
usb: storage: Expand range of matched versions for VL817 quirks entry
Nathan Rebello <[email protected]>
usbip: validate number_of_packets in usbip_pack_ret_submit()
Greg Kroah-Hartman <[email protected]>
usb: gadget: renesas_usb3: validate endpoint index in standard request handlers
Greg Kroah-Hartman <[email protected]>
usb: gadget: f_phonet: fix skb frags[] overflow in pn_rx_complete()
Greg Kroah-Hartman <[email protected]>
usb: gadget: f_ncm: validate minimum block_len in ncm_unwrap_ntb()
Greg Kroah-Hartman <[email protected]>
fbdev: tdfxfb: avoid divide-by-zero on FBIOPUT_VSCREENINFO
Greg Kroah-Hartman <[email protected]>
ALSA: fireworks: bound device-supplied status before string array lookup
Greg Kroah-Hartman <[email protected]>
NFC: digital: Bounds check NFC-A cascade depth in SDD response handler
Greg Kroah-Hartman <[email protected]>
net: usb: cdc-phonet: fix skb frags[] overflow in rx_complete()
Greg Kroah-Hartman <[email protected]>
HID: core: clamp report_size in s32ton() to avoid undefined shift
Greg Kroah-Hartman <[email protected]>
HID: alps: fix NULL pointer dereference in alps_raw_event()
Lin YuChen <[email protected]>
staging: rtl8723bs: initialize le_tmp64 in rtw_BIP_verify()
Greg Kroah-Hartman <[email protected]>
i2c: s3c24xx: check the size of the SMBUS message before using it
Samuel Page <[email protected]>
can: raw: fix ro->uniq use-after-free in raw_rcv()
Junxi Qian <[email protected]>
nfc: llcp: add missing return after LLCP_CLOSED checks
Haoze Xie <[email protected]>
batman-adv: hold claim backbone gateways by reference
Florian Westphal <[email protected]>
netfilter: nft_set_pipapo: do not rely on ZERO_SIZE_PTR
Maciej W. Rozycki <[email protected]>
MIPS: mm: Rewrite TLB uniquification for the hidden bit feature
Maciej W. Rozycki <[email protected]>
MIPS: mm: Suppress TLB uniquification on EHINV hardware
Maciej W. Rozycki <[email protected]>
MIPS: Always record SEGBITS in cpu_data.vmbits
Stefan Wiehler <[email protected]>
mips: mm: Allocate tlb_vpn array atomically
Thomas Bogendoerfer <[email protected]>
MIPS: mm: kmalloc tlb_vpn array to avoid stack overflow
Sebastian Brzezinka <[email protected]>
drm/i915/gt: fix refcount underflow in intel_engine_park_heartbeat
Florian Westphal <[email protected]>
netfilter: conntrack: add missing netlink policy validations
Alice Mikityanska <[email protected]>
l2tp: Drop large packets with UDP encap
Jiexun Wang <[email protected]>
af_unix: read UNIX_DIAG_VFS data under unix_state_lock
Zhengchuan Liang <[email protected]>
netfilter: ip6t_eui64: reject invalid MAC header for all packets
Ren Wei <[email protected]>
netfilter: xt_multiport: validate range encoding in checkentry
Xiang Mei <[email protected]>
netfilter: nfnetlink_log: initialize nfgenmsg in NLMSG_DONE terminator
Greg Kroah-Hartman <[email protected]>
xfrm_user: fix info leak in build_mapping()
Steffen Klassert <[email protected]>
xfrm: Wait for RCU readers during policy netns exit
Maciej Fijalkowski <[email protected]>
xsk: tighten UMEM headroom validation to account for tailroom and min frame
Agalakov Daniil <[email protected]>
e1000: check return value of e1000_read_eeprom
Pengpeng Hou <[email protected]>
tracing/probe: reject non-closed empty immediate strings
Eric Dumazet <[email protected]>
net: lapbether: handle NETDEV_PRE_TYPE_CHANGE
Peng Li <[email protected]>
net: lapbether: replace comparison to NULL with "lapbeth_get_x25_dev"
Peng Li <[email protected]>
net: lapbether: remove trailing whitespaces
Xie He <[email protected]>
net: lapbether: Close the LAPB device before its underlying Ethernet device closes
Ruide Cao <[email protected]>
net: sched: act_csum: validate nested VLAN headers
Maíra Canal <[email protected]>
drm/vc4: Protect madv read in vc4_gem_object_mmap() with madv_lock
Maíra Canal <[email protected]>
drm/vc4: Fix a memory leak in hang state error path
Maíra Canal <[email protected]>
drm/vc4: Fix memory leak of BO array in hang state
Long Li <[email protected]>
PCI: hv: Set default NUMA node to 0 for devices without affinity info
Sebastian Krzyszkowiak <[email protected]>
arm64: dts: imx8mq: Set the correct gpu_ahb clock frequency
Tomasz Merta <[email protected]>
ASoC: stm32_sai: fix incorrect BCLK polarity for DSP_A/B, LEFT_J
Pengpeng Hou <[email protected]>
wifi: brcmfmac: validate bsscfg indices in IF events
Arthur Husband <[email protected]>
ata: ahci: force 32-bit DMA for JMicron JMB582/JMB585
Benoît Sevens <[email protected]>
HID: roccat: fix use-after-free in roccat_report_event
leo vriska <[email protected]>
HID: quirks: add HID_QUIRK_ALWAYS_POLL for 8BitDo Pro 3
Kuninori Morimoto <[email protected]>
ASoC: soc-core: call missing INIT_LIST_HEAD() for card_aux_list
Pengpeng Hou <[email protected]>
wifi: wl1251: validate packet IDs before indexing tx_frames
Florian Westphal <[email protected]>
netfilter: nft_set_pipapo_avx2: don't return non-matching entry on expiry
César Montoya <[email protected]>
ALSA: hda/realtek: Add mute LED quirk for HP Pavilion 15-eg0xxx
Goldwyn Rodrigues <[email protected]>
btrfs: tracepoints: get correct superblock from dentry in event btrfs_sync_file()
Wenyuan Li <[email protected]>
can: mcp251x: add error handling for power enable in open and resume
Cássio Gabriel <[email protected]>
ASoC: SOF: topology: reject invalid vendor array size in token parser
Arnd Bergmann <[email protected]>
ALSA: asihpi: avoid write overflow check warning
-------------
Diffstat:
Documentation/vm/hugetlbfs_reserv.rst | 2 +-
Makefile | 4 +-
arch/arm/boot/dts/mt7623.dtsi | 2 +-
arch/arm/mach-integrator/integrator_cp.c | 13 +-
.../boot/dts/amlogic/meson-gxl-s905d-p230.dts | 3 +-
.../arm64/boot/dts/freescale/imx8mq-librem5-r3.dts | 6 +
arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi | 16 +-
arch/arm64/boot/dts/freescale/imx8mq.dtsi | 2 +-
.../boot/dts/qcom/sdm845-xiaomi-beryllium.dts | 72 ++++
arch/mips/include/asm/cpu-features.h | 1 -
arch/mips/include/asm/cpu-info.h | 2 -
arch/mips/include/asm/mipsregs.h | 2 +
arch/mips/kernel/cpu-probe.c | 13 +-
arch/mips/kernel/cpu-r3k-probe.c | 2 +
arch/mips/mm/tlb-r4k.c | 299 ++++++++++++++---
arch/parisc/kernel/syscalls/syscall.tbl | 2 +-
arch/powerpc/kexec/file_load_64.c | 2 +-
arch/powerpc/net/bpf_jit_comp64.c | 20 +-
arch/powerpc/platforms/44x/warp.c | 2 +
arch/riscv/include/asm/pgtable.h | 2 +-
arch/s390/kernel/debug.c | 8 +
arch/um/drivers/cow_user.c | 8 +-
arch/x86/include/asm/segment.h | 8 +-
arch/x86/kernel/uprobes.c | 24 ++
arch/x86/kvm/svm/nested.c | 11 +
arch/x86/kvm/svm/sev.c | 11 +-
arch/x86/kvm/svm/svm.c | 10 +
arch/x86/kvm/x86.c | 14 +-
block/blk-cgroup.c | 4 +
block/blk-mq.c | 6 +-
block/blk.h | 3 +-
block/elevator.c | 4 +-
crypto/af_alg.c | 2 +
crypto/authencesn.c | 5 +
crypto/pcrypt.c | 7 +-
drivers/acpi/video_detect.c | 8 +
drivers/ata/ahci.c | 14 +
drivers/base/core.c | 26 ++
drivers/base/dd.c | 12 +
drivers/base/devres.c | 2 +
drivers/block/drbd/drbd_nl.c | 8 +-
drivers/bluetooth/hci_ldisc.c | 51 ++-
drivers/cdrom/cdrom.c | 73 ++--
drivers/char/ipmi/ipmi_si_intf.c | 70 +++-
drivers/char/ipmi/ipmi_ssif.c | 74 +++-
drivers/char/tpm/tpm_tis_core.c | 4 +
drivers/clk/clk-qoriq.c | 17 +-
drivers/clk/clk-xgene.c | 2 +
drivers/clk/imx/clk-imx6q.c | 12 +-
drivers/clk/imx/clk-imx8mq.c | 4 +-
drivers/clk/qcom/dispcc-sc7180.c | 8 +
drivers/clk/qcom/dispcc-sm8250.c | 6 +-
drivers/cpuidle/cpuidle-powernv.c | 5 +-
drivers/cpuidle/cpuidle-pseries.c | 5 +-
drivers/crypto/atmel-aes.c | 2 +-
drivers/crypto/atmel-ecc.c | 1 +
drivers/crypto/atmel-tdes.c | 8 +-
drivers/crypto/ccp/ccp-crypto-aes.c | 7 +-
drivers/crypto/ccp/sev-dev.c | 19 +-
drivers/crypto/ccree/cc_hash.c | 1 +
drivers/crypto/hisilicon/sec/sec_algs.c | 2 +-
drivers/crypto/sa2ul.c | 4 +-
drivers/dma/mxs-dma.c | 1 +
drivers/firmware/efi/capsule-loader.c | 2 +-
drivers/firmware/google/framebuffer-coreboot.c | 2 +-
drivers/gpio/gpiolib-cdev.c | 21 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 66 ++++
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 -
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 4 +-
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 +-
.../drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 72 +++-
drivers/gpu/drm/amd/display/dc/bios/bios_parser.c | 62 ++++
.../drm/amd/display/dc/bios/bios_parser_helper.c | 9 +-
drivers/gpu/drm/amd/display/dc/calcs/Makefile | 3 +-
.../gpu/drm/amd/display/dc/dce/dce_link_encoder.c | 4 +-
drivers/gpu/drm/amd/display/dc/dcn30/Makefile | 4 +-
drivers/gpu/drm/amd/display/dc/dsc/Makefile | 3 +-
.../amd/display/include/grph_object_ctrl_defs.h | 4 +
drivers/gpu/drm/amd/pm/powerplay/hwmgr/hwmgr.c | 15 +
.../gpu/drm/amd/pm/powerplay/smumgr/ci_smumgr.c | 28 +-
.../drm/arm/display/komeda/komeda_framebuffer.c | 6 +-
.../drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c | 16 +-
drivers/gpu/drm/drm_gem_framebuffer_helper.c | 4 +-
drivers/gpu/drm/gma500/oaktrail_hdmi.c | 1 +
drivers/gpu/drm/i915/display/intel_dp.c | 9 +-
drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c | 26 +-
drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c | 2 +-
drivers/gpu/drm/msm/adreno/a6xx_hfi.c | 14 +-
drivers/gpu/drm/msm/dsi/dsi_cfg.c | 4 +-
drivers/gpu/drm/msm/dsi/dsi_cfg.h | 2 +-
drivers/gpu/drm/panel/panel-simple.c | 2 +-
drivers/gpu/drm/panfrost/panfrost_drv.c | 2 +
drivers/gpu/drm/radeon/ci_dpm.c | 9 +-
drivers/gpu/drm/sun4i/sun4i_backend.c | 3 +-
drivers/gpu/drm/vc4/vc4_bo.c | 3 +
drivers/gpu/drm/vc4/vc4_gem.c | 19 +-
drivers/hid/hid-alps.c | 3 +
drivers/hid/hid-asus.c | 28 +-
drivers/hid/hid-core.c | 3 +
drivers/hid/hid-ids.h | 3 +
drivers/hid/hid-quirks.c | 3 +-
drivers/hid/hid-roccat.c | 2 +
drivers/hid/usbhid/hid-core.c | 2 +-
drivers/hwmon/pmbus/adm1266.c | 32 +-
drivers/i2c/busses/i2c-s3c2410.c | 7 +-
drivers/i3c/master.c | 7 +-
drivers/iio/adc/ad7768-1.c | 9 +-
drivers/infiniband/core/addr.c | 3 +
drivers/infiniband/core/iwpm_msg.c | 6 +-
drivers/infiniband/core/mad.c | 5 -
drivers/infiniband/hw/mlx4/srq.c | 4 +-
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 4 +-
drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c | 2 +-
drivers/infiniband/sw/rxe/rxe_recv.c | 14 +-
drivers/infiniband/sw/siw/siw_qp_rx.c | 15 +
drivers/iommu/intel/iommu.c | 3 +
drivers/irqchip/irq-ath79-cpu.c | 7 -
drivers/irqchip/irq-pic32-evic.c | 2 +-
drivers/mailbox/mailbox-test.c | 39 ++-
drivers/mailbox/mailbox.c | 9 +-
drivers/md/bcache/super.c | 8 +
drivers/md/dm-cache-metadata.c | 24 +-
drivers/md/dm-cache-metadata.h | 5 -
drivers/md/dm-cache-policy-smq.c | 4 +
drivers/md/dm-cache-target.c | 111 ++++--
drivers/md/dm-ioctl.c | 6 +-
drivers/md/dm-log.c | 6 +-
drivers/md/dm-raid1.c | 6 +-
drivers/md/dm-verity-fec.c | 8 +-
drivers/md/raid10.c | 2 +
drivers/md/raid5-cache.c | 48 ++-
drivers/md/raid5.c | 8 +-
drivers/media/dvb-frontends/dib8000.c | 4 +-
drivers/media/i2c/imx219.c | 3 +
drivers/media/rc/streamzap.c | 12 +-
drivers/media/rc/xbox_remote.c | 9 +-
drivers/media/test-drivers/vidtv/vidtv_bridge.c | 4 +-
drivers/media/test-drivers/vidtv/vidtv_channel.c | 4 +
drivers/media/test-drivers/vidtv/vidtv_mux.c | 4 +-
drivers/media/test-drivers/vidtv/vidtv_ts.c | 48 +--
drivers/media/test-drivers/vidtv/vidtv_ts.h | 4 +-
drivers/media/usb/as102/as102_usb_drv.c | 2 +
drivers/media/usb/em28xx/em28xx-video.c | 14 +-
drivers/media/usb/hackrf/hackrf.c | 7 +-
drivers/media/usb/uvc/uvc_driver.c | 81 +++--
drivers/media/usb/uvc/uvc_queue.c | 3 +-
drivers/media/usb/uvc/uvcvideo.h | 9 +-
drivers/memory/tegra/tegra124-emc.c | 2 +-
drivers/memory/tegra/tegra30-emc.c | 6 +-
drivers/mfd/mc13xxx-core.c | 2 +-
drivers/misc/ibmasm/ibmasmfs.c | 7 +
drivers/misc/ibmasm/lowlevel.c | 12 +-
drivers/misc/ibmasm/remote.c | 5 +
drivers/mmc/core/block.c | 12 +-
drivers/mmc/core/queue.h | 3 +
drivers/mtd/devices/docg3.c | 3 +-
drivers/mtd/maps/physmap-gemini.c | 2 +-
drivers/mtd/nand/raw/sunxi_nand.c | 6 +-
drivers/net/bareudp.c | 24 +-
drivers/net/can/spi/mcp251x.c | 29 +-
drivers/net/dsa/sja1105/sja1105_static_config.c | 6 +-
.../net/ethernet/aquantia/atlantic/aq_pci_func.c | 2 +-
drivers/net/ethernet/atheros/ag71xx.c | 3 +
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 15 +-
drivers/net/ethernet/cirrus/cs89x0.c | 2 -
drivers/net/ethernet/cortina/gemini.c | 21 +-
drivers/net/ethernet/ibm/ibmveth.c | 22 ++
drivers/net/ethernet/ibm/ibmveth.h | 1 +
drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 8 +-
drivers/net/ethernet/intel/e1000e/netdev.c | 1 +
drivers/net/ethernet/intel/i40e/i40e_main.c | 1 -
drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 4 +-
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 1 +
.../ethernet/netronome/nfp/nfpcore/nfp_target.c | 17 +-
drivers/net/hamradio/6pack.c | 39 ++-
drivers/net/netdevsim/dev.c | 2 +-
drivers/net/phy/dp83869.c | 13 +-
drivers/net/ppp/ppp_generic.c | 5 +-
drivers/net/ppp/pppoe.c | 8 +-
drivers/net/slip/slhc.c | 49 ++-
drivers/net/tap.c | 23 +-
drivers/net/usb/cdc-phonet.c | 7 +-
drivers/net/usb/lan78xx.c | 31 +-
drivers/net/usb/rtl8150.c | 12 +-
drivers/net/vrf.c | 15 +-
drivers/net/wan/lapbether.c | 23 +-
drivers/net/wireless/ath/ath11k/hal.c | 14 +-
drivers/net/wireless/ath/ath5k/base.c | 3 +-
drivers/net/wireless/ath/ath9k/channel.c | 6 +-
drivers/net/wireless/broadcom/b43/xmit.c | 3 +-
drivers/net/wireless/broadcom/b43legacy/xmit.c | 3 +-
.../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 3 +-
.../wireless/broadcom/brcm80211/brcmfmac/chip.c | 31 +-
.../wireless/broadcom/brcm80211/brcmfmac/chip.h | 5 +-
.../wireless/broadcom/brcm80211/brcmfmac/fweh.c | 5 +
.../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 3 +-
.../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 12 +-
.../net/wireless/broadcom/brcm80211/include/soc.h | 2 +-
drivers/net/wireless/mac80211_hwsim.c | 1 -
drivers/net/wireless/marvell/mwifiex/11n_aggr.c | 1 +
drivers/net/wireless/realtek/rtlwifi/pci.c | 1 +
drivers/net/wireless/rsi/rsi_common.h | 5 +-
drivers/net/wireless/ti/wl1251/tx.c | 8 +-
drivers/nfc/trf7970a.c | 3 +-
drivers/nvme/target/core.c | 2 +-
drivers/parisc/lasi.c | 12 +-
drivers/pci/controller/dwc/pcie-tegra194.c | 10 +-
drivers/pci/controller/pci-hyperv.c | 8 +
drivers/pci/pci.c | 48 ++-
drivers/pci/pcie/aer.c | 2 -
drivers/pcmcia/rsrc_nonstatic.c | 6 +-
drivers/phy/marvell/phy-mvebu-a3700-utmi.c | 5 +-
drivers/pinctrl/nomadik/pinctrl-abx500.c | 2 +-
drivers/pinctrl/pinctrl-pic32.c | 20 +-
drivers/platform/x86/dell_rbu.c | 6 +-
drivers/platform/x86/intel-hid.c | 6 +-
drivers/platform/x86/surfacepro3_button.c | 1 +
drivers/power/supply/max17042_battery.c | 2 +-
drivers/regulator/act8945a-regulator.c | 3 +-
drivers/regulator/max77650-regulator.c | 2 +-
drivers/rtc/class.c | 5 +
drivers/rtc/interface.c | 12 +-
drivers/rtc/rtc-abx80x.c | 2 +
drivers/s390/cio/css.c | 2 +-
drivers/scsi/isci/host.c | 3 +
drivers/scsi/qla2xxx/qla_init.c | 20 +-
drivers/scsi/sg.c | 29 +-
drivers/scsi/sr.c | 25 +-
drivers/scsi/sr.h | 1 -
drivers/soc/qcom/ocmem.c | 7 +-
drivers/soc/qcom/qcom_aoss.c | 2 +-
drivers/soc/ti/omap_prm.c | 1 +
drivers/spi/spi-fsl-qspi.c | 3 +-
drivers/spi/spi-imx.c | 1 +
drivers/spi/spi-mpc52xx.c | 3 +-
drivers/spi/spi-mtk-nor.c | 4 +-
drivers/spi/spi-orion.c | 6 +
drivers/spi/spi-rockchip.c | 4 +-
drivers/spi/spi-sprd.c | 3 +-
drivers/spi/spi-ti-qspi.c | 1 +
drivers/spi/spi-topcliff-pch.c | 6 +-
drivers/spi/spi-zynqmp-gqspi.c | 4 +-
drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 4 +
drivers/staging/rtl8723bs/core/rtw_security.c | 2 +-
drivers/staging/sm750fb/sm750.c | 3 +
drivers/target/target_core_configfs.c | 2 +-
drivers/target/target_core_sbc.c | 3 +-
.../intel/int340x_thermal/int3400_thermal.c | 9 +-
drivers/thermal/spear_thermal.c | 2 +-
drivers/thermal/sprd_thermal.c | 4 +-
drivers/tty/hvc/hvc_iucv.c | 11 +-
drivers/usb/class/usblp.c | 3 +-
drivers/usb/common/ulpi.c | 5 +-
drivers/usb/gadget/function/f_ncm.c | 4 +-
drivers/usb/gadget/function/f_phonet.c | 9 +
drivers/usb/gadget/udc/omap_udc.c | 4 -
drivers/usb/gadget/udc/renesas_usb3.c | 7 +-
drivers/usb/host/xhci.c | 1 -
drivers/usb/serial/option.c | 6 +
drivers/usb/storage/unusual_devs.h | 7 +-
drivers/usb/usbip/usbip_common.c | 12 +
drivers/vhost/net.c | 4 +-
drivers/video/backlight/sky81452-backlight.c | 3 +
drivers/video/fbdev/matrox/g450_pll.c | 2 +-
drivers/video/fbdev/offb.c | 7 +-
drivers/video/fbdev/tdfxfb.c | 3 +
drivers/video/fbdev/udlfb.c | 34 +-
fs/adfs/super.c | 3 +
fs/btrfs/extent_io.c | 4 +-
fs/btrfs/extent_io.h | 12 +-
fs/btrfs/inode.c | 30 +-
fs/ceph/xattr.c | 1 +
fs/cifs/cifs_spnego.c | 16 +
fs/cifs/connect.c | 17 +-
fs/ext2/inode.c | 14 +-
fs/ext4/xattr.c | 4 +-
fs/fuse/control.c | 4 +-
fs/fuse/readdir.c | 4 +
fs/gfs2/dir.c | 6 +-
fs/gfs2/glops.c | 4 +
fs/isofs/export.c | 2 +-
fs/isofs/rock.c | 9 +
fs/nfs/blocklayout/blocklayout.c | 4 +-
fs/nilfs2/dat.c | 3 +
fs/nilfs2/ioctl.c | 6 +
fs/notify/fsnotify.c | 2 +-
fs/notify/inotify/inotify_user.c | 1 +
fs/notify/mark.c | 18 +-
fs/ocfs2/alloc.c | 2 +-
fs/ocfs2/aops.c | 75 +++--
fs/ocfs2/cluster/nodemanager.c | 2 +-
fs/ocfs2/dir.c | 4 +-
fs/ocfs2/dlm/dlmdomain.c | 10 +-
fs/ocfs2/file.c | 4 +-
fs/ocfs2/inode.c | 33 +-
fs/ocfs2/ioctl.c | 18 +-
fs/ocfs2/localalloc.c | 6 +-
fs/ocfs2/mmap.c | 7 +-
fs/ocfs2/namei.c | 2 +-
fs/ocfs2/ocfs2.h | 4 +-
fs/ocfs2/ocfs2_trace.h | 10 +-
fs/ocfs2/quota_global.c | 2 +-
fs/ocfs2/resize.c | 22 +-
fs/ocfs2/xattr.c | 6 +-
fs/omfs/inode.c | 6 +
fs/pstore/ram_core.c | 4 +
fs/quota/dquot.c | 38 ++-
fs/sysfs/group.c | 2 +-
fs/udf/misc.c | 8 +-
fs/userfaultfd.c | 2 -
include/dt-bindings/clock/qcom,dispcc-sc7180.h | 7 +-
include/linux/acpi.h | 6 +-
include/linux/cdrom.h | 1 +
include/linux/dev_printk.h | 10 +
include/linux/device.h | 48 ++-
include/linux/dmi.h | 5 +
include/linux/fsnotify_backend.h | 1 +
include/linux/kvm_host.h | 3 +-
include/linux/padata.h | 4 -
include/linux/ppp_defs.h | 30 ++
include/linux/printk.h | 5 +-
include/linux/quotaops.h | 9 +-
include/linux/rtc.h | 2 +
include/linux/spinlock_up.h | 20 +-
include/linux/string.h | 12 +
include/linux/tpm_eventlog.h | 9 +-
include/linux/uprobes.h | 1 +
include/linux/usb.h | 3 +-
include/net/flow_dissector.h | 22 ++
include/net/ipv6.h | 6 -
include/net/mac80211.h | 4 +
include/net/pie.h | 2 +-
include/net/red.h | 1 -
include/net/route.h | 6 -
include/net/udp_tunnel.h | 15 +
include/sound/compress_driver.h | 2 -
include/trace/events/btrfs.h | 9 +-
include/trace/events/ib_mad.h | 13 +-
include/trace/events/rxrpc.h | 8 +
include/uapi/linux/rtc.h | 5 +
include/video/udlfb.h | 1 +
io_uring/io-wq.c | 3 +-
io_uring/io_uring.c | 35 +-
kernel/audit.c | 4 +
kernel/auditsc.c | 2 +-
kernel/bpf/local_storage.c | 2 +-
kernel/cgroup/rdma.c | 2 +-
kernel/events/uprobes.c | 10 +-
kernel/padata.c | 136 ++------
kernel/taskstats.c | 1 +
kernel/time/alarmtimer.c | 2 +-
kernel/trace/ring_buffer.c | 8 +-
kernel/trace/trace_branch.c | 8 +-
kernel/trace/trace_events_hist.c | 12 +-
kernel/trace/trace_probe.c | 2 +-
kernel/trace/tracing_map.c | 17 +-
lib/kunit/Kconfig | 5 +-
lib/ts_kmp.c | 18 +-
mm/backing-dev.c | 5 +-
mm/kasan/init.c | 8 +-
net/batman-adv/bat_iv_ogm.c | 85 +++--
net/batman-adv/bridge_loop_avoidance.c | 92 +++--
net/batman-adv/distributed-arp-table.c | 3 +
net/batman-adv/fragmentation.c | 58 +++-
net/batman-adv/gateway_client.c | 4 +
net/batman-adv/originator.c | 4 +-
net/batman-adv/tp_meter.c | 32 +-
net/batman-adv/types.h | 6 +-
net/bluetooth/bnep/core.c | 2 +-
net/bluetooth/hci_event.c | 3 -
net/bluetooth/l2cap_core.c | 8 +-
net/bluetooth/l2cap_sock.c | 9 +
net/bpf/test_run.c | 20 +-
net/caif/cfsrvl.c | 14 +-
net/can/raw.c | 11 +-
net/ceph/crush/crush.c | 6 +-
net/ceph/osdmap.c | 14 +-
net/core/filter.c | 2 +-
net/core/flow_dissector.c | 79 ++++-
net/core/rtnetlink.c | 1 +
net/ethtool/bitset.c | 8 +-
net/ipv4/netfilter/arp_tables.c | 18 +-
net/ipv4/netfilter/arpt_mangle.c | 8 +
net/ipv4/nexthop.c | 36 +-
net/ipv4/raw.c | 2 +-
net/ipv4/route.c | 48 ---
net/ipv4/tcp.c | 3 +-
net/ipv4/tcp_bpf.c | 3 +
net/ipv4/udp_tunnel_core.c | 48 +++
net/ipv6/exthdrs.c | 13 +-
net/ipv6/icmp.c | 10 +-
net/ipv6/ip6_gre.c | 5 +-
net/ipv6/ip6_output.c | 68 ----
net/ipv6/ip6_udp_tunnel.c | 69 ++++
net/ipv6/netfilter/ip6t_eui64.c | 3 +-
net/ipv6/netfilter/ip6t_hbh.c | 4 +
net/ipv6/seg6_hmac.c | 2 +
net/ipv6/xfrm6_protocol.c | 4 +-
net/l2tp/l2tp_core.c | 5 +
net/mac80211/tx.c | 4 +-
net/netfilter/ipset/ip_set_hash_ipmark.c | 6 +-
net/netfilter/ipset/ip_set_hash_ipport.c | 5 +-
net/netfilter/ipset/ip_set_hash_ipportip.c | 5 +-
net/netfilter/ipset/ip_set_hash_ipportnet.c | 5 +-
net/netfilter/ipvs/ip_vs_xmit.c | 19 +-
net/netfilter/nf_conntrack_netlink.c | 2 +-
net/netfilter/nf_conntrack_proto_sctp.c | 13 +-
net/netfilter/nf_conntrack_sip.c | 152 +++++++--
net/netfilter/nf_nat_amanda.c | 2 +-
net/netfilter/nf_nat_sip.c | 34 +-
net/netfilter/nfnetlink_log.c | 8 +-
net/netfilter/nfnetlink_osf.c | 45 ++-
net/netfilter/nft_bitwise.c | 3 +-
net/netfilter/nft_ct.c | 2 +
net/netfilter/nft_fwd_netdev.c | 10 +
net/netfilter/nft_osf.c | 6 +-
net/netfilter/nft_set_pipapo.c | 21 +-
net/netfilter/nft_set_pipapo_avx2.c | 20 +-
net/netfilter/xt_mac.c | 34 +-
net/netfilter/xt_multiport.c | 34 +-
net/netfilter/xt_owner.c | 37 +-
net/netfilter/xt_physdev.c | 29 +-
net/netfilter/xt_policy.c | 2 +-
net/netfilter/xt_realm.c | 2 +-
net/nfc/digital_technology.c | 6 +
net/nfc/llcp_core.c | 2 +
net/openvswitch/datapath.c | 35 +-
net/openvswitch/vport.c | 3 +
net/phonet/pep.c | 19 +-
net/qrtr/ns.c | 11 +
net/rds/af_rds.c | 10 +-
net/rds/connection.c | 14 +
net/rds/ib.c | 24 +-
net/rds/ib.h | 1 +
net/rds/ib_rdma.c | 2 +-
net/rds/message.c | 21 +-
net/rds/rdma.c | 4 -
net/rxrpc/call_object.c | 22 +-
net/rxrpc/conn_event.c | 17 +-
net/rxrpc/key.c | 12 +-
net/rxrpc/proc.c | 26 +-
net/rxrpc/recvmsg.c | 22 +-
net/rxrpc/rxkad.c | 7 +-
net/rxrpc/sendmsg.c | 2 +-
net/sched/act_csum.c | 6 +-
net/sched/act_ct.c | 23 +-
net/sched/sch_cake.c | 15 +-
net/sched/sch_choke.c | 28 +-
net/sched/sch_fq_codel.c | 3 +-
net/sched/sch_fq_pie.c | 19 +-
net/sched/sch_gred.c | 3 -
net/sched/sch_hhf.c | 19 +-
net/sched/sch_netem.c | 57 +++-
net/sched/sch_pie.c | 52 ++-
net/sched/sch_red.c | 34 +-
net/sched/sch_sfb.c | 54 +--
net/sched/sch_taprio.c | 371 +++++++++++----------
net/sctp/sm_statefuns.c | 6 +
net/sctp/socket.c | 11 +-
net/smc/smc_clc.c | 4 +-
net/strparser/strparser.c | 8 +
net/tipc/msg.c | 14 +-
net/tls/tls_sw.c | 26 +-
net/unix/diag.c | 21 +-
net/vmw_vsock/af_vsock.c | 6 +-
net/vmw_vsock/hyperv_transport.c | 4 +-
net/vmw_vsock/virtio_transport_common.c | 3 +-
net/vmw_vsock/vmci_transport.c | 2 +-
net/wireless/core.c | 4 +-
net/wireless/scan.c | 3 +
net/xdp/xdp_umem.c | 3 +-
net/xfrm/xfrm_policy.c | 2 +
net/xfrm/xfrm_user.c | 4 +
scripts/checkpatch.pl | 10 +
scripts/dtc/dtc-lexer.l | 3 -
security/integrity/ima/ima_crypto.c | 2 +-
sound/aoa/soundbus/i2sbus/core.c | 9 +-
sound/core/compress_offload.c | 75 -----
sound/core/control.c | 4 +
sound/core/seq/oss/seq_oss_rw.c | 6 +-
sound/core/sound.c | 7 +
sound/firewire/fireworks/fireworks_command.c | 5 +-
sound/firewire/tascam/tascam-hwdep.c | 1 +
sound/pci/asihpi/hpicmn.c | 6 +
sound/pci/asihpi/hpimsgx.c | 6 +-
sound/pci/ctxfi/ctatc.c | 3 +-
sound/pci/ctxfi/ctvmem.h | 2 +-
sound/pci/hda/patch_realtek.c | 5 +-
sound/soc/codecs/ab8500-codec.c | 6 +-
sound/soc/fsl/fsl_easrc.c | 125 +++++--
sound/soc/soc-core.c | 1 +
sound/soc/sof/topology.c | 2 +-
sound/soc/sti/uniperif_player.c | 9 +-
sound/soc/stm/stm32_sai_sub.c | 3 +
sound/usb/6fire/chip.c | 17 +-
sound/usb/6fire/control.c | 10 +-
sound/usb/caiaq/control.c | 52 ++-
sound/usb/caiaq/device.c | 39 ++-
sound/usb/caiaq/input.c | 2 +-
sound/usb/clock.c | 6 +
sound/usb/format.c | 2 +-
sound/usb/midi.c | 12 +-
sound/usb/misc/ua101.c | 12 +-
sound/usb/mixer.c | 14 +-
sound/usb/mixer_quirks.c | 12 +-
sound/usb/stream.c | 4 +-
tools/perf/util/branch.h | 3 +
tools/perf/util/expr.c | 3 +-
tools/perf/util/util.h | 1 -
tools/testing/ktest/ktest.pl | 35 +-
tools/testing/selftests/cgroup/test_memcontrol.c | 11 +-
tools/testing/selftests/lib.mk | 1 +
.../testing/selftests/mqueue/{setting => settings} | 0
514 files changed, 4832 insertions(+), 2163 deletions(-)Greg Kroah-Hartman
maintainerPATCH 1/589 ALSA: asihpi: avoid write overflow check warning
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 591721223be9e28f83489a59289579493b8e3d83 ]
clang-22 rightfully warns that the memcpy() in adapter_prepare() copies between different structures, crossing the boundary of nested structures inside it:
In file included from sound/pci/asihpi/hpimsgx.c:13:
In file included from include/linux/string.h:386:include/linux/fortify-string.h:569:4: error: call to '__write_overflow_field' declared with 'warning' attribute: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror,-Wattribute-warning]
569 | __write_overflow_field(p_size_field, size);
The two structures seem to refer to the same layout, despite the separate definitions, so the code is in fact correct.
Avoid the warning by copying the two inner structures separately. I see the same pattern happens in other functions in the same file, so there is a chance that this may come back in the future, but this instance is the only one that I saw in practice, hitting it multiple times per day in randconfig build.
--- sound/pci/asihpi/hpimsgx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
sound/pci/asihpi/hpimsgx.c +4 -2
@@ -586,8 +586,10 @@ static u16 adapter_prepare(u16 adapter) HPI_ADAPTER_OPEN); hm.adapter_index = adapter;hw_entry_point (&hm, &hr); -memcpy (&rESP_HPI_ADAPTER_OPEN[adapter], &hr, -sizeof (rESP_HPI_ADAPTER_OPEN[0 ])); +memcpy (&rESP_HPI_ADAPTER_OPEN[adapter].h, &hr, +sizeof (rESP_HPI_ADAPTER_OPEN[adapter].h)); +memcpy (&rESP_HPI_ADAPTER_OPEN[adapter].a, &hr.u.ax.info, +sizeof (rESP_HPI_ADAPTER_OPEN[adapter].a));if (hr.error)return hr.error;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2/589 ASoC: SOF: topology: reject invalid vendor array size in token parser
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
[ Upstream commit 215e5fe75881a7e2425df04aeeed47a903d5cd5d ]
sof_parse_token_sets() accepts array->size values that can be invalid for a vendor tuple array header. In particular, a zero size does not advance the parser state and can lead to non-progress parsing on malformed topology data.
Validate array->size against the minimum header size and reject values smaller than sizeof(*array) before parsing. This preserves behavior for valid topologies and hardens malformed-input handling.
--- sound/soc/sof/topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sof/topology.c +1 -1
@@ -941,7 +941,7 @@ static int sof_parse_token_sets(struct snd_soc_component *scomp, asize =le32_to_cpu (array->size);/* validate asize */ -if (asize <0 ) {/* FIXME: A zero-size array makes no sense */ +if (asize <sizeof (*array)) {dev_err (scomp->dev,"error: invalid array size 0x%x\n" , asize);return -EINVAL ;
Signature · 1 line
2.53.0
Re: [PATCH 5.10 002/589] ASoC: SOF: topology: reject invalid vendor array size in token parser
Quoted 31 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
[ Upstream commit
215e5fe75881a7e2425df04aeeed47a903d5cd5d]
sof_parse_token_sets()acceptsarray->sizevalues that can be invalid for a vendor tuple array header. In particular, a zero size does not advance the parser state and can lead to non-progress parsing on malformed topology data.Validate
array->sizeagainst the minimum header size and reject values smaller thansizeof(*array)before parsing. This preserves behavior for valid topologies and hardens malformed-input handling.Signed-off-by Cássio Gabriel <[email protected]>Acked-by Peter Ujfalusi <[email protected]>Signed-off-by Mark Brown <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- sound/soc/sof/topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)sound/soc/sof/topology.c +0
-0
sound/soc/sof/topology.c static int sof_parse_token_sets(struct snd_soc_component *scomp, · line 944
Quoted 5 lines
sound/soc/sof/topology.c +1
-1@@ -941,7 +941,7 @@ static int sof_parse_token_sets(struct snd_soc_component *scomp, asize =le32_to_cpu (array->size);/* validate asize */ -if (asize <0 ) {/* FIXME: A zero-size array makes no sense */ +if (asize <sizeof (*array)) {
asize is signed and this comparison coerces it to be unsigned. So non- negative values of asize that are too small will be correctly rejected here, but negative values will now be accepted.
I think this creates a worse security problem than it solves.
Ben.
Quoted 3 lines
sound/soc/sof/topology.c +0
-0dev_err (scomp->dev,"error: invalid array size 0x%x\n" , asize);return -EINVAL ;
Signature · 3 lines
Ben Hutchings The Peter principle: In a hierarchy, every employee tends to rise to their level of incompetence.
Re: [PATCH 5.10 002/589] ASoC: SOF: topology: reject invalid vendor array size in token parser
Hi!
Quoted 11 lines · Ben Hutchings
Review
Quoted 5 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
(quoted diff) +1
-1/* validate asize */ - if (asize < 0) { /* FIXME: A zero-size array makes no sense */ + if (asize < sizeof(*array)) {asize is signed and this comparison coerces it to be unsigned. So non- negative values of asize that are too small will be correctly rejected here, but negative values will now be accepted.
Quoted 1 line
I think this creates a worse security problem than it solves.
Thanks for catching this.
In order to keep the minimum header-size validation but force the comparison to remain signed, I think we can do this:
if (asize < (int)sizeof(*array))
While checking this further, I also noticed a separate parser-hardening issue:sof_parse_token_sets() reads array->size before checking that the remaining private data contains a full struct snd_soc_tplg_vendor_array header.
So, on top of the signed comparison fix, the safer ordering would be:
--->8
sound/soc/sof/topology.c +3 -0
@@ -740,6 +740,9 @@ static int sof_parse_token_sets(struct snd_soc_component *scomp,int ret;while (array_size >0 && total < count * token_instance_num) { +if (array_size < (int )sizeof (*array)) +return -EINVAL ; + asize =le32_to_cpu (array->size);/* validate asize */
8<---
The added check prevents a truncated-header read before dereferencing array->size. The existing signed asize check then validates the declared vendor-array size.
Let me know what you guys think.
Signature · 2 lines
Thanks, Cássio
Sasha Levin
maintainerRe: [PATCH 5.10 002/589] ASoC: SOF: topology: reject invalid vendor array size in token parser
Quoted 4 lines · Cássio Gabriel Monteiro Pires
In order to keep the minimum header-size validation but force the comparison to remain signed, I think we can do this:
if (asize < (int)sizeof(*array))
Thanks for confirming. I've dropped it from the stable queues (5.10, 5.15 and 6.1).
--
Thanks,
Sasha
Sasha Levin
maintainerRe: [PATCH 5.10 002/589] ASoC: SOF: topology: reject invalid vendor array size in token parser
In reply to Ben HutchingsQuoted 5 lines · Ben Hutchings
asize is signed and this comparison coerces it to be unsigned. So non- negative values of asize that are too small will be correctly rejected here, but negative values will now be accepted.
I think this creates a worse security problem than it solves.
I've dropped this from the 5.10, 5.15 and 6.1 queues and will pick up the corrected upstream fix once it lands. Thanks both.
--
Thanks,
Sasha
Greg Kroah-Hartman
maintainerPATCH 3/589 can: mcp251x: add error handling for power enable in open and resume
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wenyuan Li <[email protected]>
[ Upstream commit 7a57354756c7df223abe2c33774235ad70cb4231 ]
Add missing error handling for mcp251x_power_enable() calls in both mcp251x_open() and mcp251x_can_resume() functions.
In mcp251x_open(), if power enable fails, jump to error path to close candev without attempting to disable power again.
In mcp251x_can_resume(), properly check return values of power enable calls for both power and transceiver regulators. If any fails, return the error code to the PM framework and log the failure.
This ensures the driver properly handles power control failures and maintains correct device state.
--- drivers/net/can/spi/mcp251x.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-)
drivers/net/can/spi/mcp251x.c +24 -5
@@ -1218,7 +1218,11 @@ static int mcp251x_open(struct net_device *net) }mutex_lock (&priv->mcp_lock); -mcp251x_power_enable (priv->transceiver,1 ); + ret =mcp251x_power_enable (priv->transceiver,1 ); +if (ret) { +dev_err (&spi->dev,"failed to enable transceiver power: %pe\n" ,ERR_PTR (ret)); + goto out_close_candev; + } priv->force_quit =0 ; priv->tx_skb =NULL ;
@@ -1267,6 +1271,7 @@ static int mcp251x_open(struct net_device *net)mcp251x_hw_sleep (spi); out_close:mcp251x_power_enable (priv->transceiver,0 ); +out_close_candev:close_candev (net);mutex_unlock (&priv->mcp_lock);if (release_irq)
@@ -1505,11 +1510,25 @@ static int __maybe_unused mcp251x_can_resume(struct device *dev) {struct spi_device *spi =to_spi_device (dev);struct mcp251x_priv *priv =spi_get_drvdata (spi); +int ret =0 ; -if (priv->after_suspend &AFTER_SUSPEND_POWER ) -mcp251x_power_enable (priv->power,1 ); -if (priv->after_suspend &AFTER_SUSPEND_UP ) -mcp251x_power_enable (priv->transceiver,1 ); +if (priv->after_suspend &AFTER_SUSPEND_POWER ) { + ret =mcp251x_power_enable (priv->power,1 ); +if (ret) { +dev_err (dev,"failed to restore power: %pe\n" ,ERR_PTR (ret)); +return ret; + } + } + +if (priv->after_suspend &AFTER_SUSPEND_UP ) { + ret =mcp251x_power_enable (priv->transceiver,1 ); +if (ret) { +dev_err (dev,"failed to restore transceiver power: %pe\n" ,ERR_PTR (ret)); +if (priv->after_suspend &AFTER_SUSPEND_POWER ) +mcp251x_power_enable (priv->power,0 ); +return ret; + } + }if (priv->after_suspend & (AFTER_SUSPEND_POWER |AFTER_SUSPEND_UP ))queue_work (priv->wq, &priv->restart_work);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 4/589 btrfs: tracepoints: get correct superblock from dentry in event btrfs_sync_file()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Goldwyn Rodrigues <[email protected]>
[ Upstream commit a85b46db143fda5869e7d8df8f258ccef5fa1719 ]
If overlay is used on top of btrfs, dentry->d_sb translates to overlay's super block and fsid assignment will lead to a crash.
Use file_inode(file)->i_sb to always get btrfs_sb.
--- include/trace/events/btrfs.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
include/trace/events/btrfs.h +7 -4
@@ -697,12 +697,15 @@ TRACE_EVENT(btrfs_sync_file, ),TP_fast_assign ( - const struct dentry *dentry = file->f_path.dentry; -const struct inode *inode =d_inode (dentry); + struct dentry *dentry = file_dentry(file); +struct inode *inode =file_inode (file); +struct dentry *parent =dget_parent (dentry); +struct inode *parent_inode =d_inode (parent); -TP_fast_assign_fsid (btrfs_sb (file->f_path.dentry->d_sb)); +dput (parent); +TP_fast_assign_fsid (btrfs_sb (inode->i_sb)); __entry->ino =btrfs_ino (BTRFS_I (inode)); - __entry->parent =btrfs_ino (BTRFS_I (d_inode (dentry->d_parent))); + __entry->parent =btrfs_ino (BTRFS_I (parent_inode)); __entry->datasync = datasync; __entry->root_objectid =BTRFS_I (inode)->root->root_key.objectid;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 5/589 ALSA: hda/realtek: Add mute LED quirk for HP Pavilion 15-eg0xxx
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: César Montoya <[email protected]>
[ Upstream commit 2f388b4e8fdd6b0f27cafd281658daacfd85807e ]
The HP Pavilion 15-eg0xxx with subsystem ID 0x103c87cb uses a Realtek ALC287 codec with a mute LED wired to GPIO pin 4 (mask 0x10). The existing ALC287_FIXUP_HP_GPIO_LED fixup already handles this correctly, but the subsystem ID was missing from the quirk table.
GPIO pin confirmed via manual hda-verb testing:
hda-verb SET_GPIO_MASK 0x10
hda-verb SET_GPIO_DIRECTION 0x10
hda-verb SET_GPIO_DATA 0x10
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -9291,6 +9291,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x8788 ,"HP OMEN 15" ,ALC285_FIXUP_HP_MUTE_LED ),SND_PCI_QUIRK (0x103c ,0x87b7 ,"HP Laptop 14-fq0xxx" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ),SND_PCI_QUIRK (0x103c ,0x87c8 ,"HP" ,ALC287_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x87cb ,"HP Pavilion 15-eg0xxx" ,ALC287_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x87cc ,"HP Pavilion 15-eg0xxx" ,ALC287_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x87d3 ,"HP Laptop 15-gw0xxx" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ), SND_PCI_QUIRK(0x103c, 0x87df, "HP ProBook 430 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 6/589 netfilter: nft_set_pipapo_avx2: dont return non-matching entry on expiry
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit d3c0037ffe1273fa1961e779ff6906234d6cf53c ]
New test case fails unexpectedly when avx2 matching functions are used.
The test first loads a ranomly generated pipapo set with 'ipv4 . port' key, i.e. nft -f foo.
This works. Then, it reloads the set after a flush:
(echo flush set t s; cat foo) | nft -f -
This is expected to work, because its the same set after all and it was already loaded once.
But with avx2, this fails: nft reports a clashing element.
The reported clash is of following form:
We successfully re-inserted
a . b
c . d
Then we try to insert a . d
avx2 finds the already existing a . d, which (due to 'flush set') is marked as invalid in the new generation. It skips the element and moves to next.
Due to incorrect masking, the skip-step finds the next matching element *only considering the first field*,
i.e. we return the already reinserted "a . b", even though the last field is different and the entry should not have been matched.
No such error is reported for the generic c implementation (no avx2) or when the last field has to use the 'nft_pipapo_avx2_lookup_slow' fallback.
Bisection points to7711f4bb4b36 ("netfilter: nft_set_pipapo: fix range overlap detection") but that fix merely uncovers this bug.
Before this commit, the wrong element is returned, but erronously reported as a full, identical duplicate.
The root-cause is too early return in the avx2 match functions. When we process the last field, we should continue to process data until the entire input size has been consumed to make sure no stale bits remain in the map.
--- net/netfilter/nft_set_pipapo_avx2.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
net/netfilter/nft_set_pipapo_avx2.c +10 -10
@@ -242,7 +242,7 @@ static int nft_pipapo_avx2_lookup_4b_2(unsigned long *map, unsigned long *fill, b =nft_pipapo_avx2_refill (i_ul, &map[i_ul], fill, f->mt, last);if (last) -return b; + ret = b;if (unlikely (ret ==-1 )) ret = b /XSAVE_YMM_SIZE ;
@@ -318,7 +318,7 @@ static int nft_pipapo_avx2_lookup_4b_4(unsigned long *map, unsigned long *fill, b =nft_pipapo_avx2_refill (i_ul, &map[i_ul], fill, f->mt, last);if (last) -return b; + ret = b;if (unlikely (ret ==-1 )) ret = b /XSAVE_YMM_SIZE ;
@@ -412,7 +412,7 @@ static int nft_pipapo_avx2_lookup_4b_8(unsigned long *map, unsigned long *fill, b =nft_pipapo_avx2_refill (i_ul, &map[i_ul], fill, f->mt, last);if (last) -return b; + ret = b;if (unlikely (ret ==-1 )) ret = b /XSAVE_YMM_SIZE ;
@@ -502,7 +502,7 @@ static int nft_pipapo_avx2_lookup_4b_12(unsigned long *map, unsigned long *fill, b =nft_pipapo_avx2_refill (i_ul, &map[i_ul], fill, f->mt, last);if (last) -return b; + ret = b;if (unlikely (ret ==-1 )) ret = b /XSAVE_YMM_SIZE ;
@@ -637,7 +637,7 @@ static int nft_pipapo_avx2_lookup_4b_32(unsigned long *map, unsigned long *fill, b =nft_pipapo_avx2_refill (i_ul, &map[i_ul], fill, f->mt, last);if (last) -return b; + ret = b;if (unlikely (ret ==-1 )) ret = b /XSAVE_YMM_SIZE ;
@@ -694,7 +694,7 @@ static int nft_pipapo_avx2_lookup_8b_1(unsigned long *map, unsigned long *fill, b =nft_pipapo_avx2_refill (i_ul, &map[i_ul], fill, f->mt, last);if (last) -return b; + ret = b;if (unlikely (ret ==-1 )) ret = b /XSAVE_YMM_SIZE ;
@@ -758,7 +758,7 @@ static int nft_pipapo_avx2_lookup_8b_2(unsigned long *map, unsigned long *fill, b =nft_pipapo_avx2_refill (i_ul, &map[i_ul], fill, f->mt, last);if (last) -return b; + ret = b;if (unlikely (ret ==-1 )) ret = b /XSAVE_YMM_SIZE ;
@@ -832,7 +832,7 @@ static int nft_pipapo_avx2_lookup_8b_4(unsigned long *map, unsigned long *fill, b =nft_pipapo_avx2_refill (i_ul, &map[i_ul], fill, f->mt, last);if (last) -return b; + ret = b;if (unlikely (ret ==-1 )) ret = b /XSAVE_YMM_SIZE ;
@@ -917,7 +917,7 @@ static int nft_pipapo_avx2_lookup_8b_6(unsigned long *map, unsigned long *fill, b =nft_pipapo_avx2_refill (i_ul, &map[i_ul], fill, f->mt, last);if (last) -return b; + ret = b;if (unlikely (ret ==-1 )) ret = b /XSAVE_YMM_SIZE ;
@@ -1010,7 +1010,7 @@ static int nft_pipapo_avx2_lookup_8b_16(unsigned long *map, unsigned long *fill, b =nft_pipapo_avx2_refill (i_ul, &map[i_ul], fill, f->mt, last);if (last) -return b; + ret = b;if (unlikely (ret ==-1 )) ret = b /XSAVE_YMM_SIZE ;
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 5.10.258-rc1-00600-g01c1356f563d #1 SMP Sat May 30 16:59:39 -00 2026 x86_64 AMD Ryzen 9 9950X 16-Core Processor AuthenticAMD GNU/Linux
Greg Kroah-Hartman
maintainerPATCH 7/589 wifi: wl1251: validate packet IDs before indexing tx_frames
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 0fd56fad9c56356e7fa7a7c52e7ecbf807a44eb0 ]
wl1251_tx_packet_cb() uses the firmware completion ID directly to index the fixed 16-entry wl->tx_frames[] array. The ID is a raw u8 from the completion block, and the callback does not currently verify that it fits the array before dereferencing it.
Reject completion IDs that fall outside wl->tx_frames[] and keep the existing NULL check in the same guard. This keeps the fix local to the trust boundary and avoids touching the rest of the completion flow.
--- drivers/net/wireless/ti/wl1251/tx.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/wireless/ti/wl1251/tx.c +5 -3
@@ -402,12 +402,14 @@ static void wl1251_tx_packet_cb(struct wl1251 *wl,int hdrlen;u8 *frame; - skb = wl->tx_frames[result->id]; -if (skb ==NULL ) { -wl1251_error ("SKB for packet %d is NULL" , result->id); +if (unlikely (result->id >=ARRAY_SIZE (wl->tx_frames) || + wl->tx_frames[result->id] ==NULL )) { +wl1251_error ("invalid packet id %u" , result->id);return ; } + skb = wl->tx_frames[result->id]; + info =IEEE80211_SKB_CB (skb); if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) &&
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 8/589 ASoC: soc-core: call missing INIT_LIST_HEAD() for card_aux_list
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuninori Morimoto <[email protected]>
[ Upstream commit b9eff9732cb0f86a68c9d1592a98ceab47c01e95 ]
Component has "card_aux_list" which is added/deled in bind/unbind aux dev function (A), and used in for_each_card_auxs() loop (B).
static void soc_unbind_aux_dev(...)
{
...
for_each_card_auxs_safe(...) {
...
(A) list_del(&component->card_aux_list);
} ^^^^^^^^^^^^^
}
static int soc_bind_aux_dev(...)
{
...
for_each_card_pre_auxs(...) {
...
(A) list_add(&component->card_aux_list, ...);
} ^^^^^^^^^^^^^
...
}
#define for_each_card_auxs(card, component) \
(B) list_for_each_entry(component, ..., card_aux_list)
^^^^^^^^^^^^^But it has been used without calling INIT_LIST_HEAD().
> git grep card_aux_list sound/soc sound/soc/soc-core.c: list_del(&component->card_aux_list); sound/soc/soc-core.c: list_add(&component->card_aux_list, ...);
call missing INIT_LIST_HEAD() for it.
--- sound/soc/soc-core.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/soc-core.c +1 -0
@@ -2628,6 +2628,7 @@ int snd_soc_component_initialize(struct snd_soc_component *component,INIT_LIST_HEAD (&component->dobj_list);INIT_LIST_HEAD (&component->card_list);INIT_LIST_HEAD (&component->list); +INIT_LIST_HEAD (&component->card_aux_list);mutex_init (&component->io_mutex); component->name =fmt_single_name (dev, &component->id);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 9/589 HID: quirks: add HID_QUIRK_ALWAYS_POLL for 8BitDo Pro 3
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: leo vriska <[email protected]>
[ Upstream commit 532743944324a873bbaf8620fcabcd0e69e30c36 ]
According to a mailing list report [1], this controller's predecessor has the same issue. However, it uses the xpad driver instead of HID, so this quirk wouldn't apply.
[1]: https://lore.kernel.org/linux-input/[email protected]/
--- drivers/hid/hid-ids.h | 3 +++ drivers/hid/hid-quirks.c | 1 + 2 files changed, 4 insertions(+)
drivers/hid/hid-ids.h +3 -0
@@ -22,6 +22,9 @@#define USB_DEVICE_ID_3M2256 0x0502#define USB_DEVICE_ID_3M3266 0x0506 +#define USB_VENDOR_ID_8BITDO 0x2dc8 +#define USB_DEVICE_ID_8BITDO_PRO_3 0x6009 +#define USB_VENDOR_ID_A4TECH 0x09da#define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006#define USB_DEVICE_ID_A4TECH_X5_005D 0x000a
drivers/hid/hid-quirks.c +1 -0
@@ -25,6 +25,7 @@*/ static const struct hid_device_id hid_quirks[] = { + {HID_USB_DEVICE (USB_VENDOR_ID_8BITDO ,USB_DEVICE_ID_8BITDO_PRO_3 ),HID_QUIRK_ALWAYS_POLL }, {HID_USB_DEVICE (USB_VENDOR_ID_AASHIMA ,USB_DEVICE_ID_AASHIMA_GAMEPAD ),HID_QUIRK_BADPAD }, {HID_USB_DEVICE (USB_VENDOR_ID_AASHIMA ,USB_DEVICE_ID_AASHIMA_PREDATOR ),HID_QUIRK_BADPAD }, {HID_USB_DEVICE (USB_VENDOR_ID_ADATA_XPG ,USB_VENDOR_ID_ADATA_XPG_WL_GAMING_MOUSE ),HID_QUIRK_ALWAYS_POLL },
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 10/589 HID: roccat: fix use-after-free in roccat_report_event
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benoît Sevens <[email protected]>
[ Upstream commit d802d848308b35220f21a8025352f0c0aba15c12 ]
roccat_report_event() iterates over the device->readers list without holding the readers_lock. This allows a concurrent roccat_release() to remove and free a reader while it's still being accessed, leading to a use-after-free.
Protect the readers list traversal with the readers_lock mutex.
--- drivers/hid/hid-roccat.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hid/hid-roccat.c +2 -0
@@ -257,6 +257,7 @@ int roccat_report_event(int minor, u8 const *data)if (!new_value)return -ENOMEM ; +mutex_lock (&device->readers_lock);mutex_lock (&device->cbuf_lock); report = &device->cbuf[device->cbuf_end];
@@ -279,6 +280,7 @@ int roccat_report_event(int minor, u8 const *data) }mutex_unlock (&device->cbuf_lock); +mutex_unlock (&device->readers_lock);wake_up_interruptible (&device->wait);return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 11/589 ata: ahci: force 32-bit DMA for JMicron JMB582/JMB585
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arthur Husband <[email protected]>
[ Upstream commit 105c42566a550e2d05fc14f763216a8765ee5d0e ]
The JMicron JMB585 (and JMB582) SATA controllers advertise 64-bit DMA support via the S64A bit in the AHCI CAP register, but their 64-bit DMA implementation is defective. Under sustained I/O, DMA transfers targeting addresses above 4GB silently corrupt data -- writes land at incorrect memory addresses with no errors logged.
The failure pattern is similar to the ASMedia ASM1061 (commit 20730e9b2778 ("ahci: add 43-bit DMA address quirk for ASMedia ASM1061 controllers")), which also falsely advertised full 64-bit DMA support. However, the JMB585 requires a stricter 32-bit DMA mask rather than 43-bit, as corruption occurs with any address above 4GB.
On the Minisforum N5 Pro specifically, the combination of the JMB585's broken 64-bit DMA with the AMD Family 1Ah (Strix Point) IOMMU causes silent data corruption that is only detectable via checksumming filesystems (BTRFS/ZFS scrub). The corruption occurs when 32-bit IOVA space is exhausted and the kernel transparently switches to 64-bit DMA addresses.
Add device-specific PCI ID entries for the JMB582 (0x0582) and JMB585 (0x0585) before the generic JMicron class match, using a new board type that combines AHCI_HFLAG_IGN_IRQ_IF_ERR (preserving existing behavior) with AHCI_HFLAG_32BIT_ONLY to force 32-bit DMA masks.
--- drivers/ata/ahci.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/ata/ahci.c +14 -0
@@ -61,6 +61,7 @@ enum board_ids {/* board IDs for specific chipsets in alphabetical order */ board_ahci_al, board_ahci_avn, + board_ahci_jmb585, board_ahci_mcp65, board_ahci_mcp77, board_ahci_mcp89,
@@ -200,6 +201,15 @@ static const struct ata_port_info ahci_port_info[] = { .udma_mask = ATA_UDMA6, .port_ops = &ahci_avn_ops, }, + /* JMicron JMB582/585: 64-bit DMA is broken, force 32-bit */ + [board_ahci_jmb585] = { +AHCI_HFLAGS (AHCI_HFLAG_IGN_IRQ_IF_ERR | + AHCI_HFLAG_32BIT_ONLY), + .flags = AHCI_FLAG_COMMON, + .pio_mask = ATA_PIO4, + .udma_mask = ATA_UDMA6, + .port_ops = &ahci_ops, + }, [board_ahci_mcp65] = {AHCI_HFLAGS (AHCI_HFLAG_NO_FPDMA_AA |AHCI_HFLAG_NO_PMP | AHCI_HFLAG_YES_NCQ),
@@ -436,6 +446,10 @@ static const struct pci_device_id ahci_pci_tbl[] = {/* Elkhart Lake IDs 0x4b60 & 0x4b62 https://sata-io.org/product/8803 not tested yet */ { PCI_VDEVICE(INTEL, 0x4b63), board_ahci_low_power }, /* Elkhart Lake AHCI */ +/* JMicron JMB582/585: force 32-bit DMA (broken 64-bit implementation) */ + { PCI_VDEVICE(JMICRON, 0x0582), board_ahci_jmb585 }, + { PCI_VDEVICE(JMICRON, 0x0585), board_ahci_jmb585 }, +/* JMicron 360/1/3/5/6, match class to avoid IDE function */ { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci_ign_iferr },
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 12/589 wifi: brcmfmac: validate bsscfg indices in IF events
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 304950a467d83678bd0b0f46331882e2ac23b12d ]
brcmf_fweh_handle_if_event() validates the firmware-provided interface index before it touches drvr->iflist[], but it still uses the raw bsscfgidx field as an array index without a matching range check.
Reject IF events whose bsscfg index does not fit in drvr->iflist[] before indexing the interface array.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c +5 -0
@@ -151,6 +151,11 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr,bphy_err (drvr,"invalid interface index: %u\n" , ifevent->ifidx);return ; } +if (ifevent->bsscfgidx >=BRCMF_MAX_IFS ) { +bphy_err (drvr,"invalid bsscfg index: %u\n" , + ifevent->bsscfgidx); +return ; + } ifp = drvr->iflist[ifevent->bsscfgidx];
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 13/589 ASoC: stm32_sai: fix incorrect BCLK polarity for DSP_A/B, LEFT_J
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Merta <[email protected]>
[ Upstream commit 0669631dbccd41cf3ca7aa70213fcd8bb41c4b38 ]
The STM32 SAI driver do not set the clock strobing bit (CKSTR) for DSP_A, DSP_B and LEFT_J formats, causing data to be sampled on the wrong BCLK edge when SND_SOC_DAIFMT_NB_NF is used.
Per ALSA convention, NB_NF requires sampling on the rising BCLK edge. The STM32MP25 SAI reference manual states that CKSTR=1 is required for signals received by the SAI to be sampled on the SCK rising edge. Without setting CKSTR=1, the SAI samples on the falling edge, violating the NB_NF convention. For comparison, the NXP FSL SAI driver correctly sets FSL_SAI_CR2_BCP for DSP_A, DSP_B and LEFT_J, consistent with its I2S handling.
This patch adds SAI_XCR1_CKSTR for DSP_A, DSP_B and LEFT_J in stm32_sai_set_dai_fmt which was verified empirically with a cs47l35 codec. RIGHT_J (LSB) is not investigated and addressed by this patch.
Note: the STM32 I2S driver (stm32_i2s_set_dai_fmt) may have the same issue for DSP_A mode, as I2S_CGFR_CKPOL is not set. This has not been verified and is left for a separate investigation.
--- sound/soc/stm/stm32_sai_sub.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/stm/stm32_sai_sub.c +3 -0
@@ -671,6 +671,7 @@ static int stm32_sai_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)break ;/* Left justified */ case SND_SOC_DAIFMT_MSB : + cr1 |=SAI_XCR1_CKSTR ; frcr |=SAI_XFRCR_FSPOL |SAI_XFRCR_FSDEF ;break ;/* Right justified */
@@ -678,9 +679,11 @@ static int stm32_sai_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) frcr |=SAI_XFRCR_FSPOL |SAI_XFRCR_FSDEF ;break ;case SND_SOC_DAIFMT_DSP_A : + cr1 |=SAI_XCR1_CKSTR ; frcr |=SAI_XFRCR_FSPOL |SAI_XFRCR_FSOFF ;break ;case SND_SOC_DAIFMT_DSP_B : + cr1 |=SAI_XCR1_CKSTR ; frcr |=SAI_XFRCR_FSPOL ;break ;default :
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 14/589 arm64: dts: imx8mq: Set the correct gpu_ahb clock frequency
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Krzyszkowiak <[email protected]>
[ Upstream commit 1f99b5d93d99ca17d50b386a674d0ce1f20932d8 ]
According to i.MX 8M Quad Reference Manual, GPU_AHB_CLK_ROOT's maximum frequency is 400MHz.
--- arch/arm64/boot/dts/freescale/imx8mq.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mq.dtsi +1 -1
@@ -1137,7 +1137,7 @@ gpu: gpu@38000000 { <&clk IMX8MQ_GPU_PLL_OUT>, <&clk IMX8MQ_GPU_PLL>; assigned-clock-rates = <800000000>, <800000000>, - <800000000>, <800000000>, <0>; + <800000000>, <400000000>, <0>; power-domains = <&pgc_gpu>; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 15/589 PCI: hv: Set default NUMA node to 0 for devices without affinity info
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Long Li <[email protected]>
[ Upstream commit 7b3b1e5a87b2f5e35c52b5386d7c327be869454f ]
When hv_pci_assign_numa_node() processes a device that does not have HV_PCI_DEVICE_FLAG_NUMA_AFFINITY set or has an out-of-range virtual_numa_node, the device NUMA node is left unset. On x86_64, the uninitialized default happens to be 0, but on ARM64 it is NUMA_NO_NODE (-1).
Tests show that when no NUMA information is available from the Hyper-V host, devices perform best when assigned to node 0. With NUMA_NO_NODE the kernel may spread work across NUMA nodes, which degrades performance on Hyper-V, particularly for high-throughput devices like MANA.
Always set the device NUMA node to 0 before the conditional NUMA affinity check, so that devices get a performant default when the host provides no NUMA information, and behavior is consistent on both x86_64 and ARM64.
--- drivers/pci/controller/pci-hyperv.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/pci/controller/pci-hyperv.c +8 -0
@@ -1901,6 +1901,14 @@ static void hv_pci_assign_numa_node(struct hv_pcibus_device *hbus)if (!hv_dev)continue ; +/* +* If the Hyper-V host doesn't provide a NUMA node for the +* device, default to node 0. With NUMA_NO_NODE the kernel +* may spread work across NUMA nodes, which degrades +* performance on Hyper-V. +*/ +set_dev_node (&dev->dev,0 ); +if (hv_dev->desc.flags &HV_PCI_DEVICE_FLAG_NUMA_AFFINITY && hv_dev->desc.virtual_numa_node <num_possible_nodes ())/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 16/589 drm/vc4: Fix memory leak of BO array in hang state
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maíra Canal <[email protected]>
[ Upstream commit f4dfd6847b3e5d24e336bca6057485116d17aea4 ]
The hang state's BO array is allocated separately with kzalloc() in vc4_save_hang_state() but never freed in vc4_free_hang_state(). Add the missing kfree() for the BO array before freeing the hang state struct.
--- drivers/gpu/drm/vc4/vc4_gem.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/vc4/vc4_gem.c +1 -0
@@ -60,6 +60,7 @@ vc4_free_hang_state(struct drm_device *dev, struct vc4_hang_state *state)for (i =0 ; i < state->user_state.bo_count; i++)drm_gem_object_put (state->bo[i]); +kfree (state->bo);kfree (state); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 17/589 drm/vc4: Fix a memory leak in hang state error path
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maíra Canal <[email protected]>
[ Upstream commit 9525d169e5fd481538cf8c663cc5839e54f2e481 ]
When vc4_save_hang_state() encounters an early return condition, it returns without freeing the previously allocated kernel_state, leaking memory.
Add the missing kfree() calls by consolidating the early return paths into a single place.
--- drivers/gpu/drm/vc4/vc4_gem.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/gpu/drm/vc4/vc4_gem.c +10 -8
@@ -166,10 +166,8 @@ vc4_save_hang_state(struct drm_device *dev)spin_lock_irqsave (&vc4->job_lock, irqflags); exec[0 ] =vc4_first_bin_job (vc4); exec[1 ] =vc4_first_render_job (vc4); -if (!exec[0 ] && !exec[1 ]) { -spin_unlock_irqrestore (&vc4->job_lock, irqflags); -return ; - } +if (!exec[0 ] && !exec[1 ]) + goto err_free_state;/* Get the bos from both binner and renderer into hang state. */ state->bo_count =0 ;
@@ -186,10 +184,8 @@ vc4_save_hang_state(struct drm_device *dev) kernel_state->bo =kcalloc (state->bo_count,sizeof (*kernel_state->bo),GFP_ATOMIC ); -if (!kernel_state->bo) { -spin_unlock_irqrestore (&vc4->job_lock, irqflags); -return ; - } +if (!kernel_state->bo) + goto err_free_state; k =0 ;for (i =0 ; i <2 ; i++) {
@@ -281,6 +277,12 @@ vc4_save_hang_state(struct drm_device *dev) vc4->hang_state = kernel_state;spin_unlock_irqrestore (&vc4->job_lock, irqflags); } + +return ; + +err_free_state: +spin_unlock_irqrestore (&vc4->job_lock, irqflags); +kfree (kernel_state); } static void
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 18/589 drm/vc4: Protect madv read in vc4_gem_object_mmap() with madv_lock
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maíra Canal <[email protected]>
[ Upstream commit 338c56050d8e892604da97f67bfa8cc4015a955f ]
The mmap callback reads bo->madv without holding madv_lock, racing with concurrent DRM_IOCTL_VC4_GEM_MADVISE calls that modify the field under the same lock. Add the missing locking to prevent the data race.
--- drivers/gpu/drm/vc4/vc4_bo.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/vc4/vc4_bo.c +3 -0
@@ -719,12 +719,15 @@ int vc4_mmap(struct file *filp, struct vm_area_struct *vma)return -EINVAL ; } +mutex_lock (&bo->madv_lock);if (bo->madv !=VC4_MADV_WILLNEED ) {DRM_DEBUG ("mmaping of %s BO not allowed\n" , bo->madv ==VC4_MADV_DONTNEED ?"purgeable" :"purged" ); +mutex_unlock (&bo->madv_lock);return -EINVAL ; } +mutex_unlock (&bo->madv_lock);/* * Clear the VM_PFNMAP flag that was set by drm_gem_mmap(), and set the
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 19/589 net: sched: act_csum: validate nested VLAN headers
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruide Cao <[email protected]>
[ Upstream commit c842743d073bdd683606cb414eb0ca84465dd834 ]
tcf_csum_act() walks nested VLAN headers directly from skb->data when an skb still carries in-payload VLAN tags. The current code reads vlan->h_vlan_encapsulated_proto and then pulls VLAN_HLEN bytes without first ensuring that the full VLAN header is present in the linear area.
If only part of an inner VLAN header is linearized, accessing h_vlan_encapsulated_proto reads past the linear area, and the following skb_pull(VLAN_HLEN) may violate skb invariants.
Fix this by requiring pskb_may_pull(skb, VLAN_HLEN) before accessing and pulling each nested VLAN header. If the header still is not fully available, drop the packet through the existing error path.
--- net/sched/act_csum.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/sched/act_csum.c +5 -1
@@ -602,8 +602,12 @@ static int tcf_csum_act(struct sk_buff *skb, const struct tc_action *a, protocol = skb->protocol; orig_vlan_tag_present = true; }else { -struct vlan_hdr *vlan = (struct vlan_hdr *)skb->data; +struct vlan_hdr *vlan; +if (!pskb_may_pull (skb,VLAN_HLEN )) + goto drop; + + vlan = (struct vlan_hdr *)skb->data; protocol = vlan->h_vlan_encapsulated_proto;skb_pull (skb,VLAN_HLEN );skb_reset_network_header (skb);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 20/589 net: lapbether: Close the LAPB device before its underlying Ethernet device closes
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xie He <[email protected]>
[ Upstream commit 536e1004d273cf55d0e6c6ab6bfe74dc60464cd2 ]
When a virtual LAPB device's underlying Ethernet device closes, the LAPB device is also closed.
However, currently the LAPB device is closed after the Ethernet device closes. It would be better to close it before the Ethernet device closes. This would allow the LAPB device to transmit a last frame to notify the other side that it is disconnecting.
Stable-dep-of: b120e4432f9f ("net: lapbether: handle NETDEV_PRE_TYPE_CHANGE")
--- drivers/net/wan/lapbether.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wan/lapbether.c +2 -2
@@ -415,8 +415,8 @@ static int lapbeth_device_event(struct notifier_block *this,if (lapbeth_get_x25_dev (dev) ==NULL )lapbeth_new_device (dev);break ; -case NETDEV_DOWN : -/* ethernet device closed -> close LAPB interface */ +case NETDEV_GOING_DOWN : +/* ethernet device closes -> close LAPB interface */ lapbeth =lapbeth_get_x25_dev (dev);if (lapbeth)dev_close (lapbeth->axdev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 21/589 net: lapbether: remove trailing whitespaces
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Li <[email protected]>
[ Upstream commit 2e350780ae4f2be8a2525929b6c69c2dd9591a20 ]
This patch removes trailing whitespaces.
Stable-dep-of: b120e4432f9f ("net: lapbether: handle NETDEV_PRE_TYPE_CHANGE")
--- drivers/net/wan/lapbether.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wan/lapbether.c +3 -3
@@ -6,7 +6,7 @@* * This is a "pseudo" network driver to allow LAPB over Ethernet. * -* This driver can use any ethernet destination address, and can be +* This driver can use any ethernet destination address, and can be * limited to accept frames from one dedicated ethernet card only. * * History
@@ -67,7 +67,7 @@ static struct lapbethdev *lapbeth_get_x25_dev(struct net_device *dev)struct lapbethdev *lapbeth;list_for_each_entry_rcu (lapbeth, &lapbeth_devices, node,lockdep_rtnl_is_held ()) { -if (lapbeth->ethdev == dev) +if (lapbeth->ethdev == dev)return lapbeth; }return NULL ;
@@ -418,7 +418,7 @@ static int lapbeth_device_event(struct notifier_block *this,case NETDEV_GOING_DOWN :/* ethernet device closes -> close LAPB interface */ lapbeth =lapbeth_get_x25_dev (dev); -if (lapbeth) +if (lapbeth)dev_close (lapbeth->axdev);break ;case NETDEV_UNREGISTER :
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 22/589 net: lapbether: replace comparison to NULL with "lapbeth_get_x25_dev"
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Li <[email protected]>
[ Upstream commit d49859601d72baef143703c6944a4e41921f7e6e ]
According to the chackpatch.pl, comparison to NULL could be written "lapbeth_get_x25_dev".
Stable-dep-of: b120e4432f9f ("net: lapbether: handle NETDEV_PRE_TYPE_CHANGE")
--- drivers/net/wan/lapbether.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wan/lapbether.c +1 -1
@@ -412,7 +412,7 @@ static int lapbeth_device_event(struct notifier_block *this,switch (event) {case NETDEV_UP :/* New ethernet device -> new LAPB interface */ -if (lapbeth_get_x25_dev (dev) ==NULL ) +if (!lapbeth_get_x25_dev (dev))lapbeth_new_device (dev);break ;case NETDEV_GOING_DOWN :
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 23/589 net: lapbether: handle NETDEV_PRE_TYPE_CHANGE
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit b120e4432f9f56c7103133d6a11245e617695adb ]
lapbeth_data_transmit() expects the underlying device type to be ARPHRD_ETHER.
Returning NOTIFY_BAD from lapbeth_device_event() makes sure bonding driver can not break this expectation.
--- drivers/net/wan/lapbether.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/net/wan/lapbether.c +8 -5
@@ -400,33 +400,36 @@ static void lapbeth_free_device(struct lapbethdev *lapbeth)static int lapbeth_device_event (struct notifier_block *this,unsigned long event,void *ptr) { -struct lapbethdev *lapbeth;struct net_device *dev =netdev_notifier_info_to_dev (ptr); +struct lapbethdev *lapbeth;if (dev_net (dev) != &init_net)return NOTIFY_DONE ; -if (!dev_is_ethdev (dev) && !lapbeth_get_x25_dev (dev)) + lapbeth =lapbeth_get_x25_dev (dev); +if (!dev_is_ethdev (dev) && !lapbeth)return NOTIFY_DONE ;switch (event) {case NETDEV_UP :/* New ethernet device -> new LAPB interface */ -if (!lapbeth_get_x25_dev (dev)) +if (!lapbeth)lapbeth_new_device (dev);break ;case NETDEV_GOING_DOWN :/* ethernet device closes -> close LAPB interface */ - lapbeth =lapbeth_get_x25_dev (dev);if (lapbeth)dev_close (lapbeth->axdev);break ;case NETDEV_UNREGISTER :/* ethernet device disappears -> remove LAPB interface */ - lapbeth =lapbeth_get_x25_dev (dev);if (lapbeth)lapbeth_free_device (lapbeth);break ; +case NETDEV_PRE_TYPE_CHANGE : +/* Our underlying device type must not change. */ +if (lapbeth) +return NOTIFY_BAD ; }return NOTIFY_DONE ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 24/589 tracing/probe: reject non-closed empty immediate strings
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 4346be6577aaa04586167402ae87bbdbe32484a4 ]
parse_probe_arg() accepts quoted immediate strings and passes the body after the opening quote to __parse_imm_string(). That helper currently computes strlen(str) and immediately dereferences str[len - 1], which underflows when the body is empty and not closed with double-quotation.
Reject empty non-closed immediate strings before checking for the closing quote.
--- kernel/trace/trace_probe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_probe.c +1 -1
@@ -341,7 +341,7 @@ static int __parse_imm_string(char *str, char **pbuf, int offs) {size_t len =strlen (str); -if (str[len -1 ] !='"' ) { +if (!len || str[len -1 ] !='"' ) {trace_probe_log_err (offs + len,IMMSTR_NO_CLOSE );return -EINVAL ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 25/589 e1000: check return value of e1000_read_eeprom
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Agalakov Daniil <[email protected]>
[ Upstream commit d3baa34a470771399c1495bc04b1e26ac15d598e ]
[Why]e1000_set_eeprom() performs a read-modify-write operation when the write range is not word-aligned. This requires reading the first and last words of the range from the EEPROM to preserve the unmodified bytes.
However, the code does not check the return value of e1000_read_eeprom(). If the read fails, the operation continues using uninitialized data from eeprom_buff. This results in corrupted data being written back to the EEPROM for the boundary words.
Add the missing error checks and abort the operation if reading fails.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/e1000/e1000_ethtool.c +7 -1
@@ -496,14 +496,19 @@ static int e1000_set_eeprom(struct net_device *netdev,*/ ret_val =e1000_read_eeprom (hw, first_word,1 , &eeprom_buff[0 ]); +if (ret_val) + goto out; + ptr++; } -if (((eeprom->offset + eeprom->len) &1 ) && (ret_val ==0 )) { +if ((eeprom->offset + eeprom->len) &1 ) {/* need read/modify/write of last changed EEPROM word * only the first byte of the word is being modified */ ret_val =e1000_read_eeprom (hw, last_word,1 , &eeprom_buff[last_word - first_word]); +if (ret_val) + goto out; }/* Device's eeprom is always little-endian, word addressable */
@@ -522,6 +527,7 @@ static int e1000_set_eeprom(struct net_device *netdev,if ((ret_val ==0 ) && (first_word <=EEPROM_CHECKSUM_REG ))e1000_update_eeprom_checksum (hw); +out:kfree (eeprom_buff);return ret_val; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 26/589 xsk: tighten UMEM headroom validation to account for tailroom and min frame
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej Fijalkowski <[email protected]>
[ Upstream commit a315e022a72d95ef5f1d4e58e903cb492b0ad931 ]
The current headroom validation in xdp_umem_reg() could leave us with insufficient space dedicated to even receive minimum-sized ethernet frame. Furthermore if multi-buffer would come to play then skb_shared_info stored at the end of XSK frame would be corrupted.
HW typically works with 128-aligned sizes so let us provide this value as bare minimum.
Multi-buffer setting is known later in the configuration process so besides accounting for 128 bytes, let us also take care of tailroom space upfront.
--- net/xdp/xdp_umem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/xdp/xdp_umem.c +2 -1
@@ -199,7 +199,8 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)if (!unaligned_chunks && chunks_rem)return -EINVAL ; -if (headroom >= chunk_size -XDP_PACKET_HEADROOM ) +if (headroom > chunk_size -XDP_PACKET_HEADROOM - +SKB_DATA_ALIGN (sizeof (struct skb_shared_info )) -128 )return -EINVAL ; umem->size = size;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 27/589 xfrm: Wait for RCU readers during policy netns exit
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Klassert <[email protected]>
[ Upstream commit 069daad4f2ae9c5c108131995529d5f02392c446 ]
xfrm_policy_fini() frees the policy_bydst hash tables after flushing the policy work items and deleting all policies, but it does not wait for concurrent RCU readers to leave their read-side critical sections first.
The policy_bydst tables are published via rcu_assign_pointer() and are looked up through rcu_dereference_check(), so netns teardown must also wait for an RCU grace period before freeing the table memory.
Fix this by adding synchronize_rcu() before freeing the policy hash tables.
--- net/xfrm/xfrm_policy.c | 2 ++ 1 file changed, 2 insertions(+)
net/xfrm/xfrm_policy.c +2 -0
@@ -4166,6 +4166,8 @@ static void xfrm_policy_fini(struct net *net)#endif xfrm_policy_flush (net,XFRM_POLICY_TYPE_MAIN , false); +synchronize_rcu (); +WARN_ON (!list_empty (&net->xfrm.policy_all));for (dir =0 ; dir <XFRM_POLICY_MAX ; dir++) {
Signature · 1 line
2.53.0
Re: [PATCH 5.10 027/589] xfrm: Wait for RCU readers during policy netns exit
Quoted 7 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Klassert <[email protected]>
[ Upstream commit
069daad4f2ae9c5c108131995529d5f02392c446]
[...]
This is broken - it needs commit 3e5241731847 "xfrm: move policy_bydst RCU sync from per-netns .exit to .pre_exit" as a further fix.
I haven't checked whether that applies cleanly or needs backporting work.
Ben.
Signature · 3 lines
Ben Hutchings The Peter principle: In a hierarchy, every employee tends to rise to their level of incompetence.
Sasha Levin
maintainerRe: [PATCH 5.10 027/589] xfrm: Wait for RCU readers during policy netns exit
Quoted 5 lines · Ben Hutchings
This is broken - it needs commit
3e5241731847"xfrm: movepolicy_bydstRCU sync from per-netns .exit to .pre_exit" as a further fix.I haven't checked whether that applies cleanly or needs backporting work.
I've dropped this from the 5.10, 5.15 and 6.1 queues; I'll (try to) re-queue it together with the backported follow-up. Thanks for the catch.
--
Thanks,
Sasha
Sasha Levin
maintainerRe: [PATCH 5.10 027/589] xfrm: Wait for RCU readers during policy netns exit
In reply to Ben HutchingsQuoted 2 lines · Ben Hutchings
This is broken - it needs commit
3e5241731847"xfrm: movepolicy_bydstRCU sync from per-netns .exit to .pre_exit" as a further fix.
Now queued from mainline (3e52417318473782) together with the original commit for 7.0.y, 6.18.y and 6.12.y.
--
Thanks,
Sasha
Greg Kroah-Hartman
maintainerPATCH 28/589 xfrm_user: fix info leak in build_mapping()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
[ Upstream commit 1beb76b2053b68c491b78370794b8ff63c8f8c02 ]
struct xfrm_usersa_id has a one-byte padding hole after the proto field, which ends up never getting set to zero before copying out to userspace. Fix that up by zeroing out the whole structure before setting individual variables.
--- net/xfrm/xfrm_user.c | 1 + 1 file changed, 1 insertion(+)
net/xfrm/xfrm_user.c +1 -0
@@ -3493,6 +3493,7 @@ static int build_mapping(struct sk_buff *skb, struct xfrm_state *x, um =nlmsg_data (nlh); +memset (&um->id,0 ,sizeof (um->id));memcpy (&um->id.daddr, &x->id.daddr,sizeof (um->id.daddr)); um->id.spi = x->id.spi; um->id.family = x->props.family;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 29/589 netfilter: nfnetlink_log: initialize nfgenmsg in NLMSG_DONE terminator
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiang Mei <[email protected]>
[ Upstream commit 1f3083aec8836213da441270cdb1ab612dd82cf4 ]
When batching multiple NFLOG messages (inst->qlen > 1), __nfulnl_send() appends an NLMSG_DONE terminator with sizeof(struct nfgenmsg) payload via nlmsg_put(), but never initializes the nfgenmsg bytes. The nlmsg_put() helper only zeroes alignment padding after the payload, not the payload itself, so four bytes of stale kernel heap data are leaked to userspace in the NLMSG_DONE message body.
Use nfnl_msg_put() to build the NLMSG_DONE terminator, which initializes the nfgenmsg payload via nfnl_fill_hdr(), consistent with how __build_packet_message() already constructs NFULNL_MSG_PACKET headers.
--- net/netfilter/nfnetlink_log.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/netfilter/nfnetlink_log.c +4 -4
@@ -346,10 +346,10 @@ static void __nfulnl_send(struct nfulnl_instance *inst) {if (inst->qlen >1 ) { -struct nlmsghdr *nlh =nlmsg_put (inst->skb,0 ,0 , -NLMSG_DONE , -sizeof (struct nfgenmsg ), -0 ); +struct nlmsghdr *nlh =nfnl_msg_put (inst->skb,0 ,0 , +NLMSG_DONE ,0 , +AF_UNSPEC ,NFNETLINK_V0 , +htons (inst->group_num));if (WARN_ONCE (!nlh,"bad nlskb size: %u, tailroom %d\n" , inst->skb->len,skb_tailroom (inst->skb))) {kfree_skb (inst->skb);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 30/589 netfilter: xt_multiport: validate range encoding in checkentry
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ren Wei <[email protected]>
[ Upstream commit ff64c5bfef12461df8450e0f50bb693b5269c720 ]
ports_match_v1() treats any non-zero pflags entry as the start of a port range and unconditionally consumes the next ports[] element as the range end.
The checkentry path currently validates protocol, flags and count, but it does not validate the range encoding itself. As a result, malformed rules can mark the last slot as a range start or place two range starts back to back, leaving ports_match_v1() to step past the last valid ports[] element while interpreting the rule.
Reject malformed multiport v1 rules in checkentry by validating that each range start has a following element and that the following element is not itself marked as another range start.
--- net/netfilter/xt_multiport.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-)
net/netfilter/xt_multiport.c +30 -4
@@ -105,6 +105,28 @@ multiport_mt(const struct sk_buff *skb, struct xt_action_param *par)return ports_match_v1 (multiinfo,ntohs (pptr[0 ]),ntohs (pptr[1 ])); } +static bool +multiport_valid_ranges (const struct xt_multiport_v1 *multiinfo) +{ +unsigned int i; + +for (i =0 ; i < multiinfo->count; i++) { +if (!multiinfo->pflags[i]) +continue ; + +if (++i >= multiinfo->count) +return false; + +if (multiinfo->pflags[i]) +return false; + +if (multiinfo->ports[i -1 ] > multiinfo->ports[i]) +return false; + } + +return true; +} + static inline bool check(u_int16_t proto, u_int8_t ip_invflags,
@@ -127,8 +149,10 @@ static int multiport_mt_check(const struct xt_mtchk_param *par)const struct ipt_ip *ip = par->entryinfo;const struct xt_multiport_v1 *multiinfo = par->matchinfo; -return check (ip->proto, ip->invflags, multiinfo->flags, - multiinfo->count) ?0 : -EINVAL ; +if (!check (ip->proto, ip->invflags, multiinfo->flags, multiinfo->count)) +return -EINVAL ; + +return multiport_valid_ranges (multiinfo) ?0 : -EINVAL ; }static int multiport_mt6_check (const struct xt_mtchk_param *par)
@@ -136,8 +160,10 @@ static int multiport_mt6_check(const struct xt_mtchk_param *par)const struct ip6t_ip6 *ip = par->entryinfo;const struct xt_multiport_v1 *multiinfo = par->matchinfo; -return check (ip->proto, ip->invflags, multiinfo->flags, - multiinfo->count) ?0 : -EINVAL ; +if (!check (ip->proto, ip->invflags, multiinfo->flags, multiinfo->count)) +return -EINVAL ; + +return multiport_valid_ranges (multiinfo) ?0 : -EINVAL ; }static struct xt_match multiport_mt_reg[]__read_mostly = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 31/589 netfilter: ip6t_eui64: reject invalid MAC header for all packets
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhengchuan Liang <[email protected]>
[ Upstream commit fdce0b3590f724540795b874b4c8850c90e6b0a8 ]
eui64_mt6() derives a modified EUI-64 from the Ethernet source address and compares it with the low 64 bits of the IPv6 source address.
The existing guard only rejects an invalid MAC header when par->fragoff != 0. For packets with par->fragoff == 0, eui64_mt6() can still reach eth_hdr(skb) even when the MAC header is not valid.
Fix this by removing the par->fragoff != 0 condition so that packets with an invalid MAC header are rejected before accessing eth_hdr(skb).
--- net/ipv6/netfilter/ip6t_eui64.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/ipv6/netfilter/ip6t_eui64.c +1 -2
@@ -22,8 +22,7 @@ eui64_mt6(const struct sk_buff *skb, struct xt_action_param *par)unsigned char eui64[8 ];if (!(skb_mac_header (skb) >= skb->head && -skb_mac_header (skb) +ETH_HLEN <= skb->data) && - par->fragoff !=0 ) { +skb_mac_header (skb) +ETH_HLEN <= skb->data)) { par->hotdrop = true;return false; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 32/589 af_unix: read UNIX_DIAG_VFS data under unix_state_lock
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiexun Wang <[email protected]>
[ Upstream commit 39897df386376912d561d4946499379effa1e7ef ]
Exact UNIX diag lookups hold a reference to the socket, but not to u->path. Meanwhile, unix_release_sock() clears u->path under unix_state_lock() and drops the path reference after unlocking.
Read the inode and device numbers for UNIX_DIAG_VFS while holding unix_state_lock(), then emit the netlink attribute after dropping the lock.
This keeps the VFS data stable while the reply is being built.
--- net/unix/diag.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
net/unix/diag.c +13 -8
@@ -25,18 +25,23 @@ static int sk_diag_dump_name(struct sock *sk, struct sk_buff *nlskb)static int sk_diag_dump_vfs (struct sock *sk,struct sk_buff *nlskb) { -struct dentry *dentry =unix_sk (sk)->path.dentry; +struct unix_diag_vfs uv; +struct dentry *dentry; +bool have_vfs = false; +unix_state_lock (sk); + dentry =unix_sk (sk)->path.dentry;if (dentry) { -struct unix_diag_vfs uv = { - .udiag_vfs_ino =d_backing_inode (dentry)->i_ino, - .udiag_vfs_dev = dentry->d_sb->s_dev, - }; - -return nla_put (nlskb,UNIX_DIAG_VFS ,sizeof (uv), &uv); + uv.udiag_vfs_ino =d_backing_inode (dentry)->i_ino; + uv.udiag_vfs_dev = dentry->d_sb->s_dev; + have_vfs = true; } +unix_state_unlock (sk); -return 0 ; +if (!have_vfs) +return 0 ; + +return nla_put (nlskb,UNIX_DIAG_VFS ,sizeof (uv), &uv); }static int sk_diag_dump_peer (struct sock *sk,struct sk_buff *nlskb)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 33/589 l2tp: Drop large packets with UDP encap
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alice Mikityanska <[email protected]>
[ Upstream commit ebe560ea5f54134279356703e73b7f867c89db13 ]
syzbot reported a WARN on my patch series [1]. The actual issue is an overflow of 16-bit UDP length field, and it exists in the upstream code. My series added a debug WARN with an overflow check that exposed the issue, that's why syzbot tripped on my patches, rather than on upstream code.
syzbot's repro:
r0 = socket$pppl2tp(0x18, 0x1, 0x1)
r1 = socket$inet6_udp(0xa, 0x2, 0x0)
connect$inet6(r1, &(0x7f00000000c0)={0xa, 0x0, 0x0, @loopback, 0xfffffffc}, 0x1c)
connect$pppl2tp(r0, &(0x7f0000000240)=@pppol2tpin6={0x18, 0x1, {0x0, r1, 0x4, 0x0, 0x0, 0x0, {0xa, 0x4e22, 0xffff, @ipv4={'\x00', '\xff\xff', @empty}}}}, 0x32) writev(r0, &(0x7f0000000080)=[{&(0x7f0000000000)="ee", 0x34000}], 0x1)
It basically sends an oversized (0x34000 bytes) PPPoL2TP packet with UDP encapsulation, and l2tp_xmit_core doesn't check for overflows when it assigns the UDP length field. The value gets trimmed to 16 bites.
Add an overflow check that drops oversized packets and avoids sending packets with trimmed UDP length to the wire.
syzbot's stack trace (with my patch applied):
len >= 65536u
WARNING: ./include/linux/udp.h:38 at udp_set_len_short include/linux/udp.h:38 [inline], CPU#1: syz.0.17/5957 WARNING: ./include/linux/udp.h:38 at l2tp_xmit_core net/l2tp/l2tp_core.c:1293 [inline], CPU#1: syz.0.17/5957 WARNING: ./include/linux/udp.h:38 at l2tp_xmit_skb+0x1204/0x18d0 net/l2tp/l2tp_core.c:1327, CPU#1: syz.0.17/5957 Modules linked in: CPU: 1 UID: 0 PID: 5957 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 RIP: 0010:udp_set_len_short include/linux/udp.h:38 [inline] RIP: 0010:l2tp_xmit_core net/l2tp/l2tp_core.c:1293 [inline] RIP: 0010:l2tp_xmit_skb+0x1204/0x18d0 net/l2tp/l2tp_core.c:1327 Code: 0f 0b 90 e9 21 f9 ff ff e8 e9 05 ec f6 90 0f 0b 90 e9 8d f9 ff ff e8 db 05 ec f6 90 0f 0b 90 e9 cc f9 ff ff e8 cd 05 ec f6 90 <0f> 0b 90 e9 de fa ff ff 44 89 f1 80 e1 07 80 c1 03 38 c1 0f 8c 4f RSP: 0018:ffffc90003d67878 EFLAGS: 00010293 RAX: ffffffff8ad985e3 RBX: ffff8881a6400090 RCX: ffff8881697f0000 RDX: 0000000000000000 RSI: 0000000000034010 RDI: 000000000000ffff RBP: dffffc0000000000 R08: 0000000000000003 R09: 0000000000000004 R10: dffffc0000000000 R11: fffff520007acf00 R12: ffff8881baf20900 R13: 0000000000034010 R14: ffff8881a640008e R15: ffff8881760f7000 FS: 000055557e81f500(0000) GS:ffff8882a9467000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000200000033000 CR3: 00000001612f4000 CR4: 00000000000006f0 Call Trace: <TASK> pppol2tp_sendmsg+0x40a/0x5f0 net/l2tp/l2tp_ppp.c:302 sock_sendmsg_nosec net/socket.c:727 [inline] __sock_sendmsg net/socket.c:742 [inline] sock_write_iter+0x503/0x550 net/socket.c:1195 do_iter_readv_writev+0x619/0x8c0 fs/read_write.c:-1 vfs_writev+0x33c/0x990 fs/read_write.c:1059 do_writev+0x154/0x2e0 fs/read_write.c:1105 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f636479c629 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffffd4241c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000014 RAX: ffffffffffffffda RBX: 00007f6364a15fa0 RCX: 00007f636479c629 RDX: 0000000000000001 RSI: 0000200000000080 RDI: 0000000000000003 RBP: 00007f6364832b39 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f6364a15fac R14: 00007f6364a15fa0 R15: 00007f6364a15fa0 </TASK>
[1]: https://lore.kernel.org/all/[email protected]/
--- net/l2tp/l2tp_core.c | 5 +++++ 1 file changed, 5 insertions(+)
net/l2tp/l2tp_core.c +5 -0
@@ -1083,6 +1083,11 @@ static int l2tp_xmit_core(struct l2tp_session *session, struct sk_buff *skb, uns uh->source = inet->inet_sport; uh->dest = inet->inet_dport; udp_len = uhlen + session->hdr_len + data_len; +if (udp_len >U16_MAX ) { +kfree_skb (skb); + ret =NET_XMIT_DROP ; + goto out_unlock; + } uh->len =htons (udp_len);/* Calculate UDP checksum if configured to do so */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 34/589 netfilter: conntrack: add missing netlink policy validations
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit f900e1d77ee0ef87bfb5ab3fe60f0b3d8ad5ba05 ]
Hyunwoo Kim reports out-of-bounds access in sctp and ctnetlink.
These attributes are used by the kernel without any validation. Extend the netlink policies accordingly.
Quoting the reporter:
nlattr_to_sctp() assigns the user-supplied CTA_PROTOINFO_SCTP_STATE value directly to ct->proto.sctp.state without checking that it is within the valid range. [..]
and: ... with exp->dir = 100, the access at ct->master->tuplehash[100] reads 5600 bytes past the start of a 320-byte nf_conn object, causing a slab-out-of-bounds read confirmed by UBSAN.
--- net/netfilter/nf_conntrack_netlink.c | 2 +- net/netfilter/nf_conntrack_proto_sctp.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
net/netfilter/nf_conntrack_netlink.c +1 -1
@@ -3474,7 +3474,7 @@ ctnetlink_change_expect(struct nf_conntrack_expect *x,#if IS_ENABLED (CONFIG_NF_NAT )static const struct nla_policy exp_nat_nla_policy[CTA_EXPECT_NAT_MAX +1 ] = { - [CTA_EXPECT_NAT_DIR ] = { .type =NLA_U32 }, + [CTA_EXPECT_NAT_DIR ] =NLA_POLICY_MAX (NLA_BE32 ,IP_CT_DIR_REPLY ), [CTA_EXPECT_NAT_TUPLE ] = { .type =NLA_NESTED }, };#endif
net/netfilter/nf_conntrack_proto_sctp.c +2 -1
@@ -595,7 +595,8 @@ static int sctp_to_nlattr(struct sk_buff *skb, struct nlattr *nla, }static const struct nla_policy sctp_nla_policy[CTA_PROTOINFO_SCTP_MAX +1 ] = { - [CTA_PROTOINFO_SCTP_STATE ] = { .type =NLA_U8 }, + [CTA_PROTOINFO_SCTP_STATE ] =NLA_POLICY_MAX (NLA_U8 , +SCTP_CONNTRACK_HEARTBEAT_SENT ), [CTA_PROTOINFO_SCTP_VTAG_ORIGINAL ] = { .type =NLA_U32 }, [CTA_PROTOINFO_SCTP_VTAG_REPLY ] = { .type =NLA_U32 }, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 35/589 drm/i915/gt: fix refcount underflow in intel_engine_park_heartbeat
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Brzezinka <[email protected]>
[ Upstream commit 4c71fd099513bfa8acab529b626e1f0097b76061 ]
A use-after-free / refcount underflow is possible when the heartbeat worker and intel_engine_park_heartbeat() race to release the same engine->heartbeat.systole request.
The heartbeat worker reads engine->heartbeat.systole and calls i915_request_put() on it when the request is complete, but clears the pointer in a separate, non-atomic step. Concurrently, a request retirement on another CPU can drop the engine wakeref to zero, triggering __engine_park() -> intel_engine_park_heartbeat(). If the heartbeat timer is pending at that point, cancel_delayed_work() returns true and intel_engine_park_heartbeat() reads the stale non-NULL systole pointer and calls i915_request_put() on it again, causing a refcount underflow:
``` <4> [487.221889] Workqueue: i915-unordered engine_retire [i915] <4> [487.222640] RIP: 0010:refcount_warn_saturate+0x68/0xb0 ... <4> [487.222707] Call Trace: <4> [487.222711] <TASK> <4> [487.222716] intel_engine_park_heartbeat.part.0+0x6f/0x80 [i915] <4> [487.223115] intel_engine_park_heartbeat+0x25/0x40 [i915] <4> [487.223566] __engine_park+0xb9/0x650 [i915] <4> [487.223973] ____intel_wakeref_put_last+0x2e/0xb0 [i915] <4> [487.224408] __intel_wakeref_put_last+0x72/0x90 [i915] <4> [487.224797] intel_context_exit_engine+0x7c/0x80 [i915] <4> [487.225238] intel_context_exit+0xf1/0x1b0 [i915] <4> [487.225695] i915_request_retire.part.0+0x1b9/0x530 [i915] <4> [487.226178] i915_request_retire+0x1c/0x40 [i915] <4> [487.226625] engine_retire+0x122/0x180 [i915] <4> [487.227037] process_one_work+0x239/0x760 <4> [487.227060] worker_thread+0x200/0x3f0 <4> [487.227068] ? __pfx_worker_thread+0x10/0x10 <4> [487.227075] kthread+0x10d/0x150 <4> [487.227083] ? __pfx_kthread+0x10/0x10 <4> [487.227092] ret_from_fork+0x3d4/0x480 <4> [487.227099] ? __pfx_kthread+0x10/0x10 <4> [487.227107] ret_from_fork_asm+0x1a/0x30 <4> [487.227141] </TASK> ```
Fix this by replacing the non-atomic pointer read + separate clear with xchg() in both racing paths. xchg() is a single indivisible hardware instruction that atomically reads the old pointer and writes NULL. This guarantees only one of the two concurrent callers obtains the non-NULL pointer and performs the put, the other gets NULL and skips it.
--- .../gpu/drm/i915/gt/intel_engine_heartbeat.c | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c +18 -8
@@ -70,10 +70,12 @@ static void heartbeat(struct work_struct *wrk)/* Just in case everything has gone horribly wrong, give it a kick */ intel_engine_flush_submission (engine); - rq = engine->heartbeat.systole; -if (rq &&i915_request_completed (rq)) { -i915_request_put (rq); - engine->heartbeat.systole =NULL ; + rq =xchg (&engine->heartbeat.systole,NULL ); +if (rq) { +if (i915_request_completed (rq)) +i915_request_put (rq); +else + engine->heartbeat.systole = rq; }if (!intel_engine_pm_get_if_awake (engine))
@@ -153,8 +155,11 @@ static void heartbeat(struct work_struct *wrk) unlock:mutex_unlock (&ce->timeline->mutex); out: -if (!next_heartbeat (engine)) -i915_request_put (fetch_and_zero (&engine->heartbeat.systole)); +if (!next_heartbeat (engine)) { + rq =xchg (&engine->heartbeat.systole,NULL ); +if (rq) +i915_request_put (rq); + }intel_engine_pm_put (engine); }
@@ -168,8 +173,13 @@ void intel_engine_unpark_heartbeat(struct intel_engine_cs *engine)void intel_engine_park_heartbeat (struct intel_engine_cs *engine) { -if (cancel_delayed_work (&engine->heartbeat.work)) -i915_request_put (fetch_and_zero (&engine->heartbeat.systole)); +if (cancel_delayed_work (&engine->heartbeat.work)) { +struct i915_request *rq; + + rq =xchg (&engine->heartbeat.systole,NULL ); +if (rq) +i915_request_put (rq); + } }void intel_engine_init_heartbeat (struct intel_engine_cs *engine)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 36/589 MIPS: mm: kmalloc tlb_vpn array to avoid stack overflow
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Bogendoerfer <[email protected]>
commit 841ecc979b18d3227fad5e2d6a1e6f92688776b5 upstream.
Owing to Config4.MMUSizeExt and VTLB/FTLB MMU features later MIPSr2+ cores can have more than 64 TLB entries. Therefore allocate an array for uniquification instead of placing too an small array on the stack.
--- arch/mips/mm/tlb-r4k.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
arch/mips/mm/tlb-r4k.c +16 -2
@@ -12,6 +12,7 @@#include <linux/init.h> #include <linux/sched.h> #include <linux/smp.h> +#include <linux/memblock.h> #include <linux/mm.h> #include <linux/hugetlb.h> #include <linux/export.h>
@@ -512,17 +513,26 @@ static int r4k_vpn_cmp(const void *a, const void *b)* Initialise all TLB entries with unique values that do not clash with * what we have been handed over and what we'll be using ourselves. */ -static void r4k_tlb_uniquify (void ) +static void __ref r4k_tlb_uniquify (void ) { -unsigned long tlb_vpns[1 <<MIPS_CONF1_TLBS_SIZE ];int tlbsize = current_cpu_data.tlbsize; +bool use_slab =slab_is_available ();int start =num_wired_entries (); +phys_addr_t tlb_vpn_size; +unsigned long *tlb_vpns;unsigned long vpn_mask;int cnt, ent, idx, i; vpn_mask =GENMASK (cpu_vmbits -1 ,13 ); vpn_mask |=IS_ENABLED (CONFIG_64BIT ) ?3ULL <<62 :1 <<31 ; + tlb_vpn_size = tlbsize *sizeof (*tlb_vpns); + tlb_vpns = (use_slab ? +kmalloc (tlb_vpn_size,GFP_KERNEL ) : +memblock_alloc_raw (tlb_vpn_size,sizeof (*tlb_vpns))); +if (WARN_ON (!tlb_vpns)) +return ;/* Pray local_flush_tlb_all() is good enough. */ +htw_stop ();for (i = start, cnt =0 ; i < tlbsize; i++, cnt++) {
@@ -575,6 +585,10 @@ static void r4k_tlb_uniquify(void)tlbw_use_hazard ();htw_start ();flush_micro_tlb (); +if (use_slab) +kfree (tlb_vpns); +else +memblock_free (__pa (tlb_vpns), tlb_vpn_size); }/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 37/589 mips: mm: Allocate tlb_vpn array atomically
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Wiehler <[email protected]>
commit 01cc50ea5167bb14117257ec084637abe9e5f691 upstream.
Found by DEBUG_ATOMIC_SLEEP:
BUG: sleeping function called from invalid context at /include/linux/sched/mm.h:306
in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 0, name: swapper/1
preempt_count: 1, expected: 0
RCU nest depth: 0, expected: 0
no locks held by swapper/1/0.
irq event stamp: 0
hardirqs last enabled at (0): [<0000000000000000>] 0x0
hardirqs last disabled at (0): [<ffffffff801477fc>] copy_process+0x75c/0x1b68
softirqs last enabled at (0): [<ffffffff801477fc>] copy_process+0x75c/0x1b68
softirqs last disabled at (0): [<0000000000000000>] 0x0
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 6.6.119-d79e757675ec-fct #1
Stack : 800000000290bad8 0000000000000000 0000000000000008 800000000290bae8
800000000290bae8 800000000290bc78 0000000000000000 0000000000000000
ffffffff80c80000 0000000000000001 ffffffff80d8dee8 ffffffff810d09c0
784bb2a7ec10647d 0000000000000010 ffffffff80a6fd60 8000000001d8a9c0
0000000000000000 0000000000000000 ffffffff80d90000 0000000000000000
ffffffff80c9e0e8 0000000007ffffff 0000000000000cc0 0000000000000400
ffffffffffffffff 0000000000000001 0000000000000002 ffffffffc0149ed8
fffffffffffffffe 8000000002908000 800000000290bae0 ffffffff80a81b74
ffffffff80129fb0 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 ffffffff80129fd0 0000000000000000
...
Call Trace:
[<ffffffff80129fd0>] show_stack+0x60/0x158
[<ffffffff80a7f894>] dump_stack_lvl+0x88/0xbc
[<ffffffff8018d3c8>] __might_resched+0x268/0x288
[<ffffffff803648b0>] __kmem_cache_alloc_node+0x2e0/0x330
[<ffffffff80302788>] __kmalloc+0x58/0xd0
[<ffffffff80a81b74>] r4k_tlb_uniquify+0x7c/0x428
[<ffffffff80143e8c>] tlb_init+0x7c/0x110
[<ffffffff8012bdb4>] per_cpu_trap_init+0x16c/0x1d0
[<ffffffff80133258>] start_secondary+0x28/0x128--- arch/mips/mm/tlb-r4k.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/mm/tlb-r4k.c +1 -1
@@ -528,7 +528,7 @@ static void __ref r4k_tlb_uniquify(void) tlb_vpn_size = tlbsize *sizeof (*tlb_vpns); tlb_vpns = (use_slab ? -kmalloc (tlb_vpn_size,GFP_KERNEL ) : +kmalloc (tlb_vpn_size,GFP_ATOMIC ) :memblock_alloc_raw (tlb_vpn_size,sizeof (*tlb_vpns)));if (WARN_ON (!tlb_vpns))return ;/* Pray local_flush_tlb_all() is good enough. */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 38/589 MIPS: Always record SEGBITS in cpu_data.vmbits
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej W. Rozycki <[email protected]>
commit 8374c2cb83b95b3c92f129fd56527225c20a058c upstream.
With a 32-bit kernel running on 64-bit MIPS hardware the hardcoded value of `cpu_vmbits' only records the size of compatibility useg and does not reflect the size of native xuseg or the complete range of values allowed in the VPN2 field of TLB entries.
An upcoming change will need the actual VPN2 value range permitted even in 32-bit kernel configurations, so always include the vmbits' member in struct cpuinfo_mips' and probe for SEGBITS when running on 64-bit hardware and resorting to the currently hardcoded value of 31 on 32-bit processors. No functional change for users of `cpu_vmbits'.
--- arch/mips/include/asm/cpu-features.h | 1 - arch/mips/include/asm/cpu-info.h | 2 -- arch/mips/include/asm/mipsregs.h | 2 ++ arch/mips/kernel/cpu-probe.c | 13 ++++++++----- arch/mips/kernel/cpu-r3k-probe.c | 2 ++ 5 files changed, 12 insertions(+), 8 deletions(-)
arch/mips/include/asm/cpu-features.h +0 -1
@@ -486,7 +486,6 @@# endif # ifndef cpu_vmbits# define cpu_vmbits cpu_data[0].vmbits -# define __NEED_VMBITS_PROBE# endif #endif
arch/mips/include/asm/cpu-info.h +0 -2
@@ -80,9 +80,7 @@ struct cpuinfo_mips {int srsets;/* Shadow register sets */ int package;/* physical package number */ unsigned int globalnumber; -#ifdef CONFIG_64BIT int vmbits;/* Virtual memory size in bits */ -#endif void *data;/* Additional data */ unsigned int watch_reg_count;/* Number that exist */ unsigned int watch_reg_use_cnt;/* Usable by ptrace */
arch/mips/include/asm/mipsregs.h +2 -0
@@ -1715,6 +1715,8 @@ do { \#define read_c0_entryhi () __read_ulong_c0_register($10, 0)#define write_c0_entryhi (val) __write_ulong_c0_register($10, 0, val) +#define read_c0_entryhi_64 () __read_64bit_c0_register($10, 0) +#define write_c0_entryhi_64 (val) __write_64bit_c0_register($10, 0, val)#define read_c0_guestctl1 () __read_32bit_c0_register($10, 4)#define write_c0_guestctl1 (val) __write_32bit_c0_register($10, 4, val)
arch/mips/kernel/cpu-probe.c +8 -5
@@ -207,11 +207,14 @@ static inline void set_elf_base_platform(const char *plat)static inline void cpu_probe_vmbits (struct cpuinfo_mips *c) { -#ifdef __NEED_VMBITS_PROBE -write_c0_entryhi (0x3fffffffffffe000ULL ); -back_to_back_c0_hazard (); - c->vmbits =fls64 (read_c0_entryhi () &0x3fffffffffffe000ULL ); -#endif +int vmbits =31 ; + +if (cpu_has_64bits) { +write_c0_entryhi_64 (0x3fffffffffffe000ULL ); +back_to_back_c0_hazard (); + vmbits =fls64 (read_c0_entryhi_64 () &0x3fffffffffffe000ULL ); + } + c->vmbits = vmbits; }static void set_isa (struct cpuinfo_mips *c,unsigned int isa)
arch/mips/kernel/cpu-r3k-probe.c +2 -0
@@ -158,6 +158,8 @@ void cpu_probe(void)cpu_set_fpu_opts (c); elsecpu_set_nofpu_opts (c ); + + c->vmbits =31 ; }void cpu_report (void )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 39/589 MIPS: mm: Suppress TLB uniquification on EHINV hardware
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej W. Rozycki <[email protected]>
commit 74283cfe216392c7b776ebf6045b5b15ed9dffcd upstream.
Hardware that supports the EHINV feature, mandatory for R6 ISA and FTLB implementation, lets software mark TLB entries invalid, which eliminates the need to ensure no duplicate matching entries are ever created. This feature is already used by local_flush_tlb_all(), via the UNIQUE_ENTRYHI macro, making the preceding call to r4k_tlb_uniquify() superfluous.
The next change will also modify uniquification code such that it'll become incompatible with the FTLB and MMID features, as well as MIPSr6 CPUs that do not implement 4KiB pages.
Therefore prevent r4k_tlb_uniquify() from being used on EHINV hardware, as denoted by `cpu_has_tlbinv'.
--- arch/mips/mm/tlb-r4k.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/mips/mm/tlb-r4k.c +2 -1
@@ -630,7 +630,8 @@ static void r4k_tlb_configure(void) temp_tlb_entry = current_cpu_data.tlbsize -1 ;/* From this point on the ARC firmware is dead. */ -r4k_tlb_uniquify (); +if (!cpu_has_tlbinv) +r4k_tlb_uniquify ();local_flush_tlb_all ();/* Did I tell you that ARC SUCKS? */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 40/589 MIPS: mm: Rewrite TLB uniquification for the hidden bit feature
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej W. Rozycki <[email protected]>
commit 540760b77b8fc49d39d1b2b76196e5ec57711a32 upstream.
Before the introduction of the EHINV feature, which lets software mark TLB entries invalid, certain older implementations of the MIPS ISA were equipped with an analogous bit, as a vendor extension, which however is hidden from software and only ever set at reset, and then any software write clears it, making the intended TLB entry valid.
This feature makes it unsafe to read a TLB entry with TLBR, modify the page mask, and write the entry back with TLBWI, because this operation will implicitly clear the hidden bit and this may create a duplicate entry, as with the presence of the hidden bit there is no guarantee all the entries across the TLB are unique each.
Usually the firmware has already uniquified TLB entries before handing control over, in which case we only need to guarantee at bootstrap no clash will happen with the VPN2 values chosen in local_flush_tlb_all().
However with systems such as Mikrotik RB532 we get handed the TLB as at reset, with the hidden bit set across the entries and possibly duplicate entries present. This then causes a machine check exception when page sizes are reset in r4k_tlb_uniquify() and prevents the system from booting.
Rewrite the algorithm used in r4k_tlb_uniquify() then such as to avoid the reuse of ASID/VPN values across the TLB. Get rid of global entries first as they may be blocking the entire address space, e.g. 16 256MiB pages will exhaust the whole address space of a 32-bit CPU and a single big page can exhaust the 32-bit compatibility space on a 64-bit CPU.
Details of the algorithm chosen are given across the code itself.
--- arch/mips/mm/tlb-r4k.c | 282 +++++++++++++++++++++++++++++++++-------- 1 file changed, 228 insertions(+), 54 deletions(-)
arch/mips/mm/tlb-r4k.c +228 -54
@@ -13,6 +13,7 @@#include <linux/sched.h> #include <linux/smp.h> #include <linux/memblock.h> +#include <linux/minmax.h> #include <linux/mm.h> #include <linux/hugetlb.h> #include <linux/export.h>
@@ -24,6 +25,7 @@#include <asm/hazards.h> #include <asm/mmu_context.h> #include <asm/tlb.h> +#include <asm/tlbdebug.h> #include <asm/tlbmisc.h> extern void build_tlb_refill_handler (void );
@@ -501,87 +503,259 @@ static int __init set_ntlb(char *str)__setup ("ntlb=" , set_ntlb); -/* Comparison function for EntryHi VPN fields. */ -static int r4k_vpn_cmp (const void *a,const void *b) +/* The start bit position of VPN2 and Mask in EntryHi/PageMask registers. */ +#define VPN2_SHIFT 13 + +/* Read full EntryHi even with CONFIG_32BIT. */ +static inline unsigned long long read_c0_entryhi_native (void ) +{ +return cpu_has_64bits ?read_c0_entryhi_64 () :read_c0_entryhi (); +} + +/* Write full EntryHi even with CONFIG_32BIT. */ +static inline void write_c0_entryhi_native (unsigned long long v) { -long v = *(unsigned long *)a - *(unsigned long *)b; -int s =sizeof (long ) >sizeof (int ) ?sizeof (long ) *8 -1 :0 ; -return s ? (v !=0 ) | v >> s : v; +if (cpu_has_64bits) +write_c0_entryhi_64 (v); +else +write_c0_entryhi (v); } +/* TLB entry state for uniquification. */ +struct tlbent { +unsigned long long wired:1 ; +unsigned long long global:1 ; +unsigned long long asid:10 ; +unsigned long long vpn:51 ; +unsigned long long pagesz:5 ; +unsigned long long index:14 ; +}; +/* -* Initialise all TLB entries with unique values that do not clash with -* what we have been handed over and what we'll be using ourselves. +* Comparison function for TLB entry sorting. Place wired entries first, +* then global entries, then order by the increasing VPN/ASID and the +* decreasing page size. This lets us avoid clashes with wired entries +* easily and get entries for larger pages out of the way first. +* +* We could group bits so as to reduce the number of comparisons, but this +* is seldom executed and not performance-critical, so prefer legibility. */ -static void __ref r4k_tlb_uniquify (void ) +static int r4k_entry_cmp (const void *a,const void *b) { -int tlbsize = current_cpu_data.tlbsize; -bool use_slab =slab_is_available (); -int start =num_wired_entries (); -phys_addr_t tlb_vpn_size; -unsigned long *tlb_vpns; -unsigned long vpn_mask; -int cnt, ent, idx, i; - - vpn_mask =GENMASK (cpu_vmbits -1 ,13 ); - vpn_mask |=IS_ENABLED (CONFIG_64BIT ) ?3ULL <<62 :1 <<31 ; +struct tlbent ea = *(struct tlbent *)a, eb = *(struct tlbent *)b; + +if (ea.wired > eb.wired) +return -1 ; +else if (ea.wired < eb.wired) +return 1 ; +else if (ea.global > eb.global) +return -1 ; +else if (ea.global < eb.global) +return 1 ; +else if (ea.vpn < eb.vpn) +return -1 ; +else if (ea.vpn > eb.vpn) +return 1 ; +else if (ea.asid < eb.asid) +return -1 ; +else if (ea.asid > eb.asid) +return 1 ; +else if (ea.pagesz > eb.pagesz) +return -1 ; +else if (ea.pagesz < eb.pagesz) +return 1 ; +else +return 0 ; +} - tlb_vpn_size = tlbsize *sizeof (*tlb_vpns); - tlb_vpns = (use_slab ? -kmalloc (tlb_vpn_size,GFP_ATOMIC ) : -memblock_alloc_raw (tlb_vpn_size,sizeof (*tlb_vpns))); -if (WARN_ON (!tlb_vpns)) -return ;/* Pray local_flush_tlb_all() is good enough. */ +/* +* Fetch all the TLB entries. Mask individual VPN values retrieved with +* the corresponding page mask and ignoring any 1KiB extension as we'll +* be using 4KiB pages for uniquification. +*/ +static void __ref r4k_tlb_uniquify_read (struct tlbent *tlb_vpns,int tlbsize) +{ +int start =num_wired_entries (); +unsigned long long vpn_mask; +bool global; +int i; -htw_stop (); + vpn_mask =GENMASK (current_cpu_data.vmbits -1 ,VPN2_SHIFT ); + vpn_mask |= cpu_has_64bits ?3ULL <<62 :1 <<31 ; -for (i = start, cnt =0 ; i < tlbsize; i++, cnt++) { -unsigned long vpn; +for (i =0 ; i < tlbsize; i++) { +unsigned long long entryhi, vpn, mask, asid; +unsigned int pagesz;write_c0_index (i);mtc0_tlbr_hazard ();tlb_read ();tlb_read_hazard (); - vpn =read_c0_entryhi (); - vpn &= vpn_mask &PAGE_MASK ; - tlb_vpns[cnt] = vpn; -/* Prevent any large pages from overlapping regular ones. */ -write_c0_pagemask (read_c0_pagemask () &PM_DEFAULT_MASK ); -mtc0_tlbw_hazard (); -tlb_write_indexed (); -tlbw_use_hazard (); + global = !!(read_c0_entrylo0 () &ENTRYLO_G ); + entryhi =read_c0_entryhi_native (); + mask =read_c0_pagemask (); + + asid = entryhi &cpu_asid_mask (¤t_cpu_data); + vpn = (entryhi & vpn_mask & ~mask) >>VPN2_SHIFT ; + pagesz =ilog2 ((mask >>VPN2_SHIFT ) +1 ); + + tlb_vpns[i].global = global; + tlb_vpns[i].asid = global ?0 : asid; + tlb_vpns[i].vpn = vpn; + tlb_vpns[i].pagesz = pagesz; + tlb_vpns[i].wired = i < start; + tlb_vpns[i].index = i; } +} -sort (tlb_vpns, cnt,sizeof (tlb_vpns[0 ]), r4k_vpn_cmp,NULL ); +/* +* Write unique values to all but the wired TLB entries each, using +* the 4KiB page size. This size might not be supported with R6, but +* EHINV is mandatory for R6, so we won't ever be called in that case. +* +* A sorted table is supplied with any wired entries at the beginning, +* followed by any global entries, and then finally regular entries. +* We start at the VPN and ASID values of zero and only assign user +* addresses, therefore guaranteeing no clash with addresses produced +* by UNIQUE_ENTRYHI. We avoid any VPN values used by wired or global +* entries, by increasing the VPN value beyond the span of such entry. +* +* When a VPN/ASID clash is found with a regular entry we increment the +* ASID instead until no VPN/ASID clash has been found or the ASID space +* has been exhausted, in which case we increase the VPN value beyond +* the span of the largest clashing entry. +* +* We do not need to be concerned about FTLB or MMID configurations as +* those are required to implement the EHINV feature. +*/ +static void __ref r4k_tlb_uniquify_write (struct tlbent *tlb_vpns,int tlbsize) +{ +unsigned long long asid, vpn, vpn_size, pagesz; +int widx, gidx, idx, sidx, lidx, i; -write_c0_pagemask (PM_DEFAULT_MASK ); + vpn_size =1ULL << (current_cpu_data.vmbits -VPN2_SHIFT ); + pagesz =ilog2 ((PM_4K >>VPN2_SHIFT ) +1 ); + +write_c0_pagemask (PM_4K );write_c0_entrylo0 (0 );write_c0_entrylo1 (0 ); - idx =0 ; - ent = tlbsize; -for (i = start; i < tlbsize; i++) -while (1 ) { -unsigned long entryhi, vpn; + asid =0 ; + vpn =0 ; + widx =0 ; + gidx =0 ; +for (sidx =0 ; sidx < tlbsize && tlb_vpns[sidx].wired; sidx++) + ; +for (lidx = sidx; lidx < tlbsize && tlb_vpns[lidx].global; lidx++) + ; + idx = gidx = sidx +1 ; +for (i = sidx; i < tlbsize; i++) { +unsigned long long entryhi, vpn_pagesz =0 ; - entryhi =UNIQUE_ENTRYHI (ent); - vpn = entryhi & vpn_mask &PAGE_MASK ; +while (1 ) { +if (WARN_ON (vpn >= vpn_size)) { +dump_tlb_all (); +/* Pray local_flush_tlb_all() will cope. */ +return ; + } -if (idx >= cnt || vpn < tlb_vpns[idx]) { -write_c0_entryhi (entryhi); -write_c0_index (i); -mtc0_tlbw_hazard (); -tlb_write_indexed (); - ent++; -break ; - }else if (vpn == tlb_vpns[idx]) { - ent++; - }else { +/* VPN must be below the next wired entry. */ +if (widx < sidx && vpn >= tlb_vpns[widx].vpn) { + vpn =max (vpn, + (tlb_vpns[widx].vpn + + (1ULL << tlb_vpns[widx].pagesz))); + asid =0 ; + widx++; +continue ; + } +/* VPN must be below the next global entry. */ +if (gidx < lidx && vpn >= tlb_vpns[gidx].vpn) { + vpn =max (vpn, + (tlb_vpns[gidx].vpn + + (1ULL << tlb_vpns[gidx].pagesz))); + asid =0 ; + gidx++; +continue ; + } +/* Try to find a free ASID so as to conserve VPNs. */ +if (idx < tlbsize && vpn == tlb_vpns[idx].vpn && + asid == tlb_vpns[idx].asid) { +unsigned long long idx_pagesz; + + idx_pagesz = tlb_vpns[idx].pagesz; + vpn_pagesz =max (vpn_pagesz, idx_pagesz); +do + idx++; +while (idx < tlbsize && + vpn == tlb_vpns[idx].vpn && + asid == tlb_vpns[idx].asid); + asid++; +if (asid >cpu_asid_mask (¤t_cpu_data)) { + vpn += vpn_pagesz; + asid =0 ; + vpn_pagesz =0 ; + } +continue ; + } +/* VPN mustn't be above the next regular entry. */ +if (idx < tlbsize && vpn > tlb_vpns[idx].vpn) { + vpn =max (vpn, + (tlb_vpns[idx].vpn + + (1ULL << tlb_vpns[idx].pagesz))); + asid =0 ; idx++; +continue ; } +break ; } + entryhi = (vpn <<VPN2_SHIFT ) | asid; +write_c0_entryhi_native (entryhi); +write_c0_index (tlb_vpns[i].index); +mtc0_tlbw_hazard (); +tlb_write_indexed (); + + tlb_vpns[i].asid = asid; + tlb_vpns[i].vpn = vpn; + tlb_vpns[i].pagesz = pagesz; + + asid++; +if (asid >cpu_asid_mask (¤t_cpu_data)) { + vpn +=1ULL << pagesz; + asid =0 ; + } + } +} + +/* +* Initialise all TLB entries with unique values that do not clash with +* what we have been handed over and what we'll be using ourselves. +*/ +static void __ref r4k_tlb_uniquify (void ) +{ +int tlbsize = current_cpu_data.tlbsize; +bool use_slab =slab_is_available (); +phys_addr_t tlb_vpn_size; +struct tlbent *tlb_vpns; + + tlb_vpn_size = tlbsize *sizeof (*tlb_vpns); + tlb_vpns = (use_slab ? +kmalloc (tlb_vpn_size,GFP_ATOMIC ) : +memblock_alloc_raw (tlb_vpn_size,sizeof (*tlb_vpns))); +if (WARN_ON (!tlb_vpns)) +return ;/* Pray local_flush_tlb_all() is good enough. */ + +htw_stop (); + +r4k_tlb_uniquify_read (tlb_vpns, tlbsize); + +sort (tlb_vpns, tlbsize,sizeof (*tlb_vpns), r4k_entry_cmp,NULL ); + +r4k_tlb_uniquify_write (tlb_vpns, tlbsize); + +write_c0_pagemask (PM_DEFAULT_MASK ); +tlbw_use_hazard ();htw_start ();flush_micro_tlb ();
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 41/589 netfilter: nft_set_pipapo: do not rely on ZERO_SIZE_PTR
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
commit 07ace0bbe03b3d8e85869af1dec5e4087b1d57b8 upstream
pipapo relies on kmalloc(0) returning ZERO_SIZE_PTR (i.e., not NULL but pointer is invalid).
Rework this to not call slab allocator when we'd request a 0-byte allocation.
[Keerthana: In older stable branches (v6.6 and earlier), the allocation logic in pipapo_clone() still relies on src->rules rather than src->rules_alloc (introduced in v6.9 via 9f439bd6ef4f). Consequently, the previously backported INT_MAX clamping check uses src->rules. This patch correctly moves that src->rules > (INT_MAX / ...) check inside the newif (src->rules > 0) block]
--- net/netfilter/nft_set_pipapo.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
net/netfilter/nft_set_pipapo.c +15 -6
@@ -524,6 +524,9 @@ static struct nft_pipapo_elem *pipapo_get(const struct net *net,struct nft_pipapo_field *f;int i; +if (m->bsize_max ==0 ) +return ret; + res_map =kmalloc_array (m->bsize_max,sizeof (*res_map),GFP_ATOMIC );if (!res_map) { ret =ERR_PTR (-ENOMEM );
@@ -1363,14 +1366,20 @@ static struct nft_pipapo_match *pipapo_clone(struct nft_pipapo_match *old) src->bsize *sizeof (*dst->lt) * src->groups * NFT_PIPAPO_BUCKETS(src->bb)); -if (src->rules > (INT_MAX /sizeof (*src->mt))) - goto out_mt; +if (src->rules >0 ) { +if (src->rules > (INT_MAX /sizeof (*src->mt))) + goto out_mt; + + dst->mt =kvmalloc_array (src->rules,sizeof (*src->mt), +GFP_KERNEL ); +if (!dst->mt) + goto out_mt; - dst->mt =kvmalloc (src->rules *sizeof (*src->mt),GFP_KERNEL ); -if (!dst->mt) - goto out_mt; +memcpy (dst->mt, src->mt, src->rules *sizeof (*src->mt)); + }else { + dst->mt =NULL ; + } -memcpy (dst->mt, src->mt, src->rules *sizeof (*src->mt)); src++; dst++; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 42/589 batman-adv: hold claim backbone gateways by reference
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haoze Xie <[email protected]>
commit 82d8701b2c930d0e96b0dbc9115a218d791cb0d2 upstream.
batadv_bla_add_claim() can replace claim->backbone_gw and drop the old gateway's last reference while readers still follow the pointer.
The netlink claim dump path dereferences claim->backbone_gw->orig and takes claim->backbone_gw->crc_lock without pinning the underlying backbone gateway. batadv_bla_check_claim() still has the same naked pointer access pattern.
Reuse batadv_bla_claim_get_backbone_gw() in both readers so they operate on a stable gateway reference until the read-side work is complete. This keeps the dump and claim-check paths aligned with the lifetime rules introduced for the other BLA claim readers.
--- net/batman-adv/bridge_loop_avoidance.c | 27 +++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-)
net/batman-adv/bridge_loop_avoidance.c +18 -9
@@ -2206,6 +2206,7 @@ batadv_bla_claim_dump_entry(struct sk_buff *msg, u32 portid, struct batadv_bla_claim *claim) {u8 *primary_addr = primary_if->net_dev->dev_addr; +struct batadv_bla_backbone_gw *backbone_gw;u16 backbone_crc;bool is_own;void *hdr;
@@ -2221,32 +2222,35 @@ batadv_bla_claim_dump_entry(struct sk_buff *msg, u32 portid,genl_dump_check_consistent (cb, hdr); - is_own =batadv_compare_eth (claim->backbone_gw->orig, - primary_addr); + backbone_gw =batadv_bla_claim_get_backbone_gw (claim); + + is_own =batadv_compare_eth (backbone_gw->orig, primary_addr); -spin_lock_bh (&claim->backbone_gw->crc_lock); - backbone_crc = claim->backbone_gw->crc; -spin_unlock_bh (&claim->backbone_gw->crc_lock); +spin_lock_bh (&backbone_gw->crc_lock); + backbone_crc = backbone_gw->crc; +spin_unlock_bh (&backbone_gw->crc_lock);if (is_own)if (nla_put_flag (msg,BATADV_ATTR_BLA_OWN )) {genlmsg_cancel (msg, hdr); - goto out; + goto put_backbone_gw; }if (nla_put (msg,BATADV_ATTR_BLA_ADDRESS ,ETH_ALEN , claim->addr) ||nla_put_u16 (msg,BATADV_ATTR_BLA_VID , claim->vid) ||nla_put (msg,BATADV_ATTR_BLA_BACKBONE ,ETH_ALEN , - claim->backbone_gw->orig) || + backbone_gw->orig) ||nla_put_u16 (msg,BATADV_ATTR_BLA_CRC , backbone_crc)) {genlmsg_cancel (msg, hdr); - goto out; + goto put_backbone_gw; }genlmsg_end (msg, hdr); ret =0 ; +put_backbone_gw: +batadv_backbone_gw_put (backbone_gw); out:return ret; }
@@ -2612,6 +2616,7 @@ int batadv_bla_backbone_dump(struct sk_buff *msg, struct netlink_callback *cb)bool batadv_bla_check_claim (struct batadv_priv *bat_priv,u8 *addr,unsigned short vid) { +struct batadv_bla_backbone_gw *backbone_gw;struct batadv_bla_claim search_claim;struct batadv_bla_claim *claim =NULL ;struct batadv_hard_iface *primary_if =NULL ;
@@ -2634,9 +2639,13 @@ bool batadv_bla_check_claim(struct batadv_priv *bat_priv,* return false. */ if (claim) { -if (!batadv_compare_eth (claim->backbone_gw->orig, + backbone_gw =batadv_bla_claim_get_backbone_gw (claim); + +if (!batadv_compare_eth (backbone_gw->orig, primary_if->net_dev->dev_addr)) ret = false; + +batadv_backbone_gw_put (backbone_gw);batadv_claim_put (claim); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 43/589 nfc: llcp: add missing return after LLCP_CLOSED checks
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junxi Qian <[email protected]>
commit 2b5dd4632966c39da6ba74dbc8689b309065e82c upstream.
In nfc_llcp_recv_hdlc() and nfc_llcp_recv_disc(), when the socket state is LLCP_CLOSED, the code correctly calls release_sock() and nfc_llcp_sock_put() but fails to return. Execution falls through to the remainder of the function, which calls release_sock() and nfc_llcp_sock_put() again. This results in a double release_sock() and a refcount underflow via double nfc_llcp_sock_put(), leading to a use-after-free.
Add the missing return statements after the LLCP_CLOSED branches in both functions to prevent the fall-through.
--- net/nfc/llcp_core.c | 2 ++ 1 file changed, 2 insertions(+)
net/nfc/llcp_core.c +2 -0
@@ -1098,6 +1098,7 @@ static void nfc_llcp_recv_hdlc(struct nfif (sk->sk_state ==LLCP_CLOSED ) {release_sock (sk);nfc_llcp_sock_put (llcp_sock); +return ; }/* Pass the payload upstream */
@@ -1189,6 +1190,7 @@ static void nfc_llcp_recv_disc(struct nfif (sk->sk_state ==LLCP_CLOSED ) {release_sock (sk);nfc_llcp_sock_put (llcp_sock); +return ; }if (sk->sk_state ==LLCP_CONNECTED ) {
Greg Kroah-Hartman
maintainerPATCH 44/589 can: raw: fix ro->uniq use-after-free in raw_rcv()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Samuel Page <[email protected]>
commit a535a9217ca3f2fccedaafb2fddb4c48f27d36dc upstream.
raw_release() unregisters raw CAN receive filters via can_rx_unregister(), but receiver deletion is deferred with call_rcu(). This leaves a window where raw_rcv() may still be running in an RCU read-side critical section after raw_release() frees ro->uniq, leading to a use-after-free of the percpu uniq storage.
Move free_percpu(ro->uniq) out of raw_release() and into a raw-specific socket destructor. can_rx_unregister() takes an extra reference to the socket and only drops it from the RCU callback, so freeing uniq from sk_destruct ensures the percpu area is not released until the relevant callbacks have drained.
--- net/can/raw.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
net/can/raw.c +10 -1
@@ -329,6 +329,14 @@ static int raw_notifier(struct notifier_return NOTIFY_DONE ; } +static void raw_sock_destruct (struct sock *sk) +{ +struct raw_sock *ro =raw_sk (sk); + +free_percpu (ro->uniq); +can_sock_destruct (sk); +} +static int raw_init (struct sock *sk) {struct raw_sock *ro =raw_sk (sk);
@@ -353,6 +361,8 @@ static int raw_init(struct sock *sk)if (unlikely (!ro->uniq))return -ENOMEM ; + sk->sk_destruct = raw_sock_destruct; +/* set notifier */ spin_lock (&raw_notifier_lock);list_add_tail (&ro->notifier, &raw_notifier_list);
@@ -403,7 +413,6 @@ static int raw_release(struct socket *so ro->ifindex =0 ; ro->bound =0 ; ro->count =0 ; -free_percpu (ro->uniq);sock_orphan (sk); sock->sk =NULL ;
Greg Kroah-Hartman
maintainerPATCH 45/589 i2c: s3c24xx: check the size of the SMBUS message before using it
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit c0128c7157d639a931353ea344fb44aad6d6e17a upstream.
The first byte of an i2c SMBUS message is the size, and it should be verified to ensure that it is in the range of 0..I2C_SMBUS_BLOCK_MAX before processing it.
This is the same logic that was added in commit a6e04f05ce0b ("i2c:
tegra: check msg length in SMBUS block read") to the i2c tegra driver.
--- drivers/i2c/busses/i2c-s3c2410.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-s3c2410.c +6 -1
@@ -511,8 +511,13 @@ static int i2c_s3c_irq_nextbyte(struct s i2c->msg->buf[i2c->msg_ptr++] = byte;/* Add actual length to read for smbus block read */ -if (i2c->msg->flags &I2C_M_RECV_LEN && i2c->msg->len ==1 ) +if (i2c->msg->flags &I2C_M_RECV_LEN && i2c->msg->len ==1 ) { +if (byte ==0 || byte >I2C_SMBUS_BLOCK_MAX ) { +s3c24xx_i2c_stop (i2c, -EPROTO ); +break ; + } i2c->msg->len += byte; + } prepare_read:if (is_msglast (i2c)) {/* last byte of buffer */
Greg Kroah-Hartman
maintainerPATCH 46/589 staging: rtl8723bs: initialize le_tmp64 in rtw_BIP_verify()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lin YuChen <[email protected]>
commit 8c964b82a4e97ec7f25e17b803ee196009b38a57 upstream.
Initialize le_tmp64 to zero in rtw_BIP_verify() to prevent using uninitialized data.
Smatch warns that only 6 bytes are copied to this 8-byte (u64) variable, leaving the last two bytes uninitialized:
drivers/staging/rtl8723bs/core/rtw_security.c:1308 rtw_BIP_verify()
warn: not copying enough bytes for '&le_tmp64' (8 vs 6 bytes)
Initializing the variable at the start of the function fixes this warning and ensures predictable behavior.
--- drivers/staging/rtl8723bs/core/rtw_security.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8723bs/core/rtw_security.c +1 -1
@@ -1889,7 +1889,7 @@ u32 rtw_BIP_verify(struct adapter *padapu8 mic[16 ];struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;__le16 le_tmp; -__le64 le_tmp64; +__le64 le_tmp64 =0 ; ori_len = pattrib->pkt_len-WLAN_HDR_A3_LEN +BIP_AAD_SIZE ;BIP_AAD =rtw_zmalloc (ori_len);
Greg Kroah-Hartman
maintainerPATCH 47/589 HID: alps: fix NULL pointer dereference in alps_raw_event()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 1badfc4319224820d5d890f8eab6aa52e4e83339 upstream.
Commit ecfa6f34492c ("HID: Add HID_CLAIMED_INPUT guards in raw_event callbacks missing them") attempted to fix up the HID drivers that had missed the previous fix that was done in 2ff5baa9b527 ("HID: appleir:
Fix potential NULL dereference at raw event handle"), but the alps driver was missed.
Fix this up by properly checking in the hid-alps driver that it had been claimed correctly before attempting to process the raw event.
--- drivers/hid/hid-alps.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/hid/hid-alps.c +3 -0
@@ -437,6 +437,9 @@ static int alps_raw_event(struct hid_devint ret =0 ;struct alps_dev *hdata =hid_get_drvdata (hdev); +if (!(hdev->claimed &HID_CLAIMED_INPUT ) || !hdata->input) +return 0 ; +switch (hdev->product) {case HID_PRODUCT_ID_T4_BTNLESS : ret =t4_raw_event (hdata, data, size);
Greg Kroah-Hartman
maintainerPATCH 48/589 HID: core: clamp report_size in s32ton() to avoid undefined shift
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 69c02ffde6ed4d535fa4e693a9e572729cad3d0d upstream.
s32ton() shifts by n-1 where n is the field's report_size, a value that comes directly from a HID device. The HID parser bounds report_size only to <= 256, so a broken HID device can supply a report descriptor with a wide field that triggers shift exponents up to 256 on a 32-bit type when an output report is built via hid_output_field() or hid_set_field().
Commit ec61b41918587 ("HID: core: fix shift-out-of-bounds in hid_report_raw_event") added the same n > 32 clamp to the function snto32(), but s32ton() was never given the same fix as I guess syzbot hadn't figured out how to fuzz a device the same way.
Fix this up by just clamping the max value of n, just like snto32() does.
--- drivers/hid/hid-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/hid/hid-core.c +3 -0
@@ -1354,6 +1354,9 @@ static u32 s32ton(__s32 value, unsignedif (!value || !n)return 0 ; +if (n >32 ) + n =32 ; + a = value >> (n -1 );if (a && a !=-1 )return value <0 ?1 << (n -1 ) : (1 << (n -1 )) -1 ;
Greg Kroah-Hartman
maintainerPATCH 49/589 net: usb: cdc-phonet: fix skb frags[] overflow in rx_complete()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 600dc40554dc5ad1e6f3af51f700228033f43ea7 upstream.
A malicious USB device claiming to be a CDC Phonet modem can overflow the skb_shared_info->frags[] array by sending an unbounded sequence of full-page bulk transfers.
Drop the skb and increment the length error when the frag limit is reached. This matches the same fix that commit f0813bcd2d9d ("net:
wwan: t7xx: fix potential skb->frags overflow in RX path") did for the t7xx driver.
--- drivers/net/usb/cdc-phonet.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/usb/cdc-phonet.c +6 -1
@@ -157,11 +157,16 @@ static void rx_complete(struct urb *req) PAGE_SIZE); page =NULL ; } - }else { + }else if (skb_shinfo (skb)->nr_frags <MAX_SKB_FRAGS ) {skb_add_rx_frag (skb,skb_shinfo (skb)->nr_frags, page,0 , req->actual_length,PAGE_SIZE ); page =NULL ; + }else { +dev_kfree_skb_any (skb); + pnd->rx_skb =NULL ; + skb =NULL ; + dev->stats.rx_length_errors++; }if (req->actual_length <PAGE_SIZE ) pnd->rx_skb =NULL ;/* Last fragment */
Greg Kroah-Hartman
maintainerPATCH 50/589 NFC: digital: Bounds check NFC-A cascade depth in SDD response handler
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 46ce8be2ced389bccd84bcc04a12cf2f4d0c22d1 upstream.
The NFC-A anti-collision cascade in digital_in_recv_sdd_res() appends 3 or 4 bytes to target->nfcid1 on each round, but the number of cascade rounds is controlled entirely by the peer device. The peer sets the cascade tag in the SDD_RES (deciding 3 vs 4 bytes) and the cascade-incomplete bit in the SEL_RES (deciding whether another round follows).
ISO 14443-3 limits NFC-A to three cascade levels and target->nfcid1 is sized accordingly (NFC_NFCID1_MAXSIZE = 10), but nothing in the driver actually enforces this. This means a malicious peer can keep the cascade running, writing past the heap-allocated nfc_target with each round.
Fix this by rejecting the response when the accumulated UID would exceed the buffer.
Commit e329e71013c9 ("NFC: nci: Bounds check struct nfc_target arrays") fixed similar missing checks against the same field on the NCI path.
--- net/nfc/digital_technology.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/nfc/digital_technology.c +6 -0
@@ -424,6 +424,12 @@ static void digital_in_recv_sdd_res(stru size =4 ; } +if (target->nfcid1_len + size >NFC_NFCID1_MAXSIZE ) { +PROTOCOL_ERR ("4.7.2.1" ); + rc = -EPROTO ; + goto exit; + } +memcpy (target->nfcid1 + target->nfcid1_len, sdd_res->nfcid1 + offset, size); target->nfcid1_len += size;
Greg Kroah-Hartman
maintainerPATCH 51/589 ALSA: fireworks: bound device-supplied status before string array lookup
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 07704bbf36f57e4379e4cadf96410dab14621e3b upstream.
The status field in an EFW response is a 32-bit value supplied by the firewire device. efr_status_names[] has 17 entries so a status value outside that range goes off into the weeds when looking at the %s value.
Even worse, the status could return EFR_STATUS_INCOMPLETE which is 0x80000000, and is obviously not in that array of potential strings.
Fix this up by properly bounding the index against the array size and printing "unknown" if it's not recognized.
--- sound/firewire/fireworks/fireworks_command.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/firewire/fireworks/fireworks_command.c +4 -1
@@ -151,10 +151,13 @@ efw_transaction(struct snd_efw *efw, uns (be32_to_cpu(header->category) != category) || (be32_to_cpu(header->command) != command) || (be32_to_cpu(header->status) != EFR_STATUS_OK)) { +u32 st =be32_to_cpu (header->status); +dev_err (&efw->unit->device,"EFW command failed [%u/%u]: %s\n" ,be32_to_cpu (header->category),be32_to_cpu (header->command), - efr_status_names[be32_to_cpu (header->status)]); + st <ARRAY_SIZE (efr_status_names) ? + efr_status_names[st] :"unknown" ); err = -EIO ; goto end; }
Greg Kroah-Hartman
maintainerPATCH 52/589 fbdev: tdfxfb: avoid divide-by-zero on FBIOPUT_VSCREENINFO
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 8f98b81fe011e1879e6a7b1247e69e06a5e17af2 upstream.
Much like commit 19f953e74356 ("fbdev: fb_pm2fb: Avoid potential divide by zero error"), we also need to prevent that same crash from happening in the udlfb driver as it uses pixclock directly when dividing, which will crash.
--- drivers/video/fbdev/tdfxfb.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/video/fbdev/tdfxfb.c +3 -0
@@ -497,6 +497,9 @@ static int tdfxfb_check_var(struct fb_va } } +if (!var->pixclock) +return -EINVAL ; +if (PICOS2KHZ (var->pixclock) > par->max_pixclock) {DPRINTK ("pixclock too high (%ldKHz)\n" ,PICOS2KHZ (var->pixclock));
Greg Kroah-Hartman
maintainerPATCH 53/589 usb: gadget: f_ncm: validate minimum block_len in ncm_unwrap_ntb()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 8f993d30b95dc9557a8a96ceca11abed674c8acb upstream.
The block_len read from the host-supplied NTB header is checked against ntb_max but has no lower bound. When block_len is smaller than opts->ndp_size, the bounds check of:
ndp_index > (block_len - opts->ndp_size)
will underflow producing a huge unsigned value that ndp_index can never exceed, defeating the check entirely.
The same underflow occurs in the datagram index checks against block_len
- opts->dpe_size. With those checks neutered, a malicious USB host can choose ndp_index and datagram offsets that point past the actual transfer, and the skb_put_data() copies adjacent kernel memory into the network skb.
Fix this by rejecting block lengths that cannot hold at least the NTB header plus one NDP. This will make block_len - opts->ndp_size and block_len - opts->dpe_size both well-defined.
Commit 8d2b1a1ec9f5 ("CDC-NCM: avoid overflow in sanity checking") fixed a related class of issues on the host side of NCM.
--- drivers/usb/gadget/function/f_ncm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/f_ncm.c +2 -2
@@ -1218,8 +1218,8 @@ parse_ntb: block_len =get_ncm (&tmp, opts->block_length);/* (d)wBlockLength */ -if (block_len > ntb_max) { -INFO (port->func.config->cdev,"OUT size exceeded\n" ); +if ((block_len < opts->nth_size + opts->ndp_size) || (block_len > ntb_max)) { +INFO (port->func.config->cdev,"Bad block length: %#X\n" , block_len); goto err; }
Greg Kroah-Hartman
maintainerPATCH 54/589 usb: gadget: f_phonet: fix skb frags[] overflow in pn_rx_complete()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit c088d5dd2fffb4de1fb8e7f57751c8b82942180a upstream.
A broken/bored/mean USB host can overflow the skb_shared_info->frags[] array on a Linux gadget exposing a Phonet function by sending an unbounded sequence of full-page OUT transfers.
pn_rx_complete() finalizes the skb only when req->actual < req->length, where req->length is set to PAGE_SIZE by the gadget. If the host always sends exactly PAGE_SIZE bytes per transfer, fp->rx.skb will never be reset and each completion will add another fragment via skb_add_rx_frag(). Once nr_frags exceeds MAX_SKB_FRAGS (default 17), subsequent frag stores overwrite memory adjacent to the shinfo on the heap.
Drop the skb and account a length error when the frag limit is reached, matching the fix applied in t7xx by commit f0813bcd2d9d ("net: wwan:
t7xx: fix potential skb->frags overflow in RX path").
--- drivers/usb/gadget/function/f_phonet.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/usb/gadget/function/f_phonet.c +9 -0
@@ -330,6 +330,15 @@ static void pn_rx_complete(struct usb_epif (unlikely (!skb))break ; +if (unlikely (skb_shinfo (skb)->nr_frags >=MAX_SKB_FRAGS )) { +/* Frame count from host exceeds frags[] capacity */ +dev_kfree_skb_any (skb); +if (fp->rx.skb == skb) + fp->rx.skb =NULL ; + dev->stats.rx_length_errors++; +break ; + } +if (skb->len ==0 ) {/* First fragment */ skb->protocol =htons (ETH_P_PHONET );skb_reset_mac_header (skb);
Greg Kroah-Hartman
maintainerPATCH 55/589 usb: gadget: renesas_usb3: validate endpoint index in standard request handlers
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit f880aac8a57ebd92abfa685d45424b2998ac1059 upstream.
The GET_STATUS and SET/CLEAR_FEATURE handlers extract the endpoint number from the host-supplied wIndex without any sort of validation. Fix this up by validating the number of endpoints actually match up with the number the device has before attempting to dereference a pointer based on this math.
This is just like what was done in commit ee0d382feb44 ("usb: gadget:aspeed_udc: validate endpoint index for ast udc") for the aspeed driver.
--- drivers/usb/gadget/udc/renesas_usb3.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/usb/gadget/udc/renesas_usb3.c +6 -1
@@ -1611,6 +1611,10 @@ static bool usb3_std_req_get_status(strubreak ;case USB_RECIP_ENDPOINT : num =le16_to_cpu (ctrl->wIndex) &USB_ENDPOINT_NUMBER_MASK ; +if (num >= usb3->num_usb3_eps) { + stall = true; +break ; + } usb3_ep =usb3_get_ep (usb3, num);if (usb3_ep->halt) status |=1 <<USB_ENDPOINT_HALT ;
@@ -1723,7 +1727,8 @@ static bool usb3_std_req_feature_endpoinstruct renesas_usb3_ep *usb3_ep;struct renesas_usb3_request *usb3_req; -if (le16_to_cpu (ctrl->wValue) !=USB_ENDPOINT_HALT ) +if ((le16_to_cpu (ctrl->wValue) !=USB_ENDPOINT_HALT ) || + (num >= usb3->num_usb3_eps))return true;/* stall */ usb3_ep =usb3_get_ep (usb3, num);
Greg Kroah-Hartman
maintainerPATCH 56/589 usbip: validate number_of_packets in usbip_pack_ret_submit()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Rebello <[email protected]>
commit 2ab833a16a825373aad2ba7d54b572b277e95b71 upstream.
When a USB/IP client receives a RET_SUBMIT response, usbip_pack_ret_submit() unconditionally overwrites urb->number_of_packets from the network PDU. This value is subsequently used as the loop bound in usbip_recv_iso() and usbip_pad_iso() to iterate over urb->iso_frame_desc[], a flexible array whose size was fixed at URB allocation time based on the *original* number_of_packets from the CMD_SUBMIT.
A malicious USB/IP server can set number_of_packets in the response to a value larger than what was originally submitted, causing a heap out-of-bounds write when usbip_recv_iso() writes to urb->iso_frame_desc[i] beyond the allocated region.
KASAN confirmed this with kernel 7.0.0-rc5:
BUG: KASAN: slab-out-of-bounds in usbip_recv_iso+0x46a/0x640 Write of size 4 at addr ffff888106351d40 by task vhci_rx/69
The buggy address is located 0 bytes to the right of
allocated 320-byte region [ffff888106351c00, ffff888106351d40)
The server side (stub_rx.c) and gadget side (vudc_rx.c) already validate number_of_packets in the CMD_SUBMIT path since commits c6688ef9f297 ("usbip: fix stub_rx: harden CMD_SUBMIT path to handle malicious input") and b78d830f0049 ("usbip: fix vudc_rx: harden CMD_SUBMIT path to handle malicious input"). The server side validates against USBIP_MAX_ISO_PACKETS because no URB exists yet at that point. On the client side we have the original URB, so we can use the tighter
bound: the response must not exceed the original number_of_packets.
This mirrors the existing validation of actual_length against transfer_buffer_length in usbip_recv_xbuff(), which checks the response value against the original allocation size.
Kelvin Mbogo's series ("usb: usbip: fix integer overflow in usbip_recv_iso()", v2) hardens the receive-side functions themselves; this patch complements that work by catching the bad value at its source -- in usbip_pack_ret_submit() before the overwrite -- and using the tighter per-URB allocation bound rather than the global USBIP_MAX_ISO_PACKETS limit.
Fix this by checking rpdu->number_of_packets against urb->number_of_packets in usbip_pack_ret_submit() before the overwrite. On violation, clamp to zero so that usbip_recv_iso() and usbip_pad_iso() safely return early.
--- drivers/usb/usbip/usbip_common.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/usb/usbip/usbip_common.c +12 -0
@@ -389,6 +389,18 @@ static void usbip_pack_ret_submit(struct urb->status = rpdu->status; urb->actual_length = rpdu->actual_length; urb->start_frame = rpdu->start_frame; +/* +* The number_of_packets field determines the length of +* iso_frame_desc[], which is a flexible array allocated +* at URB creation time. A response must never claim more +* packets than originally submitted; doing so would cause +* an out-of-bounds write in usbip_recv_iso() and +* usbip_pad_iso(). Clamp to zero on violation so both +* functions safely return early. +*/ +if (rpdu->number_of_packets <0 || + rpdu->number_of_packets > urb->number_of_packets) + rpdu->number_of_packets =0 ; urb->number_of_packets = rpdu->number_of_packets; urb->error_count = rpdu->error_count; }
Greg Kroah-Hartman
maintainerPATCH 57/589 usb: storage: Expand range of matched versions for VL817 quirks entry
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Brát <[email protected]>
commit 609865ab3d5d803556f628e221ecd3d06aed9f30 upstream.
Expands range of matched bcdDevice values for the VL817 quirk entry. This is based on experience with Axagon EE35-GTR rev1 3.5" HDD enclosure, which reports its bcdDevice as 0x0843, but presumably other vendors using this IC in their products may set it to any other value.
--- drivers/usb/storage/unusual_devs.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/usb/storage/unusual_devs.h +4 -3
@@ -2339,10 +2339,11 @@ UNUSUAL_DEV( 0x2027, 0xa001, 0x0000, 0x US_FL_SCM_MULT_TARG ),/* -* Reported by DocMAX <[email protected]> -* and Thomas Weißschuh <[email protected]> +* Reported by DocMAX <[email protected]>, +* Thomas Weißschuh <[email protected]> +* and Daniel Brát <[email protected]> */ -UNUSUAL_DEV( 0x2109, 0x0715, 0x9999, 0x9999, +UNUSUAL_DEV( 0x2109, 0x0715, 0x0000, 0x9999, "VIA Labs, Inc.", "VL817 SATA Bridge", USB_SC_DEVICE, USB_PR_DEVICE, NULL,
Greg Kroah-Hartman
maintainerPATCH 58/589 fbdev: udlfb: avoid divide-by-zero on FBIOPUT_VSCREENINFO
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit a31e4518bec70333a0a98f2946a12b53b45fe5b9 upstream.
Much like commit 19f953e74356 ("fbdev: fb_pm2fb: Avoid potential divide by zero error"), we also need to prevent that same crash from happening in the udlfb driver as it uses pixclock directly when dividing, which will crash.
--- drivers/video/fbdev/udlfb.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/video/fbdev/udlfb.c +3 -0
@@ -1077,6 +1077,9 @@ static int dlfb_ops_check_var(struct fb_struct fb_videomode mode;struct dlfb_data *dlfb = info->par; +if (!var->pixclock) +return -EINVAL ; +/* set device-specific elements of var unrelated to mode */ dlfb_var_color_format (var);
Greg Kroah-Hartman
maintainerPATCH 59/589 staging: sm750fb: fix division by zero in ps_to_hz()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junrui Luo <[email protected]>
commit 75a1621e4f91310673c9acbcbb25c2a7ff821cd3 upstream.
ps_to_hz() is called from hw_sm750_crtc_set_mode() without validating that pixclock is non-zero. A zero pixclock passed via FBIOPUT_VSCREENINFO causes a division by zero.
Fix by rejecting zero pixclock in lynxfb_ops_check_var(), consistent with other framebuffer drivers.
--- drivers/staging/sm750fb/sm750.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/staging/sm750fb/sm750.c +3 -0
@@ -482,6 +482,9 @@ static int lynxfb_ops_check_var(struct fstruct lynxfb_crtc *crtc;resource_size_t request; +if (!var->pixclock) +return -EINVAL ; + ret =0 ; par = info->par; crtc = &par->crtc;
Greg Kroah-Hartman
maintainerPATCH 60/589 USB: serial: option: add Telit Cinterion FN990A MBIM composition
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Porcedda <[email protected]>
commit f8cc59ecc22841be5deb07b549c0c6a2657cd5f9 upstream.
Add the following Telit Cinterion FN990A MBIM composition:
0x1074: MBIM + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (diag) +
DPL (Data Packet Logging) + adb
T: Bus=01 Lev=01 Prnt=04 Port=06 Cnt=01 Dev#= 7 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=1074 Rev=05.04 S: Manufacturer=Telit Wireless Solutions S: Product=FN990 S: SerialNumber=70628d0c C: #Ifs= 8 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim E: Ad=81(I) Atr=03(Int.) MxPS= 64 Ivl=32ms I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim E: Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 6 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none) E: Ad=8f(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 7 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none) E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/option.c +2 -0
@@ -1383,6 +1383,8 @@ static const struct usb_device_id option .driver_info = NCTRL(2) | RSVD(3) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1073, 0xff), /* Telit FN990A (ECM) */ .driver_info = NCTRL(0) | RSVD(1) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1074, 0xff), /* Telit FN990A (MBIM) */ + .driver_info = NCTRL(5) | RSVD(6) | RSVD(7) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1075, 0xff), /* Telit FN990A (PCIe) */ .driver_info = RSVD(0) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1077, 0xff), /* Telit FN990A (rmnet + audio) */
Greg Kroah-Hartman
maintainerPATCH 61/589 ALSA: ctxfi: Limit PTP to a single page
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harin Lee <[email protected]>
commit e9418da50d9e5c496c22fe392e4ad74c038a94eb upstream.
Commit 391e69143d0a increased CT_PTP_NUM from 1 to 4 to support 256 playback streams, but the additional pages are not used by the card correctly. The CT20K2 hardware already has multiple VMEM_PTPAL registers, but using them separately would require refactoring the entire virtual memory allocation logic.
ct_vm_map() always uses PTEs in vm->ptp[0].area regardless of CT_PTP_NUM. On AMD64 systems, a single PTP covers 512 PTEs (2M). When aggregate memory allocations exceed this limit, ct_vm_map() tries to access beyond the allocated space and causes a page fault:
BUG: unable to handle page fault for address: ffffd4ae8a10a000 Oops: Oops: 0002 [#1] SMP PTI RIP: 0010:ct_vm_map+0x17c/0x280 [snd_ctxfi] Call Trace: atc_pcm_playback_prepare+0x225/0x3b0 ct_pcm_playback_prepare+0x38/0x60 snd_pcm_do_prepare+0x2f/0x50 snd_pcm_action_single+0x36/0x90 snd_pcm_action_nonatomic+0xbf/0xd0 snd_pcm_ioctl+0x28/0x40 __x64_sys_ioctl+0x97/0xe0 do_syscall_64+0x81/0x610 entry_SYSCALL_64_after_hwframe+0x76/0x7e
Revert CT_PTP_NUM to 1. The 256 SRC_RESOURCE_NUM and playback_count remain unchanged.
--- sound/pci/ctxfi/ctvmem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/ctxfi/ctvmem.h +1 -1
@@ -15,7 +15,7 @@#ifndef CTVMEM_H #define CTVMEM_H -#define CT_PTP_NUM 4/* num of device page table pages */ +#define CT_PTP_NUM 1/* num of device page table pages */ #include <linux/mutex.h> #include <linux/list.h>
Greg Kroah-Hartman
maintainerPATCH 62/589 media: vidtv: fix NULL pointer dereference in vidtv_channel_pmt_match_sections
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruslan Valiyev <[email protected]>
commit f8e1fc918a9fe67103bcda01d20d745f264d00a7 upstream.
syzbot reported a general protection fault in vidtv_psi_desc_assign [1].
vidtv_psi_pmt_stream_init() can return NULL on memory allocation failure, but vidtv_channel_pmt_match_sections() does not check for this. When tail is NULL, the subsequent call to vidtv_psi_desc_assign(&tail->descriptor, desc) dereferences a NULL pointer offset, causing a general protection fault.
Add a NULL check after vidtv_psi_pmt_stream_init(). On failure, clean up the already-allocated stream chain and return.
[1]
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] SMP KASAN PTI KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] RIP: 0010:vidtv_psi_desc_assign+0x24/0x90 drivers/media/test-drivers/vidtv/vidtv_psi.c:629 Call Trace: <TASK> vidtv_channel_pmt_match_sections drivers/media/test-drivers/vidtv/vidtv_channel.c:349 [inline] vidtv_channel_si_init+0x1445/0x1a50 drivers/media/test-drivers/vidtv/vidtv_channel.c:479 vidtv_mux_init+0x526/0xbe0 drivers/media/test-drivers/vidtv/vidtv_mux.c:519 vidtv_start_streaming drivers/media/test-drivers/vidtv/vidtv_bridge.c:194 [inline] vidtv_start_feed+0x33e/0x4d0 drivers/media/test-drivers/vidtv/vidtv_bridge.c:239
--- drivers/media/test-drivers/vidtv/vidtv_channel.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/media/test-drivers/vidtv/vidtv_channel.c +4 -0
@@ -341,6 +341,10 @@ vidtv_channel_pmt_match_sections(struct tail =vidtv_psi_pmt_stream_init (tail, s->type, e_pid); +if (!tail) { +vidtv_psi_pmt_stream_destroy (head); +return ; + }if (!head) head = tail;
Greg Kroah-Hartman
maintainerPATCH 63/589 ocfs2: fix use-after-free in ocfs2_fault() when VM_FAULT_RETRY
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejas Bharambe <[email protected]>
commit 7de554cabf160e331e4442e2a9ad874ca9875921 upstream.
filemap_fault() may drop the mmap_lock before returning VM_FAULT_RETRY, as documented in mm/filemap.c:
"If our return value has VM_FAULT_RETRY set, it's because the mmap_lock may be dropped before doing I/O or by lock_folio_maybe_drop_mmap()."
When this happens, a concurrent munmap() can call remove_vma() and free the vm_area_struct via RCU. The saved 'vma' pointer in ocfs2_fault() then becomes a dangling pointer, and the subsequent trace_ocfs2_fault() call dereferences it -- a use-after-free.
Fix this by saving ip_blkno as a plain integer before calling filemap_fault(), and removing vma from the trace event. Since ip_blkno is copied by value before the lock can be dropped, it remains valid regardless of what happens to the vma or inode afterward.
--- fs/ocfs2/mmap.c | 7 +++---- fs/ocfs2/ocfs2_trace.h | 10 ++++------ 2 files changed, 7 insertions(+), 10 deletions(-)
fs/ocfs2/mmap.c +3 -4
@@ -32,7 +32,8 @@static vm_fault_t ocfs2_fault (struct vm_fault *vmf) { -struct vm_area_struct *vma = vmf->vma; +unsigned long long ip_blkno = +OCFS2_I (file_inode (vmf->vma->vm_file))->ip_blkno;sigset_t oldset;vm_fault_t ret;
@@ -40,11 +41,9 @@ static vm_fault_t ocfs2_fault(struct vm_ ret =filemap_fault (vmf);ocfs2_unblock_signals (&oldset); -trace_ocfs2_fault (OCFS2_I (vma->vm_file->f_mapping->host)->ip_blkno, - vma, vmf->page, vmf->pgoff); +trace_ocfs2_fault (ip_blkno, vmf->page, vmf->pgoff);return ret; } -static vm_fault_t __ocfs2_page_mkwrite (struct file *file,struct buffer_head *di_bh,struct page *page) {
fs/ocfs2/ocfs2_trace.h +4 -6
@@ -1248,22 +1248,20 @@ TRACE_EVENT(ocfs2_write_end_inline,TRACE_EVENT (ocfs2_fault, TP_PROTO(unsigned long long ino, - void *area, void *page, unsigned long pgoff), -TP_ARGS (ino, area, page, pgoff), + void *page, unsigned long pgoff), +TP_ARGS (ino, page, pgoff),TP_STRUCT__entry ( __field(unsigned long long, ino) - __field(void *, area) __field(void *, page) __field(unsigned long, pgoff) ),TP_fast_assign ( __entry->ino = ino; - __entry->area = area; __entry->page = page; __entry->pgoff = pgoff; ), -TP_printk ("%llu %p %p %lu" , - __entry->ino, __entry->area, __entry->page, __entry->pgoff) +TP_printk ("%llu %p %lu" , + __entry->ino, __entry->page, __entry->pgoff) );/* End of trace events for fs/ocfs2/mmap.c. */
Greg Kroah-Hartman
maintainerPATCH 64/589 ocfs2: handle invalid dinode in ocfs2_group_extend
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: ZhengYuan Huang <[email protected]>
commit 4a1c0ddc6e7bcf2e9db0eeaab9340dcfe97f448f upstream.
[BUG]
kernel BUG at fs/ocfs2/resize.c:308!
Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI RIP: 0010:ocfs2_group_extend+0x10aa/0x1ae0 fs/ocfs2/resize.c:308 Code: 8b8520ff ffff83f8 860f8580 030000e8 5cc3c1fe Call Trace: ... ocfs2_ioctl+0x175/0x6e0 fs/ocfs2/ioctl.c:869 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl fs/ioctl.c:583 [inline] __x64_sys_ioctl+0x197/0x1e0 fs/ioctl.c:583 x64_sys_call+0x1144/0x26a0 arch/x86/include/generated/asm/syscalls_64.h:17 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x93/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x76/0x7e ...
[CAUSE]ocfs2_group_extend() assumes that the global bitmap inode block returned from ocfs2_inode_lock() has already been validated and BUG_ONs when the signature is not a dinode. That assumption is too strong for crafted filesystems because the JBD2-managed buffer path can bypass structural validation and return an invalid dinode to the resize ioctl.
[FIX]
Validate the dinode explicitly in ocfs2_group_extend(). If the global bitmap buffer does not contain a valid dinode, report filesystem corruption with ocfs2_error() and fail the resize operation instead of crashing the kernel.
--- fs/ocfs2/resize.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
fs/ocfs2/resize.c +7 -3
@@ -297,9 +297,13 @@ int ocfs2_group_extend(struct inode * in fe = (struct ocfs2_dinode *)main_bm_bh->b_data; -/* main_bm_bh is validated by inode read inside ocfs2_inode_lock(), -* so any corruption is a code bug. */ -BUG_ON (!OCFS2_IS_VALID_DINODE (fe)); +/* JBD-managed buffers can bypass validation, so treat this as corruption. */ +if (!OCFS2_IS_VALID_DINODE (fe)) { + ret =ocfs2_error (main_bm_inode->i_sb, +"Invalid dinode #%llu\n" , + (unsigned long long )OCFS2_I (main_bm_inode)->ip_blkno); + goto out_unlock; + }if (le16_to_cpu (fe->id2.i_chain.cl_cpg) != ocfs2_group_bitmap_size(osb->sb, 0,
Greg Kroah-Hartman
maintainerPATCH 65/589 KVM: SEV: Drop WARN on large size for KVM_MEMORY_ENCRYPT_REG_REGION
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 8acffeef5ef720c35e513e322ab08e32683f32f2 upstream.
Drop the WARN in sev_pin_memory() on npages overflowing an int, as the WARN is comically trivially to trigger from userspace, e.g. by doing:
struct kvm_enc_region range = {
.addr = 0,
.size = -1ul,
};
__vm_ioctl(vm, KVM_MEMORY_ENCRYPT_REG_REGION, &range);Note, the checks in sev_mem_enc_register_region() that presumably exist to verify the incoming address+size are completely worthless, as both "addr" and "size" are u64s and SEV is 64-bit only, i.e. they _can't_ be greater than ULONG_MAX. That wart will be cleaned up in the near future.
if (range->addr > ULONG_MAX || range->size > ULONG_MAX) return -EINVAL;
Opportunistically add a comment to explain why the code calculates the number of pages the "hard" way, e.g. instead of just shifting @ulen.
--- arch/x86/kvm/svm/sev.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
arch/x86/kvm/svm/sev.c +7 -4
@@ -338,10 +338,16 @@ static struct page **sev_pin_memory(struif (ulen ==0 || uaddr + ulen < uaddr)return ERR_PTR (-EINVAL ); -/* Calculate number of pages. */ +/* +* Calculate the number of pages that need to be pinned to cover the +* entire range. Note! This isn't simply ulen >> PAGE_SHIFT, as KVM +* doesn't require the incoming address+size to be page aligned! +*/ first = (uaddr &PAGE_MASK ) >>PAGE_SHIFT ; last = ((uaddr + ulen -1 ) &PAGE_MASK ) >>PAGE_SHIFT ; npages = (last - first +1 ); +if (npages >INT_MAX ) +return ERR_PTR (-EINVAL ); locked = sev->pages_locked + npages; lock_limit =rlimit (RLIMIT_MEMLOCK ) >>PAGE_SHIFT ;
@@ -350,9 +356,6 @@ static struct page **sev_pin_memory(strureturn ERR_PTR (-ENOMEM ); } -if (WARN_ON_ONCE (npages >INT_MAX )) -return ERR_PTR (-EINVAL ); -/* Avoid using vmalloc for smaller buffers. */ size = npages *sizeof (struct page *);if (size >PAGE_SIZE )
Greg Kroah-Hartman
maintainerPATCH 66/589 ACPI: property: Constify stubs for CONFIG_ACPI=n case
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
commit 5c1a72a0fbe1b02c3ce0537f85f92ea935e0beec upstream.
There is a few stubs that left untouched during constification of the fwnode related APIs. Constify three more stubs here.
--- include/linux/acpi.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/linux/acpi.h +3 -3
@@ -753,7 +753,7 @@ static inline bool is_acpi_device_node(struct fwnode_handle *fwnode)return false; } -static inline struct acpi_device *to_acpi_device_node (struct fwnode_handle *fwnode) +static inline struct acpi_device *to_acpi_device_node (const struct fwnode_handle *fwnode) {return NULL ; }
@@ -763,12 +763,12 @@ static inline bool is_acpi_data_node(struct fwnode_handle *fwnode)return false; } -static inline struct acpi_data_node *to_acpi_data_node (struct fwnode_handle *fwnode) +static inline struct acpi_data_node *to_acpi_data_node (const struct fwnode_handle *fwnode) {return NULL ; } -static inline bool acpi_data_node_match (struct fwnode_handle *fwnode, +static inline bool acpi_data_node_match (const struct fwnode_handle *fwnode,const char *name) {return false;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 67/589 rxrpc: Fix call removal to use RCU safe deletion
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 146d4ab94cf129ee06cd467cb5c71368a6b5bad6 ]
Fix rxrpc call removal from the rxnet->calls list to use list_del_rcu() rather than list_del_init() to prevent stuffing up reading /proc/net/rxrpc/calls from potentially getting into an infinite loop.
This, however, means that list_empty() no longer works on an entry that's been deleted from the list, making it harder to detect prior deletion. Fix this by:
Firstly, make rxrpc_destroy_all_calls() only dump the first ten calls that are unexpectedly still on the list. Limiting the number of steps means there's no need to call cond_resched() or to remove calls from the list here, thereby eliminating the need for rxrpc_put_call() to check for that.
rxrpc_put_call() can then be fixed to unconditionally delete the call from the list as it is the only place that the deletion occurs.
--- net/rxrpc/call_object.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-)
net/rxrpc/call_object.c +8 -14
@@ -634,11 +634,9 @@ void rxrpc_put_call(struct rxrpc_call *call, enum rxrpc_call_trace op)_debug ("call %d dead" , call->debug_id); ASSERTCMP(call->state, ==, RXRPC_CALL_COMPLETE); -if (!list_empty (&call->link)) { -write_lock (&rxnet->call_lock); -list_del_init (&call->link); -write_unlock (&rxnet->call_lock); - } +write_lock (&rxnet->call_lock); +list_del_rcu (&call->link); +write_unlock (&rxnet->call_lock);rxrpc_cleanup_call (call); }
@@ -709,24 +707,20 @@ void rxrpc_destroy_all_calls(struct rxrpc_net *rxnet)_enter ("" );if (!list_empty (&rxnet->calls)) { -write_lock (&rxnet->call_lock); +int shown =0 ; -while (!list_empty (&rxnet->calls)) { - call =list_entry (rxnet->calls.next, - struct rxrpc_call, link); -_debug ("Zapping call %p" , call); +write_lock (&rxnet->call_lock); +list_for_each_entry (call, &rxnet->calls, link) {rxrpc_see_call (call); -list_del_init (&call->link);pr_err ("Call %p still in use (%d,%s,%lx,%lx)!\n" , call,refcount_read (&call->ref), rxrpc_call_states[call->state], call->flags, call->events); -write_unlock (&rxnet->call_lock); -cond_resched (); -write_lock (&rxnet->call_lock); +if (++shown >=10 ) +break ; }write_unlock (&rxnet->call_lock);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 68/589 rxrpc: proc: size address buffers for %pISpc output
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit a44ce6aa2efb61fe44f2cfab72bb01544bbca272 ]
The AF_RXRPC procfs helpers format local and remote socket addresses into fixed 50-byte stack buffers with "%pISpc".
That is too small for the longest current-tree IPv6-with-port form the formatter can produce. In lib/vsprintf.c, the compressed IPv6 path uses a dotted-quad tail not only for v4mapped addresses, but also for ISATAP addresses via ipv6_addr_is_isatap().
As a result, a case such as
[ffff:ffff:ffff:ffff:0:5efe:255.255.255.255]:65535
is possible with the current formatter. That is 50 visible characters, so 51 bytes including the trailing NUL, which does not fit in the existing char[50] buffers used by net/rxrpc/proc.c.
Size the buffers from the formatter's maximum textual form and switch the call sites to scnprintf().
Changes since v1:
- correct the changelog to cite the actual maximum current-tree case explicitly
- frame the proof around the ISATAP formatting path instead of the earlier mapped-v4 example
--- net/rxrpc/proc.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-)
net/rxrpc/proc.c +15 -11
@@ -10,6 +10,10 @@#include <net/af_rxrpc.h> #include "ar-internal.h" +#define RXRPC_PROC_ADDRBUF_SIZE \ + (sizeof("[xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:255.255.255.255]") + \ + sizeof(":12345")) +static const char *const rxrpc_conn_states[RXRPC_CONN__NR_STATES ] = { [RXRPC_CONN_UNUSED ] ="Unused " , [RXRPC_CONN_CLIENT ] ="Client " ,
@@ -61,7 +65,7 @@ static int rxrpc_call_seq_show(struct seq_file *seq, void *v)struct rxrpc_net *rxnet =rxrpc_net (seq_file_net (seq));unsigned long timeout =0 ;rxrpc_seq_t tx_hard_ack, rx_hard_ack; -char lbuff[50 ], rbuff[50 ]; +char lbuff[RXRPC_PROC_ADDRBUF_SIZE ], rbuff[RXRPC_PROC_ADDRBUF_SIZE ];if (v == &rxnet->calls) { seq_puts(seq,
@@ -78,7 +82,7 @@ static int rxrpc_call_seq_show(struct seq_file *seq, void *v)if (rx) { local =READ_ONCE (rx->local);if (local) -sprintf (lbuff,"%pISpc" , &local->srx.transport); +scnprintf (lbuff,sizeof (lbuff),"%pISpc" , &local->srx.transport);else strcpy (lbuff,"no_local" ); }else {
@@ -87,7 +91,7 @@ static int rxrpc_call_seq_show(struct seq_file *seq, void *v) peer = call->peer;if (peer) -sprintf (rbuff,"%pISpc" , &peer->srx.transport); +scnprintf (rbuff,sizeof (rbuff),"%pISpc" , &peer->srx.transport);else strcpy (rbuff,"no_connection" );
@@ -158,7 +162,7 @@ static int rxrpc_connection_seq_show(struct seq_file *seq, void *v) {struct rxrpc_connection *conn;struct rxrpc_net *rxnet =rxrpc_net (seq_file_net (seq)); -char lbuff[50 ], rbuff[50 ]; +char lbuff[RXRPC_PROC_ADDRBUF_SIZE ], rbuff[RXRPC_PROC_ADDRBUF_SIZE ];if (v == &rxnet->conn_proc_list) { seq_puts(seq,
@@ -177,9 +181,9 @@ static int rxrpc_connection_seq_show(struct seq_file *seq, void *v) goto print; } -sprintf (lbuff,"%pISpc" , &conn->params.local->srx.transport); +scnprintf (lbuff,sizeof (lbuff),"%pISpc" , &conn->params.local->srx.transport); -sprintf (rbuff,"%pISpc" , &conn->params.peer->srx.transport); +scnprintf (rbuff,sizeof (rbuff),"%pISpc" , &conn->params.peer->srx.transport); print:seq_printf (seq, "UDP %-47.47s %-47.47s %4x %08x %s %3u"
@@ -216,7 +220,7 @@ static int rxrpc_peer_seq_show(struct seq_file *seq, void *v) {struct rxrpc_peer *peer;time64_t now; -char lbuff[50 ], rbuff[50 ]; +char lbuff[RXRPC_PROC_ADDRBUF_SIZE ], rbuff[RXRPC_PROC_ADDRBUF_SIZE ];if (v ==SEQ_START_TOKEN ) { seq_puts(seq,
@@ -229,9 +233,9 @@ static int rxrpc_peer_seq_show(struct seq_file *seq, void *v) peer = list_entry(v, struct rxrpc_peer, hash_link); -sprintf (lbuff,"%pISpc" , &peer->local->srx.transport); +scnprintf (lbuff,sizeof (lbuff),"%pISpc" , &peer->local->srx.transport); -sprintf (rbuff,"%pISpc" , &peer->srx.transport); +scnprintf (rbuff,sizeof (rbuff),"%pISpc" , &peer->srx.transport); now =ktime_get_seconds (); seq_printf(seq,
@@ -341,7 +345,7 @@ const struct seq_operations rxrpc_peer_seq_ops = {static int rxrpc_local_seq_show (struct seq_file *seq,void *v) {struct rxrpc_local *local; -char lbuff[50 ]; +char lbuff[RXRPC_PROC_ADDRBUF_SIZE ];if (v ==SEQ_START_TOKEN ) { seq_puts(seq,
@@ -352,7 +356,7 @@ static int rxrpc_local_seq_show(struct seq_file *seq, void *v) local = hlist_entry(v, struct rxrpc_local, link); -sprintf (lbuff,"%pISpc" , &local->srx.transport); +scnprintf (lbuff,sizeof (lbuff),"%pISpc" , &local->srx.transport); seq_printf(seq, "UDP %-47.47s %3u %3u\n",
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 69/589 Revert "wifi: cfg80211: stop NAN and P2P in cfg80211_leave"
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guocai He <[email protected]>
This reverts commit d91240f24e831d3bd36954599ada6b456fb1bd0a which is commit e1696c8bd0056bc1a5f7766f58ac333adc203e8a upstream.
The reverted patch introduced a deadlock. The locking situation in mainline is totally different, so it is incorrect to directly backport the commit from mainline.
--- net/wireless/core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
net/wireless/core.c +1 -3
@@ -1208,10 +1208,8 @@ void __cfg80211_leave(struct cfg80211_registered_device *rdev,/* must be handled by mac80211/driver, has no APIs */ break ;case NL80211_IFTYPE_P2P_DEVICE : -cfg80211_stop_p2p_device (rdev, wdev); -break ;case NL80211_IFTYPE_NAN : -cfg80211_stop_nan (rdev, wdev); +/* cannot happen, has no netdev */ break ;case NL80211_IFTYPE_AP_VLAN :case NL80211_IFTYPE_MONITOR :
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 70/589 media: uvcvideo: Allow extra entities
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
[ Upstream commit cae79e50d1222010fde8c522410c315f74d35c40 ]
Increase the size of the id, to avoid collisions with entities implemented by the driver that are not part of the UVC device.
Entities exposed by the UVC device use IDs 0-255, extra entities implemented by the driver (such as the GPIO entity) use IDs 256 and up.
--- drivers/media/usb/uvc/uvc_driver.c | 2 +- drivers/media/usb/uvc/uvcvideo.h | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/media/usb/uvc/uvc_driver.c +1 -1
@@ -1032,7 +1032,7 @@ static int uvc_parse_streaming(struct uvc_device *dev,return ret; } -static struct uvc_entity *uvc_alloc_entity (u16 type,u8 id, +static struct uvc_entity *uvc_alloc_entity (u16 type,u16 id,unsigned int num_pads,unsigned int extra_size) {struct uvc_entity *entity;
drivers/media/usb/uvc/uvcvideo.h +6 -1
@@ -302,7 +302,12 @@ struct uvc_entity {* chain. */ unsigned int flags; -u8 id; +/* +* Entities exposed by the UVC device use IDs 0-255, extra entities +* implemented by the driver (such as the GPIO entity) use IDs 256 and +* up. +*/ +u16 id;u16 type;char name[64 ];
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 71/589 media: uvcvideo: Mark invalid entities with id UVC_INVALID_ENTITY_ID
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thadeu Lima de Souza Cascardo <[email protected]>
[ Upstream commit 0e2ee70291e64a30fe36960c85294726d34a103e ]
Per UVC 1.1+ specification 3.7.2, units and terminals must have a non-zero unique ID.
``` Each Unit and Terminal within the video function is assigned a unique identification number, the Unit ID (UID) or Terminal ID (TID), contained in the bUnitID or bTerminalID field of the descriptor. The value 0x00 is reserved for undefined ID, ```
If we add a new entity with id 0 or a duplicated ID, it will be marked as UVC_INVALID_ENTITY_ID.
In a previous attempt commit 3dd075fe8ebb ("media: uvcvideo: Require entities to have a non-zero unique ID"), we ignored all the invalid units, this broke a lot of non-compatible cameras. Hopefully we are more lucky this time.
This also prevents some syzkaller reproducers from triggering warnings due to a chain of entities referring to themselves. In one particular case, an Output Unit is connected to an Input Unit, both with the same ID of 1. But when looking up for the source ID of the Output Unit, that same entity is found instead of the input entity, which leads to such warnings.
In another case, a backward chain was considered finished as the source ID was 0. Later on, that entity was found, but its pads were not valid.
Here is a sample stack trace for one of those cases.
[ 20.650953] usb 1-1: new high-speed USB device number 2 using dummy_hcd [ 20.830206] usb 1-1: Using ep0 maxpacket: 8 [ 20.833501] usb 1-1: config 0 descriptor?? [ 21.038518] usb 1-1: string descriptor 0 read error: -71 [ 21.038893] usb 1-1: Found UVC 0.00 device <unnamed> (2833:0201) [ 21.039299] uvcvideo 1-1:0.0: Entity type for entity Output 1 was not initialized! [ 21.041583] uvcvideo 1-1:0.0: Entity type for entity Input 1 was not initialized! [ 21.042218] ------------[ cut here ]------------ [ 21.042536] WARNING: CPU: 0 PID: 9 at drivers/media/mc/mc-entity.c:1147 media_create_pad_link+0x2c4/0x2e0 [ 21.043195] Modules linked in: [ 21.043535] CPU: 0 UID: 0 PID: 9 Comm: kworker/0:1 Not tainted 6.11.0-rc7-00030-g3480e43aeccf #444 [ 21.044101] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.15.0-1 04/01/2014 [ 21.044639] Workqueue: usb_hub_wq hub_event [ 21.045100] RIP: 0010:media_create_pad_link+0x2c4/0x2e0 [ 21.045508] Code: fe e8 20 01 00 00 b8 f4 ff ff ff 48 83 c4 30 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc 0f 0b eb e9 0f 0b eb 0a 0f 0b eb 06 <0f> 0b eb 02 0f 0b b8 ea ff ff ff eb d4 66 2e 0f 1f 84 00 00 00 00 [ 21.046801] RSP: 0018:ffffc9000004b318 EFLAGS: 00010246 [ 21.047227] RAX: ffff888004e5d458 RBX: 0000000000000000 RCX: ffffffff818fccf1 [ 21.047719] RDX: 000000000000007b RSI: 0000000000000000 RDI: ffff888004313290 [ 21.048241] RBP: ffff888004313290 R08: 0001ffffffffffff R09: 0000000000000000 [ 21.048701] R10: 0000000000000013 R11: 0001888004313290 R12: 0000000000000003 [ 21.049138] R13: ffff888004313080 R14: ffff888004313080 R15: 0000000000000000 [ 21.049648] FS: 0000000000000000(0000) GS:ffff88803ec00000(0000) knlGS:0000000000000000 [ 21.050271] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 21.050688] CR2: 0000592cc27635b0 CR3: 000000000431c000 CR4: 0000000000750ef0 [ 21.051136] PKRU: 55555554 [ 21.051331] Call Trace: [ 21.051480] <TASK> [ 21.051611] ? __warn+0xc4/0x210 [ 21.051861] ? media_create_pad_link+0x2c4/0x2e0 [ 21.052252] ? report_bug+0x11b/0x1a0 [ 21.052540] ? trace_hardirqs_on+0x31/0x40 [ 21.052901] ? handle_bug+0x3d/0x70 [ 21.053197] ? exc_invalid_op+0x1a/0x50 [ 21.053511] ? asm_exc_invalid_op+0x1a/0x20 [ 21.053924] ? media_create_pad_link+0x91/0x2e0 [ 21.054364] ? media_create_pad_link+0x2c4/0x2e0 [ 21.054834] ? media_create_pad_link+0x91/0x2e0 [ 21.055131] ? _raw_spin_unlock+0x1e/0x40 [ 21.055441] ? __v4l2_device_register_subdev+0x202/0x210 [ 21.055837] uvc_mc_register_entities+0x358/0x400 [ 21.056144] uvc_register_chains+0x1fd/0x290 [ 21.056413] uvc_probe+0x380e/0x3dc0 [ 21.056676] ? __lock_acquire+0x5aa/0x26e0 [ 21.056946] ? find_held_lock+0x33/0xa0 [ 21.057196] ? kernfs_activate+0x70/0x80 [ 21.057533] ? usb_match_dynamic_id+0x1b/0x70 [ 21.057811] ? find_held_lock+0x33/0xa0 [ 21.058047] ? usb_match_dynamic_id+0x55/0x70 [ 21.058330] ? lock_release+0x124/0x260 [ 21.058657] ? usb_match_one_id_intf+0xa2/0x100 [ 21.058997] usb_probe_interface+0x1ba/0x330 [ 21.059399] really_probe+0x1ba/0x4c0 [ 21.059662] __driver_probe_device+0xb2/0x180 [ 21.059944] driver_probe_device+0x5a/0x100 [ 21.060170] __device_attach_driver+0xe9/0x160 [ 21.060427] ? __pfx___device_attach_driver+0x10/0x10 [ 21.060872] bus_for_each_drv+0xa9/0x100 [ 21.061312] __device_attach+0xed/0x190 [ 21.061812] device_initial_probe+0xe/0x20 [ 21.062229] bus_probe_device+0x4d/0xd0 [ 21.062590] device_add+0x308/0x590 [ 21.062912] usb_set_configuration+0x7b6/0xaf0 [ 21.063403] usb_generic_driver_probe+0x36/0x80 [ 21.063714] usb_probe_device+0x7b/0x130 [ 21.063936] really_probe+0x1ba/0x4c0 [ 21.064111] __driver_probe_device+0xb2/0x180 [ 21.064577] driver_probe_device+0x5a/0x100 [ 21.065019] __device_attach_driver+0xe9/0x160 [ 21.065403] ? __pfx___device_attach_driver+0x10/0x10 [ 21.065820] bus_for_each_drv+0xa9/0x100 [ 21.066094] __device_attach+0xed/0x190 [ 21.066535] device_initial_probe+0xe/0x20 [ 21.066992] bus_probe_device+0x4d/0xd0 [ 21.067250] device_add+0x308/0x590 [ 21.067501] usb_new_device+0x347/0x610 [ 21.067817] hub_event+0x156b/0x1e30 [ 21.068060] ? process_scheduled_works+0x48b/0xaf0 [ 21.068337] process_scheduled_works+0x5a3/0xaf0 [ 21.068668] worker_thread+0x3cf/0x560 [ 21.068932] ? kthread+0x109/0x1b0 [ 21.069133] kthread+0x197/0x1b0 [ 21.069343] ? __pfx_worker_thread+0x10/0x10 [ 21.069598] ? __pfx_kthread+0x10/0x10 [ 21.069908] ret_from_fork+0x32/0x40 [ 21.070169] ? __pfx_kthread+0x10/0x10 [ 21.070424] ret_from_fork_asm+0x1a/0x30 [ 21.070737] </TASK>
--- drivers/media/usb/uvc/uvc_driver.c | 66 +++++++++++++++++++----------- drivers/media/usb/uvc/uvcvideo.h | 2 + 2 files changed, 44 insertions(+), 24 deletions(-)
drivers/media/usb/uvc/uvc_driver.c +42 -24
@@ -412,6 +412,9 @@ struct uvc_entity *uvc_entity_by_id(struct uvc_device *dev, int id) {struct uvc_entity *entity; +if (id ==UVC_INVALID_ENTITY_ID ) +return NULL ; +list_for_each_entry (entity, &dev->entities, list) {if (entity->id == id)return entity;
@@ -1032,14 +1035,27 @@ static int uvc_parse_streaming(struct uvc_device *dev,return ret; } -static struct uvc_entity *uvc_alloc_entity (u16 type,u16 id, -unsigned int num_pads,unsigned int extra_size) +static struct uvc_entity *uvc_alloc_new_entity (struct uvc_device *dev,u16 type, +u16 id,unsigned int num_pads, +unsigned int extra_size) {struct uvc_entity *entity;unsigned int num_inputs;unsigned int size;unsigned int i; +/* Per UVC 1.1+ spec 3.7.2, the ID should be non-zero. */ +if (id ==0 ) { +dev_err (&dev->intf->dev,"Found Unit with invalid ID 0\n" ); + id =UVC_INVALID_ENTITY_ID ; + } + +/* Per UVC 1.1+ spec 3.7.2, the ID is unique. */ +if (uvc_entity_by_id (dev, id)) { +dev_err (&dev->intf->dev,"Found multiple Units with ID %u\n" , id); + id =UVC_INVALID_ENTITY_ID ; + } + extra_size =roundup (extra_size,sizeof (*entity->pads));if (num_pads) num_inputs = type &UVC_TERM_OUTPUT ? num_pads : num_pads -1 ;
@@ -1049,7 +1065,7 @@ static struct uvc_entity *uvc_alloc_entity(u16 type, u16 id, + num_inputs; entity =kzalloc (size,GFP_KERNEL );if (entity ==NULL ) -return NULL ; +return ERR_PTR (-ENOMEM ); entity->id = id; entity->type = type;
@@ -1120,10 +1136,10 @@ static int uvc_parse_vendor_control(struct uvc_device *dev,break ; } - unit =uvc_alloc_entity (UVC_VC_EXTENSION_UNIT , buffer[3 ], - p +1 ,2 *n); -if (unit ==NULL ) -return -ENOMEM ; + unit =uvc_alloc_new_entity (dev,UVC_VC_EXTENSION_UNIT , + buffer[3 ], p +1 ,2 * n); +if (IS_ERR (unit)) +return PTR_ERR (unit);memcpy (unit->extension.guidExtensionCode, &buffer[4 ],16 ); unit->extension.bNumControls = buffer[20 ];
@@ -1234,10 +1250,10 @@ static int uvc_parse_standard_control(struct uvc_device *dev,return -EINVAL ; } - term =uvc_alloc_entity (type |UVC_TERM_INPUT , buffer[3 ], -1 , n + p); -if (term ==NULL ) -return -ENOMEM ; + term =uvc_alloc_new_entity (dev, type |UVC_TERM_INPUT , + buffer[3 ],1 , n + p); +if (IS_ERR (term)) +return PTR_ERR (term);if (UVC_ENTITY_TYPE (term) ==UVC_ITT_CAMERA ) { term->camera.bControlSize = n;
@@ -1293,10 +1309,10 @@ static int uvc_parse_standard_control(struct uvc_device *dev,return 0 ; } - term =uvc_alloc_entity (type |UVC_TERM_OUTPUT , buffer[3 ], -1 ,0 ); -if (term ==NULL ) -return -ENOMEM ; + term =uvc_alloc_new_entity (dev, type |UVC_TERM_OUTPUT , + buffer[3 ],1 ,0 ); +if (IS_ERR (term)) +return PTR_ERR (term);memcpy (term->baSourceID, &buffer[7 ],1 );
@@ -1317,9 +1333,10 @@ static int uvc_parse_standard_control(struct uvc_device *dev,return -EINVAL ; } - unit =uvc_alloc_entity (buffer[2 ], buffer[3 ], p +1 ,0 ); -if (unit ==NULL ) -return -ENOMEM ; + unit =uvc_alloc_new_entity (dev, buffer[2 ], buffer[3 ], + p +1 ,0 ); +if (IS_ERR (unit)) +return PTR_ERR (unit);memcpy (unit->baSourceID, &buffer[5 ], p);
@@ -1341,9 +1358,9 @@ static int uvc_parse_standard_control(struct uvc_device *dev,return -EINVAL ; } - unit =uvc_alloc_entity (buffer[2 ], buffer[3 ],2 , n); -if (unit ==NULL ) -return -ENOMEM ; + unit =uvc_alloc_new_entity (dev, buffer[2 ], buffer[3 ],2 , n); +if (IS_ERR (unit)) +return PTR_ERR (unit);memcpy (unit->baSourceID, &buffer[4 ],1 ); unit->processing.wMaxMultiplier =
@@ -1372,9 +1389,10 @@ static int uvc_parse_standard_control(struct uvc_device *dev,return -EINVAL ; } - unit =uvc_alloc_entity (buffer[2 ], buffer[3 ], p +1 , n); -if (unit ==NULL ) -return -ENOMEM ; + unit =uvc_alloc_new_entity (dev, buffer[2 ], buffer[3 ], + p +1 , n); +if (IS_ERR (unit)) +return PTR_ERR (unit);memcpy (unit->extension.guidExtensionCode, &buffer[4 ],16 ); unit->extension.bNumControls = buffer[20 ];
drivers/media/usb/uvc/uvcvideo.h +2 -0
@@ -170,6 +170,8 @@ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71} +#define UVC_INVALID_ENTITY_ID 0xffff +/* ------------------------------------------------------------------------ * Driver specific constants. */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 72/589 media: uvcvideo: Use heuristic to find stream entity
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
[ Upstream commit 758dbc756aad429da11c569c0d067f7fd032bcf7 ]
Some devices, like the Grandstream GUV3100 webcam, have an invalid UVC descriptor where multiple entities share the same ID, this is invalid and makes it impossible to make a proper entity tree without heuristics.
We have recently introduced a change in the way that we handle invalid entities that has caused a regression on broken devices.
Implement a new heuristic to handle these devices properly.
--- drivers/media/usb/uvc/uvc_driver.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_driver.c +14 -1
@@ -442,13 +442,26 @@ static struct uvc_entity *uvc_entity_by_reference(struct uvc_device *dev,static struct uvc_streaming *uvc_stream_by_id (struct uvc_device *dev,int id) { -struct uvc_streaming *stream; +struct uvc_streaming *stream, *last_stream; +unsigned int count =0 ;list_for_each_entry (stream, &dev->streams, list) { + count +=1 ; + last_stream = stream;if (stream->header.bTerminalLink == id)return stream; } +/* +* If the streaming entity is referenced by an invalid ID, notify the +* user and use heuristics to guess the correct entity. +*/ +if (count ==1 && id ==UVC_INVALID_ENTITY_ID ) { +dev_warn (&dev->intf->dev, +"UVC non compliance: Invalid USB header. The streaming entity has an invalid ID, guessing the correct one." ); +return last_stream; + } +return NULL ; }
Signature · 1 line
2.53.0
Re: [PATCH 5.10 072/589] media: uvcvideo: Use heuristic to find stream entity
Quoted 37 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda<[email protected]>
[ Upstream commit
758dbc756aad429da11c569c0d067f7fd032bcf7]Some devices, like the Grandstream GUV3100 webcam, have an invalid UVC descriptor where multiple entities share the same ID, this is invalid and makes it impossible to make a proper entity tree without heuristics.
We have recently introduced a change in the way that we handle invalid entities that has caused a regression on broken devices.
Implement a new heuristic to handle these devices properly.
Reported-by Angel4005<[email protected]>Closes https://lore.kernel.org/linux-media/CAOzBiVuS7ygUjjhCbyWg-KiNx+HFTYnqH5+GJhd6cYsNLT=DaA@mail.gmail.com/ open hereFixes 0e2ee70291e6 ("media: uvcvideo: Mark invalid entities with id UVC_INVALID_ENTITY_ID")Signed-off-by Ricardo Ribalda<[email protected]>Reviewed-by Hans de Goede<[email protected]>Signed-off-by Hans Verkuil<[email protected]>Tested-by Ron Economos<[email protected]>Tested-by Pavel Machek (CIP)<[email protected]>Tested-by Brett A C Sheffield<[email protected]>Tested-by Mark Brown<[email protected]>Tested-by Barry K. Nathan<[email protected]>Tested-by Peter Schneider<[email protected]>Tested-by Francesco Dolcini<[email protected]>Tested-by Shuah Khan<[email protected]>Tested-by Jon Hunter<[email protected]>Tested-by Florian Fainelli<[email protected]>Tested-by Miguel Ojeda<[email protected]>Tested-by Vijayendra Suman<[email protected]>Signed-off-by Sasha Levin<[email protected]>
Quoted 3 lines
--- drivers/media/usb/uvc/uvc_driver.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
Comparing this patch to the corresponding patches that went into 5.15.203/6.1.169/6.6.117/6.12.58/6.17.8, I believe these Tested-by tags may be incorrect.
(Incidentally, I think my email client may have removed some of the spaces in the quoted text, but I'm not sure why that happened.)
Signature · 1 line
-Barry K. Nathan <[email protected]>
Re: [PATCH 5.10 072/589] media: uvcvideo: Use heuristic to find stream entity
In reply to Greg Kroah-HartmanQuoted 7 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
[ Upstream commit
758dbc756aad429da11c569c0d067f7fd032bcf7]
This doesn't properly fix the problem. Commit 3d9f32e02c2e "media:
uvcvideo: Create an ID namespace for streaming output terminals" (which reverts this) needs to be applied on top. I haven't checked whether that would apply cleanly.
Ben.
Quoted 65 lines
Some devices, like the Grandstream GUV3100 webcam, have an invalid UVC descriptor where multiple entities share the same ID, this is invalid and makes it impossible to make a proper entity tree without heuristics.
We have recently introduced a change in the way that we handle invalid entities that has caused a regression on broken devices.
Implement a new heuristic to handle these devices properly.
Reported-by Angel4005 <[email protected]>Closes https://lore.kernel.org/linux-media/CAOzBiVuS7ygUjjhCbyWg-KiNx+HFTYnqH5+GJhd6cYsNLT=DaA@mail.gmail.com/ open hereFixes 0e2ee70291e6 ("media: uvcvideo: Mark invalid entities with id UVC_INVALID_ENTITY_ID")Signed-off-by Ricardo Ribalda <[email protected]>Reviewed-by Hans de Goede <[email protected]>Signed-off-by Hans Verkuil <[email protected]>Tested-by Ron Economos <[email protected]>Tested-by Pavel Machek (CIP) <[email protected]>Tested-by Brett A C Sheffield <[email protected]>Tested-by Mark Brown <[email protected]>Tested-by Barry K. Nathan <[email protected]>Tested-by Peter Schneider <[email protected]>Tested-by Francesco Dolcini <[email protected]>Tested-by Shuah Khan <[email protected]>Tested-by Jon Hunter <[email protected]>Tested-by Florian Fainelli <[email protected]>Tested-by Miguel Ojeda <[email protected]>Tested-by Vijayendra Suman <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- drivers/media/usb/uvc/uvc_driver.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)drivers/media/usb/uvc/uvc_driver.c +14
-1@@ -442,13 +442,26 @@ static struct uvc_entity *uvc_entity_by_reference(struct uvc_device *dev,static struct uvc_streaming *uvc_stream_by_id (struct uvc_device *dev,int id) { -struct uvc_streaming *stream; +struct uvc_streaming *stream, *last_stream; +unsigned int count =0 ;list_for_each_entry (stream, &dev->streams, list) { + count +=1 ; + last_stream = stream;if (stream->header.bTerminalLink == id)return stream; } +/* +* If the streaming entity is referenced by an invalid ID, notify the +* user and use heuristics to guess the correct entity. +*/ +if (count ==1 && id ==UVC_INVALID_ENTITY_ID ) { +dev_warn (&dev->intf->dev, +"UVC non compliance: Invalid USB header. The streaming entity has an invalid ID, guessing the correct one." ); +return last_stream; + } +return NULL ; }
Signature · 3 lines
Ben Hutchings Time is nature's way of making sure that everything doesn't happen at once.
Sasha Levin
maintainerRe: [PATCH 5.10 072/589] media: uvcvideo: Use heuristic to find stream entity
Quoted 3 lines · Ben Hutchings
This doesn't properly fix the problem. Commit
3d9f32e02c2e"media:
uvcvideo: Create an ID namespace for streaming output terminals" (which reverts this) needs to be applied on top.
Rather than carry the heuristic and then layer the namespace rework on top in 5.10 only, I've dropped this together with its regression source 0e2ee70291e6 ("media: uvcvideo: Mark invalid entities with id UVC_INVALID_ENTITY_ID") from the 5.10 queue. That mirrors what 3d9f32e02c2e does upstream (it reverts the heuristic), and avoids exposing the 0e2ee70291e6 regression that would otherwise enter 5.10 in the same batch.
Quoted 3 lines · Barry K. Nathan
Comparing this patch to the corresponding patches that went into 5.15.203/6.1.169/6.6.117/6.12.58/6.17.8, I believe these Tested-by tags may be incorrect.
You're right that the tag set on the 5.10 backport was over-attributed relative to the other branches; since the patch is being dropped this is now moot. Thanks to you both for the review.
--
Thanks,
Sasha
Re: [PATCH 5.10 072/589] media: uvcvideo: Use heuristic to find stream entity
Hi Sasha
Quoted 6 lines · Sasha Levin
Quoted 3 lines · Ben Hutchings
This doesn't properly fix the problem. Commit
3d9f32e02c2e"media:
uvcvideo: Create an ID namespace for streaming output terminals" (which reverts this) needs to be applied on top.
Quoted 6 lines
Rather than carry the heuristic and then layer the namespace rework on top in 5.10 only, I've dropped this together with its regression source
0e2ee70291e6("media: uvcvideo: Mark invalid entities with idUVC_INVALID_ENTITY_ID") from the 5.10 queue. That mirrors what3d9f32e02c2edoes upstream (it reverts the heuristic), and avoids exposing the0e2ee70291e6regression that would otherwise enter 5.10 in the same batch.
Are you going to apply:
Commit 3d9f32e02c2e "media: uvcvideo: Create an ID namespace for streaming output terminals"
?
We need either that patch or this one: media: uvcvideo: Use heuristic to find stream entity
The namespace solution is cleaner, which is why it is the upstream solution, but both patches solve the issue.
Regards
Quoted 13 lines
Quoted 3 lines · Barry K. Nathan
Comparing this patch to the corresponding patches that went into 5.15.203/6.1.169/6.6.117/6.12.58/6.17.8, I believe these Tested-by tags may be incorrect.
You're right that the tag set on the 5.10 backport was over-attributed relative to the other branches; since the patch is being dropped this is now moot. Thanks to you both for the review.
--
Thanks,
Sasha
Signature · 1 line
Ricardo Ribalda
Greg Kroah-Hartman
maintainerRe: [PATCH 5.10 072/589] media: uvcvideo: Use heuristic to find stream entity
Quoted 16 lines · Ricardo Ribalda
Hi Sasha
Quoted 6 lines · Sasha Levin
Quoted 3 lines · Ben Hutchings
This doesn't properly fix the problem. Commit
3d9f32e02c2e"media:
uvcvideo: Create an ID namespace for streaming output terminals" (which reverts this) needs to be applied on top.Quoted 6 lines
Rather than carry the heuristic and then layer the namespace rework on top in 5.10 only, I've dropped this together with its regression source
0e2ee70291e6("media: uvcvideo: Mark invalid entities with idUVC_INVALID_ENTITY_ID") from the 5.10 queue. That mirrors what3d9f32e02c2edoes upstream (it reverts the heuristic), and avoids exposing the0e2ee70291e6regression that would otherwise enter 5.10 in the same batch.
Quoted 5 lines
Are you going to apply:
Commit
3d9f32e02c2e"media: uvcvideo: Create an ID namespace for streaming output terminals"
?
It wasn't planned on.
Quoted 2 lines
We need either that patch or this one: media: uvcvideo: Use heuristic to find stream entity
What id is that?
thanks,
greg k-h
Re: [PATCH 5.10 072/589] media: uvcvideo: Use heuristic to find stream entity
Hi Greg
Quoted 24 lines · Greg Kroah-Hartman
Quoted 16 lines · Ricardo Ribalda
Hi Sasha
Quoted 6 lines · Sasha Levin
Quoted 3 lines · Ben Hutchings
This doesn't properly fix the problem. Commit
3d9f32e02c2e"media:
uvcvideo: Create an ID namespace for streaming output terminals" (which reverts this) needs to be applied on top.Quoted 6 lines
Rather than carry the heuristic and then layer the namespace rework on top in 5.10 only, I've dropped this together with its regression source
0e2ee70291e6("media: uvcvideo: Mark invalid entities with idUVC_INVALID_ENTITY_ID") from the 5.10 queue. That mirrors what3d9f32e02c2edoes upstream (it reverts the heuristic), and avoids exposing the0e2ee70291e6regression that would otherwise enter 5.10 in the same batch.Quoted 5 lines
Are you going to apply:
Commit
3d9f32e02c2e"media: uvcvideo: Create an ID namespace for streaming output terminals"
?
Quoted 6 lines
It wasn't planned on.
Quoted 2 lines
We need either that patch or this one: media: uvcvideo: Use heuristic to find stream entity
What id is that?
Sorry, I should have been more specific. I am talking about Upstream commit 758dbc756aad429da11c569c0d067f7fd032bcf7.
(this patch that we are discussing)
Regards
Quoted 4 lines
thanks,
greg k-h
Signature · 1 line
Ricardo Ribalda
Greg Kroah-Hartman
maintainerPATCH 73/589 checkpatch: add support for Assisted-by tag
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sasha Levin <[email protected]>
commit d1db4118489fffd2b2f612140b7acbb477880839 upstream.
The Assisted-by tag was introduced in Documentation/process/coding-assistants.rst for attributing AI tool contributions to kernel patches. However, checkpatch.pl did not recognize this tag, causing two issues:
WARNING: Non-standard signature: Assisted-by:
ERROR: Unrecognized email address: 'AGENT_NAME:MODEL_VERSION'
Fix this by:
1. Adding Assisted-by to the recognized $signature_tags list
2. Skipping email validation for Assisted-by lines since they use the AGENT_NAME:MODEL_VERSION format instead of an email address
3. Warning when the Assisted-by value doesn't match the expected format
--- scripts/checkpatch.pl | 10 ++++++++++ 1 file changed, 10 insertions(+)
scripts/checkpatch.pl +10 -0
@@ -502,6 +502,7 @@ our $signature_tags = qr{(?xi: Reviewed-by:| Reported-by:| Suggested-by:| + Assisted-by:| To:| Cc: )};
@@ -2789,6 +2790,15 @@ sub process { } } + # Assisted-by uses AGENT_NAME:MODEL_VERSION format, not email + if ($sign_off =~ /^Assisted-by:/i) { + if ($email !~ /^\S+:\S+/) { + WARN("BAD_SIGN_OFF", + "Assisted-by expects 'AGENT_NAME:MODEL_VERSION [TOOL1] [TOOL2]' format\n" . $herecurr); + } + next; + } + my ($email_name, $name_comment, $email_address, $comment) = parse_email($email); my $suggested_email = format_email(($email_name, $name_comment, $email_address, $comment)); if ($suggested_email eq "") {
Greg Kroah-Hartman
maintainerPATCH 74/589 KVM: x86: Use scratch field in MMIO fragment to hold small write values
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 0b16e69d17d8c35c5c9d5918bf596c75a44655d3 upstream.
When exiting to userspace to service an emulated MMIO write, copy the to-be-written value to a scratch field in the MMIO fragment if the size of the data payload is 8 bytes or less, i.e. can fit in a single chunk, instead of pointing the fragment directly at the source value.
This fixes a class of use-after-free bugs that occur when the emulator initiates a write using an on-stack, local variable as the source, the write splits a page boundary, *and* both pages are MMIO pages. Because KVM's ABI only allows for physically contiguous MMIO requests, accesses that split MMIO pages are separated into two fragments, and are sent to userspace one at a time. When KVM attempts to complete userspace MMIO in response to KVM_RUN after the first fragment, KVM will detect the second fragment and generate a second userspace exit, and reference the on-stack variable.
The issue is most visible if the second KVM_RUN is performed by a separate task, in which case the stack of the initiating task can show up as truly freed data.
==================================================================
BUG: KASAN: use-after-free in complete_emulated_mmio+0x305/0x420
Read of size 1 at addr ffff888009c378d1 by task syz-executor417/984
CPU: 1 PID: 984 Comm: syz-executor417 Not tainted 5.10.0-182.0.0.95.h2627.eulerosv2r13.x86_64 #3
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.15.0-0-g2dd4b9b3f840-prebuilt.qemu.org 04/01/2014 Call Trace:
dump_stack+0xbe/0xfd
print_address_description.constprop.0+0x19/0x170
__kasan_report.cold+0x6c/0x84
kasan_report+0x3a/0x50
check_memory_region+0xfd/0x1f0
memcpy+0x20/0x60
complete_emulated_mmio+0x305/0x420
kvm_arch_vcpu_ioctl_run+0x63f/0x6d0
kvm_vcpu_ioctl+0x413/0xb20
__se_sys_ioctl+0x111/0x160
do_syscall_64+0x30/0x40
entry_SYSCALL_64_after_hwframe+0x67/0xd1
RIP: 0033:0x42477d
Code: <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007faa8e6890e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000004d7338 RCX: 000000000042477d
RDX: 0000000000000000 RSI: 000000000000ae80 RDI: 0000000000000005
RBP: 00000000004d7330 R08: 00007fff28d546df R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000004d733c
R13: 0000000000000000 R14: 000000000040a200 R15: 00007fff28d54720
The buggy address belongs to the page:
page:0000000029f6a428 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x9c37
flags: 0xfffffc0000000(node=0|zone=1|lastcpupid=0x1fffff)
raw: 000fffffc0000000 0000000000000000 ffffea0000270dc8 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff888009c37780: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff888009c37800: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff888009c37880: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff888009c37900: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff888009c37980: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================The bug can also be reproduced with a targeted KVM-Unit-Test by hacking KVM to fill a large on-stack variable in complete_emulated_mmio(), i.e. by overwrite the data value with garbage.
Limit the use of the scratch fields to 8-byte or smaller accesses, and to just writes, as larger accesses and reads are not affected thanks to implementation details in the emulator, but add a sanity check to ensure those details don't change in the future. Specifically, KVM never uses on-stack variables for accesses larger that 8 bytes, e.g. uses an operand in the emulator context, and *all* reads are buffered through the mem_read cache.
Note! Using the scratch field for reads is not only unnecessary, it's also extremely difficult to handle correctly. As above, KVM buffers all reads through the mem_read cache, and heavily relies on that behavior when re-emulating the instruction after a userspace MMIO read exit. If a read splits a page, the first page is NOT an MMIO page, and the second page IS an MMIO page, then the MMIO fragment needs to point at _just_ the second chunk of the destination, i.e. its position in the mem_read cache. Taking the "obvious" approach of copying the fragment value into the destination when re-emulating the instruction would clobber the first chunk of the destination, i.e. would clobber the data that was read from guest memory.
--- arch/x86/kvm/x86.c | 14 +++++++++++++- include/linux/kvm_host.h | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-)
arch/x86/kvm/x86.c +13 -1
@@ -6489,7 +6489,13 @@ static int emulator_read_write_onepage(uWARN_ON (vcpu->mmio_nr_fragments >=KVM_MAX_MMIO_FRAGMENTS ); frag = &vcpu->mmio_fragments[vcpu->mmio_nr_fragments++]; frag->gpa = gpa; - frag->data = val; +if (write && bytes <=8u ) { + frag->val =0 ; + frag->data = &frag->val; +memcpy (&frag->val, val, bytes); + }else { + frag->data = val; + } frag->len = bytes;return X86EMUL_CONTINUE ; }
@@ -6504,6 +6510,9 @@ static int emulator_read_write(struct x8gpa_t gpa;int rc; +if (WARN_ON_ONCE ((bytes >8u || !ops->write) &&object_is_on_stack (val))) +return X86EMUL_UNHANDLEABLE ; +if (ops->read_write_prepare && ops->read_write_prepare (vcpu, val, bytes))return X86EMUL_CONTINUE ;
@@ -9554,6 +9563,9 @@ static int complete_emulated_mmio(struct frag++; vcpu->mmio_cur_fragment++; }else { +if (WARN_ON_ONCE (frag->data == &frag->val)) +return -EIO ; +/* Go forward to the next mmio piece. */ frag->data += len; frag->gpa += len;
include/linux/kvm_host.h +2 -1
@@ -257,7 +257,8 @@ static inline bool kvm_vcpu_mapped(strucstruct kvm_mmio_fragment {gpa_t gpa;void *data; -unsigned len; +u64 val; +unsigned int len; };struct kvm_vcpu {
Greg Kroah-Hartman
maintainerPATCH 75/589 mm/kasan: fix double free for kasan pXds
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ritesh Harjani (IBM) <[email protected]>
commit 51d8c78be0c27ddb91bc2c0263941d8b30a47d3b upstream.
kasan_free_pxd() assumes the page table is always struct page aligned. But that's not always the case for all architectures. E.g. In case of powerpc with 64K pagesize, PUD table (of size 4096) comes from slab cache named pgtable-2^9. Hence instead of page_to_virt(pxd_page()) let's just directly pass the start of the pxd table which is passed as the 1st argument.
This fixes the below double free kasan issue seen with PMEM:
radix-mmu: Mapped 0x0000047d10000000-0x0000047f90000000 with 2.00 MiB pages
==================================================================
BUG: KASAN: double-free in kasan_remove_zero_shadow+0x9c4/0xa20
Free of addr c0000003c38e0000 by task ndctl/2164
CPU: 34 UID: 0 PID: 2164 Comm: ndctl Not tainted 6.19.0-rc1-00048-gea1013c15392 #157 VOLUNTARY Hardware name: IBM,9080-HEX POWER10 (architected) 0x800200 0xf000006 of:IBM,FW1060.00 (NH1060_012) hv:phyp pSeries Call Trace: dump_stack_lvl+0x88/0xc4 (unreliable) print_report+0x214/0x63c kasan_report_invalid_free+0xe4/0x110 check_slab_allocation+0x100/0x150 kmem_cache_free+0x128/0x6e0 kasan_remove_zero_shadow+0x9c4/0xa20 memunmap_pages+0x2b8/0x5c0 devm_action_release+0x54/0x70 release_nodes+0xc8/0x1a0 devres_release_all+0xe0/0x140 device_unbind_cleanup+0x30/0x120 device_release_driver_internal+0x3e4/0x450 unbind_store+0xfc/0x110 drv_attr_store+0x78/0xb0 sysfs_kf_write+0x114/0x140 kernfs_fop_write_iter+0x264/0x3f0 vfs_write+0x3bc/0x7d0 ksys_write+0xa4/0x190 system_call_exception+0x190/0x480 system_call_vectored_common+0x15c/0x2ec ---- interrupt: 3000 at 0x7fff93b3d3f4 NIP: 00007fff93b3d3f4 LR: 00007fff93b3d3f4 CTR: 0000000000000000 REGS: c0000003f1b07e80 TRAP: 3000 Not tainted (6.19.0-rc1-00048-gea1013c15392) MSR: 800000000280f033 <SF,VEC,VSX,EE,PR,FP,ME,IR,DR,RI,LE> CR: 48888208 XER: 00000000
<...>
NIP [00007fff93b3d3f4] 0x7fff93b3d3f4
LR [00007fff93b3d3f4] 0x7fff93b3d3f4
---- interrupt: 3000
The buggy address belongs to the object at c0000003c38e0000 which belongs to the cache pgtable-2^9 of size 4096 The buggy address is located 0 bytes inside of 4096-byte region [c0000003c38e0000, c0000003c38e1000) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x3c38c head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 memcg:c0000003bfd63e01 flags: 0x63ffff800000040(head|node=6|zone=0|lastcpupid=0x7ffff) page_type: f5(slab) raw: 063ffff800000040 c000000140058980 5deadbeef0000122 0000000000000000 raw: 0000000000000000 0000000080200020 00000000f5000000 c0000003bfd63e01 head: 063ffff800000040 c000000140058980 5deadbeef0000122 0000000000000000 head: 0000000000000000 0000000080200020 00000000f5000000 c0000003bfd63e01 head: 063ffff800000002 c00c000000f0e301 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000004 page dumped because: kasan: bad access detected
[ 138.953636] [ T2164] Memory state around the buggy address: [ 138.953643] [ T2164] c0000003c38dff00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 138.953652] [ T2164] c0000003c38dff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 138.953661] [ T2164] >c0000003c38e0000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 138.953669] [ T2164] ^ [ 138.953675] [ T2164] c0000003c38e0080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 138.953684] [ T2164] c0000003c38e0100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 138.953692] [ T2164] ================================================================== [ 138.953701] [ T2164] Disabling lock debugging due to kernel taint
--- mm/kasan/init.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
mm/kasan/init.c +4 -4
@@ -294,7 +294,7 @@ static void kasan_free_pte(pte_t *pte_streturn ; } -pte_free_kernel (&init_mm, (pte_t *)page_to_virt (pmd_page (*pmd))); +pte_free_kernel (&init_mm, pte_start);pmd_clear (pmd); }
@@ -309,7 +309,7 @@ static void kasan_free_pmd(pmd_t *pmd_streturn ; } -pmd_free (&init_mm, (pmd_t *)page_to_virt (pud_page (*pud))); +pmd_free (&init_mm, pmd_start);pud_clear (pud); }
@@ -324,7 +324,7 @@ static void kasan_free_pud(pud_t *pud_streturn ; } -pud_free (&init_mm, (pud_t *)page_to_virt (p4d_page (*p4d))); +pud_free (&init_mm, pud_start);p4d_clear (p4d); }
@@ -339,7 +339,7 @@ static void kasan_free_p4d(p4d_t *p4d_streturn ; } -p4d_free (&init_mm, (p4d_t *)page_to_virt (pgd_page (*pgd))); +p4d_free (&init_mm, p4d_start);pgd_clear (pgd); }
Greg Kroah-Hartman
maintainerPATCH 76/589 media: vidtv: fix nfeeds state corruption on start_streaming failure
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruslan Valiyev <[email protected]>
commit a0e5a598fe9a4612b852406b51153b881592aede upstream.
syzbot reported a memory leak in vidtv_psi_service_desc_init [1].
When vidtv_start_streaming() fails inside vidtv_start_feed(), the nfeeds counter is left incremented even though no feed was actually started. This corrupts the driver state: subsequent start_feed calls see nfeeds > 1 and skip starting the mux, while stop_feed calls eventually try to stop a non-existent stream.
This state corruption can also lead to memory leaks, since the mux and channel resources may be partially allocated during a failed start_streaming but never cleaned up, as the stop path finds dvb->streaming == false and returns early.
Fix by decrementing nfeeds back when start_streaming fails, keeping the counter in sync with the actual number of active feeds.
[1]
BUG: memory leak unreferenced object 0xffff888145b50820 (size 32): comm "syz.0.17", pid 6068, jiffies 4294944486 backtrace (crc 90a0c7d4): vidtv_psi_service_desc_init+0x74/0x1b0 drivers/media/test-drivers/vidtv/vidtv_psi.c:288 vidtv_channel_s302m_init+0xb1/0x2a0 drivers/media/test-drivers/vidtv/vidtv_channel.c:83 vidtv_channels_init+0x1b/0x40 drivers/media/test-drivers/vidtv/vidtv_channel.c:524 vidtv_mux_init+0x516/0xbe0 drivers/media/test-drivers/vidtv/vidtv_mux.c:518 vidtv_start_streaming drivers/media/test-drivers/vidtv/vidtv_bridge.c:194 [inline] vidtv_start_feed+0x33e/0x4d0 drivers/media/test-drivers/vidtv/vidtv_bridge.c:239
--- drivers/media/test-drivers/vidtv/vidtv_bridge.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/test-drivers/vidtv/vidtv_bridge.c +3 -1
@@ -235,8 +235,10 @@ static int vidtv_start_feed(struct dvb_dif (dvb->nfeeds ==1 ) { ret =vidtv_start_streaming (dvb); -if (ret <0 ) +if (ret <0 ) { + dvb->nfeeds--; rc = ret; + } }mutex_unlock (&dvb->feed_lock);
Greg Kroah-Hartman
maintainerPATCH 77/589 media: em28xx: fix use-after-free in em28xx_v4l2_open()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abhishek Kumar <[email protected]>
commit a66485a934c7187ae8e36517d40615fa2e961cff upstream.
em28xx_v4l2_open() reads dev->v4l2 without holding dev->lock, creating a race with em28xx_v4l2_init()'s error path and em28xx_v4l2_fini(), both of which free the em28xx_v4l2 struct and set dev->v4l2 to NULL under dev->lock.
This race leads to two issues:
- use-after-free in v4l2_fh_init() when accessing vdev->ctrl_handler, since the video_device is embedded in the freed em28xx_v4l2 struct.
- NULL pointer dereference in em28xx_resolution_set() when accessing v4l2->norm, since dev->v4l2 has been set to NULL.
Fix this by moving the mutex_lock() before the dev->v4l2 read and adding a NULL check for dev->v4l2 under the lock.
--- drivers/media/usb/em28xx/em28xx-video.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/media/usb/em28xx/em28xx-video.c +10 -4
@@ -2136,7 +2136,7 @@ static int em28xx_v4l2_open(struct file {struct video_device *vdev =video_devdata (filp);struct em28xx *dev =video_drvdata (filp); -struct em28xx_v4l2 *v4l2 = dev->v4l2; +struct em28xx_v4l2 *v4l2;enum v4l2_buf_type fh_type =0 ;int ret;
@@ -2153,13 +2153,19 @@ static int em28xx_v4l2_open(struct filereturn -EINVAL ; } +if (mutex_lock_interruptible (&dev->lock)) +return -ERESTARTSYS ; + + v4l2 = dev->v4l2; +if (!v4l2) { +mutex_unlock (&dev->lock); +return -ENODEV ; + } +em28xx_videodbg ("open dev=%s type=%s users=%d\n" ,video_device_node_name (vdev), v4l2_type_names[fh_type], v4l2->users); -if (mutex_lock_interruptible (&dev->lock)) -return -ERESTARTSYS ; - ret =v4l2_fh_open (filp);if (ret) { dev_err(&dev->intf->dev,
Greg Kroah-Hartman
maintainerPATCH 78/589 ALSA: 6fire: fix use-after-free on disconnect
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Berk Cem Goksel <[email protected]>
commit b9c826916fdce6419b94eb0cd8810fdac18c2386 upstream.
In usb6fire_chip_abort(), the chip struct is allocated as the card's private data (via snd_card_new with sizeof(struct sfire_chip)). When snd_card_free_when_closed() is called and no file handles are open, the card and embedded chip are freed synchronously. The subsequent chip->card = NULL write then hits freed slab memory.
Call trace: usb6fire_chip_abort sound/usb/6fire/chip.c:59 [inline] usb6fire_chip_disconnect+0x348/0x358 sound/usb/6fire/chip.c:182 usb_unbind_interface+0x1a8/0x88c drivers/usb/core/driver.c:458 ... hub_event+0x1a04/0x4518 drivers/usb/core/hub.c:5953
Fix by moving the card lifecycle out of usb6fire_chip_abort() and into usb6fire_chip_disconnect(). The card pointer is saved in a local before any teardown, snd_card_disconnect() is called first to prevent new opens, URBs are aborted while chip is still valid, and snd_card_free_when_closed() is called last so chip is never accessed after the card may be freed.
--- sound/usb/6fire/chip.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
sound/usb/6fire/chip.c +12 -5
@@ -54,11 +54,6 @@ static void usb6fire_chip_abort(struct susb6fire_comm_abort (chip);if (chip->control)usb6fire_control_abort (chip); -if (chip->card) { -snd_card_disconnect (chip->card); -snd_card_free_when_closed (chip->card); - chip->card =NULL ; - } } }
@@ -171,6 +166,7 @@ destroy_chip:static void usb6fire_chip_disconnect (struct usb_interface *intf) {struct sfire_chip *chip; +struct snd_card *card; chip =usb_get_intfdata (intf);if (chip) {/* if !chip, fw upload has been performed */
@@ -181,8 +177,19 @@ static void usb6fire_chip_disconnect(str chips[chip->regidx] =NULL ;mutex_unlock (®ister_mutex); +/* +* Save card pointer before teardown. +* snd_card_free_when_closed() may free card (and +* the embedded chip) immediately, so it must be +* called last and chip must not be accessed after. +*/ + card = chip->card; chip->shutdown = true; +if (card) +snd_card_disconnect (card);usb6fire_chip_abort (chip); +if (card) +snd_card_free_when_closed (card); } } }
Greg Kroah-Hartman
maintainerPATCH 79/589 bcache: fix cached_dev.sb_bio use-after-free and crash
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mingzhe Zou <[email protected]>
commit fec114a98b8735ee89c75216c45a78e28be0f128 upstream.
In our production environment, we have received multiple crash reports regarding libceph, which have caught our attention:
``` [6888366.280350] Call Trace: [6888366.280452] blk_update_request+0x14e/0x370 [6888366.280561] blk_mq_end_request+0x1a/0x130 [6888366.280671] rbd_img_handle_request+0x1a0/0x1b0 [rbd] [6888366.280792] rbd_obj_handle_request+0x32/0x40 [rbd] [6888366.280903] __complete_request+0x22/0x70 [libceph] [6888366.281032] osd_dispatch+0x15e/0xb40 [libceph] [6888366.281164] ? inet_recvmsg+0x5b/0xd0 [6888366.281272] ? ceph_tcp_recvmsg+0x6f/0xa0 [libceph] [6888366.281405] ceph_con_process_message+0x79/0x140 [libceph] [6888366.281534] ceph_con_v1_try_read+0x5d7/0xf30 [libceph] [6888366.281661] ceph_con_workfn+0x329/0x680 [libceph] ```
After analyzing the coredump file, we found that the address of dc->sb_bio has been freed. We know that cached_dev is only freed when it is stopped.
Since sb_bio is a part of struct cached_dev, rather than an alloc every time. If the device is stopped while writing to the superblock, the released address will be accessed at endio.
This patch hopes to wait for sb_write to complete in cached_dev_free.
It should be noted that we analyzed the cause of the problem, then tell all details to the QWEN and adopted the modifications it made.
--- drivers/md/bcache/super.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/md/bcache/super.c +7 -0
@@ -1396,6 +1396,13 @@ static void cached_dev_free(struct closumutex_unlock (&bch_register_lock); +/* +* Wait for any pending sb_write to complete before free. +* The sb_bio is embedded in struct cached_dev, so we must +* ensure no I/O is in progress. +*/ +closure_sync (&dc->sb_write); +if (dc->sb_disk)put_page (virt_to_page (dc->sb_disk));
Greg Kroah-Hartman
maintainerPATCH 80/589 media: as102: fix to not free memory after the device is registered in as102_usb_probe()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeongjun Park <[email protected]>
commit 8bd29dbe03fc5b0f039ab2395ff37b64236d2f0c upstream.
In as102_usb driver, the following race condition occurs:
```
CPU0 CPU1
as102_usb_probe()
kzalloc(); // alloc as102_dev_t
....
usb_register_dev();
fd = sys_open("/path/to/dev"); // open as102 fd
....
usb_deregister_dev();
....
kfree(); // free as102_dev_t
....
sys_close(fd);
as102_release() // UAF!!
as102_usb_release()
kfree(); // DFB!!
```When a USB character device registered with usb_register_dev() is later unregistered (via usb_deregister_dev() or disconnect), the device node is removed so new open() calls fail. However, file descriptors that are already open do not go away immediately: they remain valid until the last reference is dropped and the driver's .release() is invoked.
In as102, as102_usb_probe() calls usb_register_dev() and then, on an error path, does usb_deregister_dev() and frees as102_dev_t right away. If userspace raced a successful open() before the deregistration, that open FD will later hit as102_release() --> as102_usb_release() and access or free as102_dev_t again, occur a race to use-after-free and double-free vuln.
The fix is to never kfree(as102_dev_t) directly once usb_register_dev() has succeeded. After deregistration, defer freeing memory to .release().
In other words, let release() perform the last kfree when the final open FD is closed.
--- drivers/media/usb/as102/as102_usb_drv.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/usb/as102/as102_usb_drv.c +2 -0
@@ -405,7 +405,9 @@ static int as102_usb_probe(struct usb_in failed_dvb:as102_free_usb_stream_buffer (as102_dev); failed_stream: +usb_set_intfdata (intf,NULL );usb_deregister_dev (intf, &as102_usb_class_driver); +return ret; failed:usb_put_dev (as102_dev->bus_adap.usb_dev);usb_set_intfdata (intf,NULL );
Greg Kroah-Hartman
maintainerPATCH 81/589 nilfs2: fix NULL i_assoc_inode dereference in nilfs_mdt_save_to_shadow_map
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Deepanshu Kartikey <[email protected]>
commit 4a4e0328edd9e9755843787d28f16dd4165f8b48 upstream.
The DAT inode's btree node cache (i_assoc_inode) is initialized lazily during btree operations. However, nilfs_mdt_save_to_shadow_map() assumes i_assoc_inode is already initialized when copying dirty pages to the shadow map during GC.
If NILFS_IOCTL_CLEAN_SEGMENTS is called immediately after mount before any btree operation has occurred on the DAT inode, i_assoc_inode is NULL leading to a general protection fault.
Fix this by calling nilfs_attach_btree_node_cache() on the DAT inode in nilfs_dat_read() at mount time, ensuring i_assoc_inode is always initialized before any GC operation can use it.
--- fs/nilfs2/dat.c | 3 +++ 1 file changed, 3 insertions(+)
fs/nilfs2/dat.c +3 -0
@@ -515,6 +515,9 @@ int nilfs_dat_read(struct super_block *sif (err) goto failed; + err =nilfs_attach_btree_node_cache (dat); +if (err) + goto failed; err =nilfs_read_inode_common (dat, raw_inode);if (err) goto failed;
Greg Kroah-Hartman
maintainerPATCH 82/589 media: vidtv: fix pass-by-value structs causing MSAN warnings
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abd-Alrhman Masalkhi <[email protected]>
commit 5f8e73bde67e931468bc2a1860d78d72f0c6ba41 upstream.
vidtv_ts_null_write_into() and vidtv_ts_pcr_write_into() take their argument structs by value, causing MSAN to report uninit-value warnings. While only vidtv_ts_null_write_into() has triggered a report so far, both functions share the same issue.
Fix by passing both structs by const pointer instead, avoiding the stack copy of the struct along with its MSAN shadow and origin metadata. The functions do not modify the structs, which is enforced by the const qualifier.
--- drivers/media/test-drivers/vidtv/vidtv_mux.c | 4 +- drivers/media/test-drivers/vidtv/vidtv_ts.c | 50 +++++++++++++-------------- drivers/media/test-drivers/vidtv/vidtv_ts.h | 4 +- 3 files changed, 29 insertions(+), 29 deletions(-)
drivers/media/test-drivers/vidtv/vidtv_mux.c +2 -2
@@ -233,7 +233,7 @@ static u32 vidtv_mux_push_pcr(struct vid/* the 27Mhz clock will feed both parts of the PCR bitfield */ args.pcr = m->timing.clk; - nbytes +=vidtv_ts_pcr_write_into (args); + nbytes +=vidtv_ts_pcr_write_into (&args); m->mux_buf_offset += nbytes; m->num_streamed_pcr++;
@@ -363,7 +363,7 @@ static u32 vidtv_mux_pad_with_nulls(stru args.continuity_counter = &ctx->cc;for (i =0 ; i < npkts; ++i) { - m->mux_buf_offset +=vidtv_ts_null_write_into (args); + m->mux_buf_offset +=vidtv_ts_null_write_into (&args); args.dest_offset = m->mux_buf_offset; }
drivers/media/test-drivers/vidtv/vidtv_ts.c +25 -25
97 lines not on this page · raw message
drivers/media/test-drivers/vidtv/vidtv_ts.h +2 -2
@@ -91,7 +91,7 @@ void vidtv_ts_inc_cc(u8 *continuity_coun* * Return: The number of bytes written into the buffer. */ -u32 vidtv_ts_null_write_into (struct null_packet_write_args args); +u32 vidtv_ts_null_write_into (const struct null_packet_write_args *args);/** * vidtv_ts_pcr_write_into - Write a PCR packet into a buffer.
@@ -102,6 +102,6 @@ u32 vidtv_ts_null_write_into(struct null* * Return: The number of bytes written into the buffer. */ -u32 vidtv_ts_pcr_write_into (struct pcr_write_args args); +u32 vidtv_ts_pcr_write_into (const struct pcr_write_args *args);#endif //VIDTV_TS_H
Greg Kroah-Hartman
maintainerPATCH 83/589 media: hackrf: fix to not free memory after the device is registered in hackrf_probe()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeongjun Park <[email protected]>
commit 3b7da2b4d0fe014eff181ed37e3bf832eb8ed258 upstream.
In hackrf driver, the following race condition occurs:
```
CPU0 CPU1
hackrf_probe()
kzalloc(); // alloc hackrf_dev
....
v4l2_device_register();
....
fd = sys_open("/path/to/dev"); // open hackrf fd
....
v4l2_device_unregister();
....
kfree(); // free hackrf_dev
....
sys_ioctl(fd, ...);
v4l2_ioctl();
video_is_registered() // UAF!!
....
sys_close(fd);
v4l2_release() // UAF!!
hackrf_video_release()
kfree(); // DFB!!
```When a V4L2 or video device is unregistered, the device node is removed so new open() calls are blocked.
However, file descriptors that are already open-and any in-flight I/O-do not terminate immediately; they remain valid until the last reference is dropped and the driver's release() is invoked.
Therefore, freeing device memory on the error path after hackrf_probe() has registered dev it will lead to a race to use-after-free vuln, since those already-open handles haven't been released yet.
And since release() free memory too, race to use-after-free and double-free vuln occur.
To prevent this, if device is registered from probe(), it should be modified to free memory only through release() rather than calling kfree() directly.
--- drivers/media/usb/hackrf/hackrf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/media/usb/hackrf/hackrf.c +4 -3
@@ -1488,7 +1488,7 @@ static int hackrf_probe(struct usb_interif (ret) {dev_err (dev->dev,"Failed to register as video device (%d)\n" , ret); - goto err_v4l2_device_unregister; + goto err_v4l2_device_put; }dev_info (dev->dev,"Registered as %s\n" ,video_device_node_name (&dev->rx_vdev));
@@ -1517,8 +1517,9 @@ static int hackrf_probe(struct usb_interreturn 0 ; err_video_unregister_device_rx:video_unregister_device (&dev->rx_vdev); -err_v4l2_device_unregister: -v4l2_device_unregister (&dev->v4l2_dev); +err_v4l2_device_put: +v4l2_device_put (&dev->v4l2_dev); +return ret; err_v4l2_ctrl_handler_free_tx:v4l2_ctrl_handler_free (&dev->tx_ctrl_handler); err_v4l2_ctrl_handler_free_rx:
Greg Kroah-Hartman
maintainerPATCH 84/589 net: tap: NULL pointer derefence in dev_parse_header_protocol when skb->dev is null
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezar Bulinaru <[email protected]>
commit 4f61f133f354853bc394ec7d6028adb9b02dd701 upstream.
Fixes a NULL pointer derefence bug triggered from tap driver. When tap_get_user calls virtio_net_hdr_to_skb the skb->dev is null (in tap.c skb->dev is set after the call to virtio_net_hdr_to_skb) virtio_net_hdr_to_skb calls dev_parse_header_protocol which needs skb->dev field to be valid.
The line that trigers the bug is in dev_parse_header_protocol (dev is at offset 0x10 from skb and is stored in RAX register)
if (!dev->header_ops || !dev->header_ops->parse_protocol)
22e1: mov 0x10(%rbx),%rax 22e5: mov 0x230(%rax),%rax
Setting skb->dev before the call in tap.c fixes the issue.
BUG: kernel NULL pointer dereference, address: 0000000000000230 RIP: 0010:virtio_net_hdr_to_skb.constprop.0+0x335/0x410 [tap] Code: c0 0f 85 b7 fd ff ff eb d4 41 39 c6 77 cf 29 c6 48 89 df 44 01 f6 e8 7a 79 83 c1 48 85 c0 0f 85 d9 fd ff ff eb b7 48 8b 43 10 <48> 8b 80 30 02 00 00 48 85 c0 74 55 48 8b 40 28 48 85 c0 74 4c 48 RSP: 0018:ffffc90005c27c38 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff888298f25300 RCX: 0000000000000010 RDX: 0000000000000005 RSI: ffffc90005c27cb6 RDI: ffff888298f25300 RBP: ffffc90005c27c80 R08: 00000000ffffffea R09: 00000000000007e8 R10: ffff88858ec77458 R11: 0000000000000000 R12: 0000000000000001 R13: 0000000000000014 R14: ffffc90005c27e08 R15: ffffc90005c27cb6 FS: 0000000000000000(0000) GS:ffff88858ec40000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000230 CR3: 0000000281408006 CR4: 00000000003706e0 Call Trace: tap_get_user+0x3f1/0x540 [tap] tap_sendmsg+0x56/0x362 [tap] ? get_tx_bufs+0xc2/0x1e0 [vhost_net] handle_tx_copy+0x114/0x670 [vhost_net] handle_tx+0xb0/0xe0 [vhost_net] handle_tx_kick+0x15/0x20 [vhost_net] vhost_worker+0x7b/0xc0 [vhost] ? vhost_vring_call_reset+0x40/0x40 [vhost] kthread+0xfa/0x120 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x1f/0x30
--- drivers/net/tap.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/net/tap.c +13 -10
@@ -703,11 +703,22 @@ static ssize_t tap_get_user(struct tap_queue *q, void *msg_control,skb_reset_mac_header (skb); skb->protocol =eth_hdr (skb)->h_proto; +rcu_read_lock (); + tap =rcu_dereference (q->tap); +if (!tap) { +kfree_skb (skb); +rcu_read_unlock (); +return total_len; + } + skb->dev = tap->dev; +if (vnet_hdr_len) { err =virtio_net_hdr_to_skb (skb, &vnet_hdr,tap_is_little_endian (q)); -if (err) +if (err) { +rcu_read_unlock (); goto err_kfree; + } }skb_probe_transport_header (skb);
@@ -717,8 +728,6 @@ static ssize_t tap_get_user(struct tap_queue *q, void *msg_control, vlan_get_protocol_and_depth(skb, skb->protocol, &depth) != 0)skb_set_network_header (skb, depth); -rcu_read_lock (); - tap =rcu_dereference (q->tap);/* copy skb_ubuf_info for callback when skb has no error */ if (zerocopy) {skb_shinfo (skb)->destructor_arg = msg_control;
@@ -729,14 +738,8 @@ static ssize_t tap_get_user(struct tap_queue *q, void *msg_control, uarg->callback (uarg, false); } -if (tap) { - skb->dev = tap->dev; -dev_queue_xmit (skb); - }else { -kfree_skb (skb); - } +dev_queue_xmit (skb);rcu_read_unlock (); -return total_len; err_kfree:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 85/589 scsi: qla2xxx: Fix warning message due to adisc being flushed
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quinn Tran <[email protected]>
commit 64f24af75b79cba3b86b0760e27e0fa904db570f upstream.
Fix warning message due to adisc being flushed. Linux kernel triggered a warning message where a different error code type is not matching up with the expected type. Add additional translation of one error code type to another.
WARNING: CPU: 2 PID: 1131623 at drivers/scsi/qla2xxx/qla_init.c:498 qla2x00_async_adisc_sp_done+0x294/0x2b0 [qla2xxx] CPU: 2 PID: 1131623 Comm: drmgr Not tainted 5.13.0-rc1-autotest #1
..
GPR28: c000000aaa9c8890 c0080000079ab678 c00000140a104800 c00000002bd19000 NIP [c00800000790857c] qla2x00_async_adisc_sp_done+0x294/0x2b0 [qla2xxx] LR [c008000007908578] qla2x00_async_adisc_sp_done+0x290/0x2b0 [qla2xxx]
Call Trace: [c00000001cdc3620] [c008000007908578] qla2x00_async_adisc_sp_done+0x290/0x2b0 [qla2xxx] (unreliable) [c00000001cdc3710] [c0080000078f3080] __qla2x00_abort_all_cmds+0x1b8/0x580 [qla2xxx] [c00000001cdc3840] [c0080000078f589c] qla2x00_abort_all_cmds+0x34/0xd0 [qla2xxx] [c00000001cdc3880] [c0080000079153d8] qla2x00_abort_isp_cleanup+0x3f0/0x570 [qla2xxx] [c00000001cdc3920] [c0080000078fb7e8] qla2x00_remove_one+0x3d0/0x480 [qla2xxx] [c00000001cdc39b0] [c00000000071c274] pci_device_remove+0x64/0x120 [c00000001cdc39f0] [c0000000007fb818] device_release_driver_internal+0x168/0x2a0 [c00000001cdc3a30] [c00000000070e304] pci_stop_bus_device+0xb4/0x100 [c00000001cdc3a70] [c00000000070e4f0] pci_stop_and_remove_bus_device+0x20/0x40 [c00000001cdc3aa0] [c000000000073940] pci_hp_remove_devices+0x90/0x130 [c00000001cdc3b30] [c0080000070704d0] disable_slot+0x38/0x90 [rpaphp] [ c00000001cdc3b60] [c00000000073eb4c] power_write_file+0xcc/0x180 [c00000001cdc3be0] [c0000000007354bc] pci_slot_attr_store+0x3c/0x60 [c00000001cdc3c00] [c00000000055f820] sysfs_kf_write+0x60/0x80 [c00000001cdc3c20] [c00000000055df10] kernfs_fop_write_iter+0x1a0/0x290 [c00000001cdc3c70] [c000000000447c4c] new_sync_write+0x14c/0x1d0 [c00000001cdc3d10] [c00000000044b134] vfs_write+0x224/0x330 [c00000001cdc3d60] [c00000000044b3f4] ksys_write+0x74/0x130 [c00000001cdc3db0] [c00000000002df70] system_call_exception+0x150/0x2d0 [c00000001cdc3e10] [c00000000000d45c] system_call_common+0xec/0x278
[ kovalev: bp to fix CVE-2022-49158; in qla2x00_async_prli_sp_done used
'if (res)' instead of 'else if (res)' due to the older kernel not having the preceding QLA_OS_TIMER_EXPIRED check (see upstream commit 4de067e5df12) ]
--- drivers/scsi/qla2xxx/qla_init.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/scsi/qla2xxx/qla_init.c +6 -0
@@ -283,6 +283,8 @@ static void qla2x00_async_login_sp_done(srb_t *sp, int res) ea.iop[0 ] = lio->u.logio.iop[0 ]; ea.iop[1 ] = lio->u.logio.iop[1 ]; ea.sp = sp; +if (res) + ea.data[0 ] =MBS_COMMAND_ERROR ;qla24xx_handle_plogi_done_event (vha, &ea); }
@@ -563,6 +565,8 @@ static void qla2x00_async_adisc_sp_done(srb_t *sp, int res) ea.iop[1 ] = lio->u.logio.iop[1 ]; ea.fcport = sp->fcport; ea.sp = sp; +if (res) + ea.data[0 ] =MBS_COMMAND_ERROR ;qla24xx_handle_adisc_event (vha, &ea);
@@ -1238,6 +1242,8 @@ static void qla2x00_async_prli_sp_done(srb_t *sp, int res) ea.iop[0 ] = lio->u.logio.iop[0 ]; ea.iop[1 ] = lio->u.logio.iop[1 ]; ea.sp = sp; +if (res) + ea.data[0 ] =MBS_COMMAND_ERROR ;qla24xx_handle_prli_done_event (vha, &ea); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 86/589 scsi: qla2xxx: Fix crash when I/O abort times out
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arun Easi <[email protected]>
commit 68ad83188d782b2ecef2e41ac245d27e0710fe8e upstream.
While performing CPU hotplug, a crash with the following stack was seen:
Call Trace:
qla24xx_process_response_queue+0x42a/0x970 [qla2xxx]
qla2x00_start_nvme_mq+0x3a2/0x4b0 [qla2xxx]
qla_nvme_post_cmd+0x166/0x240 [qla2xxx]
nvme_fc_start_fcp_op.part.0+0x119/0x2e0 [nvme_fc]
blk_mq_dispatch_rq_list+0x17b/0x610
__blk_mq_sched_dispatch_requests+0xb0/0x140
blk_mq_sched_dispatch_requests+0x30/0x60
__blk_mq_run_hw_queue+0x35/0x90
__blk_mq_delay_run_hw_queue+0x161/0x180
blk_execute_rq+0xbe/0x160
__nvme_submit_sync_cmd+0x16f/0x220 [nvme_core]
nvmf_connect_admin_queue+0x11a/0x170 [nvme_fabrics]
nvme_fc_create_association.cold+0x50/0x3dc [nvme_fc]
nvme_fc_connect_ctrl_work+0x19/0x30 [nvme_fc]
process_one_work+0x1e8/0x3c0On abort timeout, completion was called without checking if the I/O was already completed.
Verify that I/O and abort request are indeed outstanding before attempting completion.
--- drivers/scsi/qla2xxx/qla_init.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +10 -4
@@ -101,6 +101,7 @@ static void qla24xx_abort_iocb_timeout(void *data)struct qla_qpair *qpair = sp->qpair;u32 handle;unsigned long flags; +int sp_found =0 , cmdsp_found =0 ;if (sp->cmd_sp) ql_dbg(ql_dbg_async, sp->vha, 0x507c,
@@ -115,22 +116,27 @@ static void qla24xx_abort_iocb_timeout(void *data)spin_lock_irqsave (qpair->qp_lock_ptr, flags);for (handle =1 ; handle < qpair->req->num_outstanding_cmds; handle++) {if (sp->cmd_sp && (qpair->req->outstanding_cmds[handle] == - sp->cmd_sp)) + sp->cmd_sp)) { qpair->req->outstanding_cmds[handle] =NULL ; + cmdsp_found =1 ; + }/* removing the abort */ if (qpair->req->outstanding_cmds[handle] == sp) { qpair->req->outstanding_cmds[handle] =NULL ; + sp_found =1 ;break ; } }spin_unlock_irqrestore (qpair->qp_lock_ptr, flags); -if (sp->cmd_sp) +if (cmdsp_found && sp->cmd_sp) sp->cmd_sp->done (sp->cmd_sp,QLA_OS_TIMER_EXPIRED ); - abt->u.abt.comp_status =cpu_to_le16 (CS_TIMEOUT ); - sp->done (sp,QLA_OS_TIMER_EXPIRED ); +if (sp_found) { + abt->u.abt.comp_status =cpu_to_le16 (CS_TIMEOUT ); + sp->done (sp,QLA_OS_TIMER_EXPIRED ); + } }static void qla24xx_abort_sp_done (srb_t *sp,int res)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 87/589 net/sched: act_ct: fix ref leak when switching zones
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcelo Ricardo Leitner <[email protected]>
commit bcb74e132a76ce0502bb33d5b65533a4ed72d159 upstream.
When switching zones or network namespaces without doing a ct clear in between, it is now leaking a reference to the old ct entry. That's because tcf_ct_skb_nfct_cached() returns false and tcf_ct_flow_table_lookup() may simply overwrite it.
The fix is to, as the ct entry is not reusable, free it already at tcf_ct_skb_nfct_cached().
[ kovalev: bp to fix CVE-2022-49183; used nf_conntrack_put(&ct->ct_general)
instead of nf_ct_put(ct) due to the older kernel not yet having the conversion from the indirect call (see upstream commit 408bdcfce8df) ]
--- net/sched/act_ct.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
net/sched/act_ct.c +9 -6
@@ -589,22 +589,25 @@ static bool tcf_ct_skb_nfct_cached(struct net *net, struct sk_buff *skb,if (!ct)return false;if (!net_eq (net,read_pnet (&ct->ct_net))) -return false; + goto drop_ct;if (nf_ct_zone (ct)->id != zone_id) -return false; + goto drop_ct;/* Force conntrack entry direction. */ if (force &&CTINFO2DIR (ctinfo) !=IP_CT_DIR_ORIGINAL ) {if (nf_ct_is_confirmed (ct))nf_ct_kill (ct); -nf_conntrack_put (&ct->ct_general); -nf_ct_set (skb,NULL ,IP_CT_UNTRACKED ); - -return false; + goto drop_ct; }return true; + +drop_ct: +nf_conntrack_put (&ct->ct_general); +nf_ct_set (skb,NULL ,IP_CT_UNTRACKED ); + +return false; }/* Trim the skb to the length specified by the IP/IPv6 header,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 88/589 bpf, sockmap: Fix an infinite loop error when len is 0 in tcp_bpf_recvmsg_parser()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Jian <[email protected]>
commit d900f3d20cc3169ce42ec72acc850e662a4d4db2 upstream.
When the buffer length of the recvmsg system call is 0, we got the flollowing soft lockup problem:
watchdog: BUG: soft lockup - CPU#3 stuck for 27s! [a.out:6149] CPU: 3 PID: 6149 Comm: a.out Kdump: loaded Not tainted 6.2.0+ #30 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.15.0-1 04/01/2014 RIP: 0010:remove_wait_queue+0xb/0xc0 Code: 5e 41 5f c3 cc cc cc cc 0f 1f 80 00 00 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 0f 1f 44 00 00 41 57 <41> 56 41 55 41 54 55 48 89 fd 53 48 89 f3 4c 8d 6b 18 4c 8d 73 20 RSP: 0018:ffff88811b5978b8 EFLAGS: 00000246 RAX: 0000000000000000 RBX: ffff88811a7d3780 RCX: ffffffffb7a4d768 RDX: dffffc0000000000 RSI: ffff88811b597908 RDI: ffff888115408040 RBP: 1ffff110236b2f1b R08: 0000000000000000 R09: ffff88811a7d37e7 R10: ffffed10234fa6fc R11: 0000000000000001 R12: ffff88811179b800 R13: 0000000000000001 R14: ffff88811a7d38a8 R15: ffff88811a7d37e0 FS: 00007f6fb5398740(0000) GS:ffff888237180000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000020000000 CR3: 000000010b6ba002 CR4: 0000000000370ee0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> tcp_msg_wait_data+0x279/0x2f0 tcp_bpf_recvmsg_parser+0x3c6/0x490 inet_recvmsg+0x280/0x290 sock_recvmsg+0xfc/0x120 ____sys_recvmsg+0x160/0x3d0 ___sys_recvmsg+0xf0/0x180 __sys_recvmsg+0xea/0x1a0 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc
The logic in tcp_bpf_recvmsg_parser is as follows:
msg_bytes_ready:
copied = sk_msg_recvmsg(sk, psock, msg, len, flags);
if (!copied) {
wait data;
goto msg_bytes_ready;
}In this case, "copied" always is 0, the infinite loop occurs.
According to the Linux system call man page, 0 should be returned in this case. Therefore, in tcp_bpf_recvmsg_parser(), if the length is 0, directly return. Also modify several other functions with the same problem.
[ kovalev: bp to fix CVE-2023-53133; applied only to tcp_bpf_recvmsg as the
older kernel lacks tcp_bpf_recvmsg_parser, udp_bpf_recvmsg and unix_bpf_recvmsg (see upstream commits c5d2177a72a1, 1f5be6b3b063 and 9825d866ce0d) ]
--- net/ipv4/tcp_bpf.c | 3 +++ 1 file changed, 3 insertions(+)
net/ipv4/tcp_bpf.c +3 -0
@@ -277,6 +277,9 @@ static int tcp_bpf_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,if (unlikely (flags &MSG_ERRQUEUE ))return inet_recv_error (sk, msg, len, addr_len); +if (!len) +return 0 ; + psock =sk_psock_get (sk);if (unlikely (!psock))return tcp_recvmsg (sk, msg, len, nonblock, flags, addr_len);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 89/589 ipv6: add NULL checks for idev in SRv6 paths
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Minhong He <[email protected]>
[ Upstream commit 06413793526251870e20402c39930804f14d59c0 ]
__in6_dev_get() can return NULL when the device has no IPv6 configuration (e.g. MTU < IPV6_MIN_MTU or after NETDEV_UNREGISTER).
Add NULL checks for idev returned by __in6_dev_get() in both seg6_hmac_validate_skb() and ipv6_srh_rcv() to prevent potential NULL pointer dereferences.
--- net/ipv6/exthdrs.c | 4 ++++ net/ipv6/seg6_hmac.c | 2 ++ 2 files changed, 6 insertions(+)
net/ipv6/exthdrs.c +4 -0
@@ -361,6 +361,10 @@ static int ipv6_srh_rcv(struct sk_buff *skb) hdr = (struct ipv6_sr_hdr *)skb_transport_header (skb); idev =__in6_dev_get (skb->dev); +if (!idev) { +kfree_skb (skb); +return -1 ; + } accept_seg6 = net->ipv6.devconf_all->seg6_enabled;if (accept_seg6 > idev->cnf.seg6_enabled)
net/ipv6/seg6_hmac.c +2 -0
@@ -245,6 +245,8 @@ bool seg6_hmac_validate_skb(struct sk_buff *skb)struct inet6_dev *idev; idev =__in6_dev_get (skb->dev); +if (!idev) +return false; srh = (struct ipv6_sr_hdr *)skb_transport_header (skb);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 90/589 drm/amd/display: Add null checker before passing variables
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Hung <[email protected]>
commit 8092aa3ab8f7b737a34b71f91492c676a843043a upstream.
Checks null pointer before passing variables to functions.
This fixes 3 NULL_RETURNS issues reported by Coverity.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +6 -3
@@ -1778,7 +1778,8 @@ static int dm_suspend(void *handle)mutex_lock (&dm->dc_lock); dm->cached_dc_state =dc_copy_state (dm->dc->current_state); -dm_gpureset_toggle_interrupts (adev, dm->cached_dc_state, false); +if (dm->cached_dc_state) +dm_gpureset_toggle_interrupts (adev, dm->cached_dc_state, false);amdgpu_dm_commit_zero_streams (dm->dc);
@@ -5396,7 +5397,8 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector) aconnector->dc_sink = aconnector->dc_link->local_sink ? aconnector->dc_link->local_sink : aconnector->dc_em_sink; -dc_sink_retain (aconnector->dc_sink); +if (aconnector->dc_sink) +dc_sink_retain (aconnector->dc_sink); } }
@@ -6575,7 +6577,8 @@ static int amdgpu_dm_connector_get_modes(struct drm_connector *connector)drm_add_modes_noedid (connector,640 ,480 ); }else {amdgpu_dm_connector_ddc_get_modes (connector, edid); -amdgpu_dm_connector_add_common_modes (encoder, connector); +if (encoder) +amdgpu_dm_connector_add_common_modes (encoder, connector); }amdgpu_dm_fbc_init (connector);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 91/589 wifi: mac80211: always free skb on ieee80211_tx_prepare_skb() failure
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit d5ad6ab61cbd89afdb60881f6274f74328af3ee9 ]
ieee80211_tx_prepare_skb() has three error paths, but only two of them free the skb. The first error path (ieee80211_tx_prepare() returning TX_DROP) does not free it, while invoke_tx_handlers() failure and the fragmentation check both do.
Add kfree_skb() to the first error path so all three are consistent, and remove the now-redundant frees in callers (ath9k, mt76, mac80211_hwsim) to avoid double-free.
Document the skb ownership guarantee in the function's kdoc.
[ Exclude changes to drivers/net/wireless/mediatek/mt76/scan.c as this file is first
introduced by commit 31083e38548f("wifi: mt76: add code for emulating hardware scanning") after linux-6.14.]
--- drivers/net/wireless/ath/ath9k/channel.c | 6 ++---- drivers/net/wireless/mac80211_hwsim.c | 1 - include/net/mac80211.h | 4 ++++ net/mac80211/tx.c | 4 +++- 4 files changed, 9 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath9k/channel.c +2 -4
@@ -1011,7 +1011,7 @@ static void ath_scan_send_probe(struct ath_softc *sc,skb_set_queue_mapping (skb,IEEE80211_AC_VO );if (!ieee80211_tx_prepare_skb (sc->hw, vif, skb, band,NULL )) - goto error; +return ; txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO ];if (ath_tx_start (sc->hw, skb, &txctl))
@@ -1124,10 +1124,8 @@ ath_chanctx_send_vif_ps_frame(struct ath_softc *sc, struct ath_vif *avp, skb->priority =7 ;skb_set_queue_mapping (skb,IEEE80211_AC_VO ); -if (!ieee80211_tx_prepare_skb (sc->hw, vif, skb, band, &sta)) { -dev_kfree_skb_any (skb); +if (!ieee80211_tx_prepare_skb (sc->hw, vif, skb, band, &sta))return false; - }break ;default :return false;
drivers/net/wireless/mac80211_hwsim.c +0 -1
@@ -2275,7 +2275,6 @@ static void hw_scan_work(struct work_struct *work) hwsim->tmp_chan->band, NULL)) {rcu_read_unlock (); -kfree_skb (probe);continue ; }
include/net/mac80211.h +4 -0
@@ -6337,6 +6337,10 @@ void ieee80211_report_wowlan_wakeup(struct ieee80211_vif *vif,* @band: the band to transmit on * @sta: optional pointer to get the station to send the frame to * +* Return: %true if the skb was prepared, %false otherwise. +* On failure, the skb is freed by this function; callers must not +* free it again. +* * Note: must be called under RCU lock */ bool ieee80211_tx_prepare_skb(struct ieee80211_hw *hw,
net/mac80211/tx.c +3 -1
@@ -1869,8 +1869,10 @@ bool ieee80211_tx_prepare_skb(struct ieee80211_hw *hw,struct ieee80211_tx_data tx;struct sk_buff *skb2; -if (ieee80211_tx_prepare (sdata, &tx,NULL , skb) ==TX_DROP ) +if (ieee80211_tx_prepare (sdata, &tx,NULL , skb) ==TX_DROP ) { +kfree_skb (skb);return false; + } info->band = band; info->control.vif = vif;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 92/589 drm/amd/display: Fix memory leak
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yongzhi Liu <[email protected]>
commit 5d5c6dba2b43e28845d7d7ed32a36802329a5f52 upstream.
[why]
Resource release is needed on the error handling path to prevent memory leak.
[how]
Fix this by adding kfree on the error handling path.
--- .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 72 ++++++++++++++----- 1 file changed, 54 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +54 -18
@@ -229,8 +229,10 @@ static ssize_t dp_link_settings_read(struct file *f, char __user *buf,break ; r =put_user (*(rd_buf + result), buf); -if (r) +if (r) { +kfree (rd_buf);return r;/* r = -EFAULT */ + } buf +=1 ; size -=1 ;
@@ -388,8 +390,10 @@ static ssize_t dp_phy_settings_read(struct file *f, char __user *buf,break ; r =put_user ((*(rd_buf + result)), buf); -if (r) +if (r) { +kfree (rd_buf);return r;/* r = -EFAULT */ + } buf +=1 ; size -=1 ;
@@ -1195,8 +1199,10 @@ static ssize_t dp_dsc_clock_en_read(struct file *f, char __user *buf,break ; } -if (!pipe_ctx) +if (!pipe_ctx) { +kfree (rd_buf);return -ENXIO ; + } dsc = pipe_ctx->stream_res.dsc;if (dsc)
@@ -1212,8 +1218,10 @@ static ssize_t dp_dsc_clock_en_read(struct file *f, char __user *buf,break ; r =put_user (*(rd_buf + result), buf); -if (r) +if (r) { +kfree (rd_buf);return r;/* r = -EFAULT */ + } buf +=1 ; size -=1 ;
@@ -1351,8 +1359,10 @@ static ssize_t dp_dsc_slice_width_read(struct file *f, char __user *buf,break ; } -if (!pipe_ctx) +if (!pipe_ctx) { +kfree (rd_buf);return -ENXIO ; + } dsc = pipe_ctx->stream_res.dsc;if (dsc)
@@ -1368,8 +1378,10 @@ static ssize_t dp_dsc_slice_width_read(struct file *f, char __user *buf,break ; r =put_user (*(rd_buf + result), buf); -if (r) +if (r) { +kfree (rd_buf);return r;/* r = -EFAULT */ + } buf +=1 ; size -=1 ;
@@ -1505,8 +1517,10 @@ static ssize_t dp_dsc_slice_height_read(struct file *f, char __user *buf,break ; } -if (!pipe_ctx) +if (!pipe_ctx) { +kfree (rd_buf);return -ENXIO ; + } dsc = pipe_ctx->stream_res.dsc;if (dsc)
@@ -1522,8 +1536,10 @@ static ssize_t dp_dsc_slice_height_read(struct file *f, char __user *buf,break ; r =put_user (*(rd_buf + result), buf); -if (r) +if (r) { +kfree (rd_buf);return r;/* r = -EFAULT */ + } buf +=1 ; size -=1 ;
@@ -1655,8 +1671,10 @@ static ssize_t dp_dsc_bits_per_pixel_read(struct file *f, char __user *buf,break ; } -if (!pipe_ctx) +if (!pipe_ctx) { +kfree (rd_buf);return -ENXIO ; + } dsc = pipe_ctx->stream_res.dsc;if (dsc)
@@ -1672,8 +1690,10 @@ static ssize_t dp_dsc_bits_per_pixel_read(struct file *f, char __user *buf,break ; r =put_user (*(rd_buf + result), buf); -if (r) +if (r) { +kfree (rd_buf);return r;/* r = -EFAULT */ + } buf +=1 ; size -=1 ;
@@ -1800,8 +1820,10 @@ static ssize_t dp_dsc_pic_width_read(struct file *f, char __user *buf,break ; } -if (!pipe_ctx) +if (!pipe_ctx) { +kfree (rd_buf);return -ENXIO ; + } dsc = pipe_ctx->stream_res.dsc;if (dsc)
@@ -1817,8 +1839,10 @@ static ssize_t dp_dsc_pic_width_read(struct file *f, char __user *buf,break ; r =put_user (*(rd_buf + result), buf); -if (r) +if (r) { +kfree (rd_buf);return r;/* r = -EFAULT */ + } buf +=1 ; size -=1 ;
@@ -1857,8 +1881,10 @@ static ssize_t dp_dsc_pic_height_read(struct file *f, char __user *buf,break ; } -if (!pipe_ctx) +if (!pipe_ctx) { +kfree (rd_buf);return -ENXIO ; + } dsc = pipe_ctx->stream_res.dsc;if (dsc)
@@ -1874,8 +1900,10 @@ static ssize_t dp_dsc_pic_height_read(struct file *f, char __user *buf,break ; r =put_user (*(rd_buf + result), buf); -if (r) +if (r) { +kfree (rd_buf);return r;/* r = -EFAULT */ + } buf +=1 ; size -=1 ;
@@ -1929,8 +1957,10 @@ static ssize_t dp_dsc_chunk_size_read(struct file *f, char __user *buf,break ; } -if (!pipe_ctx) +if (!pipe_ctx) { +kfree (rd_buf);return -ENXIO ; + } dsc = pipe_ctx->stream_res.dsc;if (dsc)
@@ -1946,8 +1976,10 @@ static ssize_t dp_dsc_chunk_size_read(struct file *f, char __user *buf,break ; r =put_user (*(rd_buf + result), buf); -if (r) +if (r) { +kfree (rd_buf);return r;/* r = -EFAULT */ + } buf +=1 ; size -=1 ;
@@ -2001,8 +2033,10 @@ static ssize_t dp_dsc_slice_bpg_offset_read(struct file *f, char __user *buf,break ; } -if (!pipe_ctx) +if (!pipe_ctx) { +kfree (rd_buf);return -ENXIO ; + } dsc = pipe_ctx->stream_res.dsc;if (dsc)
@@ -2018,8 +2052,10 @@ static ssize_t dp_dsc_slice_bpg_offset_read(struct file *f, char __user *buf,break ; r =put_user (*(rd_buf + result), buf); -if (r) +if (r) { +kfree (rd_buf);return r;/* r = -EFAULT */ + } buf +=1 ; size -=1 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 93/589 thermal/int340x_thermal: handle data_vault when the value is ZERO_SIZE_PTR
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lee, Chun-Yi <[email protected]>
commit 7931e28098a4c1a2a6802510b0cbe57546d2049d upstream.
In some case, the GDDV returns a package with a buffer which has zero length. It causes that kmemdup() returns ZERO_SIZE_PTR (0x10).
Then the data_vault_read() got NULL point dereference problem when accessing the 0x10 value in data_vault.
[ 71.024560] BUG: kernel NULL pointer dereference, address:
0000000000000010
This patch uses ZERO_OR_NULL_PTR() for checking ZERO_SIZE_PTR or NULL value in data_vault.
--- drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/thermal/intel/int340x_thermal/int3400_thermal.c +5 -4
@@ -466,7 +466,7 @@ static void int3400_setup_gddv(struct int3400_thermal_priv *priv) priv->data_vault =kmemdup (obj->package.elements[0 ].buffer.pointer, obj->package.elements[0 ].buffer.length,GFP_KERNEL ); -if (!priv->data_vault) { +if (ZERO_OR_NULL_PTR (priv->data_vault)) {kfree (buffer.pointer);return ; }
@@ -531,7 +531,7 @@ static int int3400_thermal_probe(struct platform_device *pdev)if (result) goto free_rel_misc; -if (priv->data_vault) { +if (!ZERO_OR_NULL_PTR (priv->data_vault)) { result =sysfs_create_group (&pdev->dev.kobj, &data_attribute_group);if (result)
@@ -549,7 +549,8 @@ static int int3400_thermal_probe(struct platform_device *pdev) free_sysfs:cleanup_odvp (priv);if (priv->data_vault) { -sysfs_remove_group (&pdev->dev.kobj, &data_attribute_group); +if (!ZERO_OR_NULL_PTR (priv->data_vault)) +sysfs_remove_group (&pdev->dev.kobj, &data_attribute_group);kfree (priv->data_vault); } free_uuid:
@@ -579,7 +580,7 @@ static int int3400_thermal_remove(struct platform_device *pdev)if (!priv->rel_misc_dev_res)acpi_thermal_rel_misc_device_remove (priv->adev->handle); -if (priv->data_vault) +if (!ZERO_OR_NULL_PTR (priv->data_vault))sysfs_remove_group (&pdev->dev.kobj, &data_attribute_group);sysfs_remove_group (&pdev->dev.kobj, &uuid_attribute_group);thermal_zone_device_unregister (priv->thermal);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 94/589 blk-cgroup: Reinit blkg_iostat_set after clearing in blkcg_reset_stats()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Waiman Long <[email protected]>
[ Upstream commit 3d2af77e31ade05ff7ccc3658c3635ec1bea0979 ]
When blkg_alloc() is called to allocate a blkcg_gq structure with the associated blkg_iostat_set's, there are 2 fields within blkg_iostat_set that requires proper initialization - blkg & sync. The former field was introduced by commit 3b8cc6298724 ("blk-cgroup:
Optimize blkcg_rstat_flush()") while the later one was introduced by commit f73316482977 ("blk-cgroup: reimplement basic IO stats using cgroup rstat").
Unfortunately those fields in the blkg_iostat_set's are not properly re-initialized when they are cleared in v1's blkcg_reset_stats(). This can lead to a kernel panic due to NULL pointer access of the blkg pointer. The missing initialization of sync is less problematic and can be a problem in a debug kernel due to missing lockdep initialization.
Fix these problems by re-initializing them after memory clearing.
[ Remove this line: bis -> blkg = blkg for blkg was introduced by commit
3b8cc6298724 ("blk-cgroup: Optimize blkcg_rstat_flush()") since v6.2. ]
--- block/blk-cgroup.c | 4 ++++ 1 file changed, 4 insertions(+)
block/blk-cgroup.c +4 -0
@@ -464,8 +464,12 @@ static int blkcg_reset_stats(struct cgroup_subsys_state *css,struct blkg_iostat_set *bis =per_cpu_ptr (blkg->iostat_cpu, cpu);memset (bis,0 ,sizeof (*bis)); + +/* Re-initialize the cleared blkg_iostat_set */ +u64_stats_init (&bis->sync); }memset (&blkg->iostat,0 ,sizeof (blkg->iostat)); +u64_stats_init (&blkg->iostat.sync);for (i =0 ; i <BLKCG_MAX_POLS ; i++) {struct blkcg_policy *pol = blkcg_policy[i];
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 95/589 ALSA: usb-audio: fix null pointer dereference on pointer cs_desc
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengfeng Ye <[email protected]>
commit b97053df0f04747c3c1e021ecbe99db675342954 upstream.
The pointer cs_desc return from snd_usb_find_clock_source could be null, so there is a potential null pointer dereference issue. Fix this by adding a null check before dereference.
[ kovalev: bp to fix CVE-2021-47211; added Fixes tag; the null
check was added into both UAC2 and UAC3 branches since the older kernel still has the clock source lookup split between snd_usb_find_clock_source() and snd_usb_find_clock_source_v3() (see upstream commit 9ec730052fa2) ]
--- sound/usb/clock.c | 6 ++++++ 1 file changed, 6 insertions(+)
sound/usb/clock.c +6 -0
@@ -646,11 +646,17 @@ static int set_sample_rate_v2v3(struct snd_usb_audio *chip, int iface,struct uac3_clock_source_descriptor *cs_desc; cs_desc =snd_usb_find_clock_source_v3 (chip->ctrl_intf, clock); + +if (!cs_desc) +return 0 ; bmControls =le32_to_cpu (cs_desc->bmControls); }else {struct uac_clock_source_descriptor *cs_desc; cs_desc =snd_usb_find_clock_source (chip->ctrl_intf, clock); + +if (!cs_desc) +return 0 ; bmControls = cs_desc->bmControls; }
Signature · 1 line
2.53.0
Re: [PATCH 5.10 095/589] ALSA: usb-audio: fix null pointer dereference on pointer cs_desc
Quoted 16 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengfeng Ye <[email protected]>
commit
b97053df0f04747c3c1e021ecbe99db675342954upstream.The pointer
cs_descreturn fromsnd_usb_find_clock_sourcecould be null, so there is a potential null pointer dereference issue. Fix this by adding a null check before dereference.Signed-off-by Chengfeng Ye <[email protected]>Signed-off-by Takashi Iwai <[email protected]>Fixes 1dc669fed61a ("ALSA: usb-audio: UAC2: support read-only freq control")
Quoted 5 lines
[ kovalev: bp to fix CVE-2021-47211; added Fixes tag; the null
check was added into both UAC2 and UAC3 branches since the older kernel still has the clock source lookup split betweensnd_usb_find_clock_source()andsnd_usb_find_clock_source_v3()(see upstream commit9ec730052fa2) ]
In the upstream version the return statement was added in snd_usb_set_sample_rate_v2v3(), so set_sample_rate_v2v3() will do:
cur_rate = snd_usb_set_sample_rate_v2v3(chip, fmt, clock, rate); // = 0
if (cur_rate < 0) ... // false
if (!cur_rate) // true
cur_rate = prev_rate;
if (cur_rate != rate) ... validation:
if (!uac_clock_source_is_valid(chip, fmt, clock)) // true because clock soure is missing
return -ENXIO;
so it will ultimately return -ENXIO.
Whereas this backport puts the return statements in set_sample_rate_v2v3(), so it directly returns 0 i.e. silently fails. Shouldn't these be changed to return -ENXIO?
Ben.
Quoted 28 lines
Signed-off-by Vasiliy Kovalev <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- sound/usb/clock.c | 6 ++++++ 1 file changed, 6 insertions(+)sound/usb/clock.c +6
-0@@ -646,11 +646,17 @@ static int set_sample_rate_v2v3(struct snd_usb_audio *chip, int iface,struct uac3_clock_source_descriptor *cs_desc; cs_desc =snd_usb_find_clock_source_v3 (chip->ctrl_intf, clock); + +if (!cs_desc) +return 0 ; bmControls =le32_to_cpu (cs_desc->bmControls); }else {struct uac_clock_source_descriptor *cs_desc; cs_desc =snd_usb_find_clock_source (chip->ctrl_intf, clock); + +if (!cs_desc) +return 0 ; bmControls = cs_desc->bmControls; }
Signature · 3 lines
Ben Hutchings Time is nature's way of making sure that everything doesn't happen at once.
Re: [PATCH 5.10 095/589] ALSA: usb-audio: fix null pointer dereference on pointer cs_desc
Quoted 35 lines · Ben Hutchings
Quoted 16 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengfeng Ye <[email protected]>
commit
b97053df0f04747c3c1e021ecbe99db675342954upstream.The pointer
cs_descreturn fromsnd_usb_find_clock_sourcecould be null, so there is a potential null pointer dereference issue. Fix this by adding a null check before dereference.Signed-off-by Chengfeng Ye <[email protected]>Signed-off-by Takashi Iwai <[email protected]>Fixes 1dc669fed61a ("ALSA: usb-audio: UAC2: support read-only freq control")Quoted 5 lines
[ kovalev: bp to fix CVE-2021-47211; added Fixes tag; the null
check was added into both UAC2 and UAC3 branches since the older kernel still has the clock source lookup split betweensnd_usb_find_clock_source()andsnd_usb_find_clock_source_v3()(see upstream commit9ec730052fa2) ]In the upstream version the return statement was added in
snd_usb_set_sample_rate_v2v3(), soset_sample_rate_v2v3()will do:cur_rate = snd_usb_set_sample_rate_v2v3(chip, fmt, clock, rate); // = 0 if (cur_rate < 0) ... // false if (!cur_rate) // true cur_rate = prev_rate; if (cur_rate != rate) ...validation:
if (!uac_clock_source_is_valid(chip, fmt, clock)) // true because clock soure is missing
return-ENXIO;
Quoted 7 lines
so it will ultimately return
-ENXIO.Whereas this backport puts the return statements in
set_sample_rate_v2v3(), so it directly returns 0 i.e. silently fails. Shouldn't these be changed to return-ENXIO?Ben.
Hi Ben,
You're right. In 5.10 set_sample_rate_v2v3() is a single function, so return 0 here is consumed as success by snd_usb_pcm_prepare(), diverging from upstream which ends up at -ENXIO via !uac_clock_source_is_valid().
v2 sent: https://lore.kernel.org/all/[email protected]/
Signature · 2 lines
Thanks, Vasiliy
Sasha Levin
maintainerRe: [PATCH 5.10 095/589] ALSA: usb-audio: fix null pointer dereference on pointer cs_desc
In reply to Ben HutchingsQuoted 3 lines · Ben Hutchings
Whereas this backport puts the return statements in
set_sample_rate_v2v3(), so it directly returns 0 i.e. silently fails. Shouldn't these be changed to return-ENXIO?
I've dropped this v1 from the 5.10 queue so the v2 can take its place. Thanks for the review.
--
Thanks,
Sasha
Greg Kroah-Hartman
maintainerPATCH 96/589 scsi: ufs: core: Improve SCSI abort handling
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 3ff1f6b6ba6f97f50862aa50e79959cc8ddc2566 upstream.
The following has been observed on a test setup:
WARNING: CPU: 4 PID: 250 at drivers/scsi/ufs/ufshcd.c:2737 ufshcd_queuecommand+0x468/0x65c Call trace: ufshcd_queuecommand+0x468/0x65c scsi_send_eh_cmnd+0x224/0x6a0 scsi_eh_test_devices+0x248/0x418 scsi_eh_ready_devs+0xc34/0xe58 scsi_error_handler+0x204/0x80c kthread+0x150/0x1b4 ret_from_fork+0x10/0x30
That warning is triggered by the following statement:
WARN_ON(lrbp->cmd);
Fix this warning by clearing lrbp->cmd from the abort handler.
[ kovalev: bp to fix CVE-2021-47188; adapted placement of
lrbp->cmd = NULL for 5.10 function structure ]
--- drivers/scsi/ufs/ufshcd.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/ufs/ufshcd.c +1 -0
@@ -6788,6 +6788,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)__ufshcd_transfer_req_compl (hba, (1UL << tag));spin_unlock_irqrestore (host->host_lock, flags); out: + lrbp->cmd =NULL ; err =SUCCESS ; }else {dev_err (hba->dev,"%s: failed with err %d\n" , __func__, err);
Signature · 1 line
2.53.0
Re: [PATCH 5.10 096/589] scsi: ufs: core: Improve SCSI abort handling
Quoted 7 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit
3ff1f6b6ba6f97f50862aa50e79959cc8ddc2566upstream.
Since there are no patches to ufshcd in this series besides this and its revert, it seems like you should drop both of them.
Ben.
Quoted 44 lines
The following has been observed on a test setup:
WARNING: CPU: 4 PID: 250 at drivers/scsi/ufs/ufshcd.c:2737 ufshcd_queuecommand+0x468/0x65c Call trace: ufshcd_queuecommand+0x468/0x65c scsi_send_eh_cmnd+0x224/0x6a0 scsi_eh_test_devices+0x248/0x418 scsi_eh_ready_devs+0xc34/0xe58 scsi_error_handler+0x204/0x80c kthread+0x150/0x1b4 ret_from_fork+0x10/0x30That warning is triggered by the following statement:
WARN_ON(lrbp->cmd);Fix this warning by clearing
lrbp->cmdfrom the abort handler.Fixes 7a3e97b0dc4b ("[SCSI] ufshcd: UFS Host controller driver")Reviewed-by Bean Huo <[email protected]>Reviewed-by Stanley Chu <[email protected]>Signed-off-by Bart Van Assche <[email protected]>Signed-off-by Martin K. Petersen <[email protected]>[ kovalev: bp to fix CVE-2021-47188; adapted placement of
lrbp->cmd= NULL for 5.10 function structure ]Signed-off-by Vasiliy Kovalev <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- drivers/scsi/ufs/ufshcd.c | 1 + 1 file changed, 1 insertion(+)drivers/scsi/ufs/ufshcd.c +1
-0@@ -6788,6 +6788,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)__ufshcd_transfer_req_compl (hba, (1UL << tag));spin_unlock_irqrestore (host->host_lock, flags); out: + lrbp->cmd =NULL ; err =SUCCESS ; }else {dev_err (hba->dev,"%s: failed with err %d\n" , __func__, err);
Signature · 3 lines
Ben Hutchings Time is nature's way of making sure that everything doesn't happen at once.
Sasha Levin
maintainerRe: [PATCH 5.10 096/589] scsi: ufs: core: Improve SCSI abort handling
Quoted 2 lines · Ben Hutchings
Since there are no patches to ufshcd in this series besides this and its revert, it seems like you should drop both of them.
We could, but keeping this structure makes it easier to track in the future.
--
Thanks,
Sasha
Greg Kroah-Hartman
maintainerPATCH 97/589 IB/mad: Dont call to function that might sleep while in atomic context
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leonid Ravich <[email protected]>
commit 5c20311d76cbaeb7ed2ecf9c8b8322f8fc4a7ae3 upstream.
Tracepoints are not allowed to sleep, as such the following splat is generated due to call to ib_query_pkey() in atomic context.
WARNING: CPU: 0 PID: 1888000 at kernel/trace/ring_buffer.c:2492 rb_commit+0xc1/0x220 CPU: 0 PID: 1888000 Comm: kworker/u9:0 Kdump: loaded Tainted: G OE --------- - - 4.18.0-305.3.1.el8.x86_64 #1 Hardware name: Red Hat KVM, BIOS 1.13.0-2.module_el8.3.0+555+a55c8938 04/01/2014 Workqueue: ib-comp-unb-wq ib_cq_poll_work [ib_core] RIP: 0010:rb_commit+0xc1/0x220 RSP: 0000:ffffa8ac80f9bca0 EFLAGS: 00010202 RAX: ffff8951c7c01300 RBX: ffff8951c7c14a00 RCX: 0000000000000246 RDX: ffff8951c707c000 RSI: ffff8951c707c57c RDI: ffff8951c7c14a00 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: ffff8951c7c01300 R11: 0000000000000001 R12: 0000000000000246 R13: 0000000000000000 R14: ffffffff964c70c0 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff8951fbc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f20e8f39010 CR3: 000000002ca10005 CR4: 0000000000170ef0 Call Trace: ring_buffer_unlock_commit+0x1d/0xa0 trace_buffer_unlock_commit_regs+0x3b/0x1b0 trace_event_buffer_commit+0x67/0x1d0 trace_event_raw_event_ib_mad_recv_done_handler+0x11c/0x160 [ib_core] ib_mad_recv_done+0x48b/0xc10 [ib_core] ? trace_event_raw_event_cq_poll+0x6f/0xb0 [ib_core] __ib_process_cq+0x91/0x1c0 [ib_core] ib_cq_poll_work+0x26/0x80 [ib_core] process_one_work+0x1a7/0x360 ? create_worker+0x1a0/0x1a0 worker_thread+0x30/0x390 ? create_worker+0x1a0/0x1a0 kthread+0x116/0x130 ? kthread_flush_work_fn+0x10/0x10 ret_from_fork+0x35/0x40 ---[ end trace 78ba8509d3830a16 ]---
--- drivers/infiniband/core/mad.c | 5 ----- include/trace/events/ib_mad.h | 13 ++++--------- 2 files changed, 4 insertions(+), 14 deletions(-)
drivers/infiniband/core/mad.c +0 -5
@@ -59,9 +59,6 @@ static void create_mad_addr_info(struct ib_mad_send_wr_private *mad_send_wr,struct ib_mad_qp_info *qp_info, struct trace_event_raw_ib_mad_send_template *entry) { - u16 pkey; -struct ib_device *dev = qp_info->port_priv->device; -u8 pnum = qp_info->port_priv->port_num; struct ib_ud_wr *wr = &mad_send_wr->send_wr;struct rdma_ah_attr attr = {};
@@ -69,8 +66,6 @@ static void create_mad_addr_info(struct ib_mad_send_wr_private *mad_send_wr,/* These are common */ entry->sl = attr.sl; -ib_query_pkey (dev, pnum, wr->pkey_index, &pkey); - entry->pkey = pkey; entry->rqpn = wr->remote_qpn; entry->rqkey = wr->remote_qkey; entry->dlid =rdma_ah_get_dlid (&attr);
include/trace/events/ib_mad.h +4 -9
@@ -49,7 +49,6 @@ DECLARE_EVENT_CLASS(ib_mad_send_template, __field(int, retries_left) __field(int, max_retries)__field (int, retry) -__field (u16, pkey) ), TP_fast_assign(
@@ -89,7 +88,7 @@ DECLARE_EVENT_CLASS(ib_mad_send_template,"hdr : base_ver 0x%x class 0x%x class_ver 0x%x " \"method 0x%x status 0x%x class_specific 0x%x tid 0x%llx " \"attr_id 0x%x attr_mod 0x%x => dlid 0x%08x sl %d " \ -"pkey 0x%x rpqn 0x%x rqpkey 0x%x" , +"rpqn 0x%x rqpkey 0x%x" , __entry->dev_index, __entry->port_num, __entry->qp_num, __entry->agent_priv,be64_to_cpu (__entry->wrtid), __entry->retries_left, __entry->max_retries,
@@ -100,7 +99,7 @@ DECLARE_EVENT_CLASS(ib_mad_send_template,be16_to_cpu (__entry->class_specific),be64_to_cpu (__entry->tid),be16_to_cpu (__entry->attr_id),be32_to_cpu (__entry->attr_mod), -be32_to_cpu (__entry->dlid), __entry->sl, __entry->pkey, +be32_to_cpu (__entry->dlid), __entry->sl, __entry->rqpn, __entry->rqkey ) );
@@ -204,7 +203,6 @@ TRACE_EVENT(ib_mad_recv_done_handler, __field(u16, wc_status) __field(u32, slid)__field (u32, dev_index) -__field (u16, pkey) ), TP_fast_assign(
@@ -224,9 +222,6 @@ TRACE_EVENT(ib_mad_recv_done_handler, __entry->slid = wc->slid; __entry->src_qp = wc->src_qp; __entry->sl = wc->sl; -ib_query_pkey (qp_info->port_priv->device, - qp_info->port_priv->port_num, - wc->pkey_index, &__entry->pkey); __entry->wc_status = wc->status; ),
@@ -234,7 +229,7 @@ TRACE_EVENT(ib_mad_recv_done_handler,"base_ver 0x%02x class 0x%02x class_ver 0x%02x " \"method 0x%02x status 0x%04x class_specific 0x%04x " \"tid 0x%016llx attr_id 0x%04x attr_mod 0x%08x " \ -"slid 0x%08x src QP%d, sl %d pkey 0x%04x" , +"slid 0x%08x src QP%d, sl %d" , __entry->dev_index, __entry->port_num, __entry->qp_num, __entry->wc_status, __entry->length,
@@ -244,7 +239,7 @@ TRACE_EVENT(ib_mad_recv_done_handler,be16_to_cpu (__entry->class_specific),be64_to_cpu (__entry->tid),be16_to_cpu (__entry->attr_id),be32_to_cpu (__entry->attr_mod), - __entry->slid, __entry->src_qp, __entry->sl, __entry->pkey + __entry->slid, __entry->src_qp, __entry->sl ) );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 98/589 powerpc64/bpf: do not increment tailcall count when prog is NULL
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hari Bathini <[email protected]>
commit 521bd39d9d28ce54cbfec7f9b89c94ad4fdb8350 upstream.
Do not increment tailcall count, if tailcall did not succeed due to missing BPF program.
[ Conflicts due to missing clean up commits
b10cb163c4b3 ("powerpc64/bpf elfv2: Setup kernel TOC in r2 on entry")
49c3af43e65f ("powerpc/bpf: Simplify bpf_to_ppc() and adopt it for powerpc64")
036d559c0bde ("powerpc/bpf: Use _Rn macros for GPRs")
and missing feature commit 2ed2d8f6fb38 ("powerpc64/bpf: Support tailcalls with subprogs") resolved accordingly. ]
--- arch/powerpc/net/bpf_jit_comp64.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
arch/powerpc/net/bpf_jit_comp64.c +11 -9
@@ -257,30 +257,32 @@ static int bpf_jit_emit_tail_call(u32 *i* tail_call_cnt++; */ EMIT (PPC_RAW_ADDI (b2p[TMP_REG_1 ], b2p[TMP_REG_1 ],1 )); -PPC_BPF_STL (b2p[TMP_REG_1 ],1 ,bpf_jit_stack_tailcallcnt (ctx));/* prog = array->ptrs[index]; */ -EMIT (PPC_RAW_MULI (b2p[TMP_REG_1 ], b2p_index,8 )); -EMIT (PPC_RAW_ADD (b2p[TMP_REG_1 ], b2p[TMP_REG_1 ], b2p_bpf_array)); -PPC_BPF_LL (b2p[TMP_REG_1 ], b2p[TMP_REG_1 ], offsetof(struct bpf_array , ptrs)); +EMIT (PPC_RAW_MULI (b2p[TMP_REG_2 ], b2p_index,8 )); +EMIT (PPC_RAW_ADD (b2p[TMP_REG_2 ], b2p[TMP_REG_2 ], b2p_bpf_array)); +PPC_BPF_LL (b2p[TMP_REG_2 ], b2p[TMP_REG_2 ], offsetof(struct bpf_array , ptrs));/* * if (prog == NULL) * goto out; */ -EMIT (PPC_RAW_CMPLDI (b2p[TMP_REG_1 ],0 )); +EMIT (PPC_RAW_CMPLDI (b2p[TMP_REG_2 ],0 ));PPC_BCC (COND_EQ , out);/* goto *(prog->bpf_func + prologue_size); */ -PPC_BPF_LL (b2p[TMP_REG_1 ], b2p[TMP_REG_1 ], offsetof(struct bpf_prog , bpf_func)); +PPC_BPF_LL (b2p[TMP_REG_2 ], b2p[TMP_REG_2 ], offsetof(struct bpf_prog , bpf_func));#ifdef PPC64_ELF_ABI_v1/* skip past the function descriptor */ -EMIT (PPC_RAW_ADDI (b2p[TMP_REG_1 ], b2p[TMP_REG_1 ], +EMIT (PPC_RAW_ADDI (b2p[TMP_REG_2 ], b2p[TMP_REG_2 ],FUNCTION_DESCR_SIZE +BPF_TAILCALL_PROLOGUE_SIZE ));#else -EMIT (PPC_RAW_ADDI (b2p[TMP_REG_1 ], b2p[TMP_REG_1 ],BPF_TAILCALL_PROLOGUE_SIZE )); +EMIT (PPC_RAW_ADDI (b2p[TMP_REG_2 ], b2p[TMP_REG_2 ],BPF_TAILCALL_PROLOGUE_SIZE ));#endif -EMIT (PPC_RAW_MTCTR (b2p[TMP_REG_1 ])); +EMIT (PPC_RAW_MTCTR (b2p[TMP_REG_2 ])); + +/* Writeback updated tailcall count */ +PPC_BPF_STL (b2p[TMP_REG_1 ],1 ,bpf_jit_stack_tailcallcnt (ctx));/* tear down stack, restore NVRs, ... */ bpf_jit_emit_common_epilogue (image, ctx);
Greg Kroah-Hartman
maintainerPATCH 99/589 mailbox: Prevent out-of-bounds access in of_mbox_index_xlate()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joonwon Kang <[email protected]>
[ Upstream commit fcd7f96c783626c07ee3ed75fa3739a8a2052310 ]
Although it is guided that #mbox-cells must be at least 1, there are many instances of #mbox-cells = <0>; in the device tree. If that is the case and the corresponding mailbox controller does not provide fw_xlate and of_xlate function pointers, of_mbox_index_xlate()` will be used by default and out-of-bounds accesses could occur due to lack of bounds check in that function.
[ changed sp->nargs to sp->args_count in the code and fw_mbox_index_xlate() to of_mbox_index_xlate() in the commit message. ]
--- drivers/mailbox/mailbox.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/mailbox/mailbox.c +2 -4
@@ -468,12 +468,10 @@ static struct mbox_chan * of_mbox_index_xlate(struct mbox_controller *mbox, const struct of_phandle_args *sp) { - int ind = sp->args[0]; - -if (ind >= mbox->num_chans) +if (sp->args_count <1 || sp->args[0 ] >= mbox->num_chans)return ERR_PTR (-EINVAL ); -return &mbox->chans[ind]; +return &mbox->chans[sp->args[0 ]]; }/**
Greg Kroah-Hartman
maintainerPATCH 100/589 rxrpc: fix reference count leak in rxrpc_server_keyring()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luxiao Xu <[email protected]>
[ Upstream commit f125846ee79fcae537a964ce66494e96fa54a6de ]
This patch fixes a reference count leak in rxrpc_server_keyring() by checking if rx->securities is already set.
--- net/rxrpc/key.c | 3 +++ 1 file changed, 3 insertions(+)
net/rxrpc/key.c +3 -0
@@ -933,6 +933,9 @@ int rxrpc_server_keyring(struct rxrpc_so_enter ("" ); +if (rx->securities) +return -EINVAL ; +if (optlen <=0 || optlen >PAGE_SIZE -1 )return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 101/589 rxrpc: Fix key quota calculation for multitoken keys
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit bdbfead6d38979475df0c2f4bad2b19394fe9bdc ]
In the rxrpc key preparsing, every token extracted sets the proposed quota value, but for multitoken keys, this will overwrite the previous proposed quota, losing it.
Fix this by adding to the proposed quota instead.
--- net/rxrpc/key.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/rxrpc/key.c +3 -2
@@ -108,7 +108,7 @@ static int rxrpc_preparse_xdr_rxkad(strureturn -EKEYREJECTED ; plen =sizeof (*token) +sizeof (*token->kad) + tktlen; - prep->quotalen = datalen + plen; + prep->quotalen += datalen + plen; plen -=sizeof (*token); token =kzalloc (sizeof (*token),GFP_KERNEL );
@@ -718,6 +718,7 @@ static int rxrpc_preparse(struct key_prememcpy (&kver, prep->data,sizeof (kver)); prep->data +=sizeof (kver); prep->datalen -=sizeof (kver); + prep->quotalen =0 ;_debug ("KEY I/F VERSION: %u" , kver);
@@ -755,7 +756,7 @@ static int rxrpc_preparse(struct key_pre goto error; plen =sizeof (*token->kad) + v1->ticket_length; - prep->quotalen = plen +sizeof (*token); + prep->quotalen += plen +sizeof (*token); ret = -ENOMEM ; token =kzalloc (sizeof (*token),GFP_KERNEL );
Re: [PATCH 5.10 101/589] rxrpc: Fix key quota calculation for multitoken keys
Quoted 14 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit
bdbfead6d38979475df0c2f4bad2b19394fe9bdc]In the rxrpc key preparsing, every token extracted sets the proposed quota value, but for multitoken keys, this will overwrite the previous proposed quota, losing it.
Fix this by adding to the proposed quota instead.
Quoted 11 lines
Fixes 8a7a3eb4ddbe ("KEYS: RxRPC: Use key preparsing")Signed-off-by David Howells <[email protected]>cc Marc Dionne <[email protected]>cc Jeffrey Altman <[email protected]>cc Simon Horman <[email protected]>Signed-off-by Jakub Kicinski <[email protected]>[ dropped hunk for rxrpc_preparse_xdr_yfs_rxgk() ]
Indeed 5.10 does not have that key type, but it does have rxrpc_preparse_xdr_rxk5() which I think also needs to be updated.
Ben.
Quoted 36 lines
Signed-off-by Sasha Levin <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- net/rxrpc/key.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)net/rxrpc/key.c +3
-2@@ -108,7 +108,7 @@ static int rxrpc_preparse_xdr_rxkad(strureturn -EKEYREJECTED ; plen =sizeof (*token) +sizeof (*token->kad) + tktlen; - prep->quotalen = datalen + plen; + prep->quotalen += datalen + plen; plen -=sizeof (*token); token =kzalloc (sizeof (*token),GFP_KERNEL );@@ -718,6 +718,7 @@ static int rxrpc_preparse(struct key_prememcpy (&kver, prep->data,sizeof (kver)); prep->data +=sizeof (kver); prep->datalen -=sizeof (kver); + prep->quotalen =0 ;_debug ("KEY I/F VERSION: %u" , kver);@@ -755,7 +756,7 @@ static int rxrpc_preparse(struct key_pre goto error; plen =sizeof (*token->kad) + v1->ticket_length; - prep->quotalen = plen +sizeof (*token); + prep->quotalen += plen +sizeof (*token); ret = -ENOMEM ; token =kzalloc (sizeof (*token),GFP_KERNEL );
Signature · 3 lines
Ben Hutchings Time is nature's way of making sure that everything doesn't happen at once.
Sasha Levin
maintainerRe: [PATCH 5.10 101/589] rxrpc: Fix key quota calculation for multitoken keys
Quoted 2 lines · Ben Hutchings
Indeed 5.10 does not have that key type, but it does have
rxrpc_preparse_xdr_rxk5()which I think also needs to be updated.
I've dropped this from the 5.10 queue and will re-queue once a complete backport that also converts the rxk5 path is prepared. Thanks for the review.
--
Thanks,
Sasha
Greg Kroah-Hartman
maintainerPATCH 102/589 xfrm: clear trailing padding in build_polexpire()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yasuaki Torimaru <[email protected]>
[ Upstream commit 71a98248c63c535eaa4d4c22f099b68d902006d0 ]
build_expire() clears the trailing padding bytes of struct xfrm_user_expire after setting the hard field via memset_after(), but the analogous function build_polexpire() does not do this for struct xfrm_user_polexpire.
The padding bytes after the __u8 hard field are left uninitialized from the heap allocation, and are then sent to userspace via netlink multicast to XFRMNLGRP_EXPIRE listeners, leaking kernel heap memory contents.
Add the missing memset_after() call, matching build_expire().
--- net/xfrm/xfrm_user.c | 2 ++ 1 file changed, 2 insertions(+)
net/xfrm/xfrm_user.c +2 -0
@@ -3290,6 +3290,8 @@ static int build_polexpire(struct sk_bufreturn err; } upe->hard = !!hard; +/* clear the padding bytes */ +memset (&upe->hard +1 ,0 ,sizeof (*upe) -offsetofend (typeof (*upe), hard));nlmsg_end (skb, nlh);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 103/589 ocfs2: add inline inode consistency check to ocfs2_validate_inode_block()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Antipov <[email protected]>
[ Upstream commit a2b1c419ff72ec62ff5831684e30cd1d4f0b09ee ]
In 'ocfs2_validate_inode_block()', add an extra check whether an inode with inline data (i.e. self-contained) has no clusters, thus preventing an invalid inode from being passed to 'ocfs2_evict_inode()' and below.
Stable-dep-of: 7bc5da4842be ("ocfs2: fix out-of-bounds write in ocfs2_write_end_inline")
--- fs/ocfs2/inode.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/ocfs2/inode.c +8 -0
@@ -1418,6 +1418,14 @@ int ocfs2_validate_inode_block(struct su goto bail; } +if ((le16_to_cpu (di->i_dyn_features) &OCFS2_INLINE_DATA_FL ) && +le32_to_cpu (di->i_clusters)) { + rc =ocfs2_error (sb,"Invalid dinode %llu: %u clusters\n" , + (unsigned long long )bh->b_blocknr, +le32_to_cpu (di->i_clusters)); + goto bail; + } + rc =0 ; bail:
Greg Kroah-Hartman
maintainerPATCH 104/589 ocfs2: validate inline data i_size during inode read
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Deepanshu Kartikey <[email protected]>
[ Upstream commit 1524af3685b35feac76662cc551cbc37bd14775f ]
When reading an inode from disk, ocfs2_validate_inode_block() performs various sanity checks but does not validate the size of inline data. If the filesystem is corrupted, an inode's i_size can exceed the actual inline data capacity (id_count).
This causes ocfs2_dir_foreach_blk_id() to iterate beyond the inline data buffer, triggering a use-after-free when accessing directory entries from freed memory.
In the syzbot report:
- i_size was 1099511627576 bytes (~1TB)
- Actual inline data capacity (id_count) is typically <256 bytes
- A garbage rec_len (54648) caused ctx->pos to jump out of bounds
- This triggered a UAF in ocfs2_check_dir_entry()
Fix by adding a validation check in ocfs2_validate_inode_block() to ensure inodes with inline data have i_size <= id_count. This catches the corruption early during inode read and prevents all downstream code from operating on invalid data.
Stable-dep-of: 7bc5da4842be ("ocfs2: fix out-of-bounds write in ocfs2_write_end_inline")
--- fs/ocfs2/inode.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
fs/ocfs2/inode.c +19 -6
@@ -1418,12 +1418,25 @@ int ocfs2_validate_inode_block(struct su goto bail; } -if ((le16_to_cpu (di->i_dyn_features) &OCFS2_INLINE_DATA_FL ) && -le32_to_cpu (di->i_clusters)) { - rc =ocfs2_error (sb,"Invalid dinode %llu: %u clusters\n" , - (unsigned long long )bh->b_blocknr, -le32_to_cpu (di->i_clusters)); - goto bail; +if (le16_to_cpu (di->i_dyn_features) &OCFS2_INLINE_DATA_FL ) { +struct ocfs2_inline_data *data = &di->id2.i_data; + +if (le32_to_cpu (di->i_clusters)) { + rc =ocfs2_error (sb, +"Invalid dinode %llu: %u clusters\n" , + (unsigned long long )bh->b_blocknr, +le32_to_cpu (di->i_clusters)); + goto bail; + } + +if (le64_to_cpu (di->i_size) >le16_to_cpu (data->id_count)) { + rc =ocfs2_error (sb, +"Invalid dinode #%llu: inline data i_size %llu exceeds id_count %u\n" , + (unsigned long long )bh->b_blocknr, + (unsigned long long )le64_to_cpu (di->i_size), +le16_to_cpu (data->id_count)); + goto bail; + } } rc =0 ;
Greg Kroah-Hartman
maintainerPATCH 105/589 ocfs2: fix out-of-bounds write in ocfs2_write_end_inline
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joseph Qi <[email protected]>
[ Upstream commit 7bc5da4842bed3252d26e742213741a4d0ac1b14 ]
KASAN reports a use-after-free write of 4086 bytes in ocfs2_write_end_inline, called from ocfs2_write_end_nolock during a copy_file_range splice fallback on a corrupted ocfs2 filesystem mounted on a loop device. The actual bug is an out-of-bounds write past the inode block buffer, not a true use-after-free. The write overflows into an adjacent freed page, which KASAN reports as UAF.
The root cause is that ocfs2_try_to_write_inline_data trusts the on-disk id_count field to determine whether a write fits in inline data. On a corrupted filesystem, id_count can exceed the physical maximum inline data capacity, causing writes to overflow the inode block buffer.
Call trace (crash path):
vfs_copy_file_range (fs/read_write.c:1634)
do_splice_direct
splice_direct_to_actor
iter_file_splice_write
ocfs2_file_write_iter
generic_perform_write
ocfs2_write_end
ocfs2_write_end_nolock (fs/ocfs2/aops.c:1949)
ocfs2_write_end_inline (fs/ocfs2/aops.c:1915)
memcpy_from_folio <-- KASAN: write OOBSo add id_count upper bound check in ocfs2_validate_inode_block() to alongside the existing i_size check to fix it.
--- fs/ocfs2/inode.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
fs/ocfs2/inode.c +10 -0
@@ -1429,6 +1429,16 @@ int ocfs2_validate_inode_block(struct su goto bail; } +if (le16_to_cpu (data->id_count) > +ocfs2_max_inline_data_with_xattr (sb, di)) { + rc =ocfs2_error (sb, +"Invalid dinode #%llu: inline data id_count %u exceeds max %d\n" , + (unsigned long long )bh->b_blocknr, +le16_to_cpu (data->id_count), +ocfs2_max_inline_data_with_xattr (sb, di)); + goto bail; + } +if (le64_to_cpu (di->i_size) >le16_to_cpu (data->id_count)) { rc = ocfs2_error(sb, "Invalid dinode #%llu: inline data i_size %llu exceeds id_count %u\n",
Greg Kroah-Hartman
maintainerPATCH 106/589 rxrpc: reject undecryptable rxkad response tickets
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuqi Xu <[email protected]>
[ Upstream commit fe4447cd95623b1cfacc15f280aab73a6d7340b2 ]
rxkad_decrypt_ticket() decrypts the RXKAD response ticket and then parses the buffer as plaintext without checking whether crypto_skcipher_decrypt() succeeded.
A malformed RESPONSE can therefore use a non-block-aligned ticket length, make the decrypt operation fail, and still drive the ticket parser with attacker-controlled bytes.
Check the decrypt result and abort the connection with RXKADBADTICKET when ticket decryption fails.
--- net/rxrpc/rxkad.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/rxrpc/rxkad.c +6 -1
@@ -941,8 +941,13 @@ static int rxkad_decrypt_ticket(struct rsg_init_one (&sg[0 ], ticket, ticket_len);skcipher_request_set_callback (req,0 ,NULL ,NULL );skcipher_request_set_crypt (req, sg, sg, ticket_len, iv.x); -crypto_skcipher_decrypt (req); + ret =crypto_skcipher_decrypt (req);skcipher_request_free (req); +if (ret <0 ) { + abort_code =RXKADBADTICKET ; + ret = -EPROTO ; + goto other_error; + } p = ticket; end = p + ticket_len;
Greg Kroah-Hartman
maintainerPATCH 107/589 blk-mq: use quiesced elevator switch when reinitializing queues
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Keith Busch <[email protected]>
[ Upstream commit 8237c01f1696bc53c470493bf1fe092a107648a6 ]
The hctx's run_work may be racing with the elevator switch when reinitializing hardware queues. The queue is merely frozen in this context, but that only prevents requests from allocating and doesn't stop the hctx work from running. The work may get an elevator pointer that's being torn down, and can result in use-after-free errors and kernel panics (example below). Use the quiesced elevator switch instead, and make the previous one static since it is now only used locally.
nvme nvme0: resetting controller
nvme nvme0: 32/0/0 default/read/poll queues
BUG: kernel NULL pointer dereference, address: 0000000000000008 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 80000020c8861067 P4D 80000020c8861067 PUD 250f8c8067 PMD 0 Oops: 0000 [#1] SMP PTI Workqueue: kblockd blk_mq_run_work_fn RIP: 0010:kyber_has_work+0x29/0x70
...
Call Trace: __blk_mq_do_dispatch_sched+0x83/0x2b0 __blk_mq_sched_dispatch_requests+0x12e/0x170 blk_mq_sched_dispatch_requests+0x30/0x60 __blk_mq_run_hw_queue+0x2b/0x50 process_one_work+0x1ef/0x380 worker_thread+0x2d/0x3e0
--- block/blk-mq.c | 6 +++--- block/blk.h | 3 +-- block/elevator.c | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-)
block/blk-mq.c +3 -3
@@ -3689,14 +3689,14 @@ static bool blk_mq_elv_switch_none(strucmutex_lock (&q->sysfs_lock);/* -* After elevator_switch_mq, the previous elevator_queue will be +* After elevator_switch, the previous elevator_queue will be * released by elevator_release. The reference of the io scheduler * module get by elevator_get will also be put. So we need to get * a reference of the io scheduler module here to prevent it to be * removed. */ __module_get (qe->type->elevator_owner); -elevator_switch_mq (q,NULL ); +elevator_switch (q,NULL );mutex_unlock (&q->sysfs_lock);return true;
@@ -3721,7 +3721,7 @@ static void blk_mq_elv_switch_back(struckfree (qe);mutex_lock (&q->sysfs_lock); -elevator_switch_mq (q, t); +elevator_switch (q, t);mutex_unlock (&q->sysfs_lock); }
block/blk.h +1 -2
@@ -202,8 +202,7 @@ void blk_account_io_done(struct requestvoid blk_insert_flush (struct request *rq);void elevator_init_mq (struct request_queue *q); -int elevator_switch_mq (struct request_queue *q, -struct elevator_type *new_e); +int elevator_switch (struct request_queue *q,struct elevator_type *new_e);void __elevator_exit (struct request_queue *,struct elevator_queue *);int elv_register_queue (struct request_queue *q,bool uevent);void elv_unregister_queue (struct request_queue *q);
block/elevator.c +2 -2
@@ -572,7 +572,7 @@ void elv_unregister(struct elevator_type }EXPORT_SYMBOL_GPL (elv_unregister); -int elevator_switch_mq (struct request_queue *q, +static int elevator_switch_mq (struct request_queue *q,struct elevator_type *new_e) {int ret;
@@ -701,7 +701,7 @@ void elevator_init_mq(struct request_que* need for the new one. this way we have a chance of going back to the old * one, if the new one fails init for some reason. */ -static int elevator_switch (struct request_queue *q,struct elevator_type *new_e) +int elevator_switch (struct request_queue *q,struct elevator_type *new_e) {int err;
Greg Kroah-Hartman
maintainerPATCH 108/589 drivers: base: Free devm resources when unregistering a device
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Gow <[email protected]>
[ Upstream commit 699fb50d99039a50e7494de644f96c889279aca3 ]
In the current code, devres_release_all() only gets called if the device has a bus and has been probed.
This leads to issues when using bus-less or driver-less devices where the device might never get freed if a managed resource holds a reference to the device. This is happening in the DRM framework for example.
We should thus call devres_release_all() in the device_del() function to make sure that the device-managed actions are properly executed when the device is unregistered, even if it has neither a bus nor a driver.
This is effectively the same change than commit 2f8d16a996da ("devres:
release resources on device_del()") that got reverted by commit a525a3ddeaca ("driver core: free devres in device_release") over memory leaks concerns.
This patch effectively combines the two commits mentioned above to release the resources both on device_del() and device_release() and get the best of both worlds.
--- drivers/base/core.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/base/core.c +11 -0
@@ -3195,6 +3195,17 @@ void device_del(struct device *dev)device_remove_properties (dev);device_links_purge (dev); +/* +* If a device does not have a driver attached, we need to clean +* up any managed resources. We do this in device_release(), but +* it's never called (and we leak the device) if a managed +* resource holds a reference to the device. So release all +* managed resources here, like we do in driver_detach(). We +* still need to do so again in device_release() in case someone +* adds a new resource after this point, though. +*/ +devres_release_all (dev); +if (dev->bus)blocking_notifier_call_chain (&dev->bus->p->bus_notifier,BUS_NOTIFY_REMOVED_DEVICE , dev);
Greg Kroah-Hartman
maintainerPATCH 109/589 x86/uprobes: Fix XOL allocation failure for 32-bit tasks
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
[ Upstream commit d55c571e4333fac71826e8db3b9753fadfbead6a ]
This script
#!/usr/bin/bash
echo 0 > /proc/sys/kernel/randomize_va_space
echo 'void main(void) {}' > TEST.c
# -fcf-protection to ensure that the 1st endbr32 insn can't be emulated gcc -m32 -fcf-protection=branch TEST.c -o test
bpftrace -e 'uprobe:./test:main {}' -c ./test
"hangs", the probed ./test task enters an endless loop.
The problem is that with randomize_va_space == 0 get_unmapped_area(TASK_SIZE - PAGE_SIZE) called by xol_add_vma() can not just return the "addr == TASK_SIZE - PAGE_SIZE" hint, this addr is used by the stack vma.
arch_get_unmapped_area_topdown() doesn't take TIF_ADDR32 into account and in_32bit_syscall() is false, this leads to info.high_limit > TASK_SIZE. vm_unmapped_area() happily returns the high address > TASK_SIZE and then get_unmapped_area() returns -ENOMEM after the "if (addr > TASK_SIZE - len)" check.
handle_swbp() doesn't report this failure (probably it should) and silently restarts the probed insn. Endless loop.
I think that the right fix should change the x86 get_unmapped_area() paths to rely on TIF_ADDR32 rather than in_32bit_syscall(). Note also that if CONFIG_X86_X32_ABI=y, in_x32_syscall() falsely returns true in this case because ->orig_ax = -1.
But we need a simple fix for -stable, so this patch just sets TS_COMPAT if the probed task is 32-bit to make in_ia32_syscall() true.
--- arch/x86/kernel/uprobes.c | 24 ++++++++++++++++++++++++ include/linux/uprobes.h | 1 + kernel/events/uprobes.c | 10 +++++++--- 3 files changed, 32 insertions(+), 3 deletions(-)
arch/x86/kernel/uprobes.c +24 -0
@@ -1095,3 +1095,27 @@ bool arch_uretprobe_is_alive(struct retuelse return regs->sp <= ret->stack; } + +#ifdef CONFIG_IA32_EMULATION +unsigned long arch_uprobe_get_xol_area (void ) +{ +struct thread_info *ti =current_thread_info (); +unsigned long vaddr; + +/* +* HACK: we are not in a syscall, but x86 get_unmapped_area() paths +* ignore TIF_ADDR32 and rely on in_32bit_syscall() to calculate +* vm_unmapped_area_info.high_limit. +* +* The #ifdef above doesn't cover the CONFIG_X86_X32_ABI=y case, +* but in this case in_32bit_syscall() -> in_x32_syscall() always +* (falsely) returns true because ->orig_ax == -1. +*/ +if (test_thread_flag (TIF_ADDR32 )) + ti->status |=TS_COMPAT ; + vaddr =get_unmapped_area (NULL ,TASK_SIZE -PAGE_SIZE ,PAGE_SIZE ,0 ,0 ); + ti->status &= ~TS_COMPAT ; + +return vaddr; +} +#endif
include/linux/uprobes.h +1 -0
@@ -138,6 +138,7 @@ extern bool arch_uretprobe_is_alive(struextern bool arch_uprobe_ignore (struct arch_uprobe *aup,struct pt_regs *regs);extern void arch_uprobe_copy_ixol (struct page *page,unsigned long vaddr,void *src,unsigned long len); +extern unsigned long arch_uprobe_get_xol_area (void );#else /* !CONFIG_UPROBES */ struct uprobes_state { };
kernel/events/uprobes.c +7 -3
@@ -1438,6 +1438,12 @@ void uprobe_munmap(struct vm_area_structset_bit (MMF_RECALC_UPROBES , &vma->vm_mm->flags); } +unsigned long __weak arch_uprobe_get_xol_area (void ) +{ +/* Try to map as high as possible, this is only a hint. */ +return get_unmapped_area (NULL ,TASK_SIZE -PAGE_SIZE ,PAGE_SIZE ,0 ,0 ); +} +/* Slot allocation for XOL */ static int xol_add_vma (struct mm_struct *mm,struct xol_area *area) {
@@ -1453,9 +1459,7 @@ static int xol_add_vma(struct mm_struct }if (!area->vaddr) { -/* Try to map as high as possible, this is only a hint. */ - area->vaddr =get_unmapped_area (NULL ,TASK_SIZE -PAGE_SIZE , -PAGE_SIZE ,0 ,0 ); + area->vaddr =arch_uprobe_get_xol_area ();if (IS_ERR_VALUE (area->vaddr)) { ret = area->vaddr; goto fail;
Greg Kroah-Hartman
maintainerPATCH 110/589 fs/ocfs2: fix comments mentioning i_mutex
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: hongnanli <[email protected]>
[ Upstream commit 137cebf9432eae024d0334953ed92a2a78619b52 ]
inode->i_mutex has been replaced with inode->i_rwsem long ago. Fix comments still mentioning i_mutex.
Stable-dep-of: b02da26a992d ("ocfs2: fix possible deadlock between unlink and dio_end_io_write")
--- fs/ocfs2/alloc.c | 2 +- fs/ocfs2/aops.c | 2 +- fs/ocfs2/cluster/nodemanager.c | 2 +- fs/ocfs2/dir.c | 4 ++-- fs/ocfs2/file.c | 4 ++-- fs/ocfs2/inode.c | 2 +- fs/ocfs2/localalloc.c | 6 +++--- fs/ocfs2/namei.c | 2 +- fs/ocfs2/ocfs2.h | 4 ++-- fs/ocfs2/quota_global.c | 2 +- fs/ocfs2/xattr.c | 2 +- 11 files changed, 16 insertions(+), 16 deletions(-)
fs/ocfs2/alloc.c +1 -1
@@ -5988,7 +5988,7 @@ bail:return status; } -/* Expects you to already be holding tl_inode->i_mutex */ +/* Expects you to already be holding tl_inode->i_rwsem */ int __ocfs2_flush_truncate_log (struct ocfs2_super *osb) {int status;
fs/ocfs2/aops.c +1 -1
@@ -2327,7 +2327,7 @@ static int ocfs2_dio_end_io_write(structdown_write (&oi->ip_alloc_sem); -/* Delete orphan before acquire i_mutex. */ +/* Delete orphan before acquire i_rwsem. */ if (dwc->dw_orphaned) {BUG_ON (dwc->dw_writer_pid !=task_pid_nr (current));
fs/ocfs2/cluster/nodemanager.c +1 -1
@@ -691,7 +691,7 @@ static struct config_group *o2nm_clusterstruct o2nm_node_group *ns =NULL ;struct config_group *o2hb_group =NULL , *ret =NULL ; -/* this runs under the parent dir's i_mutex; there can be only +/* this runs under the parent dir's i_rwsem; there can be only * one caller in here at a time */ if (o2nm_single_cluster)return ERR_PTR (-ENOSPC );
fs/ocfs2/dir.c +2 -2
@@ -1981,7 +1981,7 @@ bail_nolock: }/* -* NOTE: this should always be called with parent dir i_mutex taken. +* NOTE: this should always be called with parent dir i_rwsem taken. */ int ocfs2_find_files_on_disk(const char *name, int namelen,
@@ -2028,7 +2028,7 @@ int ocfs2_lookup_ino_from_name(struct in* Return -EEXIST if the directory contains the name * Return -EFSCORRUPTED if found corruption * -* Callers should have i_mutex + a cluster lock on dir +* Callers should have i_rwsem + a cluster lock on dir */ int ocfs2_check_dir_for_entry(struct inode *dir, const char *name,
fs/ocfs2/file.c +2 -2
@@ -272,7 +272,7 @@ int ocfs2_update_inode_atime(struct inod/* * Don't use ocfs2_mark_inode_dirty() here as we don't always -* have i_mutex to guard against concurrent changes to other +* have i_rwsem to guard against concurrent changes to other * inode fields. */ inode->i_atime =current_time (inode);
@@ -1070,7 +1070,7 @@ static int ocfs2_extend_file(struct inod/* * The alloc sem blocks people in read/write from reading our * allocation until we're done changing it. We depend on -* i_mutex to block other extend/truncate calls while we're +* i_rwsem to block other extend/truncate calls while we're * here. We even have to hold it for sparse files because there * might be some tail zeroing. */
fs/ocfs2/inode.c +1 -1
@@ -715,7 +715,7 @@ bail:/* * Serialize with orphan dir recovery. If the process doing * recovery on this orphan dir does an iget() with the dir -* i_mutex held, we'll deadlock here. Instead we detect this +* i_rwsem held, we'll deadlock here. Instead we detect this * and exit early - recovery will wipe this inode for us. */ static int ocfs2_check_orphan_recovery_state(struct ocfs2_super *osb,
fs/ocfs2/localalloc.c +3 -3
@@ -608,7 +608,7 @@ out:/* * make sure we've got at least bits_wanted contiguous bits in the -* local alloc. You lose them when you drop i_mutex. +* local alloc. You lose them when you drop i_rwsem. * * We will add ourselves to the transaction passed in, but may start * our own in order to shift windows.
@@ -638,7 +638,7 @@ int ocfs2_reserve_local_alloc_bits(struc/* * We must double check state and allocator bits because -* another process may have changed them while holding i_mutex. +* another process may have changed them while holding i_rwsem. */ spin_lock (&osb->osb_lock); if (!ocfs2_la_state_enabled(osb) ||
@@ -1031,7 +1031,7 @@ enum ocfs2_la_event {/* * Given an event, calculate the size of our next local alloc window. * -* This should always be called under i_mutex of the local alloc inode +* This should always be called under i_rwsem of the local alloc inode * so that local alloc disabling doesn't race with processes trying to * use the allocator. *
fs/ocfs2/namei.c +1 -1
@@ -485,7 +485,7 @@ leave:ocfs2_free_alloc_context (meta_ac);/* -* We should call iput after the i_mutex of the bitmap been +* We should call iput after the i_rwsem of the bitmap been * unlocked in ocfs2_free_alloc_context, or the * ocfs2_delete_inode will mutex_lock again. */
fs/ocfs2/ocfs2.h +2 -2
@@ -371,7 +371,7 @@ struct ocfs2_superstruct delayed_work la_enable_wq;/* -* Must hold local alloc i_mutex and osb->osb_lock to change +* Must hold local alloc i_rwsem and osb->osb_lock to change * local_alloc_bits. Reads can be done under either lock. */ unsigned int local_alloc_bits;
@@ -446,7 +446,7 @@ struct ocfs2_superatomic_t osb_tl_disable;/* * How many clusters in our truncate log. -* It must be protected by osb_tl_inode->i_mutex. +* It must be protected by osb_tl_inode->i_rwsem. */ unsigned int truncated_clusters;
fs/ocfs2/quota_global.c +1 -1
@@ -36,7 +36,7 @@* should be obeyed by all the functions: * - any write of quota structure (either to local or global file) is protected * by dqio_sem or dquot->dq_lock. -* - any modification of global quota file holds inode cluster lock, i_mutex, +* - any modification of global quota file holds inode cluster lock, i_rwsem, * and ip_alloc_sem of the global quota file (achieved by * ocfs2_lock_global_qf). It also has to hold qinfo_lock. * - an allocation of new blocks for local quota file is protected by
fs/ocfs2/xattr.c +1 -1
@@ -7210,7 +7210,7 @@ out:* Used for reflink a non-preserve-security file. * * It uses common api like ocfs2_xattr_set, so the caller -* must not hold any lock expect i_mutex. +* must not hold any lock expect i_rwsem. */ int ocfs2_init_security_and_acl(struct inode *dir, struct inode *inode,
Greg Kroah-Hartman
maintainerPATCH 111/589 ocfs2: fix possible deadlock between unlink and dio_end_io_write
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joseph Qi <[email protected]>
[ Upstream commit b02da26a992db0c0e2559acbda0fc48d4a2fd337 ]
ocfs2_unlink takes orphan dir inode_lock first and then ip_alloc_sem, while in ocfs2_dio_end_io_write, it acquires these locks in reverse order. This creates an ABBA lock ordering violation on lock classes ocfs2_sysfile_lock_key[ORPHAN_DIR_SYSTEM_INODE] and ocfs2_file_ip_alloc_sem_key.
Lock Chain #0 (orphan dir inode_lock -> ip_alloc_sem):ocfs2_unlink
ocfs2_prepare_orphan_dir
ocfs2_lookup_lock_orphan_dir
inode_lock(orphan_dir_inode) <- lock A
__ocfs2_prepare_orphan_dir
ocfs2_prepare_dir_for_insert
ocfs2_extend_dir
ocfs2_expand_inline_dir
down_write(&oi->ip_alloc_sem) <- Lock B
Lock Chain #1 (ip_alloc_sem -> orphan dir inode_lock):ocfs2_dio_end_io_write
down_write(&oi->ip_alloc_sem) <- Lock B ocfs2_del_inode_from_orphan()
inode_lock(orphan_dir_inode) <- Lock A
Deadlock Scenario:
CPU0 (unlink) CPU1 (dio_end_io_write)
------ ------
inode_lock(orphan_dir_inode)
down_write(ip_alloc_sem)
down_write(ip_alloc_sem)
inode_lock(orphan_dir_inode)
Since ip_alloc_sem is to protect allocation changes, which is unrelated with operations in ocfs2_del_inode_from_orphan. So move ocfs2_del_inode_from_orphan out of ip_alloc_sem to fix the deadlock.
--- fs/ocfs2/aops.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/ocfs2/aops.c +1 -2
@@ -2325,8 +2325,6 @@ static int ocfs2_dio_end_io_write(struct goto out; } -down_write (&oi->ip_alloc_sem); -/* Delete orphan before acquire i_rwsem. */ if (dwc->dw_orphaned) {BUG_ON (dwc->dw_writer_pid !=task_pid_nr (current));
@@ -2339,6 +2337,7 @@ static int ocfs2_dio_end_io_write(structmlog_errno (ret); } +down_write (&oi->ip_alloc_sem); di = (struct ocfs2_dinode *)di_bh->b_data;ocfs2_init_dinode_extent_tree (&et,INODE_CACHE (inode), di_bh);
Greg Kroah-Hartman
maintainerPATCH 112/589 mm: blk-cgroup: fix use-after-free in cgwb_release_workfn()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit 8f5857be99f1ed1fa80991c72449541f634626ee ]
cgwb_release_workfn() calls css_put(wb->blkcg_css) and then later accesses wb->blkcg_css again via blkcg_unpin_online(). If css_put() drops the last reference, the blkcg can be freed asynchronously (css_free_rwork_fn -> blkcg_css_free -> kfree) before blkcg_unpin_online() dereferences the pointer to access blkcg->online_pin, resulting in a use-after-free:
BUG: KASAN: slab-use-after-free in blkcg_unpin_online (./include/linux/instrumented.h:112 ./include/linux/atomic/atomic-instrumented.h:400 ./include/linux/refcount.h:389 ./include/linux/refcount.h:432 ./include/linux/refcount.h:450 block/blk-cgroup.c:1367)
Write of size 4 at addr ff11000117aa6160 by task kworker/71:1/531
Workqueue: cgwb_release cgwb_release_workfn
Call Trace:
<TASK>
blkcg_unpin_online (./include/linux/instrumented.h:112 ./include/linux/atomic/atomic-instrumented.h:400 ./include/linux/refcount.h:389 ./include/linux/refcount.h:432 ./include/linux/refcount.h:450 block/blk-cgroup.c:1367)
cgwb_release_workfn (mm/backing-dev.c:629)
process_scheduled_works (kernel/workqueue.c:3278 kernel/workqueue.c:3385)
Freed by task 1016:
kfree (./include/linux/kasan.h:235 mm/slub.c:2689 mm/slub.c:6246 mm/slub.c:6561)
css_free_rwork_fn (kernel/cgroup/cgroup.c:5542)
process_scheduled_works (kernel/workqueue.c:3302 kernel/workqueue.c:3385)** Stack based on commit 66672af7a095 ("Add linux-next specific files for 20260410")
I am seeing this crash sporadically in Meta fleet across multiple kernel versions. A full reproducer is available at:
https://github.com/leitao/debug/blob/main/reproducers/repro_blkcg_uaf.sh
(The race window is narrow. To make it easily reproducible, inject a msleep(100) between css_put() and blkcg_unpin_online() in cgwb_release_workfn(). With that delay and a KASAN-enabled kernel, the reproducer triggers the splat reliably in less than a second.)
Fix this by moving blkcg_unpin_online() before css_put(), so the cgwb's CSS reference keeps the blkcg alive while blkcg_unpin_online() accesses it.
--- mm/backing-dev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
mm/backing-dev.c +3 -2
@@ -397,12 +397,13 @@ static void cgwb_release_workfn(struct wwb_shutdown (wb);css_put (wb->memcg_css); -css_put (wb->blkcg_css); -mutex_unlock (&wb->bdi->cgwb_release_mutex);/* triggers blkg destruction if no online users left */ blkcg_unpin_online (blkcg); +css_put (wb->blkcg_css); +mutex_unlock (&wb->bdi->cgwb_release_mutex); +fprop_local_destroy_percpu (&wb->memcg_completions);wb_exit (wb);call_rcu (&wb->rcu, cgwb_free_rcu);
Greg Kroah-Hartman
maintainerPATCH 113/589 arm64: dts: imx8mq-librem5-r3: workaround i2c1 issue with 1GHz cpu voltage
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Kepplinger <[email protected]>
[ Upstream commit 1773b8d6697ac8e9380843fe5c13c25e95baa702 ]
This is a workaround for a hardware bug in the r3 revision that basically would stop the system due to traffic on the i2c1 bus. A cpu voltage change would trigger such traffic and that's what is avoided in order to work around it.
Stable-dep-of: 511f76bf1dce ("arm64: dts: imx8mq-librem5: Bump BUCK1 suspend voltage up to 0.85V")
--- arch/arm64/boot/dts/freescale/imx8mq-librem5-r3.dts | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/freescale/imx8mq-librem5-r3.dts +6 -0
@@ -10,6 +10,12 @@ compatible = "purism,librem5r3", "purism,librem5", "fsl,imx8mq"; }; +&a53_opp_table { + opp-1000000000 { + opp-microvolt = <1000000>; + }; +}; + &accel_gyro { mount-matrix = "1", "0", "0", "0", "1", "0",
Greg Kroah-Hartman
maintainerPATCH 114/589 arm64: dts: imx8mq-librem5: Dont mark buck3 as always on
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guido Günther <[email protected]>
[ Upstream commit 99e71c029213d3cfcc4f39a534c73d1828ffb341 ]
With the pmic driver fixed we can now shut off the regulator in the gpc.
Stable-dep-of: 511f76bf1dce ("arm64: dts: imx8mq-librem5: Bump BUCK1 suspend voltage up to 0.85V")
--- arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi | 1 - 1 file changed, 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi +0 -1
@@ -671,7 +671,6 @@ regulator-min-microvolt = <700000>; regulator-max-microvolt = <1300000>; rohm,dvs-run-voltage = <900000>; - regulator-always-on; }; buck4_reg: BUCK4 {
Re: [PATCH 5.10 114/589] arm64: dts: imx8mq-librem5: Dont mark buck3 as always on
Quoted 9 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guido Günther <[email protected]>
[ Upstream commit
99e71c029213d3cfcc4f39a534c73d1828ffb341]With the pmic driver fixed we can now shut off the regulator in the gpc.
But not for all hardware revisions. We need commit a362b0cc94d4 "arm64:
dts: imx8mq-librem5-r3: Mark buck3 as always on" on top of this.
Ben.
Quoted 22 lines
Signed-off-by Guido Günther <[email protected]>Signed-off-by Martin Kepplinger <[email protected]>Signed-off-by Shawn Guo <[email protected]>Stable-dep-of:
511f76bf1dce("arm64: dts: imx8mq-librem5: Bump BUCK1 suspend voltage up to 0.85V")Signed-off-by Sasha Levin <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi | 1 - 1 file changed, 1 deletion(-)arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi +0
-1@@ -671,7 +671,6 @@ regulator-min-microvolt = <700000>; regulator-max-microvolt = <1300000>; rohm,dvs-run-voltage = <900000>; - regulator-always-on; }; buck4_reg: BUCK4 {
Signature · 3 lines
Ben Hutchings Time is nature's way of making sure that everything doesn't happen at once.
Sasha Levin
maintainerRe: [PATCH 5.10 114/589] arm64: dts: imx8mq-librem5: Dont mark buck3 as always on
Quoted 2 lines · Ben Hutchings
But not for all hardware revisions. We need commit
a362b0cc94d4"arm64:
dts: imx8mq-librem5-r3: Mark buck3 as always on" on top of this.
That commit is already backported to 5.10.y (as e5da8b37ce34d), so this is safe to keep as-is. Thanks!
--
Thanks,
Sasha