6.6.136-rc1 review
Subsystems (6)
Greg Kroah-Hartman
maintainerPATCH 1/166 RDMA/irdma: Fix double free related to rereg_user_mr
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Moroni <[email protected]>
[ Upstream commit 29a3edd7004bb635d299fb9bc6f0ea4ef13ed5a2 ]
If IB_MR_REREG_TRANS is set during rereg_user_mr, the umem will be released and a new one will be allocated in irdma_rereg_mr_trans. If any step of irdma_rereg_mr_trans fails after the new umem is allocated, it releases the umem, but does not set iwmr->region to NULL. The problem is that this failure is propagated to the user, who will then call ibv_dereg_mr (as they should). Then, the dereg_mr path will see a non-NULL umem and attempt to call ib_umem_release again.
Fix this by setting iwmr->region to NULL after ib_umem_release.
Fixed: 5ac388db27c4 ("RDMA/irdma: Add support to re-register a memory region")
--- drivers/infiniband/hw/irdma/verbs.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/irdma/verbs.c +1 -0
@@ -3209,6 +3209,7 @@ static int irdma_rereg_mr_trans(struct irdma_mr *iwmr, u64 start, u64 len, err:ib_umem_release (region); + iwmr->region =NULL ;return err; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 10/166 btrfs: tracepoints: get correct superblock from dentry in event btrfs_sync_file()
In reply to Greg Kroah-Hartman6.6-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
@@ -789,12 +789,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 2/166 ASoC: amd: yc: Add DMI quirk for ASUS EXPERTBOOK BM1403CDA
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vee Satayamas <[email protected]>
[ Upstream commit f200b2f9a810c440c6750b56fc647b73337749a1 ]
Add a DMI quirk for the Asus Expertbook BM1403CDA to resolve the issue of the internal microphone not being detected.
--- sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +7 -0
@@ -710,6 +710,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { DMI_MATCH(DMI_BOARD_NAME, "PM1503CDA"), } }, + { + .driver_data = &acp6x_card, + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_BOARD_NAME, "BM1403CDA"), + } + }, {} };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 3/166 ALSA: hda/realtek: Add HP ENVY Laptop 13-ba0xxx quirk
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrii Kovalchuk <[email protected]>
[ Upstream commit 793b008cd39516385791a1d1d223d817e947a471 ]
Add a PCI quirk for HP ENVY Laptop 13-ba0xxx (PCI device ID 0x8756) to enable proper mute LED and mic mute behavior using the ALC245_FIXUP_HP_X360_MUTE_LEDS fixup.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10094,6 +10094,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x8730 ,"HP ProBook 445 G7" ,ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF ),SND_PCI_QUIRK (0x103c ,0x8735 ,"HP ProBook 435 G7" ,ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF ),SND_PCI_QUIRK (0x103c ,0x8736 ,"HP" ,ALC285_FIXUP_HP_GPIO_AMP_INIT ), +SND_PCI_QUIRK (0x103c ,0x8756 ,"HP ENVY Laptop 13-ba0xxx" ,ALC245_FIXUP_HP_X360_MUTE_LEDS ),SND_PCI_QUIRK (0x103c ,0x8760 ,"HP EliteBook 8{4,5}5 G7" ,ALC285_FIXUP_HP_BEEP_MICMUTE_LED ),SND_PCI_QUIRK (0x103c ,0x876e ,"HP ENVY x360 Convertible 13-ay0xxx" ,ALC245_FIXUP_HP_X360_MUTE_LEDS ), SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 4/166 ALSA: hda/realtek: Add quirk for ASUS ROG Flow Z13-KJP GZ302EAC
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Schwartz <[email protected]>
[ Upstream commit 59f68dc1d8df3142cb58fd2568966a9bb7b0ed8a ]
Fixes lack of audio output on the ASUS ROG Flow Z13-KJP GZ302EAC model, similar to the ASUS ROG Flow Z13 GZ302EA.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10290,6 +10290,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1043 ,0x14e3 ,"ASUS G513PI/PU/PV" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x1043 ,0x14f2 ,"ASUS VivoBook X515JA" ,ALC256_FIXUP_ASUS_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1043 ,0x1503 ,"ASUS G733PY/PZ/PZV/PYV" ,ALC287_FIXUP_CS35L41_I2C_2 ), +SND_PCI_QUIRK (0x1043 ,0x1514 ,"ASUS ROG Flow Z13 GZ302EAC" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x1043 ,0x1517 ,"Asus Zenbook UX31A" ,ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A ),SND_PCI_QUIRK (0x1043 ,0x1533 ,"ASUS GV302XA/XJ/XQ/XU/XV/XI" ,ALC287_FIXUP_CS35L41_I2C_2 ), SND_PCI_QUIRK(0x1043, 0x1573, "ASUS GZ301VV/VQ/VU/VJ/VA/VC/VE/VVC/VQC/VUC/VJC/VEC/VCC", ALC285_FIXUP_ASUS_HEADSET_MIC),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 5/166 media: rkvdec: reduce stack usage in rkvdec_init_v4l2_vp9_count_tbl()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit c03b7dec3c4ddc97872fa12bfca75bae9cb46510 ]
The deeply nested loop in rkvdec_init_v4l2_vp9_count_tbl() needs a lot of registers, so when the clang register allocator runs out, it ends up spilling countless temporaries to the stack:
drivers/media/platform/rockchip/rkvdec/rkvdec-vp9.c:966:12: error: stack frame size (1472) exceeds limit (1280) in 'rkvdec_vp9_start' [-Werror,-Wframe-larger-than]
Marking this function as noinline_for_stack keeps it out of rkvdec_vp9_start(), giving the compiler more room for optimization.
The resulting code is good enough that both the total stack usage and the loop get enough better to stay under the warning limit, though it's still slow, and would need a larger rework if this function ends up being called in a fast path.
--- drivers/staging/media/rkvdec/rkvdec-vp9.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/media/rkvdec/rkvdec-vp9.c +2 -1
@@ -923,7 +923,8 @@ static void rkvdec_vp9_done(struct rkvdec_ctx *ctx,update_ctx_last_info (vp9_ctx); } -static void rkvdec_init_v4l2_vp9_count_tbl (struct rkvdec_ctx *ctx) +static noinline_for_stack void +rkvdec_init_v4l2_vp9_count_tbl (struct rkvdec_ctx *ctx) {struct rkvdec_vp9_ctx *vp9_ctx = ctx->priv;struct rkvdec_vp9_intra_frame_symbol_counts *intra_cnts = vp9_ctx->count_tbl.cpu;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 6/166 ALSA: asihpi: avoid write overflow check warning
In reply to Greg Kroah-Hartman6.6-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
@@ -581,8 +581,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 7/166 ASoC: amd: yc: Add DMI quirk for Thin A15 B7VF
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Heng <[email protected]>
[ Upstream commit 1f182ec9d7084db7dfdb2372d453c28f0e5c3f0a ]
Add a DMI quirk for the Thin A15 B7VF fixing the issue where the internal microphone was not detected.
--- sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +7 -0
@@ -717,6 +717,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { DMI_MATCH(DMI_BOARD_NAME, "BM1403CDA"), } }, + { + .driver_data = &acp6x_card, + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "Micro-Star International Co., Ltd."), + DMI_MATCH(DMI_PRODUCT_NAME, "Thin A15 B7VE"), + } + }, {} };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 8/166 ASoC: SOF: topology: reject invalid vendor array size in token parser
In reply to Greg Kroah-Hartman6.6-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
@@ -722,7 +722,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
Greg Kroah-Hartman
maintainerPATCH 9/166 can: mcp251x: add error handling for power enable in open and resume
In reply to Greg Kroah-Hartman6.6-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
@@ -1213,7 +1213,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 ;
@@ -1260,6 +1264,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)
@@ -1499,11 +1504,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
maintainercover 6.6.136-rc1 review
This is the start of the stable review cycle for the 6.6.136 release. There are 166 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 Sun, 26 Apr 2026 13:23:21 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.6.136-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.6.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 6.6.136-rc1
Yu Kuai <[email protected]>
md/raid1: fix data lost for writemostly rdev
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
Herbert Xu <[email protected]>
crypto: testmgr - Hide ENOENT errors better
Herbert Xu <[email protected]>
crypto: testmgr - Hide ENOENT errors
Bingquan Chen <[email protected]>
net/packet: fix TOCTOU race on mmap'd vnet_hdr in tpacket_snd()
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
George Saad <[email protected]>
f2fs: fix use-after-free of sbi in f2fs_compress_write_end_io()
Tristan Madani <[email protected]>
ksmbd: use check_add_overflow() to prevent u16 DACL size overflow
Tristan Madani <[email protected]>
ksmbd: fix out-of-bounds write in smb2_get_ea() EA alignment
Michael Bommarito <[email protected]>
smb: client: fix OOB read in smb2_ioctl_query_info QUERY_INFO path
Michael Bommarito <[email protected]>
smb: client: require a full NFS mode SID before reading mode bits
DaeMyung Kang <[email protected]>
smb: server: fix max_connections off-by-one in tcp accept path
Michael Bommarito <[email protected]>
smb: server: fix active_num_conn leak on transport allocation failure
Darrick J. Wong <[email protected]>
fuse: quiet down complaints in fuse_conn_limit_write
Bernd Schubert <[email protected]>
fuse: Check for large folio with SPLICE_F_MOVE
Samuel Page <[email protected]>
fuse: reject oversized dirents in page cache
Chao Yu <[email protected]>
f2fs: fix to avoid memory leak in f2fs_rename()
Greg Kroah-Hartman <[email protected]>
fs/ntfs3: validate rec->used in journal-replay file record check
Wang Jie <[email protected]>
rxrpc: only handle RESPONSE during service challenge
David Howells <[email protected]>
rxrpc: Fix anonymous key handling
Nathan Chancellor <[email protected]>
scripts/dtc: Remove unused dts_version in dtc-lexer.l
Guocai He <[email protected]>
Revert "wifi: cfg80211: stop NAN and P2P in cfg80211_leave"
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()
David Howells <[email protected]>
rxrpc: Fix key quota calculation for multitoken keys
David Woodhouse <[email protected]>
KVM: x86: Use __DECLARE_FLEX_ARRAY() for UAPI structures with VLAs
Tamir Duberstein <[email protected]>
scripts: generate_rust_analyzer.py: define scripts
Koichiro Den <[email protected]>
PCI: endpoint: pci-epf-vntb: Stop cmd_handler work in epf_ntb_epc_cleanup
Eric Dumazet <[email protected]>
net: annotate data-races around sk->sk_{data_ready,write_space}Thomas Gleixner <[email protected]>
i40e: Fix preempt count leak in napi poll tracepoint
Daniel Golle <[email protected]>
net: ethernet: mtk_eth_soc: initialize PPE per-tag-layer MTU registers
Felix Fietkau <[email protected]>
wifi: mac80211: always free skb on ieee80211_tx_prepare_skb() failure
Yu Kuai <[email protected]>
md/raid1,raid10: don't ignore IO flags
Minhong He <[email protected]>
ipv6: add NULL checks for idev in SRv6 paths
Koichiro Den <[email protected]>
PCI: endpoint: pci-epf-vntb: Remove duplicate resource teardown
Kenta Akagi <[email protected]>
Revert "perf unwind-libdw: Fix invalid reference counts"
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()
Fan Wu <[email protected]>
media: mediatek: vcodec: fix use-after-free in encoder release path
Ruslan Valiyev <[email protected]>
media: vidtv: fix nfeeds state corruption on start_streaming failure
Breno Leitao <[email protected]>
mm: blk-cgroup: fix use-after-free in cgwb_release_workfn()
Ritesh Harjani (IBM) <[email protected]>
mm/kasan: fix double free for kasan pXds
Srinivas Kandagatla <[email protected]>
ASoC: qcom: q6apm: move component registration to unmanaged version
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
Zilin Guan <[email protected]>
ice: Fix memory leak in ice_set_ringparam()
Pablo Neira Ayuso <[email protected]>
nf_tables: nft_dynset: fix possible stateful expression memleak in error path
Chaitanya Kulkarni <[email protected]>
blktrace: fix __this_cpu_read/write in preemptible context
Jakub Kicinski <[email protected]>
nfc: nci: complete pending data exchange on device close
Eric Dumazet <[email protected]>
net: sched: fix TCF_LAYER_TRANSPORT handling in tcf_get_base_ptr()
Sean Christopherson <[email protected]>
KVM: nVMX: Fold requested virtual interrupt check into has_nested_events()
Eric Dumazet <[email protected]>
net: add proper RCU protection to /proc/net/ptype
Maud Spierings <[email protected]>
iio: common: st_sensors: Fix use of uninitialize device structs
Qu Wenruo <[email protected]>
btrfs: merge btrfs_orig_bbio_end_io() into btrfs_bio_end_io()
Jiayuan Chen <[email protected]>
net: skb: fix cross-cache free of KFENCE-allocated skb head
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
Joseph Qi <[email protected]>
ocfs2: fix possible deadlock between unlink and dio_end_io_write
Ruslan Valiyev <[email protected]>
media: vidtv: fix NULL pointer dereference in vidtv_channel_pmt_match_sections
Zhihao Cheng <[email protected]>
dcache: Limit the minimal number of bucket to two
Harin Lee <[email protected]>
ALSA: ctxfi: Limit PTP to a single page
SeongJae Park <[email protected]>
Docs/admin-guide/mm/damon/reclaim: warn commit_inputs vs param updates race
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()
Johan Hovold <[email protected]>
wifi: rtw88: fix device leak on probe failure
Tamir Duberstein <[email protected]>
scripts: generate_rust_analyzer.py: avoid FD leak
Greg Kroah-Hartman <[email protected]>
fbdev: udlfb: avoid divide-by-zero on FBIOPUT_VSCREENINFO
Xu Yang <[email protected]>
usb: port: add delay after usb_hub_set_port_power()
Dave Carey <[email protected]>
USB: cdc-acm: Add quirks for Yoga Book 9 14IAH10 INGENIC touchscreen
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]>
ksmbd: fix mechToken leak when SPNEGO decode fails after token alloc
Greg Kroah-Hartman <[email protected]>
ksmbd: require 3 sub-authorities before reading sub_auth[2]
Greg Kroah-Hartman <[email protected]>
ksmbd: validate EaNameLength in smb2_get_ea()
Greg Kroah-Hartman <[email protected]>
smb: client: fix off-by-8 bounds check in check_wsl_eas()
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]>
drm/vc4: platform_get_irq_byname() returns an int
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
Jouni Högander <[email protected]>
drm/i915/psr: Do not use pipe_src as borders for SU area
Aaron Plattner <[email protected]>
objtool: Remove max symbol name length limitation
Geoffrey D. Bennett <[email protected]>
ALSA: usb-audio: Improve Focusrite sample rate filtering
Florian Westphal <[email protected]>
netfilter: conntrack: add missing netlink policy validations
Herbert Xu <[email protected]>
crypto: algif_aead - Fix minimum RX size check for decryption
Zide Chen <[email protected]>
perf/x86/intel/uncore: Skip discovery table for offline dies
Samasth Norway Ananda <[email protected]>
gpio: tegra: fix irq_release_resources calling enable instead of disable
Alice Mikityanska <[email protected]>
l2tp: Drop large packets with UDP encap
Alexander Koskovich <[email protected]>
net: ipa: fix event ring index not programmed for IPA v5.0+
Alexander Koskovich <[email protected]>
net: ipa: fix GENERIC_CMD register field masks for IPA v5.0+
Jiexun Wang <[email protected]>
af_unix: read UNIX_DIAG_VFS data under unix_state_lock
Fabio Baltieri <[email protected]>
net: txgbe: leave space for null terminators on property_entry
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
Weiming Shi <[email protected]>
ipvs: fix NULL deref in ip_vs_add_service error path
Daniel Golle <[email protected]>
selftests: net: bridge_vlan_mcast: wait for h1 before querier check
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: validate MTU against usable frame size on bind
Maciej Fijalkowski <[email protected]>
xsk: fix XDP_UMEM_SG_FLAG issues
Maciej Fijalkowski <[email protected]>
xsk: respect tailroom for ZC setups
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
Michal Schmidt <[email protected]>
ixgbevf: add missing negotiate_features op to Hyper-V ops table
Pengpeng Hou <[email protected]>
tracing/probe: reject non-closed empty immediate strings
Jon Hunter <[email protected]>
dt-bindings: net: Fix Tegra234 MGBE PTP clock
Jon Hunter <[email protected]>
net: stmmac: Fix PTP ref clock for Tegra234
Pengpeng Hou <[email protected]>
nfc: s3fwrn5: allocate rx skb before consuming bytes
Yiqi Sun <[email protected]>
ipv4: icmp: fix null-ptr-deref in icmp_build_probe()
Eric Dumazet <[email protected]>
net: lapbether: handle NETDEV_PRE_TYPE_CHANGE
Ruide Cao <[email protected]>
net: sched: act_csum: validate nested VLAN headers
Nicholas Carlini <[email protected]>
eventpoll: defer struct eventpoll free to RCU grace period
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
Maíra Canal <[email protected]>
drm/vc4: Release runtime PM reference after binding V3D
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
Potin Lai <[email protected]>
soc: aspeed: socinfo: Mask table entries for accurate SoC ID matching
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
songxiebing <[email protected]>
ALSA: hda/realtek: Add quirk for Lenovo Yoga Pro 7 14IAH10
leo vriska <[email protected]>
HID: quirks: add HID_QUIRK_ALWAYS_POLL for 8BitDo Pro 3
Mario Limonciello <[email protected]>
platform/x86/amd: pmc: Add Thinkpad L14 Gen3 to quirk_s2idle_bug
Andy Shevchenko <[email protected]>
pinctrl: intel: Fix the revision for new features (1kOhm PD, HW debouncer)
Gilson Marquato Júnior <[email protected]>
ASoC: amd: yc: Add DMI entry for HP Laptop 15-fc0xxx
Fredric Cover <[email protected]>
fs/smb/client: fix out-of-bounds read in cifs_sanitize_prepath
Phil Willoughby <[email protected]>
ALSA: usb-audio: Fix quirk flags for NeuralDSP Quad Cortex
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
Dustin L. Howett <[email protected]>
ALSA: hda/realtek: add quirk for Framework F111:000F
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
Zhang Heng <[email protected]>
ASoC: amd: yc: Add DMI quirk for Thin A15 B7VF
Arnd Bergmann <[email protected]>
ALSA: asihpi: avoid write overflow check warning
Arnd Bergmann <[email protected]>
media: rkvdec: reduce stack usage in rkvdec_init_v4l2_vp9_count_tbl()
Matthew Schwartz <[email protected]>
ALSA: hda/realtek: Add quirk for ASUS ROG Flow Z13-KJP GZ302EAC
Andrii Kovalchuk <[email protected]>
ALSA: hda/realtek: Add HP ENVY Laptop 13-ba0xxx quirk
Vee Satayamas <[email protected]>
ASoC: amd: yc: Add DMI quirk for ASUS EXPERTBOOK BM1403CDA
Jacob Moroni <[email protected]>
RDMA/irdma: Fix double free related to rereg_user_mr
-------------
Diffstat:
Documentation/admin-guide/mm/damon/reclaim.rst | 4 + .../bindings/net/nvidia,tegra234-mgbe.yaml | 4 +- Makefile | 4 +- arch/arm64/boot/dts/freescale/imx8mq.dtsi | 2 +- arch/x86/events/intel/uncore_discovery.c | 2 +- arch/x86/include/asm/kvm-x86-ops.h | 1 - arch/x86/include/asm/kvm_host.h | 1 - arch/x86/include/uapi/asm/kvm.h | 12 +-- arch/x86/kvm/svm/sev.c | 11 ++- arch/x86/kvm/vmx/nested.c | 4 + arch/x86/kvm/vmx/vmx.c | 21 ------ arch/x86/kvm/x86.c | 24 +++--- crypto/algif_aead.c | 2 +- crypto/testmgr.c | 24 +++++- drivers/ata/ahci.c | 14 ++++ drivers/crypto/ccp/sev-dev.c | 19 ++++- drivers/gpio/gpio-tegra.c | 2 +- drivers/gpu/drm/i915/display/intel_psr.c | 18 +++-- drivers/gpu/drm/vc4/vc4_bo.c | 3 + drivers/gpu/drm/vc4/vc4_gem.c | 19 +++-- drivers/gpu/drm/vc4/vc4_hdmi.c | 14 +++- drivers/gpu/drm/vc4/vc4_v3d.c | 1 + drivers/hid/hid-alps.c | 3 + drivers/hid/hid-core.c | 3 + drivers/hid/hid-ids.h | 3 + drivers/hid/hid-quirks.c | 1 + drivers/hid/hid-roccat.c | 2 + drivers/i2c/busses/i2c-s3c2410.c | 7 +- drivers/iio/accel/st_accel_core.c | 10 +-- drivers/iio/common/st_sensors/st_sensors_core.c | 36 +++++---- drivers/iio/common/st_sensors/st_sensors_trigger.c | 20 +++-- drivers/infiniband/hw/irdma/verbs.c | 1 + drivers/md/bcache/super.c | 7 ++ drivers/md/raid1.c | 6 +- drivers/md/raid10.c | 7 -- .../mediatek/vcodec/encoder/mtk_vcodec_enc_drv.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/net/can/spi/mcp251x.c | 29 ++++++-- drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 8 +- drivers/net/ethernet/intel/i40e/i40e_trace.h | 2 +- drivers/net/ethernet/intel/ice/ice_ethtool.c | 11 ++- drivers/net/ethernet/intel/ixgbevf/vf.c | 7 ++ drivers/net/ethernet/mediatek/mtk_eth_soc.c | 22 +++++- drivers/net/ethernet/mediatek/mtk_ppe.c | 30 ++++++++ drivers/net/ethernet/mediatek/mtk_ppe.h | 1 + drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c | 19 ++++- drivers/net/ethernet/wangxun/txgbe/txgbe_type.h | 8 +- drivers/net/ipa/reg/gsi_reg-v5.0.c | 9 ++- drivers/net/usb/cdc-phonet.c | 7 +- drivers/net/wan/lapbether.c | 13 ++-- drivers/net/wireless/ath/ath9k/channel.c | 6 +- .../wireless/broadcom/brcm80211/brcmfmac/fweh.c | 5 ++ drivers/net/wireless/realtek/rtw88/usb.c | 3 +- drivers/net/wireless/ti/wl1251/tx.c | 8 +- drivers/net/wireless/virtual/mac80211_hwsim.c | 1 - drivers/nfc/s3fwrn5/uart.c | 10 ++- drivers/pci/controller/pci-hyperv.c | 8 ++ drivers/pci/endpoint/functions/pci-epf-vntb.c | 19 +---- drivers/pinctrl/intel/pinctrl-intel.c | 2 +- drivers/platform/x86/amd/pmc/pmc-quirks.c | 9 +++ drivers/soc/aspeed/aspeed-socinfo.c | 2 +- drivers/staging/media/rkvdec/rkvdec-vp9.c | 3 +- drivers/staging/rtl8723bs/core/rtw_security.c | 2 +- drivers/staging/sm750fb/sm750.c | 3 + drivers/usb/class/cdc-acm.c | 53 +++++++++++-- drivers/usb/core/port.c | 1 + drivers/usb/gadget/function/f_ncm.c | 4 +- drivers/usb/gadget/function/f_phonet.c | 9 +++ drivers/usb/gadget/udc/renesas_usb3.c | 7 +- drivers/usb/serial/option.c | 2 + drivers/usb/storage/unusual_devs.h | 7 +- drivers/usb/usbip/usbip_common.c | 12 +++ drivers/video/fbdev/tdfxfb.c | 3 + drivers/video/fbdev/udlfb.c | 3 + fs/btrfs/bio.c | 29 +++----- fs/dcache.c | 4 +- fs/eventpoll.c | 6 +- fs/f2fs/compress.c | 14 +++- fs/f2fs/namei.c | 1 + fs/fuse/control.c | 4 +- fs/fuse/dev.c | 3 + fs/fuse/readdir.c | 4 + fs/nilfs2/dat.c | 3 + fs/ntfs3/fslog.c | 12 ++- fs/ocfs2/aops.c | 3 +- fs/ocfs2/inode.c | 31 ++++++++ fs/ocfs2/mmap.c | 7 +- fs/ocfs2/ocfs2_trace.h | 10 +-- fs/ocfs2/resize.c | 10 ++- fs/smb/client/cifsacl.c | 1 + fs/smb/client/fs_context.c | 4 + fs/smb/client/smb2inode.c | 2 +- fs/smb/client/smb2ops.c | 6 ++ fs/smb/server/connection.c | 1 + fs/smb/server/smb2pdu.c | 9 ++- fs/smb/server/smbacl.c | 19 +++-- fs/smb/server/transport_tcp.c | 4 +- include/linux/kvm_host.h | 3 +- include/net/mac80211.h | 4 + include/net/netfilter/nf_tables.h | 2 + include/net/pkt_cls.h | 2 + include/net/xdp_sock.h | 2 +- include/net/xdp_sock_drv.h | 23 +++++- include/trace/events/btrfs.h | 11 ++- include/uapi/linux/kvm.h | 11 +-- kernel/trace/blktrace.c | 4 +- kernel/trace/trace_probe.c | 2 +- mm/backing-dev.c | 5 +- mm/kasan/init.c | 8 +- net/can/raw.c | 11 ++- net/core/net-procfs.c | 49 ++++++++---- net/core/skbuff.c | 5 +- net/core/skmsg.c | 14 ++-- net/ipv4/icmp.c | 7 ++ net/ipv4/tcp.c | 4 +- net/ipv4/tcp_bpf.c | 2 +- net/ipv4/tcp_input.c | 14 ++-- net/ipv4/tcp_minisocks.c | 2 +- net/ipv4/udp.c | 3 +- net/ipv4/udp_bpf.c | 2 +- net/ipv6/exthdrs.c | 4 + net/ipv6/netfilter/ip6t_eui64.c | 3 +- net/ipv6/seg6_hmac.c | 2 + net/l2tp/l2tp_core.c | 5 ++ net/mac80211/tx.c | 4 +- net/netfilter/ipvs/ip_vs_ctl.c | 1 - net/netfilter/nf_conntrack_netlink.c | 2 +- net/netfilter/nf_conntrack_proto_sctp.c | 3 +- net/netfilter/nf_tables_api.c | 4 +- net/netfilter/nfnetlink_log.c | 8 +- net/netfilter/nft_dynset.c | 10 ++- net/netfilter/nft_set_pipapo_avx2.c | 20 ++--- net/netfilter/xt_multiport.c | 34 ++++++++- net/nfc/digital_technology.c | 6 ++ net/nfc/llcp_core.c | 2 + net/nfc/nci/core.c | 9 +++ net/packet/af_packet.c | 21 ++++-- net/rxrpc/conn_event.c | 14 +++- net/rxrpc/key.c | 9 ++- net/rxrpc/sendmsg.c | 2 +- net/sched/act_csum.c | 6 +- net/sched/em_cmp.c | 5 +- net/sched/em_nbyte.c | 2 + net/sched/em_text.c | 11 ++- net/unix/af_unix.c | 8 +- net/unix/diag.c | 21 ++++-- net/wireless/core.c | 4 +- net/xdp/xdp_umem.c | 3 +- net/xdp/xsk.c | 4 +- net/xdp/xsk_buff_pool.c | 32 +++++++- net/xfrm/xfrm_policy.c | 2 + net/xfrm/xfrm_user.c | 1 + scripts/checkpatch.pl | 10 +++ scripts/dtc/dtc-lexer.l | 3 - scripts/generate_rust_analyzer.py | 17 ++++- sound/firewire/fireworks/fireworks_command.c | 5 +- sound/pci/asihpi/hpimsgx.c | 6 +- sound/pci/ctxfi/ctvmem.h | 2 +- sound/pci/hda/patch_realtek.c | 5 ++ sound/soc/amd/yc/acp6x-mach.c | 21 ++++++ sound/soc/qcom/qdsp6/q6apm.c | 14 +++- sound/soc/soc-core.c | 1 + sound/soc/sof/topology.c | 2 +- sound/soc/stm/stm32_sai_sub.c | 3 + sound/usb/6fire/chip.c | 17 +++-- sound/usb/caiaq/device.c | 4 +- sound/usb/format.c | 86 +++++++++++++++++++--- sound/usb/mixer.c | 7 ++ sound/usb/quirks.c | 2 + tools/objtool/elf.c | 14 ++-- tools/perf/util/unwind-libdw.c | 7 +- .../selftests/net/forwarding/bridge_vlan_mcast.sh | 1 + 179 files changed, 1172 insertions(+), 450 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 12/166 netfilter: nft_set_pipapo_avx2: dont return non-matching entry on expiry
6.6-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 ;
@@ -319,7 +319,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 ;
@@ -414,7 +414,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 ;
@@ -505,7 +505,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 ;
@@ -641,7 +641,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 ;
@@ -699,7 +699,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 ;
@@ -764,7 +764,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 ;
@@ -839,7 +839,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 ;
@@ -925,7 +925,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 ;
@@ -1019,7 +1019,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
Greg Kroah-Hartman
maintainerPATCH 21/166 HID: quirks: add HID_QUIRK_ALWAYS_POLL for 8BitDo Pro 3
In reply to Greg Kroah-Hartman6.6-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 22/166 ALSA: hda/realtek: Add quirk for Lenovo Yoga Pro 7 14IAH10
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: songxiebing <[email protected]>
[ Upstream commit f0541edb2e7333f320642c7b491a67912c1f65db ]
The bass speakers are not working, and add the following entry in /etc/modprobe.d/snd.conf:
options snd-sof-intel-hda-generic hda_model=alc287-yoga9-bass-spk-pin Fixes the bass speakers.
So add the quick ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN here.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10593,6 +10593,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x17aa ,0x38fa ,"Thinkbook 16P Gen5" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x17aa ,0x3902 ,"Lenovo E50-80" ,ALC269_FIXUP_DMIC_THINKPAD_ACPI ),SND_PCI_QUIRK (0x17aa ,0x390d ,"Lenovo Yoga Pro 7 14ASP10" ,ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN ), +SND_PCI_QUIRK (0x17aa ,0x3911 ,"Lenovo Yoga Pro 7 14IAH10" ,ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN ),SND_PCI_QUIRK (0x17aa ,0x3913 ,"Lenovo 145" ,ALC236_FIXUP_LENOVO_INV_DMIC ),SND_PCI_QUIRK (0x17aa ,0x3977 ,"IdeaPad S210" ,ALC283_FIXUP_INT_MIC ), SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 23/166 HID: roccat: fix use-after-free in roccat_report_event
In reply to Greg Kroah-Hartman6.6-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 24/166 ata: ahci: force 32-bit DMA for JMicron JMB582/JMB585
In reply to Greg Kroah-Hartman6.6-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
@@ -60,6 +60,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,
@@ -199,6 +200,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),
@@ -432,6 +442,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 25/166 wifi: brcmfmac: validate bsscfg indices in IF events
In reply to Greg Kroah-Hartman6.6-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 26/166 ASoC: stm32_sai: fix incorrect BCLK polarity for DSP_A/B, LEFT_J
In reply to Greg Kroah-Hartman6.6-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
@@ -677,6 +677,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 */
@@ -684,9 +685,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 27/166 soc: aspeed: socinfo: Mask table entries for accurate SoC ID matching
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Potin Lai <[email protected]>
[ Upstream commit 7ec1bd3d9be671d04325b9e06149b8813f6a4836 ]
The siliconid_to_name() function currently masks the input silicon ID with 0xff00ffff, but compares it against unmasked table entries. This causes matching to fail if the table entries contain non-zero values in the bits covered by the mask (bits 16-23).
Update the logic to apply the 0xff00ffff mask to the table entries during comparison. This ensures that only the relevant model and revision bits are considered, providing a consistent match across different manufacturing batches.
[arj: Add Fixes: tag, fix 'soninfo' typo, clarify function reference]
--- drivers/soc/aspeed/aspeed-socinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/aspeed/aspeed-socinfo.c +1 -1
@@ -39,7 +39,7 @@ static const char *siliconid_to_name(u32 siliconid)unsigned int i;for (i =0 ; i <ARRAY_SIZE (rev_table) ; ++i) { -if (rev_table[i].id == id) +if ((rev_table[i].id &0xff00ffff ) == id)return rev_table[i].name; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 28/166 arm64: dts: imx8mq: Set the correct gpu_ahb clock frequency
In reply to Greg Kroah-Hartman6.6-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
@@ -1629,7 +1629,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 29/166 PCI: hv: Set default NUMA node to 0 for devices without affinity info
In reply to Greg Kroah-Hartman6.6-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
@@ -2371,6 +2371,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 30/166 drm/vc4: Release runtime PM reference after binding V3D
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maíra Canal <[email protected]>
[ Upstream commit aaefbdde9abdc43699e110679c0e10972a5e1c59 ]
The vc4_v3d_bind() function acquires a runtime PM reference via pm_runtime_resume_and_get() to access V3D registers during setup. However, this reference is never released after a successful bind. This prevents the device from ever runtime suspending, since the reference count never reaches zero.
Release the runtime PM reference by adding pm_runtime_put_autosuspend() after autosuspend is configured, allowing the device to runtime suspend after the delay.
--- drivers/gpu/drm/vc4/vc4_v3d.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/vc4/vc4_v3d.c +1 -0
@@ -491,6 +491,7 @@ static int vc4_v3d_bind(struct device *dev, struct device *master, void *data)pm_runtime_use_autosuspend (dev);pm_runtime_set_autosuspend_delay (dev,40 );/* a little over 2 frames. */ +pm_runtime_put_autosuspend (dev);return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 13/166 ALSA: hda/realtek: add quirk for Framework F111:000F
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dustin L. Howett <[email protected]>
[ Upstream commit bac1e57adf08c9ee33e95fb09cd032f330294e70 ]
Similar to commit 7b509910b3ad ("ALSA hda/realtek: Add quirk for Framework F111:000C") and previous quirks for Framework systems with Realtek codecs.
000F is another new platform with an ALC285 which needs the same quirk.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10671,6 +10671,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0xf111 ,0x0009 ,"Framework Laptop" ,ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0xf111 ,0x000b ,"Framework Laptop" ,ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0xf111 ,0x000c ,"Framework Laptop" ,ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE ), +SND_PCI_QUIRK (0xf111 ,0x000f ,"Framework Laptop" ,ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE ), #if 0/* Below is a quirk table taken from the old code.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 31/166 drm/vc4: Fix memory leak of BO array in hang state
In reply to Greg Kroah-Hartman6.6-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 32/166 drm/vc4: Fix a memory leak in hang state error path
In reply to Greg Kroah-Hartman6.6-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
@@ -169,10 +169,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 ;
@@ -189,10 +187,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++) {
@@ -284,6 +280,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 33/166 drm/vc4: Protect madv read in vc4_gem_object_mmap() with madv_lock
In reply to Greg Kroah-Hartman6.6-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
@@ -738,12 +738,15 @@ static int vc4_gem_object_mmap(struct drm_gem_object *obj, struct vm_area_structreturn -EINVAL ; } +mutex_lock (&bo->madv_lock);if (bo->madv !=VC4_MADV_WILLNEED ) {DRM_DEBUG ("mmapping 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);return drm_gem_dma_mmap (&bo->base, vma); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 34/166 eventpoll: defer struct eventpoll free to RCU grace period
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Carlini <[email protected]>
[ Upstream commit 07712db80857d5d09ae08f3df85a708ecfc3b61f ]
In certain situations, ep_free() in eventpoll.c will kfree the epi->ep eventpoll struct while it still being used by another concurrent thread. Defer the kfree() to an RCU callback to prevent UAF.
--- fs/eventpoll.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/eventpoll.c +5 -1
@@ -225,6 +225,9 @@ struct eventpoll {*/ refcount_t refcount; +/* used to defer freeing past ep_get_upwards_depth_proc() RCU walk */ +struct rcu_head rcu; +#ifdef CONFIG_NET_RX_BUSY_POLL /* used to track busy poll napi_id */ unsigned int napi_id;
@@ -708,7 +711,8 @@ static void ep_free(struct eventpoll *ep)mutex_destroy (&ep->mtx);free_uid (ep->user);wakeup_source_unregister (ep->ws); -kfree (ep); +/* ep_get_upwards_depth_proc() may still hold epi->ep under RCU */ +kfree_rcu (ep, rcu); }/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 35/166 net: sched: act_csum: validate nested VLAN headers
In reply to Greg Kroah-Hartman6.6-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
@@ -603,8 +603,12 @@ TC_INDIRECT_SCOPE int tcf_csum_act(struct sk_buff *skb, 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 36/166 net: lapbether: handle NETDEV_PRE_TYPE_CHANGE
In reply to Greg Kroah-Hartman6.6-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
@@ -444,33 +444,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 37/166 ipv4: icmp: fix null-ptr-deref in icmp_build_probe()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yiqi Sun <[email protected]>
[ Upstream commit fde29fd9349327acc50d19a0b5f3d5a6c964dfd8 ]
ipv6_stub->ipv6_dev_find() may return ERR_PTR(-EAFNOSUPPORT) when the IPv6 stack is not active (CONFIG_IPV6=m and not loaded), and passing this error pointer to dev_hold() will cause a kernel crash with null-ptr-deref.
Instead, silently discard the request. RFC 8335 does not appear to define a specific response for the case where an IPv6 interface identifier is syntactically valid but the implementation cannot perform the lookup at runtime, and silently dropping the request may safer than misreporting "No Such Interface".
--- net/ipv4/icmp.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/ipv4/icmp.c +7 -0
@@ -1136,6 +1136,13 @@ bool icmp_build_probe(struct sk_buff *skb, struct icmphdr *icmphdr)if (iio->ident.addr.ctype3_hdr.addrlen !=sizeof (struct in6_addr )) goto send_mal_query; dev = ipv6_stub->ipv6_dev_find (net, &iio->ident.addr.ip_addr.ipv6_addr, dev); +/* +* If IPv6 identifier lookup is unavailable, silently +* discard the request instead of misreporting NO_IF. +*/ +if (IS_ERR (dev)) +return false; +dev_hold (dev);break ;#endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 38/166 nfc: s3fwrn5: allocate rx skb before consuming bytes
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 5c14a19d5b1645cce1cb1252833d70b23635b632 ]
s3fwrn82_uart_read() reports the number of accepted bytes to the serdev core. The current code consumes bytes into recv_skb and may already deliver a complete frame before allocating a fresh receive buffer.
If that alloc_skb() fails, the callback returns 0 even though it has already consumed bytes, and it leaves recv_skb as NULL for the next receive callback. That breaks the receive_buf() accounting contract and can also lead to a NULL dereference on the next skb_put_u8().
Allocate the receive skb lazily before consuming the next byte instead. If allocation fails, return the number of bytes already accepted.
--- drivers/nfc/s3fwrn5/uart.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/nfc/s3fwrn5/uart.c +7 -3
@@ -59,6 +59,12 @@ static int s3fwrn82_uart_read(struct serdev_device *serdev,size_t i;for (i =0 ; i < count; i++) { +if (!phy->recv_skb) { + phy->recv_skb =alloc_skb (NCI_SKB_BUFF_LEN ,GFP_KERNEL ); +if (!phy->recv_skb) +return i; + } +skb_put_u8 (phy->recv_skb, *data++);if (phy->recv_skb->len <S3FWRN82_NCI_HEADER )
@@ -70,9 +76,7 @@ static int s3fwrn82_uart_read(struct serdev_device *serdev,s3fwrn5_recv_frame (phy->common.ndev, phy->recv_skb, phy->common.mode); - phy->recv_skb =alloc_skb (NCI_SKB_BUFF_LEN ,GFP_KERNEL ); -if (!phy->recv_skb) -return 0 ; + phy->recv_skb =NULL ; }return i;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 39/166 net: stmmac: Fix PTP ref clock for Tegra234
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jon Hunter <[email protected]>
[ Upstream commit 1345e9f4e3f3bc7d8a0a2138ae29e205a857a555 ]
Since commit 030ce919e114 ("net: stmmac: make sure that ptp_rate is not 0 before configuring timestamping") was added the following error is observed on Tegra234:
ERR KERN tegra-mgbe 6800000.ethernet eth0: Invalid PTP clock rate WARNING KERN tegra-mgbe 6800000.ethernet eth0: PTP init failed
It turns out that the Tegra234 device-tree binding defines the PTP ref clock name as 'ptp-ref' and not 'ptp_ref' and the above commit now exposes this and that the PTP clock is not configured correctly.
In order to update device-tree to use the correct 'ptp_ref' name, update the Tegra MGBE driver to use 'ptp_ref' by default and fallback to using 'ptp-ref' if this clock name is present.
--- .../net/ethernet/stmicro/stmmac/dwmac-tegra.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c +17 -2
@@ -9,7 +9,7 @@#include "stmmac_platform.h" static const char *const mgbe_clks[] = { -"rx-pcs" ,"tx" ,"tx-pcs" ,"mac-divider" ,"mac" ,"mgbe" ,"ptp-ref" ,"mac" +"rx-pcs" ,"tx" ,"tx-pcs" ,"mac-divider" ,"mac" ,"mgbe" ,"ptp_ref" ,"mac" };struct tegra_mgbe {
@@ -215,6 +215,7 @@ static int tegra_mgbe_probe(struct platform_device *pdev) {struct plat_stmmacenet_data *plat;struct stmmac_resources res; +bool use_legacy_ptp = false;struct tegra_mgbe *mgbe;int irq, err, i;u32 value;
@@ -257,9 +258,23 @@ static int tegra_mgbe_probe(struct platform_device *pdev)if (!mgbe->clks)return -ENOMEM ; -for (i =0 ; i <ARRAY_SIZE (mgbe_clks); i++) +/* Older device-trees use 'ptp-ref' rather than 'ptp_ref'. +* Fall back when the legacy name is present. +*/ +if (of_property_match_string (pdev->dev.of_node,"clock-names" , +"ptp-ref" ) >=0 ) + use_legacy_ptp = true; + +for (i =0 ; i <ARRAY_SIZE (mgbe_clks); i++) { mgbe->clks[i].id = mgbe_clks[i]; +if (use_legacy_ptp && !strcmp (mgbe_clks[i],"ptp_ref" )) { +dev_warn (mgbe->dev, +"Device-tree update needed for PTP clock!\n" ); + mgbe->clks[i].id ="ptp-ref" ; + } + } + err =devm_clk_bulk_get (mgbe->dev,ARRAY_SIZE (mgbe_clks), mgbe->clks);if (err <0 )return err;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 40/166 dt-bindings: net: Fix Tegra234 MGBE PTP clock
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jon Hunter <[email protected]>
[ Upstream commit fb22b1fc5bca3c0aad95388933497ceb30f1fb26 ]
The PTP clock for the Tegra234 MGBE device is incorrectly named 'ptp-ref' and should be 'ptp_ref'. This is causing the following warning to be observed on Tegra234 platforms that use this device:
ERR KERN tegra-mgbe 6800000.ethernet eth0: Invalid PTP clock rate WARNING KERN tegra-mgbe 6800000.ethernet eth0: PTP init failed
Although this constitutes an ABI breakage in the binding for this device, PTP support has clearly never worked and so fix this now so we can correct the device-tree for this device. Note that the MGBE driver still supports the legacy 'ptp-ref' clock name and so older/existing device-trees will still work, but given that this is not the correct name, there is no point to advertise this in the binding.
--- .../devicetree/bindings/net/nvidia,tegra234-mgbe.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/net/nvidia,tegra234-mgbe.yaml +2 -2
@@ -42,7 +42,7 @@ properties: - const: mgbe - const: mac - const: mac-divider - - const: ptp-ref + - const: ptp_ref - const: rx-input-m - const: rx-input - const: tx
@@ -133,7 +133,7 @@ examples: <&bpmp TEGRA234_CLK_MGBE0_RX_PCS_M>, <&bpmp TEGRA234_CLK_MGBE0_RX_PCS>, <&bpmp TEGRA234_CLK_MGBE0_TX_PCS>; - clock-names = "mgbe", "mac", "mac-divider", "ptp-ref", "rx-input-m", + clock-names = "mgbe", "mac", "mac-divider", "ptp_ref", "rx-input-m", "rx-input", "tx", "eee-pcs", "rx-pcs-input", "rx-pcs-m", "rx-pcs", "tx-pcs"; resets = <&bpmp TEGRA234_RESET_MGBE0_MAC>,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 14/166 wifi: wl1251: validate packet IDs before indexing tx_frames
In reply to Greg Kroah-Hartman6.6-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 41/166 tracing/probe: reject non-closed empty immediate strings
In reply to Greg Kroah-Hartman6.6-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
@@ -1039,7 +1039,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 42/166 ixgbevf: add missing negotiate_features op to Hyper-V ops table
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Schmidt <[email protected]>
[ Upstream commit 4821d563cd7f251ae728be1a6d04af82a294a5b9 ]
Commit a7075f501bd3 ("ixgbevf: fix mailbox API compatibility by negotiating supported features") added the .negotiate_features callback to ixgbe_mac_operations and populated it in ixgbevf_mac_ops, but forgot to add it to ixgbevf_hv_mac_ops. This leaves the function pointer NULL on Hyper-V VMs.
During probe, ixgbevf_negotiate_api() calls ixgbevf_set_features(), which unconditionally dereferences hw->mac.ops.negotiate_features(). On Hyper-V this results in a NULL pointer dereference:
BUG: kernel NULL pointer dereference, address: 0000000000000000 [...] Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine [...] Workqueue: events work_for_cpu_fn RIP: 0010:0x0 [...] Call Trace: ixgbevf_negotiate_api+0x66/0x160 [ixgbevf] ixgbevf_sw_init+0xe4/0x1f0 [ixgbevf] ixgbevf_probe+0x20f/0x4a0 [ixgbevf] local_pci_probe+0x50/0xa0 work_for_cpu_fn+0x1a/0x30 [...]
Add ixgbevf_hv_negotiate_features_vf() that returns -EOPNOTSUPP and wire it into ixgbevf_hv_mac_ops. The caller already handles -EOPNOTSUPP gracefully.
--- drivers/net/ethernet/intel/ixgbevf/vf.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/ethernet/intel/ixgbevf/vf.c +7 -0
@@ -709,6 +709,12 @@ static int ixgbevf_negotiate_features_vf(struct ixgbe_hw *hw, u32 *pf_features)return err; } +static int ixgbevf_hv_negotiate_features_vf (struct ixgbe_hw *hw, +u32 *pf_features) +{ +return -EOPNOTSUPP ; +} +/** * ixgbevf_set_vfta_vf - Set/Unset VLAN filter table address * @hw: pointer to the HW structure
@@ -1142,6 +1148,7 @@ static const struct ixgbe_mac_operations ixgbevf_hv_mac_ops = { .setup_link = ixgbevf_setup_mac_link_vf, .check_link = ixgbevf_hv_check_mac_link_vf, .negotiate_api_version = ixgbevf_hv_negotiate_api_version_vf, + .negotiate_features = ixgbevf_hv_negotiate_features_vf, .set_rar = ixgbevf_hv_set_rar_vf, .update_mc_addr_list = ixgbevf_hv_update_mc_addr_list_vf, .update_xcast_mode = ixgbevf_hv_update_xcast_mode,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 43/166 e1000: check return value of e1000_read_eeprom
In reply to Greg Kroah-Hartman6.6-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 44/166 xsk: tighten UMEM headroom validation to account for tailroom and min frame
In reply to Greg Kroah-Hartman6.6-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
@@ -196,7 +196,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 45/166 xsk: respect tailroom for ZC setups
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej Fijalkowski <[email protected]>
[ Upstream commit 1ee1605138fc94cc8f8f273321dd2471c64977f9 ]
Multi-buffer XDP stores information about frags in skb_shared_info that sits at the tailroom of a packet. The storage space is reserved via xdp_data_hard_end():
((xdp)->data_hard_start + (xdp)->frame_sz - \ SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
and then we refer to it via macro below:
static inline struct skb_shared_info * xdp_get_shared_info_from_buff(const struct xdp_buff *xdp)
{
return (struct skb_shared_info *)xdp_data_hard_end(xdp);
}Currently we do not respect this tailroom space in multi-buffer AF_XDP ZC scenario. To address this, introduce xsk_pool_get_tailroom() and use it within xsk_pool_get_rx_frame_size() which is used in ZC drivers to configure length of HW Rx buffer.
Typically drivers on Rx Hw buffers side work on 128 byte alignment so let us align the value returned by xsk_pool_get_rx_frame_size() in order to avoid addressing this on driver's side. This addresses the fact that idpf uses mentioned function *before* pool->dev being set so we were at risk that after subtracting tailroom we would not provide 128-byte aligned value to HW.
Since xsk_pool_get_rx_frame_size() is actively used in xsk_rcv_check() and __xsk_rcv(), add a variant of this routine that will not include 128 byte alignment and therefore old behavior is preserved.
--- include/net/xdp_sock_drv.h | 23 ++++++++++++++++++++++- net/xdp/xsk.c | 4 ++-- 2 files changed, 24 insertions(+), 3 deletions(-)
include/net/xdp_sock_drv.h +22 -1
@@ -31,16 +31,37 @@ static inline u32 xsk_pool_get_headroom(struct xsk_buff_pool *pool)return XDP_PACKET_HEADROOM + pool->headroom; } +static inline u32 xsk_pool_get_tailroom (bool mbuf) +{ +return mbuf ?SKB_DATA_ALIGN (sizeof (struct skb_shared_info )) :0 ; +} +static inline u32 xsk_pool_get_chunk_size (struct xsk_buff_pool *pool) {return pool->chunk_size; } -static inline u32 xsk_pool_get_rx_frame_size (struct xsk_buff_pool *pool) +static inline u32 __xsk_pool_get_rx_frame_size (struct xsk_buff_pool *pool) {return xsk_pool_get_chunk_size (pool) -xsk_pool_get_headroom (pool); } +static inline u32 xsk_pool_get_rx_frame_size (struct xsk_buff_pool *pool) +{ +u32 frame_size =__xsk_pool_get_rx_frame_size (pool); +struct xdp_umem *umem = pool->umem; +bool mbuf; + +/* Reserve tailroom only for zero-copy pools that opted into +* multi-buffer. The reserved area is used for skb_shared_info, +* matching the XDP core's xdp_data_hard_end() layout. +*/ + mbuf = pool->dev && (umem->flags &XDP_UMEM_SG_FLAG ); + frame_size -=xsk_pool_get_tailroom (mbuf); + +return ALIGN_DOWN (frame_size,128 ); +} +static inline u32 xsk_pool_get_rx_frag_step (struct xsk_buff_pool *pool) {return pool->unaligned ?0 :xsk_pool_get_chunk_size (pool);
net/xdp/xsk.c +2 -2
@@ -232,7 +232,7 @@ static u32 xsk_copy_xdp(void *to, void **from, u32 to_len,static int __xsk_rcv (struct xdp_sock *xs,struct xdp_buff *xdp,u32 len) { -u32 frame_size =xsk_pool_get_rx_frame_size (xs->pool); +u32 frame_size =__xsk_pool_get_rx_frame_size (xs->pool);void *copy_from =xsk_copy_xdp_start (xdp), *copy_to;u32 from_len, meta_len, rem, num_desc;struct xdp_buff_xsk *xskb;
@@ -324,7 +324,7 @@ static int xsk_rcv_check(struct xdp_sock *xs, struct xdp_buff *xdp, u32 len)if (xs->dev != xdp->rxq->dev || xs->queue_id != xdp->rxq->queue_index)return -EINVAL ; -if (len >xsk_pool_get_rx_frame_size (xs->pool) && !xs->sg) { +if (len >__xsk_pool_get_rx_frame_size (xs->pool) && !xs->sg) { xs->rx_dropped++;return -ENOSPC ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 46/166 xsk: fix XDP_UMEM_SG_FLAG issues
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej Fijalkowski <[email protected]>
[ Upstream commit 93e84fe45b752d17a5a46b306ed78f0133bbc719 ]
Currently xp_assign_dev_shared() is missing XDP_USE_SG being propagated to flags so set it in order to preserve mtu check that is supposed to be done only when no multi-buffer setup is in picture.
Also, this flag has the same value as XDP_UMEM_TX_SW_CSUM so we could get unexpected SG setups for software Tx checksums. Since csum flag is UAPI, modify value of XDP_UMEM_SG_FLAG.
--- include/net/xdp_sock.h | 2 +- net/xdp/xsk_buff_pool.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-)
include/net/xdp_sock.h +1 -1
@@ -14,7 +14,7 @@#include <linux/mm.h> #include <net/sock.h> -#define XDP_UMEM_SG_FLAG (1 << 1) +#define XDP_UMEM_SG_FLAG BIT(3)struct net_device ;struct xsk_queue ;
net/xdp/xsk_buff_pool.c +4 -0
@@ -236,6 +236,10 @@ int xp_assign_dev_shared(struct xsk_buff_pool *pool, struct xdp_sock *umem_xs,return -EINVAL ; flags = umem->zc ?XDP_ZEROCOPY :XDP_COPY ; + +if (umem->flags &XDP_UMEM_SG_FLAG ) + flags |=XDP_USE_SG ; +if (umem_xs->pool->uses_need_wakeup) flags |=XDP_USE_NEED_WAKEUP ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 15/166 ASoC: soc-core: call missing INIT_LIST_HEAD() for card_aux_list
In reply to Greg Kroah-Hartman6.6-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
@@ -2681,6 +2681,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 16/166 ALSA: usb-audio: Fix quirk flags for NeuralDSP Quad Cortex
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Phil Willoughby <[email protected]>
[ Upstream commit bc5b4e5ae1a67700a618328217b6a3bd0f296e97 ]
The NeuralDSP Quad Cortex does not support DSD playback. We need this product-specific entry with zero quirks because otherwise it falls through to the vendor-specific entry which marks it as supporting DSD playback.
--- sound/usb/quirks.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/quirks.c +2 -0
@@ -2185,6 +2185,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_PLAYBACK_FIRST | QUIRK_FLAG_GENERIC_IMPLICIT_FB),DEVICE_FLG (0x13e5 ,0x0001 ,/* Serato Phono */ QUIRK_FLAG_IGNORE_CTL_ERROR ), +DEVICE_FLG (0x152a ,0x880a ,/* NeuralDSP Quad Cortex */ +0 ),/* Doesn't have the vendor quirk which would otherwise apply */ DEVICE_FLG (0x154e ,0x1002 ,/* Denon DCD-1500RE */ QUIRK_FLAG_ITF_USB_DSD_DAC |QUIRK_FLAG_CTL_MSG_DELAY ), DEVICE_FLG(0x154e, 0x1003, /* Denon DA-300USB */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 18/166 ASoC: amd: yc: Add DMI entry for HP Laptop 15-fc0xxx
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gilson Marquato Júnior <[email protected]>
[ Upstream commit 8ec017cf31299c4b6287ebe27afe81c986aeef88 ]
The HP Laptop 15-fc0xxx (subsystem ID 0x103c8dc9) has an internal DMIC connected to the AMD ACP6x audio coprocessor. Add a DMI quirk entry so the internal microphone is properly detected on this model.
Tested on HP Laptop 15-fc0237ns with Fedora 43 (kernel 6.19.9).
--- sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +7 -0
@@ -45,6 +45,13 @@ static struct snd_soc_card acp6x_card = { };static const struct dmi_system_id yc_acp_quirk_table[] = { + { + .driver_data = &acp6x_card, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"HP" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"HP Laptop 15-fc0xxx" ), + } + }, { .driver_data = &acp6x_card, .matches = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 19/166 pinctrl: intel: Fix the revision for new features (1kOhm PD, HW debouncer)
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit a4337a24d13e9e3b98a113e71d6b80dc5ed5f8c4 ]
The 1kOhm pull down and hardware debouncer are features of the revision 0.92 of the Chassis specification. Fix that in the code accordingly.
--- drivers/pinctrl/intel/pinctrl-intel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/intel/pinctrl-intel.c +1 -1
@@ -1581,7 +1581,7 @@ static int intel_pinctrl_probe(struct platform_device *pdev, value =readl (regs +REVID );if (value == ~0u )return -ENODEV ; -if (((value &REVID_MASK ) >>REVID_SHIFT ) >=0x94 ) { +if (((value &REVID_MASK ) >>REVID_SHIFT ) >=0x92 ) { community->features |=PINCTRL_FEATURE_DEBOUNCE ; community->features |=PINCTRL_FEATURE_1K_PD ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 20/166 platform/x86/amd: pmc: Add Thinkpad L14 Gen3 to quirk_s2idle_bug
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit 1a9452c428a6b76f0b797bae21daa454fccef1a2 ]
This platform is a similar vintage of platforms that had a BIOS bug leading to a 10s delay at resume from s0i3.
Add a quirk for it.
--- drivers/platform/x86/amd/pmc/pmc-quirks.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/platform/x86/amd/pmc/pmc-quirks.c +9 -0
@@ -197,6 +197,15 @@ static const struct dmi_system_id fwbug_list[] = { DMI_MATCH(DMI_PRODUCT_NAME, "82XQ"), } }, +/* https://bugzilla.kernel.org/show_bug.cgi?id=221273 */ + { + .ident = "Thinkpad L14 Gen3", + .driver_data = &quirk_s2idle_bug, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "21C6"), + } + }, /* https://gitlab.freedesktop.org/drm/amd/-/issues/4434 */ { .ident = "Lenovo Yoga 6 13ALC6",
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 11/166 ALSA: hda/realtek: Add mute LED quirk for HP Pavilion 15-eg0xxx
In reply to Greg Kroah-Hartman6.6-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
@@ -10108,6 +10108,7 @@ static const struct hda_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 48/166 xfrm: Wait for RCU readers during policy netns exit
In reply to Greg Kroah-Hartman6.6-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
@@ -4215,6 +4215,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
Greg Kroah-Hartman
maintainerPATCH 57/166 net: ipa: fix GENERIC_CMD register field masks for IPA v5.0+
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Koskovich <[email protected]>
[ Upstream commit 9709b56d908acc120fe8b4ae250b3c9d749ea832 ]
Fix the field masks to match the hardware layout documented in downstream GSI (GSI_V3_0_EE_n_GSI_EE_GENERIC_CMD_*).
Notably this fixes a WARN I was seeing when I tried to send "stop" to the MPSS remoteproc while IPA was up.
--- drivers/net/ipa/reg/gsi_reg-v5.0.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ipa/reg/gsi_reg-v5.0.c +4 -3
@@ -154,9 +154,10 @@ REG_FIELDS(EV_CH_CMD, ev_ch_cmd, 0x00025010 + 0x12000 * GSI_EE_AP);static const u32 reg_generic_cmd_fmask[] = { [GENERIC_OPCODE ] =GENMASK (4 ,0 ), - [GENERIC_CHID ] =GENMASK (9 ,5 ), - [GENERIC_EE ] =GENMASK (13 ,10 ), -/* Bits 14-31 reserved */ + [GENERIC_CHID ] =GENMASK (12 ,5 ), + [GENERIC_EE ] =GENMASK (16 ,13 ), +/* Bits 17-23 reserved */ + [GENERIC_PARAMS ] =GENMASK (31 ,24 ), };REG_FIELDS (GENERIC_CMD , generic_cmd,0x00025018 +0x12000 *GSI_EE_AP );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 58/166 net: ipa: fix event ring index not programmed for IPA v5.0+
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Koskovich <[email protected]>
[ Upstream commit 56007972c0b1e783ca714d6f1f4d6e66e531d21f ]
For IPA v5.0+, the event ring index field moved from CH_C_CNTXT_0 to CH_C_CNTXT_1. The v5.0 register definition intended to define this field in the CH_C_CNTXT_1 fmask array but used the old identifier of ERINDEX instead of CH_ERINDEX.
Without a valid event ring, GSI channels could never signal transfer completions. This caused gsi_channel_trans_quiesce() to block forever in wait_for_completion().
At least for IPA v5.2 this resolves an issue seen where runtime suspend, system suspend, and remoteproc stop all hanged forever. It also meant the IPA data path was completely non functional.
--- drivers/net/ipa/reg/gsi_reg-v5.0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ipa/reg/gsi_reg-v5.0.c +1 -1
@@ -28,7 +28,7 @@ REG_STRIDE_FIELDS(CH_C_CNTXT_0, ch_c_cntxt_0,static const u32 reg_ch_c_cntxt_1_fmask[] = { [CH_R_LENGTH ] =GENMASK (23 ,0 ), - [ERINDEX ] =GENMASK (31 ,24 ), + [CH_ERINDEX ] =GENMASK (31 ,24 ), }; REG_STRIDE_FIELDS(CH_C_CNTXT_1, ch_c_cntxt_1,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 59/166 l2tp: Drop large packets with UDP encap
In reply to Greg Kroah-Hartman6.6-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 60/166 gpio: tegra: fix irq_release_resources calling enable instead of disable
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Samasth Norway Ananda <[email protected]>
[ Upstream commit 1561d96f5f55c1bca9ff047ace5813f4f244eea6 ]
tegra_gpio_irq_release_resources() erroneously calls tegra_gpio_enable() instead of tegra_gpio_disable(). When IRQ resources are released, the GPIO configuration bit (CNF) should be cleared to deconfigure the pin as a GPIO. Leaving it enabled wastes power and can cause unexpected behavior if the pin is later reused for an alternate function via pinctrl.
--- drivers/gpio/gpio-tegra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-tegra.c +1 -1
@@ -597,7 +597,7 @@ static void tegra_gpio_irq_release_resources(struct irq_data *d)struct tegra_gpio_info *tgi =gpiochip_get_data (chip);gpiochip_relres_irq (chip, d->hwirq); -tegra_gpio_enable (tgi, d->hwirq); +tegra_gpio_disable (tgi, d->hwirq); }static void tegra_gpio_irq_print_chip (struct irq_data *d,struct seq_file *s)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 61/166 perf/x86/intel/uncore: Skip discovery table for offline dies
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zide Chen <[email protected]>
[ Upstream commit 7b568e9eba2fad89a696f22f0413d44cf4a1f892 ]
This warning can be triggered if NUMA is disabled and the system boots with fewer CPUs than the number of CPUs in die 0.
WARNING: CPU: 9 PID: 7257 at uncore.c:1157 uncore_pci_pmu_register+0x136/0x160 [intel_uncore]
Currently, the discovery table continues to be parsed even if all CPUs in the associated die are offline. This can lead to an array overflow at "pmu->boxes[die] = box" in uncore_pci_pmu_register(), which may trigger the warning above or cause other issues.
--- arch/x86/events/intel/uncore_discovery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/intel/uncore_discovery.c +1 -1
@@ -319,7 +319,7 @@ bool intel_uncore_has_discovery_tables(int *ignore) (val &UNCORE_DISCOVERY_DVSEC2_BIR_MASK ) *UNCORE_DISCOVERY_BIR_STEP ; die =get_device_die_id (dev); -if (die <0 ) +if ((die <0 ) || (die >=uncore_max_dies ()))continue ;parse_discovery_table (dev, die, bar_offset, &parsed, ignore);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 62/166 crypto: algif_aead - Fix minimum RX size check for decryption
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
[ Upstream commit 3d14bd48e3a77091cbce637a12c2ae31b4a1687c ]
The check for the minimum receive buffer size did not take the tag size into account during decryption. Fix this by adding the required extra length.
--- crypto/algif_aead.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/algif_aead.c +1 -1
@@ -170,7 +170,7 @@ static int _aead_recvmsg(struct socket *sock, struct msghdr *msg,if (usedpages < outlen) {size_t less = outlen - usedpages; -if (used < less) { +if (used < less + (ctx->enc ?0 : as)) { err = -EINVAL ; goto free; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 63/166 netfilter: conntrack: add missing netlink policy validations
In reply to Greg Kroah-Hartman6.6-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
@@ -3454,7 +3454,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
@@ -587,7 +587,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 64/166 ALSA: usb-audio: Improve Focusrite sample rate filtering
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geoffrey D. Bennett <[email protected]>
[ Upstream commit 24d2d3c5f94007a5a0554065ab7349bb69e28bcb ]
Replace the bLength == 10 max_rate check in focusrite_valid_sample_rate() with filtering that also examines the bmControls VAL_ALT_SETTINGS bit.
When VAL_ALT_SETTINGS is readable, the device uses strict per-altsetting rate filtering (only the highest rate pair for that altsetting is valid). When it is not readable, all rates up to max_rate are valid.
For devices without the bLength == 10 Format Type descriptor extension but with VAL_ALT_SETTINGS readable and multiple altsettings (only seen in Scarlett 18i8 3rd Gen playback), fall back to the Focusrite
convention: alt 1 = 48kHz, alt 2 = 96kHz, alt 3 = 192kHz.
This produces correct rate tables for all tested Focusrite devices (all Scarlett 2nd, 3rd, and 4th Gen, Clarett+, and Vocaster) using only USB descriptors, allowing QUIRK_FLAG_VALIDATE_RATES to be removed for Focusrite in the next commit.
--- sound/usb/format.c | 86 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 74 insertions(+), 12 deletions(-)
sound/usb/format.c +74 -12
@@ -304,9 +304,37 @@ static bool s1810c_valid_sample_rate(struct audioformat *fp, }/* -* Many Focusrite devices supports a limited set of sampling rates per -* altsetting. Maximum rate is exposed in the last 4 bytes of Format Type -* descriptor which has a non-standard bLength = 10. +* Focusrite devices use rate pairs: 44100/48000, 88200/96000, and +* 176400/192000. Return true if rate is in the pair for max_rate. +*/ +static bool focusrite_rate_pair (unsigned int rate, +unsigned int max_rate) +{ +switch (max_rate) { +case 48000 :return rate ==44100 || rate ==48000 ; +case 96000 :return rate ==88200 || rate ==96000 ; +case 192000 :return rate ==176400 || rate ==192000 ; +default :return true; + } +} + +/* +* Focusrite devices report all supported rates in a single clock +* source but only a subset is valid per altsetting. +* +* Detection uses two descriptor features: +* +* 1. Format Type descriptor bLength == 10: non-standard extension +* with max sample rate in bytes 6..9. +* +* 2. bmControls VAL_ALT_SETTINGS readable bit: when set, the device +* only supports the highest rate pair for that altsetting, and when +* clear, all rates up to max_rate are valid. +* +* For devices without the bLength == 10 extension but with +* VAL_ALT_SETTINGS readable and multiple altsettings (only seen in +* Scarlett 18i8 3rd Gen playback), fall back to the Focusrite +* convention: alt 1 = 48kHz, alt 2 = 96kHz, alt 3 = 192kHz. */ static bool focusrite_valid_sample_rate(struct snd_usb_audio *chip, struct audioformat *fp,
@@ -314,8 +342,10 @@ static bool focusrite_valid_sample_rate(struct snd_usb_audio *chip, {struct usb_interface *iface;struct usb_host_interface *alts; +struct uac2_as_header_descriptor *as;unsigned char *fmt;unsigned int max_rate; +bool val_alt; iface =usb_ifnum_to_if (chip->dev, fp->iface);if (!iface)
@@ -327,26 +357,58 @@ static bool focusrite_valid_sample_rate(struct snd_usb_audio *chip,if (!fmt)return true; + as =snd_usb_find_csint_desc (alts->extra, alts->extralen, +NULL ,UAC_AS_GENERAL ); +if (!as) +return true; + + val_alt =uac_v2v3_control_is_readable (as->bmControls, +UAC2_AS_VAL_ALT_SETTINGS ); +if (fmt[0 ] ==10 ) {/* bLength */ max_rate =combine_quad (&fmt[6 ]); -/* Validate max rate */ -if (max_rate !=48000 && - max_rate !=96000 && - max_rate !=192000 && - max_rate !=384000 ) { - +if (val_alt) +return focusrite_rate_pair (rate, max_rate); + +/* No val_alt: rates fall through from higher */ +switch (max_rate) { +case 192000 : +if (rate ==176400 || rate ==192000 ) +return true; + fallthrough; +case 96000 : +if (rate ==88200 || rate ==96000 ) +return true; + fallthrough; +case 48000 : +return (rate ==44100 || rate ==48000 ); +default :usb_audio_info (chip,"%u:%d : unexpected max rate: %u\n" , fp->iface, fp->altsetting, max_rate); -return true; } + } -return rate <= max_rate; +if (!val_alt) +return true; + +/* Multi-altsetting device with val_alt but no max_rate +* in the format descriptor. Use Focusrite convention: +* alt 1 = 48kHz, alt 2 = 96kHz, alt 3 = 192kHz. +*/ +if (iface->num_altsetting <=2 ) +return true; + +switch (fp->altsetting) { +case 1 : max_rate =48000 ;break ; +case 2 : max_rate =96000 ;break ; +case 3 : max_rate =192000 ;break ; +default :return true; } -return true; +return focusrite_rate_pair (rate, max_rate); }/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 65/166 objtool: Remove max symbol name length limitation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Plattner <[email protected]>
[ Upstream commit f404a58dcf0c862b05602f641ce5fdd8b98fbc3a ]
If one of the symbols processed by read_symbols() happens to have a .cold variant with a name longer than objtool's MAX_NAME_LEN limit, the build fails.
Avoid this problem by just using strndup() to copy the parent function's name, rather than strncpy()ing it onto the stack.
--- tools/objtool/elf.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
tools/objtool/elf.c +6 -8
@@ -22,8 +22,6 @@#include <objtool/elf.h> #include <objtool/warn.h> -#define MAX_NAME_LEN 128 -static inline u32 str_hash (const char *str) {return jhash (str,strlen (str),0 );
@@ -515,7 +513,7 @@ static int read_symbols(struct elf *elf)/* Create parent/child links for any cold subfunctions */ list_for_each_entry (sec, &elf->sections, list) {sec_for_each_sym (sec, sym) { -char pname[MAX_NAME_LEN +1 ]; +char *pname;size_t pnamelen;if (sym->type !=STT_FUNC )continue ;
@@ -531,15 +529,15 @@ static int read_symbols(struct elf *elf)continue ; pnamelen = coldstr - sym->name; -if (pnamelen >MAX_NAME_LEN ) { -WARN ("%s(): parent function name exceeds maximum length of %d characters" , - sym->name,MAX_NAME_LEN ); + pname =strndup (sym->name, pnamelen); +if (!pname) { +WARN ("%s(): failed to allocate memory" , + sym->name);return -1 ; } -strncpy (pname, sym->name, pnamelen); - pname[pnamelen] ='\0' ; pfunc =find_symbol_by_name (elf, pname); +free (pname);if (!pfunc) { WARN("%s(): can't find parent function",
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 66/166 drm/i915/psr: Do not use pipe_src as borders for SU area
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jouni Högander <[email protected]>
[ Upstream commit 75519f5df2a9b23f7bf305e12dc9a6e3e65c24b7 ]
This far using crtc_state->pipe_src as borders for Selective Update area haven't caused visible problems as drm_rect_width(crtc_state->pipe_src) == crtc_state->hw.adjusted_mode.crtc_hdisplay and drm_rect_height(crtc_state->pipe_src) == crtc_state->hw.adjusted_mode.crtc_vdisplay when pipe scaling is not used. On the other hand using pipe scaling is forcing full frame updates and all the Selective Update area calculations are skipped. Now this improper usage of crtc_state->pipe_src is causing following warnings:
<4> [7771.978166] xe 0000:00:02.0: [drm] drm_WARN_ON_ONCE(su_lines % vdsc_cfg->slice_height)
after WARN_ON_ONCE was added by commit:
"drm/i915/dsc: Add helper for writing DSC Selective Update ET parameters"
These warnings are seen when DSC and pipe scaling are enabled simultaneously. This is because on full frame update SU area is improperly set as pipe_src which is not aligned with DSC slice height.
Fix these by creating local rectangle using crtc_state->hw.adjusted_mode.crtc_hdisplay and crtc_state->hw.adjusted_mode.crtc_vdisplay. Use this local rectangle as borders for SU area.
--- drivers/gpu/drm/i915/display/intel_psr.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/display/intel_psr.c +12 -6
@@ -1924,9 +1924,9 @@ static void psr2_man_trk_ctl_calc(struct intel_crtc_state *crtc_state,static void clip_area_update (struct drm_rect *overlap_damage_area,struct drm_rect *damage_area, -struct drm_rect *pipe_src) +struct drm_rect *display_area) { -if (!drm_rect_intersect (damage_area, pipe_src)) +if (!drm_rect_intersect (damage_area, display_area))return ;if (overlap_damage_area->y1 ==-1 ) {
@@ -2004,6 +2004,12 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,struct drm_rect pipe_clip = { .x1 =0 , .y1 =-1 , .x2 =INT_MAX , .y2 =-1 };struct intel_plane_state *new_plane_state, *old_plane_state;struct intel_plane *plane; +struct drm_rect display_area = { + .x1 =0 , + .y1 =0 , + .x2 = crtc_state->hw.adjusted_mode.crtc_hdisplay, + .y2 = crtc_state->hw.adjusted_mode.crtc_vdisplay, + };bool full_update = false;int i, ret;
@@ -2050,14 +2056,14 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, damaged_area.y1 = old_plane_state->uapi.dst.y1; damaged_area.y2 = old_plane_state->uapi.dst.y2;clip_area_update (&pipe_clip, &damaged_area, - &crtc_state->pipe_src); + &display_area); }if (new_plane_state->uapi.visible) { damaged_area.y1 = new_plane_state->uapi.dst.y1; damaged_area.y2 = new_plane_state->uapi.dst.y2;clip_area_update (&pipe_clip, &damaged_area, - &crtc_state->pipe_src); + &display_area); }continue ; }else if (new_plane_state->uapi.alpha != old_plane_state->uapi.alpha) {
@@ -2065,7 +2071,7 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, damaged_area.y1 = new_plane_state->uapi.dst.y1; damaged_area.y2 = new_plane_state->uapi.dst.y2;clip_area_update (&pipe_clip, &damaged_area, - &crtc_state->pipe_src); + &display_area);continue ; }
@@ -2081,7 +2087,7 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, damaged_area.x1 += new_plane_state->uapi.dst.x1 - src.x1; damaged_area.x2 += new_plane_state->uapi.dst.x1 - src.x1; -clip_area_update (&pipe_clip, &damaged_area, &crtc_state->pipe_src); +clip_area_update (&pipe_clip, &damaged_area, &display_area); }/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 49/166 xfrm_user: fix info leak in build_mapping()
In reply to Greg Kroah-Hartman6.6-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
@@ -3790,6 +3790,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 67/166 nfc: llcp: add missing return after LLCP_CLOSED checks
In reply to Greg Kroah-Hartman6.6-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
@@ -1089,6 +1089,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 */
@@ -1180,6 +1181,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 68/166 can: raw: fix ro->uniq use-after-free in raw_rcv()
In reply to Greg Kroah-Hartman6.6-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
@@ -336,6 +336,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);
@@ -362,6 +370,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);
@@ -409,7 +419,6 @@ static int raw_release(struct socket *so ro->bound =0 ; ro->dev =NULL ; ro->count =0 ; -free_percpu (ro->uniq);sock_orphan (sk); sock->sk =NULL ;
Greg Kroah-Hartman
maintainerPATCH 69/166 i2c: s3c24xx: check the size of the SMBUS message before using it
In reply to Greg Kroah-Hartman6.6-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
@@ -504,8 +504,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 70/166 staging: rtl8723bs: initialize le_tmp64 in rtw_BIP_verify()
In reply to Greg Kroah-Hartman6.6-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
@@ -1364,7 +1364,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 71/166 HID: alps: fix NULL pointer dereference in alps_raw_event()
In reply to Greg Kroah-Hartman6.6-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 72/166 HID: core: clamp report_size in s32ton() to avoid undefined shift
In reply to Greg Kroah-Hartman6.6-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
@@ -1356,6 +1356,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 73/166 net: usb: cdc-phonet: fix skb frags[] overflow in rx_complete()
In reply to Greg Kroah-Hartman6.6-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 74/166 NFC: digital: Bounds check NFC-A cascade depth in SDD response handler
In reply to Greg Kroah-Hartman6.6-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 75/166 drm/vc4: platform_get_irq_byname() returns an int
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit e597a809a2b97e927060ba182f58eb3e6101bc70 upstream.
platform_get_irq_byname() will return a negative value if an error happens, so it should be checked and not just passed directly into devm_request_threaded_irq() hoping all will be ok.
--- drivers/gpu/drm/vc4/vc4_hdmi.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/vc4/vc4_hdmi.c +10 -4
@@ -2854,17 +2854,23 @@ static int vc4_hdmi_hotplug_init(structint ret;if (vc4_hdmi->variant->external_irq_controller) { -unsigned int hpd_con =platform_get_irq_byname (pdev,"hpd-connected" ); -unsigned int hpd_rm =platform_get_irq_byname (pdev,"hpd-removed" ); +int hpd =platform_get_irq_byname (pdev,"hpd-connected" ); - ret =devm_request_threaded_irq (&pdev->dev, hpd_con, +if (hpd <0 ) +return hpd; + + ret =devm_request_threaded_irq (&pdev->dev, hpd,NULL , vc4_hdmi_hpd_irq_thread,IRQF_ONESHOT ,"vc4 hdmi hpd connected" , vc4_hdmi);if (ret)return ret; - ret =devm_request_threaded_irq (&pdev->dev, hpd_rm, + hpd =platform_get_irq_byname (pdev,"hpd-removed" ); +if (hpd <0 ) +return hpd; + + ret =devm_request_threaded_irq (&pdev->dev, hpd,NULL , vc4_hdmi_hpd_irq_thread,IRQF_ONESHOT ,"vc4 hdmi hpd disconnected" , vc4_hdmi);
Greg Kroah-Hartman
maintainerPATCH 76/166 ALSA: fireworks: bound device-supplied status before string array lookup
In reply to Greg Kroah-Hartman6.6-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 50/166 selftests: net: bridge_vlan_mcast: wait for h1 before querier check
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Golle <[email protected]>
[ Upstream commit efaa71faf212324ecbf6d5339e9717fe53254f58 ]
The querier-interval test adds h1 (currently a slave of the VRF created by simple_if_init) to a temporary bridge br1 acting as an outside IGMP querier. The kernel VRF driver (drivers/net/vrf.c) calls cycle_netdev() on every slave add and remove, toggling the interface admin-down then up. Phylink takes the PHY down during the admin-down half of that cycle. Since h1 and swp1 are cable-connected, swp1 also loses its link may need several seconds to re-negotiate.
Use setup_wait_dev $h1 0 which waits for h1 to return to UP state, so the test can rely on the link being back up at this point.
--- tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/net/forwarding/bridge_vlan_mcast.sh +1 -0
@@ -414,6 +414,7 @@ vlmc_querier_intvl_test() bridge vlan add vid 10 dev br1 self pvid untagged ip link set dev $h1 master br1 ip link set dev br1 up + setup_wait_dev $h1 0 bridge vlan add vid 10 dev $h1 master bridge vlan global set vid 10 dev br1 mcast_snooping 1 mcast_querier 1 sleep 2
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 77/166 fbdev: tdfxfb: avoid divide-by-zero on FBIOPUT_VSCREENINFO
In reply to Greg Kroah-Hartman6.6-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
@@ -496,6 +496,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 78/166 usb: gadget: f_ncm: validate minimum block_len in ncm_unwrap_ntb()
In reply to Greg Kroah-Hartman6.6-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
@@ -1196,8 +1196,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 79/166 usb: gadget: f_phonet: fix skb frags[] overflow in pn_rx_complete()
In reply to Greg Kroah-Hartman6.6-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
@@ -333,6 +333,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 80/166 usb: gadget: renesas_usb3: validate endpoint index in standard request handlers
In reply to Greg Kroah-Hartman6.6-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
@@ -1669,6 +1669,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 ;
@@ -1781,7 +1785,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 81/166 smb: client: fix off-by-8 bounds check in check_wsl_eas()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 3d8b9d06bd3ac4c6846f5498800b0f5f8062e53b upstream.
The bounds check uses (u8 *)ea + nlen + 1 + vlen as the end of the EA name and value, but ea_data sits at offset sizeof(struct smb2_file_full_ea_info) = 8 from ea, not at offset 0. The strncmp() later reads ea->ea_data[0..nlen-1] and the value bytes follow at ea_data[nlen+1..nlen+vlen], so the actual end is ea->ea_data + nlen + 1
+ vlen. Isn't pointer math fun?
The earlier check (u8 *)ea > end - sizeof(*ea) only guarantees the 8-byte header is in bounds, but since the last EA is placed within 8 bytes of the end of the response, the name and value bytes are read past the end of iov.
Fix this mess all up by using ea->ea_data as the base for the bounds check.
An "untrusted" server can use this to leak up to 8 bytes of kernel heap into the EA name comparison and influence which WSL xattr the data is interpreted as.
--- fs/smb/client/smb2inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/client/smb2inode.c +1 -1
@@ -125,7 +125,7 @@ static int check_wsl_eas(struct kvec *rs nlen = ea->ea_name_length; vlen =le16_to_cpu (ea->ea_value_length);if (nlen !=SMB2_WSL_XATTR_NAME_LEN || - (u8 *)ea + nlen +1 + vlen > end) + (u8 *)ea->ea_data + nlen +1 + vlen > end)return -EINVAL ;switch (vlen) {
Greg Kroah-Hartman
maintainerPATCH 51/166 ipvs: fix NULL deref in ip_vs_add_service error path
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weiming Shi <[email protected]>
[ Upstream commit 9a91797e61d286805ae10a92cc48959c30800556 ]
When ip_vs_bind_scheduler() succeeds in ip_vs_add_service(), the local variable sched is set to NULL. If ip_vs_start_estimator() subsequently fails, the out_err cleanup calls ip_vs_unbind_scheduler(svc, sched) with sched == NULL. ip_vs_unbind_scheduler() passes the cur_sched NULL check (because svc->scheduler was set by the successful bind) but then dereferences the NULL sched parameter at sched->done_service, causing a kernel panic at offset 0x30 from NULL.
Oops: general protection fault, [..] [#1] PREEMPT SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000030-0x0000000000000037] RIP: 0010:ip_vs_unbind_scheduler (net/netfilter/ipvs/ip_vs_sched.c:69) Call Trace: <TASK> ip_vs_add_service.isra.0 (net/netfilter/ipvs/ip_vs_ctl.c:1500) do_ip_vs_set_ctl (net/netfilter/ipvs/ip_vs_ctl.c:2809) nf_setsockopt (net/netfilter/nf_sockopt.c:102) [..]
Fix by simply not clearing the local sched variable after a successful bind. ip_vs_unbind_scheduler() already detects whether a scheduler is installed via svc->scheduler, and keeping sched non-NULL ensures the error path passes the correct pointer to both ip_vs_unbind_scheduler() and ip_vs_scheduler_put().
While the bug is older, the problem popups in more recent kernels (6.2), when the new error path is taken after the ip_vs_start_estimator() call.
--- net/netfilter/ipvs/ip_vs_ctl.c | 1 - 1 file changed, 1 deletion(-)
net/netfilter/ipvs/ip_vs_ctl.c +0 -1
@@ -1452,7 +1452,6 @@ ip_vs_add_service(struct netns_ipvs *ipvs, struct ip_vs_service_user_kern *u, ret =ip_vs_bind_scheduler (svc, sched);if (ret) goto out_err; - sched =NULL ; } ret =ip_vs_start_estimator (ipvs, &svc->stats);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 52/166 netfilter: nfnetlink_log: initialize nfgenmsg in NLMSG_DONE terminator
In reply to Greg Kroah-Hartman6.6-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
@@ -361,10 +361,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 53/166 netfilter: xt_multiport: validate range encoding in checkentry
In reply to Greg Kroah-Hartman6.6-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 54/166 netfilter: ip6t_eui64: reject invalid MAC header for all packets
In reply to Greg Kroah-Hartman6.6-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 55/166 net: txgbe: leave space for null terminators on property_entry
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Baltieri <[email protected]>
[ Upstream commit 5a37d228799b0ec2c277459c83c814a59d310bc3 ]
Lists of struct property_entry are supposed to be terminated with an empty property, this driver currently seems to be allocating exactly the amount of entry used.
Change the struct definition to leave an extra element for all property_entry.
--- drivers/net/ethernet/wangxun/txgbe/txgbe_type.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/wangxun/txgbe/txgbe_type.h +4 -4
@@ -161,10 +161,10 @@ struct txgbe_nodes {char i2c_name[32 ];char sfp_name[32 ];char phylink_name[32 ]; -struct property_entry gpio_props[1 ]; -struct property_entry i2c_props[3 ]; -struct property_entry sfp_props[8 ]; -struct property_entry phylink_props[2 ]; +struct property_entry gpio_props[2 ]; +struct property_entry i2c_props[4 ]; +struct property_entry sfp_props[9 ]; +struct property_entry phylink_props[3 ];struct software_node_ref_args i2c_ref[1 ];struct software_node_ref_args gpio0_ref[1 ];struct software_node_ref_args gpio1_ref[1 ];
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 56/166 af_unix: read UNIX_DIAG_VFS data under unix_state_lock
In reply to Greg Kroah-Hartman6.6-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
@@ -26,18 +26,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 47/166 xsk: validate MTU against usable frame size on bind
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej Fijalkowski <[email protected]>
[ Upstream commit 36ee60b569ba0dfb6f961333b90d19ab5b323fa9 ]
AF_XDP bind currently accepts zero-copy pool configurations without verifying that the device MTU fits into the usable frame space provided by the UMEM chunk.
This becomes a problem since we started to respect tailroom which is subtracted from chunk_size (among with headroom). 2k chunk size might not provide enough space for standard 1500 MTU, so let us catch such settings at bind time. Furthermore, validate whether underlying HW will be able to satisfy configured MTU wrt XSK's frame size multiplied by supported Rx buffer chain length (that is exposed via net_device::xdp_zc_max_segs).
--- net/xdp/xsk_buff_pool.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-)
net/xdp/xsk_buff_pool.c +25 -3
@@ -8,6 +8,8 @@#include "xdp_umem.h" #include "xsk.h" +#define ETH_PAD_LEN (ETH_HLEN + 2 * VLAN_HLEN + ETH_FCS_LEN) +void xp_add_xsk (struct xsk_buff_pool *pool,struct xdp_sock *xs) {unsigned long flags;
@@ -149,8 +151,12 @@ static void xp_disable_drv_zc(struct xsk_buff_pool *pool)int xp_assign_dev (struct xsk_buff_pool *pool,struct net_device *netdev,u16 queue_id,u16 flags) { +u32 needed = netdev->mtu +ETH_PAD_LEN ; +u32 segs = netdev->xdp_zc_max_segs; +bool mbuf = flags &XDP_USE_SG ;bool force_zc, force_copy;struct netdev_bpf bpf; +u32 frame_size;int err =0 ;ASSERT_RTNL ();
@@ -170,7 +176,7 @@ int xp_assign_dev(struct xsk_buff_pool *pool,if (err)return err; -if (flags &XDP_USE_SG ) +if (mbuf) pool->umem->flags |=XDP_UMEM_SG_FLAG ;if (flags &XDP_USE_NEED_WAKEUP )
@@ -192,8 +198,24 @@ int xp_assign_dev(struct xsk_buff_pool *pool, goto err_unreg_pool; } -if (netdev->xdp_zc_max_segs ==1 && (flags &XDP_USE_SG )) { - err = -EOPNOTSUPP ; +if (mbuf) { +if (segs ==1 ) { + err = -EOPNOTSUPP ; + goto err_unreg_pool; + } + }else { + segs =1 ; + } + +/* open-code xsk_pool_get_rx_frame_size() as pool->dev is not +* set yet at this point; we are before getting down to driver +*/ + frame_size =__xsk_pool_get_rx_frame_size (pool) - +xsk_pool_get_tailroom (mbuf); + frame_size =ALIGN_DOWN (frame_size,128 ); + +if (needed > frame_size * segs) { + err = -EINVAL ; goto err_unreg_pool; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 83/166 ksmbd: require 3 sub-authorities before reading sub_auth[2]
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 53370cf9090777774e07fd9a8ebce67c6cc333ab upstream.
parse_dacl() compares each ACE SID against sid_unix_NFS_mode and on match reads sid.sub_auth[2] as the file mode. If sid_unix_NFS_mode is the prefix S-1-5-88-3 with num_subauth = 2 then compare_sids() compares only min(num_subauth, 2) sub-authorities so a client SID with num_subauth = 2 and sub_auth = {88, 3} will match.
If num_subauth = 2 and the ACE is placed at the very end of the security descriptor, sub_auth[2] will be 4 bytes past end_of_acl. The out-of-band bytes will then be masked to the low 9 bits and applied as the file's POSIX mode, probably not something that is good to have happen.
Fix this up by forcing the SID to actually carry a third sub-authority before reading it at all.
--- fs/smb/server/smbacl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/smb/server/smbacl.c +2 -1
@@ -451,7 +451,8 @@ static void parse_dacl(struct mnt_idmap ppace[i]->access_req =smb_map_generic_desired_access (ppace[i]->access_req); -if (!(compare_sids (&ppace[i]->sid, &sid_unix_NFS_mode))) { +if (ppace[i]->sid.num_subauth >=3 && + !(compare_sids (&ppace[i]->sid, &sid_unix_NFS_mode))) { fattr->cf_mode =le32_to_cpu (ppace[i]->sid.sub_auth[2 ]);break ;
Greg Kroah-Hartman
maintainerPATCH 92/166 staging: sm750fb: fix division by zero in ps_to_hz()
In reply to Greg Kroah-Hartman6.6-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
@@ -483,6 +483,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 93/166 USB: serial: option: add Telit Cinterion FN990A MBIM composition
In reply to Greg Kroah-Hartman6.6-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 94/166 Docs/admin-guide/mm/damon/reclaim: warn commit_inputs vs param updates race
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 0beba407d4585a15b0dc09f2064b5b3ddcb0e857 upstream.
Patch series "Docs/admin-guide/mm/damon: warn commit_inputs vs other params race".
Writing 'Y' to the commit_inputs parameter of DAMON_RECLAIM and DAMON_LRU_SORT, and writing other parameters before the commit_inputs request is completely processed can cause race conditions. While the consequence can be bad, the documentation is not clearly describing that. Add clear warnings.
The issue was discovered [1,2] by sashiko.
This patch (of 2):
DAMON_RECLAIM handles commit_inputs request inside kdamond thread, reading the module parameters. If the user updates the module parameters while the kdamond thread is reading those, races can happen. To avoid this, the commit_inputs parameter shows whether it is still in the progress, assuming users wouldn't update parameters in the middle of the work. Some users might ignore that. Add a warning about the behavior.
The issue was discovered in [1] by sashiko.
--- Documentation/admin-guide/mm/damon/reclaim.rst | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/admin-guide/mm/damon/reclaim.rst +4 -0
@@ -71,6 +71,10 @@ of parametrs except ``enabled`` again. parameter is set as ``N``. If invalid parameters are found while the re-reading, DAMON_RECLAIM will be disabled. +Once ``Y`` is written to this parameter, the user must not write to any +parameters until reading ``commit_inputs`` again returns ``N``. If users +violate this rule, the kernel may exhibit undefined behavior. + min_age -------
Greg Kroah-Hartman
maintainerPATCH 95/166 ALSA: ctxfi: Limit PTP to a single page
In reply to Greg Kroah-Hartman6.6-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 96/166 dcache: Limit the minimal number of bucket to two
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhihao Cheng <[email protected]>
commit f08fe8891c3eeb63b73f9f1f6d97aa629c821579 upstream.
There is an OOB read problem on dentry_hashtable when user sets 'dhash_entries=1':
BUG: unable to handle page fault for address: ffff888b30b774b0
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
Oops: Oops: 0000 [#1] SMP PTI
RIP: 0010:__d_lookup+0x56/0x120
Call Trace:
d_lookup.cold+0x16/0x5d
lookup_dcache+0x27/0xf0
lookup_one_qstr_excl+0x2a/0x180
start_dirop+0x55/0xa0
simple_start_creating+0x8d/0xa0
debugfs_start_creating+0x8c/0x180
debugfs_create_dir+0x1d/0x1c0
pinctrl_init+0x6d/0x140
do_one_initcall+0x6d/0x3d0
kernel_init_freeable+0x39f/0x460
kernel_init+0x2a/0x260There will be only one bucket in dentry_hashtable when dhash_entries is set as one, and d_hash_shift is calculated as 32 by dcache_init(). Then, following process will access more than one buckets(which memory region is not allocated) in dentry_hashtable:
d_lookup
b = d_hash(hash)
dentry_hashtable + ((u32)hashlen >> d_hash_shift)
// The C standard defines the behavior of right shift amounts
// exceeding the bit width of the operand as undefined. The
// result of '(u32)hashlen >> d_hash_shift' becomes 'hashlen',
// so 'b' will point to an unallocated memory region.
hlist_bl_for_each_entry_rcu(b)
hlist_bl_first_rcu(head)
h->first // read OOB!Fix it by limiting the minimal number of dentry_hashtable bucket to two, so that 'd_hash_shift' won't exceeds the bit width of type u32.
--- fs/dcache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/dcache.c +2 -2
@@ -3296,7 +3296,7 @@ static void __init dcache_init_early(voiHASH_EARLY |HASH_ZERO , &d_hash_shift,NULL , -0 , +2 , 0); d_hash_shift =32 - d_hash_shift; }
@@ -3324,7 +3324,7 @@ static void __init dcache_init(void)HASH_ZERO , &d_hash_shift,NULL , -0 , +2 , 0); d_hash_shift =32 - d_hash_shift; }
Greg Kroah-Hartman
maintainerPATCH 97/166 media: vidtv: fix NULL pointer dereference in vidtv_channel_pmt_match_sections
In reply to Greg Kroah-Hartman6.6-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 98/166 ocfs2: fix possible deadlock between unlink and dio_end_io_write
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joseph Qi <[email protected]>
commit b02da26a992db0c0e2559acbda0fc48d4a2fd337 upstream.
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
@@ -2322,8 +2322,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));
@@ -2336,6 +2334,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 99/166 ocfs2: fix use-after-free in ocfs2_fault() when VM_FAULT_RETRY
In reply to Greg Kroah-Hartman6.6-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
@@ -30,7 +30,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;
@@ -38,11 +39,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 100/166 ocfs2: handle invalid dinode in ocfs2_group_extend
In reply to Greg Kroah-Hartman6.6-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
@@ -295,9 +295,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 101/166 KVM: SEV: Drop WARN on large size for KVM_MEMORY_ENCRYPT_REG_REGION
In reply to Greg Kroah-Hartman6.6-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
@@ -414,10 +414,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 ;
@@ -426,9 +432,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 84/166 ksmbd: fix mechToken leak when SPNEGO decode fails after token alloc
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit ad0057fb91218914d6c98268718ceb9d59b388e1 upstream.
The kernel ASN.1 BER decoder calls action callbacks incrementally as it walks the input. When ksmbd_decode_negTokenInit() reaches the mechToken
[2] OCTET STRING element, ksmbd_neg_token_alloc() allocates conn->mechToken immediately via kmemdup_nul(). If a later element in the same blob is malformed, then the decoder will return nonzero after the allocation is already live. This could happen if mechListMIC [3] overrunse the enclosing SEQUENCE.
decode_negotiation_token() then sets conn->use_spnego = false because both the negTokenInit and negTokenTarg grammars failed. The cleanup at the bottom of smb2_sess_setup() is gated on use_spnego:
if (conn->use_spnego && conn->mechToken) {
kfree(conn->mechToken);
conn->mechToken = NULL;
}so the kfree is skipped, causing the mechToken to never be freed.
This codepath is reachable pre-authentication, so untrusted clients can cause slow memory leaks on a server without even being properly authenticated.
Fix this up by not checking check for use_spnego, as it's not required, so the memory will always be properly freed. At the same time, always free the memory in ksmbd_conn_free() incase some other failure path forgot to free it.
--- fs/smb/server/connection.c | 1 + fs/smb/server/smb2pdu.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
fs/smb/server/connection.c +1 -0
@@ -39,6 +39,7 @@ void ksmbd_conn_free(struct ksmbd_conn *xa_destroy (&conn->sessions);kvfree (conn->request_buf);kfree (conn->preauth_info); +kfree (conn->mechToken);if (atomic_dec_and_test (&conn->refcnt)) { conn->transport->ops->free_transport (conn->transport);kfree (conn);
fs/smb/server/smb2pdu.c +1 -1
@@ -1901,7 +1901,7 @@ out_err:else if (rc) rsp->hdr.Status =STATUS_LOGON_FAILURE ; -if (conn->use_spnego && conn->mechToken) { +if (conn->mechToken) {kfree (conn->mechToken); conn->mechToken =NULL ; }
Greg Kroah-Hartman
maintainerPATCH 102/166 net: skb: fix cross-cache free of KFENCE-allocated skb head
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <[email protected]>
[ Upstream commit 0f42e3f4fe2a58394e37241d02d9ca6ab7b7d516 ]
SKB_SMALL_HEAD_CACHE_SIZE is intentionally set to a non-power-of-2 value (e.g. 704 on x86_64) to avoid collisions with generic kmalloc bucket sizes. This ensures that skb_kfree_head() can reliably use skb_end_offset to distinguish skb heads allocated from skb_small_head_cache vs. generic kmalloc caches.
However, when KFENCE is enabled, kfence_ksize() returns the exact requested allocation size instead of the slab bucket size. If a caller (e.g. bpf_test_init) allocates skb head data via kzalloc() and the requested size happens to equal SKB_SMALL_HEAD_CACHE_SIZE, then slab_build_skb() -> ksize() returns that exact value. After subtracting skb_shared_info overhead, skb_end_offset ends up matching SKB_SMALL_HEAD_HEADROOM, causing skb_kfree_head() to incorrectly free the object to skb_small_head_cache instead of back to the original kmalloc cache, resulting in a slab cross-cache free:
kmem_cache_free(skbuff_small_head): Wrong slab cache. Expected skbuff_small_head but got kmalloc-1k
Fix this by always calling kfree(head) in skb_kfree_head(). This keeps the free path generic and avoids allocator-specific misclassification for KFENCE objects.
--- net/core/skbuff.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
net/core/skbuff.c +1 -4
@@ -943,10 +943,7 @@ static bool skb_pp_recycle(struct sk_buff *skb, void *data, bool napi_safe)static void skb_kfree_head (void *head,unsigned int end_offset) { -if (end_offset ==SKB_SMALL_HEAD_HEADROOM ) -kmem_cache_free (skb_small_head_cache, head); -else -kfree (head); +kfree (head); }static void skb_free_head (struct sk_buff *skb,bool napi_safe)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 103/166 btrfs: merge btrfs_orig_bbio_end_io() into btrfs_bio_end_io()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
[ Upstream commit 9ca0e58cb752b09816f56f7a3147a39773d5e831 ]
There are only two differences between the two functions:
- btrfs_orig_bbio_end_io() does extra error propagation This is mostly to allow tolerance for write errors.
- btrfs_orig_bbio_end_io() does extra pending_ios check This check can handle both the original bio, or the cloned one. (All accounting happens in the original one).
This makes btrfs_orig_bbio_end_io() a much safer call. In fact we already had a double freeing error due to usage of btrfs_bio_end_io() in the error path of btrfs_submit_chunk().
So just move the whole content of btrfs_orig_bbio_end_io() into btrfs_bio_end_io().
For normal paths this brings no change, because they are already calling btrfs_orig_bbio_end_io() in the first place.
For error paths (not only inside bio.c but also external callers), this change will introduce extra checks, especially for external callers, as they will error out without submitting the btrfs bio.
But considering it's already in the error path, such slower but much safer checks are still an overall win.
--- fs/btrfs/bio.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-)
fs/btrfs/bio.c +11 -18
@@ -122,12 +122,6 @@ static void __btrfs_bio_end_io(struct btrfs_bio *bbio) } } -void btrfs_bio_end_io (struct btrfs_bio *bbio,blk_status_t status) -{ - bbio->bio.bi_status = status; -__btrfs_bio_end_io (bbio); -} -static void btrfs_orig_write_end_io (struct bio *bio); static void btrfs_bbio_propagate_error(struct btrfs_bio *bbio,
@@ -149,8 +143,9 @@ static void btrfs_bbio_propagate_error(struct btrfs_bio *bbio, } } -static void btrfs_orig_bbio_end_io (struct btrfs_bio *bbio) +void btrfs_bio_end_io (struct btrfs_bio *bbio,blk_status_t status) { + bbio->bio.bi_status = status;if (bbio->bio.bi_pool == &btrfs_clone_bioset) {struct btrfs_bio *orig_bbio = bbio->private;
@@ -181,7 +176,7 @@ static int prev_repair_mirror(struct btrfs_failed_bio *fbio, int cur_mirror)static void btrfs_repair_done (struct btrfs_failed_bio *fbio) {if (atomic_dec_and_test (&fbio->repair_count)) { -btrfs_orig_bbio_end_io (fbio->bbio); +btrfs_bio_end_io (fbio->bbio, fbio->bbio->bio.bi_status);mempool_free (fbio, &btrfs_failed_bio_pool); } }
@@ -322,7 +317,7 @@ static void btrfs_check_read_bio(struct btrfs_bio *bbio, struct btrfs_device *deif (fbio)btrfs_repair_done (fbio);else -btrfs_orig_bbio_end_io (bbio); +btrfs_bio_end_io (bbio, bbio->bio.bi_status); }static void btrfs_log_dev_io_error (struct bio *bio,struct btrfs_device *dev)
@@ -356,7 +351,7 @@ static void btrfs_end_bio_work(struct work_struct *work)if (is_data_bbio (bbio))btrfs_check_read_bio (bbio, bbio->bio.bi_private);else -btrfs_orig_bbio_end_io (bbio); +btrfs_bio_end_io (bbio, bbio->bio.bi_status); }static void btrfs_simple_end_io (struct bio *bio)
@@ -376,7 +371,7 @@ static void btrfs_simple_end_io(struct bio *bio) }else {if (bio_op (bio) ==REQ_OP_ZONE_APPEND && !bio->bi_status)btrfs_record_physical_zoned (bbio); -btrfs_orig_bbio_end_io (bbio); +btrfs_bio_end_io (bbio, bbio->bio.bi_status); } }
@@ -390,7 +385,7 @@ static void btrfs_raid56_end_io(struct bio *bio)if (bio_op (bio) ==REQ_OP_READ &&is_data_bbio (bbio))btrfs_check_read_bio (bbio,NULL );else -btrfs_orig_bbio_end_io (bbio); +btrfs_bio_end_io (bbio, bbio->bio.bi_status);btrfs_put_bioc (bioc); }
@@ -420,7 +415,7 @@ static void btrfs_orig_write_end_io(struct bio *bio)if (bio_op (bio) ==REQ_OP_ZONE_APPEND && !bio->bi_status) stripe->physical = bio->bi_iter.bi_sector <<SECTOR_SHIFT ; -btrfs_orig_bbio_end_io (bbio); +btrfs_bio_end_io (bbio, bbio->bio.bi_status);btrfs_put_bioc (bioc); }
@@ -586,7 +581,7 @@ static void run_one_async_done(struct btrfs_work *work)/* If an error occurred we just want to clean up the bio and move on. */ if (bio->bi_status) { -btrfs_orig_bbio_end_io (async->bbio); +btrfs_bio_end_io (async->bbio, async->bbio->bio.bi_status);return ; }
@@ -750,11 +745,9 @@ static bool btrfs_submit_chunk(struct btrfs_bio *bbio, int mirror_num)ASSERT (bbio->bio.bi_pool == &btrfs_clone_bioset);ASSERT (remaining); - remaining->bio.bi_status = ret; -btrfs_orig_bbio_end_io (remaining); +btrfs_bio_end_io (remaining, ret); } - bbio->bio.bi_status = ret; -btrfs_orig_bbio_end_io (bbio); +btrfs_bio_end_io (bbio, ret);/* Do not submit another chunk */ return true; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 104/166 iio: common: st_sensors: Fix use of uninitialize device structs
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maud Spierings <[email protected]>
[ Upstream commit 9f92e93e257b33e73622640a9205f8642ec16ddd ]
Throughout the various probe functions &indio_dev->dev is used before it is initialized. This caused a kernel panic in st_sensors_power_enable() when the call to devm_regulator_bulk_get_enable() fails and then calls dev_err_probe() with the uninitialized device.
This seems to only cause a panic with dev_err_probe(), dev_err(), dev_warn() and dev_info() don't seem to cause a panic, but are fixed as well.
The issue is reported and traced here: [1]
--- drivers/iio/accel/st_accel_core.c | 10 +++--- .../iio/common/st_sensors/st_sensors_core.c | 36 +++++++++---------- .../common/st_sensors/st_sensors_trigger.c | 20 +++++------ 3 files changed, 31 insertions(+), 35 deletions(-)
drivers/iio/accel/st_accel_core.c +5 -5
@@ -1342,6 +1342,7 @@ static int apply_acpi_orientation(struct iio_dev *indio_dev)union acpi_object *ont;union acpi_object *elements;acpi_status status; +struct device *parent = indio_dev->dev.parent;int ret = -EINVAL ;unsigned int val;int i, j;
@@ -1360,7 +1361,7 @@ static int apply_acpi_orientation(struct iio_dev *indio_dev) }; - adev =ACPI_COMPANION (indio_dev->dev.parent); + adev =ACPI_COMPANION (parent);if (!adev)return -ENXIO ;
@@ -1369,8 +1370,7 @@ static int apply_acpi_orientation(struct iio_dev *indio_dev)if (status ==AE_NOT_FOUND ) {return -ENXIO ; }else if (ACPI_FAILURE (status)) { -dev_warn (&indio_dev->dev,"failed to execute _ONT: %d\n" , - status); +dev_warn (parent,"failed to execute _ONT: %d\n" , status);return status; }
@@ -1446,12 +1446,12 @@ static int apply_acpi_orientation(struct iio_dev *indio_dev) } ret =0 ; -dev_info (&indio_dev->dev,"computed mount matrix from ACPI\n" ); +dev_info (parent,"computed mount matrix from ACPI\n" ); out:kfree (buffer.pointer);if (ret) -dev_dbg (&indio_dev->dev, +dev_dbg (parent,"failed to apply ACPI orientation data: %d\n" , ret);return ret;
drivers/iio/common/st_sensors/st_sensors_core.c +17 -19
@@ -154,7 +154,7 @@ static int st_sensors_set_fullscale(struct iio_dev *indio_dev, unsigned int fs)return err; st_accel_set_fullscale_error: -dev_err (&indio_dev->dev,"failed to set new fullscale.\n" ); +dev_err (indio_dev->dev.parent,"failed to set new fullscale.\n" );return err; }
@@ -231,8 +231,7 @@ int st_sensors_power_enable(struct iio_dev *indio_dev)ARRAY_SIZE (regulator_names), regulator_names);if (err) -return dev_err_probe (&indio_dev->dev, err, -"unable to enable supplies\n" ); +return dev_err_probe (parent, err,"unable to enable supplies\n" );return 0 ; }
@@ -241,13 +240,14 @@ EXPORT_SYMBOL_NS(st_sensors_power_enable, IIO_ST_SENSORS);static int st_sensors_set_drdy_int_pin (struct iio_dev *indio_dev,struct st_sensors_platform_data *pdata) { +struct device *parent = indio_dev->dev.parent;struct st_sensor_data *sdata =iio_priv (indio_dev);/* Sensor does not support interrupts */ if (!sdata->sensor_settings->drdy_irq.int1.addr && !sdata->sensor_settings->drdy_irq.int2.addr) {if (pdata->drdy_int_pin) -dev_info (&indio_dev->dev, +dev_info (parent,"DRDY on pin INT%d specified, but sensor does not support interrupts\n" , pdata->drdy_int_pin);return 0 ;
@@ -256,29 +256,27 @@ static int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,switch (pdata->drdy_int_pin) {case 1 :if (!sdata->sensor_settings->drdy_irq.int1.mask) { -dev_err (&indio_dev->dev, -"DRDY on INT1 not available.\n" ); +dev_err (parent,"DRDY on INT1 not available.\n" );return -EINVAL ; } sdata->drdy_int_pin =1 ;break ;case 2 :if (!sdata->sensor_settings->drdy_irq.int2.mask) { -dev_err (&indio_dev->dev, -"DRDY on INT2 not available.\n" ); +dev_err (parent,"DRDY on INT2 not available.\n" );return -EINVAL ; } sdata->drdy_int_pin =2 ;break ;default : -dev_err (&indio_dev->dev,"DRDY on pdata not valid.\n" ); +dev_err (parent,"DRDY on pdata not valid.\n" );return -EINVAL ; }if (pdata->open_drain) {if (!sdata->sensor_settings->drdy_irq.int1.addr_od && !sdata->sensor_settings->drdy_irq.int2.addr_od) -dev_err (&indio_dev->dev, +dev_err (parent,"open drain requested but unsupported.\n" );else sdata->int_pin_open_drain = true;
@@ -336,6 +334,7 @@ EXPORT_SYMBOL_NS(st_sensors_dev_name_probe, IIO_ST_SENSORS);int st_sensors_init_sensor (struct iio_dev *indio_dev,struct st_sensors_platform_data *pdata) { +struct device *parent = indio_dev->dev.parent;struct st_sensor_data *sdata =iio_priv (indio_dev);struct st_sensors_platform_data *of_pdata;int err =0 ;
@@ -343,7 +342,7 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,mutex_init (&sdata->odr_lock);/* If OF/DT pdata exists, it will take precedence of anything else */ - of_pdata =st_sensors_dev_probe (indio_dev->dev.parent, pdata); + of_pdata =st_sensors_dev_probe (parent, pdata);if (IS_ERR (of_pdata))return PTR_ERR (of_pdata);if (of_pdata)
@@ -370,7 +369,7 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,if (err <0 )return err; }else -dev_info (&indio_dev->dev,"Full-scale not possible\n" ); +dev_info (parent,"Full-scale not possible\n" ); err =st_sensors_set_odr (indio_dev, sdata->odr);if (err <0 )
@@ -405,7 +404,7 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev, mask = sdata->sensor_settings->drdy_irq.int2.mask_od; } -dev_info (&indio_dev->dev, +dev_info (parent,"set interrupt line to open drain mode on pin %d\n" , sdata->drdy_int_pin); err = st_sensors_write_data_with_mask(indio_dev, addr,
@@ -594,21 +593,20 @@ EXPORT_SYMBOL_NS(st_sensors_get_settings_index, IIO_ST_SENSORS);int st_sensors_verify_id (struct iio_dev *indio_dev) {struct st_sensor_data *sdata =iio_priv (indio_dev); +struct device *parent = indio_dev->dev.parent;int wai, err;if (sdata->sensor_settings->wai_addr) { err =regmap_read (sdata->regmap, sdata->sensor_settings->wai_addr, &wai);if (err <0 ) { -dev_err (&indio_dev->dev, -"failed to read Who-Am-I register.\n" ); -return err; +return dev_err_probe (parent, err, +"failed to read Who-Am-I register.\n" ); }if (sdata->sensor_settings->wai != wai) { -dev_err (&indio_dev->dev, -"%s: WhoAmI mismatch (0x%x).\n" , - indio_dev->name, wai); +dev_warn (parent,"%s: WhoAmI mismatch (0x%x).\n" , + indio_dev->name, wai);return -EINVAL ; } }
drivers/iio/common/st_sensors/st_sensors_trigger.c +9 -11
@@ -127,7 +127,7 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev, sdata->trig =devm_iio_trigger_alloc (parent,"%s-trigger" , indio_dev->name);if (sdata->trig ==NULL ) { -dev_err (&indio_dev->dev,"failed to allocate iio trigger.\n" ); +dev_err (parent,"failed to allocate iio trigger.\n" );return -ENOMEM ; }
@@ -143,7 +143,7 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev,case IRQF_TRIGGER_FALLING :case IRQF_TRIGGER_LOW :if (!sdata->sensor_settings->drdy_irq.addr_ihl) { -dev_err (&indio_dev->dev, +dev_err (parent,"falling/low specified for IRQ but hardware supports only rising/high: will request rising/high\n" );if (irq_trig ==IRQF_TRIGGER_FALLING ) irq_trig =IRQF_TRIGGER_RISING ;
@@ -156,21 +156,19 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev, sdata->sensor_settings->drdy_irq.mask_ihl, 1);if (err <0 )return err; -dev_info (&indio_dev->dev, +dev_info (parent,"interrupts on the falling edge or active low level\n" ); }break ;case IRQF_TRIGGER_RISING : -dev_info (&indio_dev->dev, -"interrupts on the rising edge\n" ); +dev_info (parent,"interrupts on the rising edge\n" );break ;case IRQF_TRIGGER_HIGH : -dev_info (&indio_dev->dev, -"interrupts active high level\n" ); +dev_info (parent,"interrupts active high level\n" );break ;default :/* This is the most preferred mode, if possible */ -dev_err (&indio_dev->dev, +dev_err (parent,"unsupported IRQ trigger specified (%lx), enforce rising edge\n" , irq_trig); irq_trig =IRQF_TRIGGER_RISING ; }
@@ -179,7 +177,7 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev,if (irq_trig ==IRQF_TRIGGER_FALLING || irq_trig ==IRQF_TRIGGER_RISING ) {if (!sdata->sensor_settings->drdy_irq.stat_drdy.addr) { -dev_err (&indio_dev->dev, +dev_err (parent,"edge IRQ not supported w/o stat register.\n" );return -EOPNOTSUPP ; }
@@ -214,13 +212,13 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev, sdata->trig->name, sdata->trig);if (err) { -dev_err (&indio_dev->dev,"failed to request trigger IRQ.\n" ); +dev_err (parent,"failed to request trigger IRQ.\n" );return err; } err =devm_iio_trigger_register (parent, sdata->trig);if (err <0 ) { -dev_err (&indio_dev->dev,"failed to register iio trigger.\n" ); +dev_err (parent,"failed to register iio trigger.\n" );return err; } indio_dev->trig =iio_trigger_get (sdata->trig);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 105/166 net: add proper RCU protection to /proc/net/ptype
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit f613e8b4afea0cd17c7168e8b00e25bc8d33175d ]
Yin Fengwei reported an RCU stall in ptype_seq_show() and provided a patch.
Real issue is that ptype_seq_next() and ptype_seq_show() violate RCU rules.
ptype_seq_show() runs under rcu_read_lock(), and reads pt->dev to get device name without any barrier.
At the same time, concurrent writers can remove a packet_type structure (which is correctly freed after an RCU grace period) and clear pt->dev without an RCU grace period.
Define ptype_iter_state to carry a dev pointer along seq_net_private:
struct ptype_iter_state {
struct seq_net_private p;
struct net_device *dev; // added in this patch
};We need to record the device pointer in ptype_get_idx() and ptype_seq_next() so that ptype_seq_show() is safe against concurrent pt->dev changes.
We also need to add full RCU protection in ptype_seq_next(). (Missing READ_ONCE() when reading list.next values)
Many thanks to Dong Chenchen for providing a repro.
--- net/core/net-procfs.c | 49 +++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 16 deletions(-)
net/core/net-procfs.c +33 -16
@@ -200,8 +200,14 @@ static const struct seq_operations softnet_seq_ops = { .show = softnet_seq_show, }; +struct ptype_iter_state { +struct seq_net_private p; +struct net_device *dev; +}; +static void *ptype_get_idx (struct seq_file *seq,loff_t pos) { +struct ptype_iter_state *iter = seq->private;struct list_head *ptype_list =NULL ;struct packet_type *pt =NULL ;struct net_device *dev;
@@ -211,12 +217,16 @@ static void *ptype_get_idx(struct seq_file *seq, loff_t pos)for_each_netdev_rcu (seq_file_net (seq), dev) { ptype_list = &dev->ptype_all;list_for_each_entry_rcu (pt, ptype_list, list) { -if (i == pos) +if (i == pos) { + iter->dev = dev;return pt; + } ++i; } } + iter->dev =NULL ; +list_for_each_entry_rcu (pt, &ptype_all, list) {if (i == pos)return pt;
@@ -242,6 +252,7 @@ static void *ptype_seq_start(struct seq_file *seq, loff_t *pos)static void *ptype_seq_next (struct seq_file *seq,void *v,loff_t *pos) { +struct ptype_iter_state *iter = seq->private;struct net_device *dev;struct packet_type *pt;struct list_head *nxt;
@@ -252,20 +263,21 @@ static void *ptype_seq_next(struct seq_file *seq, void *v, loff_t *pos)return ptype_get_idx (seq,0 ); pt = v; - nxt = pt->list.next; -if (pt->dev) { -if (nxt != &pt->dev->ptype_all) + nxt =READ_ONCE (pt->list.next); + dev = iter->dev; +if (dev) { +if (nxt != &dev->ptype_all) goto found; - dev = pt->dev;for_each_netdev_continue_rcu (seq_file_net (seq), dev) { -if (!list_empty (&dev->ptype_all)) { - nxt = dev->ptype_all.next; + nxt =READ_ONCE (dev->ptype_all.next); +if (nxt != &dev->ptype_all) { + iter->dev = dev; goto found; } } - - nxt = ptype_all.next; + iter->dev =NULL ; + nxt =READ_ONCE (ptype_all.next); goto ptype_all; }
@@ -274,14 +286,14 @@ static void *ptype_seq_next(struct seq_file *seq, void *v, loff_t *pos)if (nxt != &ptype_all) goto found; hash =0 ; - nxt = ptype_base[0 ].next; + nxt =READ_ONCE (ptype_base[0 ].next); }else hash =ntohs (pt->type) &PTYPE_HASH_MASK ;while (nxt == &ptype_base[hash]) {if (++hash >=PTYPE_HASH_SIZE )return NULL ; - nxt = ptype_base[hash].next; + nxt =READ_ONCE (ptype_base[hash].next); } found: return list_entry(nxt, struct packet_type, list);
@@ -295,19 +307,24 @@ static void ptype_seq_stop(struct seq_file *seq, void *v)static int ptype_seq_show (struct seq_file *seq,void *v) { +struct ptype_iter_state *iter = seq->private;struct packet_type *pt = v; +struct net_device *dev; -if (v ==SEQ_START_TOKEN ) +if (v ==SEQ_START_TOKEN ) {seq_puts (seq,"Type Device Function\n" ); -else if ((!pt->af_packet_net ||net_eq (pt->af_packet_net,seq_file_net (seq))) && - (!pt->dev ||net_eq (dev_net (pt->dev),seq_file_net (seq)))) { +return 0 ; + } + dev = iter->dev; +if ((!pt->af_packet_net ||net_eq (pt->af_packet_net,seq_file_net (seq))) && + (!dev ||net_eq (dev_net (dev),seq_file_net (seq)))) {if (pt->type ==htons (ETH_P_ALL ))seq_puts (seq,"ALL " );else seq_printf (seq,"%04x" ,ntohs (pt->type));seq_printf (seq," %-8s %ps\n" , - pt->dev ? pt->dev->name :"" , pt->func); + dev ? dev->name :"" , pt->func); }return 0 ;
@@ -331,7 +348,7 @@ static int __net_init dev_proc_net_init(struct net *net) &softnet_seq_ops)) goto out_dev;if (!proc_create_net ("ptype" ,0444 , net->proc_net, &ptype_seq_ops, -sizeof (struct seq_net_private ))) +sizeof (struct ptype_iter_state ))) goto out_softnet;if (wext_proc_init (net))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 106/166 KVM: nVMX: Fold requested virtual interrupt check into has_nested_events()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
[ Upstream commit 321ef62b0c5f6f57bb8500a2ca5986052675abbf ]
Check for a Requested Virtual Interrupt, i.e. a virtual interrupt that is pending delivery, in vmx_has_nested_events() and drop the one-off kvm_x86_ops.guest_apic_has_interrupt() hook.
In addition to dropping a superfluous hook, this fixes a bug where KVM would incorrectly treat virtual interrupts _for L2_ as always enabled due to kvm_arch_interrupt_allowed(), by way of vmx_interrupt_blocked(), treating IRQs as enabled if L2 is active and vmcs12 is configured to exit on IRQs, i.e. KVM would treat a virtual interrupt for L2 as a valid wake event based on L1's IRQ blocking status.
--- arch/x86/include/asm/kvm-x86-ops.h | 1 - arch/x86/include/asm/kvm_host.h | 1 - arch/x86/kvm/vmx/nested.c | 4 ++++ arch/x86/kvm/vmx/vmx.c | 21 --------------------- arch/x86/kvm/x86.c | 10 +--------- 5 files changed, 5 insertions(+), 32 deletions(-)
arch/x86/include/asm/kvm-x86-ops.h +0 -1
@@ -83,7 +83,6 @@ KVM_X86_OP_OPTIONAL(update_cr8_intercept) KVM_X86_OP(refresh_apicv_exec_ctrl) KVM_X86_OP_OPTIONAL(hwapic_irr_update) KVM_X86_OP_OPTIONAL(hwapic_isr_update) -KVM_X86_OP_OPTIONAL_RET0(guest_apic_has_interrupt) KVM_X86_OP_OPTIONAL(load_eoi_exitmap) KVM_X86_OP_OPTIONAL(set_virtual_apic_mode) KVM_X86_OP_OPTIONAL(set_apic_access_page_addr)
arch/x86/include/asm/kvm_host.h +0 -1
@@ -1671,7 +1671,6 @@ struct kvm_x86_ops {void (*refresh_apicv_exec_ctrl)(struct kvm_vcpu *vcpu);void (*hwapic_irr_update)(struct kvm_vcpu *vcpu,int max_irr);void (*hwapic_isr_update)(struct kvm_vcpu *vcpu,int isr); -bool (*guest_apic_has_interrupt)(struct kvm_vcpu *vcpu);void (*load_eoi_exitmap)(struct kvm_vcpu *vcpu,u64 *eoi_exit_bitmap);void (*set_virtual_apic_mode)(struct kvm_vcpu *vcpu);void (*set_apic_access_page_addr)(struct kvm_vcpu *vcpu);
arch/x86/kvm/vmx/nested.c +4 -0
@@ -4007,6 +4007,10 @@ static bool vmx_has_nested_events(struct kvm_vcpu *vcpu, bool for_injection) vppr = *((u32 *)(vapic +APIC_PROCPRI )); + max_irr =vmx_get_rvi (); +if ((max_irr &0xf0 ) > (vppr &0xf0 )) +return true; +if (vmx->nested.pi_pending && vmx->nested.pi_desc &&pi_test_on (vmx->nested.pi_desc)) { max_irr =pi_find_highest_vector (vmx->nested.pi_desc);
arch/x86/kvm/vmx/vmx.c +0 -21
@@ -4127,26 +4127,6 @@ void pt_update_intercept_for_msr(struct kvm_vcpu *vcpu) } } -static bool vmx_guest_apic_has_interrupt (struct kvm_vcpu *vcpu) -{ -struct vcpu_vmx *vmx =to_vmx (vcpu); -void *vapic_page; -u32 vppr; -int rvi; - -if (WARN_ON_ONCE (!is_guest_mode (vcpu)) || - !nested_cpu_has_vid (get_vmcs12 (vcpu)) || -WARN_ON_ONCE (!vmx->nested.virtual_apic_map.gfn)) -return false; - - rvi =vmx_get_rvi (); - - vapic_page = vmx->nested.virtual_apic_map.hva; - vppr = *((u32 *)(vapic_page +APIC_PROCPRI )); - -return ((rvi &0xf0 ) > (vppr &0xf0 )); -} -static void vmx_msr_filter_changed (struct kvm_vcpu *vcpu) {struct vcpu_vmx *vmx =to_vmx (vcpu);
@@ -8390,7 +8370,6 @@ static struct kvm_x86_ops vmx_x86_ops __initdata = { .required_apicv_inhibits = VMX_REQUIRED_APICV_INHIBITS, .hwapic_irr_update = vmx_hwapic_irr_update, .hwapic_isr_update = vmx_hwapic_isr_update, - .guest_apic_has_interrupt = vmx_guest_apic_has_interrupt, .sync_pir_to_irr = vmx_sync_pir_to_irr, .deliver_interrupt = vmx_deliver_interrupt, .dy_apicv_has_pending_interrupt = pi_has_pending_interrupt,
arch/x86/kvm/x86.c +1 -9
@@ -12906,12 +12906,6 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,kvm_arch_free_memslot (kvm, old); } -static inline bool kvm_guest_apic_has_interrupt (struct kvm_vcpu *vcpu) -{ -return (is_guest_mode (vcpu) && -static_call (kvm_x86_guest_apic_has_interrupt)(vcpu)); -} -static inline bool kvm_vcpu_has_events (struct kvm_vcpu *vcpu) {if (!list_empty_careful (&vcpu->async_pf.done))
@@ -12942,9 +12936,7 @@ static inline bool kvm_vcpu_has_events(struct kvm_vcpu *vcpu)if (kvm_test_request (KVM_REQ_PMI , vcpu))return true; -if (kvm_arch_interrupt_allowed (vcpu) && - (kvm_cpu_has_interrupt (vcpu) || -kvm_guest_apic_has_interrupt (vcpu))) +if (kvm_arch_interrupt_allowed (vcpu) &&kvm_cpu_has_interrupt (vcpu))return true;if (kvm_hv_has_stimer_pending (vcpu))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 107/166 net: sched: fix TCF_LAYER_TRANSPORT handling in tcf_get_base_ptr()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[Upstream commit 4fe5a00ec70717a7f1002d8913ec6143582b3c8e]
syzbot reported that tcf_get_base_ptr() can be called while transport header is not set [1].
Instead of returning a dangling pointer, return NULL.
Fix tcf_get_base_ptr() callers to handle this NULL value.
[1]
WARNING: CPU: 1 PID: 6019 at ./include/linux/skbuff.h:3071 skb_transport_header include/linux/skbuff.h:3071 [inline] WARNING: CPU: 1 PID: 6019 at ./include/linux/skbuff.h:3071 tcf_get_base_ptr include/net/pkt_cls.h:539 [inline] WARNING: CPU: 1 PID: 6019 at ./include/linux/skbuff.h:3071 em_nbyte_match+0x2d8/0x3f0 net/sched/em_nbyte.c:43 Modules linked in: CPU: 1 UID: 0 PID: 6019 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full) Call Trace: <TASK> tcf_em_match net/sched/ematch.c:494 [inline] __tcf_em_tree_match+0x1ac/0x770 net/sched/ematch.c:520 tcf_em_tree_match include/net/pkt_cls.h:512 [inline] basic_classify+0x115/0x2d0 net/sched/cls_basic.c:50 tc_classify include/net/tc_wrapper.h:197 [inline] __tcf_classify net/sched/cls_api.c:1764 [inline] tcf_classify+0x4cf/0x1140 net/sched/cls_api.c:1860 multiq_classify net/sched/sch_multiq.c:39 [inline] multiq_enqueue+0xfd/0x4c0 net/sched/sch_multiq.c:66 dev_qdisc_enqueue+0x4e/0x260 net/core/dev.c:4118 __dev_xmit_skb net/core/dev.c:4214 [inline] __dev_queue_xmit+0xe83/0x3b50 net/core/dev.c:4729 packet_snd net/packet/af_packet.c:3076 [inline] packet_sendmsg+0x3e33/0x5080 net/packet/af_packet.c:3108 sock_sendmsg_nosec net/socket.c:727 [inline] __sock_sendmsg+0x21c/0x270 net/socket.c:742 ____sys_sendmsg+0x505/0x830 net/socket.c:2630
--- include/net/pkt_cls.h | 2 ++ net/sched/em_cmp.c | 5 ++++- net/sched/em_nbyte.c | 2 ++ net/sched/em_text.c | 11 +++++++++-- 4 files changed, 17 insertions(+), 3 deletions(-)
include/net/pkt_cls.h +2 -0
@@ -525,6 +525,8 @@ static inline unsigned char * tcf_get_base_ptr(struct sk_buff *skb, int layer)case TCF_LAYER_NETWORK :return skb_network_header (skb);case TCF_LAYER_TRANSPORT : +if (!skb_transport_header_was_set (skb)) +break ;return skb_transport_header (skb); }
net/sched/em_cmp.c +4 -1
@@ -22,9 +22,12 @@ static int em_cmp_match(struct sk_buff *skb, struct tcf_ematch *em, struct tcf_pkt_info *info) {struct tcf_em_cmp *cmp = (struct tcf_em_cmp *) em->data; -unsigned char *ptr =tcf_get_base_ptr (skb, cmp->layer) + cmp->off; +unsigned char *ptr =tcf_get_base_ptr (skb, cmp->layer);u32 val =0 ; +if (!ptr) +return 0 ; + ptr += cmp->off;if (!tcf_valid_offset (skb, ptr, cmp->align))return 0 ;
net/sched/em_nbyte.c +2 -0
@@ -42,6 +42,8 @@ static int em_nbyte_match(struct sk_buff *skb, struct tcf_ematch *em,struct nbyte_data *nbyte = (struct nbyte_data *) em->data;unsigned char *ptr =tcf_get_base_ptr (skb, nbyte->hdr.layer); +if (!ptr) +return 0 ; ptr += nbyte->hdr.off;if (!tcf_valid_offset (skb, ptr, nbyte->hdr.len))
net/sched/em_text.c +9 -2
@@ -29,12 +29,19 @@ static int em_text_match(struct sk_buff *skb, struct tcf_ematch *m, struct tcf_pkt_info *info) {struct text_match *tm =EM_TEXT_PRIV (m); +unsigned char *ptr;int from, to; - from =tcf_get_base_ptr (skb, tm->from_layer) - skb->data; + ptr =tcf_get_base_ptr (skb, tm->from_layer); +if (!ptr) +return 0 ; + from = ptr - skb->data; from += tm->from_offset; - to =tcf_get_base_ptr (skb, tm->to_layer) - skb->data; + ptr =tcf_get_base_ptr (skb, tm->to_layer); +if (!ptr) +return 0 ; + to = ptr - skb->data; to += tm->to_offset;return skb_find_text (skb, from, to, tm->config) !=UINT_MAX ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 108/166 nfc: nci: complete pending data exchange on device close
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 66083581945bd5b8e99fe49b5aeb83d03f62d053 ]
In nci_close_device(), complete any pending data exchange before closing. The data exchange callback (e.g. rawsock_data_exchange_complete) holds a socket reference.
NIPA occasionally hits this leak:
unreferenced object 0xff1100000f435000 (size 2048):
comm "nci_dev", pid 3954, jiffies 4295441245 hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
27 00 01 40 00 00 00 00 00 00 00 00 00 00 00 00 '..@............
backtrace (crc ec2b3c5):
__kmalloc_noprof+0x4db/0x730
sk_prot_alloc.isra.0+0xe4/0x1d0
sk_alloc+0x36/0x760
rawsock_create+0xd1/0x540
nfc_sock_create+0x11f/0x280
__sock_create+0x22d/0x630
__sys_socket+0x115/0x1d0
__x64_sys_socket+0x72/0xd0
do_syscall_64+0x117/0xfc0
entry_SYSCALL_64_after_hwframe+0x4b/0x53--- net/nfc/nci/core.c | 9 +++++++++ 1 file changed, 9 insertions(+)
net/nfc/nci/core.c +9 -0
@@ -567,6 +567,10 @@ static int nci_close_device(struct nci_dev *ndev)flush_workqueue (ndev->cmd_wq);del_timer_sync (&ndev->cmd_timer);del_timer_sync (&ndev->data_timer); +if (test_bit (NCI_DATA_EXCHANGE , &ndev->flags)) +nci_data_exchange_complete (ndev,NULL , + ndev->cur_conn_id, + -ENODEV );mutex_unlock (&ndev->req_lock);return 0 ; }
@@ -597,6 +601,11 @@ static int nci_close_device(struct nci_dev *ndev)flush_workqueue (ndev->cmd_wq);del_timer_sync (&ndev->cmd_timer); +del_timer_sync (&ndev->data_timer); + +if (test_bit (NCI_DATA_EXCHANGE , &ndev->flags)) +nci_data_exchange_complete (ndev,NULL , ndev->cur_conn_id, + -ENODEV );/* Clear flags except NCI_UNREG */ ndev->flags &=BIT (NCI_UNREG );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 109/166 blktrace: fix __this_cpu_read/write in preemptible context
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chaitanya Kulkarni <[email protected]>
[ Upstream commit da46b5dfef48658d03347cda21532bcdbb521e67 ]
tracing_record_cmdline() internally uses __this_cpu_read() and __this_cpu_write() on the per-CPU variable trace_cmdline_save, and trace_save_cmdline() explicitly asserts preemption is disabled via lockdep_assert_preemption_disabled(). These operations are only safe when preemption is off, as they were designed to be called from the scheduler context (probe_wakeup_sched_switch() / probe_wakeup()).
__blk_add_trace() was calling tracing_record_cmdline(current) early in the blk_tracer path, before ring buffer reservation, from process context where preemption is fully enabled. This triggers the following using blktests/blktrace/002:
blktrace/002 (blktrace ftrace corruption with sysfs trace) [failed]
runtime 0.367s ... 0.437s
something found in dmesg:
[ 81.211018] run blktests blktrace/002 at 2026-02-25 22:24:33
[ 81.239580] null_blk: disk nullb1 created
[ 81.357294] BUG: using __this_cpu_read() in preemptible [00000000] code: dd/2516
[ 81.362842] caller is tracing_record_cmdline+0x10/0x40
[ 81.362872] CPU: 16 UID: 0 PID: 2516 Comm: dd Tainted: G N 7.0.0-rc1lblk+ #84 PREEMPT(full)
[ 81.362877] Tainted: [N]=TEST
[ 81.362878] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.17.0-0-gb52ca86e094d-prebuilt.qemu.org 04/01/2014
[ 81.362881] Call Trace:
[ 81.362884] <TASK>
[ 81.362886] dump_stack_lvl+0x8d/0xb0
...
(See '/mnt/sda/blktests/results/nodev/blktrace/002.dmesg' for the entire message)[ 81.211018] run blktests blktrace/002 at 2026-02-25 22:24:33 [ 81.239580] null_blk: disk nullb1 created [ 81.357294] BUG: using __this_cpu_read() in preemptible [00000000] code: dd/2516 [ 81.362842] caller is tracing_record_cmdline+0x10/0x40 [ 81.362872] CPU: 16 UID: 0 PID: 2516 Comm: dd Tainted: G N 7.0.0-rc1lblk+ #84 PREEMPT(full) [ 81.362877] Tainted: [N]=TEST [ 81.362878] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.17.0-0-gb52ca86e094d-prebuilt.qemu.org 04/01/2014 [ 81.362881] Call Trace: [ 81.362884] <TASK> [ 81.362886] dump_stack_lvl+0x8d/0xb0 [ 81.362895] check_preemption_disabled+0xce/0xe0 [ 81.362902] tracing_record_cmdline+0x10/0x40 [ 81.362923] __blk_add_trace+0x307/0x5d0 [ 81.362934] ? lock_acquire+0xe0/0x300 [ 81.362940] ? iov_iter_extract_pages+0x101/0xa30 [ 81.362959] blk_add_trace_bio+0x106/0x1e0 [ 81.362968] submit_bio_noacct_nocheck+0x24b/0x3a0 [ 81.362979] ? lockdep_init_map_type+0x58/0x260 [ 81.362988] submit_bio_wait+0x56/0x90 [ 81.363009] __blkdev_direct_IO_simple+0x16c/0x250 [ 81.363026] ? __pfx_submit_bio_wait_endio+0x10/0x10 [ 81.363038] ? rcu_read_lock_any_held+0x73/0xa0 [ 81.363051] blkdev_read_iter+0xc1/0x140 [ 81.363059] vfs_read+0x20b/0x330 [ 81.363083] ksys_read+0x67/0xe0 [ 81.363090] do_syscall_64+0xbf/0xf00 [ 81.363102] entry_SYSCALL_64_after_hwframe+0x76/0x7e [ 81.363106] RIP: 0033:0x7f281906029d [ 81.363111] Code: 31 c0 e9 c6 fe ff ff 50 48 8d 3d 66 63 0a 00 e8 59 ff 01 00 66 0f 1f 84 00 00 00 00 00 80 3d 41 33 0e 00 00 74 17 31 c0 0f 05 <48> 3d 00 f0 ff ff 77 5b c3 66 2e 0f 1f 84 00 00 00 00 00 48 83 ec [ 81.363113] RSP: 002b:00007ffca127dd48 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 [ 81.363120] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f281906029d [ 81.363122] RDX: 0000000000001000 RSI: 0000559f8bfae000 RDI: 0000000000000000 [ 81.363123] RBP: 0000000000001000 R08: 0000002863a10a81 R09: 00007f281915f000 [ 81.363124] R10: 00007f2818f77b60 R11: 0000000000000246 R12: 0000559f8bfae000 [ 81.363126] R13: 0000000000000000 R14: 0000000000000000 R15: 000000000000000a [ 81.363142] </TASK>
The same BUG fires from blk_add_trace_plug(), blk_add_trace_unplug(), and blk_add_trace_rq() paths as well.
The purpose of tracing_record_cmdline() is to cache the task->comm for a given PID so that the trace can later resolve it. It is only meaningful when a trace event is actually being recorded. Ring buffer reservation via ring_buffer_lock_reserve() disables preemption, and preemption remains disabled until the event is committed :-
__blk_add_trace()
__trace_buffer_lock_reserve()
__trace_buffer_lock_reserve()
ring_buffer_lock_reserve()
preempt_disable_notrace(); <---With this fix blktests for blktrace pass:
blktests (master) # ./check blktrace
blktrace/001 (blktrace zone management command tracing) [passed]
runtime 3.650s ... 3.647s
blktrace/002 (blktrace ftrace corruption with sysfs trace) [passed]
runtime 0.411s ... 0.384s--- kernel/trace/blktrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/blktrace.c +2 -2
@@ -251,8 +251,6 @@ static void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes, cpu =raw_smp_processor_id ();if (blk_tracer) { -tracing_record_cmdline (current); - buffer = blk_tr->array_buffer.buffer; trace_ctx =tracing_gen_ctx_flags (0 ); event = trace_buffer_lock_reserve(buffer, TRACE_BLK,
@@ -260,6 +258,8 @@ static void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes, trace_ctx);if (!event)return ; + +tracing_record_cmdline (current); t =ring_buffer_event_data (event); goto record_it; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 110/166 nf_tables: nft_dynset: fix possible stateful expression memleak in error path
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 0548a13b5a145b16e4da0628b5936baf35f51b43 ]
If cloning the second stateful expression in the element via GFP_ATOMIC fails, then the first stateful expression remains in place without being released.
unreferenced object (percpu) 0x607b97e9cab8 (size 16):
comm "softirq", pid 0, jiffies 4294931867 hex dump (first 16 bytes on cpu 3):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 backtrace (crc 0):
pcpu_alloc_noprof+0x453/0xd80 nft_counter_clone+0x9c/0x190 [nf_tables] nft_expr_clone+0x8f/0x1b0 [nf_tables] nft_dynset_new+0x2cb/0x5f0 [nf_tables] nft_rhash_update+0x236/0x11c0 [nf_tables] nft_dynset_eval+0x11f/0x670 [nf_tables] nft_do_chain+0x253/0x1700 [nf_tables] nft_do_chain_ipv4+0x18d/0x270 [nf_tables] nf_hook_slow+0xaa/0x1e0 ip_local_deliver+0x209/0x330
--- include/net/netfilter/nf_tables.h | 2 ++ net/netfilter/nf_tables_api.c | 4 ++-- net/netfilter/nft_dynset.c | 10 +++++++++- 3 files changed, 13 insertions(+), 3 deletions(-)
include/net/netfilter/nf_tables.h +2 -0
@@ -861,6 +861,8 @@ void *nft_set_elem_init(const struct nft_set *set, u64 timeout, u64 expiration, gfp_t gfp);int nft_set_elem_expr_clone (const struct nft_ctx *ctx,struct nft_set *set,struct nft_expr *expr_array[]); +void nft_set_elem_expr_destroy (const struct nft_ctx *ctx, +struct nft_set_elem_expr *elem_expr);void nft_set_elem_destroy (const struct nft_set *set,void *elem,bool destroy_expr); void nf_tables_set_elem_destroy(const struct nft_ctx *ctx,
net/netfilter/nf_tables_api.c +2 -2
@@ -6464,8 +6464,8 @@ static void __nft_set_elem_expr_destroy(const struct nft_ctx *ctx, } } -static void nft_set_elem_expr_destroy (const struct nft_ctx *ctx, -struct nft_set_elem_expr *elem_expr) +void nft_set_elem_expr_destroy (const struct nft_ctx *ctx, +struct nft_set_elem_expr *elem_expr) {struct nft_expr *expr;u32 size;
net/netfilter/nft_dynset.c +9 -1
@@ -30,18 +30,26 @@ static int nft_dynset_expr_setup(const struct nft_dynset *priv, const struct nft_set_ext *ext) {struct nft_set_elem_expr *elem_expr =nft_set_ext_expr (ext); +struct nft_ctx ctx = { + .net =read_pnet (&priv->set->net), + .family = priv->set->table->family, + };struct nft_expr *expr;int i;for (i =0 ; i < priv->num_exprs; i++) { expr =nft_setelem_expr_at (elem_expr, elem_expr->size);if (nft_expr_clone (expr, priv->expr_array[i],GFP_ATOMIC ) <0 ) -return -1 ; + goto err_out; elem_expr->size += priv->expr_array[i]->ops->size; }return 0 ; +err_out: +nft_set_elem_expr_destroy (&ctx, elem_expr); + +return -1 ; } static void *nft_dynset_new(struct nft_set *set, const struct nft_expr *expr,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 111/166 ice: Fix memory leak in ice_set_ringparam()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zilin Guan <[email protected]>
[ Upstream commit fe868b499d16f55bbeea89992edb98043c9de416 ]
In ice_set_ringparam, tx_rings and xdp_rings are allocated before rx_rings. If the allocation of rx_rings fails, the code jumps to the done label leaking both tx_rings and xdp_rings. Furthermore, if the setup of an individual Rx ring fails during the loop, the code jumps to the free_tx label which releases tx_rings but leaks xdp_rings.
Fix this by introducing a free_xdp label and updating the error paths to ensure both xdp_rings and tx_rings are properly freed if rx_rings allocation or setup fails.
Compile tested only. Issue found using a prototype static analysis tool and code review.
--- drivers/net/ethernet/intel/ice/ice_ethtool.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_ethtool.c +9 -2
@@ -2847,7 +2847,7 @@ ice_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring, rx_rings =kcalloc (vsi->num_rxq,sizeof (*rx_rings),GFP_KERNEL );if (!rx_rings) { err = -ENOMEM ; - goto done; + goto free_xdp; }ice_for_each_rxq (vsi, i) {
@@ -2877,7 +2877,7 @@ ice_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring, }kfree (rx_rings); err = -ENOMEM ; - goto free_tx; + goto free_xdp; } }
@@ -2928,6 +2928,13 @@ ice_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring, } goto done; +free_xdp: +if (xdp_rings) { +ice_for_each_xdp_txq (vsi, i) +ice_free_tx_ring (&xdp_rings[i]); +kfree (xdp_rings); + } + free_tx:/* error cleanup if the Rx allocations failed after getting Tx */ if (tx_rings) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 85/166 usbip: validate number_of_packets in usbip_pack_ret_submit()
In reply to Greg Kroah-Hartman6.6-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
@@ -470,6 +470,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 112/166 checkpatch: add support for Assisted-by tag
In reply to Greg Kroah-Hartman6.6-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
@@ -621,6 +621,7 @@ our $signature_tags = qr{(?xi: Reviewed-by:| Reported-by:| Suggested-by:| + Assisted-by:| To:| Cc: )};
@@ -3069,6 +3070,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 113/166 KVM: x86: Use scratch field in MMIO fragment to hold small write values
In reply to Greg Kroah-Hartman6.6-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
@@ -7713,7 +7713,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 ; }
@@ -7728,6 +7734,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 ;
@@ -11136,6 +11145,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
@@ -316,7 +316,8 @@ static inline bool kvm_vcpu_can_poll(ktistruct kvm_mmio_fragment {gpa_t gpa;void *data; -unsigned len; +u64 val; +unsigned int len; };struct kvm_vcpu {
Greg Kroah-Hartman
maintainerPATCH 114/166 ASoC: qcom: q6apm: move component registration to unmanaged version
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Kandagatla <[email protected]>
commit 6ec1235fc941dac6c011b30ee01d9220ff87e0cd upstream.
q6apm component registers dais dynamically from ASoC toplology, which are allocated using device managed version apis. Allocating both component and dynamic dais using managed version could lead to incorrect free ordering, dai will be freed while component still holding references to it.
Fix this issue by moving component to unmanged version so that the dai pointers are only freeded after the component is removed.
==================================================================
BUG: KASAN: slab-use-after-free in snd_soc_del_component_unlocked+0x3d4/0x400 [snd_soc_core] Read of size 8 at addr ffff00084493a6e8 by task kworker/u48:0/3426 Tainted: [W]=WARN Hardware name: LENOVO 21N2ZC5PUS/21N2ZC5PUS, BIOS N42ET57W (1.31 ) 08/08/2024 Workqueue: pdr_notifier_wq pdr_notifier_work [pdr_interface] Call trace: show_stack+0x28/0x7c (C) dump_stack_lvl+0x60/0x80 print_report+0x160/0x4b4 kasan_report+0xac/0xfc __asan_report_load8_noabort+0x20/0x34 snd_soc_del_component_unlocked+0x3d4/0x400 [snd_soc_core] snd_soc_unregister_component_by_driver+0x50/0x88 [snd_soc_core] devm_component_release+0x30/0x5c [snd_soc_core] devres_release_all+0x13c/0x210 device_unbind_cleanup+0x20/0x190 device_release_driver_internal+0x350/0x468 device_release_driver+0x18/0x30 bus_remove_device+0x1a0/0x35c device_del+0x314/0x7f0 device_unregister+0x20/0xbc apr_remove_device+0x5c/0x7c [apr] device_for_each_child+0xd8/0x160 apr_pd_status+0x7c/0xa8 [apr] pdr_notifier_work+0x114/0x240 [pdr_interface] process_one_work+0x500/0xb70 worker_thread+0x630/0xfb0 kthread+0x370/0x6c0 ret_from_fork+0x10/0x20 Allocated by task 77: kasan_save_stack+0x40/0x68 kasan_save_track+0x20/0x40 kasan_save_alloc_info+0x44/0x58 __kasan_kmalloc+0xbc/0xdc __kmalloc_node_track_caller_noprof+0x1f4/0x620 devm_kmalloc+0x7c/0x1c8 snd_soc_register_dai+0x50/0x4f0 [snd_soc_core] soc_tplg_pcm_elems_load+0x55c/0x1eb8 [snd_soc_core] snd_soc_tplg_component_load+0x4f8/0xb60 [snd_soc_core] audioreach_tplg_init+0x124/0x1fc [snd_q6apm] q6apm_audio_probe+0x10/0x1c [snd_q6apm] snd_soc_component_probe+0x5c/0x118 [snd_soc_core] soc_probe_component+0x44c/0xaf0 [snd_soc_core] snd_soc_bind_card+0xad0/0x2370 [snd_soc_core] snd_soc_register_card+0x3b0/0x4c0 [snd_soc_core] devm_snd_soc_register_card+0x50/0xc8 [snd_soc_core] x1e80100_platform_probe+0x208/0x368 [snd_soc_x1e80100] platform_probe+0xc0/0x188 really_probe+0x188/0x804 __driver_probe_device+0x158/0x358 driver_probe_device+0x60/0x190 __device_attach_driver+0x16c/0x2a8 bus_for_each_drv+0x100/0x194 __device_attach+0x174/0x380 device_initial_probe+0x14/0x20 bus_probe_device+0x124/0x154 deferred_probe_work_func+0x140/0x220 process_one_work+0x500/0xb70 worker_thread+0x630/0xfb0 kthread+0x370/0x6c0 ret_from_fork+0x10/0x20 Freed by task 3426: kasan_save_stack+0x40/0x68 kasan_save_track+0x20/0x40 __kasan_save_free_info+0x4c/0x80 __kasan_slab_free+0x78/0xa0 kfree+0x100/0x4a4 devres_release_all+0x144/0x210 device_unbind_cleanup+0x20/0x190 device_release_driver_internal+0x350/0x468 device_release_driver+0x18/0x30 bus_remove_device+0x1a0/0x35c device_del+0x314/0x7f0 device_unregister+0x20/0xbc apr_remove_device+0x5c/0x7c [apr] device_for_each_child+0xd8/0x160 apr_pd_status+0x7c/0xa8 [apr] pdr_notifier_work+0x114/0x240 [pdr_interface] process_one_work+0x500/0xb70 worker_thread+0x630/0xfb0 kthread+0x370/0x6c0 ret_from_fork+0x10/0x20
--- sound/soc/qcom/qdsp6/q6apm.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
sound/soc/qcom/qdsp6/q6apm.c +12 -2
@@ -764,13 +764,22 @@ static int apm_probe(gpr_device_t *gdev)q6apm_get_apm_state (apm); - ret =devm_snd_soc_register_component (dev, &q6apm_audio_component,NULL ,0 ); + ret =snd_soc_register_component (dev, &q6apm_audio_component,NULL ,0 );if (ret <0 ) {dev_err (dev,"failed to register q6apm: %d\n" , ret);return ret; } -return of_platform_populate (dev->of_node,NULL ,NULL , dev); + ret =of_platform_populate (dev->of_node,NULL ,NULL , dev); +if (ret) +snd_soc_unregister_component (dev); + +return ret; +} + +static void apm_remove (gpr_device_t *gdev) +{ +snd_soc_unregister_component (&gdev->dev); }struct audioreach_module *q6apm_find_module_by_mid (struct q6apm_graph *graph,uint32_t mid)
@@ -837,6 +846,7 @@ MODULE_DEVICE_TABLE(of, apm_device_id);static gpr_driver_t apm_driver = { .probe = apm_probe, + .remove = apm_remove, .gpr_callback = apm_callback, .driver = { .name ="qcom-apm" ,
Greg Kroah-Hartman
maintainerPATCH 115/166 mm/kasan: fix double free for kasan pXds
In reply to Greg Kroah-Hartman6.6-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
@@ -300,7 +300,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); }
@@ -315,7 +315,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); }
@@ -330,7 +330,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); }
@@ -345,7 +345,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 116/166 mm: blk-cgroup: fix use-after-free in cgwb_release_workfn()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
commit 8f5857be99f1ed1fa80991c72449541f634626ee upstream.
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
@@ -529,12 +529,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 (wb->blkcg_css); +css_put (wb->blkcg_css); +mutex_unlock (&wb->bdi->cgwb_release_mutex); +fprop_local_destroy_percpu (&wb->memcg_completions);spin_lock_irq (&cgwb_lock);
Greg Kroah-Hartman
maintainerPATCH 86/166 usb: storage: Expand range of matched versions for VL817 quirks entry
In reply to Greg Kroah-Hartman6.6-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
@@ -2350,10 +2350,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 87/166 USB: cdc-acm: Add quirks for Yoga Book 9 14IAH10 INGENIC touchscreen
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Carey <[email protected]>
commit f58752ebcb35e156c85cd1a82d6579c7af3b9023 upstream.
The Lenovo Yoga Book 9 14IAH10 (83KJ) has a composite USB device (17EF:6161) that controls both touchscreens via a CDC ACM interface. Interface 0 is a standard CDC ACM control interface, but interface 1 (the data interface) incorrectly declares vendor-specific class (0xFF) instead of USB_CLASS_CDC_DATA. cdc-acm rejects the device at probe with -EINVAL, leaving interface 0 unbound and EP 0x82 never polled.
With no consumer polling EP 0x82, the firmware's watchdog fires every ~20 seconds and resets the USB bus, producing a continuous disconnect/ reconnect loop that prevents the touchscreens from ever initialising.
Add two new quirk flags:
VENDOR_CLASS_DATA_IFACE: Bypasses the bInterfaceClass check in acm_probe() that would otherwise reject the vendor-class data interface with -EINVAL.
ALWAYS_POLL_CTRL: Submits the notification URB at probe() rather than waiting for a TTY open. This keeps EP 0x82 polled at all times, permanently suppressing the firmware watchdog. The URB is resubmitted after port_shutdown() and on system resume. SET_CONTROL_LINE_STATE (DTR|RTS) is sent at probe and after port_shutdown() to complete firmware handshake.
Note: the firmware performs exactly 4 USB connect/disconnect cycles (~19 s each) on every cold boot before stabilising. This is a fixed firmware property; touch is available ~75-80 s after power-on.
--- drivers/usb/class/cdc-acm.c | 53 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 7 deletions(-)
drivers/usb/class/cdc-acm.c +46 -7
@@ -114,6 +114,8 @@ static int acm_ctrl_msg(struct acm *acm,int retval; retval =usb_autopm_get_interface (acm->control); +#define VENDOR_CLASS_DATA_IFACE BIT(9)/* data interface uses vendor-specific class */ +#define ALWAYS_POLL_CTRL BIT(10)/* keep ctrl URB active even without an open TTY */ if (retval)return retval;
@@ -710,12 +712,14 @@ static int acm_port_activate(struct tty_set_bit (TTY_NO_WRITE_SPLIT , &tty->flags); acm->control->needs_remote_wakeup =1 ; - acm->ctrlurb->dev = acm->dev; - retval =usb_submit_urb (acm->ctrlurb,GFP_KERNEL ); -if (retval) { -dev_err (&acm->control->dev, -"%s - usb_submit_urb(ctrl irq) failed\n" , __func__); - goto error_submit_urb; +if (!(acm->quirks &ALWAYS_POLL_CTRL )) { + acm->ctrlurb->dev = acm->dev; + retval =usb_submit_urb (acm->ctrlurb,GFP_KERNEL ); +if (retval) { +dev_err (&acm->control->dev, +"%s - usb_submit_urb(ctrl irq) failed\n" , __func__); + goto error_submit_urb; + } }acm_tty_set_termios (tty,NULL );
@@ -788,6 +792,14 @@ static void acm_port_shutdown(struct ttyacm_unpoison_urbs (acm); +if (acm->quirks &ALWAYS_POLL_CTRL ) { + acm->ctrlurb->dev = acm->dev; +if (usb_submit_urb (acm->ctrlurb,GFP_KERNEL )) +dev_dbg (&acm->control->dev, +"ctrl polling restart failed after port close\n" ); +/* port_shutdown() cleared DTR/RTS; restore them */ +acm_set_control (acm,USB_CDC_CTRL_DTR |USB_CDC_CTRL_RTS ); + } }static void acm_tty_cleanup (struct tty_struct *tty)
@@ -1328,6 +1340,9 @@ skip_normal_probe:dev_dbg (&intf->dev,"Your device has switched interfaces.\n" );swap (control_interface, data_interface); + }else if (quirks &VENDOR_CLASS_DATA_IFACE ) { +dev_dbg (&intf->dev, +"Vendor-specific data interface class, continuing.\n" ); }else {return -EINVAL ; }
@@ -1522,6 +1537,9 @@ skip_countries: acm->line.bDataBits =8 ;acm_set_line (acm, &acm->line); +if (quirks &ALWAYS_POLL_CTRL ) +acm_set_control (acm,USB_CDC_CTRL_DTR |USB_CDC_CTRL_RTS ); +if (!acm->combined_interfaces) { rv =usb_driver_claim_interface (&acm_driver, data_interface, acm);if (rv)
@@ -1543,6 +1561,13 @@ skip_countries:dev_info (&intf->dev,"ttyACM%d: USB ACM device\n" , minor); +if (acm->quirks &ALWAYS_POLL_CTRL ) { + acm->ctrlurb->dev = acm->dev; +if (usb_submit_urb (acm->ctrlurb,GFP_KERNEL )) +dev_warn (&intf->dev, +"failed to start persistent ctrl polling\n" ); + } +return 0 ; err_release_data_interface:
@@ -1669,7 +1694,7 @@ static int acm_resume(struct usb_interfaacm_unpoison_urbs (acm); -if (tty_port_initialized (&acm->port)) { +if (tty_port_initialized (&acm->port) || (acm->quirks &ALWAYS_POLL_CTRL )) { rv =usb_submit_urb (acm->ctrlurb,GFP_ATOMIC );for (;;) {
@@ -2016,6 +2041,20 @@ static const struct usb_device_id acm_id/* CH343 supports CAP_BRK, but doesn't advertise it */ { USB_DEVICE(0x1a86, 0x55d3), .driver_info = MISSING_CAP_BRK, }, + /* + * Lenovo Yoga Book 9 14IAH10 (83KJ) — INGENIC 17EF:6161 touchscreen + * composite device. The CDC ACM control interface (0) uses a standard + * Union descriptor, but the data interface (1) is declared as vendor- + * specific class (0xff) with no CDC data descriptors, so cdc-acm would + * normally reject it. The firmware also requires continuous polling of + * the notification endpoint (EP 0x82) to suppress a 20-second watchdog + * reset; ALWAYS_POLL_CTRL keeps the ctrlurb active even when no TTY is + * open. Match only the control interface by class to avoid probing the + * vendor-specific data interface. + */ + { USB_DEVICE_INTERFACE_CLASS(0x17ef, 0x6161, USB_CLASS_COMM), + .driver_info = VENDOR_CLASS_DATA_IFACE | ALWAYS_POLL_CTRL }, + /* control interfaces without any protocol set */ { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, USB_CDC_PROTO_NONE) },
Greg Kroah-Hartman
maintainerPATCH 88/166 usb: port: add delay after usb_hub_set_port_power()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xu Yang <[email protected]>
commit b84cc80610a8ce036deb987f056ce3196ead7f1e upstream.
When a port is disabled, an attached device will be disconnected. This causes a port-status-change event, which will race with hub autosuspend (if the disabled port was the only connected port on its hub), causing an immediate resume and a second autosuspend. Both of these can be avoided by adding a short delay after the call to usb_hub_set_port_power().
Below log shows what is happening:
$ echo 1 > usb1-port1/disable [ 37.958239] usb 1-1: USB disconnect, device number 2 [ 37.964101] usb 1-1: unregistering device [ 37.970070] hub 1-0:1.0: hub_suspend [ 37.971305] hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0002 [ 37.974412] usb usb1: bus auto-suspend, wakeup 1 [ 37.988175] usb usb1: suspend raced with wakeup event <--- [ 37.993947] usb usb1: usb auto-resume [ 37.998401] hub 1-0:1.0: hub_resume [ 38.105688] usb usb1-port1: status 0000, change 0000, 12 Mb/s [ 38.112399] hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0000 [ 38.118645] hub 1-0:1.0: hub_suspend [ 38.122963] usb usb1: bus auto-suspend, wakeup 1 [ 38.200368] usb usb1: usb wakeup-resume [ 38.204982] usb usb1: usb auto-resume [ 38.209376] hub 1-0:1.0: hub_resume [ 38.213676] usb usb1-port1: status 0101 change 0001 [ 38.321552] hub 1-0:1.0: state 7 ports 1 chg 0002 evt 0000 [ 38.327978] usb usb1-port1: status 0101, change 0000, 12 Mb/s [ 38.457429] usb 1-1: new high-speed USB device number 3 using ci_hdrc
Then, port change bit will be fixed to the final state and usb_clear_port_feature() can correctly clear it after this period. This will also avoid usb runtime suspend routine to run because usb_autopm_put_interface() not run yet.
--- drivers/usb/core/port.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/core/port.c +1 -0
@@ -138,6 +138,7 @@ static ssize_t disable_store(struct deviusb_disconnect (&port_dev->child); rc =usb_hub_set_port_power (hdev, hub, port1, !disabled); +msleep (2 *hub_power_on_good_delay (hub));if (disabled) {usb_clear_port_feature (hdev, port1,USB_PORT_FEAT_C_CONNECTION );
Greg Kroah-Hartman
maintainerPATCH 89/166 fbdev: udlfb: avoid divide-by-zero on FBIOPUT_VSCREENINFO
In reply to Greg Kroah-Hartman6.6-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
@@ -1078,6 +1078,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 90/166 scripts: generate_rust_analyzer.py: avoid FD leak
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tamir Duberstein <[email protected]>
commit 9b4744d8eda2824041064a5639ccbb079850914d upstream.
Use pathlib.Path.read_text() to avoid leaking file descriptors.
--- scripts/generate_rust_analyzer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/generate_rust_analyzer.py +2 -1
@@ -121,9 +121,10 @@ def generate_crates(srctree, objtree, sy def is_root_crate(build_file, target): try: - return f"{target}.o" in open(build_file).read() + contents = build_file.read_text() except FileNotFoundError: return False + return f"{target}.o" in contents # Then, the rest outside of `rust/`. #
Greg Kroah-Hartman
maintainerPATCH 91/166 wifi: rtw88: fix device leak on probe failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit bbb15e71156cd9f5e1869eee7207a06ea8e96c39 upstream.
Driver core holds a reference to the USB interface and its parent USB device while the interface is bound to a driver and there is no need to take additional references unless the structures are needed after disconnect.
This driver takes a reference to the USB device during probe but does not to release it on all probe errors (e.g. when descriptor parsing fails).
Drop the redundant device reference to fix the leak, reduce cargo culting, make it easier to spot drivers where an extra reference is needed, and reduce the risk of further memory leaks.
--- drivers/net/wireless/realtek/rtw88/usb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/usb.c +1 -2
@@ -811,7 +811,7 @@ static int rtw_usb_intf_init(struct rtw_ struct usb_interface *intf) {struct rtw_usb *rtwusb =rtw_get_usb_priv (rtwdev); -struct usb_device *udev =usb_get_dev (interface_to_usbdev (intf)); +struct usb_device *udev =interface_to_usbdev (intf);int ret; rtwusb->udev = udev;
@@ -837,7 +837,6 @@ static void rtw_usb_intf_deinit(struct r {struct rtw_usb *rtwusb =rtw_get_usb_priv (rtwdev); -usb_put_dev (rtwusb->udev);kfree (rtwusb->usb_data);usb_set_intfdata (intf,NULL ); }
Greg Kroah-Hartman
maintainerPATCH 82/166 ksmbd: validate EaNameLength in smb2_get_ea()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 66751841212c2cc196577453c37f7774ff363f02 upstream.
smb2_get_ea() reads ea_req->EaNameLength from the client request and passes it directly to strncmp() as the comparison length without verifying that the length of the name really is the size of the input buffer received.
Fix this up by properly checking the size of the name based on the value received and the overall size of the request, to prevent a later strncmp() call to use the length as a "trusted" size of the buffer. Without this check, uninitialized heap values might be slowly leaked to the client.
--- fs/smb/server/smb2pdu.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/smb/server/smb2pdu.c +5 -0
@@ -4702,6 +4702,11 @@ static int smb2_get_ea(struct ksmbd_work ea_req = (struct smb2_ea_info_req *)((char *)req +le16_to_cpu (req->InputBufferOffset)); + +if (le32_to_cpu (req->InputBufferLength) < + offsetof(struct smb2_ea_info_req , name) + + ea_req->EaNameLength) +return -EINVAL ; }else {/* need to send all EAs, if no specific EA is requested*/ if (le32_to_cpu (req->Flags) &SL_RETURN_SINGLE_ENTRY )
Greg Kroah-Hartman
maintainerPATCH 118/166 media: mediatek: vcodec: fix use-after-free in encoder release path
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fan Wu <[email protected]>
commit 76e35091ffc722ba39b303e48bc5d08abb59dd56 upstream.
The fops_vcodec_release() function frees the context structure (ctx) without first cancelling any pending or running work in ctx->encode_work. This creates a race window where the workqueue handler (mtk_venc_worker) may still be accessing the context memory after it has been freed.
Race condition:
CPU 0 (release path) CPU 1 (workqueue)
--------------------- ------------------
fops_vcodec_release()
v4l2_m2m_ctx_release()
v4l2_m2m_cancel_job()
// waits for m2m job "done"
mtk_venc_worker()
v4l2_m2m_job_finish()
// m2m job "done"
// BUT worker still running!
// post-job_finish access:
other ctx dereferences
// UAF if ctx already freed
// returns (job "done")
kfree(ctx) // ctx freedRoot cause: The v4l2_m2m_ctx_release() only waits for the m2m job lifecycle (via TRANS_RUNNING flag), not the workqueue lifecycle. After v4l2_m2m_job_finish() is called, the m2m framework considers the job complete and v4l2_m2m_ctx_release() returns, but the worker function continues executing and may still access ctx.
The work is queued during encode operations via:
queue_work(ctx->dev->encode_workqueue, &ctx->encode_work)
The worker function accesses ctx->m2m_ctx, ctx->dev, and other ctx fields even after calling v4l2_m2m_job_finish().
This vulnerability was confirmed with KASAN by running an instrumented test module that widens the post-job_finish race window. KASAN detected:
BUG: KASAN: slab-use-after-free in mtk_venc_worker+0x159/0x180
Read of size 4 at addr ffff88800326e000 by task kworker/u8:0/12
Workqueue: mtk_vcodec_enc_wq mtk_venc_worker
Allocated by task 47:
__kasan_kmalloc+0x7f/0x90
fops_vcodec_open+0x85/0x1a0
Freed by task 47:
__kasan_slab_free+0x43/0x70
kfree+0xee/0x3a0
fops_vcodec_release+0xb7/0x190Fix this by calling cancel_work_sync(&ctx->encode_work) before kfree(ctx). This ensures the workqueue handler is both cancelled (if pending) and synchronized (waits for any running handler to complete) before the context is freed.
Placement rationale: The fix is placed after v4l2_ctrl_handler_free() and before list_del_init(&ctx->list). At this point, all m2m operations are done (v4l2_m2m_ctx_release() has returned), and we need to ensure the workqueue is synchronized before removing ctx from the list and freeing it.
Note: The open error path does NOT need cancel_work_sync() because INIT_WORK() only initializes the work structure - it does not schedule it. Work is only scheduled later during device_run() operations.
--- drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c +9 -0
@@ -216,6 +216,15 @@ static int fops_vcodec_release(struct fiv4l2_fh_exit (&ctx->fh);v4l2_ctrl_handler_free (&ctx->ctrl_hdl); +/* +* Cancel any pending encode work before freeing the context. +* Although v4l2_m2m_ctx_release() waits for m2m job completion, +* the workqueue handler (mtk_venc_worker) may still be accessing +* the context after v4l2_m2m_job_finish() returns. Without this, +* a use-after-free occurs when the worker accesses ctx after kfree. +*/ +cancel_work_sync (&ctx->encode_work); +spin_lock_irqsave (&dev->dev_ctx_lock, flags);list_del_init (&ctx->list);spin_unlock_irqrestore (&dev->dev_ctx_lock, flags);
Greg Kroah-Hartman
maintainerPATCH 127/166 PCI: endpoint: pci-epf-vntb: Remove duplicate resource teardown
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Koichiro Den <[email protected]>
[ Upstream commit 0da63230d3ec1ec5fcc443a2314233e95bfece54 ]
epf_ntb_epc_destroy() duplicates the teardown that the caller is supposed to perform later. This leads to an oops when .allow_link fails or when .drop_link is performed. The following is an example oops of the former case:
Unable to handle kernel paging request at virtual address dead000000000108 [...] [dead000000000108] address between user and kernel address ranges Internal error: Oops: 0000000096000044 [#1] SMP [...] Call trace: pci_epc_remove_epf+0x78/0xe0 (P) pci_primary_epc_epf_link+0x88/0xa8 configfs_symlink+0x1f4/0x5a0 vfs_symlink+0x134/0x1d8 do_symlinkat+0x88/0x138 __arm64_sys_symlinkat+0x74/0xe0 [...]
Remove the helper, and drop pci_epc_put(). EPC device refcounting is tied to the configfs EPC group lifetime, and pci_epc_put() in the .drop_link path is sufficient.
--- drivers/pci/endpoint/functions/pci-epf-vntb.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-)
drivers/pci/endpoint/functions/pci-epf-vntb.c +1 -17
@@ -673,18 +673,6 @@ static void epf_ntb_mw_bar_clear(struct epf_ntb *ntb, int num_mws) } } -/** -* epf_ntb_epc_destroy() - Cleanup NTB EPC interface -* @ntb: NTB device that facilitates communication between HOST and VHOST -* -* Wrapper for epf_ntb_epc_destroy_interface() to cleanup all the NTB interfaces -*/ -static void epf_ntb_epc_destroy (struct epf_ntb *ntb) -{ -pci_epc_remove_epf (ntb->epf->epc, ntb->epf,0 ); -pci_epc_put (ntb->epf->epc); -} -/** * epf_ntb_init_epc_bar() - Identify BARs to be used for each of the NTB * constructs (scratchpad region, doorbell, memorywindow)
@@ -1328,7 +1316,7 @@ static int epf_ntb_bind(struct pci_epf *epf) ret =epf_ntb_init_epc_bar (ntb);if (ret) {dev_err (dev,"Failed to create NTB EPC\n" ); - goto err_bar_init; +return ret; } ret =epf_ntb_config_spad_bar_alloc (ntb);
@@ -1368,9 +1356,6 @@ static int epf_ntb_bind(struct pci_epf *epf) err_bar_alloc:epf_ntb_config_spad_bar_free (ntb); -err_bar_init: -epf_ntb_epc_destroy (ntb); -return ret; }
@@ -1386,7 +1371,6 @@ static void epf_ntb_unbind(struct pci_epf *epf)epf_ntb_epc_cleanup (ntb);epf_ntb_config_spad_bar_free (ntb); -epf_ntb_epc_destroy (ntb);pci_unregister_driver (&vntb_pci_driver); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 128/166 ipv6: add NULL checks for idev in SRv6 paths
In reply to Greg Kroah-Hartman6.6-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
@@ -378,6 +378,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
@@ -244,6 +244,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 129/166 md/raid1,raid10: dont ignore IO flags
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
commit e879a0d9cb086c8e52ce6c04e5bfa63825a6213c upstream.
If blk-wbt is enabled by default, it's found that raid write performance is quite bad because all IO are throttled by wbt of underlying disks, due to flag REQ_IDLE is ignored. And turns out this behaviour exist since blk-wbt is introduced.
Other than REQ_IDLE, other flags should not be ignored as well, for example REQ_META can be set for filesystems, clearing it can cause priority reverse problems; And REQ_NOWAIT should not be cleared as well, because io will wait instead of failing directly in underlying disks.
Fix those problems by keep IO flags from master bio.
Fises: f51d46d0e7cb ("md: add support for REQ_NOWAIT")
[ Harshit: Resolve conflicts due to missing commit: f2a38abf5f1c
("md/raid1: Atomic write support") and commit: a1d9b4fd42d9 ("md/raid10: Atomic write support") in 6.12.y, we don't have Atomic writes feature in 6.12.y ]
--- drivers/md/raid1.c | 4 ---- drivers/md/raid10.c | 7 ------- 2 files changed, 11 deletions(-)
drivers/md/raid1.c +0 -4
@@ -1214,8 +1214,6 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio,struct raid1_info *mirror;struct bio *read_bio;struct bitmap *bitmap = mddev->bitmap; -const enum req_op op =bio_op (bio); -const blk_opf_t do_sync = bio->bi_opf &REQ_SYNC ;int max_sectors;int rdisk;bool r1bio_existed = !!r1_bio;
@@ -1315,7 +1313,6 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio, read_bio->bi_iter.bi_sector = r1_bio->sector + mirror->rdev->data_offset; read_bio->bi_end_io = raid1_end_read_request; - read_bio->bi_opf = op | do_sync;if (test_bit (FailFast, &mirror->rdev->flags) &&test_bit (R1BIO_FailFast, &r1_bio->state)) read_bio->bi_opf |=MD_FAILFAST ;
@@ -1537,7 +1534,6 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio, mbio->bi_iter.bi_sector = (r1_bio->sector + rdev->data_offset); mbio->bi_end_io = raid1_end_write_request; - mbio->bi_opf =bio_op (bio) | (bio->bi_opf & (REQ_SYNC |REQ_FUA ));if (test_bit (FailFast, &rdev->flags) && !test_bit (WriteMostly, &rdev->flags) && conf->raid_disks - mddev->degraded >1 )
drivers/md/raid10.c +0 -7
@@ -1168,8 +1168,6 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio, {struct r10conf *conf = mddev->private;struct bio *read_bio; -const enum req_op op =bio_op (bio); -const blk_opf_t do_sync = bio->bi_opf &REQ_SYNC ;int max_sectors;struct md_rdev *rdev;char b[BDEVNAME_SIZE ];
@@ -1250,7 +1248,6 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio, read_bio->bi_iter.bi_sector = r10_bio->devs[slot].addr +choose_data_offset (r10_bio, rdev); read_bio->bi_end_io = raid10_end_read_request; - read_bio->bi_opf = op | do_sync;if (test_bit (FailFast, &rdev->flags) &&test_bit (R10BIO_FailFast, &r10_bio->state)) read_bio->bi_opf |=MD_FAILFAST ;
@@ -1267,9 +1264,6 @@ static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio, struct bio *bio, bool replacement, int n_copy) { - const enum req_op op = bio_op(bio); -const blk_opf_t do_sync = bio->bi_opf &REQ_SYNC ; -const blk_opf_t do_fua = bio->bi_opf &REQ_FUA ; unsigned long flags;struct r10conf *conf = mddev->private;struct md_rdev *rdev;
@@ -1295,7 +1289,6 @@ static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio, mbio->bi_iter.bi_sector = (r10_bio->devs[n_copy].addr +choose_data_offset (r10_bio, rdev)); mbio->bi_end_io = raid10_end_write_request; - mbio->bi_opf = op | do_sync | do_fua;if (!replacement &&test_bit (FailFast, &conf->mirrors[devnum].rdev->flags) &&enough (conf, devnum))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 130/166 wifi: mac80211: always free skb on ieee80211_tx_prepare_skb() failure
In reply to Greg Kroah-Hartman6.6-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/virtual/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/virtual/mac80211_hwsim.c +0 -1
@@ -2892,7 +2892,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
@@ -7032,6 +7032,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
@@ -1911,8 +1911,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 131/166 net: ethernet: mtk_eth_soc: initialize PPE per-tag-layer MTU registers
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Golle <[email protected]>
commit 2dddb34dd0d07b01fa770eca89480a4da4f13153 upstream.
The PPE enforces output frame size limits via per-tag-layer VLAN_MTU registers that the driver never initializes. The hardware defaults do not account for PPPoE overhead, causing the PPE to punt encapsulated frames back to the CPU instead of forwarding them.
Initialize the registers at PPE start and on MTU changes using the maximum GMAC MTU. This is a conservative approximation -- the actual per-PPE requirement depends on egress path, but using the global maximum ensures the limits are never too small.
--- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 22 ++++++++++++++- drivers/net/ethernet/mediatek/mtk_ppe.c | 30 +++++++++++++++++++++ drivers/net/ethernet/mediatek/mtk_ppe.h | 1 + 3 files changed, 52 insertions(+), 1 deletion(-)
drivers/net/ethernet/mediatek/mtk_eth_soc.c +21 -1
@@ -3368,11 +3368,22 @@ static int mtk_device_event(struct notifier_block *n, unsigned long event, voidreturn NOTIFY_DONE ; } +static int mtk_max_gmac_mtu (struct mtk_eth *eth) +{ +int i, max_mtu =ETH_DATA_LEN ; + +for (i =0 ; i <ARRAY_SIZE (eth->netdev); i++) +if (eth->netdev[i] && eth->netdev[i]->mtu > max_mtu) + max_mtu = eth->netdev[i]->mtu; + +return max_mtu; +} +static int mtk_open (struct net_device *dev) {struct mtk_mac *mac =netdev_priv (dev);struct mtk_eth *eth = mac->hw; -int i, err; +int i, err, mtu; err =phylink_of_phy_connect (mac->phylink, mac->of_node,0 );if (err) {
@@ -3400,6 +3411,10 @@ static int mtk_open(struct net_device *dev) : MTK_GDMA_TO_PDMA;mtk_gdm_config (eth, gdm_config); + mtu =mtk_max_gmac_mtu (eth); +for (i =0 ; i <ARRAY_SIZE (eth->ppe); i++) +mtk_ppe_update_mtu (eth->ppe[i], mtu); +napi_enable (ð->tx_napi);napi_enable (ð->rx_napi);mtk_tx_irq_enable (eth,MTK_TX_DONE_INT );
@@ -4088,6 +4103,7 @@ static int mtk_change_mtu(struct net_device *dev, int new_mtu)int length = new_mtu +MTK_RX_ETH_HLEN ;struct mtk_mac *mac =netdev_priv (dev);struct mtk_eth *eth = mac->hw; +int max_mtu, i;if (rcu_access_pointer (eth->prog) && length >MTK_PP_MAX_BUF_SIZE ) {
@@ -4098,6 +4114,10 @@ static int mtk_change_mtu(struct net_device *dev, int new_mtu)mtk_set_mcr_max_rx (mac, length); dev->mtu = new_mtu; + max_mtu =mtk_max_gmac_mtu (eth); +for (i =0 ; i <ARRAY_SIZE (eth->ppe); i++) +mtk_ppe_update_mtu (eth->ppe[i], max_mtu); +return 0 ; }
drivers/net/ethernet/mediatek/mtk_ppe.c +30 -0
@@ -971,6 +971,36 @@ static void mtk_ppe_init_foe_table(struct mtk_ppe *ppe) } } +void mtk_ppe_update_mtu (struct mtk_ppe *ppe,int mtu) +{ +int base; +u32 val; + +if (!ppe) +return ; + +/* The PPE checks output frame size against per-tag-layer MTU limits, +* treating PPPoE and DSA tags just like 802.1Q VLAN tags. The Linux +* device MTU already accounts for PPPoE (PPPOE_SES_HLEN) and DSA tag +* overhead, but 802.1Q VLAN tags are handled transparently without +* being reflected by the lower device MTU being increased by 4. +* Use the maximum MTU across all GMAC interfaces so that PPE output +* frame limits are sufficiently high regardless of which port a flow +* egresses through. +*/ + base =ETH_HLEN + mtu; + + val =FIELD_PREP (MTK_PPE_VLAN_MTU0_NONE , base) | +FIELD_PREP (MTK_PPE_VLAN_MTU0_1TAG , base +VLAN_HLEN ); +ppe_w32 (ppe,MTK_PPE_VLAN_MTU0 , val); + + val =FIELD_PREP (MTK_PPE_VLAN_MTU1_2TAG , + base +2 *VLAN_HLEN ) | +FIELD_PREP (MTK_PPE_VLAN_MTU1_3TAG , + base +3 *VLAN_HLEN ); +ppe_w32 (ppe,MTK_PPE_VLAN_MTU1 , val); +} +void mtk_ppe_start (struct mtk_ppe *ppe) {u32 val;
drivers/net/ethernet/mediatek/mtk_ppe.h +1 -0
@@ -346,6 +346,7 @@ struct mtk_ppe {struct mtk_ppe *mtk_ppe_init (struct mtk_eth *eth,void __iomem *base,int index);void mtk_ppe_deinit (struct mtk_eth *eth); +void mtk_ppe_update_mtu (struct mtk_ppe *ppe,int mtu);void mtk_ppe_start (struct mtk_ppe *ppe);int mtk_ppe_stop (struct mtk_ppe *ppe);int mtk_ppe_prepare_reset (struct mtk_ppe *ppe);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 132/166 i40e: Fix preempt count leak in napi poll tracepoint
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
[ Upstream commit 4b3d54a85bd37ebf2d9836f0d0de775c0ff21af9 ]
Using get_cpu() in the tracepoint assignment causes an obvious preempt count leak because nothing invokes put_cpu() to undo it:
softirq: huh, entered softirq 3 NET_RX with preempt_count 00000100, exited with 00000101?
This clearly has seen a lot of testing in the last 3+ years...
Use smp_processor_id() instead.
--- drivers/net/ethernet/intel/i40e/i40e_trace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_trace.h +1 -1
@@ -88,7 +88,7 @@ TRACE_EVENT(i40e_napi_poll, __entry->rx_clean_complete = rx_clean_complete; __entry->tx_clean_complete = tx_clean_complete; __entry->irq_num = q->irq_num; - __entry->curr_cpu =get_cpu (); + __entry->curr_cpu =smp_processor_id ();__assign_str (qname, q->name);__assign_str (dev_name, napi->dev ? napi->dev->name :NO_DEV ); __assign_bitmask(irq_affinity, cpumask_bits(&q->affinity_mask),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 133/166 net: annotate data-races around sk->sk_{data_ready,write_space}
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 2ef2b20cf4e04ac8a6ba68493f8780776ff84300 ]
skmsg (and probably other layers) are changing these pointers while other cpus might read them concurrently.
Add corresponding READ_ONCE()/WRITE_ONCE() annotations for UDP, TCP and AF_UNIX.
--- net/core/skmsg.c | 14 +++++++------- net/ipv4/tcp.c | 4 ++-- net/ipv4/tcp_bpf.c | 2 +- net/ipv4/tcp_input.c | 14 ++++++++------ net/ipv4/tcp_minisocks.c | 2 +- net/ipv4/udp.c | 3 ++- net/ipv4/udp_bpf.c | 2 +- net/unix/af_unix.c | 8 ++++---- 8 files changed, 26 insertions(+), 23 deletions(-)
net/core/skmsg.c +7 -7
@@ -1204,8 +1204,8 @@ void sk_psock_start_strp(struct sock *sk, struct sk_psock *psock)return ; psock->saved_data_ready = sk->sk_data_ready; - sk->sk_data_ready = sk_psock_strp_data_ready; - sk->sk_write_space = sk_psock_write_space; +WRITE_ONCE (sk->sk_data_ready, sk_psock_strp_data_ready); +WRITE_ONCE (sk->sk_write_space, sk_psock_write_space); }void sk_psock_stop_strp (struct sock *sk,struct sk_psock *psock)
@@ -1215,8 +1215,8 @@ void sk_psock_stop_strp(struct sock *sk, struct sk_psock *psock)if (!psock->saved_data_ready)return ; - sk->sk_data_ready = psock->saved_data_ready; - psock->saved_data_ready =NULL ; +WRITE_ONCE (sk->sk_data_ready, psock->saved_data_ready); +WRITE_ONCE (psock->saved_data_ready,NULL );strp_stop (&psock->strp); }
@@ -1298,8 +1298,8 @@ void sk_psock_start_verdict(struct sock *sk, struct sk_psock *psock)return ; psock->saved_data_ready = sk->sk_data_ready; - sk->sk_data_ready = sk_psock_verdict_data_ready; - sk->sk_write_space = sk_psock_write_space; +WRITE_ONCE (sk->sk_data_ready, sk_psock_verdict_data_ready); +WRITE_ONCE (sk->sk_write_space, sk_psock_write_space); }void sk_psock_stop_verdict (struct sock *sk,struct sk_psock *psock)
@@ -1310,6 +1310,6 @@ void sk_psock_stop_verdict(struct sock *sk, struct sk_psock *psock)if (!psock->saved_data_ready)return ; - sk->sk_data_ready = psock->saved_data_ready; +WRITE_ONCE (sk->sk_data_ready, psock->saved_data_ready); psock->saved_data_ready =NULL ; }
net/ipv4/tcp.c +2 -2
@@ -1333,7 +1333,7 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size) err =sk_stream_error (sk, flags, err);/* make sure we wake any epoll edge trigger waiter */ if (unlikely (tcp_rtx_and_write_queues_empty (sk) && err == -EAGAIN )) { - sk->sk_write_space (sk); +READ_ONCE (sk->sk_write_space)(sk);tcp_chrono_stop (sk,TCP_CHRONO_SNDBUF_LIMITED ); }return err;
@@ -3709,7 +3709,7 @@ int do_tcp_setsockopt(struct sock *sk, int level, int optname,break ;case TCP_NOTSENT_LOWAT :WRITE_ONCE (tp->notsent_lowat, val); - sk->sk_write_space (sk); +READ_ONCE (sk->sk_write_space)(sk);break ;case TCP_INQ :if (val >1 || val <0 )
net/ipv4/tcp_bpf.c +1 -1
@@ -725,7 +725,7 @@ int tcp_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool restore)WRITE_ONCE (sk->sk_prot->unhash, psock->saved_unhash);tcp_update_ulp (sk, psock->sk_proto, psock->saved_write_space); }else { - sk->sk_write_space = psock->saved_write_space; +WRITE_ONCE (sk->sk_write_space, psock->saved_write_space);/* Pairs with lockless read in sk_clone_lock() */ sock_replace_proto (sk, psock->sk_proto); }
net/ipv4/tcp_input.c +8 -6
@@ -4936,7 +4936,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)if (unlikely (tcp_try_rmem_schedule (sk, skb, skb->truesize))) {NET_INC_STATS (sock_net (sk),LINUX_MIB_TCPOFODROP ); - sk->sk_data_ready (sk); +READ_ONCE (sk->sk_data_ready)(sk);tcp_drop_reason (sk, skb,SKB_DROP_REASON_PROTO_MEM );return ; }
@@ -5143,7 +5143,7 @@ int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size)void tcp_data_ready (struct sock *sk) {if (tcp_epollin_ready (sk, sk->sk_rcvlowat) ||sock_flag (sk,SOCK_DONE )) - sk->sk_data_ready (sk); +READ_ONCE (sk->sk_data_ready)(sk); }static void tcp_data_queue (struct sock *sk,struct sk_buff *skb)
@@ -5189,7 +5189,7 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)inet_csk (sk)->icsk_ack.pending |= (ICSK_ACK_NOMEM |ICSK_ACK_NOW );inet_csk_schedule_ack (sk); - sk->sk_data_ready (sk); +READ_ONCE (sk->sk_data_ready)(sk);if (skb_queue_len (&sk->sk_receive_queue)) { reason =SKB_DROP_REASON_PROTO_MEM ;
@@ -5626,7 +5626,9 @@ static void tcp_new_space(struct sock *sk) tp->snd_cwnd_stamp = tcp_jiffies32; } -INDIRECT_CALL_1 (sk->sk_write_space, sk_stream_write_space, sk); +INDIRECT_CALL_1 (READ_ONCE (sk->sk_write_space), + sk_stream_write_space, + sk); }/* Caller made space either from:
@@ -5832,7 +5834,7 @@ static void tcp_urg(struct sock *sk, struct sk_buff *skb, const struct tcphdr *tBUG ();WRITE_ONCE (tp->urg_data,TCP_URG_VALID | tmp);if (!sock_flag (sk,SOCK_DEAD )) - sk->sk_data_ready (sk); +READ_ONCE (sk->sk_data_ready)(sk); } } }
@@ -7216,7 +7218,7 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,sock_put (fastopen_sk); goto drop_and_free; } - sk->sk_data_ready (sk); +READ_ONCE (sk->sk_data_ready)(sk);bh_unlock_sock (fastopen_sk);sock_put (fastopen_sk); }else {
net/ipv4/tcp_minisocks.c +1 -1
@@ -876,7 +876,7 @@ int tcp_child_process(struct sock *parent, struct sock *child, ret =tcp_rcv_state_process (child, skb);/* Wakeup parent, send SIGIO */ if (state ==TCP_SYN_RECV && child->sk_state != state) - parent->sk_data_ready (parent); +READ_ONCE (parent->sk_data_ready)(parent); }else {/* Alas, it is possible again, because we do lookup * in main socket hash table and lock on listening
net/ipv4/udp.c +2 -1
@@ -1560,7 +1560,8 @@ int __udp_enqueue_schedule_skb(struct sock *sk, struct sk_buff *skb)spin_unlock (&list->lock);if (!sock_flag (sk,SOCK_DEAD )) -INDIRECT_CALL_1 (sk->sk_data_ready, sock_def_readable, sk); +INDIRECT_CALL_1 (READ_ONCE (sk->sk_data_ready), + sock_def_readable, sk);busylock_release (busy);return 0 ;
net/ipv4/udp_bpf.c +1 -1
@@ -158,7 +158,7 @@ int udp_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool restore)int family = sk->sk_family ==AF_INET ?UDP_BPF_IPV4 :UDP_BPF_IPV6 ;if (restore) { - sk->sk_write_space = psock->saved_write_space; +WRITE_ONCE (sk->sk_write_space, psock->saved_write_space);sock_replace_proto (sk, psock->sk_proto);return 0 ; }
net/unix/af_unix.c +4 -4
@@ -1678,7 +1678,7 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr,__skb_queue_tail (&other->sk_receive_queue, skb);spin_unlock (&other->sk_receive_queue.lock);unix_state_unlock (other); - other->sk_data_ready (other); +READ_ONCE (other->sk_data_ready)(other);sock_put (other);return 0 ;
@@ -2138,7 +2138,7 @@ static int unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg,scm_stat_add (other, skb);skb_queue_tail (&other->sk_receive_queue, skb);unix_state_unlock (other); - other->sk_data_ready (other); +READ_ONCE (other->sk_data_ready)(other);sock_put (other);scm_destroy (&scm);return len;
@@ -2206,7 +2206,7 @@ static int queue_oob(struct socket *sock, struct msghdr *msg, struct sock *othersk_send_sigurg (other);unix_state_unlock (other); - other->sk_data_ready (other); +READ_ONCE (other->sk_data_ready)(other);return err; }
@@ -2317,7 +2317,7 @@ static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg,scm_stat_add (other, skb);skb_queue_tail (&other->sk_receive_queue, skb);unix_state_unlock (other); - other->sk_data_ready (other); +READ_ONCE (other->sk_data_ready)(other); sent += size; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 134/166 PCI: endpoint: pci-epf-vntb: Stop cmd_handler work in epf_ntb_epc_cleanup
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Koichiro Den <[email protected]>
[ Upstream commit d799984233a50abd2667a7d17a9a710a3f10ebe2 ]
Disable the delayed work before clearing BAR mappings and doorbells to avoid running the handler after resources have been torn down.
Unable to handle kernel paging request at virtual address ffff800083f46004 [...] Internal error: Oops: 0000000096000007 [#1] SMP [...] Call trace: epf_ntb_cmd_handler+0x54/0x200 [pci_epf_vntb] (P) process_one_work+0x154/0x3b0 worker_thread+0x2c8/0x400 kthread+0x148/0x210 ret_from_fork+0x10/0x20
--- drivers/pci/endpoint/functions/pci-epf-vntb.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/endpoint/functions/pci-epf-vntb.c +1 -0
@@ -798,6 +798,7 @@ err_config_interrupt:*/ static void epf_ntb_epc_cleanup (struct epf_ntb *ntb) { +cancel_delayed_work_sync (&ntb->cmd_handler);epf_ntb_mw_bar_clear (ntb, ntb->num_mws);epf_ntb_db_bar_clear (ntb);epf_ntb_config_sspad_bar_clear (ntb);
Greg Kroah-Hartman
maintainerPATCH 135/166 scripts: generate_rust_analyzer.py: define scripts
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tamir Duberstein <[email protected]>
[ Upstream commit 36c619f6bd793493294becb10a02fea370b67a91 ]
Add IDE support for host-side scripts written in Rust. This support has been missing since these scripts were initially added in commit 9a8ff24ce584 ("scripts: add generate_rust_target.rs"), thus add it.
Change the existing instance of extension stripping to pathlib.Path.stem to maintain code consistency.
--- scripts/generate_rust_analyzer.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
scripts/generate_rust_analyzer.py +13 -1
@@ -119,6 +119,18 @@ def generate_crates(srctree, objtree, sy "exclude_dirs": [], } + scripts = srctree / "scripts" + makefile = (scripts / "Makefile").read_text() + for path in scripts.glob("*.rs"): + name = path.stem + if f"{name}-rust" not in makefile: + continue + append_crate( + name, + path, + ["std"], + ) + def is_root_crate(build_file, target): try: contents = build_file.read_text()
@@ -135,7 +147,7 @@ def generate_crates(srctree, objtree, sy for folder in extra_dirs: for path in folder.rglob("*.rs"): logging.info("Checking %s", path) - name = path.name.replace(".rs", "") + name = path.stem # Skip those that are not crate roots. if not is_root_crate(path.parent / "Makefile", name) and \
Greg Kroah-Hartman
maintainerPATCH 136/166 KVM: x86: Use __DECLARE_FLEX_ARRAY() for UAPI structures with VLAs
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Woodhouse <[email protected]>
[ Upstream commit 2619da73bb2f10d88f7e1087125c40144fdf0987 ]
Commit 94dfc73e7cf4 ("treewide: uapi: Replace zero-length arrays with flexible-array members") broke the userspace API for C++.
These structures ending in VLAs are typically a *header*, which can be followed by an arbitrary number of entries. Userspace typically creates a larger structure with some non-zero number of entries, for example in QEMU's kvm_arch_get_supported_msr_feature():
struct {
struct kvm_msrs info;
struct kvm_msr_entry entries[1];
} msr_data = {};While that works in C, it fails in C++ with an error like:
flexible array member 'kvm_msrs::entries' not at end of 'struct msr_data'
Fix this by using __DECLARE_FLEX_ARRAY() for the VLA, which uses [0] for C++ compilation.
--- arch/x86/include/uapi/asm/kvm.h | 12 ++++++------ include/uapi/linux/kvm.h | 11 ++++++----- 2 files changed, 12 insertions(+), 11 deletions(-)
arch/x86/include/uapi/asm/kvm.h +6 -6
@@ -191,13 +191,13 @@ struct kvm_msrs {__u32 nmsrs;/* number of msrs in entries */ __u32 pad; -struct kvm_msr_entry entries[]; + __DECLARE_FLEX_ARRAY(struct kvm_msr_entry, entries); };/* for KVM_GET_MSR_INDEX_LIST */ struct kvm_msr_list {__u32 nmsrs;/* number of msrs in entries */ -__u32 indices[]; + __DECLARE_FLEX_ARRAY(__u32, indices); };/* Maximum size of any access bitmap in bytes */
@@ -239,7 +239,7 @@ struct kvm_cpuid_entry {struct kvm_cpuid {__u32 nent;__u32 padding; -struct kvm_cpuid_entry entries[]; + __DECLARE_FLEX_ARRAY(struct kvm_cpuid_entry, entries); };struct kvm_cpuid_entry2 {
@@ -261,7 +261,7 @@ struct kvm_cpuid_entry2 {struct kvm_cpuid2 {__u32 nent;__u32 padding; -struct kvm_cpuid_entry2 entries[]; + __DECLARE_FLEX_ARRAY(struct kvm_cpuid_entry2, entries); };/* for KVM_GET_PIT and KVM_SET_PIT */
@@ -392,7 +392,7 @@ struct kvm_xsave {* the contents of CPUID leaf 0xD on the host. */ __u32 region[1024 ]; -__u32 extra[]; +__DECLARE_FLEX_ARRAY (__u32, extra); };#define KVM_MAX_XCRS 16
@@ -520,7 +520,7 @@ struct kvm_pmu_event_filter {__u32 fixed_counter_bitmap;__u32 flags;__u32 pad[4 ]; -__u64 events[]; +__DECLARE_FLEX_ARRAY (__u64, events); };#define KVM_PMU_EVENT_ALLOW 0
include/uapi/linux/kvm.h +6 -5
@@ -11,6 +11,7 @@#include <linux/const.h> #include <linux/types.h> #include <linux/compiler.h> +#include <linux/stddef.h> #include <linux/ioctl.h> #include <asm/kvm.h>
@@ -556,7 +557,7 @@ struct kvm_coalesced_mmio {struct kvm_coalesced_mmio_ring {__u32 first, last; -struct kvm_coalesced_mmio coalesced_mmio[]; + __DECLARE_FLEX_ARRAY(struct kvm_coalesced_mmio, coalesced_mmio); };#define KVM_COALESCED_MMIO_MAX \
@@ -643,7 +644,7 @@ struct kvm_clear_dirty_log {/* for KVM_SET_SIGNAL_MASK */ struct kvm_signal_mask {__u32 len; -__u8 sigset[]; + __DECLARE_FLEX_ARRAY(__u8, sigset); };/* for KVM_TPR_ACCESS_REPORTING */
@@ -1256,7 +1257,7 @@ struct kvm_irq_routing_entry {struct kvm_irq_routing {__u32 nr;__u32 flags; -struct kvm_irq_routing_entry entries[]; + __DECLARE_FLEX_ARRAY(struct kvm_irq_routing_entry, entries); };#endif
@@ -1377,7 +1378,7 @@ struct kvm_dirty_tlb {struct kvm_reg_list {__u64 n;/* number of regs */ -__u64 reg[]; + __DECLARE_FLEX_ARRAY(__u64, reg); };struct kvm_one_reg {
@@ -2211,7 +2212,7 @@ struct kvm_stats_desc {__u16 size;__u32 offset;__u32 bucket_size; -char name[]; +__DECLARE_FLEX_ARRAY (char, name); };#define KVM_GET_STATS_FD _IO(KVMIO, 0xce)
Greg Kroah-Hartman
maintainerPATCH 119/166 media: em28xx: fix use-after-free in em28xx_v4l2_open()
In reply to Greg Kroah-Hartman6.6-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
@@ -2126,7 +2126,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;
@@ -2143,13 +2143,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 137/166 rxrpc: Fix key quota calculation for multitoken keys
In reply to Greg Kroah-Hartman6.6-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
@@ -72,7 +72,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 );
@@ -303,6 +303,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);
@@ -340,7 +341,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 );
Greg Kroah-Hartman
maintainerPATCH 138/166 ocfs2: add inline inode consistency check to ocfs2_validate_inode_block()
In reply to Greg Kroah-Hartman6.6-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
@@ -1419,6 +1419,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 139/166 ocfs2: validate inline data i_size during inode read
In reply to Greg Kroah-Hartman6.6-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
@@ -1419,12 +1419,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 140/166 ocfs2: fix out-of-bounds write in ocfs2_write_end_inline
In reply to Greg Kroah-Hartman6.6-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
@@ -1430,6 +1430,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 141/166 Revert "wifi: cfg80211: stop NAN and P2P in cfg80211_leave"
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guocai He <[email protected]>
This reverts commit 4d7a05da767e5cbcf4db511b9289d7ebd380dc56 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
@@ -1332,10 +1332,8 @@ void __cfg80211_leave(struct cfg80211_re__cfg80211_leave_ocb (rdev, dev);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 :
Greg Kroah-Hartman
maintainerPATCH 142/166 scripts/dtc: Remove unused dts_version in dtc-lexer.l
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
This patch is for stable only. Commit 5a09df20872c ("scripts/dtc: Update to upstream version v1.7.2-69-g53373d135579") upstream applied it as part of a regular scripts/dtc sync, which may be unsuitable for older versions of stable where the warning it fixes is present.
A recent strengthening of -Wunused-but-set-variable (enabled with -Wall) in clang under a new subwarning, -Wunused-but-set-global, points out an unused static global variable in dtc-lexer.lex.c (compiled from dtc-lexer.l):
scripts/dtc/dtc-lexer.lex.c:641:12: warning: variable 'dts_version' set but not used [-Wunused-but-set-global]
641 | static int dts_version = 1;
| ^Remove it to clear up the warning, as it is truly unused.
---
This should apply cleanly to all supported stable branches.
--- scripts/dtc/dtc-lexer.l | 3 --- 1 file changed, 3 deletions(-)
scripts/dtc/dtc-lexer.l +0 -3
@@ -39,8 +39,6 @@ extern bool treesource_error; #define DPRINT(fmt, ...) do { } while (0) #endif -static int dts_version = 1; - #define BEGIN_DEFAULT() DPRINT("<V1>\n"); \ BEGIN(V1); \
@@ -101,7 +99,6 @@ static void PRINTF(1, 2) lexical_error(c <*>"/dts-v1/" { DPRINT("Keyword: /dts-v1/\n"); - dts_version = 1; BEGIN_DEFAULT(); return DT_V1; }
Greg Kroah-Hartman
maintainerPATCH 143/166 rxrpc: Fix anonymous key handling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 6a59d84b4fc2f27f7b40e348506cc686712e260b ]
In rxrpc_new_client_call_for_sendmsg(), a key with no payload is meant to be substituted for a NULL key pointer, but the variable this is done with is subsequently not used.
Fix this by using "key" rather than "rx->key" when filling in the connection parameters.
Note that this only affects direct use of AF_RXRPC; the kAFS filesystem doesn't use sendmsg() directly and so bypasses the issue. Further, AF_RXRPC passes a NULL key in if no key is set, so using an anonymous key in that manner works. Since this hasn't been noticed to this point, it might be better just to remove the "key" variable and the code that sets it
- and, arguably, rxrpc_init_client_call_security() would be a better place to handle it.
--- net/rxrpc/sendmsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/rxrpc/sendmsg.c +1 -1
@@ -590,7 +590,7 @@ rxrpc_new_client_call_for_sendmsg(structmemset (&cp,0 ,sizeof (cp)); cp.local = rx->local; - cp.key = rx->key; + cp.key = key; cp.security_level = rx->min_sec_level; cp.exclusive = rx->exclusive | p->exclusive; cp.upgrade = p->upgrade;
Greg Kroah-Hartman
maintainerPATCH 144/166 rxrpc: only handle RESPONSE during service challenge
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Jie <[email protected]>
[ Upstream commit c43ffdcfdbb5567b1f143556df8a04b4eeea041c ]
Only process RESPONSE packets while the service connection is still in RXRPC_CONN_SERVICE_CHALLENGING. Check that state under state_lock before running response verification and security initialization, then use a local secured flag to decide whether to queue the secured-connection work after the state transition. This keeps duplicate or late RESPONSE packets from re-running the setup path and removes the unlocked post-transition state test.
--- net/rxrpc/conn_event.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
net/rxrpc/conn_event.c +12 -2
@@ -233,6 +233,7 @@ static int rxrpc_process_event(struct rx struct sk_buff *skb) {struct rxrpc_skb_priv *sp =rxrpc_skb (skb); +bool secured = false;int ret;if (conn->state ==RXRPC_CONN_ABORTED )
@@ -245,6 +246,13 @@ static int rxrpc_process_event(struct rxreturn conn->security->respond_to_challenge (conn, skb);case RXRPC_PACKET_TYPE_RESPONSE : +spin_lock (&conn->state_lock); +if (conn->state !=RXRPC_CONN_SERVICE_CHALLENGING ) { +spin_unlock (&conn->state_lock); +return 0 ; + } +spin_unlock (&conn->state_lock); + ret = conn->security->verify_response (conn, skb);if (ret <0 )return ret;
@@ -255,11 +263,13 @@ static int rxrpc_process_event(struct rxreturn ret;spin_lock (&conn->state_lock); -if (conn->state ==RXRPC_CONN_SERVICE_CHALLENGING ) +if (conn->state ==RXRPC_CONN_SERVICE_CHALLENGING ) { conn->state =RXRPC_CONN_SERVICE ; + secured = true; + }spin_unlock (&conn->state_lock); -if (conn->state ==RXRPC_CONN_SERVICE ) { +if (secured) {/* Offload call state flipping to the I/O thread. As * we've already received the packet, put it on the * front of the queue.
Greg Kroah-Hartman
maintainerPATCH 145/166 fs/ntfs3: validate rec->used in journal-replay file record check
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 0ca0485e4b2e837ebb6cbd4f2451aba665a03e4b upstream.
check_file_record() validates rec->total against the record size but never validates rec->used. The do_action() journal-replay handlers read rec->used from disk and use it to compute memmove lengths:
DeleteAttribute: memmove(attr, ..., used - asize - roff) CreateAttribute: memmove(..., attr, used - roff) change_attr_size: memmove(..., used - PtrOffset(rec, next))
When rec->used is smaller than the offset of a validated attribute, or larger than the record size, these subtractions can underflow allowing us to copy huge amounts of memory in to a 4kb buffer, generally considered a bad idea overall.
This requires a corrupted filesystem, which isn't a threat model the kernel really needs to worry about, but checking for such an obvious out-of-bounds value is good to keep things robust, especially on journal replay
Fix this up by bounding rec->used correctly.
This is much like commit b2bc7c44ed17 ("fs/ntfs3: Fix slab-out-of-bounds read in DeleteIndexEntryRoot") which checked different values in this same switch statement.
--- fs/ntfs3/fslog.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
fs/ntfs3/fslog.c +11 -1
@@ -2789,13 +2789,14 @@ static inline bool check_file_record(conu16 fn =le16_to_cpu (rec->rhdr.fix_num);u16 ao =le16_to_cpu (rec->attr_off);u32 rs = sbi->record_size; +u32 used =le32_to_cpu (rec->used);/* Check the file record header for consistency. */ if (rec->rhdr.sign !=NTFS_FILE_SIGNATURE || fo > (SECTOR_SIZE - ((rs >>SECTOR_SHIFT ) +1 ) *sizeof (short )) || (fn -1 ) *SECTOR_SIZE != rs || ao <MFTRECORD_FIXUP_OFFSET_1 || ao > sbi->record_size -SIZEOF_RESIDENT || !is_rec_inuse (rec) || -le32_to_cpu (rec->total) != rs) { +le32_to_cpu (rec->total) != rs || used > rs || used < ao) {return false; }
@@ -2807,6 +2808,15 @@ static inline bool check_file_record(conreturn false; } +/* +* The do_action() handlers compute memmove lengths as +* "rec->used - <offset of validated attr>", which underflows when +* rec->used is smaller than the attribute walk reached. At this +* point attr is the ATTR_END marker; rec->used must cover it. +*/ +if (used <PtrOffset (rec, attr) +sizeof (attr->type)) +return false; +return true; }
Greg Kroah-Hartman
maintainerPATCH 146/166 f2fs: fix to avoid memory leak in f2fs_rename()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
commit 3cf11e6f36c170050c12171dd6fd3142711478fc upstream.
syzbot reported a f2fs bug as below:
BUG: memory leak
unreferenced object 0xffff888127f70830 (size 16):
comm "syz.0.23", pid 6144, jiffies 4294943712
hex dump (first 16 bytes):
3c af 57 72 5b e6 8f ad 6e 8e fd 33 42 39 03 ff <.Wr[...n..3B9..
backtrace (crc 925f8a80):
kmemleak_alloc_recursive include/linux/kmemleak.h:44 [inline]
slab_post_alloc_hook mm/slub.c:4520 [inline]
slab_alloc_node mm/slub.c:4844 [inline]
__do_kmalloc_node mm/slub.c:5237 [inline]
__kmalloc_noprof+0x3bd/0x560 mm/slub.c:5250
kmalloc_noprof include/linux/slab.h:954 [inline]
fscrypt_setup_filename+0x15e/0x3b0 fs/crypto/fname.c:364
f2fs_setup_filename+0x52/0xb0 fs/f2fs/dir.c:143
f2fs_rename+0x159/0xca0 fs/f2fs/namei.c:961
f2fs_rename2+0xd5/0xf20 fs/f2fs/namei.c:1308
vfs_rename+0x7ff/0x1250 fs/namei.c:6026
filename_renameat2+0x4f4/0x660 fs/namei.c:6144
__do_sys_renameat2 fs/namei.c:6173 [inline]
__se_sys_renameat2 fs/namei.c:6168 [inline]
__x64_sys_renameat2+0x59/0x80 fs/namei.c:6168
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xe2/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7fThe root cause is in commit 40b2d55e0452 ("f2fs: fix to create selinux label during whiteout initialization"), we added a call to f2fs_setup_filename() without a matching call to f2fs_free_filename(), fix it.
--- fs/f2fs/namei.c | 1 + 1 file changed, 1 insertion(+)
fs/f2fs/namei.c +1 -0
@@ -940,6 +940,7 @@ static int f2fs_rename(struct mnt_idmapreturn err; err =f2fs_create_whiteout (idmap, old_dir, &whiteout, &fname); +f2fs_free_filename (&fname);if (err)return err; }
Greg Kroah-Hartman
maintainerPATCH 120/166 ALSA: 6fire: fix use-after-free on disconnect
In reply to Greg Kroah-Hartman6.6-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
@@ -53,11 +53,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 ; - } } }
@@ -170,6 +165,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 */
@@ -180,8 +176,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 147/166 fuse: reject oversized dirents in page cache
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Samuel Page <[email protected]>
commit 51a8de6c50bf947c8f534cd73da4c8f0a13e7bed upstream.
fuse_add_dirent_to_cache() computes a serialized dirent size from the server-controlled namelen field and copies the dirent into a single page-cache page. The existing logic only checks whether the dirent fits in the remaining space of the current page and advances to a fresh page if not. It never checks whether the dirent itself exceeds PAGE_SIZE.
As a result, a malicious FUSE server can return a dirent with namelen=4095, producing a serialized record size of 4120 bytes. On 4 KiB page systems this causes memcpy() to overflow the cache page by 24 bytes into the following kernel page.
Reject dirents that cannot fit in a single page before copying them into the readdir cache.
--- fs/fuse/readdir.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/fuse/readdir.c +4 -0
@@ -41,6 +41,10 @@ static void fuse_add_dirent_to_cache(strunsigned int offset;void *addr; +/* Dirent doesn't fit in readdir cache page? Skip caching. */ +if (reclen >PAGE_SIZE ) +return ; +spin_lock (&fi->rdc.lock);/* * Is cache already completed? Or this entry does not go at the end of
Greg Kroah-Hartman
maintainerPATCH 148/166 fuse: Check for large folio with SPLICE_F_MOVE
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bernd Schubert <[email protected]>
commit 59ba47b6be9cd0146ef9a55c6e32e337e11e7625 upstream.
xfstest generic/074 and generic/075 complain result in kernel warning messages / page dumps.
This is easily reproducible (on 6.19) with CONFIG_TRANSPARENT_HUGEPAGE_SHMEM_HUGE_ALWAYS=y CONFIG_TRANSPARENT_HUGEPAGE_TMPFS_HUGE_ALWAYS=y
This just adds a test for large folios fuse_try_move_folio with the same page copy fallback, but to avoid the warnings from fuse_check_folio().
--- fs/fuse/dev.c | 3 +++ 1 file changed, 3 insertions(+)
fs/fuse/dev.c +3 -0
@@ -823,6 +823,9 @@ static int fuse_try_move_page(struct fusfolio_clear_mappedtodisk (newfolio); +if (folio_test_large (newfolio)) + goto out_fallback_unlock; +if (fuse_check_folio (newfolio) !=0 ) goto out_fallback_unlock;
Greg Kroah-Hartman
maintainerPATCH 149/166 fuse: quiet down complaints in fuse_conn_limit_write
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darrick J. Wong <[email protected]>
commit 129a45f9755a89f573c6a513a6b9e3d234ce89b0 upstream.
gcc 15 complains about an uninitialized variable val that is passed by reference into fuse_conn_limit_write:
control.c: In function ‘fuse_conn_congestion_threshold_write’:
include/asm-generic/rwonce.h:55:37: warning: ‘val’ may be used uninitialized [-Wmaybe-uninitialized]
55 | *(volatile typeof(x) *)&(x) = (val); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
include/asm-generic/rwonce.h:61:9: note: in expansion of macro ‘__WRITE_ONCE’
61 | __WRITE_ONCE(x, val); \
| ^~~~~~~~~~~~
control.c:178:9: note: in expansion of macro ‘WRITE_ONCE’
178 | WRITE_ONCE(fc->congestion_threshold, val);
| ^~~~~~~~~~ control.c:166:18: note: ‘val’ was declared here
166 | unsigned val;
| ^~~
Unfortunately there's enough macro spew involved in kstrtoul_from_user that I think gcc gives up on its analysis and sprays the above warning. AFAICT it's not actually a bug, but we could just zero-initialize the variable to enable using -Wmaybe-uninitialized to find real problems.
Previously we would use some weird uninitialized_var annotation to quiet down the warnings, so clearly this code has been like this for quite some time.
--- fs/fuse/control.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/fuse/control.c +2 -2
@@ -120,7 +120,7 @@ static ssize_t fuse_conn_max_background_const char __user *buf, size_t count, loff_t *ppos) { - unsigned val; + unsigned int val = 0;ssize_t ret; ret = fuse_conn_limit_write(file, buf, count, ppos, &val,
@@ -162,7 +162,7 @@ static ssize_t fuse_conn_congestion_threconst char __user *buf, size_t count, loff_t *ppos) { - unsigned val; + unsigned int val = 0;struct fuse_conn *fc;ssize_t ret;
Greg Kroah-Hartman
maintainerPATCH 150/166 smb: server: fix active_num_conn leak on transport allocation failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Bommarito <[email protected]>
commit 6551300dc452ac16a855a83dbd1e74899542d3b3 upstream.
Commit 77ffbcac4e56 ("smb: server: fix leak of active_num_conn in ksmbd_tcp_new_connection()") addressed the kthread_run() failure path. The earlier alloc_transport() == NULL path in the same function has the same leak, is reachable pre-authentication via any TCP connect to port 445, and was empirically reproduced on UML (ARCH=um, v7.0-rc7): a small number of forced allocation failures were sufficient to put ksmbd into a state where every subsequent connection attempt was rejected for the remainder of the boot.
ksmbd_kthread_fn() increments active_num_conn before calling ksmbd_tcp_new_connection() and discards the return value, so when alloc_transport() returns NULL the socket is released and -ENOMEM returned without decrementing the counter. Each such failure permanently consumes one slot from the max_connections pool; once cumulative failures reach the cap, atomic_inc_return() hits the threshold on every subsequent accept and every new connection is rejected. The counter is only reset by module reload.
An unauthenticated remote attacker can drive the server toward the memory pressure that makes alloc_transport() fail by holding open connections with large RFC1002 lengths up to MAX_STREAM_PROT_LEN (0x00FFFFFF); natural transient allocation failures on a loaded host produce the same drift more slowly.
Mirror the existing rollback pattern in ksmbd_kthread_fn(): on the alloc_transport() failure path, decrement active_num_conn gated on server_conf.max_connections.
Repro details: with the patch reverted, forced alloc_transport() NULL returns leaked counter slots and subsequent connection attempts -- including legitimate connects issued after the forced-fail window had closed -- were all rejected with "Limit the maximum number of connections". With this patch applied, the same connect sequence produces no rejections and the counter cycles cleanly between zero and one on every accept.
--- fs/smb/server/transport_tcp.c | 2 ++ 1 file changed, 2 insertions(+)
fs/smb/server/transport_tcp.c +2 -0
@@ -203,6 +203,8 @@ static int ksmbd_tcp_new_connection(stru t =alloc_transport (client_sk);if (!t) {sock_release (client_sk); +if (server_conf.max_connections) +atomic_dec (&active_num_conn);return -ENOMEM ; }
Greg Kroah-Hartman
maintainerPATCH 151/166 smb: server: fix max_connections off-by-one in tcp accept path
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: DaeMyung Kang <[email protected]>
commit ce23158bfe584bd90d1918f279fdf9de57802012 upstream.
The global max_connections check in ksmbd's TCP accept path counts the newly accepted connection with atomic_inc_return(), but then rejects the connection when the result is greater than or equal to server_conf.max_connections.
That makes the effective limit one smaller than configured. For example:
- max_connections=1 rejects the first connection
- max_connections=2 allows only one connection
The per-IP limit in the same function uses <= correctly because it counts only pre-existing connections. The global limit instead checks the post-increment total, so it should reject only when that total exceeds the configured maximum.
Fix this by changing the comparison from >= to >, so exactly max_connections simultaneous connections are allowed and the next one is rejected. This matches the documented meaning of max_connections in fs/smb/server/ksmbd_netlink.h as the "Number of maximum simultaneous connections".
--- fs/smb/server/transport_tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/server/transport_tcp.c +1 -1
@@ -298,7 +298,7 @@ static int ksmbd_kthread_fn(void *p) skip_max_ip_conns_limit:if (server_conf.max_connections && -atomic_inc_return (&active_num_conn) >= server_conf.max_connections) { +atomic_inc_return (&active_num_conn) > server_conf.max_connections) {pr_info_ratelimited ("Limit the maximum number of connections(%u)\n" ,atomic_read (&active_num_conn));atomic_dec (&active_num_conn);
Greg Kroah-Hartman
maintainerPATCH 152/166 smb: client: require a full NFS mode SID before reading mode bits
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Bommarito <[email protected]>
commit 2757ad3e4b6f9e0fed4c7739594e702abc5cab21 upstream.
parse_dacl() treats an ACE SID matching sid_unix_NFS_mode as an NFS mode SID and reads sid.sub_auth[2] to recover the mode bits.
That assumes the ACE carries three subauthorities, but compare_sids() only compares min(a, b) subauthorities. A malicious server can return an ACE with num_subauth = 2 and sub_auth[] = {88, 3}, which still matches sid_unix_NFS_mode and then drives the sub_auth[2] read four bytes past the end of the ACE.
Require num_subauth >= 3 before treating the ACE as an NFS mode SID. This keeps the fix local to the special-SID mode path without changing compare_sids() semantics for the rest of cifsacl.
--- fs/smb/client/cifsacl.c | 1 + 1 file changed, 1 insertion(+)
fs/smb/client/cifsacl.c +1 -0
@@ -832,6 +832,7 @@ static void parse_dacl(struct smb_acl *pdump_ace (ppace[i], end_of_acl);#endif if (mode_from_special_sid && + ppace[i]->sid.num_subauth >=3 && (compare_sids (&(ppace[i]->sid), &sid_unix_NFS_mode) ==0 )) {/*
Greg Kroah-Hartman
maintainerPATCH 121/166 bcache: fix cached_dev.sb_bio use-after-free and crash
In reply to Greg Kroah-Hartman6.6-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
@@ -1367,6 +1367,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 122/166 media: as102: fix to not free memory after the device is registered in as102_usb_probe()
In reply to Greg Kroah-Hartman6.6-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
@@ -403,7 +403,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 123/166 nilfs2: fix NULL i_assoc_inode dereference in nilfs_mdt_save_to_shadow_map
In reply to Greg Kroah-Hartman6.6-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
@@ -526,6 +526,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 124/166 media: vidtv: fix pass-by-value structs causing MSAN warnings
In reply to Greg Kroah-Hartman6.6-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
@@ -90,7 +90,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.
@@ -101,6 +101,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 125/166 media: hackrf: fix to not free memory after the device is registered in hackrf_probe()
In reply to Greg Kroah-Hartman6.6-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
@@ -1485,7 +1485,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));
@@ -1514,8 +1514,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 126/166 Revert "perf unwind-libdw: Fix invalid reference counts"
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kenta Akagi <[email protected]>
This reverts commit eddddf4ed7f69697cb54e714e773f764c8d3b67e.
Upstream commit f815fc0c66e7 ("perf unwind-libdw: Fix invalid reference counts"), was backported to v6.6.128 as eddddf4ed7f6.
However, this commit depends on map_symbol__exit, which was introduced in v6.7 as commit 56e144fe9826 ("perf mem_info: Add and use map_symbol__exit and addr_map_symbol__exit") and is absent in v6.6.y. This results in a build failure.
This is a revert of a backport, so there is no upstream commit.
--- tools/perf/util/unwind-libdw.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
tools/perf/util/unwind-libdw.c +2 -5
@@ -133,8 +133,8 @@ static int entry(u64 ip, struct unwind_info *ui) } e->ip = ip; - e->ms.maps =maps__get (al.maps); - e->ms.map =map__get (al.map); + e->ms.maps = al.maps; + e->ms.map = al.map; e->ms.sym = al.sym; pr_debug("unwind: %s:ip = 0x%" PRIx64 " (0x%" PRIx64 ")\n",
@@ -319,9 +319,6 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg,if (err)pr_debug ("unwind: failed with '%s'\n" ,dwfl_errmsg (-1 )); -for (i =0 ; i < ui->idx; i++) -map_symbol__exit (&ui->entries[i].ms); -dwfl_end (ui->dwfl);free (ui);return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 117/166 media: vidtv: fix nfeeds state corruption on start_streaming failure
In reply to Greg Kroah-Hartman6.6-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
@@ -237,8 +237,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 154/166 ksmbd: fix out-of-bounds write in smb2_get_ea() EA alignment
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tristan Madani <[email protected]>
commit 30010c952077a1c89ecdd71fc4d574c75a8f5617 upstream.
smb2_get_ea() applies 4-byte alignment padding via memset() after writing each EA entry. The bounds check on buf_free_len is performed before the value memcpy, but the alignment memset fires unconditionally afterward with no check on remaining space.
When the EA value exactly fills the remaining buffer (buf_free_len == 0 after value subtraction), the alignment memset writes 1-3 NUL bytes past the buf_free_len boundary. In compound requests where the response buffer is shared across commands, the first command (e.g., READ) can consume most of the buffer, leaving a tight remainder for the QUERY_INFO EA response. The alignment memset then overwrites past the physical kvmalloc allocation into adjacent kernel heap memory.
Add a bounds check before the alignment memset to ensure buf_free_len can accommodate the padding bytes.
This is the same bug pattern fixed by commit beef2634f81f ("ksmbd: fix potencial OOB in get_file_all_info() for compound requests") and commit fda9522ed6af ("ksmbd: fix OOB write in QUERY_INFO for compound requests"), both of which added bounds checks before unconditional writes in QUERY_INFO response handlers.
--- fs/smb/server/smb2pdu.c | 2 ++ 1 file changed, 2 insertions(+)
fs/smb/server/smb2pdu.c +2 -0
@@ -4807,6 +4807,8 @@ static int smb2_get_ea(struct ksmbd_work/* align next xattr entry at 4 byte bundary */ alignment_bytes = ((next_offset +3 ) & ~3 ) - next_offset;if (alignment_bytes) { +if (buf_free_len < alignment_bytes) +break ;memset (ptr,'\0' , alignment_bytes); ptr += alignment_bytes; next_offset += alignment_bytes;
Greg Kroah-Hartman
maintainerPATCH 163/166 crypto: ccp: Dont attempt to copy PDH cert to userspace if PSP command failed
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit e76239fed3cffd6d304d8ca3ce23984fd24f57d3 upstream.
When retrieving the PDH cert, don't attempt to copy the blobs to userspace if the firmware command failed. If the failure was due to an invalid length, i.e. the userspace buffer+length was too small, copying the number of bytes _firmware_ requires will overflow the kernel-allocated buffer and leak data to userspace.
BUG: KASAN: slab-out-of-bounds in instrument_copy_to_user ../include/linux/instrumented.h:129 [inline] BUG: KASAN: slab-out-of-bounds in _inline_copy_to_user ../include/linux/uaccess.h:205 [inline] BUG: KASAN: slab-out-of-bounds in _copy_to_user+0x66/0xa0 ../lib/usercopy.c:26 Read of size 2084 at addr ffff8885c4ab8aa0 by task syz.0.186/21033 CPU: 51 UID: 0 PID: 21033 Comm: syz.0.186 Tainted: G U O 7.0.0-smp-DEV #28 PREEMPTLAZY Tainted: [U]=USER, [O]=OOT_MODULE Hardware name: Google, Inc. Arcadia_IT_80/Arcadia_IT_80, BIOS 34.84.12-0 11/17/2025 Call Trace: <TASK> dump_stack_lvl+0xc5/0x110 ../lib/dump_stack.c:120 print_address_description ../mm/kasan/report.c:378 [inline] print_report+0xbc/0x260 ../mm/kasan/report.c:482 kasan_report+0xa2/0xe0 ../mm/kasan/report.c:595 check_region_inline ../mm/kasan/generic.c:-1 [inline] kasan_check_range+0x264/0x2c0 ../mm/kasan/generic.c:200 instrument_copy_to_user ../include/linux/instrumented.h:129 [inline] _inline_copy_to_user ../include/linux/uaccess.h:205 [inline] _copy_to_user+0x66/0xa0 ../lib/usercopy.c:26 copy_to_user ../include/linux/uaccess.h:236 [inline] sev_ioctl_do_pdh_export+0x3d3/0x7c0 ../drivers/crypto/ccp/sev-dev.c:2347 sev_ioctl+0x2a2/0x490 ../drivers/crypto/ccp/sev-dev.c:2568 vfs_ioctl ../fs/ioctl.c:51 [inline] __do_sys_ioctl ../fs/ioctl.c:597 [inline] __se_sys_ioctl+0x11d/0x1b0 ../fs/ioctl.c:583 do_syscall_x64 ../arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xe0/0x800 ../arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x76/0x7e </TASK>
WARN if the driver says the command succeeded, but the firmware error code says otherwise, as __sev_do_cmd_locked() is expected to return -EIO on any firwmware error.
--- drivers/crypto/ccp/sev-dev.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/crypto/ccp/sev-dev.c +7 -1
@@ -1046,7 +1046,10 @@ static int sev_ioctl_do_pdh_export(struc cmd: ret =__sev_do_cmd_locked (SEV_CMD_PDH_CERT_EXPORT , &data, &argp->error); -/* If we query the length, FW responded with expected data. */ +/* +* Firmware will return the length of the blobs (either the minimum +* required length or the actual length written), return 'em to the user. +*/ input.cert_chain_len = data.cert_chain_len; input.pdh_cert_len = data.pdh_cert_len;
@@ -1055,6 +1058,9 @@ cmd: goto e_free_cert; } +if (ret ||WARN_ON_ONCE (argp->error)) + goto e_free_cert; +if (pdh_blob) {if (copy_to_user (input_pdh_cert_address, pdh_blob, input.pdh_cert_len)) {
Greg Kroah-Hartman
maintainerPATCH 164/166 crypto: ccp: Dont attempt to copy ID to userspace if PSP command failed
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 4f685dbfa87c546e51d9dc6cab379d20f275e114 upstream.
When retrieving the ID for the CPU, don't attempt to copy the ID blob to userspace if the firmware command failed. If the failure was due to an invalid length, i.e. the userspace buffer+length was too small, copying the number of bytes _firmware_ requires will overflow the kernel-allocated buffer and leak data to userspace.
BUG: KASAN: slab-out-of-bounds in instrument_copy_to_user ../include/linux/instrumented.h:129 [inline] BUG: KASAN: slab-out-of-bounds in _inline_copy_to_user ../include/linux/uaccess.h:205 [inline] BUG: KASAN: slab-out-of-bounds in _copy_to_user+0x66/0xa0 ../lib/usercopy.c:26 Read of size 64 at addr ffff8881867f5960 by task syz.0.906/24388 CPU: 130 UID: 0 PID: 24388 Comm: syz.0.906 Tainted: G U O 7.0.0-smp-DEV #28 PREEMPTLAZY Tainted: [U]=USER, [O]=OOT_MODULE Hardware name: Google, Inc. Arcadia_IT_80/Arcadia_IT_80, BIOS 12.62.0-0 11/19/2025 Call Trace: <TASK> dump_stack_lvl+0xc5/0x110 ../lib/dump_stack.c:120 print_address_description ../mm/kasan/report.c:378 [inline] print_report+0xbc/0x260 ../mm/kasan/report.c:482 kasan_report+0xa2/0xe0 ../mm/kasan/report.c:595 check_region_inline ../mm/kasan/generic.c:-1 [inline] kasan_check_range+0x264/0x2c0 ../mm/kasan/generic.c:200 instrument_copy_to_user ../include/linux/instrumented.h:129 [inline] _inline_copy_to_user ../include/linux/uaccess.h:205 [inline] _copy_to_user+0x66/0xa0 ../lib/usercopy.c:26 copy_to_user ../include/linux/uaccess.h:236 [inline] sev_ioctl_do_get_id2+0x361/0x490 ../drivers/crypto/ccp/sev-dev.c:2222 sev_ioctl+0x25f/0x490 ../drivers/crypto/ccp/sev-dev.c:2575 vfs_ioctl ../fs/ioctl.c:51 [inline] __do_sys_ioctl ../fs/ioctl.c:597 [inline] __se_sys_ioctl+0x11d/0x1b0 ../fs/ioctl.c:583 do_syscall_x64 ../arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xe0/0x800 ../arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x76/0x7e </TASK>
WARN if the driver says the command succeeded, but the firmware error code says otherwise, as __sev_do_cmd_locked() is expected to return -EIO on any firwmware error.
--- drivers/crypto/ccp/sev-dev.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/crypto/ccp/sev-dev.c +3 -0
@@ -932,6 +932,9 @@ static int sev_ioctl_do_get_id2(struct s goto e_free; } +if (ret ||WARN_ON_ONCE (argp->error)) + goto e_free; +if (id_blob) {if (copy_to_user (input_address, id_blob, data.len)) { ret = -EFAULT ;
Greg Kroah-Hartman
maintainerPATCH 165/166 rxrpc: Fix missing validation of ticket length in non-XDR key preparsing
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anderson Nascimento <[email protected]>
commit ac33733b10b484d666f97688561670afd5861383 upstream.
In rxrpc_preparse(), there are two paths for parsing key payloads: the XDR path (for large payloads) and the non-XDR path (for payloads <= 28 bytes). While the XDR path (rxrpc_preparse_xdr_rxkad()) correctly validates the ticket length against AFSTOKEN_RK_TIX_MAX, the non-XDR path fails to do so.
This allows an unprivileged user to provide a very large ticket length. When this key is later read via rxrpc_read(), the total token size (toksize) calculation results in a value that exceeds AFSTOKEN_LENGTH_MAX, triggering a WARN_ON().
[ 2001.302904] WARNING: CPU: 2 PID: 2108 at net/rxrpc/key.c:778 rxrpc_read+0x109/0x5c0 [rxrpc]
Fix this by adding a check in the non-XDR parsing path of rxrpc_preparse() to ensure the ticket length does not exceed AFSTOKEN_RK_TIX_MAX, bringing it into parity with the XDR parsing logic.
--- net/rxrpc/key.c | 4 ++++ 1 file changed, 4 insertions(+)
net/rxrpc/key.c +4 -0
@@ -340,6 +340,10 @@ static int rxrpc_preparse(struct key_preif (v1->security_index !=RXRPC_SECURITY_RXKAD ) goto error; + ret = -EKEYREJECTED ; +if (v1->ticket_length >AFSTOKEN_RK_TIX_MAX ) + goto error; + plen =sizeof (*token->kad) + v1->ticket_length; prep->quotalen += plen +sizeof (*token);