6.6.158-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 300/1193 ALSA: hda/realtek: Fix speakers on MECHREVO WUJIE Series
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Bowen <[email protected]>
[ Upstream commit 9064637fb2a80b43105900a47d414997630e5b6b ]
The internal speakers on the MECHREVO WUJIE Series are silent, while the headphone output works correctly.
The BIOS reports NID 0x1b on the Realtek ALC233 codec as unconnected with pin configuration 0x411111f0. However, the pin is connected to an internal speaker.
Overriding NID 0x1b with 0x90170150 makes the HDA generic parser detect both 0x14 and 0x1b as speaker outputs and restores internal speaker playback.
Add a pin configuration fixup for the affected PCI SSID c011:1d05.
Tested on a MECHREVO WUJIE Series laptop with board WUJIE Series-Lark4-LNL and firmware EM_LNL326_V1.0.23.
--- sound/pci/hda/patch_realtek.c | 9 +++++++++ 1 file changed, 9 insertions(+)
sound/pci/hda/patch_realtek.c +9 -0
@@ -7453,6 +7453,7 @@ enum {ALC275_FIXUP_DELL_XPS ,ALC293_FIXUP_LENOVO_SPK_NOISE ,ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY , +ALC233_FIXUP_WUJIE_SPEAKERS ,ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED ,ALC255_FIXUP_DELL_SPK_NOISE , ALC225_FIXUP_DISABLE_MIC_VREF,
@@ -7663,6 +7664,13 @@ static void alc287_fixup_lenovo_14irp8_duetitl(struct hda_codec *codec, }static const struct hda_fixup alc269_fixups[] = { + [ALC233_FIXUP_WUJIE_SPEAKERS ] = { + .type =HDA_FIXUP_PINS , + .v.pins = (const struct hda_pintbl []) { + {0x1b ,0x90170150 },/* internal speaker */ + { } + }, + }, [ALC269_FIXUP_GPIO2 ] = { .type =HDA_FIXUP_FUNC , .v.func = alc_fixup_gpio2,
@@ -10674,6 +10682,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x8086 ,0x2080 ,"Intel NUC 8 Rugged" ,ALC256_FIXUP_INTEL_NUC8_RUGGED ),SND_PCI_QUIRK (0x8086 ,0x2081 ,"Intel NUC 10" ,ALC256_FIXUP_INTEL_NUC10 ),SND_PCI_QUIRK (0x8086 ,0x3038 ,"Intel NUC 13" ,ALC295_FIXUP_CHROME_BOOK ), +SND_PCI_QUIRK (0xc011 ,0x1d05 ,"MECHREVO WUJIE Series" ,ALC233_FIXUP_WUJIE_SPEAKERS ),SND_PCI_QUIRK (0xf111 ,0x0001 ,"Framework Laptop" ,ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0xf111 ,0x0006 ,"Framework Laptop" ,ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE ), SND_PCI_QUIRK(0xf111, 0x0009, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 301/1193 btrfs: only account delalloc bytes for regular file inodes in btrfs_getattr()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Chen <[email protected]>
[ Upstream commit 9411aafdf352b8d72668732af5a37dcb27383e25 ]
btrfs_getattr() unconditionally reads BTRFS_I(inode)->new_delalloc_bytes and adds it (sector-aligned) to stat->blocks for every inode type. However, new_delalloc_bytes lives in a union with last_dir_index_offset:
union {
u64 new_delalloc_bytes; /* files only */
u64 last_dir_index_offset; /* directories only */
};
For a directory inode this memory holds last_dir_index_offset, which is set during directory logging (e.g. flush_dir_items_batch()) to the offset of the last logged BTRFS_DIR_INDEX_KEY. That offset grows with the number of entries ever created in the directory (dir indexes are monotonic and never reused), so it can be arbitrarily large.
As a result, after a directory has been logged (e.g. via an fsync that triggers directory logging), btrfs_getattr() reports inflated st_blocks for that directory. The inflation is purely in-core and disappears after the inode is evicted and reloaded (btrfs_alloc_inode() zeroes the union), e.g. after a remount.
Reproducer (on a btrfs filesystem):
D=/mnt/btrfs/d
mkdir -p $D
for i in $(seq 1 20000); do touch $D/f$i; done
sync # commit, push dir index high
touch $D/trigger # dirty the dir in a new transaction
xfs_io -c fsync $D # log the directory -> sets last_dir_index_offset
stat -c '%b' $D # st_blocks is now inflated (e.g. 40)
# umount + mount -> st_blocks drops back to the correct value
The evict path already knows this union is type-dependent and guards the corresponding WARN_ON with !S_ISDIR() in btrfs_destroy_inode(); only btrfs_getattr() was missing the equivalent check.
Only read new_delalloc_bytes for regular files, which are the only inodes that ever set it.
--- fs/btrfs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/inode.c +2 -1
@@ -8841,7 +8841,8 @@ static int btrfs_getattr(struct mnt_idmap *idmap, stat->dev =BTRFS_I (inode)->root->anon_dev;spin_lock (&BTRFS_I (inode)->lock); - delalloc_bytes =BTRFS_I (inode)->new_delalloc_bytes; + delalloc_bytes =S_ISREG (inode->i_mode) ? +BTRFS_I (inode)->new_delalloc_bytes :0 ; inode_bytes =inode_get_bytes (inode);spin_unlock (&BTRFS_I (inode)->lock); stat->blocks = (ALIGN(inode_bytes, blocksize) +
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 302/1193 btrfs: fix use-after-free on reloc root after error in insert_dirty_subvol()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit 83201804efa4a5168be754e1dfc9b2faee760cac ]
If during relocation we fail in insert_dirty_subvol() because btrfs_update_reloc_root() returned an error, we will leave a root's reloc_root field pointing to a reloc root that was freed instead of NULL, resulting later in a use-after-free, or double free attempt during unmount.
The sequence of steps is this:
1) During relocation the call to btrfs_update_reloc_root() in insert_dirty_subvol() fails, so insert_dirty_subvol() returns the error to merge_reloc_root() without adding the root to the list rc->dirty_subvol_roots;
2) Then merge_reloc_root() aborts the current transaction because insert_dirty_subvol() returned an error;
3) Up the call chain, merge_reloc_roots() gets the error, adds the reloc root for root X to the local reloc_roots list and jumps to the 'out' label, where it calls free_reloc_roots() to free all the reloc roots in the local reloc_roots list. This frees the reloc root for root X;
4) We go up the call chain to relocate_block_group() which calls clean_dirty_subvols() to go over dirty roots and set their ->reloc_root field to NULL, but root X is not in the dirty_subvol_roots list, so its ->reloc_root still points to a reloc root;
5) Relocation finishes, with an error and a transaction abort, but the ->reloc_root field for root X still points to the reloc root that was freed in step 3;
6) When unmounting the fs we end up calling:
btrfs_free_fs_roots()
btrfs_drop_and_free_fs_root()
--> calls btrfs_put_root() against root X's ->reloc_root
which is not NULL and points to the already freed reloc root in step 4 above
Resulting in a use-after-free to a double free attempt.
Syzbot reported this with the following dmesg/syslog:
[ 106.004389][ T5339] BTRFS error (device loop0 state A): Transaction aborted (error -5) [ 106.014266][ T5339] BTRFS: error (device loop0 state A) in merge_reloc_root:1655: errno=-5 IO failure [ 106.021891][ T1061] BTRFS error (device loop0 state A): error while writing out transaction: -5 [ 106.026964][ T1061] BTRFS warning (device loop0 state A): Skipping commit of aborted transaction. [ 106.033807][ T5340] BTRFS error (device loop0 state A): bdev /dev/loop0 errs: wr 3, rd 0, flush 0, corrupt 0, gen 0 [ 106.039265][ T1061] BTRFS: error (device loop0 state A) in cleanup_transaction:2067: errno=-5 IO failure [ 106.044382][ T5339] BTRFS info (device loop0 state EA): forced readonly [ 106.074329][ T5339] BTRFS: error (device loop0 state EA) in merge_reloc_roots:1887: errno=-5 IO failure [ 106.081004][ T5356] BTRFS info (device loop0 state EA): scrub: started on devid 1 [ 106.085611][ T5339] BTRFS info (device loop0 state EA): balance: ended with status: -30 [ 106.089517][ T5356] BTRFS info (device loop0 state EA): scrub: not finished on devid 1 with status: -30 [ 106.662365][ T5338] BTRFS info (device loop0 state EA): last unmount of filesystem 3a375e4e-b156-4d76-a2ad-16e198ce1409 [ 106.682946][ T5338] ================================================================== [ 106.686574][ T5338] BUG: KASAN: slab-use-after-free in btrfs_put_root+0x2f/0x250 [ 106.690090][ T5338] Write of size 4 at addr ffff88803f978630 by task syz.0.0/5338 [ 106.693173][ T5338] [ 106.694279][ T5338] CPU: 0 UID: 0 PID: 5338 Comm: syz.0.0 Not tainted syzkaller #0 PREEMPT(full) [ 106.694293][ T5338] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 [ 106.694300][ T5338] Call Trace: [ 106.694308][ T5338] <TASK> [ 106.694314][ T5338] dump_stack_lvl+0xe8/0x150 [ 106.694331][ T5338] print_address_description+0x55/0x1e0 [ 106.694343][ T5338] ? btrfs_put_root+0x2f/0x250 [ 106.694358][ T5338] print_report+0x58/0x70 [ 106.694368][ T5338] kasan_report+0x117/0x150 [ 106.694384][ T5338] ? btrfs_put_root+0x2f/0x250 [ 106.694399][ T5338] kasan_check_range+0x264/0x2c0 [ 106.694416][ T5338] btrfs_put_root+0x2f/0x250 [ 106.694430][ T5338] btrfs_drop_and_free_fs_root+0x160/0x210 [ 106.694447][ T5338] btrfs_free_fs_roots+0x2f9/0x3c0 [ 106.694464][ T5338] ? __pfx_btrfs_free_fs_roots+0x10/0x10 [ 106.694479][ T5338] ? free_root_pointers+0x5bf/0x5f0 [ 106.694494][ T5338] close_ctree+0x798/0x12d0 [ 106.694511][ T5338] ? __pfx_close_ctree+0x10/0x10 [ 106.694526][ T5338] ? _raw_spin_unlock_irqrestore+0x74/0x80 [ 106.694599][ T5338] ? rcu_preempt_deferred_qs_irqrestore+0x906/0xbc0 [ 106.694620][ T5338] ? __rcu_read_unlock+0x83/0xe0 [ 106.694636][ T5338] ? btrfs_put_super+0x48/0x1c0 [ 106.694652][ T5338] ? __pfx_btrfs_put_super+0x10/0x10 [ 106.694667][ T5338] generic_shutdown_super+0x13d/0x2d0 [ 106.694682][ T5338] kill_anon_super+0x3b/0x70 [ 106.694695][ T5338] btrfs_kill_super+0x41/0x50 [ 106.694710][ T5338] deactivate_locked_super+0xbc/0x130 [ 106.694722][ T5338] cleanup_mnt+0x437/0x4d0 [ 106.694736][ T5338] ? _raw_spin_unlock_irq+0x23/0x50 [ 106.694752][ T5338] task_work_run+0x1d9/0x270 [ 106.694769][ T5338] ? __pfx_task_work_run+0x10/0x10 [ 106.694784][ T5338] ? do_raw_spin_unlock+0x4d/0x210 [ 106.694802][ T5338] do_exit+0x70f/0x22c0 [ 106.694817][ T5338] ? trace_irq_disable+0x3b/0x140 [ 106.694835][ T5338] ? __pfx_do_exit+0x10/0x10 [ 106.694848][ T5338] ? preempt_schedule_thunk+0x16/0x30 [ 106.694863][ T5338] ? preempt_schedule_common+0x82/0xd0 [ 106.694878][ T5338] ? preempt_schedule_thunk+0x16/0x30 [ 106.694892][ T5338] do_group_exit+0x21b/0x2d0 [ 106.694906][ T5338] ? entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 106.694918][ T5338] __x64_sys_exit_group+0x3f/0x40 [ 106.694932][ T5338] x64_sys_call+0x221a/0x2240 [ 106.694944][ T5338] do_syscall_64+0x174/0x580 [ 106.694954][ T5338] ? clear_bhb_loop+0x40/0x90 [ 106.694967][ T5338] entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 106.694978][ T5338] RIP: 0033:0x7f958ef9ce59 [ 106.694988][ T5338] Code: Unable to access opcode bytes at 0x7f958ef9ce2f. [ 106.694994][ T5338] RSP: 002b:00007fffd4058318 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 [ 106.695008][ T5338] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f958ef9ce59 [ 106.695015][ T5338] RDX: 00007f958c3f8000 RSI: 0000000000000000 RDI: 0000000000000000 [ 106.695022][ T5338] RBP: 0000000000000003 R08: 0000000000000000 R09: 00007f958f1e73e0 [ 106.695028][ T5338] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 [ 106.695034][ T5338] R13: 00007f958f1e73e0 R14: 0000000000000003 R15: 00007fffd40583d0 [ 106.695046][ T5338] </TASK> [ 106.695050][ T5338] [ 106.821635][ T5338] Allocated by task 1061: [ 106.823446][ T5338] kasan_save_track+0x3e/0x80 [ 106.825498][ T5338] __kasan_kmalloc+0x93/0xb0 [ 106.827381][ T5338] __kmalloc_cache_noprof+0x31c/0x660 [ 106.829525][ T5338] btrfs_alloc_root+0x75/0x930 [ 106.831458][ T5338] read_tree_root_path+0x127/0xb00 [ 106.833556][ T5338] btrfs_read_tree_root+0x34/0x60 [ 106.835553][ T5338] create_reloc_root+0x6b3/0xcb0 [ 106.837556][ T5338] btrfs_init_reloc_root+0x2ec/0x4b0 [ 106.839557][ T5338] record_root_in_trans+0x2ab/0x350 [ 106.841685][ T5338] btrfs_record_root_in_trans+0x15c/0x180 [ 106.844237][ T5338] start_transaction+0x39c/0x1820 [ 106.846638][ T5338] btrfs_finish_one_ordered+0x88e/0x2680 [ 106.849436][ T5338] btrfs_work_helper+0x37b/0xc20 [ 106.851549][ T5338] process_scheduled_works+0xb5d/0x1860 [ 106.853807][ T5338] worker_thread+0xa53/0xfc0 [ 106.855773][ T5338] kthread+0x389/0x470 [ 106.857548][ T5338] ret_from_fork+0x514/0xb70 [ 106.859493][ T5338] ret_from_fork_asm+0x1a/0x30 [ 106.861504][ T5338] [ 106.862527][ T5338] Freed by task 5339: [ 106.864224][ T5338] kasan_save_track+0x3e/0x80 [ 106.866180][ T5338] kasan_save_free_info+0x46/0x50 [ 106.868371][ T5338] __kasan_slab_free+0x5c/0x80 [ 106.870462][ T5338] kfree+0x1c5/0x640 [ 106.872180][ T5338] __del_reloc_root+0x341/0x3b0 [ 106.874290][ T5338] free_reloc_roots+0x5f/0x90 [ 106.876282][ T5338] merge_reloc_roots+0x73f/0x8a0 [ 106.878489][ T5338] relocate_block_group+0xbcc/0xe70 [ 106.880742][ T5338] do_nonremap_reloc+0xa8/0x5b0 [ 106.882885][ T5338] btrfs_relocate_block_group+0x7e6/0xc40 [ 106.885336][ T5338] btrfs_relocate_chunk+0x115/0x820 [ 106.887502][ T5338] __btrfs_balance+0x1db0/0x2ae0 [ 106.889543][ T5338] btrfs_balance+0xaf3/0x11b0 [ 106.891456][ T5338] btrfs_ioctl_balance+0x3d3/0x610 [ 106.893672][ T5338] __se_sys_ioctl+0xfc/0x170 [ 106.895530][ T5338] do_syscall_64+0x174/0x580 [ 106.897518][ T5338] entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 106.900101][ T5338] [ 106.901123][ T5338] The buggy address belongs to the object at ffff88803f978000 [ 106.901123][ T5338] which belongs to the cache kmalloc-4k of size 4096 [ 106.906907][ T5338] The buggy address is located 1584 bytes inside of [ 106.906907][ T5338] freed 4096-byte region [ffff88803f978000, ffff88803f979000) [ 106.912980][ T5338] [ 106.914022][ T5338] The buggy address belongs to the physical page: [ 106.916716][ T5338] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x3f978 [ 106.920390][ T5338] head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 [ 106.923834][ T5338] flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff) [ 106.927104][ T5338] page_type: f5(slab) [ 106.928898][ T5338] raw: 04fff00000000040 ffff88801ac42140 dead000000000122 0000000000000000 [ 106.932507][ T5338] raw: 0000000000000000 0000000800040004 00000000f5000000 0000000000000000 [ 106.936193][ T5338] head: 04fff00000000040 ffff88801ac42140 dead000000000122 0000000000000000 [ 106.939856][ T5338] head: 0000000000000000 0000000800040004 00000000f5000000 0000000000000000 [ 106.943601][ T5338] head: 04fff00000000003 fffffffffffffe01 00000000ffffffff 00000000ffffffff [ 106.947268][ T5338] head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008 [ 106.950988][ T5338] page dumped because: kasan: bad access detected [ 106.953710][ T5338] page_owner tracks the page as allocated [ 106.956198][ T5338] page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd2820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 24, tgid 24 (kworker/u4:2), ts 105728970387, free_ts 29540875453 [ 106.964984][ T5338] post_alloc_hook+0x22d/0x280 [ 106.966956][ T5338] get_page_from_freelist+0x2593/0x2610 [ 106.969307][ T5338] __alloc_frozen_pages_noprof+0x18d/0x380 [ 106.971839][ T5338] allocate_slab+0x77/0x660 [ 106.973709][ T5338] refill_objects+0x339/0x3d0 [ 106.975696][ T5338] __pcs_replace_empty_main+0x321/0x720 [ 106.978136][ T5338] __kmalloc_node_track_caller_noprof+0x572/0x7b0 [ 106.981009][ T5338] __alloc_skb+0x2c1/0x7d0 [ 106.982983][ T5338] nsim_dev_trap_report_work+0x29a/0xb90 [ 106.985356][ T5338] process_scheduled_works+0xb5d/0x1860 [ 106.987710][ T5338] worker_thread+0xa53/0xfc0 [ 106.989847][ T5338] kthread+0x389/0x470 [ 106.991727][ T5338] ret_from_fork+0x514/0xb70 [ 106.993722][ T5338] ret_from_fork_asm+0x1a/0x30 [ 106.995900][ T5338] page last free pid 77 tgid 77 stack trace: [ 106.998479][ T5338] __free_frozen_pages+0xc1c/0xd30 [ 107.000819][ T5338] vfree+0x1d1/0x2f0 [ 107.002631][ T5338] delayed_vfree_work+0x55/0x80 [ 107.004848][ T5338] process_scheduled_works+0xb5d/0x1860 [ 107.007366][ T5338] worker_thread+0xa53/0xfc0 [ 107.009388][ T5338] kthread+0x389/0x470 [ 107.011177][ T5338] ret_from_fork+0x514/0xb70 [ 107.013313][ T5338] ret_from_fork_asm+0x1a/0x30 [ 107.015454][ T5338] [ 107.016460][ T5338] Memory state around the buggy address: [ 107.019052][ T5338] ffff88803f978500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 107.022691][ T5338] ffff88803f978580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 107.026264][ T5338] >ffff88803f978600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 107.029721][ T5338] ^ [ 107.032062][ T5338] ffff88803f978680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 107.035547][ T5338] ffff88803f978700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 107.038865][ T5338] ==================================================================
Fix this by resetting a root's ->reloc_root if we get an error while trying to merge a reloc root.
--- fs/btrfs/relocation.c | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-)
fs/btrfs/relocation.c +33 -9
@@ -1590,6 +1590,17 @@ static int insert_dirty_subvol(struct btrfs_trans_handle *trans,return 0 ; } +static void clear_reloc_root (struct btrfs_root *root) +{ + root->reloc_root =NULL ; +/* +* Need barrier to ensure clear_bit() only happens after +* root->reloc_root = NULL. Pairs with have_reloc_root(). +*/ +smp_wmb (); +clear_bit (BTRFS_ROOT_DEAD_RELOC_TREE , &root->state); +} +static int clean_dirty_subvols (struct reloc_control *rc) {struct btrfs_root *root;
@@ -1604,13 +1615,7 @@ static int clean_dirty_subvols(struct reloc_control *rc)struct btrfs_root *reloc_root = root->reloc_root;list_del_init (&root->reloc_dirty_list); - root->reloc_root =NULL ; -/* -* Need barrier to ensure clear_bit() only happens after -* root->reloc_root = NULL. Pairs with have_reloc_root. -*/ -smp_wmb (); -clear_bit (BTRFS_ROOT_DEAD_RELOC_TREE , &root->state); +clear_reloc_root (root);if (reloc_root) {/* * btrfs_drop_snapshot drops our ref we hold for
@@ -1996,13 +2001,32 @@ void merge_reloc_roots(struct reloc_control *rc) goto out; } ret =merge_reloc_root (rc, root); -btrfs_put_root (root);if (ret) { -if (list_empty (&reloc_root->root_list)) +/* +* Clear the reloc root since below we will call +* free_reloc_roots(), otherwise we leave +* root->reloc_root pointing to a freed reloc +* root and trigger a use-after-free during +* unmount or elsewhere. +*/ +clear_reloc_root (root); +btrfs_put_root (root); +/* +* We are adding the reloc_root to the local +* reloc_roots list, so we add a ref for this +* list which will be dropped below by the call +* to free_reloc_roots(). +*/ +if (list_empty (&reloc_root->root_list)) {list_add_tail (&reloc_root->root_list, &reloc_roots); +btrfs_grab_root (reloc_root); + } +/* Now drop the ref for root->reloc_root. */ +btrfs_put_root (reloc_root); goto out; } +btrfs_put_root (root); }else {if (!IS_ERR (root)) {if (root->reloc_root == reloc_root) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 303/1193 spi: dw-dma: Wait for controller idle before completing Tx
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang YuWei <[email protected]>
[ Upstream commit 0bcd59706aeda8a5d48ba656bab74cb26f2b423e ]
dw_spi_dma_wait_tx_done() polls dw_spi_dma_tx_busy(), which only checks DW_SPI_SR_TF_EMPT. An empty TX FIFO merely means the last data word has been moved into the shift register; the transfer is not complete on the bus until DW_SPI_SR_BUSY is also cleared. As a result the wait can return while the controller is still shifting out the final word.
Any caller that tears down or reconfigures the controller right after the transfer can then lose the tail of the transfer.
The memory-operation path in spi-dw-core.c already waits for both DW_SPI_SR_BUSY == 0 and DW_SPI_SR_TF_EMPT == 1. Use the same completion condition in the DMA path so the transfer is guaranteed to be finished on the bus before the wait returns.
--- drivers/spi/spi-dw-dma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spi/spi-dw-dma.c +2 -1
@@ -281,7 +281,8 @@ static int dw_spi_dma_wait(struct dw_spi *dws, unsigned int len, u32 speed)static inline bool dw_spi_dma_tx_busy (struct dw_spi *dws) { -return !(dw_readl (dws,DW_SPI_SR ) &DW_SPI_SR_TF_EMPT ); +return (dw_readl (dws,DW_SPI_SR ) & + (DW_SPI_SR_BUSY |DW_SPI_SR_TF_EMPT )) !=DW_SPI_SR_TF_EMPT ; } static int dw_spi_dma_wait_tx_done(struct dw_spi *dws,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 304/1193 wifi: iwlwifi: mvm: validate sta_id in BA window status notif
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
[ Upstream commit 6aa77efaea9efea92e3090c35ad348fd759a3cf3 ]
BA_WINDOW_STATUS_NOTIFICATION_ID extracts a 5-bit sta_id from the firmware notification and uses it to index fw_id_to_mac_id[] without bounds checking. Validate sta_id before array access to prevent out-of-bounds indexing.
--- drivers/net/wireless/intel/iwlwifi/mvm/rx.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/rx.c +5 -0
@@ -1059,6 +1059,11 @@ void iwl_mvm_window_status_notif(struct iwl_mvm *mvm,/* get the station */ sta_id = (ratid &BA_WINDOW_STATUS_STA_ID_MSK ) >>BA_WINDOW_STATUS_STA_ID_POS ; +if (IWL_FW_CHECK (mvm, + sta_id >= mvm->fw->ucode_capa.num_stations, +"Invalid sta id (%d) in BA window status notification\n" , + sta_id)) +continue ; sta =rcu_dereference (mvm->fw_id_to_mac_id[sta_id]);if (IS_ERR_OR_NULL (sta))continue ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 278/1193 xen/front-pgdir-shbuf: free grant reference head on errors
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yousef Alhouseen <[email protected]>
[ Upstream commit 678d59219ce0ae883f04c96936222c6168ef1164 ]
grant_references() allocates a private grant-reference head before claiming references for the page directory and, for guest-owned buffers, the data pages. The success path frees the remaining head, but claim failures and grant_refs_for_buffer() errors return immediately.
Unwind through a common exit path so the private grant-reference head is released even when granting fails part-way through setup. The caller still tears down any references already stored in buf->grefs.
Message-ID: <[email protected]>
--- drivers/xen/xen-front-pgdir-shbuf.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/xen/xen-front-pgdir-shbuf.c +8 -4
@@ -447,8 +447,10 @@ static int grant_references(struct xen_front_pgdir_shbuf *buf)unsigned long frame; cur_ref =gnttab_claim_grant_reference (&priv_gref_head); -if (cur_ref <0 ) -return cur_ref; +if (cur_ref <0 ) { + ret = cur_ref; + goto out_free_refs; + } frame =xen_page_to_gfn (virt_to_page (buf->directory +PAGE_SIZE * i));
@@ -459,11 +461,13 @@ static int grant_references(struct xen_front_pgdir_shbuf *buf)if (buf->ops->grant_refs_for_buffer) { ret = buf->ops->grant_refs_for_buffer (buf, &priv_gref_head, j);if (ret) -return ret; + goto out_free_refs; } + ret =0 ; +out_free_refs:gnttab_free_grant_references (priv_gref_head); -return 0 ; +return ret; }/**
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 305/1193 btrfs: fix reloc root cleanup in merge_reloc_roots()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit b78fe9563e2d5ae47805f1e5dc722c91fd30e1f8 ]
If the root we got has zero root refs in its root item, we are resetting the root's ->reloc_root without using barriers like we do everywhere else. Sashiko complained about this while reviewing another patch, and it's correct (see the Link tag below).
Also, we should not clear BTRFS_ROOT_DEAD_RELOC_TREE from the root unless the root points to the reloc root we have.
Fix this by using clear_reloc_root(), which issues the memory barrier after setting the root's ->reloc_root to NULL and before clearing the bit BTRFS_ROOT_DEAD_RELOC_TREE from the root.
--- fs/btrfs/relocation.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
fs/btrfs/relocation.c +2 -3
@@ -2030,11 +2030,10 @@ void merge_reloc_roots(struct reloc_control *rc) }else {if (!IS_ERR (root)) {if (root->reloc_root == reloc_root) { - root->reloc_root =NULL ; +clear_reloc_root (root); +/* Drop the ref for root->reloc_root. */ btrfs_put_root (reloc_root); } -clear_bit (BTRFS_ROOT_DEAD_RELOC_TREE , - &root->state);btrfs_put_root (root); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 306/1193 wifi: iwlwifi: mvm: fix an off-by-1 boundary check
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
[ Upstream commit d77aff138c9ec6c8562f4c2c9f262d3d9c4b4cb8 ]
Before looking at the 11th byte, check the length is big enough.
--- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +1 -1
@@ -3423,7 +3423,7 @@ static void iwl_mvm_check_he_obss_narrow_bw_ru_iter(struct wiphy *wiphy, elem =cfg80211_find_elem (WLAN_EID_EXT_CAPABILITY , ies->data, ies->len); -if (!elem || elem->datalen <10 || +if (!elem || elem->datalen <11 || !(elem->data[10 ] &WLAN_EXT_CAPA10_OBSS_NARROW_BW_RU_TOLERANCE_SUPPORT )) { data->tolerated = false;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 307/1193 wifi: iwlwifi: mvm: fix sched scan IE sizing
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
[ Upstream commit 4f155d262b31b9b17e0f9856bdabe0968eb4930f ]
Scheduled scan built the probe request before iwl_mvm_scan_fits(), so oversized IEs could be copied into the fixed preq buffer before length validation. Move iwl_mvm_build_scan_probe() after the fits check.
Also advertise max_sched_scan_ie_len using iwl_mvm_max_scan_ie_len() so userspace limits account for driver-inserted DS/TPC bytes.
--- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 4 +--- drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +1 -3
@@ -563,9 +563,7 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) hw->wiphy->max_sched_scan_reqs =1 ; hw->wiphy->max_sched_scan_ssids =PROBE_OPTION_MAX ; hw->wiphy->max_match_sets =iwl_umac_scan_get_max_profiles (mvm->fw); -/* we create the 802.11 header and zero length SSID IE. */ - hw->wiphy->max_sched_scan_ie_len = -SCAN_OFFLOAD_PROBE_REQ_SIZE -24 -2 ; + hw->wiphy->max_sched_scan_ie_len =iwl_mvm_max_scan_ie_len (mvm); hw->wiphy->max_sched_scan_plans =IWL_MAX_SCHED_SCAN_PLANS ; hw->wiphy->max_sched_scan_plan_interval =U16_MAX ;
drivers/net/wireless/intel/iwlwifi/mvm/scan.c +2 -2
@@ -3089,8 +3089,6 @@ int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm,if (ret)return ret; -iwl_mvm_build_scan_probe (mvm, vif, ies, ¶ms); -/* for 6 GHZ band only PSC channels need to be added */ for (i =0 ; i < params.n_channels; i++) {struct ieee80211_channel *channel = params.channels[i];
@@ -3124,6 +3122,8 @@ int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm, goto out; } +iwl_mvm_build_scan_probe (mvm, vif, ies, ¶ms); + uid =iwl_mvm_build_scan_cmd (mvm, vif, &hcmd, ¶ms, type);if (uid <0 ) { ret = uid;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 308/1193 ALSA: hda/realtek: Add quirk for HP EliteBook 830 G8 (8AB8) to enable mute LEDs
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcel Kłos <[email protected]>
[ Upstream commit 728d34ebf91c0e80b63a66b237dd0dfc5a8e5b4d ]
The sound and microphone mute LEDs do not function on this newer revision of the board (8AB8) while they do on the older 880D models. I have verified this on another laptop which was manufactured before the one with the issue.
Added the ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED from a G9 model, which uses the same codec, to make it work. Tested on kernel version 7.1.3 on the aforementioned newer revision notebook.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10194,6 +10194,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x8aa3 ,"HP ProBook 450 G9 (MB 8AA1)" ,ALC236_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8aa8 ,"HP EliteBook 640 G9 (MB 8AA6)" ,ALC236_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8aab ,"HP EliteBook 650 G9 (MB 8AA9)" ,ALC236_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8ab8 ,"HP EliteBook 830 G8 Notebook PC (MB 8AB8)" ,ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8ab9 ,"HP EliteBook 840 G8 (MB 8AB8)" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8abb ,"HP ZBook Firefly 14 G9" ,ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED ), SND_PCI_QUIRK(0x103c, 0x8ad1, "HP EliteBook 840 14 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 309/1193 blk-cgroup: fix leaks and online flag on radix_tree_insert failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tao Cui <[email protected]>
[ Upstream commit dbbca20764382b4d411ec2918f4e278ffe547acc ]
When radix_tree_insert() fails in blkg_create(), the error path has two issues:
1. blkg->online is set to true unconditionally, even when the blkg was never fully inserted. Move the assignment inside the success block.
2. The error path calls blkg_put() without first calling percpu_ref_kill(). Because the refcount is still in percpu mode, percpu_ref_put() only does this_cpu_sub() without checking for zero, so blkg_release() is never triggered. This permanently leaks the blkg memory, its percpu iostat, policy data, the parent blkg reference, and the cgroup css reference — the latter preventing the cgroup from ever being destroyed.
Fix by replacing blkg_put() with percpu_ref_kill(), matching the pattern used in blkg_destroy().
--- block/blk-cgroup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
block/blk-cgroup.c +2 -2
@@ -439,15 +439,15 @@ static struct blkcg_gq *blkg_create(struct blkcg *blkcg, struct gendisk *disk, blkg->pd[i]->online = true; } } + blkg->online = true; } - blkg->online = true;spin_unlock (&blkcg->lock);if (!ret)return blkg;/* @blkg failed fully initialized, use the usual release path */ -blkg_put (blkg); +percpu_ref_kill (&blkg->refcnt);return ERR_PTR (ret); err_put_css:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 310/1193 smb/client: flush dirty data before punching a hole
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huiwen He <[email protected]>
[ Upstream commit d7d2adcd022baade5cab65ca492ce63421ce3a6e ]
Punching a hole after a large buffered write may leave the range reported as data. Reproduce it with:
xfs_io -f \
-c "pwrite -b 3m -S 0x61 0 3m" \
-c "fpunch 1m 1m" \
-c "seek -h 0" \
-c "seek -d 1m" \
/mnt/test/reproPunching 1 MiB at offset 1 MiB should produce:
0 1 MiB 2 MiB 3 MiB | DATA | HOLE | DATA | EOF
Instead, the entire file is reported as data. SEEK_HOLE(0) returns EOF, and SEEK_DATA(1M) returns 1M.
This happens because a dirty folio spanning the punched range can be written back after the punch and refill the hole.
Fix this by flushing and waiting for dirty data in the punched range before invalidating the page cache and issuing FSCTL_SET_ZERO_DATA.
The xfstests generic/539 pass against Samba/ksmbd with this change.
--- fs/smb/client/smb2ops.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/smb/client/smb2ops.c +9 -0
@@ -3328,6 +3328,15 @@ static long smb3_punch_hole(struct file *file, struct cifs_tcon *tcon, goto out;filemap_invalidate_lock (inode->i_mapping); +/* +* Flush dirty data first, otherwise a dirty folio spanning the punched +* range may be written back after the ioctl and refill the hole. +*/ + rc =filemap_write_and_wait_range (inode->i_mapping, offset, + offset + len -1 ); +if (rc <0 ) + goto unlock; +/* * We implement the punch hole through ioctl, so we need remove the page * caches first, otherwise the data may be inconsistent with the server.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 311/1193 wifi: iwlwifi: mvm: fix a possible underflow
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
[ Upstream commit 0cb5260a1027a43f8cdb961e128f2ddd42e46832 ]
We shouldn't trust the firmware about the length of the wowlan packet.
--- drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/d3.c +15 -4
@@ -1519,6 +1519,10 @@ static void iwl_mvm_report_wakeup_reasons(struct iwl_mvm *mvm,if (WARN_ON_ONCE (truncated <0 )) truncated =0 ; +/* this would be a firmware bug */ +if (WARN_ON_ONCE (pktsize <sizeof (*hdr))) +return ; +if (ieee80211_is_data (hdr->frame_control)) {int hdrlen =ieee80211_hdrlen (hdr->frame_control);int ivlen =0 , icvlen =4 ;/* also FCS */
@@ -1527,10 +1531,6 @@ static void iwl_mvm_report_wakeup_reasons(struct iwl_mvm *mvm,if (!pkt) goto report; -skb_put_data (pkt, pktdata, hdrlen); - pktdata += hdrlen; - pktsize -= hdrlen; -if (ieee80211_has_protected (hdr->frame_control)) {/* * This is unlocked and using gtk_i(c)vlen,
@@ -1556,6 +1556,17 @@ static void iwl_mvm_report_wakeup_reasons(struct iwl_mvm *mvm, truncated =0 ; } +if (IWL_FW_CHECK (mvm, + pktsize <= hdrlen + ivlen + icvlen, +"pktsize is too small %d\n" , + pktsize)) { +kfree_skb (pkt); +return ; + } + +skb_put_data (pkt, pktdata, hdrlen); + pktdata += hdrlen; + pktsize -= hdrlen; pktsize -= ivlen + icvlen; pktdata += ivlen;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 312/1193 arm64: fixmap: Allow 256K early_ioremap() at any offset
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Peng <[email protected]>
[ Upstream commit 21fc7ec93f8b633b60d5bddef2f1529ff6b36185 ]
NR_FIX_BTMAPS is the per-slot page limit for early_ioremap(). Since __early_ioremap() maps the page-aligned physical range, a 256K request can require one extra page when the physical address is not page-aligned.
Reserve one extra page per slot so the 256K mapping budget is usable regardless of the initial page offset.
--- arch/arm64/include/asm/fixmap.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm64/include/asm/fixmap.h +5 -1
@@ -72,8 +72,12 @@ enum fixed_addresses {/* * Temporary boot-time mappings, used by early_ioremap(), * before ioremap() is functional. +* +* Reserve one extra page so a 256K mapping may start at any +* offset within a page. early_ioremap() maps the page-aligned +* physical range, so the initial offset can consume an extra page. */ -#define NR_FIX_BTMAPS (SZ_256K / PAGE_SIZE) +#define NR_FIX_BTMAPS ((SZ_256K / PAGE_SIZE) + 1)#define FIX_BTMAPS_SLOTS 7#define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 313/1193 wifi: iwlwifi: mvm: add a check on the tid coming from the firmware
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
[ Upstream commit 0e4c0d83267261cf67ec9690856edf4a56bb7dfc ]
ba_notif->tid is a firmware-controlled u8 that is used directly as an array index into tid_data[] without any validation. Add a bounds check against IWL_MAX_TID_COUNT before dereferencing the array.
--- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/tx.c +3 -0
@@ -2209,6 +2209,9 @@ void iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb) ba_notif = (void *)pkt->data; sta_id = ba_notif->sta_id; tid = ba_notif->tid; +if (IWL_FW_CHECK (mvm, tid >=ARRAY_SIZE (mvmsta->tid_data), +"invalid TID %d in BA notif\n" , tid)) +return ;/* "flow" corresponds to Tx queue */ txq =le16_to_cpu (ba_notif->scd_flow);/* "ssn" is start of block-ack Tx window, corresponds to index
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 314/1193 wifi: iwlwifi: mvm: fix out-of-bounds tid_data access in BA notif
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
[ Upstream commit 94d3982806c7f194b23484befde12934dda23064 ]
mvmsta->tid_data was indexed by the TFD loop counter 'i' instead of the actual TID value 'tid'. This writes lq_color into a random tid_data slot unrelated to the BA entry.
Since multi-TID blockack is not really in use, 'i' was always 0 and no harm was done.
Add a out-of-bound check before accessing the array.
--- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/tx.c +7 -1
@@ -2183,8 +2183,14 @@ void iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb)if (tid ==IWL_MGMT_TID ) tid =IWL_MAX_TID_COUNT ; +if (IWL_FW_CHECK (mvm, tid >= +ARRAY_SIZE (mvmsta->tid_data), +"invalid TID %d in compressed BA\n" , + tid)) +continue ; +if (mvmsta) - mvmsta->tid_data[i].lq_color = lq_color; + mvmsta->tid_data[tid].lq_color = lq_color; iwl_mvm_tx_reclaim(mvm, sta_id, tid, (int)(le16_to_cpu(ba_tfd->q_num)),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 279/1193 freevxfs: dont BUG() on unknown typed-extent type
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Farhad Alemi <[email protected]>
[ Upstream commit 704d48d81dc41470e108811c32c577ada66192d4 ]
vxfs_bmap_typed() handles four typed-extent types and calls BUG() in its default case, so an on-disk typed extent with any other type value crashes the kernel. It is reachable from ioctl(FIBMAP) on a regular file:
kernel BUG at fs/freevxfs/vxfs_bmap.c:230!
RIP: vxfs_bmap_typed fs/freevxfs/vxfs_bmap.c:230 [inline]
vxfs_bmap1+0x128a/0x12d0 fs/freevxfs/vxfs_bmap.c:257Replace the BUG() with WARN_ON_ONCE() and return 0 -- the value vxfs_bmap_typed() already returns on failure (and from the DEV4 case above); vxfs_getblk() maps 0 to -EIO, so the ioctl fails cleanly.
--- fs/freevxfs/vxfs_bmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/freevxfs/vxfs_bmap.c +2 -1
@@ -227,7 +227,8 @@ vxfs_bmap_typed(struct inode *ip, long iblock)return 0 ; }default : -BUG (); +WARN_ON_ONCE (1 ); +return 0 ; } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 315/1193 arm64: kprobes: Allow reentering kprobes while single-stepping
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pu Hu <[email protected]>
[ Upstream commit 23f851ac0078a908bf3422d6467ebc1db5828c46 ]
A kprobe can be hit while another kprobe is in KPROBE_HIT_SS state. This can happen when tracing or perf code runs from the debug exception path while the first kprobe is preparing or executing its out-of-line single-step instruction.
Currently arm64 treats a kprobe hit in KPROBE_HIT_SS as unrecoverable, the same as a hit in KPROBE_REENTER. This is too strict. A hit in KPROBE_HIT_SS is still a one-level reentry and can be handled by saving the current kprobe state and setting up single-step for the new probe, just like reentry from KPROBE_HIT_ACTIVE or KPROBE_HIT_SSDONE.
The truly unrecoverable case is hitting another kprobe while already in KPROBE_REENTER, because the reentry save area has already been consumed.
Move KPROBE_HIT_SS to the recoverable reentry cases and leave KPROBE_REENTER as the unrecoverable nested reentry case.
This change also requires saving saved_irqflag in struct prev_kprobe. When a nested kprobe calls kprobes_save_local_irqflag(), it overwrites kcb->saved_irqflag with the currently masked DAIF value, losing the outer kprobe's original DAIF state. Without this fix, when the outer kprobe's single-step finishes, kprobes_restore_local_irqflag() applies the wrong DAIF mask and leaves interrupts permanently disabled.
Extend struct prev_kprobe with a saved_irqflag field and save/restore it alongside kp and status. This ensures the outer kprobe's original interrupt state is preserved across reentry.
This mirrors the x86 fix in commit 6a5022a56ac3 ("kprobes/x86: Allow to handle reentered kprobe on single-stepping").
--- arch/arm64/include/asm/kprobes.h | 6 ++++++ arch/arm64/kernel/probes/kprobes.c | 23 ++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-)
arch/arm64/include/asm/kprobes.h +6 -0
@@ -26,6 +26,12 @@struct prev_kprobe {struct kprobe *kp;unsigned int status; + +/* +* The original DAIF state of the outer kprobe, saved here before +* a nested kprobe overwrites kcb->saved_irqflag during reentry. +*/ +unsigned long saved_irqflag; };/* per-cpu kprobe control block */
arch/arm64/kernel/probes/kprobes.c +22 -1
@@ -171,12 +171,27 @@ static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb) { kcb->prev_kprobe.kp =kprobe_running (); kcb->prev_kprobe.status = kcb->kprobe_status; + +/* +* Save the outer kprobe's original DAIF flags before the nested +* kprobe calls kprobes_save_local_irqflag() and overwrites +* kcb->saved_irqflag. Without this, the outer kprobe will restore +* the wrong DAIF state and leave interrupts permanently masked. +*/ + kcb->prev_kprobe.saved_irqflag = kcb->saved_irqflag; }static void __kprobes restore_previous_kprobe (struct kprobe_ctlblk *kcb) {__this_cpu_write (current_kprobe, kcb->prev_kprobe.kp); kcb->kprobe_status = kcb->prev_kprobe.status; + +/* +* Restore the outer kprobe's saved_irqflag so that when its +* single-step completes, kprobes_restore_local_irqflag() uses +* the correct original DAIF value. +*/ + kcb->saved_irqflag = kcb->prev_kprobe.saved_irqflag; }static void __kprobes set_current_kprobe (struct kprobe *p)
@@ -237,10 +252,16 @@ static int __kprobes reenter_kprobe(struct kprobe *p,switch (kcb->kprobe_status) {case KPROBE_HIT_SSDONE :case KPROBE_HIT_ACTIVE : +case KPROBE_HIT_SS : +/* +* A probe can be hit while another kprobe is preparing or +* executing its XOL single-step instruction. This is still a +* recoverable one-level reentry, so handle it in the same way as +* reentry from KPROBE_HIT_ACTIVE or KPROBE_HIT_SSDONE. +*/ kprobes_inc_nmissed_count (p);setup_singlestep (p, regs, kcb,1 );break ; -case KPROBE_HIT_SS :case KPROBE_REENTER :pr_warn ("Failed to recover from reentered kprobes.\n" );dump_kprobe (p);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 316/1193 drm/amd/pm/si: Dont schedule thermal work when queue isnt initialized
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Kristóf <[email protected]>
[ Upstream commit f8922d5a946699fc2bdc7660e6778bd6726bf8b8 ]
When DPM is turned off with the amdgpu.dpm=0 module parameter, the thermal work queue isn't initialized so we shouldn't schedule any work on it.
--- drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c +1 -1
@@ -7670,7 +7670,7 @@ static int si_dpm_process_interrupt(struct amdgpu_device *adev,break ; } -if (queue_thermal) +if (queue_thermal && amdgpu_dpm)schedule_work (&adev->pm.dpm.thermal.work);return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 317/1193 ALSA: hda/realtek: Add quirk for HP Pavilion x360
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 02bbbf05d19f49c5cc9f249dd8844b2a7f2a2b8c ]
HP Pavilion x360 sets a bogus PCI SSID (103c:0000), hence the driver picks up a wrong quirk entry, resulting in an almost silent output. And yet, the existing quirk for x390 doesn't seem sufficing, and we need the extra setup for the amp.
This patch adds the quirk entry for the codec SSID (103c:8486) to initialize the amp via COEF verbs and chains to the existing quirk for another x360 model to address the silent output.
--- sound/pci/hda/patch_realtek.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
sound/pci/hda/patch_realtek.c +15 -0
@@ -7494,6 +7494,7 @@ enum {ALC256_FIXUP_HUAWEI_MACH_WX9_PINS ,ALC298_FIXUP_HUAWEI_MBX_STEREO ,ALC295_FIXUP_HP_X360 , +ALC295_FIXUP_HP_PAVILION_X360 ,ALC221_FIXUP_HP_HEADSET_MIC ,ALC285_FIXUP_LENOVO_HEADPHONE_NOISE , ALC295_FIXUP_HP_AUTO_MUTE,
@@ -8753,6 +8754,19 @@ static const struct hda_fixup alc269_fixups[] = { .chained = true, .chain_id =ALC269_FIXUP_HP_MUTE_LED_MIC3 }, + [ALC295_FIXUP_HP_PAVILION_X360] = { + .type = HDA_FIXUP_VERBS, + .v.verbs = (const struct hda_verb []) { +/* force amp gain and processing state */ + {0x20 ,AC_VERB_SET_COEF_INDEX ,0x07 }, + {0x20 ,AC_VERB_SET_PROC_COEF ,0x7770 }, + {0x20 ,AC_VERB_SET_COEF_INDEX ,0x0d }, + {0x20 ,AC_VERB_SET_PROC_COEF ,0x3000 }, + {} + }, + .chained = true, + .chain_id =ALC295_FIXUP_HP_X360 + }, [ALC221_FIXUP_HP_HEADSET_MIC] = { .type = HDA_FIXUP_PINS, .v.pins = (const struct hda_pintbl []) {
@@ -10073,6 +10087,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x82c0 ,"HP G3 mini premium" ,ALC221_FIXUP_HP_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x103c ,0x83b9 ,"HP Spectre x360" ,ALC269_FIXUP_HP_MUTE_LED_MIC3 ),SND_PCI_QUIRK (0x103c ,0x841c ,"HP Pavilion 15-CK0xx" ,ALC269_FIXUP_HP_MUTE_LED_MIC3 ), +HDA_CODEC_QUIRK (0x103c ,0x8486 ,"HP Pavilion x360" ,ALC295_FIXUP_HP_PAVILION_X360 ),SND_PCI_QUIRK (0x103c ,0x8497 ,"HP Envy x360" ,ALC269_FIXUP_HP_MUTE_LED_MIC3 ),SND_PCI_QUIRK (0x103c ,0x84a6 ,"HP 250 G7 Notebook PC" ,ALC269_FIXUP_HP_LINE1_MIC1_LED ), SND_PCI_QUIRK(0x103c, 0x84ae, "HP 15-db0403ng", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 318/1193 wifi: iwlwifi: bound aligned TLV advance in FW parser
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
[ Upstream commit acad742714bdc70e7fd7f234323807c596828213 ]
Validate ALIGN(tlv_len, 4) against remaining parser length before consuming bytes from the firmware image.
This avoids length underflow on malformed TLVs.
--- drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-drv.c +11 -2
@@ -703,6 +703,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,u32 build, paging_mem_size;int num_of_cpus;bool usniffer_req = false; +size_t aligned_tlv_len;if (len <sizeof (*ucode)) {IWL_ERR (drv,"uCode has invalid length: %zd\n" , len);
@@ -751,8 +752,16 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, len, tlv_len);return -EINVAL ; } - len -=ALIGN (tlv_len,4 ); - data +=sizeof (*tlv) +ALIGN (tlv_len,4 ); + + aligned_tlv_len =ALIGN (tlv_len,4 ); +if (len < aligned_tlv_len) { +IWL_ERR (drv,"invalid aligned TLV len: %zd/%zu\n" , + len, aligned_tlv_len); +return -EINVAL ; + } + + len -= aligned_tlv_len; + data +=sizeof (*tlv) + aligned_tlv_len;switch (tlv_type) {case IWL_UCODE_TLV_INST :
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 319/1193 ALSA: usb-audio: Add FIXED_RATE quirk for JBL Quantum650 Wireless
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel C. Ribeiro <[email protected]>
[ Upstream commit f6d6a4147ace0c417035f65b021027c209c75190 ]
JBL Quantum650 Wireless (0ecb:2125) requires the same workaround that was used for JBL Quantum610 and Quantum810 for limiting the sample rate. Without it, the capture (microphone) stream fails to work. Setting the QUIRK_FLAG_FIXED_RATE flag, as done for the sibling models, makes both playback and capture work correctly.
--- sound/usb/quirks.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/quirks.c +2 -0
@@ -2165,6 +2165,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_CTL_MSG_DELAY_1M | QUIRK_FLAG_MIXER_MIN_MUTE),DEVICE_FLG (0x0ecb ,0x205c ,/* JBL Quantum610 Wireless */ QUIRK_FLAG_FIXED_RATE ), +DEVICE_FLG (0x0ecb ,0x2125 ,/* JBL Quantum650 Wireless */ +QUIRK_FLAG_FIXED_RATE ),DEVICE_FLG (0x0ecb ,0x2069 ,/* JBL Quantum810 Wireless */ QUIRK_FLAG_FIXED_RATE ), DEVICE_FLG(0x0fd9, 0x0008, /* Hauppauge HVR-950Q */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 320/1193 wifi: iwlwifi: acpi: validate WGDS table revision index
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
[ Upstream commit 954e821f42aaca56073ca830c5fd4bcf1a89048c ]
Check tbl_rev bounds before BIT(tbl_rev) to avoid undefined shifts when firmware reports an invalid revision value.
--- drivers/net/wireless/intel/iwlwifi/fw/acpi.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/intel/iwlwifi/fw/acpi.c +5 -0
@@ -857,6 +857,11 @@ int iwl_sar_get_wgds_table(struct iwl_fw_runtime *fwrt) min_size, max_size, &tbl_rev);if (!IS_ERR (wifi_pkg)) { +if (tbl_rev <0 || + tbl_rev >=BITS_PER_BYTE * +sizeof (rev_data[idx].revisions)) +continue ; +if (!(BIT (tbl_rev) & rev_data[idx].revisions))continue ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 321/1193 ALSA: hda/realtek: Add HDA_CODEC_QUIRK for Samsung 750XBE/730XBE
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 740b3c6780ec1f65aba2bc99a3f41d70bdb13477 ]
Add a codec SSID quirk for Samsung ELECTRONICS 750XBE/730XBE using HDA_CODEC_QUIRK() instead of SND_PCI_QUIRK(), because the alsa-info report from this device does not expose a PCI subsystem ID, only the HDA codec subsystem ID (0x144d:0xc824) is available.
This applies ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET to fix sound being very low and distorted on the headphone jack of this system.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10423,6 +10423,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x144d ,0xc1a6 ,"Samsung Galaxy Book Pro 360 (NP930QBD)" ,ALC298_FIXUP_SAMSUNG_AMP ),SND_PCI_QUIRK (0x144d ,0xc740 ,"Samsung Ativ book 8 (NP870Z5G)" ,ALC269_FIXUP_ATIV_BOOK_8 ),SND_PCI_QUIRK (0x144d ,0xc812 ,"Samsung Notebook Pen S (NT950SBE-X58)" ,ALC298_FIXUP_SAMSUNG_AMP ), +HDA_CODEC_QUIRK (0x144d ,0xc824 ,"Samsung ELECTRONICS (750XBE/730XBE)" ,ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET ),SND_PCI_QUIRK (0x144d ,0xc830 ,"Samsung Galaxy Book Ion (NT950XCJ-X716A)" ,ALC298_FIXUP_SAMSUNG_AMP ),SND_PCI_QUIRK (0x144d ,0xc832 ,"Samsung Galaxy Book Flex Alpha (NP730QCJ)" ,ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET ), SND_PCI_QUIRK(0x144d, 0xca03, "Samsung Galaxy Book2 Pro 360 (NP930QED)", ALC298_FIXUP_SAMSUNG_AMP),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 322/1193 wifi: mwifiex: replace one-element arrays with flexible array members
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Georgi Valkov <[email protected]>
[ Upstream commit 1cb5845a58d8e1f85d5766c6fbcbfddf96c212a1 ]
Replace deprecated one-element arrays with flexible array members. CONFIG_FORTIFY_SOURCE reports the following warning when one-element arrays are used as variable-length buffers:
sta_cmd.c:1033 mwifiex_sta_prepare_cmd
memcpy: detected field-spanning write (size 84) of single field "domain->triplet" at .../marvell/mwifiex/sta_cmd.c:1033 (size 3)
Convert affected structs to use flexible array members.
- Preserve existing wire layouts.
- Use DECLARE_FLEX_ARRAY() for structs inside affected unions.
Tested-on: WRT3200ACM, OpenWrt
--- drivers/net/wireless/marvell/mwifiex/fw.h | 18 +++++++++--------- drivers/net/wireless/marvell/mwifiex/join.c | 8 ++++---- drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-)
drivers/net/wireless/marvell/mwifiex/fw.h +9 -9
@@ -790,7 +790,7 @@ struct chan_band_param_set {struct mwifiex_ie_types_chan_band_list_param_set {struct mwifiex_ie_types_header header; -struct chan_band_param_set chan_band_param[1 ]; +struct chan_band_param_set chan_band_param[]; } __packed;struct mwifiex_ie_types_rates_param_set {
@@ -848,7 +848,7 @@ struct mwifiex_ie_types_wildcard_ssid_params {#define TSF_DATA_SIZE 8struct mwifiex_ie_types_tsf_timestamp {struct mwifiex_ie_types_header header; -u8 tsf_data[1 ]; +u8 tsf_data[]; } __packed;struct mwifiex_cf_param_set {
@@ -865,8 +865,8 @@ struct mwifiex_ibss_param_set {struct mwifiex_ie_types_ss_param_set {struct mwifiex_ie_types_header header;union { -struct mwifiex_cf_param_set cf_param_set[1 ]; -struct mwifiex_ibss_param_set ibss_param_set[1 ]; + DECLARE_FLEX_ARRAY(struct mwifiex_cf_param_set, cf_param_set); + DECLARE_FLEX_ARRAY(struct mwifiex_ibss_param_set, ibss_param_set); } cf_ibss; } __packed;
@@ -884,8 +884,8 @@ struct mwifiex_ds_param_set {struct mwifiex_ie_types_phy_param_set {struct mwifiex_ie_types_header header;union { -struct mwifiex_fh_param_set fh_param_set[1 ]; -struct mwifiex_ds_param_set ds_param_set[1 ]; + DECLARE_FLEX_ARRAY(struct mwifiex_fh_param_set, fh_param_set); + DECLARE_FLEX_ARRAY(struct mwifiex_ds_param_set, ds_param_set); } fh_ds; } __packed;
@@ -1338,7 +1338,7 @@ struct host_cmd_ds_802_11_snmp_mib {__le16 query_type;__le16 oid;__le16 buf_size; -u8 value[1 ]; +u8 value[]; } __packed;struct mwifiex_rate_scope {
@@ -1506,7 +1506,7 @@ struct mwifiex_scan_cmd_config {* TLV_TYPE_CHANLIST, mwifiex_ie_types_chan_list_param_set * WLAN_EID_SSID, mwifiex_ie_types_ssid_param_set */ -u8 tlv_buf[1 ];/* SSID TLV(s) and ChanList TLVs are stored +u8 tlv_buf[];/* SSID TLV(s) and ChanList TLVs are stored here */ } __packed;
@@ -1638,7 +1638,7 @@ struct host_cmd_ds_802_11_bg_scan_query_rsp {struct mwifiex_ietypes_domain_param_set {struct mwifiex_ie_types_header header;u8 country_code[IEEE80211_COUNTRY_STRING_LEN ]; -struct ieee80211_country_ie_triplet triplet[1 ]; +struct ieee80211_country_ie_triplet triplet[]; } __packed;struct host_cmd_ds_802_11d_domain_info {
drivers/net/wireless/marvell/mwifiex/join.c +4 -4
@@ -419,15 +419,15 @@ int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv, phy_tlv = (struct mwifiex_ie_types_phy_param_set *) pos; phy_tlv->header.type =cpu_to_le16 (WLAN_EID_DS_PARAMS ); - phy_tlv->header.len =cpu_to_le16 (sizeof (phy_tlv->fh_ds.ds_param_set)); -memcpy (&phy_tlv->fh_ds.ds_param_set, + phy_tlv->header.len =cpu_to_le16 (sizeof (*phy_tlv->fh_ds.ds_param_set)); +memcpy (phy_tlv->fh_ds.ds_param_set, &bss_desc->phy_param_set.ds_param_set.current_chan, -sizeof (phy_tlv->fh_ds.ds_param_set)); +sizeof (*phy_tlv->fh_ds.ds_param_set)); pos +=sizeof (phy_tlv->header) +le16_to_cpu (phy_tlv->header.len); ss_tlv = (struct mwifiex_ie_types_ss_param_set *) pos; ss_tlv->header.type =cpu_to_le16 (WLAN_EID_CF_PARAMS ); - ss_tlv->header.len =cpu_to_le16 (sizeof (ss_tlv->cf_ibss.cf_param_set)); + ss_tlv->header.len =cpu_to_le16 (sizeof (*ss_tlv->cf_ibss.cf_param_set)); pos +=sizeof (ss_tlv->header) +le16_to_cpu (ss_tlv->header.len);/* Get the common rates supported between the driver and the BSS Desc */
drivers/net/wireless/marvell/mwifiex/sta_cmd.c +1 -1
@@ -108,7 +108,7 @@ static int mwifiex_cmd_802_11_snmp_mib(struct mwifiex_private *priv, "cmd: SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid); cmd->command =cpu_to_le16 (HostCmd_CMD_802_11_SNMP_MIB); cmd->size =cpu_to_le16 (sizeof (struct host_cmd_ds_802_11_snmp_mib ) - -1 +S_DS_GEN ); + +S_DS_GEN ); snmp_mib->oid =cpu_to_le16 ((u16 )cmd_oid);if (cmd_action == HostCmd_ACT_GEN_GET) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 280/1193 xen/gntalloc: validate grant count before allocation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yousef Alhouseen <[email protected]>
[ Upstream commit 2299822f3f466b5dcad2377bf63986199f881a6b ]
gntalloc_ioctl_alloc() allocates the grant-id array before checking whether the requested count fits within the global grant limit. Counts above that limit cannot succeed, so reject them before the user-controlled allocation reaches kcalloc().
Use a subtraction-based check while holding gref_mutex so adding the requested count cannot wrap. Also cast the count before advancing the per-file index so the page-size multiplication is performed in 64-bit arithmetic.
Message-ID: <[email protected]>
--- drivers/xen/gntalloc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/xen/gntalloc.c +11 -2
@@ -272,6 +272,7 @@ static long gntalloc_ioctl_alloc(struct gntalloc_file_private_data *priv,int rc =0 ;struct ioctl_gntalloc_alloc_gref op;uint32_t *gref_ids; +unsigned int limit_snapshot;pr_debug ("%s: priv %p\n" , __func__, priv);
@@ -280,6 +281,12 @@ static long gntalloc_ioctl_alloc(struct gntalloc_file_private_data *priv, goto out; } + limit_snapshot =READ_ONCE (limit); +if (op.count > limit_snapshot) { + rc = -ENOSPC ; + goto out; + } + gref_ids =kcalloc (op.count,sizeof (gref_ids[0 ]),GFP_KERNEL );if (!gref_ids) { rc = -ENOMEM ;
@@ -292,14 +299,16 @@ static long gntalloc_ioctl_alloc(struct gntalloc_file_private_data *priv,* are about to enforce, removing them here is a good idea. */ do_cleanup (); -if (gref_size + op.count > limit) { + limit_snapshot =READ_ONCE (limit); +if (gref_size > limit_snapshot || + op.count > limit_snapshot - gref_size) {mutex_unlock (&gref_mutex); rc = -ENOSPC ; goto out_free; } gref_size += op.count; op.index = priv->index; - priv->index += op.count *PAGE_SIZE ; + priv->index += (uint64_t )op.count *PAGE_SIZE ;mutex_unlock (&gref_mutex); rc =add_grefs (&op, gref_ids, priv);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 281/1193 cachefiles: Fix double fput
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 af6830cc12dfe86c832dccc9c9878a93aaa22f83 ]
Fix a double fput() in error handling in cachefiles_create_tmpfile().
--- fs/cachefiles/namei.c | 1 - 1 file changed, 1 deletion(-)
fs/cachefiles/namei.c +0 -1
@@ -495,7 +495,6 @@ struct file *cachefiles_create_tmpfile(struct cachefiles_object *object) ret = -EINVAL ;if (unlikely (!file->f_op->read_iter) ||unlikely (!file->f_op->write_iter)) { -fput (file);pr_notice ("Cache does not support read_iter and write_iter\n" ); goto err_unuse; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 282/1193 ASoC: amd: yc: Add Alienware m15 R7 AMD to DMIC quirk table
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jetha Chan <[email protected]>
[ Upstream commit e782d687d2f5bf8b8113dc48ba22cca4b472c252 ]
The Alienware m15 R7 AMD exposes an ACP6x DMIC path, but its DMI product name is not present in the Yellow Carp ACP quirk table. As a result, the ACP machine driver does not enable the DMIC card on this system.
Add the DMI product name for this machine. With this quirk applied, the kernel reports:
acp_yc_mach acp_yc_mach.0: Enabling ACP DMIC support via DMI
and ALSA exposes the ACP DMIC capture device:
card 3: acp6x
device 0: DMIC capture dmic-hifi-0
Tested on an Alienware m15 R7 AMD with product SKU 0B59.
--- sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +7 -0
@@ -493,6 +493,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Bravo 17 D7VF"), } }, + { + .driver_data = &acp6x_card, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"Alienware" ), + DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m15 R7 AMD"), + } + }, { .driver_data = &acp6x_card, .matches = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 283/1193 drm/amdgpu: flush pending RCU callbacks on module unload
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Perry Yuan <[email protected]>
[ Upstream commit 67a654b41cfa73c3b83402c4a01b2689cad5b9bc ]
Call rcu_barrier() in module exit to wait for outstanding call_rcu() callbacks before freeing module text, preventing late callback execution in freed memory.
BUG: unable to handle page fault for address: ffffffffc1d59c40 PGD 6a12067 P4D 6a12067 PUD 6a14067 PMD 13698b067 PTE 0 Oops: 0010 [#1] SMP NOPTI RIP: 0010:0xffffffffc1d59c40 Code: Unable to access opcode bytes at RIP 0xffffffffc1d59c16. RSP: 0018:ffffc900198c0f28 EFLAGS: 00010286 RAX: ffffffffc1d59c40 RBX: ffff897c7d6b61c0 RCX: ffff88826aff4590 RDX: ffff8884d8b35490 RSI: ffffc900198c0f30 RDI: ffff88812af67290 RBP: 000000000000000a (DONE segment entries) R08: 0000000000000000 R09: 0000000000000100 R10: 0000000000000000 R11: ffffffff82a06100 R12: ffff88811a4e3700 R13: 0000000000000000 R14: ffff897c7d6b6270 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff897c7d680000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffffffc1d59c16 CR3: 00000104a980a001 CR4: 0000000002770ee0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe07f0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: <IRQ> ? rcu_do_batch+0x163/0x450 ? rcu_core+0x177/0x1c0 ? __do_softirq+0xc1/0x280 ? asm_call_irq_on_stack+0xf/0x20 </IRQ> ? do_softirq_own_stack+0x37/0x50 ? irq_exit_rcu+0xc4/0x100 ? sysvec_apic_timer_interrupt+0x36/0x80 ? asm_sysvec_apic_timer_interrupt+0x12/0x20 ? cpuidle_enter_state+0xd4/0x360 ? cpuidle_enter+0x29/0x40 ? cpuidle_idle_call+0x108/0x1a0 ? do_idle+0x77/0xf0 ? cpu_startup_entry+0x19/0x20 ? secondary_startup_64_no_verify+0xbf/0xcb
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +8 -0
@@ -2938,6 +2938,14 @@ static void __exit amdgpu_exit(void)amdgpu_fence_slab_fini ();mmu_notifier_synchronize ();amdgpu_xcp_drv_release (); + +/* +* Flush outstanding call_rcu() callbacks before the +* module text is freed. Otherwise a grace period elapsing after +* unload invokes a callback in already-freed module memory and +* faults in rcu_do_batch(). +*/ +rcu_barrier (); }module_init (amdgpu_init);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 284/1193 ksmbd: fix credit charge calculation for SMB2 QUERY_INFO
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit 284dc80ff529a0b454f11b6c2fea0d5daf6f315f ]
smb2_validate_credit_charge() computes the credit charge a request is allowed to consume from the payload size:
CreditCharge = (max(SendPayloadSize, ResponsePayloadSize) - 1)/65536 + 1
For SMB2 QUERY_INFO, the server must validate CreditCharge based on the *maximum* of InputBufferLength and OutputBufferLength. ksmbd instead summed the two lengths, which overestimates the required charge.
As a result a single-credit QUERY_INFO whose InputBufferLength and OutputBufferLength each fit in 64KB but whose sum exceeds 64KB is rejected with STATUS_INVALID_PARAMETER, even though it is a valid request. IOCTL already uses max() of the request and response sizes; make QUERY_INFO consistent by feeding InputBufferLength as the request length and OutputBufferLength as the expected response length so that smb2_validate_credit_charge() takes their maximum.
--- fs/smb/server/smb2misc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
fs/smb/server/smb2misc.c +7 -2
@@ -262,8 +262,12 @@ static int smb2_calc_size(void *buf, unsigned int *len)static inline int smb2_query_info_req_len (struct smb2_query_info_req *h) { -return le32_to_cpu (h->InputBufferLength) + -le32_to_cpu (h->OutputBufferLength); +return le32_to_cpu (h->InputBufferLength); +} + +static inline int smb2_query_info_resp_len (struct smb2_query_info_req *h) +{ +return le32_to_cpu (h->OutputBufferLength); }static inline int smb2_set_info_req_len (struct smb2_set_info_req *h)
@@ -309,6 +313,7 @@ static int smb2_validate_credit_charge(struct ksmbd_conn *conn,switch (hdr->Command) {case SMB2_QUERY_INFO : req_len =smb2_query_info_req_len (__hdr); + expect_resp_len =smb2_query_info_resp_len (__hdr);break ;case SMB2_SET_INFO : req_len =smb2_set_info_req_len (__hdr);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 275/1193 drm/arm/komeda: fix error handling for clk_prepare_enable() and callers
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo Kenji Mendonça Kaneko <[email protected]>
[ Upstream commit 6502eb8cfcd6f7bc5f1f8b73ee524112bd93319d ]
komeda_dev_resume() calls clk_prepare_enable() without checking the return value. If the clock fails to enable, the function returns 0 (success) while IRQs are enabled and IOMMU is connected on potentially unclocked hardware, causing undefined behavior on resume.
Propagate the error from clk_prepare_enable() and fix all call sites in komeda_drv.c that previously ignored the return value of komeda_dev_resume():
- komeda_platform_probe(): if resume fails, jump to err_destroy_mdev (skipping the suspend call, since the clock was never enabled)
- komeda_pm_resume(): propagate the error and skip drm_mode_config_helper_resume() on failure
This issue was found by code review without access to Komeda hardware.
--- drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 6 +++++- drivers/gpu/drm/arm/display/komeda/komeda_drv.c | 14 +++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-)
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +5 -1
@@ -321,7 +321,11 @@ void komeda_dev_destroy(struct komeda_dev *mdev)int komeda_dev_resume (struct komeda_dev *mdev) { -clk_prepare_enable (mdev->aclk); +int err; + + err =clk_prepare_enable (mdev->aclk); +if (err) +return err; mdev->funcs->enable_irq (mdev);
drivers/gpu/drm/arm/display/komeda/komeda_drv.c +9 -5
@@ -62,8 +62,11 @@ static int komeda_platform_probe(struct platform_device *pdev) }pm_runtime_enable (dev); -if (!pm_runtime_enabled (dev)) -komeda_dev_resume (mdrv->mdev); +if (!pm_runtime_enabled (dev)) { + err =komeda_dev_resume (mdrv->mdev); +if (err) + goto err_destroy_mdev; + } mdrv->kms =komeda_kms_attach (mdrv->mdev);if (IS_ERR (mdrv->kms)) {
@@ -81,7 +84,7 @@ static int komeda_platform_probe(struct platform_device *pdev)pm_runtime_disable (dev); else komeda_dev_suspend(mdrv->mdev); - +err_destroy_mdev:komeda_dev_destroy (mdrv->mdev); free_mdrv:
@@ -127,11 +130,12 @@ static int __maybe_unused komeda_pm_suspend(struct device *dev)static int __maybe_unused komeda_pm_resume (struct device *dev) {struct komeda_drv *mdrv =dev_get_drvdata (dev); +int err =0 ;if (!pm_runtime_status_suspended (dev)) -komeda_dev_resume (mdrv->mdev); + err =komeda_dev_resume (mdrv->mdev); -return drm_mode_config_helper_resume (&mdrv->kms->base); +return err ? err :drm_mode_config_helper_resume (&mdrv->kms->base); }static const struct dev_pm_ops komeda_pm_ops = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 324/1193 regulator: core: clamp voltage constraints before applying apply_uV
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kamal Wadhwa <[email protected]>
[ Upstream commit a45cc646a3aa83eb4ab4c7ed2685785ea51dc5e6 ]
machine_constraints_voltage() currently applies apply_uV against the machine-supplied [min_uV, max_uV] range, and only afterwards clamps that range down to what the regulator can actually supply (via ops->list_voltage()).
If the machine-supplied range is wider than the regulator's actual range, apply_uV's rounding can pick a selector outside the (correct) clamped range, so the regulator ends up programmed outside its clamped min/max. At bring-up this shows up as a voltage read-back outside the clamped range.
Fix this by moving the clamping block ahead of the apply_uV block, so apply_uV always targets an already-clamped range. Whether apply_uV should run is decided from the unclamped constraints beforehand and stored in a local bool, since clamping must not itself change whether apply_uV fires.
No functional change to the clamping logic itself, only its position relative to apply_uV. Its early return 0 exits become fallthroughs since the apply_uV logic now follows it.
--- drivers/regulator/core.c | 163 +++++++++++++++++++++------------------ 1 file changed, 90 insertions(+), 73 deletions(-)
drivers/regulator/core.c +90 -73
@@ -1242,10 +1242,98 @@ static int machine_constraints_voltage(struct regulator_dev *rdev, {const struct regulator_ops *ops = rdev->desc->ops;int ret; +bool apply_uV; + +/* +* Decide up front, from the constraints as handed to us, whether +* apply_uV needs to run below. The clamping pass right after this +* may rewrite constraints->min_uV/max_uV (e.g. the fixed-voltage +* autoconfigure case), and we don't want that to change whether +* apply_uV fires. +*/ + apply_uV = rdev->constraints->apply_uV && + rdev->constraints->min_uV && rdev->constraints->max_uV; + +/* +* Constrain machine-level voltage specs to fit the actual range +* supported by this regulator before apply_uV (below) tries to +* force hardware to a value from that range: otherwise apply_uV +* can target a constraint value that doesn't correspond to any +* real voltage selector and fail registration outright, even +* though the clamping pass would have narrowed it to a value +* the regulator can actually hit. +*/ +if (ops->list_voltage && rdev->desc->n_voltages) { +int count = rdev->desc->n_voltages; +int i; +int min_uV =INT_MAX ; +int max_uV =INT_MIN ; +int cmin = constraints->min_uV; +int cmax = constraints->max_uV; + +/* it's safe to autoconfigure fixed-voltage supplies +* and the constraints are used by list_voltage. +*/ +if (count ==1 && !cmin) { + cmin =1 ; + cmax =INT_MAX ; + constraints->min_uV = cmin; + constraints->max_uV = cmax; + } + +/* voltage constraints are optional */ +if ((cmin ==0 ) && (cmax ==0 )) { +/* nothing more to do */ + +/* else require explicit machine-level constraints */ + }else if (cmin <=0 || cmax <=0 || cmax < cmin) { +rdev_err (rdev,"invalid voltage constraints\n" ); +return -EINVAL ; + +/* no need to loop voltages if range is continuous */ + }else if (rdev->desc->continuous_voltage_range) { +/* nothing more to do */ + + }else { +/* initial: [cmin..cmax] valid, [min_uV..max_uV] not */ +for (i =0 ; i < count; i++) { +int value; + + value = ops->list_voltage (rdev, i); +if (value <=0 ) +continue ; + +/* maybe adjust [min_uV..max_uV] */ +if (value >= cmin && value < min_uV) + min_uV = value; +if (value <= cmax && value > max_uV) + max_uV = value; + } + +/* final: [min_uV..max_uV] valid iff constraints valid */ +if (max_uV < min_uV) { +rdev_err (rdev, +"unsupportable voltage constraints %u-%uuV\n" , + min_uV, max_uV); +return -EINVAL ; + } + +/* use regulator's subset of machine constraints */ +if (constraints->min_uV < min_uV) { +rdev_dbg (rdev,"override min_uV, %d -> %d\n" , + constraints->min_uV, min_uV); + constraints->min_uV = min_uV; + } +if (constraints->max_uV > max_uV) { +rdev_dbg (rdev,"override max_uV, %d -> %d\n" , + constraints->max_uV, max_uV); + constraints->max_uV = max_uV; + } + } + }/* do we need to apply the constraint voltage */ -if (rdev->constraints->apply_uV && - rdev->constraints->min_uV && rdev->constraints->max_uV) { +if (apply_uV) {int target_min, target_max;int current_uV =regulator_get_voltage_rdev (rdev);
@@ -1300,77 +1388,6 @@ static int machine_constraints_voltage(struct regulator_dev *rdev, } } -/* constrain machine-level voltage specs to fit -* the actual range supported by this regulator. -*/ -if (ops->list_voltage && rdev->desc->n_voltages) { -int count = rdev->desc->n_voltages; -int i; -int min_uV =INT_MAX ; -int max_uV =INT_MIN ; -int cmin = constraints->min_uV; -int cmax = constraints->max_uV; - -/* it's safe to autoconfigure fixed-voltage supplies -* and the constraints are used by list_voltage. -*/ -if (count ==1 && !cmin) { - cmin =1 ; - cmax =INT_MAX ; - constraints->min_uV = cmin; - constraints->max_uV = cmax; - } - -/* voltage constraints are optional */ -if ((cmin ==0 ) && (cmax ==0 )) -return 0 ; - -/* else require explicit machine-level constraints */ -if (cmin <=0 || cmax <=0 || cmax < cmin) { -rdev_err (rdev,"invalid voltage constraints\n" ); -return -EINVAL ; - } - -/* no need to loop voltages if range is continuous */ -if (rdev->desc->continuous_voltage_range) -return 0 ; - -/* initial: [cmin..cmax] valid, [min_uV..max_uV] not */ -for (i =0 ; i < count; i++) { -int value; - - value = ops->list_voltage (rdev, i); -if (value <=0 ) -continue ; - -/* maybe adjust [min_uV..max_uV] */ -if (value >= cmin && value < min_uV) - min_uV = value; -if (value <= cmax && value > max_uV) - max_uV = value; - } - -/* final: [min_uV..max_uV] valid iff constraints valid */ -if (max_uV < min_uV) { -rdev_err (rdev, -"unsupportable voltage constraints %u-%uuV\n" , - min_uV, max_uV); -return -EINVAL ; - } - -/* use regulator's subset of machine constraints */ -if (constraints->min_uV < min_uV) { -rdev_dbg (rdev,"override min_uV, %d -> %d\n" , - constraints->min_uV, min_uV); - constraints->min_uV = min_uV; - } -if (constraints->max_uV > max_uV) { -rdev_dbg (rdev,"override max_uV, %d -> %d\n" , - constraints->max_uV, max_uV); - constraints->max_uV = max_uV; - } - } -return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 333/1193 cifs: validate idmap key payload length
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Qiang <[email protected]>
[ Upstream commit 455488cd5054bcc59db40fa1cc2c004031a5b2a5 ]
The cifs.idmap key type stores its payload length in key->datalen, which is limited to U16_MAX. Accepting a larger key payload truncates the recorded length and can make later users interpret the payload using inconsistent bounds.
Reject oversized preparsed payloads before allocating or copying them. This keeps key->datalen consistent with the stored data for both inline and separately allocated idmap payloads.
--- fs/smb/client/cifsacl.c | 3 +++ 1 file changed, 3 insertions(+)
fs/smb/client/cifsacl.c +3 -0
@@ -69,6 +69,9 @@ cifs_idmap_key_instantiate(struct key *key, struct key_preparsed_payload *prep) {char *payload; +if (prep->datalen >U16_MAX ) +return -EINVAL ; +/* * If the payload is less than or equal to the size of a pointer, then * an allocation here is wasteful. Just copy the data directly to the
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 334/1193 wifi: cfg80211: validate IEs in cfg80211_wext_siwgenie()
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 a2f5286ca4f304d3fd469f01b96b518608912a5c ]
The KASAN allocation trace shows that a malformed IE buffer is stored via SIOCSIWGENIE (cfg80211_wext_siwgenie()) without any validation. The crash trace shows that a subsequent SIOCSIWESSID triggers a connection attempt which calls cfg80211_sme_get_conn_ies() to process the stored IE buffer, causing:
- An out-of-bounds read in skip_ie() which reads ies[pos+1] (the length byte) past the end of the 1-byte buffer.
- An integer underflow in the memcpy size argument when offs returned by ieee80211_ie_split() exceeds ies_len, causing unsigned subtraction to wrap to SIZE_MAX and triggering a fortify panic.
Fix this by validating the IE buffer in cfg80211_wext_siwgenie() before storing it.
--- net/wireless/wext-sme.c | 9 +++++++++ 1 file changed, 9 insertions(+)
net/wireless/wext-sme.c +9 -0
@@ -348,6 +348,15 @@ int cfg80211_wext_siwgenie(struct net_device *dev, goto out;if (ie_len) { +const struct element *elem; + +for_each_element (elem, extra, ie_len) { +/* nothing */ + } + +if (!for_each_element_completed (elem, extra, ie_len)) +return -EINVAL ; + ie =kmemdup (extra, ie_len,GFP_KERNEL );if (!ie) { err = -ENOMEM ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 335/1193 Bluetooth: RFCOMM: validate skb length in rfcomm_recv_frame
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <[email protected]>
[ Upstream commit b230e5bf501c5edaf2eb0991cb862ac142031d4b ]
rfcomm_recv_frame() casts skb->data to struct rfcomm_hdr and dereferences hdr->addr and hdr->ctrl without validating skb->len first. A truncated frame with skb->len less than the minimum header size causes an out-of-bounds read of uninitialized memory. Additionally, a zero-length frame causes skb->len-- to underflow to UINT_MAX, making skb_tail_pointer() read far past the buffer.
Commit 23882b828c3c ("Bluetooth: RFCOMM: validate skb length in MCC handlers") fixed the same class of missing-length-check bugs in the MCC sub-handlers, but the top-level rfcomm_recv_frame() was left unfixed. KMSAN reports:
BUG: KMSAN: uninit-value in rfcomm_run
...
Uninit was created at:
__alloc_skb+0x474/0xb60
vhci_write+0xe9/0x870Fix this by rejecting frames smaller than sizeof(struct rfcomm_hdr) + 1 (the minimum frame must have a 3-byte header and a 1-byte FCS).
--- net/bluetooth/rfcomm/core.c | 5 +++++ 1 file changed, 5 insertions(+)
net/bluetooth/rfcomm/core.c +5 -0
@@ -1817,6 +1817,11 @@ static struct rfcomm_session *rfcomm_recv_frame(struct rfcomm_session *s,return s; } +if (skb->len <sizeof (*hdr) +1 ) { +kfree_skb (skb); +return s; + } + dlci =__get_dlci (hdr->addr); type =__get_type (hdr->ctrl);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 336/1193 ALSA: usb-audio: Add quirk for Corsair Virtuoso (later revision)
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robert Abrahamse <[email protected]>
[ Upstream commit cee046679655b4822f76efc9658f19efee9ac979 ]
Add USB mixer mapping quirk for later revisions of the Corsair Virtuoso headset with USB IDs 0x1b1c:0x0a43 (wired) and 0x1b1c:0x0a44 (wireless). These devices exhibit the same mixer label collision as earlier Virtuoso variants: all controls are labelled "Headset", causing applications like PulseAudio to move the sidetone control instead of the main playback volume.
--- sound/usb/mixer_maps.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
sound/usb/mixer_maps.c +10 -0
@@ -638,6 +638,16 @@ static const struct usbmix_ctl_map usbmix_ctl_maps[] = { .id = USB_ID(0x1b1c, 0x0a42), .map = corsair_virtuoso_map, }, + { + /* Corsair Virtuoso (wired mode, later revision) */ + .id = USB_ID(0x1b1c, 0x0a43), + .map = corsair_virtuoso_map, + }, + { + /* Corsair Virtuoso (wireless mode, later revision) */ + .id = USB_ID(0x1b1c, 0x0a44), + .map = corsair_virtuoso_map, + }, { /* Corsair HS80 RGB Wireless (wired mode) */ .id = USB_ID(0x1b1c, 0x0a6a),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 337/1193 Drivers: hv: vmbus: add VTL2 redirect connection ID
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hardik Garg <[email protected]>
[ Upstream commit 92d0593128023cf93ae61b7728dcc3062f8d514f ]
VMBus sends CHANNELMSG_INITIATE_CONTACT through a Hyper-V message connection ID. Older protocol versions use VMBUS_MESSAGE_CONNECTION_ID, while protocol version 5.0 and newer normally use VMBUS_MESSAGE_CONNECTION_ID_4.
For a VTL2 kernel using VMBus protocol 5.0 or newer, the host may expect INITIATE_CONTACT on either the redirect connection ID or VMBUS_MESSAGE_CONNECTION_ID_4. There is no capability indication that identifies which ID is active, so the driver must determine it at runtime.
During VMBus negotiation, the redirect ID is tried first because it is used by VTL2 configurations with VMBus redirection enabled. If the redirect ID is unavailable, the host rejects it synchronously with HV_STATUS_INVALID_CONNECTION_ID, allowing fallback to the standard ID.
Return a distinct error for an invalid Initiate Contact connection ID so this fallback does not mask other post-message failures or protocol-version rejections. Preserve the existing connection ID selection for older protocol versions or when running below VTL2.
--- drivers/hv/connection.c | 47 +++++++++++++++++++++++---------------- drivers/hv/hyperv_vmbus.h | 2 ++ 2 files changed, 30 insertions(+), 19 deletions(-)
drivers/hv/connection.c +28 -19
@@ -71,7 +71,8 @@ module_param(max_version, uint, S_IRUGO);MODULE_PARM_DESC (max_version,"Maximal VMBus protocol version which can be negotiated" ); -int vmbus_negotiate_version (struct vmbus_channel_msginfo *msginfo,u32 version) +static int vmbus_try_connection_id (struct vmbus_channel_msginfo *msginfo, +u32 version,u32 connection_id) {int ret =0 ;struct vmbus_channel_initiate_contact *msg;
@@ -86,20 +87,20 @@ int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo, u32 version) msg->vmbus_version_requested = version;/* -* VMBus protocol 5.0 (VERSION_WIN10_V5) and higher require that we must -* use VMBUS_MESSAGE_CONNECTION_ID_4 for the Initiate Contact Message, -* and for subsequent messages, we must use the Message Connection ID -* field in the host-returned Version Response Message. And, with -* VERSION_WIN10_V5 and higher, we don't use msg->interrupt_page, but we -* tell the host explicitly that we still use VMBUS_MESSAGE_SINT(2) for -* compatibility. +* For VMBus protocol 5.0 (VERSION_WIN10_V5) and higher, use the +* caller-supplied connection_id for the Initiate Contact message so +* the caller can implement the required retry scheme. For subsequent +* messages, use the Message Connection ID field in the host-returned +* Version Response message. With VERSION_WIN10_V5 and higher, we don't +* use msg->interrupt_page, but tell the host explicitly that we still +* use VMBUS_MESSAGE_SINT(2) for compatibility. * * On old hosts, we should always use VMBUS_MESSAGE_CONNECTION_ID (1). */ if (version >=VERSION_WIN10_V5 ) { msg->msg_sint =VMBUS_MESSAGE_SINT ; msg->msg_vtl = ms_hyperv.vtl; - vmbus_connection.msg_conn_id =VMBUS_MESSAGE_CONNECTION_ID_4 ; + vmbus_connection.msg_conn_id = connection_id; }else { msg->interrupt_page =virt_to_phys (vmbus_connection.int_page); vmbus_connection.msg_conn_id =VMBUS_MESSAGE_CONNECTION_ID ;
@@ -161,6 +162,22 @@ int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo, u32 version)return ret; } +int vmbus_negotiate_version (struct vmbus_channel_msginfo *msginfo,u32 version) +{ +int ret; + +/* Try the redirect ID first for VTL2 with VMBus protocol 5.0+. */ +if (version >=VERSION_WIN10_V5 && ms_hyperv.vtl ==2 ) { + ret =vmbus_try_connection_id (msginfo, version, +VMBUS_MESSAGE_CONNECTION_ID_REDIRECT ); +if (ret != -ENXIO ) +return ret; + } + +return vmbus_try_connection_id (msginfo, version, +VMBUS_MESSAGE_CONNECTION_ID_4 ); +} +/* * vmbus_connect - Sends a connect request on the partition service connection */
@@ -454,18 +471,10 @@ int vmbus_post_msg(void *buffer, size_t buflen, bool can_sleep)switch (ret) {case HV_STATUS_INVALID_CONNECTION_ID : -/* -* See vmbus_negotiate_version(): VMBus protocol 5.0 -* and higher require that we must use -* VMBUS_MESSAGE_CONNECTION_ID_4 for the Initiate -* Contact message, but on old hosts that only -* support VMBus protocol 4.0 or lower, here we get -* HV_STATUS_INVALID_CONNECTION_ID and we should -* return an error immediately without retrying. -*/ +/* Allow INITIATE_CONTACT to try another connection ID. */ hdr = buffer;if (hdr->msgtype ==CHANNELMSG_INITIATE_CONTACT ) -return -EINVAL ; +return -ENXIO ;/* * We could get this if we send messages too * frequently.
drivers/hv/hyperv_vmbus.h +2 -0
@@ -108,6 +108,8 @@ struct hv_input_post_message {enum {VMBUS_MESSAGE_CONNECTION_ID =1 ,VMBUS_MESSAGE_CONNECTION_ID_4 =4 , +/* VTL2 redirect connection ID for INITIATE_CONTACT. */ +VMBUS_MESSAGE_CONNECTION_ID_REDIRECT =0x800074 ,VMBUS_MESSAGE_PORT_ID =1 ,VMBUS_EVENT_CONNECTION_ID =2 ,VMBUS_EVENT_PORT_ID =2 ,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 338/1193 ASoC: amd: yc: Add DMI quirk for HP Victus Laptop 16-e1xxx
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 38417f5fc8e3323218c19bd7e419eec4fb0697bd ]
Add DMI quirk to enable ACP6x sound card for HP Victus by HP Laptop 16-e1xxx, which fixes microphone not working issue.
Without this quirk, the DMIC on acp6x device is not properly enabled, causing the microphone to not work.
--- sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +7 -0
@@ -668,6 +668,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { DMI_MATCH(DMI_BOARD_NAME, "8E35"), } }, + { + .driver_data = &acp6x_card, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"HP" ), + DMI_MATCH(DMI_PRODUCT_NAME, "Victus by HP Laptop 16-e1xxx"), + } + }, { .driver_data = &acp6x_card, .matches = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 339/1193 vhost-scsi: flush backend after device ioctls
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jia Jia <[email protected]>
[ Upstream commit 22598f55a4c2b510b3df5e69e563387a963222ae ]
vhost-scsi translates guest response descriptors into userspace iovecs when commands are submitted. Target-core completes those commands asynchronously, so VHOST_SET_MEM_TABLE can replace the memory table while an in-flight command still retains response iovecs translated through the old table.
If the old mapping is reused after VHOST_SET_MEM_TABLE returns, command completion can write the response to an unrelated userspace object.
Flush the vhost-scsi backend after vhost_dev_ioctl() handles a device ioctl. This waits for in-flight commands that can still use the old response iovecs before the ioctl returns.
Message-ID: <[email protected]>
--- drivers/vhost/scsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/vhost/scsi.c +2 -1
@@ -2095,9 +2095,10 @@ vhost_scsi_ioctl(struct file *f,default :mutex_lock (&vs->dev.mutex); r =vhost_dev_ioctl (&vs->dev, ioctl, argp); -/* TODO: flush backend after dev ioctl. */ if (r == -ENOIOCTLCMD ) r =vhost_vring_ioctl (&vs->dev, ioctl, argp); +else +vhost_scsi_flush (vs);mutex_unlock (&vs->dev.mutex);return r; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 340/1193 hwmon: (corsair-psu) Fix linear11 calculation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
[ Upstream commit c6c4234928d2eb4f61fecb61067e612d9bdbd2ff ]
In corsairpsu_linear11_to_int(), the mantissa is extracted using bitwise operations and cast to s16 before being shifted left:
static int corsairpsu_linear11_to_int(const u16 val, const int scale)
{
...
const int mant = (((s16)(val & 0x7ff)) << 5) >> 5;
...
}Due to C integer promotion rules, the masked value (which is always positive) is promoted to a 32-bit integer before the left shift. As a result, the sign bit is never extended to bit 31 of the promoted integer.
When the device hardware reports a negative temperature in Linear11 format (such as an ambient temperature probe reporting sub-zero), the negative mantissa is parsed incorrectly as a massive positive value. For example, -1 becomes 2047, which scales to 2047 degrees Celsius.
Fix the problem by type casting the result of the left shift operation to s16.
Another problem is left-shifting of negative values. In C, the result of left-shifting negative values is undefined. Use a multiplication instead to avoid the problem.
Also use a local s64 variable to store temporary results, change the return value type from int to long, and clamp the final value to LONG_MIN and LONG_MAX to avoid under- and overflow issues while retaining as much information as possible.
--- drivers/hwmon/corsair-psu.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
drivers/hwmon/corsair-psu.c +14 -9
@@ -140,13 +140,18 @@ struct corsairpsu_data { };/* some values are SMBus LINEAR11 data which need a conversion */ -static int corsairpsu_linear11_to_int (const u16 val,const int scale) +static long corsairpsu_linear11_to_long (const u16 val,const int scale) {const int exp = ((s16 )val) >>11 ; -const int mant = (((s16)(val &0x7ff )) <<5 ) >>5 ; -const int result = mant * scale; +const int mant = ((s16)((val &0x7ff ) <<5 )) >>5 ; +s64 result = mant * scale; -return (exp >=0 ) ? (result << exp) : (result >> -exp); +if (exp >=0 ) + result *= (int )(1UL << exp); +else + result >>= -exp; + +return clamp (result,LONG_MIN ,LONG_MAX ); }/* the micro-controller uses percentage values to control pwm */
@@ -271,13 +276,13 @@ static int corsairpsu_get_value(struct corsairpsu_data *priv, u8 cmd, u8 rail, lcase PSU_CMD_RAIL_AMPS :case PSU_CMD_TEMP0 :case PSU_CMD_TEMP1 : - *val =corsairpsu_linear11_to_int (tmp &0xFFFF ,1000 ); + *val =corsairpsu_linear11_to_long (tmp &0xFFFF ,1000 );break ;case PSU_CMD_FAN : - *val =corsairpsu_linear11_to_int (tmp &0xFFFF ,1 ); + *val =corsairpsu_linear11_to_long (tmp &0xFFFF ,1 );break ;case PSU_CMD_FAN_PWM_ENABLE : - *val =corsairpsu_linear11_to_int (tmp &0xFFFF ,1 ); + *val =corsairpsu_linear11_to_long (tmp &0xFFFF ,1 );/* * 0 = automatic mode, means the micro-controller controls the fan using a plan * which can be modified, but changing this plan is not supported by this
@@ -291,12 +296,12 @@ static int corsairpsu_get_value(struct corsairpsu_data *priv, u8 cmd, u8 rail, l *val =2 ;break ;case PSU_CMD_FAN_PWM : - *val =corsairpsu_linear11_to_int (tmp &0xFFFF ,1 ); + *val =corsairpsu_linear11_to_long (tmp &0xFFFF ,1 ); *val =corsairpsu_dutycycle_to_pwm (*val);break ;case PSU_CMD_RAIL_WATTS :case PSU_CMD_TOTAL_WATTS : - *val =corsairpsu_linear11_to_int (tmp &0xFFFF ,1000000 ); + *val =corsairpsu_linear11_to_long (tmp &0xFFFF ,1000000 );break ;case PSU_CMD_TOTAL_UPTIME :case PSU_CMD_UPTIME :
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 341/1193 spi: dw: fix wrong RX_SAMPLE_DLY setting after resume
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jisheng Zhang <[email protected]>
[ Upstream commit 133c71b2c0bc976a4751f9e05ef7cdea67f964e5 ]
On platforms which need a non-zero rx sample delay, the RX_SAMPLE_DLY reg setting is lost after resume. The reason is that the reg may be reset to 0 after resuming, but dws->cur_rx_sample_dly doesn't know this fact. Fix this issue by clearing dws->cur_rx_sample_dly in dw_spi_shutdown_chip().
--- drivers/spi/spi-dw.h | 1 + 1 file changed, 1 insertion(+)
drivers/spi/spi-dw.h +1 -0
@@ -283,6 +283,7 @@ static inline void dw_spi_shutdown_chip(struct dw_spi *dws)dw_spi_enable_chip (dws,0 );dw_spi_set_clk (dws,0 ); dws->current_freq =0 ; + dws->cur_rx_sample_dly =0 ; }extern void dw_spi_set_cs (struct spi_device *spi,bool enable);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 342/1193 ASoC: rt5645: Perform the initial jack detect at probe
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rudi Heitbaum <[email protected]>
[ Upstream commit 54b279699279411c77c8afbc73b83c70740a7303 ]
The only initial jack detect is the rt5645_irq(0, rt5645) at the end of rt5645_set_jack_detect(). A card described with simple-audio-card has no machine driver to call that, so jack state is only ever sampled from an edge on hp-detect-gpios.
A headphone already in the socket at boot is therefore never noticed, and the card is silent with every mixer control set correctly. rt5645_jack_detect() is what force enables the "LDO2" and "Mic Det Power" supplies that the "HP amp" widget depends on, and what programs RT5645_CHARGE_PUMP away from its reset value, so without it "HP amp" cannot power up. Unplugging and replugging the jack is the only way to recover.
Do the detect at the end of the component probe when the driver owns a hp-detect GPIO and the codec's own jack detect is unused, which is the case that has no other trigger. A machine driver calling rt5645_set_jack_detect() later just repeats it.
--- sound/soc/codecs/rt5645.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/soc/codecs/rt5645.c +4 -0
@@ -3479,6 +3479,10 @@ static int rt5645_probe(struct snd_soc_component *component)if (!rt5645->eq_param)return -ENOMEM ; +/* no machine driver to call rt5645_set_jack_detect(), so detect here */ +if (!rt5645->pdata.jd_mode && rt5645->gpiod_hp_det) +rt5645_irq (0 , rt5645); +return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 325/1193 wifi: mac80211_hwsim: reject undersized HWSIM_ATTR_TX_INFO
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ibrahim Hashimov <[email protected]>
[ Upstream commit 3dc723ac78a6e4fa0fd49e27e487ed319da40a9f ]
hwsim_tx_info_frame_received_nl() casts the HWSIM_ATTR_TX_INFO payload to a struct hwsim_tx_rate * and unconditionally reads IEEE80211_TX_MAX_RATES entries (8 bytes) from it. The policy only bounds the attribute from above (NLA_BINARY .len is a maximum) and the op sets GENL_DONT_VALIDATE_STRICT, so a short or zero-length attribute is accepted and the loop reads past the payload.
Require the exact length in the policy, so a malformed attribute is rejected before the handler runs.
--- drivers/net/wireless/virtual/mac80211_hwsim.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/virtual/mac80211_hwsim.c +3 -3
@@ -876,9 +876,9 @@ static const struct nla_policy hwsim_genl_policy[HWSIM_ATTR_MAX + 1] = { [HWSIM_ATTR_FLAGS] = { .type = NLA_U32 }, [HWSIM_ATTR_RX_RATE] = { .type = NLA_U32 }, [HWSIM_ATTR_SIGNAL] = { .type = NLA_U32 }, - [HWSIM_ATTR_TX_INFO] = { .type = NLA_BINARY, - .len =IEEE80211_TX_MAX_RATES * - sizeof(struct hwsim_tx_rate)}, + [HWSIM_ATTR_TX_INFO ] = +NLA_POLICY_EXACT_LEN (IEEE80211_TX_MAX_RATES * + sizeof(struct hwsim_tx_rate)), [HWSIM_ATTR_COOKIE] = { .type = NLA_U64 }, [HWSIM_ATTR_CHANNELS] = { .type = NLA_U32 }, [HWSIM_ATTR_RADIO_ID] = { .type = NLA_U32 },
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 343/1193 scsi: core: Do not block on tag allocation in scsi_eh_lock_door()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zizhi Wo <[email protected]>
[ Upstream commit 732cb6bb37fd26863d5786522fb1997e7f5865b4 ]
scsi_eh_lock_door() is called from scsi_restart_operations() while the host is still in the SHOST_RECOVERY state, i.e. before the host is switched back to SHOST_RUNNING and scsi_run_host_queues() restarts the queues. It allocates a request via scsi_alloc_request() with no flags, so blk_mq_get_tag() may block waiting for a free sched tag when all tags are already in use.
Those tags can be held by commands that were just requeued by scsi_eh_flush_done_q() during error handling. Such commands cannot be dispatched until the host leaves SHOST_RECOVERY and scsi_run_host_queues() is called - which only happens *after* scsi_eh_lock_door() returns.
This forms a circular dependency:
- scsi_eh_lock_door(), running in the SCSI error handler thread, waits
for a sched tag held by a requeued command;
- the requeued command cannot complete and release its sched tag until the error handler thread leaves scsi_restart_operations() and restart the queues.
For devices with a single driver tag (e.g. USB storage) it is a guaranteed deadlock and I/O that can never be submitted. This problem has also been reproduced in our environment.
Locking the door is a best-effort operation, and scsi_eh_lock_door() already returns silently when the request allocation fails. Pass BLK_MQ_REQ_NOWAIT to scsi_alloc_request() so the allocation fails instead of blocking when no tag is available. This breaks the circular dependency and allows the error handler to finish restarting the queues, after which the pending commands are dispatched normally.
--- drivers/scsi/scsi_error.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_error.c +1 -1
@@ -2116,7 +2116,7 @@ static void scsi_eh_lock_door(struct scsi_device *sdev)struct scsi_cmnd *scmd;struct request *req; - req =scsi_alloc_request (sdev->request_queue,REQ_OP_DRV_IN ,0 ); + req =scsi_alloc_request (sdev->request_queue,REQ_OP_DRV_IN ,BLK_MQ_REQ_NOWAIT );if (IS_ERR (req))return ; scmd =blk_mq_rq_to_pdu (req);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 344/1193 ASoC: amd: yc: Add DMI quirk for HyperX OMEN Gaming Laptop 16-ap1xxx
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lin Xianglin <[email protected]>
[ Upstream commit fe21db8c5e7c2a9815a9be54a1f5d556f905506e ]
The HyperX OMEN Gaming Laptop 16-ap1xxx (HP board 8F06) has an internal digital microphone array attached to the AMD ACP PDM controller, but the acp6x machine driver does not register the DMIC sound card because this board is missing from the DMI quirk table, leaving the internal microphone unusable.
Add a DMI quirk entry for the HP board "8F06" so the acp6x DMIC capture card gets registered.
--- sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +7 -0
@@ -668,6 +668,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { DMI_MATCH(DMI_BOARD_NAME, "8E35"), } }, + { + .driver_data = &acp6x_card, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"HP" ), + DMI_MATCH(DMI_BOARD_NAME, "8F06"), + } + }, { .driver_data = &acp6x_card, .matches = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 345/1193 netfilter: nfnetlink_log: wait for rcu grace period before freeing pernet state
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 33d1469b0124cc0baaea7a2032123b77a81e0940 ]
sashiko reports: "nfnl_log_net_exit() calls nf_log_unset(), which clears the logger pointer without an RCU grace period. Immediately after, ops_free_list() frees the per-net state while concurrent packets might still be executing nf_log_packet() under rcu_read_lock()."
Clear the pointer via .pre_exit to make sure rcu readers have completed before pernet storage is free'd. The change in nf_log_syslog.c is only done for consistency: it doesn't use pernet data.
--- net/netfilter/nf_log_syslog.c | 4 ++-- net/netfilter/nfnetlink_log.c | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-)
net/netfilter/nf_log_syslog.c +2 -2
@@ -1004,7 +1004,7 @@ static int __net_init nf_log_syslog_net_init(struct net *net)return ret; } -static void __net_exit nf_log_syslog_net_exit(struct net *net) +static void __net_exit nf_log_syslog_net_pre_exit(struct net *net) {nf_log_unset (net, &nf_ip_logger);nf_log_unset (net, &nf_arp_logger);
@@ -1015,7 +1015,7 @@ static void __net_exit nf_log_syslog_net_exit(struct net *net)static struct pernet_operations nf_log_syslog_net_ops = { .init = nf_log_syslog_net_init, - .exit = nf_log_syslog_net_exit, + .pre_exit = nf_log_syslog_net_pre_exit, };static int __init nf_log_syslog_init (void )
net/netfilter/nfnetlink_log.c +9 -4
@@ -1137,21 +1137,26 @@ static int __net_init nfnl_log_net_init(struct net *net)return 0 ; } -static void __net_exit nfnl_log_net_exit(struct net *net) +static void __net_exit nfnl_log_net_pre_exit(struct net *net) { -struct nfnl_log_net *log =nfnl_log_pernet (net); -unsigned int i; -#ifdef CONFIG_PROC_FS remove_proc_entry ("nfnetlink_log" , net->nf.proc_netfilter);#endif nf_log_unset (net, &nfulnl_logger); +} + +static void __net_exit nfnl_log_net_exit(struct net *net) +{ +struct nfnl_log_net *log =nfnl_log_pernet (net); +unsigned int i; +for (i =0 ; i <INSTANCE_BUCKETS ; i++)WARN_ON_ONCE (!hlist_empty (&log->instance_table[i])); }static struct pernet_operations nfnl_log_net_ops = { .init = nfnl_log_net_init, + .pre_exit = nfnl_log_net_pre_exit, .exit = nfnl_log_net_exit, .id = &nfnl_log_net_id, .size =sizeof (struct nfnl_log_net ),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 346/1193 firmware: stratix10-svc: fix FCS SMC call kernel-doc
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Genevieve Chan <[email protected]>
[ Upstream commit 9b9a6e31bdd1ff20c3ffdab87431672d8bfc2a07 ]
Correct kernel-doc errors for two FCS SMC calls:
INTEL_SIP_SMC_FCS_SEND_CERTIFICATE:
- Describe as async to match STD_CALL_VAL usage
- Replace INTEL_SIP_SMC_FCS_REJECTED with INTEL_SIP_SMC_REJECTED
INTEL_SIP_SMC_FCS_GET_PROVISION_DATA:
- Replace FCS-specific status macros with standard status macros (INTEL_SIP_SMC_STATUS_ERROR and INTEL_SIP_SMC_STATUS_REJECTED)
- Restore return register documentation for a1 (mailbox error), a2 (physical address), and a3 (structure size)
--- include/linux/firmware/intel/stratix10-smc.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
include/linux/firmware/intel/stratix10-smc.h +7 -5
@@ -582,7 +582,7 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE)/** * Request INTEL_SIP_SMC_FUNCID_FCS_SEND_CERTIFICATE -* Sync call to send a signed certificate +* Async call to send a signed certificate * * Call register usage: * a0 INTEL_SIP_SMC_FCS_SEND_CERTIFICATE
@@ -591,7 +591,7 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE)* a3-a7 not used * * Return status: -* a0 INTEL_SIP_SMC_STATUS_OK or INTEL_SIP_SMC_FCS_REJECTED +* a0 INTEL_SIP_SMC_STATUS_OK or INTEL_SIP_SMC_REJECTED * a1-a3 not used */ #define INTEL_SIP_SMC_FUNCID_FCS_SEND_CERTIFICATE 93
@@ -607,9 +607,11 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE)* a1-a7 not used * * Return status: -* a0 INTEL_SIP_SMC_STATUS_OK, INTEL_SIP_SMC_FCS_ERROR or -* INTEL_SIP_SMC_FCS_REJECTED -* a1-a3 not used +* a0 INTEL_SIP_SMC_STATUS_OK, INTEL_SIP_SMC_STATUS_ERROR or +* INTEL_SIP_SMC_STATUS_REJECTED +* a1 mailbox error if a0 is INTEL_SIP_SMC_STATUS_ERROR +* a2 physical address for the structure of fuse and key hashes +* a3 the size of structure * */ #define INTEL_SIP_SMC_FUNCID_FCS_GET_PROVISION_DATA 94
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 347/1193 ksmbd: remove stale channels from all sessions on teardown
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gil Portnoy <[email protected]>
[ Upstream commit b10665730fbf6b5e45fe422badcbbc3f0df96ef5 ]
ksmbd_sessions_deregister() removes a connection's channels from other sessions' channel lists only while conn->binding is still set:
if (conn->binding) {
hash_for_each_safe(sessions_table, ...)
ksmbd_chann_del(conn, sess);
}conn->binding is a transient flag: it is cleared once a binding SESSION_SETUP completes, and also by a subsequent non-binding SESSION_SETUP on the same connection (a reauthentication on a bound channel, or a new SessionId==0 setup). A connection that has bound a channel into another session's ksmbd_chann_list and then clears conn->binding leaves that channel behind when it disconnects: the channel, whose chann->conn points at the now freed struct ksmbd_conn, stays on the owner session's list.
When the owning connection later tears down, the second loop dereferences the stale channel:
xa_for_each(&sess->ksmbd_chann_list, chann_id, chann) if (chann->conn != conn) ksmbd_conn_set_exiting(chann->conn); /* freed */
which is a use-after-free write into the freed ksmbd_conn (the same stale channel is also walked by show_proc_session() through /proc). The session is leaked as well, because its channel list never empties.
Remove the conn->binding gate so a connection always removes its channels from every session on teardown.
--- fs/smb/server/mgmt/user_session.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-)
fs/smb/server/mgmt/user_session.c +11 -14
@@ -232,22 +232,19 @@ void ksmbd_sessions_deregister(struct ksmbd_conn *conn) {struct ksmbd_session *sess;unsigned long id; +struct hlist_node *tmp; +int bkt;down_write (&sessions_table_lock); -if (conn->binding) { -int bkt; -struct hlist_node *tmp; - -hash_for_each_safe (sessions_table, bkt, tmp, sess, hlist) { -if (!ksmbd_chann_del (conn, sess) && -xa_empty (&sess->ksmbd_chann_list)) { -hash_del (&sess->hlist); -down_write (&conn->session_lock); -xa_erase (&conn->sessions, sess->id); -up_write (&conn->session_lock); -if (atomic_dec_and_test (&sess->refcnt)) -ksmbd_session_destroy (sess); - } +hash_for_each_safe (sessions_table, bkt, tmp, sess, hlist) { +if (!ksmbd_chann_del (conn, sess) && +xa_empty (&sess->ksmbd_chann_list)) { +hash_del (&sess->hlist); +down_write (&conn->session_lock); +xa_erase (&conn->sessions, sess->id); +up_write (&conn->session_lock); +if (atomic_dec_and_test (&sess->refcnt)) +ksmbd_session_destroy (sess); } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 348/1193 tracing/histograms: Simplify last_cmd_set()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit 545db7e21e64766e6b7cb987fbfd3e79419726ce ]
Turn a kzalloc()+strcpy()+strncat() into an equivalent and less verbose kasprintf().
--- kernel/trace/trace_events_hist.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
kernel/trace/trace_events_hist.c +2 -9
@@ -775,23 +775,16 @@ static void last_cmd_set(struct trace_event_file *file, char *str) {const char *system =NULL , *name =NULL ;struct trace_event_call *call; -int len;if (!str)return ; -/* sizeof() contains the nul byte */ - len =sizeof (HIST_PREFIX ) +strlen (str);kfree (last_cmd); - last_cmd =kzalloc (len,GFP_KERNEL ); + + last_cmd =kasprintf (GFP_KERNEL ,HIST_PREFIX "%s" , str);if (!last_cmd)return ; -strcpy (last_cmd,HIST_PREFIX ); -/* Again, sizeof() contains the nul byte */ - len -=sizeof (HIST_PREFIX ); -strncat (last_cmd, str, len); -if (file) { call = file->event_call; system = call->class->system;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 349/1193 wifi: mt76: mt7921: validate CLC firmware records
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laxman Acharya Padhya <[email protected]>
[ Upstream commit 9417c5818a0146980c2608fda94c908e604eb033 ]
The CLC region is supplied by firmware, but the loader trusts the region count and each record length. A malformed image can make the region table pointer precede the firmware buffer, make the record loop fail to advance, or index phy->clc past its end. Validate the table and record bounds before dereferencing or copying.
--- .../net/wireless/mediatek/mt76/mt7921/mcu.c | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +24 -4
@@ -372,7 +372,8 @@ static int mt7921_load_clc(struct mt792x_dev *dev, const char *fw_name)struct mt76_dev *mdev = &dev->mt76;struct mt792x_phy *phy = &dev->phy;const struct firmware *fw; -int ret, i, len, offset =0 ; +size_t clc_len, fw_data_len, len, offset =0 ; +int ret, i;u8 *clc_base =NULL , hw_encap =0 ; if (mt7921_disable_clc ||
@@ -397,13 +398,21 @@ static int mt7921_load_clc(struct mt792x_dev *dev, const char *fw_name) } hdr = (const void *)(fw->data + fw->size -sizeof (*hdr)); +if (hdr->n_region > (fw->size -sizeof (*hdr)) /sizeof (*region)) { +dev_err (mdev->dev,"Invalid firmware region table\n" ); + ret = -EINVAL ; + goto out; + } + fw_data_len = fw->size -sizeof (*hdr) - + hdr->n_region *sizeof (*region); +for (i =0 ; i < hdr->n_region; i++) { region = (const void *)((const u8 *)hdr - (hdr->n_region - i) *sizeof (*region)); len =le32_to_cpu (region->len);/* check if we have valid buffer size */ -if (offset + len > fw->size) { +if (len > fw_data_len - offset) {dev_err (mdev->dev,"Invalid firmware region\n" ); ret = -EINVAL ; goto out;
@@ -420,8 +429,19 @@ static int mt7921_load_clc(struct mt792x_dev *dev, const char *fw_name)if (!clc_base) goto out; -for (offset =0 ; offset < len; offset +=le32_to_cpu (clc->len)) { +for (offset =0 ; offset < len; offset += clc_len) { +if (len - offset <sizeof (*clc)) { + ret = -EINVAL ; + goto out; + } + clc = (const struct mt7921_clc *)(clc_base + offset); + clc_len =le32_to_cpu (clc->len); +if (clc_len <sizeof (*clc) || clc_len > len - offset || + clc->idx >=ARRAY_SIZE (phy->clc)) { + ret = -EINVAL ; + goto out; + }/* do not init buf again if chip reset triggered */ if (phy->clc[clc->idx])
@@ -433,7 +453,7 @@ static int mt7921_load_clc(struct mt792x_dev *dev, const char *fw_name)continue ; phy->clc[clc->idx] =devm_kmemdup (mdev->dev, clc, -le32_to_cpu (clc->len), + clc_len,GFP_KERNEL );if (!phy->clc[clc->idx]) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 350/1193 wifi: mt76: mt7921: skip unknown CLC firmware records
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laxman Acharya Padhya <[email protected]>
[ Upstream commit 1a296bfd3e775e515233f746218824fc7dd5ff16 ]
Treat an out-of-range CLC index as newer firmware rather than a malformed image. linux-firmware 20260810 ships MT7922 records with idx 3, and rejecting them made mt7921e fail to probe.
Keep the record-length checks, and report those as errors so a truncated table is visible instead of a silent retry loop.
--- drivers/net/wireless/mediatek/mt76/mt7921/mcu.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +7 -2
@@ -431,18 +431,23 @@ static int mt7921_load_clc(struct mt792x_dev *dev, const char *fw_name)for (offset =0 ; offset < len; offset += clc_len) {if (len - offset <sizeof (*clc)) { +dev_err (mdev->dev,"Invalid CLC record\n" ); ret = -EINVAL ; goto out; } clc = (const struct mt7921_clc *)(clc_base + offset); clc_len =le32_to_cpu (clc->len); -if (clc_len <sizeof (*clc) || clc_len > len - offset || - clc->idx >=ARRAY_SIZE (phy->clc)) { +if (clc_len <sizeof (*clc) || clc_len > len - offset) { +dev_err (mdev->dev,"Invalid CLC record\n" ); ret = -EINVAL ; goto out; } +/* Newer firmware may add records this driver does not use yet */ +if (clc->idx >=ARRAY_SIZE (phy->clc)) +continue ; +/* do not init buf again if chip reset triggered */ if (phy->clc[clc->idx])continue ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 351/1193 ppp_async: drop the errored frame instead of resetting its headroom
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vlatko Kosturjak <[email protected]>
[ Upstream commit 8dc5d98a16fa23c00999aecf10018c9f69fa5bf4 ]
ppp_receive_nonmp_frame() prepends a two-byte direction tag before running the pass/active BPF filters:
*(__be16 *)skb_push(skb, 2) = htons(PPP_FILTER_INBOUND_TAG);
Nothing on the receive path guarantees those two bytes of headroom. The frame-error path in ppp_async's process_input_packet() resets a reused skb's headroom to zero while claiming to restore it to a freshly allocated state - but a fresh skb from dev_alloc_skb() carries NET_SKB_PAD:
err:
if (skb) {
/* make skb appear as freshly allocated */
skb_trim(skb, 0);
skb_reserve(skb, - skb_headroom(skb));
}ap->rpkt still points at that skb, so the next frame is reassembled into it with no headroom at all. A peer that sends a bad-FCS frame followed by one beginning ff 03 then leaves a single byte of headroom by the time the filter tag is pushed, which lands one byte below skb->head:
skbuff: skb_under_panic: len:49 put:2 head:ffff888003c10000
data:ffff888003c0ffff tail:0x30 end:0x640 dev:<NULL> kernel BUG at net/core/skbuff.c:214! RIP: 0010:skb_panic+0x13e/0x230 Call Trace: skb_push+0xbd/0x100 ppp_receive_nonmp_frame+0x48a/0x1d10 ppp_input+0x4e9/0x2f80 ppp_async_process+0x2a/0xe0 tasklet_action_common+0x20f/0x8a0 handle_softirqs+0x18e/0x590 Kernel panic - not syncing: Fatal exception in interrupt
Zeroing the headroom violates the NET_SKB_PAD guarantee that dev_alloc_skb() gives the rest of the receive path. Besides the filter panic above, when CCP compression is enabled ppp_decompress_frame() hands skb->data - 2 to ->decompress()/->incomp(), which then reads out of bounds before skb->head for the same reason.
Rather than restore the headroom, drop the errored frame - as ppp_synctty already does on its error path - and clear ap->rpkt so the next frame is reassembled into a fresh skb with proper headroom. This is simpler and fixes both the filter under-panic and the CCP out-of-bounds read.
The original V1 of this patch made room in ppp_receive_nonmp_frame() with skb_cow_head(); Eric pointed out that fixing the root cause in the transport is the right approach.
Found by fuzzing the PPP receive path with a mutating peer on a pty; it is an interesting (remote) DoS: root configures PPP, the peer supplies two crashing frames. The reproducer (repro-ppp-skb.c, unchanged from v1) panics in about a second, and returns cleanly with this applied.
--- drivers/net/ppp/ppp_async.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/net/ppp/ppp_async.c +2 -5
@@ -811,11 +811,8 @@ process_input_packet(struct asyncppp *ap) err:/* frame had an error, remember that, reset SC_TOSS & SC_ESCAPE */ ap->state =SC_PREV_ERROR ; -if (skb) { -/* make skb appear as freshly allocated */ -skb_trim (skb,0 ); -skb_reserve (skb, -skb_headroom (skb)); - } +kfree_skb (skb); + ap->rpkt =NULL ; }/* Called when the tty driver has data for us. Runs parallel with the
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 352/1193 drop_monitor: perform u64_stats updates under IRQ-disabled section
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 fd098a23bf8fda7eae48db9b06e7c34fc4d228fa ]
In net_dm_packet_trace_kfree_skb_hit() and net_dm_hw_trap_packet_probe(), u64_stats_update_begin() / u64_stats_inc() / u64_stats_update_end() were called after spin_unlock_irqrestore(&...drop_queue.lock, flags), when local IRQs had already been re-enabled.
Tracepoint probes can execute in IRQ or softirq context. On 32-bit architectures, u64_stats_update_begin() disables preemption but not interrupts, relying on seqcount writes. If a nested interrupt occurs on the same CPU during the 64-bit stats update, the reentrant seqcount update can corrupt the seqcount state or stats value.
Fix this by performing the 64-bit per-CPU stats update before releasing drop_queue.lock via spin_unlock_irqrestore(), ensuring local interrupts remain disabled during the u64_stats update.
--- net/core/drop_monitor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/drop_monitor.c +2 -2
@@ -528,10 +528,10 @@ static void net_dm_packet_trace_kfree_skb_hit(void *ignore,return ; unlock_free: -spin_unlock_irqrestore (&data->drop_queue.lock, flags);u64_stats_update_begin (&data->stats.syncp);u64_stats_inc (&data->stats.dropped);u64_stats_update_end (&data->stats.syncp); +spin_unlock_irqrestore (&data->drop_queue.lock, flags);consume_skb (nskb); }
@@ -999,10 +999,10 @@ net_dm_hw_trap_packet_probe(void *ignore, const struct devlink *devlink,return ; unlock_free: -spin_unlock_irqrestore (&hw_data->drop_queue.lock, flags);u64_stats_update_begin (&hw_data->stats.syncp);u64_stats_inc (&hw_data->stats.dropped);u64_stats_update_end (&hw_data->stats.syncp); +spin_unlock_irqrestore (&hw_data->drop_queue.lock, flags);net_dm_hw_metadata_free (n_hw_metadata); free:consume_skb (nskb);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 326/1193 ksmbd: preserve VFS inherited POSIX ACL mask
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit e148e567a9252643baa125cb65d7ae9c2c6cf68a ]
The VFS initializes a child's POSIX ACL from the parent's default ACL and the requested creation mode. Do not mutate the parent ACL or overwrite the child's VFS-computed access and default ACLs afterwards.
This preserves restrictive ACL_MASK entries and prevents SMB object creation from widening effective permissions.
--- fs/smb/server/vfs.c | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-)
fs/smb/server/vfs.c +1 -25
@@ -1943,10 +1943,6 @@ int ksmbd_vfs_inherit_posix_acl(struct mnt_idmap *idmap, struct path *path, struct inode *parent_inode) { struct posix_acl *acls; -struct posix_acl_entry *pace; -struct dentry *dentry = path->dentry; -struct inode *inode =d_inode (dentry); -int rc, i;if (!IS_ENABLED (CONFIG_FS_POSIX_ACL ))return -EOPNOTSUPP ;
@@ -1954,27 +1950,7 @@ int ksmbd_vfs_inherit_posix_acl(struct mnt_idmap *idmap, acls =get_inode_acl (parent_inode,ACL_TYPE_DEFAULT );if (IS_ERR_OR_NULL (acls))return -ENOENT ; - pace = acls->a_entries; - -for (i =0 ; i < acls->a_count; i++, pace++) { -if (pace->e_tag ==ACL_MASK ) { - pace->e_perm =0x07 ; -break ; - } - } - - rc =set_posix_acl (idmap, dentry,ACL_TYPE_ACCESS , acls); -if (rc <0 ) -ksmbd_debug (SMB ,"Set posix acl(ACL_TYPE_ACCESS) failed, rc : %d\n" , - rc); -if (S_ISDIR (inode->i_mode)) { - rc =set_posix_acl (idmap, dentry,ACL_TYPE_DEFAULT , - acls); -if (rc <0 ) -ksmbd_debug (SMB ,"Set posix acl(ACL_TYPE_DEFAULT) failed, rc : %d\n" , - rc); - }posix_acl_release (acls); -return rc; +return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 353/1193 drop_monitor: fix size calculations for 64-bit attributes
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 7089f7ab99c89f443c92d8fcc585e63f2727f0b3 ]
net_dm_packet_report_fill() and net_dm_hw_packet_report_fill() use nla_put_u64_64bit() to append 64-bit attributes (NET_DM_ATTR_PC and NET_DM_ATTR_TIMESTAMP).
On 32-bit architectures without CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS, nla_put_u64_64bit() may append a 4-byte NET_DM_ATTR_PAD attribute for 64-bit alignment.
However, net_dm_packet_report_size() and net_dm_hw_packet_report_size() used nla_total_size(sizeof(u64)) instead of nla_total_size_64bit(sizeof(u64)), budgeting 12 bytes instead of up to 16 bytes.
This under-estimation of SKB size can lead to an skb_over_panic() when __nla_reserve() or skb_put() is subsequently called.
Fix this by using nla_total_size_64bit(sizeof(u64)) in both size calculations.
--- net/core/drop_monitor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/core/drop_monitor.c +3 -3
@@ -564,13 +564,13 @@ static size_t net_dm_packet_report_size(size_t payload_len)/* NET_DM_ATTR_ORIGIN */ nla_total_size (sizeof (u16)) +/* NET_DM_ATTR_PC */ -nla_total_size (sizeof (u64)) + +nla_total_size_64bit (sizeof (u64)) +/* NET_DM_ATTR_SYMBOL */ nla_total_size (NET_DM_MAX_SYMBOL_LEN +1 ) +/* NET_DM_ATTR_IN_PORT */ net_dm_in_port_size () +/* NET_DM_ATTR_TIMESTAMP */ -nla_total_size (sizeof (u64)) + +nla_total_size_64bit (sizeof (u64)) +/* NET_DM_ATTR_ORIG_LEN */ nla_total_size (sizeof (u32)) + /* NET_DM_ATTR_PROTO */
@@ -766,7 +766,7 @@ net_dm_hw_packet_report_size(size_t payload_len,/* NET_DM_ATTR_FLOW_ACTION_COOKIE */ net_dm_flow_action_cookie_size (hw_metadata) +/* NET_DM_ATTR_TIMESTAMP */ -nla_total_size (sizeof (u64)) + +nla_total_size_64bit (sizeof (u64)) +/* NET_DM_ATTR_ORIG_LEN */ nla_total_size (sizeof (u32)) + /* NET_DM_ATTR_PROTO */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 354/1193 net: drop_monitor: fix info leak in NET_DM_ATTR_PAYLOAD
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yehyeong Lee <[email protected]>
[ Upstream commit 5e9c8baee0329fbefe7c67aea945e2a07f15e98b ]
net_dm_packet_report_fill() and net_dm_hw_packet_report_fill() open code the NET_DM_ATTR_PAYLOAD attribute to avoid zeroing the packet payload before overwriting it with skb_copy_bits().
skb_put() reserves nla_total_size(payload_len), i.e. the header plus the NLA_ALIGN() padding, but only payload_len bytes are copied in. When payload_len is not a multiple of 4 the 1-3 padding bytes are never initialized and are leaked to user space inside the netlink message.
KMSAN confirms the leak for the software path when the packet payload length is not 4-byte aligned:
BUG: KMSAN: kernel-infoleak in _copy_to_iter _copy_to_iter __skb_datagram_iter skb_copy_datagram_iter netlink_recvmsg sock_recvmsg __sys_recvfrom Uninit was created at: kmem_cache_alloc_node_noprof __alloc_skb net_dm_packet_work Bytes 173-175 of 176 are uninitialized
Use __nla_reserve(), which sets up the attribute header and zeroes the padding, instead of open coding the attribute construction.
--- net/core/drop_monitor.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
net/core/drop_monitor.c +2 -6
@@ -669,9 +669,7 @@ static int net_dm_packet_report_fill(struct sk_buff *msg, struct sk_buff *skb,if (nla_put_u16 (msg,NET_DM_ATTR_PROTO ,be16_to_cpu (skb->protocol))) goto nla_put_failure; - attr =skb_put (msg,nla_total_size (payload_len)); - attr->nla_type =NET_DM_ATTR_PAYLOAD ; - attr->nla_len =nla_attr_size (payload_len); + attr =__nla_reserve (msg,NET_DM_ATTR_PAYLOAD , payload_len);if (skb_copy_bits (skb,0 ,nla_data (attr), payload_len)) goto nla_put_failure;
@@ -829,9 +827,7 @@ static int net_dm_hw_packet_report_fill(struct sk_buff *msg,if (nla_put_u16 (msg,NET_DM_ATTR_PROTO ,be16_to_cpu (skb->protocol))) goto nla_put_failure; - attr =skb_put (msg,nla_total_size (payload_len)); - attr->nla_type =NET_DM_ATTR_PAYLOAD ; - attr->nla_len =nla_attr_size (payload_len); + attr =__nla_reserve (msg,NET_DM_ATTR_PAYLOAD , payload_len);if (skb_copy_bits (skb,0 ,nla_data (attr), payload_len)) goto nla_put_failure;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 355/1193 tipc: fix integer overflow in tipc_recvmsg() and tipc_recvstream()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang (Microsoft) <[email protected]>
[ Upstream commit 47f42ff521b4eeb46e82f9a46a4783a99f7570d7 ]
In tipc_recvmsg(), the copy length is computed as:
copy = min_t(int, dlen - offset, buflen);
buflen is size_t but min_t(int, ...) casts it to int. When buflen exceeds INT_MAX (e.g. 0xFFFFFFFF via io_uring provided buffers), it wraps negative, wins the comparison, and the negative copy length propagates to simple_copy_to_iter() where int-to-size_t promotion makes it SIZE_MAX, triggering a WARN_ON. tipc_recvstream() has the same pattern.
Kernel panic - not syncing: kernel: panic_on_warn set ... RIP: 0010:simple_copy_to_iter+0x9e/0xd0 (net/core/datagram.c:521) Call Trace: __skb_datagram_iter+0x123/0x8b0 (net/core/datagram.c:402) skb_copy_datagram_iter+0x77/0x1a0 (net/core/datagram.c:534) tipc_recvmsg+0x3d7/0xe80 (net/tipc/socket.c:1934) io_recvmsg+0x47e/0xda0
Fix by changing min_t(int, ...) to min_t(size_t, ...) in both functions. The result is always <= (dlen - offset), which is bounded by TIPC maximum message size (0x1ffff bytes), so the implicit narrowing on assignment to int copy is always safe.
--- net/tipc/socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/tipc/socket.c +2 -2
@@ -1940,7 +1940,7 @@ static int tipc_recvmsg(struct socket *sock, struct msghdr *m,if (likely (!err)) {int offset = skb_cb->bytes_read; - copy =min_t (int, dlen - offset, buflen); + copy =min_t (size_t, dlen - offset, buflen); rc =skb_copy_datagram_msg (skb, hlen + offset, m, copy);if (unlikely (rc)) goto exit;
@@ -2072,7 +2072,7 @@ static int tipc_recvstream(struct socket *sock, struct msghdr *m,/* Copy data if msg ok, otherwise return error/partial data */ if (likely (!err)) { offset = skb_cb->bytes_read; - copy =min_t (int, dlen - offset, buflen - copied); + copy =min_t (size_t, dlen - offset, buflen - copied); rc =skb_copy_datagram_msg (skb, hlen + offset, m, copy);if (unlikely (rc))break ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 356/1193 Bluetooth: ISO: fix malformed ISO_END/CONT handling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pauli Virtanen <[email protected]>
[ Upstream commit e054c1a6ae7310d2815778fddb87da616e11c255 ]
Core specification (Part C vol 4 sec 5.4.5) does not exclude empty ISO_CONT, ISO_END packets. We currently reject them if they are last.
If controller sends malformed sequence
ISO_START -> rx_len = 4, ISO_CONT skb->len 4, ISO_START
that ends payload in ISO_CONT, we leak conn->rx_skb. If controller sends too long ISO_END, we panic on skb_put. If controller sends too short ISO_END we accept it.
Fix by marking unfinished ISO_START via conn->rx_skb != NULL. Check skb->len properly before skb_put. Combine the ISO_CONT/END code paths as they require the same initial checks. Reject too short ISO_END packets.
--- net/bluetooth/iso.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-)
net/bluetooth/iso.c +16 -15
@@ -2037,7 +2037,7 @@ void iso_recv(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)switch (pb) {case ISO_START :case ISO_SINGLE : -if (conn->rx_len) { +if (conn->rx_skb || conn->rx_len) {BT_ERR ("Unexpected start frame (len %d)" , skb->len);kfree_skb (conn->rx_skb); conn->rx_skb =NULL ;
@@ -2104,12 +2104,14 @@ void iso_recv(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)break ;case ISO_CONT : -BT_DBG ("Cont: frag len %d (expecting %d)" , skb->len, +case ISO_END : +BT_DBG ("%s: frag len %d (expecting %d)" , + (pb ==ISO_END ) ?"End" :"Cont" , skb->len, conn->rx_len); -if (!conn->rx_len) { -BT_ERR ("Unexpected continuation frame (len %d)" , - skb->len); +if (!conn->rx_skb) { +BT_ERR ("Unexpected ISO %s frame (len %d)" , + (pb ==ISO_END ) ?"End" :"Cont" , skb->len); goto drop; }
@@ -2125,17 +2127,9 @@ void iso_recv(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)skb_copy_from_linear_data (skb,skb_put (conn->rx_skb, skb->len), skb->len); conn->rx_len -= skb->len; -break ; -case ISO_END : -if (!conn->rx_len) { -BT_ERR ("Unexpected end frame (len %d)" , skb->len); - goto drop; - } - -skb_copy_from_linear_data (skb,skb_put (conn->rx_skb, skb->len), - skb->len); - conn->rx_len -= skb->len; +if (pb ==ISO_CONT ) +break ;if (!conn->rx_len) {struct sk_buff *rx_skb = conn->rx_skb;
@@ -2146,6 +2140,13 @@ void iso_recv(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)*/ conn->rx_skb =NULL ;iso_recv_frame (conn, rx_skb); + }else { +BT_ERR ("ISO fragment incomplete (len %d, expected %d)" , + skb->len, conn->rx_len); +kfree_skb (conn->rx_skb); + conn->rx_skb =NULL ; + conn->rx_len =0 ; + goto drop; }break ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 357/1193 bpf: Mask pseudo pointer values in verifier logs
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nuoqi Gui <[email protected]>
[ Upstream commit 72a85e9464a5332fb2cd7efd26d9295275ceda2d ]
print_bpf_insn() masks ldimm64 immediates for pointer-bearing pseudo sources when pointer leaks are not allowed, but the mask only covers BPF_PSEUDO_MAP_FD and BPF_PSEUDO_MAP_VALUE.
BPF_PSEUDO_MAP_IDX, BPF_PSEUDO_MAP_IDX_VALUE, and BPF_PSEUDO_BTF_ID can also be resolved to kernel pointer values before the verifier log prints the instruction. Include them in the existing pointer classification so the log prints 0x0 instead of the rewritten address.
--- kernel/bpf/disasm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/bpf/disasm.c +4 -1
@@ -287,7 +287,10 @@ void print_bpf_insn(const struct bpf_insn_cbs *cbs,*/ u64 imm = ((u64)(insn +1 )->imm <<32 ) | (u32 )insn->imm;bool is_ptr = insn->src_reg ==BPF_PSEUDO_MAP_FD || - insn->src_reg ==BPF_PSEUDO_MAP_VALUE ; + insn->src_reg ==BPF_PSEUDO_MAP_VALUE || + insn->src_reg ==BPF_PSEUDO_MAP_IDX || + insn->src_reg ==BPF_PSEUDO_MAP_IDX_VALUE || + insn->src_reg ==BPF_PSEUDO_BTF_ID ;char tmp[64 ];if (is_ptr && !allow_ptr_leaks)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 358/1193 sctp: fix err_chunk memory leaks in INIT handling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
[ Upstream commit 9f58a0a4d6c2ed5d341bba64f058f15d1b0c36f2 ]
When sctp_verify_init() encounters unrecognized parameters, it allocates an err_chunk to report them. However, this chunk is leaked in several code paths:
1. In sctp_sf_do_5_1B_init(), if security_sctp_assoc_request() fails after sctp_verify_init() has populated err_chunk, the function returns immediately without freeing it.
2. In sctp_sf_do_unexpected_init(), the same leak occurs on the security_sctp_assoc_request() failure path.
3. In sctp_sf_do_unexpected_init(), on the success path after copying unrecognized parameters to the INIT-ACK, the function returns without freeing err_chunk, unlike sctp_sf_do_5_1B_init() which properly frees it.
Fix all three leaks by adding sctp_chunk_free(err_chunk) calls before returning in the error paths and on the success path in sctp_sf_do_unexpected_init().
--- net/sctp/sm_statefuns.c | 5 +++++ 1 file changed, 5 insertions(+)
net/sctp/sm_statefuns.c +5 -0
@@ -415,6 +415,8 @@ enum sctp_disposition sctp_sf_do_5_1B_init(struct net *net,/* Update socket peer label if first association. */ if (security_sctp_assoc_request (new_asoc, chunk->skb)) {sctp_association_free (new_asoc); +if (err_chunk) +sctp_chunk_free (err_chunk);return sctp_sf_pdiscard (net, ep, asoc, type, arg, commands); }
@@ -1606,6 +1608,8 @@ static enum sctp_disposition sctp_sf_do_unexpected_init(/* Update socket peer label if first association. */ if (security_sctp_assoc_request (new_asoc, chunk->skb)) {sctp_association_free (new_asoc); +if (err_chunk) +sctp_chunk_free (err_chunk);return sctp_sf_pdiscard (net, ep, asoc, type, arg, commands); }
@@ -1671,6 +1675,7 @@ static enum sctp_disposition sctp_sf_do_unexpected_init(* parameter type. */ sctp_addto_chunk (repl, len, unk_param); +sctp_chunk_free (err_chunk); }sctp_add_cmd_sf (commands,SCTP_CMD_NEW_ASOC ,SCTP_ASOC (new_asoc));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 359/1193 coresight: platform: defer connection counter increment until alloc succeeds
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jie Gan <[email protected]>
[ Upstream commit 1563ae33dc4f5ebac96b93af2ef72e72aaaa31ae ]
coresight_add_out_conn() increments nr_outconns before calling devm_krealloc_array() and again before devm_kmalloc(). If either allocation fails, the counter is already bumped while the corresponding array entry is NULL or uninitialized garbage.
coresight_add_in_conn() has the same problem with nr_inconns and devm_krealloc_array().
In both cases the probe returns -ENOMEM, which causes coresight_get_platform_data() to call coresight_release_platform_data() for cleanup. That function iterates up to nr_outconns (or nr_inconns) entries and dereferences each pointer unconditionally, hitting the NULL or garbage entry and panicking instead of failing gracefully.
Fix by moving the counter increments to after all allocations succeed, so the struct is always consistent on any error path.
--- drivers/hwtracing/coresight/coresight-platform.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/hwtracing/coresight/coresight-platform.c +6 -6
@@ -45,9 +45,8 @@ coresight_add_out_conn(struct device *dev, } } - pdata->nr_outconns++; pdata->out_conns = -devm_krealloc_array (dev, pdata->out_conns, pdata->nr_outconns, +devm_krealloc_array (dev, pdata->out_conns, pdata->nr_outconns +1 ,sizeof (*pdata->out_conns),GFP_KERNEL );if (!pdata->out_conns)return ERR_PTR (-ENOMEM );
@@ -63,7 +62,8 @@ coresight_add_out_conn(struct device *dev,* used right away. */ *conn = *new_conn; - pdata->out_conns[pdata->nr_outconns -1 ] = conn; + pdata->out_conns[pdata->nr_outconns] = conn; + pdata->nr_outconns++;return conn; }EXPORT_SYMBOL_GPL (coresight_add_out_conn);
@@ -86,13 +86,13 @@ int coresight_add_in_conn(struct coresight_connection *out_conn)return 0 ; } - pdata->nr_inconns++; pdata->in_conns = -devm_krealloc_array (dev, pdata->in_conns, pdata->nr_inconns, +devm_krealloc_array (dev, pdata->in_conns, pdata->nr_inconns +1 ,sizeof (*pdata->in_conns),GFP_KERNEL );if (!pdata->in_conns)return -ENOMEM ; - pdata->in_conns[pdata->nr_inconns -1 ] = out_conn; + pdata->in_conns[pdata->nr_inconns] = out_conn; + pdata->nr_inconns++;return 0 ; }EXPORT_SYMBOL_GPL (coresight_add_in_conn);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 360/1193 RDMA/bnxt_re: Proper rollback if the ioremap fails
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Selvin Xavier <[email protected]>
[ Upstream commit 87267803a8c824616eb147c5dad7030a5db6f878 ]
bnxt_qplib_alloc_dpi returns success even if ioremap fails. Add the proper rollback when the ioremap fails and return -ENOMEM status.
--- drivers/infiniband/hw/bnxt_re/qplib_res.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/infiniband/hw/bnxt_re/qplib_res.c +11 -0
@@ -737,9 +737,13 @@ int bnxt_qplib_alloc_dpi(struct bnxt_qplib_res *res,break ;case BNXT_QPLIB_DPI_TYPE_WC : dpi->dbr =ioremap_wc (umaddr,PAGE_SIZE ); +if (!dpi->dbr) + goto fail_ioremap;break ;default : dpi->dbr =ioremap (umaddr,PAGE_SIZE ); +if (!dpi->dbr) + goto fail_ioremap;break ; }
@@ -747,6 +751,13 @@ int bnxt_qplib_alloc_dpi(struct bnxt_qplib_res *res,mutex_unlock (&res->dpi_tbl_lock);return 0 ; +fail_ioremap: +/* Roll back the bit we just claimed. */ +set_bit (bit_num, dpit->tbl); + dpit->app_tbl[bit_num] =NULL ; +mutex_unlock (&res->dpi_tbl_lock); +return -ENOMEM ; + } int bnxt_qplib_dealloc_dpi(struct bnxt_qplib_res *res,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 361/1193 bpf: Guard __get_user acesss with access_ok for uprobe_multi data
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <[email protected]>
[ Upstream commit 4d87a251d45b4a95eb4c0abcfab809c9f231258a ]
As reported by sashiko [1] we need to use access_ok to check the user space data bounds before we use __get-user to get it.
[1] https://lore.kernel.org/bpf/[email protected]/
--- kernel/trace/bpf_trace.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
kernel/trace/bpf_trace.c +11 -0
@@ -3199,6 +3199,7 @@ int bpf_uprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *prunsigned long __user *uoffsets;u64 __user *ucookies;void __user *upath; +unsigned long size;u32 flags, cnt, i;struct path path;char *name;
@@ -3233,6 +3234,16 @@ int bpf_uprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr uref_ctr_offsets =u64_to_user_ptr (attr->link_create.uprobe_multi.ref_ctr_offsets); ucookies =u64_to_user_ptr (attr->link_create.uprobe_multi.cookies); +/* +* All uoffsets/uref_ctr_offsets/ucookies arrays have the same value +* size, we need to check their address range is safe for __get_user +* calls. +*/ + size =sizeof (*uoffsets) * cnt; +if (!access_ok (uoffsets, size) || !access_ok (uref_ctr_offsets, size) || + !access_ok (ucookies, size)) +return -EFAULT ; + name =strndup_user (upath,PATH_MAX );if (IS_ERR (name)) { err =PTR_ERR (name);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 327/1193 drm/gma500: return errors from Oaktrail HDMI I2C reads
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 9b5ce5c496efd20c1c662cedba88465d39ec1f93 ]
xfer_read() waits for the HDMI I2C transaction to reach I2C_TRANSACTION_DONE, but it ignores both timeout and signal returns from wait_for_completion_interruptible_timeout(). If the interrupt never advances the transaction state, the loop can wait forever.
Return -ETIMEDOUT when the completion wait expires, propagate interrupted waits, and make the I2C master_xfer callback return the first transfer error instead of reporting a successful message count.
--- drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c +16 -5
@@ -95,6 +95,7 @@ static int xfer_read(struct i2c_adapter *adap, struct i2c_msg *pmsg)struct oaktrail_hdmi_dev *hdmi_dev =i2c_get_adapdata (adap);struct hdmi_i2c_dev *i2c_dev = hdmi_dev->i2c_dev;u32 temp; +int ret; i2c_dev->status =I2C_STAT_INIT ; i2c_dev->msg = pmsg;
@@ -106,9 +107,14 @@ static int xfer_read(struct i2c_adapter *adap, struct i2c_msg *pmsg)HDMI_WRITE (HDMI_HI2CHCR , temp);HDMI_READ (HDMI_HI2CHCR ); -while (i2c_dev->status !=I2C_TRANSACTION_DONE ) -wait_for_completion_interruptible_timeout (&i2c_dev->complete, +while (i2c_dev->status !=I2C_TRANSACTION_DONE ) { + ret =wait_for_completion_interruptible_timeout (&i2c_dev->complete,10 *HZ ); +if (ret <0 ) +return ret; +if (!ret) +return -ETIMEDOUT ; + }return 0 ; }
@@ -127,7 +133,7 @@ static int oaktrail_hdmi_i2c_access(struct i2c_adapter *adap, {struct oaktrail_hdmi_dev *hdmi_dev =i2c_get_adapdata (adap);struct hdmi_i2c_dev *i2c_dev = hdmi_dev->i2c_dev; -int i; +int i, ret =0 ;mutex_lock (&i2c_dev->i2c_lock);
@@ -139,9 +145,11 @@ static int oaktrail_hdmi_i2c_access(struct i2c_adapter *adap,for (i =0 ; i < num; i++) {if (pmsg->len && pmsg->buf) {if (pmsg->flags &I2C_M_RD ) -xfer_read (adap, pmsg); + ret =xfer_read (adap, pmsg);else -xfer_write (adap, pmsg); + ret =xfer_write (adap, pmsg); +if (ret) +break ; } pmsg++;/* next message */ }
@@ -151,6 +159,9 @@ static int oaktrail_hdmi_i2c_access(struct i2c_adapter *adap,mutex_unlock (&i2c_dev->i2c_lock); +if (ret) +return ret; +return i; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 362/1193 ipv4: fib: Dont dump dying fib_info in fib_leaf_notify().
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 06b693d2eb6651a63ad85bad8673de3b7d4edd6d ]
syzbot reported use-after-free in nsim_fib4_prepare_event(). [0]
The problem is that the following functions call fib_info_hold() / refcount_inc() while dumping fib_info under RCU, which is unsafe.
* mlxsw_sp_router_fib4_event()
* rocker_router_fib_event()
* nsim_fib4_prepare_event()
refcount_inc_not_zero() must be used, but it would be too late there.
Let's guarantee the lifetime of fib_info in fib_leaf_notify().
Note that IPv6 does not need the corresponding change since fib6_table_dump() holds fib6_table.tb6_lock.
[0]:refcount_t: addition on 0; use-after-free.
WARNING: lib/refcount.c:25 at refcount_warn_saturate+0x9f/0x110 lib/refcount.c:25, CPU#0: kworker/u8:15/3420
Modules linked in:
CPU: 0 UID: 0 PID: 3420 Comm: kworker/u8:15 Not tainted syzkaller #0 PREEMPT_{RT,(full)}
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/18/2026
Workqueue: netns cleanup_net
RIP: 0010:refcount_warn_saturate+0x9f/0x110 lib/refcount.c:25
Code: eb 66 85 db 74 3e 83 fb 01 75 4c e8 1b f1 22 fd 48 8d 3d 84 cb f1 0a 67 48 0f b9 3a eb 4a e8 08 f1 22 fd 48 8d 3d 81 cb f1 0a <67> 48 0f b9 3a eb 37 e8 f5 f0 22 fd 48 8d 3d 7e cb f1 0a 67 48 0f
RSP: 0018:ffffc9000f2c7270 EFLAGS: 00010293
RAX: ffffffff84a18858 RBX: 0000000000000002 RCX: ffff888032ff9ec0
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff8f9353e0
RBP: 0000000000000000 R08: ffff888032ff9ec0 R09: 0000000000000005
R10: 0000000000000100 R11: 0000000000000004 R12: ffff8880570cc000
R13: dffffc0000000000 R14: ffff88802b40563c R15: ffff8880570cc000
FS: 0000000000000000(0000) GS:ffff888126173000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fb1f4d5d000 CR3: 000000006072a000 CR4: 00000000003526f0
Call Trace:
<TASK>
__refcount_add include/linux/refcount.h:-1 [inline]
__refcount_inc include/linux/refcount.h:366 [inline]
refcount_inc include/linux/refcount.h:383 [inline]
fib_info_hold include/net/ip_fib.h:629 [inline]
nsim_fib4_prepare_event drivers/net/netdevsim/fib.c:930 [inline]
nsim_fib_event_schedule_work drivers/net/netdevsim/fib.c:1000 [inline]
nsim_fib_event_nb+0x1055/0x1240 drivers/net/netdevsim/fib.c:1043
call_fib_notifier+0x45/0x80 net/core/fib_notifier.c:25
call_fib_entry_notifier net/ipv4/fib_trie.c:90 [inline]
fib_leaf_notify net/ipv4/fib_trie.c:2176 [inline]
fib_table_notify net/ipv4/fib_trie.c:2194 [inline]
fib_notify+0x36b/0x5e0 net/ipv4/fib_trie.c:2217
fib_net_dump net/core/fib_notifier.c:70 [inline]
register_fib_notifier+0x184/0x360 net/core/fib_notifier.c:108
nsim_fib_create+0x85d/0x9f0 drivers/net/netdevsim/fib.c:1596
nsim_dev_reload_create drivers/net/netdevsim/dev.c:1604 [inline]
nsim_dev_reload_up+0x374/0x7c0 drivers/net/netdevsim/dev.c:1058
devlink_reload+0x501/0x8d0 net/devlink/dev.c:475
devlink_pernet_pre_exit+0x1ff/0x420 net/devlink/core.c:558
ops_pre_exit_list net/core/net_namespace.c:161 [inline]
ops_undo_list+0x187/0x940 net/core/net_namespace.c:234
cleanup_net+0x56e/0x800 net/core/net_namespace.c:702
process_one_work kernel/workqueue.c:3314 [inline]
process_scheduled_works+0xb5d/0x1860 kernel/workqueue.c:3397
worker_thread+0xa53/0xfc0 kernel/workqueue.c:3478
kthread+0x388/0x470 kernel/kthread.c:436
ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
</TASK>--- include/net/ip_fib.h | 5 +++++ net/ipv4/fib_trie.c | 4 ++++ 2 files changed, 9 insertions(+)
include/net/ip_fib.h +5 -0
@@ -576,6 +576,11 @@ static inline void fib_info_hold(struct fib_info *fi)refcount_inc (&fi->fib_clntref); } +static inline bool fib_info_hold_safe (struct fib_info *fi) +{ +return refcount_inc_not_zero (&fi->fib_clntref); +} +static inline void fib_info_put (struct fib_info *fi) {if (refcount_dec_and_test (&fi->fib_clntref))
net/ipv4/fib_trie.c +4 -0
@@ -2178,10 +2178,14 @@ static int fib_leaf_notify(struct key_vector *l, struct fib_table *tb,if (fa->fa_slen == last_slen)continue ; +if (!fib_info_hold_safe (fa->fa_info)) +continue ; + last_slen = fa->fa_slen; err =call_fib_entry_notifier (nb,FIB_EVENT_ENTRY_REPLACE , l->key,KEYLENGTH - fa->fa_slen, fa, extack); +fib_info_put (fa->fa_info);if (err)return err; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 363/1193 ASoC: topology: Check PCM and DAI name strings before use
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 b7e44d1986d6671342c19b82192189ca5db5dab7 ]
Topology objects store several PCM and DAI names in fixed-size UAPI arrays. Other topology parser paths validate these fields with bounded strnlen() checks before using them as C strings, but the PCM and DAI paths still pass some fixed-size arrays directly to strlen(), devm_kstrdup(), DAI lookup, and diagnostic prints.
A malformed topology blob with a non-NUL-terminated PCM, DAI, or stream capability name can therefore make the parser read past the end of the fixed-size field.
Reject unterminated PCM and DAI name fields before consuming them as C strings.
--- sound/soc/soc-topology.c | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-)
sound/soc/soc-topology.c +34 -3
@@ -1523,9 +1523,24 @@ static int soc_tplg_dapm_complete(struct soc_tplg *tplg)return ret; } +static int soc_tplg_check_name (const char *name) +{ +if (strnlen (name,SNDRV_CTL_ELEM_ID_NAME_MAXLEN ) == +SNDRV_CTL_ELEM_ID_NAME_MAXLEN ) +return -EINVAL ; + +return 0 ; +} +static int set_stream_info (struct soc_tplg *tplg,struct snd_soc_pcm_stream *stream,struct snd_soc_tplg_stream_caps *caps) { +int ret; + + ret =soc_tplg_check_name (caps->name); +if (ret) +return ret; + stream->stream_name =devm_kstrdup (tplg->dev, caps->name,GFP_KERNEL );if (!stream->stream_name)return -ENOMEM ;
@@ -1578,7 +1593,11 @@ static int soc_tplg_dai_create(struct soc_tplg *tplg,if (dai_drv ==NULL )return -ENOMEM ; -if (strlen (pcm->dai_name)) { + ret =soc_tplg_check_name (pcm->dai_name); +if (ret) + goto err; + +if (pcm->dai_name[0 ]) { dai_drv->name =devm_kstrdup (tplg->dev, pcm->dai_name,GFP_KERNEL );if (!dai_drv->name) { ret = -ENOMEM ;
@@ -1684,7 +1703,11 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg,if (tplg->ops) link->dobj.unload = tplg->ops->link_unload; -if (strlen (pcm->pcm_name)) { + ret =soc_tplg_check_name (pcm->pcm_name); +if (ret) + goto err; + +if (pcm->pcm_name[0 ]) { link->name =devm_kstrdup (tplg->dev, pcm->pcm_name,GFP_KERNEL ); link->stream_name =devm_kstrdup (tplg->dev, pcm->pcm_name,GFP_KERNEL );if (!link->name || !link->stream_name) {
@@ -1694,7 +1717,11 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg, } link->id =le32_to_cpu (pcm->pcm_id); -if (strlen (pcm->dai_name)) { + ret =soc_tplg_check_name (pcm->dai_name); +if (ret) + goto err; + +if (pcm->dai_name[0 ]) { link->cpus->dai_name =devm_kstrdup (tplg->dev, pcm->dai_name,GFP_KERNEL );if (!link->cpus->dai_name) { ret = -ENOMEM ;
@@ -2188,6 +2215,10 @@ static int soc_tplg_dai_config(struct soc_tplg *tplg,memset (&dai_component,0 ,sizeof (dai_component)); + ret =soc_tplg_check_name (d->dai_name); +if (ret) +return ret; + dai_component.dai_name = d->dai_name; dai =snd_soc_find_dai (&dai_component);if (!dai) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 364/1193 ASoC: meson: aiu: Validate written enum values
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: HyeongJun An <[email protected]>
[ Upstream commit d65adf85477247be04ac86886f8edfaa047b5d4a ]
The AIU HDMI and internal codec mux put callbacks use the written enum value with snd_soc_enum_item_to_val() before checking whether the value is valid for the enumeration.
Reject out-of-range values before converting the enum item, matching the validation already done by the G12A HDMI and internal codec mux controls.
--- sound/soc/meson/aiu-acodec-ctrl.c | 3 +++ sound/soc/meson/aiu-codec-ctrl.c | 3 +++ 2 files changed, 6 insertions(+)
sound/soc/meson/aiu-acodec-ctrl.c +3 -0
@@ -38,6 +38,9 @@ static int aiu_acodec_ctrl_mux_put_enum(struct snd_kcontrol *kcontrol,struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;unsigned int mux, changed; +if (ucontrol->value.enumerated.item[0 ] >= e->items) +return -EINVAL ; + mux =snd_soc_enum_item_to_val (e, ucontrol->value.enumerated.item[0 ]); changed = snd_soc_component_test_bits(component, e->reg, CTRL_DIN_LRCLK_SRC,
sound/soc/meson/aiu-codec-ctrl.c +3 -0
@@ -30,6 +30,9 @@ static int aiu_codec_ctrl_mux_put_enum(struct snd_kcontrol *kcontrol,struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;unsigned int mux, changed; +if (ucontrol->value.enumerated.item[0 ] >= e->items) +return -EINVAL ; + mux =snd_soc_enum_item_to_val (e, ucontrol->value.enumerated.item[0 ]); changed = snd_soc_component_test_bits(component, e->reg, CTRL_DATA_SEL,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 365/1193 ksmbd: use memcmp() to compare ClientGUIDs
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit e8bb506e6ef749ac0336f3e579d8d02396b7d832 ]
ClientGUID is a fixed-size binary value and can contain embedded NUL bytes. strncmp() stops comparing at the first NUL byte, so different ClientGUID values can incorrectly be treated as equal.
Use memcmp() in SMB3 multichannel session binding and FSCTL_VALIDATE_NEGOTIATE_INFO to compare all SMB2_CLIENT_GUID_SIZE bytes.
--- fs/smb/server/smb2pdu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/smb/server/smb2pdu.c +2 -2
@@ -1741,7 +1741,7 @@ int smb2_sess_setup(struct ksmbd_work *work) goto out_err; } -if (strncmp (conn->ClientGUID, sess->ClientGUID, +if (memcmp (conn->ClientGUID, sess->ClientGUID,SMB2_CLIENT_GUID_SIZE )) { rc = -ENOENT ; goto out_err;
@@ -8106,7 +8106,7 @@ static int fsctl_validate_negotiate_info(struct ksmbd_conn *conn, goto err_out; } -if (strncmp (neg_req->Guid, conn->ClientGUID,SMB2_CLIENT_GUID_SIZE )) { +if (memcmp (neg_req->Guid, conn->ClientGUID,SMB2_CLIENT_GUID_SIZE )) { ret = -EINVAL ; goto err_out; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 366/1193 af_unix: Unlink scc_entry in unix_del_edge().
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 594d905195024b228c962627ae5ae7c17bd582a4 ]
Kyle Zeng reported that GC could free a dead SCC partially.
The scenario is as follows:
1) Create two SCCs:
X -. A <-> B
^--'2) Run the following concurrently:
2-1) send() sk-B to sk-B from sk-X
2-2) close() both A and B
At 2-1), there is a small window where unix_add_edges() publishes a new edge (B <-> B) to GC but its skb is not queued by skb_queue_tail().
If 2-2) completes before skb_queue_tail() and GC is triggered, it judges A <-> B as dead, but B is not freed because GC cannot collect the not-yet-queued skb holding the B <-> B edge.
X -. A <-> B -. This edge is visible
^--' ^..' but skb is not
This itself is not a problem since the next GC run will judge B as dead as well and free it finally.
X -. A <.> B -.
^--' ^--'However, X's SCC forces the next GC to call unix_walk_scc_fast(), and it iterates over A through B's scc_entry.
Let's unlink scc_entry before freeing the vertex in unix_del_edge().
--- net/unix/garbage.c | 1 + 1 file changed, 1 insertion(+)
net/unix/garbage.c +1 -0
@@ -173,6 +173,7 @@ static void unix_del_edge(struct scm_fp_list *fpl, struct unix_edge *edge)if (!vertex->out_degree) { edge->predecessor->vertex =NULL ;list_move_tail (&vertex->entry, &fpl->vertices); +list_del (&vertex->scc_entry); } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 367/1193 of: dynamic: Fix overlayed devices not probing because of fw_devlink
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Saravana Kannan <[email protected]>
[ Upstream commit 81e7c6befa36cecdcbf7244393bd67e8f8c59bf5 ]
When an overlay is applied, if the target device has already probed successfully and bound to a device, then some of the fw_devlink logic that ran when the device was probed needs to be rerun. This allows newly created dangling consumers of the overlayed device tree nodes to be moved to become consumers of the target device.
[Herve: Add the call to driver_deferred_probe_trigger()] [Herve: Use fwnode_test_flag() to test fwnode flags value]
--- drivers/base/core.c | 81 ++++++++++++++++++++++++++++++++++++++---- drivers/of/overlay.c | 15 ++++++++ include/linux/fwnode.h | 1 + 3 files changed, 90 insertions(+), 7 deletions(-)
drivers/base/core.c +74 -7
@@ -235,6 +235,79 @@ static void __fw_devlink_pickup_dangling_consumers(struct fwnode_handle *fwnode,__fw_devlink_pickup_dangling_consumers (child, new_sup); } +static void fw_devlink_pickup_dangling_consumers (struct device *dev) +{ +struct fwnode_handle *child; + +guard (mutex)(&fwnode_link_lock); + +fwnode_for_each_available_child_node (dev->fwnode, child) +__fw_devlink_pickup_dangling_consumers (child, dev->fwnode); +__fw_devlink_link_to_consumers (dev); +} + +/** +* fw_devlink_refresh_fwnode - Recheck the tree under this firmware node +* @fwnode: The fwnode under which the fwnode tree has changed +* +* This function is mainly meant to adjust the supplier/consumer dependencies +* after a fwnode tree overlay has occurred. +*/ +void fw_devlink_refresh_fwnode (struct fwnode_handle *fwnode) +{ +struct device *dev; + +/* +* Find the closest ancestor fwnode that has been converted to a device +* that can bind to a driver (bus device). +*/ +fwnode_handle_get (fwnode); +do { +if (fwnode_test_flag (fwnode,FWNODE_FLAG_NOT_DEVICE )) +continue ; + + dev =get_dev_from_fwnode (fwnode); +if (!dev) +continue ; + +if (dev->bus) +break ; + +put_device (dev); + }while ((fwnode =fwnode_get_next_parent (fwnode))); + +/* +* If none of the ancestor fwnodes have (yet) been converted to a device +* that can bind to a driver, there's nothing to fix up. +*/ +if (!fwnode) +return ; + +WARN (device_is_bound (dev) && dev->links.status !=DL_DEV_DRIVER_BOUND , +"Don't multithread overlaying and probing the same device!\n" ); + +/* +* If the device has already bound to a driver, then we need to redo +* some of the work that was done after the device was bound to a +* driver. If the device hasn't bound to a driver, running things too +* soon would incorrectly pick up consumers that it shouldn't. +*/ +if (dev->links.status ==DL_DEV_DRIVER_BOUND ) { +fw_devlink_pickup_dangling_consumers (dev); +/* +* Some of dangling consumers could have been put previously in +* the deferred probe list due to the unavailability of their +* suppliers. Those consumers have been picked up and some of +* their suppliers links have been updated. Time to re-try their +* probe sequence. +*/ +driver_deferred_probe_trigger (); + } + +put_device (dev); +fwnode_handle_put (fwnode); +} +static DEFINE_MUTEX (device_links_lock);DEFINE_STATIC_SRCU (device_links_srcu);
@@ -1320,14 +1393,8 @@ void device_links_driver_bound(struct device *dev)* child firmware node. */ if (dev->fwnode && dev->fwnode->dev == dev) { -struct fwnode_handle *child;fwnode_links_purge_suppliers (dev->fwnode); -mutex_lock (&fwnode_link_lock); -fwnode_for_each_available_child_node (dev->fwnode, child) -__fw_devlink_pickup_dangling_consumers (child, - dev->fwnode); -__fw_devlink_link_to_consumers (dev); -mutex_unlock (&fwnode_link_lock); +fw_devlink_pickup_dangling_consumers (dev); }device_remove_file (dev, &dev_attr_waiting_for_supplier);
drivers/of/overlay.c +15 -0
@@ -179,6 +179,15 @@ static int overlay_notify(struct overlay_changeset *ovcs,return 0 ; } +static void overlay_fw_devlink_refresh (struct overlay_changeset *ovcs) +{ +for (int i =0 ; i < ovcs->count; i++) { +struct device_node *np = ovcs->fragments[i].target; + +fw_devlink_refresh_fwnode (of_fwnode_handle (np)); + } +} +/* * The values of properties in the "/__symbols__" node are paths in * the ovcs->overlay_root. When duplicating the properties, the paths
@@ -948,6 +957,12 @@ static int of_overlay_apply(struct overlay_changeset *ovcs,pr_err ("overlay apply changeset entry notify error %d\n" , ret);/* notify failure is not fatal, continue */ +/* +* Needs to happen after changeset notify to give the listeners a chance +* to finish creating all the devices they need to create. +*/ +overlay_fw_devlink_refresh (ovcs); + ret_tmp =overlay_notify (ovcs,OF_OVERLAY_POST_APPLY );if (ret_tmp)if (!ret)
include/linux/fwnode.h +1 -0
@@ -238,5 +238,6 @@ extern bool fw_devlink_is_strict(void);int fwnode_link_add (struct fwnode_handle *con,struct fwnode_handle *sup);void fwnode_links_purge (struct fwnode_handle *fwnode);void fw_devlink_purge_absent_suppliers (struct fwnode_handle *fwnode); +void fw_devlink_refresh_fwnode (struct fwnode_handle *fwnode);#endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 368/1193 mm/damon/core: avoid infinite kdamond_merge_regions() internal loop
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SJ Park <[email protected]>
commit 123e4619ab6c8ab1c4cb1d7a58311a2af13929cd upstream.
Patch series "mm/damon: unurgent fixes for infinite loop, NULL de-ref and races", v1.1.
Sashiko found a few issues in DAMON that could cause infinite loop, NULL dereference and monitoring results degradation. The first two sounds scary but the infinite loop happens only under unreasonable user setup. The NULL dereference is only in a unit test. Monitoring results degradation is trivial since it is only best-effort, and those happens from only unlikely races. Still those are bugs that better to fix if possible. Fix those.
This patch (of 6):
Due to online parameter update like events, the number of DAMON regions could be higher than the user-set upper limit. kdamond_merge_regions() repeats merge regions until the number meets the limit, while doubling the merge threshold up to the theoretical maximum threshold. It is tried only up to the theoretical maximum threshold because even the aggressive merging can fail from reducing the number of regions under the user-defined upper limit. For example, there could be many user-defined non-contiguous regions that cannot be merged.
The threshold based loop break condition is evaluated by comparing the threshold for the next merging try against the theoretical maximum threshold. If max_thres is larger than UINT_MAX / 2, doubling the threshold could make it overflow, and bypass the loop break condition. In the case, if the number of regions cannot be reduced under the upper limit like explained above, the loop will run infinitely.
Prevent the case by doing the break condition check before doubling the threshold. Also, prevent the threshold exceeding the maximum threshold, as it could overflow and apply the wrong merge threshold.
This issue is unlikely to occur in real world, since having the max_thres higher than UINT_MAX / 2 require unrealistically large aggregation intervals compared to the sampling interval. Also, it requires an unrealistically large number of uncontiguous regions setup. Nonetheless, the consequence is bad and the fix is simple.
The issue was discovered [1] by Sashiko.
--- mm/damon/core.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
mm/damon/core.c +9 -4
@@ -1240,7 +1240,7 @@ static void kdamond_merge_regions(struct damon_ctx *c, unsigned int threshold, max_thres = c->attrs.aggr_interval / (c->attrs.sample_interval ? c->attrs.sample_interval :1 ); - do { +while (true) { nr_regions =0 ;damon_for_each_target (t, c) { damon_merge_regions_of(t, threshold, sz_limit,
@@ -1248,9 +1248,14 @@ static void kdamond_merge_regions(struct damon_ctx *c, unsigned int threshold, nr_regions +=damon_nr_regions (t); } count_age = false; - threshold =max (1 , threshold *2 ); - }while (nr_regions > c->attrs.max_nr_regions && - threshold /2 < max_thres); +if (nr_regions <= c->attrs.max_nr_regions || + max_thres <= threshold) +break ; +if (threshold < max_thres /2 ) + threshold =max (1 , threshold *2 ); +else + threshold = max_thres; + } }/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 369/1193 Revert "Bluetooth: btusb: Add ASUS USB-BT600 for Realtek 8761CU"
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
This reverts commit 0725f93b395f731a9d014235816f5312c21ba4ea.
--- drivers/bluetooth/btusb.c | 2 -- 1 file changed, 2 deletions(-)
drivers/bluetooth/btusb.c +0 -2
@@ -756,8 +756,6 @@ static const struct usb_device_id quirks_table[] = {/* Additional Realtek 8761CU Bluetooth devices */ { USB_DEVICE(0x0b05, 0x1bef), .driver_info = BTUSB_REALTEK | BTUSB_WIDEBAND_SPEECH }, - { USB_DEVICE(0x0b05, 0x1d70), .driver_info = BTUSB_REALTEK | - BTUSB_WIDEBAND_SPEECH }, /* Additional Realtek 8821AE Bluetooth devices */ { USB_DEVICE(0x0b05, 0x17dc), .driver_info = BTUSB_REALTEK },
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 370/1193 Revert "Bluetooth: btusb: Add ASUS USB-BT540 for Realtek 8761CU"
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
This reverts commit 1b5fb9c40e301491a02d4741dbb5473c11439038.
--- drivers/bluetooth/btusb.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/bluetooth/btusb.c +0 -4
@@ -753,10 +753,6 @@ static const struct usb_device_id quirks_table[] = { { USB_DEVICE(0x37ad, 0x0600), .driver_info = BTUSB_REALTEK | BTUSB_WIDEBAND_SPEECH }, - /* Additional Realtek 8761CU Bluetooth devices */ - { USB_DEVICE(0x0b05, 0x1bef), .driver_info = BTUSB_REALTEK | - BTUSB_WIDEBAND_SPEECH }, - /* Additional Realtek 8821AE Bluetooth devices */ { USB_DEVICE(0x0b05, 0x17dc), .driver_info = BTUSB_REALTEK }, { USB_DEVICE(0x13d3, 0x3414), .driver_info = BTUSB_REALTEK },
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 328/1193 phonet: check register_netdevice_notifier() error in phonet_device_init()
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 d1ff66b66151c14b084e88040512a064b1c1e493 ]
phonet_device_init() registers a netdevice notifier before calling phonet_netlink_register(), but does not check whether notifier registration succeeded. On failure, netlink setup still proceeds and init may return success without the notifier in place.
Also, the existing phonet_netlink_register() failure path called phonet_device_exit(), which runs rtnl_unregister_all() even though rtnl_register_many() already unwound any partial registration. Calling the full exit helper on a partial init is not correct.
Check each registration error, including proc_create_net(), and unwind only the steps that have succeeded so far, in reverse order.
--- net/phonet/pn_dev.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-)
net/phonet/pn_dev.c +24 -6
@@ -336,16 +336,34 @@ static struct pernet_operations phonet_net_ops = {/* Initialize Phonet devices list */ int __init phonet_device_init (void ) { -int err =register_pernet_subsys (&phonet_net_ops); +int err; + + err =register_pernet_subsys (&phonet_net_ops);if (err)return err; -proc_create_net ("pnresource" ,0 , init_net.proc_net, &pn_res_seq_ops, -sizeof (struct seq_net_private )); -register_netdevice_notifier (&phonet_device_notifier); +if (!proc_create_net ("pnresource" ,0 , init_net.proc_net, + &pn_res_seq_ops,sizeof (struct seq_net_private ))) { + err = -ENOMEM ; + goto err_pernet; + } + + err =register_netdevice_notifier (&phonet_device_notifier); +if (err) + goto err_proc; + err =phonet_netlink_register ();if (err) -phonet_device_exit (); + goto err_notifier; + +return 0 ; + +err_notifier: +unregister_netdevice_notifier (&phonet_device_notifier); +err_proc: +remove_proc_entry ("pnresource" , init_net.proc_net); +err_pernet: +unregister_pernet_subsys (&phonet_net_ops);return err; }
@@ -353,8 +371,8 @@ void phonet_device_exit(void) {rtnl_unregister_all (PF_PHONET );unregister_netdevice_notifier (&phonet_device_notifier); -unregister_pernet_subsys (&phonet_net_ops);remove_proc_entry ("pnresource" , init_net.proc_net); +unregister_pernet_subsys (&phonet_net_ops); }int phonet_route_add (struct net_device *dev,u8 daddr)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 329/1193 ALSA: usb-audio: Add dB map quirk for Razer Barracuda X 2.4
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Markus Lindner <[email protected]>
[ Upstream commit acd8aa3c4b91a38c8521000790890bc9d1083f1d ]
The Razer Barracuda X 2.4 GHz USB headset dongle (0x1532:0x0552) reports a minimum volume register value of cval->min = -16800.
In UAC 1/256 dB units, -16800 corresponds to -65.625 dB. However, stock ALSA misinterprets this raw integer as 1/100 dB units (-168.00 dB), causing user-space audio servers (PipeWire / PulseAudio) to map their volume curves against an incorrectly wide range.
Add an explicit usbmix_dB_map entry overriding Unit 2 to -6562 (-65.62 dB) to accurately report the physical hardware attenuation bounds.
--- sound/usb/mixer_maps.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
sound/usb/mixer_maps.c +15 -0
@@ -344,6 +344,16 @@ static const struct usbmix_name_map bose_soundlink_map[] = { { 0 } /* terminator */ }; +/* +* Razer Barracuda X 2.4: Firmware reports cval->min = -16800 in 1/256 dB units +* (-65.62 dB), which stock ALSA misinterprets as a -168 dB floor +*/ +static const struct usbmix_dB_map razer_barracuda_x_2_4_dB = {-6562 ,0 }; +static const struct usbmix_name_map razer_barracuda_x_2_4_map[] = { + {2 ,NULL , .dB = &razer_barracuda_x_2_4_dB }, + {0 }/* terminator */ +}; +/* Sennheiser Communications Headset [PC 8], the dB value is reported as -6 negative maximum */ static const struct usbmix_dB_map sennheiser_pc8_dB = {-9500 ,0 };static const struct usbmix_name_map sennheiser_pc8_map[] = {
@@ -689,6 +699,11 @@ static const struct usbmix_ctl_map usbmix_ctl_maps[] = { .id = USB_ID(0x17aa, 0x1046), .map = lenovo_p620_rear_map, }, + { +/* Razer Barracuda X 2.4 */ + .id = USB_ID(0x1532, 0x0552), + .map = razer_barracuda_x_2_4_map, + }, {/* Sennheiser Communications Headset [PC 8] */ .id = USB_ID(0x1395, 0x0025),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 330/1193 ALSA: hda/realtek: Add mute LED quirk for HP Laptop 14s-dr1xxx
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Madhavender Singh <[email protected]>
[ Upstream commit bf4fc9f33ec21595143132a3e7fb8b5d2c2261cd ]
This laptop with an ALC236 codec requires theALC236_FIXUP_HP_MUTE_LED_COEFBIT2
fixup for its mute LED to function correctly.
Add the subsystem ID 0x103c:0x86c8 to the quirk table to apply this fixup.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10104,6 +10104,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x869d ,"HP" ,ALC236_FIXUP_HP_MUTE_LED ),SND_PCI_QUIRK (0x103c ,0x86c1 ,"HP Laptop 15-da3001TU" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ),SND_PCI_QUIRK (0x103c ,0x86c7 ,"HP Envy AiO 32" ,ALC274_FIXUP_HP_ENVY_GPIO ), +SND_PCI_QUIRK (0x103c ,0x86c8 ,"HP Laptop 14s-dr1xxx" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ),SND_PCI_QUIRK (0x103c ,0x86e7 ,"HP Spectre x360 15-eb0xxx" ,ALC285_FIXUP_HP_SPECTRE_X360_EB1 ),SND_PCI_QUIRK (0x103c ,0x863e ,"HP Spectre x360 15-df1xxx" ,ALC285_FIXUP_HP_SPECTRE_X360_DF1 ), SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 331/1193 ice: pass the return value of skb_checksum_help()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Swiatkowski <[email protected]>
[ Upstream commit 2d19302f628853742c4828381abbd668c1315598 ]
skb_checksum_help() can fail. Pass its return value back to the caller.
Commonize this software path in goto.
Instead of just returning error try calculating software checksum first. There is a check for TSO in checksum_sw_fb.
--- drivers/net/ethernet/intel/ice/ice_txrx.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/net/ethernet/intel/ice/ice_txrx.c +9 -11
@@ -1872,7 +1872,7 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off) ret =ipv6_skip_exthdr (skb, exthdr - skb->data, &l4_proto, &frag_off);if (ret <0 ) -return -1 ; + goto checksum_sw_fb; }/* define outer transport */
@@ -1891,11 +1891,7 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off) l4.hdr =skb_inner_network_header (skb);break ;default : -if (first->tx_flags &ICE_TX_FLAGS_TSO ) -return -1 ; - -skb_checksum_help (skb); -return 0 ; + goto checksum_sw_fb; }/* compute outer L3 header size */
@@ -1954,7 +1950,7 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off)ipv6_skip_exthdr (skb, exthdr - skb->data, &l4_proto, &frag_off); }else { -return -1 ; + goto checksum_sw_fb; }/* compute inner L3 header size */
@@ -1983,15 +1979,17 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off)break ;default : -if (first->tx_flags &ICE_TX_FLAGS_TSO ) -return -1 ; -skb_checksum_help (skb); -return 0 ; + goto checksum_sw_fb; } off->td_cmd |= cmd; off->td_offset |= offset;return 1 ; + +checksum_sw_fb: +if (first->tx_flags &ICE_TX_FLAGS_TSO ) +return -1 ; +return skb_checksum_help (skb); }/**
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 332/1193 powerpc/pseries: Ensure vpa,slb_shadow & dtl are unregistered during crash
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vaibhav Jain <[email protected]>
[ Upstream commit 810d07fb4cf7577847f85a6fd6273b69cad8d580 ]
Currently pseries_kexec_cpu_down() skips unregistering vpa, slb_shadow and dtl areas during a crash and kexec shutdown path. It was done to avoid doing an HCALL while crashing. However recently Anushree reported that during kernel crash while the kdump kernel was coming up, Hypervisor reported invalid values for 'vpa.yield_count' while it dispatching L2-KVM Guest vcpus. The error manifested as debug build Hypervisor assert triggering to indicate possible VPA corruption.
Looking at the kexec cpu offline path it was discovered that during crash kernel doesn't unregister the VPA/SLB-Shadow/DTL area with Hypervisor. Instead it re-allocates and re-registers these areas for cpus during boot. During kexec boot the previously allocated areas can get overwritten with new content without hypervisor knowledge. This creates a small window where while kexec kernel boots and the L2-VCPUs are being dispatched, Hypervisor may try to read/write to a wrong memory area which previously belonged to older VPA.
Fix this possible race and memory corruption by updating pseries_kexec_cpu_down() to also unregister vpa,slb_shadow & dtl areas during a kernel crash.
--- arch/powerpc/platforms/pseries/kexec.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
arch/powerpc/platforms/pseries/kexec.c +8 -5
@@ -20,12 +20,15 @@void pseries_kexec_cpu_down (int crash_shutdown,int secondary) {/* -* Don't risk a hypervisor call if we're crashing -* XXX: Why? The hypervisor is not crashing. It might be better -* to at least attempt unregister to avoid the hypervisor stepping -* on our memory. +* Ensure vpa/slb_shadow/dtl cleanup even while we are crashing. +* Why? The hypervisor is not crashing so at least attempt unregister to +* avoid the hypervisor stepping on our memory. If hypervisor or kexec +* kernel steps on the old memory allocated to these areas before the +* new kexec-kernel happens to allocate and register new areas, +* the hypervisor will see invalid content which may cause +* unexpected behavior. */ -if (firmware_has_feature (FW_FEATURE_SPLPAR ) && !crash_shutdown) { +if (firmware_has_feature (FW_FEATURE_SPLPAR )) {int ret;int cpu =smp_processor_id ();int hwcpu =hard_smp_processor_id ();
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 323/1193 smb: client: bound dirent name against end of SMB response in cifs_filldir
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jay Vadayath <[email protected]>
[ Upstream commit f8cf09a53a0dc1da298e9dd0ba5f21710cf119d6 ]
cifs_filldir() copies the entry name out of an SMB1 TRANS2_FIND_FIRST / FIND_NEXT response using a length (de.namelen) supplied by the server. The kmalloc'd SMB response buffer is bounded, but nothing checks that de.name + de.namelen still lies inside that buffer before the eventual filldir64() -> verify_dirent_name() -> memchr() reads namelen bytes.
A hostile SMB1 server that returns an oversized FileNameLength in a directory entry therefore causes memchr() to read past the end of the response slab buffer. Reachable from any user who can list a directory on a CIFS mount served by an attacker-controlled server (getdents64() on the mounted directory):
BUG: KASAN: slab-out-of-bounds in memchr+0x71/0x80 Read of size 1 at addr ffff88800e0640cc by task poc/115 Call Trace: dump_stack_lvl+0x64/0x80 print_report+0xce/0x620 kasan_report+0xec/0x120 memchr+0x71/0x80 filldir64+0x4c/0x6a0 cifs_filldir.constprop.0+0x9bb/0x1e00 cifs_readdir+0x2101/0x3380 iterate_dir+0x19c/0x520 __x64_sys_getdents64+0x126/0x210 do_syscall_64+0x107/0x5a0 entry_SYSCALL_64_after_hwframe+0x77/0x7f
Pass the end-of-response pointer down to cifs_filldir() and reject entries whose name would extend past that boundary.
This bug was discovered by Artiphishell's vTriage pipeline, which generated a userspace reproducer (an emulated hostile SMB1 server plus a getdents64() client) that reliably triggers the KASAN report on an unpatched kernel. The fix below was drafted with the Claude coding assistant; a userspace reproducer is available on request.
--- fs/smb/client/readdir.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
fs/smb/client/readdir.c +7 -2
@@ -934,7 +934,7 @@ static bool cifs_dir_emit(struct dir_context *ctx,static int cifs_filldir (char *find_entry,struct file *file,struct dir_context *ctx,char *scratch_buf,unsigned int max_len, -struct cached_fid *cfid) +char *end_of_smb,struct cached_fid *cfid) {struct cifsFileInfo *file_info = file->private_data;struct super_block *sb =file_inode (file)->i_sb;
@@ -955,6 +955,11 @@ static int cifs_filldir(char *find_entry, struct file *file,return -EINVAL ; } +if (de.name + de.namelen > end_of_smb) { +cifs_dbg (VFS ,"search entry name extends past end of SMB\n" ); +return -EINVAL ; + } +/* skip . and .. since we added them first */ if (cifs_entry_is_dot (&de, file_info->srch_inf.unicode))return 0 ;
@@ -1175,7 +1180,7 @@ int cifs_readdir(struct file *file, struct dir_context *ctx)*/ *tmp_buf =0 ; rc =cifs_filldir (current_entry, file, ctx, - tmp_buf, max_len, cfid); + tmp_buf, max_len, end_of_smb, cfid);if (rc) {if (rc >0 ) rc =0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 372/1193 ARM: ensure interrupts are enabled in __do_user_fault()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King (Oracle) <[email protected]>
[ Upstream commit 59e4f3b45b96a24fc9b7a89e5f8a2168b30f95af ]
__do_user_fault() may be called from fault handling paths where the interrupts are enabled or disabled. E.g. do_page_fault() calls this with interrupts enabled, whereas do_sect_fault()->do_bad_area() will call this with interrupts disabled. Since this is a userspace fault, we know that interrupts were enabled in the parent context, so call local_irq_enable() here to give a consistent interrupt state.
This is necessary for force_sig_info() when PREEMPT_RT is enabled.
--- arch/arm/mm/fault.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/mm/fault.c +5 -1
@@ -191,7 +191,8 @@ __do_kernel_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,/* * Something tried to access memory that isn't in our memory map.. -* User mode accesses just cause a SIGSEGV +* User mode accesses just cause a SIGSEGV. Ensure interrupts are enabled +* for preempt RT. */ static void __do_user_fault(unsigned long addr, unsigned int fsr, unsigned int sig,
@@ -199,6 +200,8 @@ __do_user_fault(unsigned long addr, unsigned int fsr, unsigned int sig, {struct task_struct *tsk = current; +local_irq_enable (); +#ifdef CONFIG_DEBUG_USER if (((user_debug &UDBG_SEGV ) && (sig ==SIGSEGV )) || ((user_debug &UDBG_BUS ) && (sig ==SIGBUS ))) {
@@ -255,6 +258,7 @@ do_kernel_address_page_fault(struct mm_struct *mm, unsigned long addr,* should not be faulting in kernel space, which includes the * vector/khelper page. Handle the branch predictor hardening * while interrupts are still disabled, then send a SIGSEGV. +* Note that __do_user_fault() will enable interrupts. */ harden_branch_predictor ();__do_user_fault (addr, fsr,SIGSEGV ,SEGV_MAPERR , regs);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 381/1193 ufs: convert to new timestamp accessors
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
[ Upstream commit d936d3820658bc2728804482c7a3d07ea5da2a3d ]
Convert to using the new inode timestamp accessor functions.
Stable-dep-of: 08edfb34ee9c ("ufs: do not treat unreadable directory blocks as empty")
--- fs/ufs/dir.c | 6 +++--- fs/ufs/ialloc.c | 2 +- fs/ufs/inode.c | 42 ++++++++++++++++++++++++------------------ 3 files changed, 28 insertions(+), 22 deletions(-)
fs/ufs/dir.c +3 -3
@@ -107,7 +107,7 @@ void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de,ufs_commit_chunk (page, pos, len);ufs_put_page (page);if (update_times) - dir->i_mtime =inode_set_ctime_current (dir); +inode_set_mtime_to_ts (dir,inode_set_ctime_current (dir));mark_inode_dirty (dir);ufs_handle_dirsync (dir); }
@@ -397,7 +397,7 @@ int ufs_add_link(struct dentry *dentry, struct inode *inode)ufs_set_de_type (sb, de, inode->i_mode);ufs_commit_chunk (page, pos, rec_len); - dir->i_mtime =inode_set_ctime_current (dir); +inode_set_mtime_to_ts (dir,inode_set_ctime_current (dir));mark_inode_dirty (dir); err =ufs_handle_dirsync (dir);
@@ -539,7 +539,7 @@ int ufs_delete_entry(struct inode *inode, struct ufs_dir_entry *dir, pde->d_reclen =cpu_to_fs16 (sb, to - from); dir->d_ino =0 ;ufs_commit_chunk (page, pos, to - from); - inode->i_mtime =inode_set_ctime_current (inode); +inode_set_mtime_to_ts (inode,inode_set_ctime_current (inode));mark_inode_dirty (inode); err =ufs_handle_dirsync (inode); out:
fs/ufs/ialloc.c +1 -1
@@ -292,7 +292,7 @@ struct inode *ufs_new_inode(struct inode *dir, umode_t mode)inode_init_owner (&nop_mnt_idmap, inode, dir, mode); inode->i_blocks =0 ; inode->i_generation =0 ; - inode->i_mtime = inode->i_atime =inode_set_ctime_current (inode); +simple_inode_init_ts (inode); ufsi->i_flags =UFS_I (dir)->i_flags; ufsi->i_lastfrag =0 ; ufsi->i_shadow =0 ;
fs/ufs/inode.c +24 -18
81 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 382/1193 ufs: Convert ufs_get_page() to use a folio
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Wilcox (Oracle) <[email protected]>
[ Upstream commit bf9883d5779117776c2e25d29d4dfed31d390fb2 ]
Remove a call to read_mapping_page().
Stable-dep-of: 08edfb34ee9c ("ufs: do not treat unreadable directory blocks as empty")
--- fs/ufs/dir.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
fs/ufs/dir.c +10 -9
@@ -195,18 +195,19 @@ static bool ufs_check_page(struct page *page)static struct page *ufs_get_page (struct inode *dir,unsigned long n) {struct address_space *mapping = dir->i_mapping; -struct page *page =read_mapping_page (mapping, n,NULL ); -if (!IS_ERR (page)) { -kmap (page); -if (unlikely (!PageChecked (page))) { -if (!ufs_check_page (page)) - goto fail; - } +struct folio *folio =read_mapping_folio (mapping, n,NULL ); + +if (IS_ERR (folio)) +return &folio->page; +kmap (&folio->page); +if (unlikely (!folio_test_checked (folio))) { +if (!ufs_check_page (&folio->page)) + goto fail; } -return page; +return &folio->page; fail: -ufs_put_page (page); +ufs_put_page (&folio->page);return ERR_PTR (-EIO ); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 383/1193 ufs: Convert ufs_get_page() to ufs_get_folio()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Wilcox (Oracle) <[email protected]>
[ Upstream commit 5fe08b1d7e315cb4238ae1afa4a3ec951ae4908e ]
Use the same calling convention as ext2 (see commit 46022375abe8) so that we can transition to kmap_local in a future patch.
Stable-dep-of: 08edfb34ee9c ("ufs: do not treat unreadable directory blocks as empty")
--- fs/ufs/dir.c | 101 ++++++++++++++++++++++++--------------------------- 1 file changed, 48 insertions(+), 53 deletions(-)
fs/ufs/dir.c +48 -53
@@ -192,19 +192,22 @@ static bool ufs_check_page(struct page *page)return false; } -static struct page *ufs_get_page (struct inode *dir,unsigned long n) +static void *ufs_get_folio (struct inode *dir,unsigned long n, +struct folio **foliop) {struct address_space *mapping = dir->i_mapping;struct folio *folio =read_mapping_folio (mapping, n,NULL ); +void *kaddr;if (IS_ERR (folio)) -return &folio->page; -kmap (&folio->page); +return ERR_CAST (folio); + kaddr =kmap (&folio->page);if (unlikely (!folio_test_checked (folio))) {if (!ufs_check_page (&folio->page)) goto fail; } -return &folio->page; + *foliop = folio; +return kaddr; fail:ufs_put_page (&folio->page);
@@ -235,14 +238,14 @@ ufs_next_entry(struct super_block *sb, struct ufs_dir_entry *p)struct ufs_dir_entry *ufs_dotdot (struct inode *dir,struct page **p) { -struct page *page =ufs_get_page (dir,0 ); -struct ufs_dir_entry *de =NULL ; +struct folio *folio; +struct ufs_dir_entry *de =ufs_get_folio (dir,0 , &folio); + +if (IS_ERR (de)) +return NULL ; + de =ufs_next_entry (dir->i_sb, de); + *p = &folio->page; -if (!IS_ERR (page)) { - de =ufs_next_entry (dir->i_sb, - (struct ufs_dir_entry *)page_address (page)); - *p = page; - }return de; }
@@ -263,7 +266,7 @@ struct ufs_dir_entry *ufs_find_entry(struct inode *dir, const struct qstr *qstr,unsigned reclen =UFS_DIR_REC_LEN (namelen);unsigned long start, n;unsigned long npages =dir_pages (dir); -struct page *page =NULL ; +struct folio *folio;struct ufs_inode_info *ui =UFS_I (dir);struct ufs_dir_entry *de;
@@ -281,18 +284,17 @@ struct ufs_dir_entry *ufs_find_entry(struct inode *dir, const struct qstr *qstr, start =0 ; n = start; do { - char *kaddr; - page = ufs_get_page(dir, n); - if (!IS_ERR(page)) { - kaddr = page_address(page); - de = (struct ufs_dir_entry *) kaddr; + char *kaddr = ufs_get_folio(dir, n, &folio); + + if (!IS_ERR(kaddr)) { + de = (struct ufs_dir_entry *)kaddr; kaddr += ufs_last_byte(dir, n) - reclen; while ((char *) de <= kaddr) { if (ufs_match(sb, namelen, name, de)) goto found; de = ufs_next_entry(sb, de); } - ufs_put_page(page); + ufs_put_page(&folio->page); } if (++n >= npages) n = 0;
@@ -301,7 +303,7 @@ struct ufs_dir_entry *ufs_find_entry(struct inode *dir, const struct qstr *qstr,return NULL ; found: - *res_page = page; + *res_page = &folio->page; ui->i_dir_start_lookup = n;return de; }
@@ -318,11 +320,10 @@ int ufs_add_link(struct dentry *dentry, struct inode *inode)unsigned reclen =UFS_DIR_REC_LEN (namelen);const unsigned int chunk_size =UFS_SB (sb)->s_uspi->s_dirblksize;unsigned short rec_len, name_len; -struct page *page =NULL ; +struct folio *folio =NULL ;struct ufs_dir_entry *de;unsigned long npages =dir_pages (dir);unsigned long n; -char *kaddr;loff_t pos;int err;
@@ -330,21 +331,19 @@ int ufs_add_link(struct dentry *dentry, struct inode *inode)/* * We take care of directory expansion in the same loop. -* This code plays outside i_size, so it locks the page +* This code plays outside i_size, so it locks the folio * to protect that region. */ for (n =0 ; n <= npages; n++) { +char *kaddr =ufs_get_folio (dir, n, &folio);char *dir_end; - page =ufs_get_page (dir, n); - err =PTR_ERR (page); -if (IS_ERR (page)) - goto out; -lock_page (page); - kaddr =page_address (page); +if (IS_ERR (kaddr)) +return PTR_ERR (kaddr); +folio_lock (folio); dir_end = kaddr +ufs_last_byte (dir, n); de = (struct ufs_dir_entry *)kaddr; - kaddr +=PAGE_SIZE - reclen; + kaddr +=folio_size (folio) - reclen;while ((char *)de <= kaddr) {if ((char *)de == dir_end) {/* We hit i_size */
@@ -371,16 +370,15 @@ int ufs_add_link(struct dentry *dentry, struct inode *inode) goto got_it; de = (struct ufs_dir_entry *) ((char *) de + rec_len); } -unlock_page (page); -ufs_put_page (page); +folio_unlock (folio); +ufs_put_page (&folio->page); }BUG ();return -EINVAL ; got_it: - pos =page_offset (page) + - (char *)de - (char *)page_address (page); - err =ufs_prepare_chunk (page, pos, rec_len); + pos =folio_pos (folio) +offset_in_folio (folio, de); + err =ufs_prepare_chunk (&folio->page, pos, rec_len);if (err) goto out_unlock;if (de->d_ino) {
@@ -397,18 +395,17 @@ int ufs_add_link(struct dentry *dentry, struct inode *inode) de->d_ino =cpu_to_fs32 (sb, inode->i_ino);ufs_set_de_type (sb, de, inode->i_mode); -ufs_commit_chunk (page, pos, rec_len); +ufs_commit_chunk (&folio->page, pos, rec_len);inode_set_mtime_to_ts (dir,inode_set_ctime_current (dir));mark_inode_dirty (dir); err =ufs_handle_dirsync (dir);/* OFFSET_CACHE */ out_put: -ufs_put_page (page); -out: +ufs_put_page (&folio->page);return err; out_unlock: -unlock_page (page); +folio_unlock (folio); goto out_put; }
@@ -446,19 +443,18 @@ ufs_readdir(struct file *file, struct dir_context *ctx)return 0 ;for ( ; n < npages; n++, offset =0 ) { -char *kaddr, *limit;struct ufs_dir_entry *de; +struct folio *folio; +char *kaddr =ufs_get_folio (inode, n, &folio); +char *limit; -struct page *page =ufs_get_page (inode, n); - -if (IS_ERR (page)) { +if (IS_ERR (kaddr)) {ufs_error (sb, __func__,"bad page in #%lu" , inode->i_ino); ctx->pos +=PAGE_SIZE - offset; -return -EIO ; +return PTR_ERR (kaddr); } - kaddr =page_address (page);if (unlikely (need_revalidate)) {if (offset) { offset =ufs_validate_entry (sb, kaddr, offset, chunk_mask);
@@ -484,13 +480,13 @@ ufs_readdir(struct file *file, struct dir_context *ctx) ufs_get_de_namlen(sb, de), fs32_to_cpu(sb, de->d_ino), d_type)) { -ufs_put_page (page); +ufs_put_page (&folio->page);return 0 ; } } ctx->pos +=fs16_to_cpu (sb, de->d_reclen); } -ufs_put_page (page); +ufs_put_page (&folio->page); }return 0 ; }
@@ -601,18 +597,17 @@ int ufs_make_empty(struct inode * inode, struct inode *dir)int ufs_empty_dir (struct inode * inode) {struct super_block *sb = inode->i_sb; -struct page *page =NULL ; +struct folio *folio; +char *kaddr;unsigned long i, npages =dir_pages (inode);for (i =0 ; i < npages; i++) { -char *kaddr;struct ufs_dir_entry *de; - page =ufs_get_page (inode, i); -if (IS_ERR (page)) + kaddr =ufs_get_folio (inode, i, &folio); +if (IS_ERR (kaddr))continue ; - kaddr =page_address (page); de = (struct ufs_dir_entry *)kaddr; kaddr +=ufs_last_byte (inode, i) -UFS_DIR_REC_LEN (1 );
@@ -639,12 +634,12 @@ int ufs_empty_dir(struct inode * inode) } de =ufs_next_entry (sb, de); } -ufs_put_page (page); +ufs_put_page (&folio->page); }return 1 ; not_empty: -ufs_put_page (page); +ufs_put_page (&folio->page);return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 384/1193 ufs: do not treat unreadable directory blocks as empty
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ali Ahmet Memis <[email protected]>
[ Upstream commit 08edfb34ee9ca54383970c65ed3a6013e84f5e16 ]
ufs_empty_dir() scans every directory block to decide whether a directory is empty before rmdir() removes it. When ufs_get_folio() cannot read or validate a block it returns an error pointer, and the loop currently skips that block with continue and keeps scanning the remaining blocks.
If none of the readable blocks hold an entry, the function returns 1 and the caller unlinks the directory. A directory whose contents live in a block that cannot be read, for example because of an I/O error or corrupted directory metadata, is therefore seen as empty and removed, losing the entries it still holds.
Follow the ext2 behaviour and treat an unreadable block as a reason to consider the directory not empty, so rmdir() fails instead of discarding data that could not be verified.
--- fs/ufs/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ufs/dir.c +1 -1
@@ -606,7 +606,7 @@ int ufs_empty_dir(struct inode * inode) kaddr =ufs_get_folio (inode, i, &folio);if (IS_ERR (kaddr)) -continue ; +return 0 ; de = (struct ufs_dir_entry *)kaddr; kaddr +=ufs_last_byte (inode, i) -UFS_DIR_REC_LEN (1 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 385/1193 drm/cirrus: Use video aperture helpers
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
[ Upstream commit c77ec6b18b0397cf1f0c270ea77310f70fe48081 ]
DRM's aperture functions have long been implemented as helpers under drivers/video/ for use with fbdev. Avoid the DRM wrappers by calling the video functions directly.
Stable-dep-of: 92312d333bf7 ("drm/cirrus-qemu: Validate BAR0 size during probe")
--- drivers/gpu/drm/tiny/cirrus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tiny/cirrus.c +2 -2
@@ -16,6 +16,7 @@* Copyright 1999-2001 Jeff Garzik <[email protected]> */ +#include <linux/aperture.h> #include <linux/iosys-map.h> #include <linux/module.h> #include <linux/pci.h>
@@ -23,7 +24,6 @@#include <video/cirrus.h> #include <video/vga.h> -#include <drm/drm_aperture.h> #include <drm/drm_atomic.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_atomic_state_helper.h>
@@ -669,7 +669,7 @@ static int cirrus_pci_probe(struct pci_dev *pdev,struct cirrus_device *cirrus;int ret; - ret =drm_aperture_remove_conflicting_pci_framebuffers (pdev, &cirrus_driver); + ret =aperture_remove_conflicting_pci_devices (pdev, cirrus_driver.name);if (ret)return ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 386/1193 drm/cirrus-qemu: Validate BAR0 size during probe
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Slawomir Stepien <[email protected]>
[ Upstream commit 92312d333bf700798f92f30406c721bce87506f3 ]
The cirrus-qemu driver relies on CIRRUS_VRAM_SIZE (4 MB) to validate framebuffer sizes. However, during PCI probe, the driver mapped BAR0 without verifying that its size matches CIRRUS_VRAM_SIZE.
If a PCI device with a BAR0 smaller than 4 MB is bound to the driver, the mapped VRAM will be smaller than expected. Because validation checks assume 4 MB VRAM, framebuffers larger than the mapped memory can be created.
When the display plane is updated (e.g. during release), cirrus_primary_plane_helper_atomic_update() copies the framebuffer to VRAM using drm_fb_memcpy(). Writing past the end of the mapped I/O memory causes a supervisor write page fault:
BUG: unable to handle page fault for address: ffffc9000389c000 ... RIP: 0010:memcpy_toio+0x7c/0xe0 arch/x86/lib/iomem.c:110 ... Call Trace: <TASK> iosys_map_memcpy_to include/linux/iosys-map.h:285 [inline] drm_fb_memcpy+0x325/0x5d0 drivers/gpu/drm/drm_format_helper.c:442 cirrus_primary_plane_helper_atomic_update+0x98a/0xb00 drivers/gpu/drm/tiny/cirrus-qemu.c:358 drm_atomic_helper_commit_planes+0x626/0xea0 drivers/gpu/drm/drm_atomic_helper.c:3038 drm_atomic_helper_commit_tail+0x60/0x510 drivers/gpu/drm/drm_atomic_helper.c:1989 commit_tail+0x2b1/0x3c0 drivers/gpu/drm/drm_atomic_helper.c:2074 drm_atomic_helper_commit+0xa77/0xb10 drivers/gpu/drm/drm_atomic_helper.c:2312
Fix this by validating in cirrus_pci_probe() that the PCI BAR0 resource is not less than CIRRUS_VRAM_SIZE, returning -ENODEV if it is less.
--- drivers/gpu/drm/tiny/cirrus.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/tiny/cirrus.c +3 -0
@@ -669,6 +669,9 @@ static int cirrus_pci_probe(struct pci_dev *pdev,struct cirrus_device *cirrus;int ret; +if (pci_resource_len (pdev,0 ) <CIRRUS_VRAM_SIZE ) +return -ENODEV ; + ret =aperture_remove_conflicting_pci_devices (pdev, cirrus_driver.name);if (ret)return ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 387/1193 net: icmp: avoid invalid transport header access in icmp_send tracepoint
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 7fcc2fe39fed1cb98a7374a113ff3800e8f9af80 ]
syzbot reported a WARNING triggered by DEBUG_NET_WARN_ON_ONCE():
WARNING: at skb_transport_header include/linux/skbuff.h:3087 [inline] WARNING: at udp_hdr include/linux/udp.h:23 [inline] WARNING: at do_trace_event_raw_event_icmp_send include/trace/events/icmp.h:30 [inline] WARNING: at trace_event_raw_event_icmp_send+0x48c/0x6ec include/trace/events/icmp.h:11 Call trace: skb_transport_header include/linux/skbuff.h:3087 [inline] udp_hdr include/linux/udp.h:23 [inline] do_trace_event_raw_event_icmp_send include/trace/events/icmp.h:30 [inline] trace_event_raw_event_icmp_send+0x48c/0x6ec include/trace/events/icmp.h:11 __traceiter_icmp_send include/trace/events/icmp.h:11 [inline] __do_trace_icmp_send include/trace/events/icmp.h:11 [inline] trace_icmp_send+0x320/0x49c include/trace/events/icmp.h:11 __icmp_send+0xcfc/0x11d8 net/ipv4/icmp.c:1013 ipv4_send_dest_unreach net/ipv4/route.c:1280 [inline] ipv4_link_failure+0x57c/0x8dc net/ipv4/route.c:1287 dst_link_failure include/net/dst.h:438 [inline] vti_tunnel_xmit+0xe40/0x17a4 net/ipv4/ip_vti.c:307
TP_fast_assign() unconditionally calls udp_hdr(skb) before checking whether the packet is UDP. Furthermore, __icmp_send() can be invoked from paths (e.g., link failures, ARP errors, forwarding, AF_PACKET) where skb->transport_header was never initialized (~0U).
Under CONFIG_DEBUG_NET=y, calling skb_transport_header(skb) triggers DEBUG_NET_WARN_ON_ONCE(!skb_transport_header_was_set(skb)).
Fix this by:
1. Only parsing transport info when iph->protocol == IPPROTO_UDP.
2. Using skb_header_pointer() at skb_network_offset(skb) + (iph->ihl << 2) to safely fetch the UDP header without assuming transport_header is set.
--- include/trace/events/icmp.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
include/trace/events/icmp.h +8 -5
@@ -27,17 +27,20 @@ TRACE_EVENT(icmp_send,TP_fast_assign ( struct iphdr *iph = ip_hdr(skb); -struct udphdr *uh =udp_hdr (skb); -int proto_4 = iph->protocol; +struct udphdr _uh, *uh =NULL ;__be32 *p32; __entry->skbaddr = skb; __entry->type = type; __entry->code = code; -if (proto_4 !=IPPROTO_UDP || (u8 *)uh < skb->head || - (u8 *)uh +sizeof (struct udphdr ) - >skb_tail_pointer (skb)) { +if (iph->protocol ==IPPROTO_UDP ) + uh =skb_header_pointer (skb, +skb_network_offset (skb) + + (iph->ihl <<2 ), +sizeof (_uh), &_uh); + +if (!uh) { __entry->sport =0 ; __entry->dport =0 ; __entry->ulen =0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 388/1193 net/sched: act_api: budget all shared attributes in notify skbs
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Victor Nogueira <[email protected]>
[ Upstream commit 13eb543cebef6d6c3ec42e31afe3856f51b7126b ]
tcf_action_shared_attrs_size() is supposed to return an upper bound on the netlink attributes every action dump emits outside of TCA_ACT_OPTIONS, so that tcf_add_notify_msg(), tcf_del_notify_msg() and friends can allocate an skb large enough for the reply. It has fallen behind the dump path and is now an underestimate for every single action.
Attributes, such as, TCA_ACT_IN_HW_COUNT and TCA_STATS_BASIC_HW are emitted unconditionally and never accounted for. TCA_STATS_PKT64, TCA_ACT_USED_HW_STATS, TCA_STATS_RATE_EST, TCA_STATS_RATE_EST64 require specific conditions, but are also not accounted for.
Fix the issue by budgeting all of them so that we have a legitimate upper bound. Even tough for of them require specific conditions, they are cheap so, to avoid overcomplicating, we opted to account for them unconditionally as well to account for a real worst case scenario.
--- net/sched/act_api.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
net/sched/act_api.c +11 -2
@@ -443,12 +443,21 @@ static size_t tcf_action_shared_attrs_size(const struct tc_action *act) +nla_total_size (IFNAMSIZ )/* TCA_ACT_KIND */ + cookie_len/* TCA_ACT_COOKIE */ +nla_total_size (sizeof (struct nla_bitfield32 ))/* TCA_ACT_HW_STATS */ +/* TCA_ACT_USED_HW_STATS */ + +nla_total_size (sizeof (struct nla_bitfield32 )) + +nla_total_size (sizeof (u32))/* TCA_ACT_IN_HW_COUNT */ +nla_total_size (0 )/* TCA_ACT_STATS nested */ +nla_total_size (sizeof (struct nla_bitfield32 ))/* TCA_ACT_FLAGS */ /* TCA_STATS_BASIC */ +nla_total_size_64bit (sizeof (struct gnet_stats_basic )) -/* TCA_STATS_PKT64 */ - +nla_total_size_64bit (sizeof (u64)) +/* TCA_STATS_BASIC_HW */ + +nla_total_size_64bit (sizeof (struct gnet_stats_basic )) +/* TCA_STATS_PKT64, emitted by both of the basic copies above */ + +2 *nla_total_size_64bit (sizeof (u64)) +/* TCA_STATS_RATE_EST */ + +nla_total_size_64bit (sizeof (struct gnet_stats_rate_est )) +/* TCA_STATS_RATE_EST64 */ + +nla_total_size_64bit (sizeof (struct gnet_stats_rate_est64 ))/* TCA_STATS_QUEUE */ +nla_total_size_64bit (sizeof (struct gnet_stats_queue )) +nla_total_size (0 )/* TCA_ACT_OPTIONS nested */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 389/1193 net/sched: act_api: size the RTM_GETACTION reply from the actions
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Victor Nogueira <[email protected]>
[ Upstream commit e9ca46ebc3262b498626c4095826b8fa034bbf21 ]
tca_action_gd() already walks every requested action and accumulates attr_size += tcf_action_fill_size(act), then wraps the result in tcf_action_full_attrs_size(). For RTM_DELACTION that value is handed to tcf_del_notify_msg(), which allocates max(attr_size, NLMSG_GOODSIZE). For RTM_GETACTION it is silently discarded and tcf_get_notify() allocates a fixed NLMSG_GOODSIZE skb instead.
Any action whose dump exceeds that fixed budget therefore cannot be read back. For example, act_pedit overruns the budget with 32 actions of four munge keys each, act_police with 32 policers once the optional rate/peakrate/result/avrate attributes are present
Fix this by passing attr_size through and allocate the reply the way the add and delete paths do.
Note on exposure: RTM_GETACTION is the only one of the three action commands that is not capability checked - tc_ctl_action() requires CAP_NET_ADMIN for RTM_NEWACTION and RTM_DELACTION only - so this turns a fixed NLMSG_GOODSIZE reply into a user sized allocation on an unprivileged path. It is bounded by TCA_ACT_MAX_PRIO actions per request, and tca_action_gd() does not reject duplicate indices, so a single large action can be requested 32 times; an act_bpf program near BPF_MAXINSNS is about 32KB of dump, or roughly 1MB for one request. Creating such an action still requires CAP_NET_ADMIN, and the add and delete paths have sized their skbs this way since the Fixes commit. Should this ever need bounding, GFP_KERNEL_ACCOUNT would charge the reply to the caller's memcg.
--- net/sched/act_api.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/sched/act_api.c +4 -3
@@ -1664,12 +1664,12 @@ static int tca_get_fill(struct sk_buff *skb, struct tc_action *actions[],static int tcf_get_notify (struct net *net,u32 portid,struct nlmsghdr *n, -struct tc_action *actions[],int event, +struct tc_action *actions[],size_t attr_size,int event,struct netlink_ext_ack *extack) {struct sk_buff *skb; - skb =alloc_skb (NLMSG_GOODSIZE ,GFP_KERNEL ); + skb =alloc_skb (max (attr_size,NLMSG_GOODSIZE ),GFP_KERNEL );if (!skb)return -ENOBUFS ; if (tca_get_fill(skb, actions, portid, n->nlmsg_seq, 0, event,
@@ -1989,7 +1989,8 @@ tca_action_gd(struct net *net, struct nlattr *nla, struct nlmsghdr *n, attr_size =tcf_action_full_attrs_size (attr_size);if (event ==RTM_GETACTION ) - ret =tcf_get_notify (net, portid, n, actions, event, extack); + ret =tcf_get_notify (net, portid, n, actions, attr_size, event, + extack);else {/* delete */ ret =tcf_del_notify (net, n, actions, portid, attr_size, extack);if (ret)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 390/1193 rtnl: add helper to send if skb is not null
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pedro Tammela <[email protected]>
[ Upstream commit ddb6b284bdc32b6e218b3d90b5a745ea26620812 ]
This is a convenience helper for routines handling conditional rtnl events, that is code that might send a notification depending on rtnl_has_listeners/rtnl_notify_needed.
Instead of:
if (skb)
rtnetlink_send(...)
Use:
rtnetlink_maybe_send(...)
Stable-dep-of: 251367a0a331 ("net/sched: act_api: fix skb sizing and action leak on reoffload delete")
--- include/linux/rtnetlink.h | 7 +++++++ 1 file changed, 7 insertions(+)
include/linux/rtnetlink.h +7 -0
@@ -10,6 +10,13 @@#include <uapi/linux/rtnetlink.h> extern int rtnetlink_send (struct sk_buff *skb,struct net *net,u32 pid,u32 group,int echo); + +static inline int rtnetlink_maybe_send (struct sk_buff *skb,struct net *net, +u32 pid,u32 group,int echo) +{ +return !skb ?0 :rtnetlink_send (skb, net, pid, group, echo); +} +extern int rtnl_unicast (struct sk_buff *skb,struct net *net,u32 pid);extern void rtnl_notify (struct sk_buff *skb,struct net *net,u32 pid,u32 group,const struct nlmsghdr *nlh,gfp_t flags);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 373/1193 EDAC/igen6: Fix interleave boundary condition
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qiuxu Zhuo <[email protected]>
[ Upstream commit f4008169bd320eedb9ddf2b39eeb21370ddac278 ]
The address translation logic splits the memory space into interleaved and non-interleaved regions using a boundary at 2 * s_size.
The current check uses '>' and incorrectly classifies the boundary address (2 * s_size) as part of the interleaved region. This leads to incorrect channel/sub-channel selection at the region boundary.
Fix the classification by using '>=' so that the boundary address is handled in the non-interleaved region, matching the hardware layout.
--- drivers/edac/igen6_edac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/edac/igen6_edac.c +1 -1
@@ -493,7 +493,7 @@ static void decode_addr(u64 addr, u32 hash, u64 s_size, int l_map, {int intlv_bit =CHANNEL_HASH_LSB_MASK_BIT (hash) +6 ; -if (addr >2 * s_size) { +if (addr >=2 * s_size) { *sub_addr = addr - s_size; *idx = l_map;return ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 391/1193 net/sched: act_api: dont open code max()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pedro Tammela <[email protected]>
[ Upstream commit c73724bfde0932cb0cafff2855e8ce81e12fd594 ]
Use max() in a couple of places that are open coding it with the ternary operator.
Stable-dep-of: 251367a0a331 ("net/sched: act_api: fix skb sizing and action leak on reoffload delete")
--- net/sched/act_api.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
net/sched/act_api.c +3 -6
@@ -1842,8 +1842,7 @@ tcf_reoffload_del_notify(struct net *net, struct tc_action *action)struct sk_buff *skb;int ret; - skb =alloc_skb (attr_size <=NLMSG_GOODSIZE ?NLMSG_GOODSIZE : attr_size, -GFP_KERNEL ); + skb =alloc_skb (max (attr_size,NLMSG_GOODSIZE ),GFP_KERNEL );if (!skb)return -ENOBUFS ;
@@ -1928,8 +1927,7 @@ tcf_del_notify(struct net *net, struct nlmsghdr *n, struct tc_action *actions[],int ret;struct sk_buff *skb; - skb =alloc_skb (attr_size <=NLMSG_GOODSIZE ?NLMSG_GOODSIZE : attr_size, -GFP_KERNEL ); + skb =alloc_skb (max (attr_size,NLMSG_GOODSIZE ),GFP_KERNEL );if (!skb)return -ENOBUFS ;
@@ -2008,8 +2006,7 @@ tcf_add_notify(struct net *net, struct nlmsghdr *n, struct tc_action *actions[], {struct sk_buff *skb; - skb =alloc_skb (attr_size <=NLMSG_GOODSIZE ?NLMSG_GOODSIZE : attr_size, -GFP_KERNEL ); + skb =alloc_skb (max (attr_size,NLMSG_GOODSIZE ),GFP_KERNEL );if (!skb)return -ENOBUFS ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 392/1193 net/sched: act_api: conditional notification of events
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pedro Tammela <[email protected]>
[ Upstream commit 8d4390f51920c1edb2d09d44d918c7940ac51e54 ]
As of today tc-action events are unconditionally built and sent to RTNLGRP_TC. As with the introduction of rtnl_notify_needed we can check before-hand if they are really needed.
Stable-dep-of: 251367a0a331 ("net/sched: act_api: fix skb sizing and action leak on reoffload delete")
--- net/sched/act_api.c | 98 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 75 insertions(+), 23 deletions(-)
net/sched/act_api.c +75 -23
@@ -1831,30 +1831,45 @@ static int tcf_action_delete(struct net *net, struct tc_action *actions[])return 0 ; } -static int -tcf_reoffload_del_notify (struct net *net,struct tc_action *action) +static struct sk_buff *tcf_reoffload_del_notify_msg (struct net *net, +struct tc_action *action) {size_t attr_size =tcf_action_fill_size (action);struct tc_action *actions[TCA_ACT_MAX_PRIO ] = { [0 ] = action, }; -const struct tc_action_ops *ops = action->ops;struct sk_buff *skb; -int ret; skb =alloc_skb (max (attr_size,NLMSG_GOODSIZE ),GFP_KERNEL );if (!skb) -return -ENOBUFS ; +return ERR_PTR (-ENOBUFS );if (tca_get_fill (skb, actions,0 ,0 ,0 ,RTM_DELACTION ,0 ,1 ,NULL ) <=0 ) {kfree_skb (skb); -return -EINVAL ; +return ERR_PTR (-EINVAL ); + } + +return skb; +} + +static int tcf_reoffload_del_notify (struct net *net,struct tc_action *action) +{ +const struct tc_action_ops *ops = action->ops; +struct sk_buff *skb; +int ret; + +if (!rtnl_notify_needed (net,0 ,RTNLGRP_TC )) { + skb =NULL ; + }else { + skb =tcf_reoffload_del_notify_msg (net, action); +if (IS_ERR (skb)) +return PTR_ERR (skb); } ret =tcf_idr_release_unsafe (action);if (ret ==ACT_P_DELETED ) {module_put (ops->owner); - ret =rtnetlink_send (skb, net,0 ,RTNLGRP_TC ,0 ); + ret =rtnetlink_maybe_send (skb, net,0 ,RTNLGRP_TC ,0 ); }else {kfree_skb (skb); }
@@ -1920,22 +1935,41 @@ int tcf_action_reoffload_cb(flow_indr_block_bind_cb_t *cb,return 0 ; } -static int -tcf_del_notify (struct net *net,struct nlmsghdr *n,struct tc_action *actions[], -u32 portid,size_t attr_size,struct netlink_ext_ack *extack) +static struct sk_buff *tcf_del_notify_msg (struct net *net,struct nlmsghdr *n, +struct tc_action *actions[], +u32 portid,size_t attr_size, +struct netlink_ext_ack *extack) { -int ret;struct sk_buff *skb; skb =alloc_skb (max (attr_size,NLMSG_GOODSIZE ),GFP_KERNEL );if (!skb) -return -ENOBUFS ; +return ERR_PTR (-ENOBUFS );if (tca_get_fill (skb, actions, portid, n->nlmsg_seq,0 ,RTM_DELACTION ,0 ,2 , extack) <=0 ) {NL_SET_ERR_MSG (extack,"Failed to fill netlink TC action attributes" );kfree_skb (skb); -return -EINVAL ; +return ERR_PTR (-EINVAL ); + } + +return skb; +} + +static int tcf_del_notify (struct net *net,struct nlmsghdr *n, +struct tc_action *actions[],u32 portid, +size_t attr_size,struct netlink_ext_ack *extack) +{ +struct sk_buff *skb; +int ret; + +if (!rtnl_notify_needed (net, n->nlmsg_flags,RTNLGRP_TC )) { + skb =NULL ; + }else { + skb =tcf_del_notify_msg (net, n, actions, portid, attr_size, + extack); +if (IS_ERR (skb)) +return PTR_ERR (skb); }/* now do the delete */
@@ -1946,9 +1980,8 @@ tcf_del_notify(struct net *net, struct nlmsghdr *n, struct tc_action *actions[],return ret; } - ret =rtnetlink_send (skb, net, portid,RTNLGRP_TC , - n->nlmsg_flags &NLM_F_ECHO ); -return ret; +return rtnetlink_maybe_send (skb, net, portid,RTNLGRP_TC , + n->nlmsg_flags &NLM_F_ECHO ); } static int
@@ -2000,25 +2033,44 @@ tca_action_gd(struct net *net, struct nlattr *nla, struct nlmsghdr *n,return ret; } -static int -tcf_add_notify (struct net *net,struct nlmsghdr *n,struct tc_action *actions[], -u32 portid,size_t attr_size,struct netlink_ext_ack *extack) +static struct sk_buff *tcf_add_notify_msg (struct net *net,struct nlmsghdr *n, +struct tc_action *actions[], +u32 portid,size_t attr_size, +struct netlink_ext_ack *extack) {struct sk_buff *skb; skb =alloc_skb (max (attr_size,NLMSG_GOODSIZE ),GFP_KERNEL );if (!skb) -return -ENOBUFS ; +return ERR_PTR (-ENOBUFS );if (tca_get_fill (skb, actions, portid, n->nlmsg_seq, n->nlmsg_flags,RTM_NEWACTION ,0 ,0 , extack) <=0 ) {NL_SET_ERR_MSG (extack,"Failed to fill netlink attributes while adding TC action" );kfree_skb (skb); -return -EINVAL ; +return ERR_PTR (-EINVAL ); + } + +return skb; +} + +static int tcf_add_notify (struct net *net,struct nlmsghdr *n, +struct tc_action *actions[],u32 portid, +size_t attr_size,struct netlink_ext_ack *extack) +{ +struct sk_buff *skb; + +if (!rtnl_notify_needed (net, n->nlmsg_flags,RTNLGRP_TC )) { + skb =NULL ; + }else { + skb =tcf_add_notify_msg (net, n, actions, portid, attr_size, + extack); +if (IS_ERR (skb)) +return PTR_ERR (skb); } -return rtnetlink_send (skb, net, portid,RTNLGRP_TC , - n->nlmsg_flags &NLM_F_ECHO ); +return rtnetlink_maybe_send (skb, net, portid,RTNLGRP_TC , + n->nlmsg_flags &NLM_F_ECHO ); } static int tcf_action_add(struct net *net, struct nlattr *nla,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 393/1193 net/sched: act_api: fix skb sizing and action leak on reoffload delete
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Victor Nogueira <[email protected]>
[ Upstream commit 251367a0a3319fa565daf7468b0afd933b1f5ab1 ]
tcf_reoffload_del_notify_msg() sizes the RTM_DELACTION skb with tcf_action_fill_size(action) alone. Unlike every other notification path it never wraps that in tcf_action_full_attrs_size(), so the nlmsg_put() header, struct tcamsg and the TCA_ACT_TAB nest that tca_get_fill() emits - 24 bytes on x86_64 - are not budgeted. As long as the single action stays well under NLMSG_GOODSIZE the floor in alloc_skb() hides this, but once its fill size crosses NLMSG_GOODSIZE the allocation is exactly 24 bytes short and tca_get_fill() runs out of tailroom. That is now easy to reach for an offloadable act_pedit with a large tcfp_nkeys, which commit 8e2efb3f45a5 ("net/sched: add get_fill_size callbacks for actions missing them") started accounting for properly.
When that happens tcf_reoffload_del_notify() returns early, before tcf_idr_release_unsafe(), and tcf_action_reoffload_cb() discards the return value:
if (tc_act_skip_sw(p->tcfa_flags) && !tc_act_in_hw(p)) tcf_reoffload_del_notify(net, p);
The action has just lost its last hardware instance and is skip_sw, so it is left installed while processing no packets, and with no notification to tell userspace about it. An -ENOBUFS from alloc_skb() gets the same treatment.
Fix this by budgeting the message header the way the add and delete paths do, and release the action even when the notification cannot be built - dropping the notification is strictly better than leaking a dead action, and there is no caller left to report the error to.
--- net/sched/act_api.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
net/sched/act_api.c +11 -6
@@ -1834,11 +1834,13 @@ static int tcf_action_delete(struct net *net, struct tc_action *actions[])static struct sk_buff *tcf_reoffload_del_notify_msg (struct net *net,struct tc_action *action) { -size_t attr_size =tcf_action_fill_size (action);struct tc_action *actions[TCA_ACT_MAX_PRIO ] = { [0 ] = action, };struct sk_buff *skb; +size_t attr_size; + + attr_size =tcf_action_full_attrs_size (tcf_action_fill_size (action)); skb =alloc_skb (max (attr_size,NLMSG_GOODSIZE ),GFP_KERNEL );if (!skb)
@@ -1855,15 +1857,18 @@ static struct sk_buff *tcf_reoffload_del_notify_msg(struct net *net,static int tcf_reoffload_del_notify (struct net *net,struct tc_action *action) {const struct tc_action_ops *ops = action->ops; -struct sk_buff *skb; +struct sk_buff *skb =NULL ;int ret; -if (!rtnl_notify_needed (net,0 ,RTNLGRP_TC )) { - skb =NULL ; - }else { +if (rtnl_notify_needed (net,0 ,RTNLGRP_TC )) { skb =tcf_reoffload_del_notify_msg (net, action); +/* The action has already lost its hardware instance and is +* skip_sw, so it must be released whether or not the +* notification can be built. Drop the notification rather +* than leave an action behind that processes no packets. +*/ if (IS_ERR (skb)) -return PTR_ERR (skb); + skb =NULL ; } ret =tcf_idr_release_unsafe (action);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 394/1193 sctp: fix a TOCTOU race in SCTP_CMD_TIMER_START
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
[ Upstream commit 2188569e7e1b0bc3f3b557dc97ab7a02befc11c8 ]
The SCTP_CMD_TIMER_START handler checks timer_pending() before calling timer_reduce(). The timer can expire and detach between these operations, causing timer_reduce() to rearm the timer without taking the association reference required for the newly armed timer.
The timer callback later unconditionally drops its association reference, which can leave the association reference count unbalanced and result in use-after-free during association teardown.
Use the return value of timer_reduce() to determine whether the timer was actually armed. Take the association reference only when timer_reduce() successfully starts a new timer, closing the race between checking the timer state and rearming it.
This issue was reported by Nico Yip (@_cyeaa_) working with TrendAI Zero Day Initiative.
--- net/sctp/sm_sideeffect.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
net/sctp/sm_sideeffect.c +1 -10
@@ -1539,17 +1539,8 @@ static int sctp_cmd_interpreter(enum sctp_event_type event_type, timeout = asoc->timeouts[cmd->obj.to];BUG_ON (!timeout); -/* -* SCTP has a hard time with timer starts. Because we process -* timer starts as side effects, it can be hard to tell if we -* have already started a timer or not, which leads to BUG -* halts when we call add_timer. So here, instead of just starting -* a timer, if the timer is already started, and just mod -* the timer with the shorter of the two expiration times -*/ -if (!timer_pending (timer)) +if (!timer_reduce (timer, jiffies + timeout))sctp_association_hold (asoc); -timer_reduce (timer, jiffies + timeout);break ;case SCTP_CMD_TIMER_RESTART :
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 395/1193 scsi: mpi3mr: Fix NULL pointer dereference in mpi3mr_sas_port_add()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Milan P. Gandhi <[email protected]>
[ Upstream commit dba9e2181ca5e875f98b8b9b4535cdaab87dcb0d ]
sas_port_alloc_num() can return NULL on memory allocation failure. The return value is passed directly to sas_port_add() without a NULL check, which causes a NULL pointer dereference.
Additionally, if sas_port_add() fails, the allocated port is not freed before jumping to out_fail, leaking the sas_port structure. Call sas_port_free() to properly release it.
--- drivers/scsi/mpi3mr/mpi3mr_transport.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/scsi/mpi3mr/mpi3mr_transport.c +6 -0
@@ -1404,9 +1404,15 @@ static struct mpi3mr_sas_port *mpi3mr_sas_port_add(struct mpi3mr_ioc *mrioc, } port =sas_port_alloc_num (mr_sas_node->parent_dev); +if (!port) { +ioc_err (mrioc,"failure at %s:%d/%s()!\n" , + __FILE__, __LINE__, __func__); + goto out_fail; + }if ((sas_port_add (port))) {ioc_err (mrioc,"failure at %s:%d/%s()!\n" , __FILE__, __LINE__, __func__); +sas_port_free (port); goto out_fail; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 396/1193 scsi: mpi3mr: Fix target device refcount leak in mpi3mr_sas_port_add()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Milan P. Gandhi <[email protected]>
[ Upstream commit 419d129f970aaa6567dbac366b0c93784bf9ec97 ]
mpi3mr_get_tgtdev_by_addr() increments the target device kref when it returns a device. If a subsequent error triggers a goto out_fail after the tgtdev reference is acquired, the reference is never released because the out_fail path does not call mpi3mr_tgtdev_put(). This prevents the target device structure from ever being freed.
Add a tgtdev put in the out_fail path, guarded by a NULL check since tgtdev is only acquired for SAS_END_DEVICE types and the same cleanup path is shared by earlier error cases where tgtdev is still NULL.
--- drivers/scsi/mpi3mr/mpi3mr_transport.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/mpi3mr/mpi3mr_transport.c +2 -0
@@ -1483,6 +1483,8 @@ static struct mpi3mr_sas_port *mpi3mr_sas_port_add(struct mpi3mr_ioc *mrioc,list_for_each_entry_safe (mr_sas_phy, next, &mr_sas_port->phy_list, port_siblings)list_del (&mr_sas_phy->port_siblings); +if (tgtdev) +mpi3mr_tgtdev_put (tgtdev);kfree (mr_sas_port);return NULL ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 397/1193 smb/client: mark file sparse before emulating insert range
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huiwen He <[email protected]>
[ Upstream commit cd03ce4950d80147ac8f20bc03c42b75b0352407 ]
The SMB client emulates FALLOC_FL_INSERT_RANGE with SET_EOF, COPYCHUNK and SET_ZERO_DATA.
SET_ZERO_DATA creates a hole only when the file is sparse. On a non-sparse file, it clears the inserted range but leaves its blocks allocated, causing the extent count check in xfstests generic/064 to fail.
Fix this by marking the file sparse before modifying it.
This patch produces the expected sparse extents in xfstests generic/064 only when the server-reported block size is compatible with the server's deallocation granularity.
For ksmbd, the reported block size follows the backing filesystem, and the test passes. For Samba, the test passes with a block size matching the backend granularity, for example, 4 KiB on Btrfs, but not with the default 1 KiB value. For Windows Server 2022, 4 KiB inserts do not generate holes, while aligned inserts of 64 KiB or larger do.
--- fs/smb/client/smb2ops.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/smb/client/smb2ops.c +5 -0
@@ -3715,6 +3715,11 @@ static long smb3_insert_range(struct file *file, struct cifs_tcon *tcon, count = old_eof - off; new_eof = old_eof + len; +/* SET_ZERO_DATA creates a hole only in a sparse file. */ + rc =smb2_set_sparse (xid, tcon, cfile, inode, true); +if (rc) + goto out; +filemap_invalidate_lock (inode->i_mapping); rc =filemap_write_and_wait_range (inode->i_mapping, off, new_eof -1 );if (rc <0 )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 398/1193 smb: client: transport: Fix debug printing in __release_mid()
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 d83a21bb26015bfdd79b0440fe816b271b8bbab3 ]
Long time ago during upgrading printk():s to the respective pr_<level>() calls one misconversion happened and nobody has noticed that. So, previously printk(KERN_DEBUG) + printk() worked as one long debug print since the trailing '\n' is only present in the followup printk() format string. The culprit change missed that and split the message to two on the different levels. Restore the original behaviour to make users be less confused in the most likely never happen cases of partially getting that message.
--- fs/smb/client/transport.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
fs/smb/client/transport.c +5 -6
@@ -143,12 +143,11 @@ void __release_mid(struct kref *refcount)trace_smb3_slow_rsp (smb_cmd, midEntry->mid, midEntry->pid, midEntry->when_sent, midEntry->when_received);if (cifsFYI &CIFS_TIMER ) { -pr_debug ("slow rsp: cmd %d mid %llu" , - midEntry->command, midEntry->mid); -cifs_info ("A: 0x%lx S: 0x%lx R: 0x%lx\n" , - now - midEntry->when_alloc, - now - midEntry->when_sent, - now - midEntry->when_received); +pr_debug ("slow rsp: cmd %d mid %llu A: 0x%lx S: 0x%lx R: 0x%lx\n" , + midEntry->command, midEntry->mid, + now - midEntry->when_alloc, + now - midEntry->when_sent, + now - midEntry->when_received); } }#endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 399/1193 sctp: fix soft lockup from unpadded ASCONF-ACK parameter iteration
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Henry Martin <[email protected]>
[ Upstream commit 2cb0b0b1ed69430bf73740377ea0a1c44c50db63 ]
sctp_verify_asconf() walks ASCONF-ACK parameters with sctp_walk_params(), which advances by SCTP_PAD4(length), while the consumer sctp_get_asconf_response() iterates the same parameters advancing by the raw length, without padding. A single odd-length parameter desynchronises the two walks and makes the consumer interpret attacker-controlled bytes at a misaligned offset.
When those bytes yield a length of zero, the while loop over asconf_ack_len makes no progress, spinning forever in softirq context, and the watchdog reports a soft lockup. All reads stay within the received skb, so the lockup is a pure remote denial of service. A remote peer can trigger it with a crafted ASCONF-ACK on an ADD-IP enabled association with an outstanding ASCONF (RFC 5061 section 4.1.2 requires the chunk to be authenticated, but the predefined empty key id 0 allows the peer to compute the same association HMAC from publicly exchanged parameters, so the gate does not help).
The SCTP_PARAM_ERR_CAUSE case of sctp_verify_asconf() also performs no length check, letting a parameter without a complete error header reach the consumer, which reads errhdr.cause past the end of the parameter, an out-of-bounds read.
Reject SCTP_PARAM_ERR_CAUSE parameters shorter than sizeof(struct sctp_addip_param) + sizeof(struct sctp_errhdr) at the verifier, and advance the consumer iterator with the same padding rule as the verifier to keep the two walks in lockstep. The verifier change guarantees a complete error header in every ERR_CAUSE parameter the consumer can see, so the consumer's asconf_ack_len check is dropped and it returns err_param->cause directly. The consumer padding fix is still required because odd lengths remain valid for SCTP_PARAM_ERR_CAUSE per RFC 5061.
The issue was found by ZeroHive, a vulnerability hunting agent at Tencent Yunding Lab.
--- net/sctp/sm_make_chunk.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
net/sctp/sm_make_chunk.c +6 -8
@@ -3230,6 +3230,9 @@ bool sctp_verify_asconf(const struct sctp_association *asoc, *errp = param.p;switch (param.p->type) {case SCTP_PARAM_ERR_CAUSE : +if (length <sizeof (struct sctp_addip_param ) + +sizeof (struct sctp_errhdr )) +return false;break ;case SCTP_PARAM_IPV4_ADDRESS :if (length !=sizeof (struct sctp_ipv4addr_param ))
@@ -3463,20 +3466,15 @@ static __be16 sctp_get_asconf_response(struct sctp_chunk *asconf_ack,case SCTP_PARAM_ERR_CAUSE : length =sizeof (*asconf_ack_param); err_param = (void *)asconf_ack_param + length; - asconf_ack_len -= length; -if (asconf_ack_len >0 ) -return err_param->cause; -else -return SCTP_ERROR_INV_PARAM ; -break ; +return err_param->cause;default :return SCTP_ERROR_INV_PARAM ; } } length =ntohs (asconf_ack_param->param_hdr.length); - asconf_ack_param = (void *)asconf_ack_param + length; - asconf_ack_len -= length; + asconf_ack_param = (void *)asconf_ack_param +SCTP_PAD4 (length); + asconf_ack_len -=SCTP_PAD4 (length); }return err_code;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 400/1193 raw: annotate disconnect-side IPv4 match writers
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xuanqiang Luo <[email protected]>
[ Upstream commit ac08d183dac0441e41f77bbad50798fe609d90f1 ]
raw_v4_match() reads inet_daddr, inet_rcv_saddr and sk_bound_dev_if locklessly under RCU. Bind and connect writers are annotated, but __udp_disconnect() still clears the same fields using plain stores.
Commit 18f116931f52e ("raw: annotate lockless match fields in raw_v4_match()") added the lockless readers and annotated the raw bind and datagram connect writers. Its v4 revision intentionally left the shared disconnect-side IPv4 writers for follow-up cleanup.
Complete that follow-up by using WRITE_ONCE() for the disconnect-side stores, including the inet_rcv_saddr reset in inet_reset_saddr(), to pair with the lockless raw socket matcher.
--- include/net/ip.h | 3 ++- net/ipv4/udp.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-)
include/net/ip.h +2 -1
@@ -660,7 +660,8 @@ static inline void ip_ipgre_mc_map(__be32 naddr, const unsigned char *broadcast,static __inline__void inet_reset_saddr (struct sock *sk) { -inet_sk (sk)->inet_rcv_saddr =inet_sk (sk)->inet_saddr =0 ; +inet_sk (sk)->inet_saddr =0 ; +WRITE_ONCE (inet_sk (sk)->inet_rcv_saddr,0 );#if IS_ENABLED (CONFIG_IPV6 )if (sk->sk_family ==PF_INET6 ) {struct ipv6_pinfo *np =inet6_sk (sk);
net/ipv4/udp.c +2 -2
@@ -1948,10 +1948,10 @@ int __udp_disconnect(struct sock *sk, int flags)*/ sk->sk_state =TCP_CLOSE ; - inet->inet_daddr =0 ; +WRITE_ONCE (inet->inet_daddr,0 ); inet->inet_dport =0 ;sock_rps_reset_rxhash (sk); - sk->sk_bound_dev_if =0 ; +WRITE_ONCE (sk->sk_bound_dev_if,0 );if (!(sk->sk_userlocks &SOCK_BINDADDR_LOCK )) {inet_reset_saddr (sk); if (sk->sk_prot->rehash &&
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 374/1193 EDAC/igen6: Fix channel selection hash
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qiuxu Zhuo <[email protected]>
[ Upstream commit 540b79536f3a89a66c5b6c490110298d43025618 ]
In channel selection hash mode, the hardware decoding logic always includes the channel interleave bit in XOR operations. However, the hash mask may or may not include this channel interleave bit. When the mask does include this bit, the current igen6_edac code performs XOR on the interleave bit twice, effectively ignoring it - which is incorrect.
Fix this issue by ensuring the hash mask always includes the interleave bit, so XOR is performed on the interleave bit exactly once.
--- drivers/edac/igen6_edac.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/edac/igen6_edac.c +11 -3
@@ -467,14 +467,22 @@ static enum mem_type get_memory_type(u32 mad_inter)static int decode_chan_idx (u64 addr,u64 mask,int intlv_bit) { -u64 hash_addr = addr & mask, hash =0 ; -u64 intlv = (addr >> intlv_bit) &1 ; +u64 hash_addr, hash =0 ;int i; +/* +* In hash mode, the @intlv_bit is the lowest selected bit of @addr +* to be XORed. While @mask may or may not include this @intlv_bit, +* we enforce that @mask includes @intlv_bit to ensure @intlv_bit is +* XORed exactly once. +*/ + mask |=1 << intlv_bit; + hash_addr = addr & mask; +for (i =6 ; i <20 ; i++) hash ^= (hash_addr >> i) &1 ; -return (int )hash ^ intlv; +return (int )hash; }static u64 decode_channel_addr (u64 addr,int intlv_bit)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 401/1193 net: amd-xgbe: discard rx packets with bad FCS
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Nugraha <[email protected]>
[ Upstream commit ac8d6b28d48c5d951dcd923d33e461588e762a6d ]
amd-xgbe driver currently sets the MAC_RCR.DCRCC bit whenever RX is enabled. This disables hardware FCS validation, causing packets with bad FCS to be accepted unconditionally.
This change unsets DCRCC so that packets with bad FCS will be dropped, in-line with typical behaviours of many other network controllers.
Tests:
- Verified that packets with bad FCS are now dropped.
- Verified that receiving packets with bad FCS will increment the rx_crc_errors counter.
--- drivers/net/ethernet/amd/xgbe/xgbe-dev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-dev.c +1 -2
@@ -3438,7 +3438,7 @@ static void xgbe_enable_rx(struct xgbe_prv_data *pdata)XGMAC_IOWRITE (pdata,MAC_RQC0R , reg_val);/* Enable MAC Rx */ -XGMAC_IOWRITE_BITS (pdata,MAC_RCR ,DCRCC ,1 ); +XGMAC_IOWRITE_BITS (pdata,MAC_RCR ,DCRCC ,0 );XGMAC_IOWRITE_BITS (pdata,MAC_RCR ,CST ,1 );XGMAC_IOWRITE_BITS (pdata,MAC_RCR ,ACS ,1 );XGMAC_IOWRITE_BITS (pdata,MAC_RCR ,RE ,1 );
@@ -3449,7 +3449,6 @@ static void xgbe_disable_rx(struct xgbe_prv_data *pdata)unsigned int i;/* Disable MAC Rx */ -XGMAC_IOWRITE_BITS (pdata,MAC_RCR ,DCRCC ,0 );XGMAC_IOWRITE_BITS (pdata,MAC_RCR ,CST ,0 );XGMAC_IOWRITE_BITS (pdata,MAC_RCR ,ACS ,0 );XGMAC_IOWRITE_BITS (pdata,MAC_RCR ,RE ,0 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 402/1193 vxlan: mdb: Fix use-after-free in vxlan_mdb_remote_src_del()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baul Lee <[email protected]>
[ Upstream commit 4aa61c88b4e292e10abdfd791334b8272108d68a ]
vxlan_mdb_is_valid_source(), which validates MDBE_ATTR_SOURCE and every MDBE_ATTR_SRC_LIST member, accepts the all-zeros address.
A source list is only accepted on a (*, G) entry, whose source is the all-zeros address, and for each member of the list an (S, G) entry is derived from it by substituting the source. Entries are keyed by a plain memcmp() of struct vxlan_mdb_entry_key, so if MDBE_ATTR_SOURCE is present and holds the all-zeros address and the source list holds it as well, the derived (S, G) key is byte-identical to the (*, G) key and resolves to the same entry. Omitting MDBE_ATTR_SOURCE is not equivalent, as the key is then left with a zero address family.
vxlan_mdb_remote_src_del() removes the forwarding entry of a source before freeing the source entry:
vxlan_mdb_remote_src_fwd_del(vxlan, group, remote, &ent->addr); vxlan_mdb_remote_src_entry_del(ent);
With the keys aliased, the first call deletes the remote of the entry that owns 'ent' instead of a separate (S, G) entry, and frees 'ent'. The second call then runs on the freed entry, and its hlist_del() reads ->pprev and ->next out of it and writes through them.
Adding the (*, G) entry with NLM_F_REPLACE and no source list marks the all-zeros source for deletion and reaches this from the sweep at the end of vxlan_mdb_remote_srcs_replace().
BUG: KASAN: slab-use-after-free in __vxlan_mdb_add+0x1cd/0xd70 Read of size 8 at addr ffff888102852500 by task poc/84 __vxlan_mdb_add+0x1cd/0xd70 vxlan_mdb_add+0xc0/0x140 rtnl_mdb_add+0x157/0x2a0 rtnetlink_rcv_msg+0x207/0x5a0 Allocated by task 84: __kmalloc_cache_noprof+0x153/0x360 vxlan_mdb_remote_srcs_add+0x2eb/0x440 __vxlan_mdb_add+0x803/0xd70 Freed by task 84: kfree+0x14c/0x3b0 vxlan_mdb_remote_del+0x129/0x1a0 __vxlan_mdb_del+0x4f/0xe0 vxlan_mdb_remote_src_fwd_del.isra.0+0x162/0x1b0 __vxlan_mdb_add+0x1c5/0xd70
The MDB operations are netns-scoped, so an unprivileged user can perform them in a new user and network namespace.
Reject the all-zeros address in vxlan_mdb_is_valid_source(), which covers both call sites. A (*, G) entry is expressed by omitting the source, so nothing legitimate is refused.
Discovered by XBOW, triaged by Baul Lee <[email protected]>
--- drivers/net/vxlan/vxlan_mdb.c | 8 ++++++++ tools/testing/selftests/net/test_vxlan_mdb.sh | 6 ++++++ 2 files changed, 14 insertions(+)
drivers/net/vxlan/vxlan_mdb.c +8 -0
@@ -354,6 +354,10 @@ static bool vxlan_mdb_is_valid_source(const struct nlattr *attr, __be16 proto,NL_SET_ERR_MSG_MOD (extack,"IPv4 multicast source address is not allowed" );return false; } +if (ipv4_is_zeronet (nla_get_in_addr (attr))) { +NL_SET_ERR_MSG_MOD (extack,"IPv4 all-zeros source address is not allowed" ); +return false; + }break ;#if IS_ENABLED (CONFIG_IPV6 )case htons (ETH_P_IPV6 ): {
@@ -368,6 +372,10 @@ static bool vxlan_mdb_is_valid_source(const struct nlattr *attr, __be16 proto,NL_SET_ERR_MSG_MOD (extack,"IPv6 multicast source address is not allowed" ); return false; } +if (ipv6_addr_any (&src)) { +NL_SET_ERR_MSG_MOD (extack,"IPv6 all-zeros source address is not allowed" ); +return false; + }break ; }#endif
tools/testing/selftests/net/test_vxlan_mdb.sh +6 -0
@@ -688,6 +688,9 @@ star_g_common() run_cmd "bridge -n $ns1 mdb add dev vx0 port vx0 grp $grp permanent filter_mode exclude source_list $grp dst $vtep_ip src_vni 10010" log_test $? 255 "Invalid source in source list" + run_cmd "bridge -n $ns1 mdb add dev vx0 port vx0 grp $grp permanent filter_mode exclude source_list $all_zeros_grp dst $vtep_ip src_vni 10010" + log_test $? 255 "All-zeros source in source list" + run_cmd "bridge -n $ns1 mdb add dev vx0 port vx0 grp $grp permanent source_list $src1 dst $vtep_ip src_vni 10010" log_test $? 255 "Source list without filter mode" }
@@ -787,6 +790,9 @@ sg_common() run_cmd "bridge -n $ns1 mdb add dev vx0 port vx0 grp $grp src $grp permanent dst $vtep_ip src_vni 10010" log_test $? 255 "(S, G) with an invalid source list" + run_cmd "bridge -n $ns1 mdb add dev vx0 port vx0 grp $grp src $all_zeros_grp permanent dst $vtep_ip src_vni 10010" + log_test $? 255 "(S, G) with an all-zeros source" + run_cmd "bridge -n $ns1 mdb add dev vx0 port vx0 grp $all_zeros_grp src $src permanent dst $vtep_ip src_vni 10010" log_test $? 255 "All-zeros group with source" }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 403/1193 watchdog: msc313e: Fix NULL pointer dereference in PM callbacks
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tzung-Bi Shih <[email protected]>
[ Upstream commit e3eceb76515910746e6268c4e4ac1c07516ebd7b ]
msc313e_wdt_probe() doesn't set the driver data for the platform device. As a result, dev_get_drvdata() in msc313e_wdt_suspend() and msc313e_wdt_resume() will return NULL, leading to a NULL pointer dereference afterward.
Set the platform device driver data in msc313e_wdt_probe().
--- drivers/watchdog/msc313e_wdt.c | 1 + 1 file changed, 1 insertion(+)
drivers/watchdog/msc313e_wdt.c +1 -0
@@ -125,6 +125,7 @@ static int msc313e_wdt_probe(struct platform_device *pdev)set_bit (WDOG_HW_RUNNING , &priv->wdev.status);watchdog_set_drvdata (&priv->wdev, priv); +platform_set_drvdata (pdev, priv);watchdog_init_timeout (&priv->wdev, timeout, dev);watchdog_stop_on_reboot (&priv->wdev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 404/1193 OPP: of: Fix potential multiplication overflow when calculating freq
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
[ Upstream commit e11811a552252740bd396ec38378e9570ee16578 ]
The multiplication be32_to_cpup(val++) * 1000 is performed using 32 bit unsigned integers and hence uses a 32 bit multiplication; this will overflow if be32_to_cpup(val++) is greater than 4294967 (which is very unlikely at present). The result is assigned to an unsigned long (which is a 64 bit value on 64 bit systems), so fix this potential overflow by casting the first operand of the multiplication to an unsigned int.
--- drivers/opp/of.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/opp/of.c +1 -1
@@ -1080,7 +1080,7 @@ static int _of_add_opp_table_v1(struct device *dev, struct opp_table *opp_table) val = prop->value;while (nr) { -unsigned long freq =be32_to_cpup (val++) *1000 ; +unsigned long freq = (unsigned long )be32_to_cpup (val++) *1000 ;unsigned long volt =be32_to_cpup (val++); ret =_opp_add_v1 (opp_table, dev, freq, volt, false);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 405/1193 ALSA: pcm: Serialize PCM mmap with buffer reallocation to fix page UAF
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yilin Zhang <[email protected]>
[ Upstream commit 9b110a9dcecc59516c77cb3c0caf1f492f75df2d ]
snd_pcm_hw_params() and snd_pcm_hw_free() guard buffer reallocation with an mmap_count check performed under the PCM stream lock, but the lock is released long before the buffer is actually freed:snd_pcm_sync_stop(), constraint refinement and do_free_pages() all happen in between. snd_pcm_mmap_data(), on the other hand, takes no lock at all: it validates against the old buffer's state and dma_bytes, remaps its pages into the VMA, and only then increments mmap_count.
A concurrent mmap() can therefore slip in between the check and the free. remap_pfn_range() installs writable PTEs for the old buffer's pages without taking page references, and the subsequent do_free_pages() returns those pages to the page allocator while the VMA still maps them. This leaves a stale, writable mapping of freed
pages: a page-level use-after-free that can be leveraged for local privilege escalation.
Make snd_pcm_mmap_data() participate in the buffer-access scheme introduced for hw_params/hw_free: acquire runtime->buffer_accessing before validating and remapping, and release it afterwards. Buffer reallocation already fails with -EBUSY while accessors are active, and the mmap side now fails with -EBUSY while a reallocation is in progress, so the validate/remap sequence and the check/free sequence can no longer interleave.
A reproducer that turns this race into a stale writable mapping of the freed DMA buffer pages is available on request.
--- sound/core/pcm_native.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-)
sound/core/pcm_native.c +25 -10
@@ -3939,20 +3939,33 @@ int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file,return -EINVAL ; } runtime = substream->runtime; -if (runtime->state ==SNDRV_PCM_STATE_OPEN ) -return -EBADFD ; -if (!(runtime->info &SNDRV_PCM_INFO_MMAP )) -return -ENXIO ; +/* don't race with buffer reallocation in hw_params/hw_free */ +if (!atomic_inc_unless_negative (&runtime->buffer_accessing)) +return -EBUSY ; +if (runtime->state ==SNDRV_PCM_STATE_OPEN ) { + err = -EBADFD ; + goto out; + } +if (!(runtime->info &SNDRV_PCM_INFO_MMAP )) { + err = -ENXIO ; + goto out; + }if (runtime->access ==SNDRV_PCM_ACCESS_RW_INTERLEAVED || - runtime->access ==SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ) -return -EINVAL ; + runtime->access ==SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ) { + err = -EINVAL ; + goto out; + } size = area->vm_end - area->vm_start; offset = area->vm_pgoff <<PAGE_SHIFT ; dma_bytes =PAGE_ALIGN (runtime->dma_bytes); -if ((size_t )size > dma_bytes) -return -EINVAL ; -if (offset > dma_bytes - size) -return -EINVAL ; +if ((size_t )size > dma_bytes) { + err = -EINVAL ; + goto out; + } +if (offset > dma_bytes - size) { + err = -EINVAL ; + goto out; + } area->vm_ops = &snd_pcm_vm_ops_data; area->vm_private_data = substream;
@@ -3962,6 +3975,8 @@ int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, err =snd_pcm_lib_default_mmap (substream, area);if (!err)atomic_inc (&substream->mmap_count); +out: +atomic_dec (&runtime->buffer_accessing);return err; }EXPORT_SYMBOL (snd_pcm_mmap_data);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 406/1193 ksmbd: rate limit unmapped SID errors
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit feca5e70fc963b088377b20879e8cd8237c2fd7d ]
A client can include many structurally valid but unmapped SIDs in a DACL. Logging every mapping failure lets one request generate hundreds of kernel error messages.
Rate limit the message to prevent an authenticated client from flooding the kernel log.
--- fs/smb/server/smbacl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/smb/server/smbacl.c +2 -2
@@ -521,8 +521,8 @@ static void parse_dacl(struct mnt_idmap *idmap, temp_fattr.cf_uid =INVALID_UID ; ret =sid_to_id (idmap, &ppace[i]->sid,SIDOWNER , &temp_fattr);if (ret ||uid_eq (temp_fattr.cf_uid,INVALID_UID )) { -pr_err ("%s: Error %d mapping Owner SID to uid\n" , - __func__, ret); +pr_err_ratelimited ("%s: Error %d mapping Owner SID to uid\n" , + __func__, ret);continue ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 407/1193 s390/checksum: call instrument_read() instead of kasan_check_read()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
[ Upstream commit 4ce69fcf17d067112f754414aa563e0cd74cc49d ]
Call instrument_read() from csum_partial() instead of kasan_check_read(). instrument_read() covers all memory access instrumentation methods.
Stable-dep-of: 7f918871112e ("s390/ipl: Fix NULL deref in kdump without re-IPL parm block")
--- arch/s390/include/asm/checksum.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/s390/include/asm/checksum.h +2 -2
@@ -12,7 +12,7 @@#ifndef _S390_CHECKSUM_H#define _S390_CHECKSUM_H -#include <linux/kasan-checks.h> +#include <linux/instrumented.h> #include <linux/in6.h> /*
@@ -34,7 +34,7 @@ static inline __wsum csum_partial(const void *buff, int len, __wsum sum) .odd = (unsigned long) len, }; -kasan_check_read (buff, len); +instrument_read (buff, len); asmvolatile ("0: cksm %[sum],%[rp]\n" " jo 0b\n"
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 408/1193 s390/checksum: provide and use cksm() inline assembly
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
[ Upstream commit 3a74f44de2c901e1536d227d29257cae1a6ed18f ]
Convert those callers of csum_partial() to use the cksm instruction, which are either very early or in critical paths, like panic/dump, so they don't have to rely on a working kernel infrastructure, which will be introduced with a subsequent patch.
Stable-dep-of: 7f918871112e ("s390/ipl: Fix NULL deref in kdump without re-IPL parm block")
--- arch/s390/include/asm/checksum.h | 27 ++++++++++++++++----------- arch/s390/kernel/ipl.c | 3 +-- arch/s390/kernel/os_info.c | 6 +++--- 3 files changed, 20 insertions(+), 16 deletions(-)
arch/s390/include/asm/checksum.h +16 -11
@@ -15,6 +15,21 @@#include <linux/instrumented.h> #include <linux/in6.h> +static inline __wsum cksm (const void *buff,int len,__wsum sum) +{ +union register_pair rp = { + .even = (unsigned long )buff, + .odd = (unsigned long )len, + }; + +instrument_read (buff, len); + asmvolatile ("\n" +"0: cksm %[sum],%[rp]\n" +" jo 0b\n" + : [sum]"+&d" (sum), [rp]"+&d" (rp.pair) : :"cc" ,"memory" ); +return sum; +} +/* * Computes the checksum of a memory block at buff, length len, * and adds in "sum" (32-bit).
@@ -29,17 +44,7 @@*/ static inline __wsum csum_partial (const void *buff,int len,__wsum sum) { -union register_pair rp = { - .even = (unsigned long ) buff, - .odd = (unsigned long ) len, - }; - -instrument_read (buff, len); - asmvolatile ( -"0: cksm %[sum],%[rp]\n" -" jo 0b\n" - : [sum]"+&d" (sum), [rp]"+&d" (rp.pair) : :"cc" ,"memory" ); -return sum; +return cksm (buff, len, sum); }/*
arch/s390/kernel/ipl.c +1 -2
@@ -1965,8 +1965,7 @@ static void dump_reipl_run(struct shutdown_trigger *trigger) reipl_type == IPL_TYPE_UNKNOWN) os_info_flags |=OS_INFO_FLAG_REIPL_CLEAR ;os_info_entry_add (OS_INFO_FLAGS_ENTRY , &os_info_flags,sizeof (os_info_flags)); - csum = (__force unsigned int ) -csum_partial (reipl_block_actual, reipl_block_actual->hdr.len,0 ); + csum = (__force unsigned int )cksm (reipl_block_actual, reipl_block_actual->hdr.len,0 ); abs_lc =get_abs_lowcore (); abs_lc->ipib =__pa (reipl_block_actual); abs_lc->ipib_checksum = csum;
arch/s390/kernel/os_info.c +3 -3
@@ -29,7 +29,7 @@ static struct os_info os_info __page_aligned_data;u32 os_info_csum (struct os_info *os_info) {int size =sizeof (*os_info) - offsetof(struct os_info , version_major); -return (__force u32 )csum_partial (&os_info->version_major, size,0 ); +return (__force u32 )cksm (&os_info->version_major, size,0 ); }/*
@@ -49,7 +49,7 @@ void os_info_entry_add(int nr, void *ptr, u64 size) { os_info.entry[nr].addr =__pa (ptr); os_info.entry[nr].size = size; - os_info.entry[nr].csum = (__force u32 )csum_partial (ptr, size,0 ); + os_info.entry[nr].csum = (__force u32 )cksm (ptr, size,0 ); os_info.csum =os_info_csum (&os_info); }
@@ -98,7 +98,7 @@ static void os_info_old_alloc(int nr, int align) msg ="copy failed" ; goto fail_free; } - csum = (__force u32 )csum_partial (buf_align, size,0 ); + csum = (__force u32 )cksm (buf_align, size,0 );if (csum != os_info_old->entry[nr].csum) { msg ="checksum failed" ; goto fail_free;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 409/1193 s390/os_info: Introduce value entries
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Gordeev <[email protected]>
[ Upstream commit 88702793c5b4ef127a1f57d76920a80f70d081a7 ]
Introduce entries that do not reference any data in memory, but rather provide values. Set the size of such entries to zero and do not compute checksum for them, since there is no data which integrity needs to be checked. The integrity of the value entries itself is still covered by the os_info checksum.
Reserve the lowest unused entry index OS_INFO_RESERVED for future use - presumably for the number of entries present. That could later be used by user level tools. The existing tools would not notice any difference.
Stable-dep-of: 7f918871112e ("s390/ipl: Fix NULL deref in kdump without re-IPL parm block")
--- arch/s390/include/asm/os_info.h | 19 +++++++++++++++---- arch/s390/kernel/ipl.c | 6 +++--- arch/s390/kernel/os_info.c | 15 +++++++++++++-- 3 files changed, 31 insertions(+), 9 deletions(-)
arch/s390/include/asm/os_info.h +15 -4
@@ -17,11 +17,15 @@#define OS_INFO_VMCOREINFO 0#define OS_INFO_REIPL_BLOCK 1#define OS_INFO_FLAGS_ENTRY 2 +#define OS_INFO_RESERVED 3#define OS_INFO_FLAG_REIPL_CLEAR (1UL << 0)struct os_info_entry { -u64 addr; +union { +u64 addr; +u64 val; + };u64 size;u32 csum; } __packed;
@@ -33,17 +37,24 @@ struct os_info {u16 version_minor;u64 crashkernel_addr;u64 crashkernel_size; -struct os_info_entry entry[3 ]; -u8 reserved[4004 ]; +struct os_info_entry entry[4 ]; +u8 reserved[3984 ]; } __packed;void os_info_init (void ); -void os_info_entry_add (int nr,void *ptr,u64 len); +void os_info_entry_add_data (int nr,void *ptr,u64 len); +void os_info_entry_add_val (int nr,u64 val);void os_info_crashkernel_add (unsigned long base,unsigned long size);u32 os_info_csum (struct os_info *os_info);#ifdef CONFIG_CRASH_DUMP void *os_info_old_entry (int nr,unsigned long *size); +static inline unsigned long os_info_old_value (int nr) +{ +unsigned long size; + +return (unsigned long )os_info_old_entry (nr, &size); +}#else static inline void *os_info_old_entry (int nr,unsigned long *size) {
arch/s390/kernel/ipl.c +3 -3
@@ -1230,8 +1230,8 @@ static struct attribute_group reipl_nss_attr_group = {void set_os_info_reipl_block (void ) { -os_info_entry_add (OS_INFO_REIPL_BLOCK , reipl_block_actual, - reipl_block_actual->hdr.len); +os_info_entry_add_data (OS_INFO_REIPL_BLOCK , reipl_block_actual, + reipl_block_actual->hdr.len); }/* reipl type */
@@ -1964,7 +1964,7 @@ static void dump_reipl_run(struct shutdown_trigger *trigger) reipl_type == IPL_TYPE_NSS || reipl_type == IPL_TYPE_UNKNOWN) os_info_flags |=OS_INFO_FLAG_REIPL_CLEAR ; -os_info_entry_add (OS_INFO_FLAGS_ENTRY , &os_info_flags,sizeof (os_info_flags)); +os_info_entry_add_data (OS_INFO_FLAGS_ENTRY , &os_info_flags,sizeof (os_info_flags)); csum = (__force unsigned int )cksm (reipl_block_actual, reipl_block_actual->hdr.len,0 ); abs_lc =get_abs_lowcore (); abs_lc->ipib =__pa (reipl_block_actual);
arch/s390/kernel/os_info.c +13 -2
@@ -43,9 +43,9 @@ void os_info_crashkernel_add(unsigned long base, unsigned long size) }/* -* Add OS info entry and update checksum +* Add OS info data entry and update checksum */ -void os_info_entry_add (int nr,void *ptr,u64 size) +void os_info_entry_add_data (int nr,void *ptr,u64 size) { os_info.entry[nr].addr =__pa (ptr); os_info.entry[nr].size = size;
@@ -53,6 +53,17 @@ void os_info_entry_add(int nr, void *ptr, u64 size) os_info.csum =os_info_csum (&os_info); } +/* +* Add OS info value entry and update checksum +*/ +void os_info_entry_add_val (int nr,u64 value) +{ + os_info.entry[nr].val = value; + os_info.entry[nr].size =0 ; + os_info.entry[nr].csum =0 ; + os_info.csum =os_info_csum (&os_info); +} +/* * Initialize OS info structure and set lowcore pointer */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 410/1193 s390/ipl: Fix NULL deref in kdump without re-IPL parm block
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasily Gorbik <[email protected]>
[ Upstream commit 7f918871112e8e7c581e99eb8e545af4e59c8367 ]
Some IPL types, like HMC FTP boot or QEMU direct kernel boot, might not provide an IPL parameter block. In this case, reipl_type_init() selects IPL_TYPE_UNKNOWN, and reipl_block_actual remains NULL.
kdump passes the re-IPL parameter block to the dump kernel through os_info. Before commit 3b9678472bab ("s390/ipl: correct kdump reipl block checksum calculation"), the os_info entry was added only for IPL types which initialized reipl_block_actual. That commit moved the os_info update to machine_crash_shutdown(), making it unconditional. As a result, set_os_info_reipl_block() dereferences reipl_block_actual for IPL_TYPE_UNKNOWN. This may happen to work by chance when address zero contains readable lowcore data and the resulting empty os_info entry is ignored by the dump kernel.
Skip the os_info update when no re-IPL parameter block is available. Kdump then collect the dump and reboot without setting re-IPL parameter block.
--- arch/s390/kernel/ipl.c | 2 ++ 1 file changed, 2 insertions(+)
arch/s390/kernel/ipl.c +2 -0
@@ -1230,6 +1230,8 @@ static struct attribute_group reipl_nss_attr_group = {void set_os_info_reipl_block (void ) { +if (!reipl_block_actual) +return ;os_info_entry_add_data (OS_INFO_REIPL_BLOCK , reipl_block_actual, reipl_block_actual->hdr.len); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 375/1193 EDAC/igen6: Fix channel address decode for non-hash mode
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qiuxu Zhuo <[email protected]>
[ Upstream commit 7b348d0d401d478f1923ba20a34a61681d1f7971 ]
In non-hash mode, decode_channel_addr() and channel index extraction used a hardcoded interleave bit position 6 instead of the actual intlv_bit parameter, causing incorrect channel address decoding.
Fix this by using intlv_bit consistently in both hash and non-hash modes.
--- drivers/edac/igen6_edac.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/edac/igen6_edac.c +5 -6
@@ -507,13 +507,12 @@ static void decode_addr(u64 addr, u32 hash, u64 s_size, int l_map,return ; } -if (CHANNEL_HASH_MODE (hash)) { - *sub_addr =decode_channel_addr (addr, intlv_bit); + *sub_addr =decode_channel_addr (addr, intlv_bit); + +if (CHANNEL_HASH_MODE (hash)) *idx =decode_chan_idx (addr,CHANNEL_HASH_MASK (hash), intlv_bit); - }else { - *sub_addr =decode_channel_addr (addr,6 ); - *idx =GET_BITFIELD (addr,6 ,6 ); - } +else + *idx =GET_BITFIELD (addr, intlv_bit, intlv_bit); }static int igen6_decode (struct decoded_addr *res)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 411/1193 s390/ipl: Fix NULL deref in dump_reipl without re-IPL parm block
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasily Gorbik <[email protected]>
[ Upstream commit 37f61b71cbc0caefc01022a19ee56fc2510e2e6e ]
Unlike kdump, which passes the re-IPL parameter block through os_info, the stand-alone dump passes it through the IPL parm block address and checksum in lowcore.
Some IPL types, like HMC FTP boot or QEMU direct kernel boot, might not provide an IPL parameter block. In this case reipl_type_init() selects IPL_TYPE_UNKNOWN and reipl_block_actual remains NULL. Nevertheless, dump_reipl_run() unconditionally dereferences it when preparing the lowcore fields. This may happen to work by chance when address zero contains readable lowcore data. A zero IPL parameter block address is then stored in lowcore, causing the stand-alone dumper to enter disabled wait after completing the dump.
Explicitly store a zero IPL parameter block address and checksum when no re-IPL parameter block is available. This does not change the behavior:
the stand-alone dumper completes the dump and halts, while valid re-IPL parameter blocks continue to be handled as before.
--- arch/s390/kernel/ipl.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/s390/kernel/ipl.c +7 -3
@@ -1951,7 +1951,8 @@ static struct shutdown_action __refdata dump_action = {static void dump_reipl_run (struct shutdown_trigger *trigger) {struct lowcore *abs_lc; -unsigned int csum; +unsigned long ipib =0 ; +unsigned int csum =0 ;/* * Set REIPL_CLEAR flag in os_info flags entry indicating
@@ -1967,9 +1968,12 @@ static void dump_reipl_run(struct shutdown_trigger *trigger) reipl_type == IPL_TYPE_UNKNOWN) os_info_flags |=OS_INFO_FLAG_REIPL_CLEAR ;os_info_entry_add_data (OS_INFO_FLAGS_ENTRY , &os_info_flags,sizeof (os_info_flags)); - csum = (__force unsigned int )cksm (reipl_block_actual, reipl_block_actual->hdr.len,0 ); +if (reipl_block_actual) { + ipib =__pa (reipl_block_actual); + csum = (__force unsigned int )cksm (reipl_block_actual, reipl_block_actual->hdr.len,0 ); + } abs_lc =get_abs_lowcore (); - abs_lc->ipib =__pa (reipl_block_actual); + abs_lc->ipib = ipib; abs_lc->ipib_checksum = csum;put_abs_lowcore (abs_lc);dump_run (trigger);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 412/1193 workqueue: replace use of system_wq with system_percpu_wq
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marco Crivellari <[email protected]>
[ Upstream commit a2be943b46b4a7478ea8ddf9bb8e5251c59fceb7 ]
Currently if a user enqueue a work item using schedule_delayed_work() the used wq is "system_wq" (per-cpu wq) while queue_delayed_work() use WORK_CPU_UNBOUND (used when a cpu is not specified). The same applies to schedule_work() that is using system_wq and queue_work(), that makes use again of WORK_CPU_UNBOUND.
This lack of consistentcy cannot be addressed without refactoring the API.
system_wq is a per-CPU worqueue, yet nothing in its name tells about that CPU affinity constraint, which is very often not required by users. Make it clear by adding a system_percpu_wq.
queue_work() / queue_delayed_work() mod_delayed_work() will now use the new per-cpu wq: whether the user still stick on the old name a warn will be printed along a wq redirect to the new one.
This patch add the new system_percpu_wq except for mm, fs and net subsystem, whom are handled in separated patches.
The old wq will be kept for a few release cylces.
Stable-dep-of: 068c35b5d054 ("workqueue: reject watchdog thresholds that overflow jiffies")
--- include/linux/workqueue.h | 22 +++++++++++----------- kernel/workqueue.c | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-)
include/linux/workqueue.h +11 -11
@@ -415,10 +415,10 @@ enum {* short queue flush time. Don't queue works which can run for too * long. * -* system_highpri_wq is similar to system_wq but for work items which +* system_highpri_wq is similar to system_percpu_wq but for work items which * require WQ_HIGHPRI. * -* system_long_wq is similar to system_wq but may host long running +* system_long_wq is similar to system_percpu_wq but may host long running * works. Queue flushing might take relatively long. * * system_dfl_wq is unbound workqueue. Workers are not bound to
@@ -426,13 +426,13 @@ enum {* executed immediately as long as max_active limit is not reached and * resources are available. * -* system_freezable_wq is equivalent to system_wq except that it's +* system_freezable_wq is equivalent to system_percpu_wq except that it's * freezable. * * *_power_efficient_wq are inclined towards saving power and converted * into WQ_UNBOUND variants if 'wq_power_efficient' is enabled; otherwise, * they are same as their non-power-efficient counterparts - e.g. -* system_power_efficient_wq is identical to system_wq if +* system_power_efficient_wq is identical to system_percpu_wq if * 'wq_power_efficient' is disabled. See WQ_POWER_EFFICIENT for more info. */ extern struct workqueue_struct *system_wq;/* use system_percpu_wq, this will be removed */
@@ -603,7 +603,7 @@ static inline bool mod_delayed_work(struct workqueue_struct *wq,*/ static inline bool schedule_work_on (int cpu,struct work_struct *work) { -return queue_work_on (cpu, system_wq, work); +return queue_work_on (cpu, system_percpu_wq, work); }/**
@@ -622,7 +622,7 @@ static inline bool schedule_work_on(int cpu, struct work_struct *work)*/ static inline bool schedule_work (struct work_struct *work) { -return queue_work (system_wq, work); +return queue_work (system_percpu_wq, work); }/*
@@ -639,15 +639,15 @@ extern void __warn_flushing_systemwide_wq(void)#define flush_scheduled_work () \ ({ \ __warn_flushing_systemwide_wq(); \ - __flush_workqueue(system_wq); \ + __flush_workqueue(system_percpu_wq); \ })#define flush_workqueue (wq) \ ({ \ struct workqueue_struct *_wq = (wq); \ \ - if ((__builtin_constant_p(_wq == system_wq) && \ - _wq == system_wq) || \ + if ((__builtin_constant_p(_wq == system_percpu_wq) && \ + _wq == system_percpu_wq) || \ (__builtin_constant_p(_wq == system_highpri_wq) && \ _wq == system_highpri_wq) || \ (__builtin_constant_p(_wq == system_long_wq) && \
@@ -676,7 +676,7 @@ extern void __warn_flushing_systemwide_wq(void)static inline bool schedule_delayed_work_on (int cpu,struct delayed_work *dwork,unsigned long delay) { -return queue_delayed_work_on (cpu, system_wq, dwork, delay); +return queue_delayed_work_on (cpu, system_percpu_wq, dwork, delay); }/**
@@ -690,7 +690,7 @@ static inline bool schedule_delayed_work_on(int cpu, struct delayed_work *dwork,static inline bool schedule_delayed_work (struct delayed_work *dwork,unsigned long delay) { -return queue_delayed_work (system_wq, dwork, delay); +return queue_delayed_work (system_percpu_wq, dwork, delay); }#ifndef CONFIG_SMP
kernel/workqueue.c +1 -1
@@ -6574,7 +6574,7 @@ static int wq_watchdog_param_set_thresh(const char *val,if (ret)return ret; -if (system_wq) +if (system_percpu_wq)wq_watchdog_set_thresh (thresh);else wq_watchdog_thresh = thresh;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 413/1193 workqueue: reject watchdog thresholds that overflow jiffies
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiacheng Xu <[email protected]>
[ Upstream commit 068c35b5d0546c8625b3d7c61910f73775cf1216 ]
The watchdog threshold is supplied in seconds but is multiplied by HZ before being used as a jiffies interval. Reject values that exceed MAX_JIFFY_OFFSET / HZ so the multiplication cannot wrap and the time_after() comparisons remain within their supported range.
The check is performed before changing the threshold or watchdog timer. Zero remains the value used to disable the watchdog.
--- kernel/workqueue.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/workqueue.c +3 -0
@@ -6574,6 +6574,9 @@ static int wq_watchdog_param_set_thresh(const char *val,if (ret)return ret; +if (thresh >MAX_JIFFY_OFFSET /HZ ) +return -ERANGE ; +if (system_percpu_wq)wq_watchdog_set_thresh (thresh);else
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 414/1193 Bluetooth: btintel: Print firmware SHA1
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kiran K <[email protected]>
[ Upstream commit a2e7707bba21b373c7b429ad7f9030d63dfb4542 ]
Intel Read Version event contains a TLV(0x32) having firmware sha1 in operational image.
Stable-dep-of: a086c0892969 ("Bluetooth: btintel: validate version TLV value lengths")
--- drivers/bluetooth/btintel.c | 5 +++++ drivers/bluetooth/btintel.h | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/bluetooth/btintel.c +5 -0
@@ -530,6 +530,8 @@ static int btintel_version_info_tlv(struct hci_dev *hdev,bt_dev_info (hdev,"%s timestamp %u.%u buildtype %u build %u" , variant,2000 + (version->timestamp >>8 ), version->timestamp &0xff , version->build_type, version->build_num); +if (version->img_type ==0x03 ) +bt_dev_info (hdev,"Firmware SHA1: 0x%8.8x" , version->git_sha1);return 0 ; }
@@ -625,6 +627,9 @@ static int btintel_parse_version_tlv(struct hci_dev *hdev,memcpy (&version->otp_bd_addr, tlv->val,sizeof (bdaddr_t));break ; +case INTEL_TLV_GIT_SHA1 : + version->git_sha1 =get_unaligned_le32 (tlv->val); +break ;default :/* Ignore rest of information */ break ;
drivers/bluetooth/btintel.h +3 -1
@@ -41,7 +41,8 @@ enum {INTEL_TLV_LIMITED_CCE ,INTEL_TLV_SBE_TYPE ,INTEL_TLV_OTP_BDADDR , -INTEL_TLV_UNLOCKED_STATE +INTEL_TLV_UNLOCKED_STATE , +INTEL_TLV_GIT_SHA1 }; struct intel_tlv {
@@ -69,6 +70,7 @@ struct intel_version_tlv {u8 min_fw_build_yy;u8 limited_cce;u8 sbe_type; +u32 git_sha1;bdaddr_t otp_bd_addr; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 415/1193 Bluetooth: btintel: Export few static functions
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kiran K <[email protected]>
[ Upstream commit 67d4dbac3b8c48ada784ae923f7cd68dfac509ec ]
Some of the functions used in btintel.c is made global so that they can be reused in other transport drivers apart from USB.
Stable-dep-of: a086c0892969 ("Bluetooth: btintel: validate version TLV value lengths")
--- drivers/bluetooth/btintel.c | 26 +++++++++++++--------- drivers/bluetooth/btintel.h | 43 +++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 10 deletions(-)
drivers/bluetooth/btintel.c +16 -10
@@ -235,7 +235,7 @@ static int btintel_set_diag_combined(struct hci_dev *hdev, bool enable)return ret; } -static void btintel_hw_error (struct hci_dev *hdev,u8 code) +void btintel_hw_error (struct hci_dev *hdev,u8 code) {struct sk_buff *skb;u8 type =0x00 ;
@@ -272,6 +272,7 @@ static void btintel_hw_error(struct hci_dev *hdev, u8 code) unlock:hci_req_sync_unlock (hdev); } +EXPORT_SYMBOL_GPL (btintel_hw_error);int btintel_version_info (struct hci_dev *hdev,struct intel_version *ver) {
@@ -450,8 +451,8 @@ int btintel_read_version(struct hci_dev *hdev, struct intel_version *ver) }EXPORT_SYMBOL_GPL (btintel_read_version); -static int btintel_version_info_tlv (struct hci_dev *hdev, -struct intel_version_tlv *version) +int btintel_version_info_tlv (struct hci_dev *hdev, +struct intel_version_tlv *version) {const char *variant;
@@ -535,10 +536,11 @@ static int btintel_version_info_tlv(struct hci_dev *hdev,return 0 ; } +EXPORT_SYMBOL_GPL (btintel_version_info_tlv); -static int btintel_parse_version_tlv (struct hci_dev *hdev, -struct intel_version_tlv *version, -struct sk_buff *skb) +int btintel_parse_version_tlv (struct hci_dev *hdev, +struct intel_version_tlv *version, +struct sk_buff *skb) {/* Consume Command Complete Status field */ skb_pull (skb,1 );
@@ -640,6 +642,7 @@ static int btintel_parse_version_tlv(struct hci_dev *hdev,return 0 ; } +EXPORT_SYMBOL_GPL (btintel_parse_version_tlv);static int btintel_read_version_tlv (struct hci_dev *hdev,struct intel_version_tlv *version)
@@ -2531,8 +2534,8 @@ static void btintel_set_dsm_reset_method(struct hci_dev *hdev, data->acpi_reset_method = btintel_acpi_reset_method; } -static int btintel_bootloader_setup_tlv (struct hci_dev *hdev, -struct intel_version_tlv *ver) +int btintel_bootloader_setup_tlv (struct hci_dev *hdev, +struct intel_version_tlv *ver) {u32 boot_param;char ddcname[64 ];
@@ -2599,8 +2602,9 @@ static int btintel_bootloader_setup_tlv(struct hci_dev *hdev,return 0 ; } +EXPORT_SYMBOL_GPL (btintel_bootloader_setup_tlv); -static void btintel_set_msft_opcode (struct hci_dev *hdev,u8 hw_variant) +void btintel_set_msft_opcode (struct hci_dev *hdev,u8 hw_variant) {switch (hw_variant) {/* Legacy bootloader devices that supports MSFT Extension */
@@ -2623,6 +2627,7 @@ static void btintel_set_msft_opcode(struct hci_dev *hdev, u8 hw_variant)break ; } } +EXPORT_SYMBOL_GPL (btintel_set_msft_opcode);static int btintel_setup_combined (struct hci_dev *hdev) {
@@ -2873,7 +2878,7 @@ static int btintel_setup_combined(struct hci_dev *hdev)return err; } -static int btintel_shutdown_combined (struct hci_dev *hdev) +int btintel_shutdown_combined (struct hci_dev *hdev) {struct sk_buff *skb;int ret;
@@ -2907,6 +2912,7 @@ static int btintel_shutdown_combined(struct hci_dev *hdev)return 0 ; } +EXPORT_SYMBOL_GPL (btintel_shutdown_combined);int btintel_configure_setup (struct hci_dev *hdev,const char *driver_name) {
drivers/bluetooth/btintel.h +43 -0
53 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 416/1193 Bluetooth: btintel: validate version TLV value lengths
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laxman Acharya Padhya <[email protected]>
[ Upstream commit a086c0892969bf8a0151b0f12bd14a68827c88b2 ]
btintel_parse_version_tlv() verifies that a complete TLV is present in the response, but it does not ensure that the value is long enough for the specific TLV type. A short value can therefore cause an out-of-bounds read through get_unaligned_le16(), get_unaligned_le32(), or memcpy().
Reject values shorter than the minimum required by each known TLV type. Also reject responses that do not contain the Command Complete Status field.
--- drivers/bluetooth/btintel.c | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-)
drivers/bluetooth/btintel.c +36 -1
@@ -538,12 +538,44 @@ int btintel_version_info_tlv(struct hci_dev *hdev, }EXPORT_SYMBOL_GPL (btintel_version_info_tlv); +static u8 btintel_version_tlv_min_len (u8 type) +{ +switch (type) { +case INTEL_TLV_CNVI_TOP : +case INTEL_TLV_CNVR_TOP : +case INTEL_TLV_CNVI_BT : +case INTEL_TLV_CNVR_BT : +case INTEL_TLV_BUILD_NUM : +case INTEL_TLV_GIT_SHA1 : +return sizeof (u32); +case INTEL_TLV_DEV_REV_ID : +case INTEL_TLV_TIME_STAMP : +return sizeof (u16); +case INTEL_TLV_IMAGE_TYPE : +case INTEL_TLV_BUILD_TYPE : +case INTEL_TLV_SECURE_BOOT : +case INTEL_TLV_OTP_LOCK : +case INTEL_TLV_API_LOCK : +case INTEL_TLV_DEBUG_LOCK : +case INTEL_TLV_LIMITED_CCE : +case INTEL_TLV_SBE_TYPE : +return sizeof (u8); +case INTEL_TLV_MIN_FW : +return 3 ; +case INTEL_TLV_OTP_BDADDR : +return sizeof (bdaddr_t); +default : +return 0 ; + } +} +int btintel_parse_version_tlv (struct hci_dev *hdev,struct intel_version_tlv *version,struct sk_buff *skb) {/* Consume Command Complete Status field */ -skb_pull (skb,1 ); +if (!skb_pull (skb,1 )) +return -EINVAL ;/* Event parameters contatin multiple TLVs. Read each of them * and only keep the required data. Also, it use existing legacy
@@ -563,6 +595,9 @@ int btintel_parse_version_tlv(struct hci_dev *hdev,if (skb->len < tlv->len +sizeof (*tlv))return -EINVAL ; +if (tlv->len <btintel_version_tlv_min_len (tlv->type)) +return -EINVAL ; +switch (tlv->type) {case INTEL_TLV_CNVI_TOP : version->cnvi_top =get_unaligned_le32 (tlv->val);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 417/1193 Bluetooth: hci_core: Fix race condition during device registration
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Nogikh <[email protected]>
[ Upstream commit 57938bbdb9bf7fd41cbd5cd509ec10c4b22bec18 ]
In hci_register_dev(), the power_on work item is queued to hdev->req_workqueue before initializing hdev->adv_monitors_idr and registering the MSFT extension via msft_register(). For devices marked with quirks such as HCI_QUIRK_RAW_DEVICE, the HCI_UNCONFIGURED flag is set on the device. When the power_on work item runs concurrently on another CPU, hci_power_on() detects that the device is unconfigured and immediately invokes hci_dev_do_close(), which calls msft_do_close().
Concurrently, msft_register() allocates the msft structure and exposes it to hdev->msft_data prior to calling mutex_init(&msft->filter_lock). If msft_do_close() executes while hdev->msft_data is already assigned but the mutex has not yet been initialized, mutex_lock(&msft->filter_lock) operates on an uninitialized mutex, triggering a DEBUG_LOCKS warning:
DEBUG_LOCKS_WARN_ON(lock->magic != lock)
WARNING: kernel/locking/mutex.c:625 at __mutex_lock_common kernel/locking/mutex.c:625 [inline] WARNING: kernel/locking/mutex.c:625 at __mutex_lock+0x12d8/0x1550 kernel/locking/mutex.c:821 ... Call Trace: <TASK> msft_do_close+0x308/0x7b0 net/bluetooth/msft.c:693 hci_dev_close_sync+0x86b/0x10a0 net/bluetooth/hci_sync.c:5522 hci_dev_do_close net/bluetooth/hci_core.c:499 [inline] hci_power_on+0x32c/0x750 net/bluetooth/hci_core.c:937 process_one_work kernel/workqueue.c:3322 [inline] process_scheduled_works+0xa8e/0x14e0 kernel/workqueue.c:3405 worker_thread+0x92d/0xe10 kernel/workqueue.c:3486 kthread+0x388/0x470 kernel/kthread.c:436 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 </TASK>
Fix this by moving the queue_work() call in hci_register_dev() to after idr_init(&hdev->adv_monitors_idr) and msft_register(hdev) so that device structures and extensions are fully initialized before asynchronous tasks can access them. Additionally, assign hdev->msft_data in msft_register() only after mutex_init(&msft->filter_lock) has completed.
--- net/bluetooth/hci_core.c | 4 ++-- net/bluetooth/msft.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
net/bluetooth/hci_core.c +2 -2
@@ -2662,11 +2662,11 @@ int hci_register_dev(struct hci_dev *hdev)if (error)BT_WARN ("register suspend notifier failed error:%d\n" , error); -queue_work (hdev->req_workqueue, &hdev->power_on); -idr_init (&hdev->adv_monitors_idr);msft_register (hdev); +queue_work (hdev->req_workqueue, &hdev->power_on); +return id; err_wqueue:
net/bluetooth/msft.c +1 -1
@@ -770,8 +770,8 @@ void msft_register(struct hci_dev *hdev)INIT_LIST_HEAD (&msft->handle_map);INIT_LIST_HEAD (&msft->address_filters); - hdev->msft_data = msft;mutex_init (&msft->filter_lock); + hdev->msft_data = msft; }void msft_release (struct hci_dev *hdev)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 418/1193 Bluetooth: L2CAP: fix chan mode for LE_CONN_REQ + EXT_FLOWCTL pchan
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pauli Virtanen <[email protected]>
[ Upstream commit 4ef05db5b08b176a551b4a6287372045998806b0 ]
l2cap_new_connection() sets default value of channel mode to match the parent channel. l2cap_le_connect_req() left this at the default, and created L2CAP_MODE_EXT_FLOWCTL channels if listening pchan has that mode. This causes FLAG_DEFER_SETUP channels to reply to L2CAP_LE_CONN_REQ with L2CAP_ECRED_CONN_RSP, which is incorrect.
It can also result to stack OOB write (of l2cap_alloc_cid determined values) in l2cap_ecred_rsp_defer(), as l2cap_le_connect_req() does not limit maximum number of deferred channels or check for duplicate ident.
Fix by setting chan->mode correctly in l2cap_le_connect_req().
Also check channel mode in l2cap_ecred_rsp_defer(), and do WARN_ON_ONCE instead of OOB write to make it less brittle.
--- net/bluetooth/l2cap_core.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/bluetooth/l2cap_core.c +8 -0
@@ -3841,6 +3841,9 @@ static void l2cap_ecred_rsp_defer(struct l2cap_chan *chan, void *data) {struct l2cap_ecred_rsp_data *rsp = data; +if (chan->mode !=L2CAP_MODE_EXT_FLOWCTL ) +return ; +/* Check if channel for outgoing connection or if it wasn't deferred * since in those cases it must be skipped. */
@@ -3851,6 +3854,10 @@ static void l2cap_ecred_rsp_defer(struct l2cap_chan *chan, void *data)/* Reset ident so only one response is sent */ chan->ident =0 ; +/* Unreachable, check in l2cap_ecred_conn_req. If reached, drop rest */ +if (WARN_ON_ONCE (rsp->count >=ARRAY_SIZE (rsp->pdu.scid))) + rsp->pdu.rsp.result =cpu_to_le16 (L2CAP_CR_LE_NO_MEM ); +/* Include all channels pending with the same ident */ if (!rsp->pdu.rsp.result) rsp->pdu.rsp.dcid[rsp->count++] =cpu_to_le16 (chan->scid);
@@ -4995,6 +5002,7 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn,__set_chan_timer (chan, chan->ops->get_sndtimeo (chan)); chan->ident = cmd->ident; + chan->mode =L2CAP_MODE_LE_FLOWCTL ;if (test_bit (FLAG_DEFER_SETUP , &chan->flags)) {l2cap_state_change (chan,BT_CONNECT2 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 376/1193 EDAC/device_sysfs: Use kstrtouint() for poll_msec to prevent truncation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jad Keskes <[email protected]>
[ Upstream commit 66cc9dec919dd63d8e4b3d386f7aed3ae684e645 ]
The poll_msec sysfs store file uses simple_strtoul() which accepts an unsigned long, but the target field (poll_msec) is unsigned int. On 64-bit systems, a value > UINT_MAX is silently truncated when stored.
Fix the mismatch by using kstrtouint() instead. This rejects values larger than UINT_MAX at parse time, making truncation impossible. Also add a check for value < 1 to reject the 0-delay case, which would cause the poll work to spin without delay and consume 100% CPU.
--- drivers/edac/edac_device_sysfs.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/edac/edac_device_sysfs.c +9 -2
@@ -90,14 +90,21 @@ static ssize_t edac_device_ctl_poll_msec_store(struct edac_device_ctl_info *ctl_info, const char *data, size_t count) { -unsigned long value; +unsigned int value; +int ret;/* get the value and enforce that it is non-zero, must be at least * one millisecond for the delay period, between scans * Then cancel last outstanding delay for the work request * and set a new one. */ - value =simple_strtoul (data,NULL ,0 ); + ret =kstrtouint (data,0 , &value); +if (ret <0 ) +return ret; + +if (value <1 ) +return -EINVAL ; +edac_device_reset_delay_period (ctl_info, value);return count;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 377/1193 drm/virtio: Fix a NULL vs ERR_PTR() bug in virtio_gpu_user_framebuffer_create()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 94579f24e2b526a04eb41050af0ba018c6f528e7 ]
Smatch complains that returning a NULL here will lead to a NULL pointer dereference in drm_mode_addfb2(). Return an error pointer instead.
--- drivers/gpu/drm/virtio/virtgpu_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/virtio/virtgpu_display.c +1 -1
@@ -320,7 +320,7 @@ virtio_gpu_user_framebuffer_create(struct drm_device *dev,if (ret) {kfree (virtio_gpu_fb);drm_gem_object_put (obj); -return NULL ; +return ERR_PTR (ret); }return &virtio_gpu_fb->base;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 378/1193 accel/qaic: Address potential out-of-bounds read in resp_worker()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Youssef Samir <[email protected]>
[ Upstream commit ab243f74ab4084ca5c8dec608cb5b0deb27db067 ]
Although 'commit 2feec5ae5df7 ("accel/qaic: Handle DBC deactivation if the owner went away")' fixes the scenario it was intended for by walking the message and only decoding QAIC_TRANS_DEACTIVATE_FROM_DEV, if present, it skipped over the bounds checking code that is included in decode_message(). This could lead to issues such as reading past the slab allocation's end, infinite loops or kernel panics. For those issues to happen, a malformed wire message is needed to be sent from the device.
Instead of duplicating the bounds checking code already present in decode_message(), use the function inside resp_worker().
--- drivers/accel/qaic/qaic_control.c | 46 ++++++++++++++++--------------- 1 file changed, 24 insertions(+), 22 deletions(-)
drivers/accel/qaic/qaic_control.c +24 -22
@@ -958,11 +958,13 @@ static int decode_status(struct qaic_device *qdev, void *trans, struct manage_msstatic int decode_message (struct qaic_device *qdev,struct manage_msg *user_msg,struct wire_msg *msg,struct ioctl_resources *resources, -struct qaic_user *usr) +struct qaic_user *usr,bool orphaned_deactivate) { +u32 msg_hdr_count =le32_to_cpu (msg->hdr.count);u32 msg_hdr_len =le32_to_cpu (msg->hdr.len);struct wire_trans_hdr *trans_hdr;u32 msg_len =0 ; +int trans_type;int ret;int i;
@@ -970,10 +972,12 @@ static int decode_message(struct qaic_device *qdev, struct manage_msg *user_msg, msg_hdr_len > QAIC_MANAGE_MAX_MSG_LENGTH)return -EINVAL ; - user_msg->len =0 ; - user_msg->count =le32_to_cpu (msg->hdr.count); +if (user_msg) { + user_msg->len =0 ; + user_msg->count = msg_hdr_count; + } -for (i =0 ; i < user_msg->count; ++i) { +for (i =0 ; i < msg_hdr_count; ++i) {u32 hdr_len;if (msg_len > msg_hdr_len -sizeof (*trans_hdr))
@@ -985,7 +989,20 @@ static int decode_message(struct qaic_device *qdev, struct manage_msg *user_msg, size_add(msg_len, hdr_len) > msg_hdr_len)return -EINVAL ; -switch (le32_to_cpu (trans_hdr->type)) { + trans_type =le32_to_cpu (trans_hdr->type); +/* +* orphaned_deactivate is the case where a deactivate response +* is received from the device after the user owning the DBC, +* and the message requesting deactivation, has gone away. +* In this case, only process QAIC_TRANS_DEACTIVATE_FROM_DEV +* transaction and skip the others. +*/ +if (orphaned_deactivate && trans_type !=QAIC_TRANS_DEACTIVATE_FROM_DEV ) { + msg_len += hdr_len; +continue ; + } + +switch (trans_type) {case QAIC_TRANS_PASSTHROUGH_FROM_DEV : ret =decode_passthrough (qdev, trans_hdr, user_msg, &msg_len);break ;
@@ -1276,7 +1293,7 @@ static int qaic_manage(struct qaic_device *qdev, struct qaic_user *usr, struct m goto dma_cont_failed; } - ret =decode_message (qdev, user_msg, rsp, &resources, usr); + ret =decode_message (qdev, user_msg, rsp, &resources, usr, false); dma_cont_failed:free_dbc_buf (qdev, &resources);
@@ -1441,22 +1458,7 @@ static void resp_worker(struct work_struct *work)* response to the QAIC_TRANS_TERMINATE_TO_DEV transaction, * otherwise, the user can issue an soc_reset to the device. */ -u32 msg_count =le32_to_cpu (msg->hdr.count); -u32 msg_len =le32_to_cpu (msg->hdr.len); -u32 len =0 ; -int j; - -for (j =0 ; j < msg_count && len < msg_len; ++j) { -struct wire_trans_hdr *trans_hdr; - - trans_hdr = (struct wire_trans_hdr *)(msg->data + len); -if (le32_to_cpu (trans_hdr->type) ==QAIC_TRANS_DEACTIVATE_FROM_DEV ) { -if (decode_deactivate (qdev, trans_hdr, &len,NULL )) - len +=le32_to_cpu (trans_hdr->len); - }else { - len +=le32_to_cpu (trans_hdr->len); - } - } +decode_message (qdev,NULL , msg,NULL ,NULL , true);/* request must have timed out, drop packet */ kfree (msg); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 379/1193 nvme-rdma: fix -EIO cleanup order in queue_rq
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xixin Liu <[email protected]>
[ Upstream commit d61828199c6cb4b76d48403c77023cd4bb9d09fc ]
On -EIO, the RDMA queue_rq path reports a host path error and then still cleans up the command and unmaps the SQE DMA. The path error helper completes the request, so that is double cleanup and DMA unmap after the request is already complete.
Unmap the SQE first, then report the host path error. Skip the outer command cleanup on that path.
--- drivers/nvme/host/rdma.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/nvme/host/rdma.c +10 -8
@@ -1981,7 +1981,7 @@ static blk_status_t nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx,struct ib_device *dev;bool queue_ready =test_bit (NVME_RDMA_Q_LIVE , &queue->flags);blk_status_t ret; -int err; +int err =0 ;WARN_ON_ONCE (rq->tag <0 );
@@ -2037,16 +2037,18 @@ static blk_status_t nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx, err_unmap:nvme_rdma_unmap_data (queue, rq); err: -if (err == -EIO ) - ret =nvme_host_path_error (rq); -else if (err == -ENOMEM || err == -EAGAIN ) - ret =BLK_STS_RESOURCE ; -else - ret =BLK_STS_IOERR ; -nvme_cleanup_cmd (rq); +if (err != -EIO ) { +nvme_cleanup_cmd (rq); +if (err == -ENOMEM || err == -EAGAIN ) + ret =BLK_STS_RESOURCE ; +else + ret =BLK_STS_IOERR ; + } unmap_qe:ib_dma_unmap_single (dev, req->sqe.dma,sizeof (struct nvme_command ),DMA_TO_DEVICE ); +if (err == -EIO ) +return nvme_host_path_error (rq);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 380/1193 selftests/cgroup: Fix cg_run_in_subcgroups ignoring arg parameter
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongfu Li <[email protected]>
[ Upstream commit a8c6daab4b0e276508b7ffdd66c60fd3020a9178 ]
cg_run_in_subcgroups() discards its arg and always passes NULL to cg_run(), turning the (void *)100 from test_kmem_dead_cgroups() into NULL so no allocation occurs.
This makes test_kmem_dead_cgroups() falsely pass without exercising the "dying cgroup with charged slab" scenario it intends to test.
Pass the arg through to cg_run() to fix this.
--- tools/testing/selftests/cgroup/test_kmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/cgroup/test_kmem.c +1 -1
@@ -144,7 +144,7 @@ static int cg_run_in_subcgroups(const char *parent,return -1 ; } -if (cg_run (child, fn,NULL )) { +if (cg_run (child, fn, arg)) {cg_destroy (child);free (child);return -1 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 371/1193 ARM: 9484/1: enable interrupts when unhandled user faults are triggered
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xie Yuanbin <[email protected]>
[ Upstream commit e79ca91165d4fd18549c536abdb86101e889052f ]
PREEMPT_RT requires interrupts to be enabled when sending signals.
When do_DataAbort()/do_PrefetchAbort() triggers unhandled user faults, that is inf->fn() return a non-zero value, and the interrupts are not enabled within the hook function, force_sig_fault() will be called with interrupts disabled.
This can be triggered by user programs executing the bkpt instruction, with kernel config CONFIG_PERF_EVENTS=n.
Enable interrupts in do_DataAbort()/do_PrefetchAbort() when unhandled user faults are triggered to fix the issue.
--- arch/arm/mm/fault.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/mm/fault.c +6 -0
@@ -587,6 +587,9 @@ do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs)if (!inf->fn (addr, fsr & ~FSR_LNX_PF , regs))return ; +if (likely (user_mode (regs))) +local_irq_enable (); +pr_alert ("8<--- cut here ---\n" );pr_alert ("Unhandled fault: %s (0x%03x) at 0x%08lx\n" , inf->name, fsr, addr);
@@ -625,6 +628,9 @@ do_PrefetchAbort(unsigned long addr, unsigned int ifsr, struct pt_regs *regs)if (!inf->fn (addr, ifsr |FSR_LNX_PF , regs))return ; +if (likely (user_mode (regs))) +local_irq_enable (); +pr_alert ("8<--- cut here ---\n" );pr_alert ("Unhandled prefetch abort: %s (0x%03x) at 0x%08lx\n" , inf->name, ifsr, addr);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 420/1193 Bluetooth: hci_mrvl: Fix wrong return value check of wait_on_bit_timeout()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gongwei Li <[email protected]>
[ Upstream commit 2deb76c21b81e42b3282224f7dd2046fe73fd1e0 ]
wait_on_bit_timeout() returns 0 if the bit was cleared, -EINTR if the process received a signal and the mode permitted wake up on that signal, or -EAGAIN if the timeout elapsed. It never returns 1.
Hence the check "err == 1" in mrvl_load_firmware() is dead code: when the waiting task is interrupted by a signal (-EINTR), the code falls into the "else if (err)" branch and misreports it as "Firmware request timeout" with -ETIMEDOUT instead of propagating -EINTR.
Fix this by testing for -EINTR so that an interrupted firmware load is properly detected and reported.
--- drivers/bluetooth/hci_mrvl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/bluetooth/hci_mrvl.c +1 -2
@@ -307,9 +307,8 @@ static int mrvl_load_firmware(struct hci_dev *hdev, const char *name) err =wait_on_bit_timeout (&mrvl->flags,STATE_FW_REQ_PENDING ,TASK_INTERRUPTIBLE ,msecs_to_jiffies (2000 )); -if (err ==1 ) { +if (err == -EINTR ) {bt_dev_err (hdev,"Firmware load interrupted" ); - err = -EINTR ;break ; }else if (err) {bt_dev_err (hdev,"Firmware request timeout" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 429/1193 ipv6: sr: restore network header before routing and forwarding
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 975b5b067f525a1b1338c4a3bee1c46545801518 ]
ipv6_srh_rcv() runs with skb->data at the Segment Routing Header (SRH) while skb_network_header() points at the IPv6 header.
When segments_left > 0, ipv6_srh_rcv() previously restored the skb->data position by pushing sizeof(struct ipv6hdr), assuming the SRH immediately followed the fixed IPv6 header. If another extension header (such as a Hop-by-Hop options header) precedes the SRH, skb_network_offset() remained negative.
This led to two problems:
1. During ip6_route_input(), fib6_rules_early_flow_dissect() invokes __skb_flow_dissect() which passes the negative skb_network_offset() to flow dissection, breaking BPF and C flow dissector logic.
2. If forwarded via ip6_forward() or redirected via act_mirred, downstream handlers (like sch_fragment() or neighbour output) pass the negative offset as an unsigned length, triggering OOB memcpy or buffer overflows.
Fix this by pushing -skb_network_offset(skb) before routing, ensuring skb_network_offset(skb) is 0 for route lookup / flow dissection as well as downstream forwarding. On the loopback path, pull skb_transport_offset(skb) to restore skb->data to the SRH before looping back.
--- net/ipv6/exthdrs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv6/exthdrs.c +2 -2
@@ -454,7 +454,7 @@ static int ipv6_srh_rcv(struct sk_buff *skb) hdr->segments_left--; addr = hdr->segments + hdr->segments_left; -skb_push (skb,sizeof (struct ipv6hdr )); +skb_push (skb, -skb_network_offset (skb));if (skb->ip_summed ==CHECKSUM_COMPLETE )seg6_update_csum (skb);
@@ -478,7 +478,7 @@ static int ipv6_srh_rcv(struct sk_buff *skb) }ipv6_hdr (skb)->hop_limit--; -skb_pull (skb,sizeof (struct ipv6hdr )); +skb_pull (skb,skb_transport_offset (skb)); goto looped_back; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 430/1193 af_packet: Dont cast tpacket_hdr.tp_len to int in tpacket_parse_header().
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 73e594c19b4f815d8343461cec7074c4713bbde7 ]
syzbot reported BUG() in sock_sendmsg_nosec(). [0]
The problem is that tpacket_parse_header() casts user-provided tpacket_hdr.tp_len, which is u32, to int.
If the length is larger than INT_MAX, the following condition in tpacket_parse_header() passes,
if (unlikely(tp_len > size_max))
and any negative value can be returned to the caller, up to sock_sendmsg_nosec().
The repro set tpacket_hdr.tp_len to 0xfffffdef, which is cast to -EIOCBQUEUED (-529), triggering BUG() in sock_sendmsg_nosec().
*(uint64_t*)0x200000000008 = 0xfffffdef; ... syscall(__NR_write, /*fd=*/r[0], /*buf=*/0x200000000000ul, /*count=*/1ul);
Let's define the local tp_len as u32 in tpacket_parse_header().
[0]:
kernel BUG at net/socket.c:803!
Oops: invalid opcode: 0000 [#1] SMP KASAN PTI CPU: 0 UID: 0 PID: 5628 Comm: syz-executor176 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026 RIP: 0010:sock_sendmsg_nosec+0x145/0x180 net/socket.c:803 Code: 06 67 48 0f b9 3a eb 95 e8 e8 3a 22 f8 48 89 df 4c 89 f6 4c 89 e2 4d 89 fb 2e e8 32 a5 5c 16 e9 51 ff ff ff e8 cc 3a 22 f8 90 <0f> 0b e8 c4 3a 22 f8 48 83 c3 18 48 89 d8 48 c1 e8 03 42 80 3c 28 RSP: 0018:ffffc90003aefb48 EFLAGS: 00010293 RAX: ffffffff89a578d4 RBX: ffff8880764c67c0 RCX: ffff88807fb23e80 RDX: 0000000000000000 RSI: 00000000fffffdef RDI: 00000000fffffdef RBP: 00000000fffffdef R08: ffffc90003aef747 R09: 1ffff9200075dee8 R10: dffffc0000000000 R11: fffff5200075dee9 R12: 0000000000000001 R13: dffffc0000000000 R14: ffffc90003aefbc0 R15: ffffffff8aac4310 FS: 000055559101b400(0000) GS:ffff888124ce0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000200000000210 CR3: 0000000073dca000 CR4: 00000000003526f0 Call Trace: <TASK> __sock_sendmsg net/socket.c:815 [inline] sock_write_iter+0x2de/0x3e0 net/socket.c:1266 new_sync_write fs/read_write.c:595 [inline] vfs_write+0x612/0xba0 fs/read_write.c:687 ksys_write+0x150/0x270 fs/read_write.c:739 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f173130ecb9 Code: c0 79 93 eb d5 48 8d 7c 1d 00 eb 99 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 d8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffd67e44248 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 0000200000000000 RCX: 00007f173130ecb9 RDX: 0000000000000001 RSI: 0000200000000000 RDI: 0000000000000003 RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffd67e44388 R13: 0000000000000002 R14: 00002000000000c0 R15: 0000000000000002 </TASK>
--- net/packet/af_packet.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/packet/af_packet.c +3 -2
@@ -2725,7 +2725,8 @@ static int tpacket_parse_header(struct packet_sock *po, void *frame, int size_max, void **data) { union tpacket_uhdr ph; -int tp_len, off; +u32 tp_len; +int off; ph.raw = frame;
@@ -2745,7 +2746,7 @@ static int tpacket_parse_header(struct packet_sock *po, void *frame,break ; }if (unlikely (tp_len > size_max)) { -pr_err ("packet size is too long (%d > %d)\n" , tp_len, size_max); +pr_err ("packet size is too long (%u > %d)\n" , tp_len, size_max);return -EMSGSIZE ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 431/1193 staging: fbtft: make dirty_lock IRQ-safe
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hui Su <[email protected]>
[ Upstream commit f576944a59f31bcffff121117ebf452c5dd162b7 ]
fbtft_mkdirty() can be reached from the fbcon rendering path while processing printk() in hardirq context. Meanwhile, dirty_lock is also taken by fbtft_deferred_io() in workqueue context with local interrupts enabled.
Lockdep reports a possible IRQ lock inversion involving dirty_lock and console_owner. A hardirq can interrupt a CPU holding dirty_lock and enter the console rendering path, which can attempt to acquire dirty_lock again.
The following lockdep report was observed on an RK3566 system with CONFIG_PROVE_LOCKING enabled:
WARNING: possible irq lock inversion dependency detected swapper/2/0 just changed the state of lock:
(console_owner){-...}-{0:0}
but this lock took another, HARDIRQ-unsafe lock in the past:
(&par->dirty_lock){+.+.}-{2:2}
CPU0 CPU1
---- ----
lock(&par->dirty_lock);
local_irq_disable();
lock(console_owner);
lock(&par->dirty_lock);
<Interrupt>
lock(console_owner);*** DEADLOCK ***
Use spin_lock_irqsave() for fbtft_mkdirty() and spin_lock_irq() for fbtft_deferred_io(). They only access the dirty line range, so the IRQ-off regions remain short.
--- drivers/staging/fbtft/fbtft-core.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/staging/fbtft/fbtft-core.c +5 -4
@@ -302,6 +302,7 @@ static void fbtft_mkdirty(struct fb_info *info, int y, int height) {struct fbtft_par *par = info->par;struct fb_deferred_io *fbdefio = info->fbdefio; +unsigned long flags;/* special case, needed ? */ if (y ==-1 ) {
@@ -310,12 +311,12 @@ static void fbtft_mkdirty(struct fb_info *info, int y, int height) }/* Mark display lines/area as dirty */ -spin_lock (&par->dirty_lock); +spin_lock_irqsave (&par->dirty_lock, flags);if (y < par->dirty_lines_start) par->dirty_lines_start = y;if (y + height -1 > par->dirty_lines_end) par->dirty_lines_end = y + height -1 ; -spin_unlock (&par->dirty_lock); +spin_unlock_irqrestore (&par->dirty_lock, flags);/* Schedule deferred_io to update display (no-op if already on queue)*/ schedule_delayed_work (&info->deferred_work, fbdefio->delay);
@@ -329,13 +330,13 @@ static void fbtft_deferred_io(struct fb_info *info, struct list_head *pagereflisunsigned int y_low =0 , y_high =0 ;int count =0 ; -spin_lock (&par->dirty_lock); +spin_lock_irq (&par->dirty_lock); dirty_lines_start = par->dirty_lines_start; dirty_lines_end = par->dirty_lines_end;/* set display line markers as clean */ par->dirty_lines_start = par->info->var.yres -1 ; par->dirty_lines_end =0 ; -spin_unlock (&par->dirty_lock); +spin_unlock_irq (&par->dirty_lock);/* Mark display lines as dirty */ list_for_each_entry (pageref, pagereflist, list) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 432/1193 ALSA: hda/core: Use guard() for mutex locks
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 0a930d8732fc076600c4b346a83d9b0a190aeaf0 ]
Replace the manual mutex lock/unlock pairs with guard().
Only code refactoring, and no behavior change.
Stable-dep-of: 32d7226e6105 ("ALSA: hda: restore MFG widget enumeration after core split")
--- sound/hda/ext/hdac_ext_controller.c | 6 ++--- sound/hda/hdac_bus.c | 8 ++----- sound/hda/hdac_component.c | 6 ++--- sound/hda/hdac_device.c | 23 +++++++++---------- sound/hda/hdac_regmap.c | 35 +++++++++-------------------- 5 files changed, 27 insertions(+), 51 deletions(-)
sound/hda/ext/hdac_ext_controller.c +2 -4
@@ -281,7 +281,7 @@ int snd_hdac_ext_bus_link_get(struct hdac_bus *bus,unsigned long codec_mask;int ret =0 ; -mutex_lock (&bus->lock); +guard (mutex)(&bus->lock);/* * if we move from 0 to 1, count will be 1 so power up this link
@@ -312,7 +312,6 @@ int snd_hdac_ext_bus_link_get(struct hdac_bus *bus, bus->codec_mask = codec_mask; } -mutex_unlock (&bus->lock);return ret; }EXPORT_SYMBOL_GPL (snd_hdac_ext_bus_link_get);
@@ -324,7 +323,7 @@ int snd_hdac_ext_bus_link_put(struct hdac_bus *bus,struct hdac_ext_link *hlink_tmp;bool link_up = false; -mutex_lock (&bus->lock); +guard (mutex)(&bus->lock);/* * if we move from 1 to 0, count will be 0
@@ -350,7 +349,6 @@ int snd_hdac_ext_bus_link_put(struct hdac_bus *bus, } } -mutex_unlock (&bus->lock);return ret; }EXPORT_SYMBOL_GPL (snd_hdac_ext_bus_link_put);
sound/hda/hdac_bus.c +2 -6
@@ -87,12 +87,8 @@ EXPORT_SYMBOL_GPL(snd_hdac_bus_exit);int snd_hdac_bus_exec_verb (struct hdac_bus *bus,unsigned int addr,unsigned int cmd,unsigned int *res) { -int err; - -mutex_lock (&bus->cmd_mutex); - err =snd_hdac_bus_exec_verb_unlocked (bus, addr, cmd, res); -mutex_unlock (&bus->cmd_mutex); -return err; +guard (mutex)(&bus->cmd_mutex); +return snd_hdac_bus_exec_verb_unlocked (bus, addr, cmd, res); }/**
sound/hda/hdac_component.c +2 -4
@@ -70,14 +70,14 @@ void snd_hdac_display_power(struct hdac_bus *bus, unsigned int idx, bool enable)dev_dbg (bus->dev,"display power %s\n" , enable ?"enable" :"disable" ); -mutex_lock (&bus->lock); +guard (mutex)(&bus->lock);if (enable)set_bit (idx, &bus->display_power_status);else clear_bit (idx, &bus->display_power_status);if (!acomp || !acomp->ops) - goto unlock; +return ;if (bus->display_power_status) {if (!bus->display_power_active) {
@@ -100,8 +100,6 @@ void snd_hdac_display_power(struct hdac_bus *bus, unsigned int idx, bool enable) bus->display_power_active =0 ; } } - unlock: -mutex_unlock (&bus->lock); }EXPORT_SYMBOL_GPL (snd_hdac_display_power);
sound/hda/hdac_device.c +10 -13
@@ -146,9 +146,9 @@ int snd_hdac_device_register(struct hdac_device *codec) err =device_add (&codec->dev);if (err <0 )return err; -mutex_lock (&codec->widget_lock); - err =hda_widget_sysfs_init (codec); -mutex_unlock (&codec->widget_lock); + scoped_guard(mutex, &codec->widget_lock) { + err =hda_widget_sysfs_init (codec); + }if (err <0 ) {device_del (&codec->dev);return err;
@@ -165,9 +165,9 @@ EXPORT_SYMBOL_GPL(snd_hdac_device_register);void snd_hdac_device_unregister (struct hdac_device *codec) {if (device_is_registered (&codec->dev)) { -mutex_lock (&codec->widget_lock); -hda_widget_sysfs_exit (codec); -mutex_unlock (&codec->widget_lock); + scoped_guard(mutex, &codec->widget_lock) { +hda_widget_sysfs_exit (codec); + }device_del (&codec->dev);snd_hdac_bus_remove_device (codec->bus, codec); }
@@ -410,25 +410,22 @@ int snd_hdac_refresh_widgets(struct hdac_device *codec)* Serialize against multiple threads trying to update the sysfs * widgets array. */ -mutex_lock (&codec->widget_lock); +guard (mutex)(&codec->widget_lock); nums =snd_hdac_get_sub_nodes (codec, codec->afg, &start_nid);if (!start_nid || nums <=0 || nums >=0xff ) {dev_err (&codec->dev,"cannot read sub nodes for FG 0x%02x\n" , codec->afg); - err = -EINVAL ; - goto unlock; +return -EINVAL ; } err =hda_widget_sysfs_reinit (codec, start_nid, nums);if (err <0 ) - goto unlock; +return err; codec->num_nodes = nums; codec->start_nid = start_nid; codec->end_nid = start_nid + nums; -unlock: -mutex_unlock (&codec->widget_lock); -return err; +return 0 ; }EXPORT_SYMBOL_GPL (snd_hdac_refresh_widgets);
sound/hda/hdac_regmap.c +11 -24
@@ -425,15 +425,11 @@ EXPORT_SYMBOL_GPL(snd_hdac_regmap_add_vendor_verb);static int reg_raw_write (struct hdac_device *codec,unsigned int reg,unsigned int val) { -int err; - -mutex_lock (&codec->regmap_lock); +guard (mutex)(&codec->regmap_lock);if (!codec->regmap) - err =hda_reg_write (codec, reg, val); +return hda_reg_write (codec, reg, val);else - err =regmap_write (codec->regmap, reg, val); -mutex_unlock (&codec->regmap_lock); -return err; +return regmap_write (codec->regmap, reg, val); }/* a helper macro to call @func_call; retry with power-up if failed */
@@ -466,15 +462,11 @@ EXPORT_SYMBOL_GPL(snd_hdac_regmap_write_raw);static int reg_raw_read (struct hdac_device *codec,unsigned int reg,unsigned int *val,bool uncached) { -int err; - -mutex_lock (&codec->regmap_lock); +guard (mutex)(&codec->regmap_lock);if (uncached || !codec->regmap) - err =hda_reg_read (codec, reg, val); +return hda_reg_read (codec, reg, val);else - err =regmap_read (codec->regmap, reg, val); -mutex_unlock (&codec->regmap_lock); -return err; +return regmap_read (codec->regmap, reg, val); } static int __snd_hdac_regmap_read_raw(struct hdac_device *codec,
@@ -515,7 +507,7 @@ static int reg_raw_update(struct hdac_device *codec, unsigned int reg,bool change;int err; -mutex_lock (&codec->regmap_lock); +guard (mutex)(&codec->regmap_lock);if (codec->regmap) { err =regmap_update_bits_check (codec->regmap, reg, mask, val, &change);
@@ -533,7 +525,6 @@ static int reg_raw_update(struct hdac_device *codec, unsigned int reg, } } } -mutex_unlock (&codec->regmap_lock);return err; }
@@ -556,17 +547,14 @@ EXPORT_SYMBOL_GPL(snd_hdac_regmap_update_raw);static int reg_raw_update_once (struct hdac_device *codec,unsigned int reg,unsigned int mask,unsigned int val) { -int err =0 ; -if (!codec->regmap)return reg_raw_update (codec, reg, mask, val); -mutex_lock (&codec->regmap_lock); +guard (mutex)(&codec->regmap_lock);/* Discard any updates to already initialised registers. */ if (!regcache_reg_cached (codec->regmap, reg)) - err =regmap_update_bits (codec->regmap, reg, mask, val); -mutex_unlock (&codec->regmap_lock); -return err; +return regmap_update_bits (codec->regmap, reg, mask, val); +return 0 ; }/**
@@ -593,9 +581,8 @@ EXPORT_SYMBOL_GPL(snd_hdac_regmap_update_raw_once);*/ void snd_hdac_regmap_sync (struct hdac_device *codec) { -mutex_lock (&codec->regmap_lock); +guard (mutex)(&codec->regmap_lock);if (codec->regmap)regcache_sync (codec->regmap); -mutex_unlock (&codec->regmap_lock); }EXPORT_SYMBOL_GPL (snd_hdac_regmap_sync);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 433/1193 ALSA: hda: restore MFG widget enumeration after core split
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xu Rao <[email protected]>
[ Upstream commit 32d7226e6105c257ef7b3d0ec819f11a81f53b6d ]
Before commit 7639a06c23c7 ("ALSA: hda - Move a part of hda_codec stuff into hdac_device"), widget enumeration selected the function group with
codec->afg ? codec->afg : codec->mfg
and read subordinate nodes from that group.
The core split moved this logic into snd_hdac_refresh_widgets(), but hard-coded codec->afg there. For an MFG-only codec, codec->afg is zero, so the Root Node is queried and codec->start_nid/num_nodes are populated from the function-group range instead of the MFG's subordinate nodes.
Restore the pre-split AFG-or-MFG selection.
--- sound/hda/hdac_device.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
sound/hda/hdac_device.c +3 -2
@@ -403,6 +403,7 @@ static void setup_fg_nodes(struct hdac_device *codec)*/ int snd_hdac_refresh_widgets (struct hdac_device *codec) { +hda_nid_t fg = codec->afg ? codec->afg : codec->mfg;hda_nid_t start_nid;int nums, err =0 ;
@@ -411,10 +412,10 @@ int snd_hdac_refresh_widgets(struct hdac_device *codec)* widgets array. */ guard (mutex)(&codec->widget_lock); - nums =snd_hdac_get_sub_nodes (codec, codec->afg, &start_nid); + nums =snd_hdac_get_sub_nodes (codec, fg, &start_nid);if (!start_nid || nums <=0 || nums >=0xff ) {dev_err (&codec->dev,"cannot read sub nodes for FG 0x%02x\n" , - codec->afg); + fg);return -EINVAL ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 434/1193 s390/boot: Fix physical memory search range
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasily Gorbik <[email protected]>
[ Upstream commit a0c798ed4103316c23938bdf625af364fbd38016 ]
search_mem_end() calculates the number of 1MB blocks with a signed int literal. CONFIG_MAX_PHYSMEM_BITS values of 51 and above either overflow the signed int or shift beyond its width. This produces an invalid search range when the binary-search memory detection fallback is used.
Use an unsigned long literal so the full supported physical address range is represented.
--- arch/s390/boot/physmem_info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/boot/physmem_info.c +1 -1
@@ -140,7 +140,7 @@ static int tprot(unsigned long addr)static unsigned long search_mem_end (void ) { -unsigned long range =1 << (MAX_PHYSMEM_BITS -20 );/* in 1MB blocks */ +unsigned long range =1UL << (MAX_PHYSMEM_BITS -20 );/* in 1MB blocks */ unsigned long offset =0 ;unsigned long pivot;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 435/1193 ASoC: amd: renoir: fix disable_pdm_interrupts() to clear mask bits
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: wangdicheng <[email protected]>
[ Upstream commit 0c06c4ce0206290c9a934a1e7196aaa86adfe018 ]
disable_pdm_interrupts() uses |= ~PDM_DMA_INTR_MASK which sets all bits except the PDM DMA interrupt bit instead of clearing only the PDM DMA interrupt bit. Use &= ~PDM_DMA_INTR_MASK to clear only the target bit.
--- sound/soc/amd/renoir/acp3x-pdm-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/amd/renoir/acp3x-pdm-dma.c +1 -1
@@ -104,7 +104,7 @@ static void disable_pdm_interrupts(void __iomem *acp_base)u32 ext_int_ctrl; ext_int_ctrl =rn_readl (acp_base +ACP_EXTERNAL_INTR_CNTL ); - ext_int_ctrl |= ~PDM_DMA_INTR_MASK ; + ext_int_ctrl &= ~PDM_DMA_INTR_MASK ;rn_writel (ext_int_ctrl, acp_base +ACP_EXTERNAL_INTR_CNTL ); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 436/1193 ASoC: amd: yc: fix memory leak in acp6x_pdm_dma_close()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: wangdicheng <[email protected]>
[ Upstream commit 1b67e0d3b9691d7b6b74e18960ddd2be24f9dc9d ]
acp6x_pdm_dma_close() does not free the runtime->private_data buffer allocated in acp6x_pdm_dma_open(). Add the missing kfree.
--- sound/soc/amd/yc/acp6x-pdm-dma.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/amd/yc/acp6x-pdm-dma.c +2 -0
@@ -275,9 +275,11 @@ static int acp6x_pdm_dma_close(struct snd_soc_component *component, struct snd_pcm_substream *substream) {struct pdm_dev_data *adata =dev_get_drvdata (component->dev); +struct snd_pcm_runtime *runtime = substream->runtime;acp6x_disable_pdm_interrupts (adata->acp6x_base); adata->capture_stream =NULL ; +kfree (runtime->private_data);return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 437/1193 btrfs: detach failed sprout device from transaction update list
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guanghui Yang <[email protected]>
[ Upstream commit c93b3c43df561cd9f592cee20ae058b563f9e5b6 ]
When creating the first metadata chunk for a sprout filesystem, create_chunk() adds the new device to the transaction dev_update_list through device->post_commit_list.
If the subsequent system chunk creation fails, btrfs_init_new_device() aborts the transaction and releases the device while post_commit_list is still linked. This triggers a warning in btrfs_free_device() and leaves the transaction list referencing freed memory.
Detach the device while holding chunk_mutex before releasing it.
--- fs/btrfs/volumes.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/volumes.c +2 -0
@@ -2865,6 +2865,8 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_pathbtrfs_sysfs_remove_device (device);mutex_lock (&fs_info->fs_devices->device_list_mutex);mutex_lock (&fs_info->chunk_mutex); +if (!list_empty (&device->post_commit_list)) +list_del_init (&device->post_commit_list);list_del_rcu (&device->dev_list);list_del (&device->dev_alloc_list); fs_info->fs_devices->num_devices--;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 438/1193 btrfs: restore active device pointers after failed sprout
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guanghui Yang <[email protected]>
[ Upstream commit e0b54613aabeb8e9da597f23b90c6a03d0981986 ]
btrfs_init_new_device() switches latest_dev and possibly s_bdev from the seed device to the new sprout device before creating the first writable chunks.
If chunk creation or the subsequent sprout setup fails, the error path releases the new device without switching those pointers back. btrfs_show_devname() can then dereference the freed latest_dev and crash.
Restore the active device pointers to the latest seed device before removing and releasing the failed sprout device.
--- fs/btrfs/volumes.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/volumes.c +2 -0
@@ -2864,6 +2864,8 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path error_sysfs:btrfs_sysfs_remove_device (device);mutex_lock (&fs_info->fs_devices->device_list_mutex); +if (seeding_dev) +btrfs_assign_next_active_device (device, seed_devices->latest_dev);mutex_lock (&fs_info->chunk_mutex);if (!list_empty (&device->post_commit_list))list_del_init (&device->post_commit_list);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 421/1193 ASoC: ab8500: Reset the audio block before configuring it
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <[email protected]>
[ Upstream commit 8e839bca7793a0b03c005f4b2b0825464290d425 ]
ResetAudn is active low, but the codec probe only deasserts it. It also clears Clk32kOut2Dis despite claiming to disable that output, and writes codec registers before releasing reset.
Pulse ResetAudn before the first audio-bank access and leave the unused 32 kHz output disabled.
--- sound/soc/codecs/ab8500-codec.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
sound/soc/codecs/ab8500-codec.c +13 -13
@@ -1917,18 +1917,18 @@ enum ab8500_filter {static int ab8500_audio_init_audioblock (struct snd_soc_component *component) {int status; +u8 mask =AB8500_STW4500CTRL3_CLK32KOUT2DIS | +AB8500_STW4500CTRL3_RESETAUDN ;dev_dbg (component->dev,"%s: Enter.\n" , __func__); -/* Reset audio-registers and disable 32kHz-clock output 2 */ - status =ab8500_sysctrl_write (AB8500_STW4500CTRL3 , -AB8500_STW4500CTRL3_CLK32KOUT2DIS | -AB8500_STW4500CTRL3_RESETAUDN , -AB8500_STW4500CTRL3_RESETAUDN ); +/* Reset the audio registers and disable the unused 32 kHz output. */ + status =ab8500_sysctrl_write (AB8500_STW4500CTRL3 , mask, +AB8500_STW4500CTRL3_CLK32KOUT2DIS );if (status <0 )return status; -return 0 ; +return ab8500_sysctrl_write (AB8500_STW4500CTRL3 , mask, mask); } static int ab8500_audio_setup_mics(struct snd_soc_component *component,
@@ -2461,6 +2461,13 @@ static int ab8500_codec_probe(struct snd_soc_component *component)ab8500_codec_of_probe (dev, np, &codec_pdata); + status =ab8500_audio_init_audioblock (component); +if (status <0 ) { +dev_err (dev,"%s: failed to init audio-block (%d)!\n" , + __func__, status); +return status; + } + status =ab8500_audio_setup_mics (component, &codec_pdata.amics);if (status <0 ) {pr_err ("%s: Failed to setup mics (%d)!\n" , __func__, status);
@@ -2473,13 +2480,6 @@ static int ab8500_codec_probe(struct snd_soc_component *component)return status; } - status =ab8500_audio_init_audioblock (component); -if (status <0 ) { -dev_err (dev,"%s: failed to init audio-block (%d)!\n" , - __func__, status); -return status; - } -/* Override HW-defaults */ snd_soc_component_write (component,AB8500_ANACONF5 ,BIT (AB8500_ANACONF5_HSAUTOEN ));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 439/1193 bonding: alb: fix uninitialized transport header access in alb_determine_nd()
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 70f3995830d3f1e79faa14eb0605914f778feca9 ]
alb_determine_nd() uses icmp6_hdr(skb) to inspect ICMPv6 headers. However, in xmit paths (e.g. packets sent via AF_PACKET / raw sockets or forwarded packets), skb->transport_header is not guaranteed to be initialized. While pskb_network_may_pull() ensures the packet data is linear starting from the network header, it does not set or adjust the transport header offset.
Dereferencing icmp6_hdr(skb) can therefore access out-of-bounds memory.
Fetch the icmp6hdr directly after ipv6hdr following pskb_network_may_pull(), and reload ipv6hdr in case pskb_may_pull() reallocated skb->head. Also remove the unused bond argument from alb_determine_nd().
--- drivers/net/bonding/bond_alb.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/net/bonding/bond_alb.c +7 -6
@@ -1282,10 +1282,10 @@ static int alb_set_mac_address(struct bonding *bond, void *addr) }/* determine if the packet is NA or NS */ -static bool alb_determine_nd (struct sk_buff *skb,struct bonding *bond) +static bool alb_determine_nd (struct sk_buff *skb) { -struct ipv6hdr *ip6hdr; -struct icmp6hdr *hdr; +const struct ipv6hdr *ip6hdr; +const struct icmp6hdr *hdr;if (!pskb_network_may_pull (skb,sizeof (*ip6hdr)))return true;
@@ -1297,7 +1297,8 @@ static bool alb_determine_nd(struct sk_buff *skb, struct bonding *bond)if (!pskb_network_may_pull (skb,sizeof (*ip6hdr) +sizeof (*hdr)))return true; - hdr =icmp6_hdr (skb); + ip6hdr =ipv6_hdr (skb); + hdr = (const struct icmp6hdr *)(ip6hdr +1 );return hdr->icmp6_type ==NDISC_NEIGHBOUR_ADVERTISEMENT || hdr->icmp6_type ==NDISC_NEIGHBOUR_SOLICITATION ; }
@@ -1382,7 +1383,7 @@ struct slave *bond_xmit_tlb_slave_get(struct bonding *bond,if (!is_multicast_ether_addr (eth_data->h_dest)) {switch (skb->protocol) {case htons (ETH_P_IPV6 ): -if (alb_determine_nd (skb, bond)) +if (alb_determine_nd (skb))break ; fallthrough;case htons (ETH_P_IP ):
@@ -1468,7 +1469,7 @@ struct slave *bond_xmit_alb_slave_get(struct bonding *bond,break ; } -if (alb_determine_nd (skb, bond)) { +if (alb_determine_nd (skb)) { do_tx_balance = false;break ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 440/1193 scsi: mpt3sas: Avoid out-of-bounds cpumask_of_node() call in _base_assign_reply_queues()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivy Lopez <[email protected]>
[ Upstream commit e0d26fe176a8db6ccad4ab38c5bab29391c1946b ]
dev_to_node() can return NUMA_NO_NODE (-1) on systems without NUMA topology information for the PCI device, such as single-socket boards that don't expose device-to-node affinity. Passing -1 directly into cpumask_of_node() indexes node_to_cpumask_map[-1], an out-of-bounds array read caught by UBSAN:
UBSAN: array-index-out-of-bounds in arch/x86/include/asm/topology.h:72:28 index -1 is out of range for type 'cpumask *[1024]'
Fall back to cpu_online_mask when no NUMA node is available, rather than assuming dev_to_node() always returns a valid node index.
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +4 -1
@@ -3227,7 +3227,10 @@ _base_assign_reply_queues(struct MPT3SAS_ADAPTER *ioc)* corresponding to high iops queues. */ if (ioc->high_iops_queues) { - mask =cpumask_of_node (dev_to_node (&ioc->pdev->dev)); +int node =dev_to_node (&ioc->pdev->dev); + + mask = (node ==NUMA_NO_NODE ) ? + cpu_online_mask :cpumask_of_node (node);for (index =0 ; index < ioc->high_iops_queues; index++) { irq =pci_irq_vector (ioc->pdev, index);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 441/1193 perf/core: Skip empty AUX records with only format flags
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Yan <[email protected]>
[ Upstream commit 8a7f5b5e860b5c113ca99acd5b1e9074f5c5af3c ]
perf_aux_output_end() emits a PERF_RECORD_AUX when the recorded size is nonzero or when any flag other than PERF_AUX_FLAG_OVERWRITE is set.
PMU format flags describe how an AUX payload is encoded. TRBE driver sets PERF_AUX_FLAG_CORESIGHT_FORMAT_RAW for raw trace buffers, causing an AUX record to be emitted even when no trace data.
This is noticeable when tracing a task with strace. Ptrace stops repeatedly end empty AUX transactions, producing many zero-sized PERF_RECORD_AUX records. For example:
perf record -e cs_etm//u -m,128M -- strace ls
perf script -D 2>&1 |
awk '/PERF_RECORD_AUX offset/ {
for (i = 1; i <= NF; i++)
if ($i == "size:" && $(i + 1) == "0")
count++
}
END { print count }'
165This recording contains 165 zero-sized AUX records which provide no useful information to userspace.
Ignore PERF_AUX_FLAG_PMU_FORMAT_TYPE_MASK, together with PERF_AUX_FLAG_OVERWRITE, when deciding whether an empty AUX record is useful. Zero-sized records carrying TRUNCATED, PARTIAL or COLLISION are still emitted.
--- kernel/events/ring_buffer.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
kernel/events/ring_buffer.c +7 -2
@@ -503,7 +503,10 @@ void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size)/* * Only send RECORD_AUX if we have something useful to communicate * -* Note: the OVERWRITE records by themselves are not considered +* PMU_FORMAT bits identify the PMU type rather than an AUX event +* has occurred, so ignore them for zero-sized records. +* +* The OVERWRITE records by themselves are not considered * useful, as they don't communicate any *new* information, * aside from the short-lived offset, that becomes history at * the next event sched-in and therefore isn't useful.
@@ -512,7 +515,9 @@ void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size)* offset. So, from now on we don't output AUX records that * have *only* OVERWRITE flag set. */ -if (size || (handle->aux_flags & ~(u64 )PERF_AUX_FLAG_OVERWRITE )) +if (size || + (handle->aux_flags & ~(u64)(PERF_AUX_FLAG_PMU_FORMAT_TYPE_MASK | +PERF_AUX_FLAG_OVERWRITE )))perf_event_aux_event (handle->event, aux_head, size, handle->aux_flags);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 442/1193 locking/lockdep: Invalidate stale class_cache entries for zapped classes
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 02c6be7d675b21d81f0ba3a524346850a8c0e3bf ]
syzbot reported a lockdep splat hitting DEBUG_LOCKS_WARN_ON(1) in hlock_class() due to an invalid class_idx:
WARNING: kernel/locking/lockdep.c:238 at __lock_acquire+0x382/0x2cf0 kernel/locking/lockdep.c:5203 Workqueue: wg-crypt-wg0 wg_packet_tx_worker RIP: 0010:hlock_class kernel/locking/lockdep.c:238 [inline] RIP: 0010:check_wait_context kernel/locking/lockdep.c:4870 [inline] RIP: 0010:__lock_acquire+0x389/0x2cf0 kernel/locking/lockdep.c:5203 Call Trace: <IRQ> lock_acquire+0x106/0x350 kernel/locking/lockdep.c:5886 _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:173 tcp_tsq_handler+0x29/0x200 net/ipv4/tcp_output.c:1291 tcp_tsq_workfn+0x384/0x410 net/ipv4/tcp_output.c:1325 ...
When a lock class is zapped (e.g. during module unload or key unregistration), zap_class() clears the class's bit in lock_classes_in_use and removes it from the class hash table. However, existing lockdep_map instances embedded in data structures may still retain a pointer to the zapped class in their class_cache[] array.
When __lock_acquire() subsequently runs on such a lock, it finds lock->class_cache[subclass] != NULL, skipping register_lock_class() and assigning hlock->class_idx to the index of the zapped class. When check_wait_context() or hlock_class() inspects the held_lock, it finds !test_bit(class_idx, lock_classes_in_use) and warns. Furthermore, if the zapped slot is subsequently re-allocated to an unrelated lock key, the stale class_cache entry would erroneously match the unrelated class (ABA issue).
Add lock_class_cache_is_valid() to validate that the cached class is within lock_classes bounds, still allocated in lock_classes_in_use (using uninstrumented arch_test_bit() in __always_inline context so it is safe in noinstr contexts like match_held_lock()), and that class->key matches the expected subkey (taking lockdep_set_subclass() overrides into account). Also use READ_ONCE()/WRITE_ONCE() when accessing class_cache[]. If the entry is invalid or stale, fall back to register_lock_class() / look_up_lock_class().
--- kernel/locking/lockdep.c | 50 +++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 8 deletions(-)
kernel/locking/lockdep.c +42 -8
@@ -940,6 +940,34 @@ look_up_lock_class(const struct lockdep_map *lock, unsigned int subclass)return NULL ; } +static __always_inline bool lock_class_cache_is_valid(const struct lockdep_map *lock, +const struct lock_class *class, +unsigned int subclass) +{ +unsigned int class_subclass; + +if (!class) +return false; + +if (unlikely (class < lock_classes || class >= lock_classes +MAX_LOCKDEP_KEYS )) +return false; + +if (unlikely (!arch_test_bit (class - lock_classes, lock_classes_in_use))) +return false; + +if (unlikely (!lock->key)) +return false; + + class_subclass = subclass ? subclass : class->subclass; +if (unlikely (class_subclass >=MAX_LOCKDEP_SUBCLASSES )) +return false; + +if (unlikely (READ_ONCE (class->key) != lock->key->subkeys + class_subclass)) +return false; + +return true; +} +/* * Static locks do not have their class-keys yet - for them the key is * the lock object itself. If the lock is in the per cpu area, the
@@ -1365,9 +1393,9 @@ register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force) out_set_class_cache:if (!subclass || force) - lock->class_cache[0 ] = class; +WRITE_ONCE (lock->class_cache[0 ], class);else if (subclass <NR_LOCKDEP_CACHING_CLASSES ) - lock->class_cache[subclass] = class; +WRITE_ONCE (lock->class_cache[subclass], class);/* * Hash collision, did we smoke some? We found a class with a matching
@@ -4860,7 +4888,7 @@ void lockdep_init_map_type(struct lockdep_map *lock, const char *name,int i;for (i =0 ; i <NR_LOCKDEP_CACHING_CLASSES ; i++) - lock->class_cache[i] =NULL ; +WRITE_ONCE (lock->class_cache[i],NULL );#ifdef CONFIG_LOCK_STAT lock->cpu =raw_smp_processor_id ();
@@ -4922,12 +4950,15 @@ EXPORT_SYMBOL_GPL(__lockdep_no_validate__);void lockdep_set_lock_cmp_fn (struct lockdep_map *lock,lock_cmp_fn cmp_fn,lock_print_fn print_fn) { -struct lock_class *class = lock->class_cache[0 ]; +struct lock_class *class =READ_ONCE (lock->class_cache[0 ]);unsigned long flags;raw_local_irq_save (flags);lockdep_recursion_inc (); +if (!lock_class_cache_is_valid (lock, class,0 )) + class =NULL ; +if (!class) class =register_lock_class (lock,0 ,0 );
@@ -5005,8 +5036,11 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,if (!prove_locking || lock->key == &__lockdep_no_validate__) check =0 ; -if (subclass <NR_LOCKDEP_CACHING_CLASSES ) - class = lock->class_cache[subclass]; +if (subclass <NR_LOCKDEP_CACHING_CLASSES ) { + class =READ_ONCE (lock->class_cache[subclass]); +if (!lock_class_cache_is_valid (lock, class, subclass)) + class =NULL ; + }/* * Not cached? */
@@ -5201,9 +5235,9 @@ static noinstr int match_held_lock(const struct held_lock *hlock,return 1 ;if (hlock->references) { -const struct lock_class *class = lock->class_cache[0 ]; +const struct lock_class *class =READ_ONCE (lock->class_cache[0 ]); -if (!class) +if (!lock_class_cache_is_valid (lock, class,0 )) class =look_up_lock_class (lock,0 );/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 443/1193 ALSA: rawmidi: Expose the tied device number in info ioctl
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit bdf46443f350dd5d226fd528a5a5954ff762f591 ]
The UMP legacy rawmidi is derived from the UMP rawmidi, but currently there is no way to know which device is involved in other side.
This patch extends the rawmidi info ioctl to show the tied device number. As default it stores -1, indicating that no tied device.
Stable-dep-of: adeee7187694 ("ALSA: ump: do not touch legacy_rmidi before it exists")
--- Documentation/sound/designs/midi-2.0.rst | 5 +++++ include/sound/rawmidi.h | 1 + include/uapi/sound/asound.h | 5 ++++- sound/core/rawmidi.c | 2 ++ sound/core/ump.c | 3 +++ 5 files changed, 15 insertions(+), 1 deletion(-)
Documentation/sound/designs/midi-2.0.rst +5 -0
@@ -293,6 +293,11 @@ Rawmidi API Extensions status 0x05). When UMP core receives such a message, it updates the UMP EP info and the corresponding sequencer clients as well. +* The legacy rawmidi device number is found in the new `tied_device` + field of the rawmidi info. + On the other hand, the UMP rawmidi device number is found in + `tied_device` field of the legacy rawmidi info, too. + Control API Extensions ======================
include/sound/rawmidi.h +1 -0
@@ -118,6 +118,7 @@ struct snd_rawmidi {struct list_head list;unsigned int device;/* device number */ unsigned int info_flags;/* SNDRV_RAWMIDI_INFO_XXXX */ +unsigned int tied_device;char id[64 ];char name[80 ];
include/uapi/sound/asound.h +4 -1
@@ -725,6 +725,8 @@ enum {#define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004#define SNDRV_RAWMIDI_INFO_UMP 0x00000008 +#define SNDRV_RAWMIDI_DEVICE_UNKNOWN -1 +struct snd_rawmidi_info {unsigned int device;/* RO/WR (control): device number */ unsigned int subdevice;/* RO/WR (control): subdevice number */
@@ -736,7 +738,8 @@ struct snd_rawmidi_info {unsigned char subname[32 ];/* name of active or selected subdevice */ unsigned int subdevices_count;unsigned int subdevices_avail; -unsigned char reserved[64 ];/* reserved for future use */ +int tied_device;/* R: tied rawmidi device (UMP/legacy) */ +unsigned char reserved[60 ];/* reserved for future use */ };#define SNDRV_RAWMIDI_MODE_FRAMING_MASK (7<<0)
sound/core/rawmidi.c +2 -0
@@ -651,6 +651,7 @@ static int snd_rawmidi_info(struct snd_rawmidi_substream *substream, info->subdevices_count = substream->pstr->substream_count; info->subdevices_avail = (substream->pstr->substream_count - substream->pstr->substream_opened); + info->tied_device = rmidi->tied_device;return 0 ; }
@@ -1897,6 +1898,7 @@ int snd_rawmidi_init(struct snd_rawmidi *rmidi,INIT_LIST_HEAD (&rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT ].substreams);INIT_LIST_HEAD (&rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT ].substreams); rmidi->info_flags = info_flags; + rmidi->tied_device =SNDRV_RAWMIDI_DEVICE_UNKNOWN ;if (id !=NULL )strscpy (rmidi->id, id,sizeof (rmidi->id));
sound/core/ump.c +3 -0
@@ -1304,6 +1304,9 @@ int snd_ump_attach_legacy_rawmidi(struct snd_ump_endpoint *ump, ump->legacy_rmidi = rmidi;update_legacy_names (ump); + rmidi->tied_device = ump->core.device; + ump->core.tied_device = rmidi->device; +ump_dbg (ump,"Created a legacy rawmidi #%d (%s)\n" , device, id);return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 444/1193 ALSA: rawmidi: Show substream activity in info ioctl
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit b8fefed73a952a33521ad416fb39683abd87454b ]
The UMP legacy rawmidi may turn on/off the substream dynamically depending on the UMP Function Block information. So far, there was no direct way to know whether the substream is disabled (inactive) or not; at most one can take a look at the substream name string or try to open and get -ENODEV.
This patch extends the rawmidi info ioctl to show the current inactive state of the given substream. When the selected substream is inactive, info flags field contains the new bit flag SNDRV_RAWMIDI_INFO_STREAM_INACTIVE.
Stable-dep-of: adeee7187694 ("ALSA: ump: do not touch legacy_rmidi before it exists")
--- Documentation/sound/designs/midi-2.0.rst | 6 ++++++ include/sound/rawmidi.h | 1 + include/uapi/sound/asound.h | 1 + sound/core/rawmidi.c | 2 ++ sound/core/ump.c | 9 +++++---- 5 files changed, 15 insertions(+), 4 deletions(-)
Documentation/sound/designs/midi-2.0.rst +6 -0
@@ -298,6 +298,12 @@ Rawmidi API Extensions On the other hand, the UMP rawmidi device number is found in `tied_device` field of the legacy rawmidi info, too. +* Each substream of the legacy rawmidi may be enabled / disabled + dynamically depending on the UMP FB state. + When the selected substream is inactive, it's indicated by the bit + 0x10 (`SNDRV_RAWMIDI_INFO_STREAM_INACTIVE`) in the `flags` field of + the legacy rawmidi info. + Control API Extensions ======================
include/sound/rawmidi.h +1 -0
@@ -89,6 +89,7 @@ struct snd_rawmidi_substream {unsigned int framing;/* whether to frame input data */ unsigned int clock_type;/* clock source to use for input framing */ int use_count;/* use counter (for output) */ +bool inactive;/* inactive substream (for UMP legacy) */ size_t bytes;spinlock_t lock;struct snd_rawmidi *rmidi;
include/uapi/sound/asound.h +1 -0
@@ -724,6 +724,7 @@ enum {#define SNDRV_RAWMIDI_INFO_INPUT 0x00000002#define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004#define SNDRV_RAWMIDI_INFO_UMP 0x00000008 +#define SNDRV_RAWMIDI_INFO_STREAM_INACTIVE 0x00000010#define SNDRV_RAWMIDI_DEVICE_UNKNOWN -1
sound/core/rawmidi.c +2 -0
@@ -645,6 +645,8 @@ static int snd_rawmidi_info(struct snd_rawmidi_substream *substream, info->subdevice = substream->number; info->stream = substream->stream; info->flags = rmidi->info_flags; +if (substream->inactive) + info->flags |=SNDRV_RAWMIDI_INFO_STREAM_INACTIVE ;strcpy (info->id, rmidi->id);strcpy (info->name, rmidi->name);strcpy (info->subname, substream->name);
sound/core/ump.c +5 -4
@@ -1239,8 +1239,8 @@ static int fill_legacy_mapping(struct snd_ump_endpoint *ump)return num; } -static void fill_substream_names (struct snd_ump_endpoint *ump, -struct snd_rawmidi *rmidi,int dir) +static void update_legacy_substreams (struct snd_ump_endpoint *ump, +struct snd_rawmidi *rmidi,int dir) {struct snd_rawmidi_substream *s;const char *name;
@@ -1254,6 +1254,7 @@ static void fill_substream_names(struct snd_ump_endpoint *ump,scnprintf (s->name,sizeof (s->name),"Group %d (%.16s)%s" , idx +1 , name, ump->groups[idx].active ?"" :" [Inactive]" ); + s->inactive = !ump->groups[idx].active; } }
@@ -1261,8 +1262,8 @@ static void update_legacy_names(struct snd_ump_endpoint *ump) {struct snd_rawmidi *rmidi = ump->legacy_rmidi; -fill_substream_names (ump, rmidi,SNDRV_RAWMIDI_STREAM_INPUT ); -fill_substream_names (ump, rmidi,SNDRV_RAWMIDI_STREAM_OUTPUT ); +update_legacy_substreams (ump, rmidi,SNDRV_RAWMIDI_STREAM_INPUT ); +update_legacy_substreams (ump, rmidi,SNDRV_RAWMIDI_STREAM_OUTPUT ); } int snd_ump_attach_legacy_rawmidi(struct snd_ump_endpoint *ump,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 445/1193 ALSA: ump: Copy FB name string more safely
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit e3f035edadcc1c5901311c03d098bc3dedc5c525 ]
The UMP group names are referred as the corresponding sequencer port names, hence they should be proper ASCII strings. OTOH, the UMP group names are composed from the UMP FB strings that are received from the device; i.e. a device may give some bogus letters and we can't trust them fully.
To assure that the group names consist of the proper ASCII strings, replace the normal string copy and append operations with special ones that strip the non-printable letters.
Stable-dep-of: adeee7187694 ("ALSA: ump: do not touch legacy_rmidi before it exists")
--- sound/core/ump.c | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-)
sound/core/ump.c +31 -9
@@ -53,6 +53,34 @@ static inline void update_legacy_names(struct snd_ump_endpoint *ump) }#endif +/* copy a string safely with stripping non-printable letters */ +static void safe_copy_string (void *dst,size_t max_dst_size, +const void *src,size_t max_src_size) +{ +const unsigned char *s = src; +unsigned char *d = dst; + +if (!max_dst_size--) +return ; +for (s = src; max_dst_size && *s && max_src_size--; s++) { +if (!isascii (*s) || !isprint (*s)) +continue ; + *d++ = *s; + max_dst_size--; + } + *d =0 ; +} + +/* append a string safely with stripping non-printable letters */ +static void safe_append_string (void *dst,size_t max_dst_size, +const void *src,size_t max_src_size) +{ +unsigned char *d = dst; +size_t len =strlen (d); + +safe_copy_string (d + len, max_dst_size - len, src, max_src_size); +} +static const struct snd_rawmidi_global_ops snd_ump_rawmidi_ops = { .dev_register = snd_ump_dev_register, .dev_unregister = snd_ump_dev_unregister,
@@ -566,16 +594,10 @@ void snd_ump_update_group_attrs(struct snd_ump_endpoint *ump) }if (!*fb->info.name)continue ; -if (!*group->name) { -/* store the first matching name */ -strscpy (group->name, fb->info.name, -sizeof (group->name)); - }else { -/* when overlapping, concat names */ +if (*group->name)strlcat (group->name,", " ,sizeof (group->name)); -strlcat (group->name, fb->info.name, -sizeof (group->name)); - } +safe_append_string (group->name,sizeof (group->name), + fb->info.name,sizeof (fb->info.name)); } } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 446/1193 ALSA: ump: Copy safe string name to rawmidi
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 85e8d66f30f967cda91b3ee6dfcb0a0c2391e612 ]
The UMP helper didn't set up the rawmidi name string by itself but left it to the driver. But since the only user (USB MIDI2 driver) picks up the UMP info name string to the rawmidi name as default, it's better to set up in the UMP core side.
Meanwhile, UMP receives the EP name string from the device, and it might contain garbage letters. We should purify the string to be usable for the kernel as done previously for UMP Group names.
This implements the copy of the UMP info name string into the rawmidi name at the creation of UMP EP object in a safe way to strip the non-ASCII or non-printable characters. Also, change the reference from the legacy rawmidi and other places to rawmidi name field instead of ump info; this assures the sane strings.
Stable-dep-of: adeee7187694 ("ALSA: ump: do not touch legacy_rmidi before it exists")
--- sound/core/ump.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
sound/core/ump.c +11 -2
@@ -729,6 +729,13 @@ static int ump_handle_device_info_msg(struct snd_ump_endpoint *ump,return 1 ;/* finished */ } +/* set up the core rawmidi name from UMP EP name string */ +static void ump_set_rawmidi_name (struct snd_ump_endpoint *ump) +{ +safe_copy_string (ump->core.name,sizeof (ump->core.name), + ump->info.name,sizeof (ump->info.name)); +} +/* handle EP name stream message; update the UMP name string */ static int ump_handle_ep_name_msg (struct snd_ump_endpoint *ump,const union snd_ump_stream_msg *buf)
@@ -1056,6 +1063,8 @@ int snd_ump_parse_endpoint(struct snd_ump_endpoint *ump)if (err <0 )ump_dbg (ump,"Unable to get UMP EP name string\n" ); +ump_set_rawmidi_name (ump); +/* Request Endpoint Product ID */ err =ump_req_msg (ump, msg,UMP_STREAM_MSG_REQUEST_PRODUCT_ID ,UMP_STREAM_MSG_STATUS_PRODUCT_ID );
@@ -1272,7 +1281,7 @@ static void update_legacy_substreams(struct snd_ump_endpoint *ump, idx = ump->legacy_mapping[s->number]; name = ump->groups[idx].name;if (!*name) - name = ump->info.name; + name = ump->core.name;scnprintf (s->name,sizeof (s->name),"Group %d (%.16s)%s" , idx +1 , name, ump->groups[idx].active ?"" :" [Inactive]" );
@@ -1320,7 +1329,7 @@ int snd_ump_attach_legacy_rawmidi(struct snd_ump_endpoint *ump,snd_rawmidi_set_ops (rmidi,SNDRV_RAWMIDI_STREAM_OUTPUT , &snd_ump_legacy_output_ops);snprintf (rmidi->name,sizeof (rmidi->name),"%.68s (MIDI 1.0)" , - ump->info.name); + ump->core.name); rmidi->info_flags = ump->core.info_flags & ~SNDRV_RAWMIDI_INFO_UMP ; rmidi->ops = &snd_ump_legacy_ops; rmidi->private_data = ump;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 447/1193 ALSA: ump: Update rawmidi name per EP name update
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit aca565359596c5998cab1cc72f61aa83b3ccd152 ]
The rawmidi name string should be updated dynamically when the device receives the UMP EP name update, too. Both the core and legacy rawmidi names are updated.
Stable-dep-of: adeee7187694 ("ALSA: ump: do not touch legacy_rmidi before it exists")
--- sound/core/ump.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-)
sound/core/ump.c +23 -4
@@ -37,6 +37,7 @@ static int process_legacy_output(struct snd_ump_endpoint *ump, u32 *buffer, int count);static void process_legacy_input (struct snd_ump_endpoint *ump,const u32 *src,int words); +static void ump_legacy_set_rawmidi_name (struct snd_ump_endpoint *ump);static void update_legacy_names (struct snd_ump_endpoint *ump);#else static inline int process_legacy_output(struct snd_ump_endpoint *ump,
@@ -48,6 +49,9 @@ static inline void process_legacy_input(struct snd_ump_endpoint *ump, const u32 *src, int words) { } +static inline void ump_legacy_set_rawmidi_name (struct snd_ump_endpoint *ump) +{ +}static inline void update_legacy_names (struct snd_ump_endpoint *ump) { }
@@ -740,8 +744,16 @@ static void ump_set_rawmidi_name(struct snd_ump_endpoint *ump)static int ump_handle_ep_name_msg (struct snd_ump_endpoint *ump,const union snd_ump_stream_msg *buf) { -return ump_append_string (ump, ump->info.name,sizeof (ump->info.name), - buf->raw,2 ); +int ret; + + ret =ump_append_string (ump, ump->info.name,sizeof (ump->info.name), + buf->raw,2 ); +if (ret && ump->parsed) { +ump_set_rawmidi_name (ump); +ump_legacy_set_rawmidi_name (ump); + } + +return ret; }/* handle EP product id stream message; update the UMP product_id string */
@@ -1297,6 +1309,14 @@ static void update_legacy_names(struct snd_ump_endpoint *ump)update_legacy_substreams (ump, rmidi,SNDRV_RAWMIDI_STREAM_OUTPUT ); } +static void ump_legacy_set_rawmidi_name (struct snd_ump_endpoint *ump) +{ +struct snd_rawmidi *rmidi = ump->legacy_rmidi; + +snprintf (rmidi->name,sizeof (rmidi->name),"%.68s (MIDI 1.0)" , + ump->core.name); +} +int snd_ump_attach_legacy_rawmidi (struct snd_ump_endpoint *ump,char *id,int device) {
@@ -1328,12 +1348,11 @@ int snd_ump_attach_legacy_rawmidi(struct snd_ump_endpoint *ump,if (output)snd_rawmidi_set_ops (rmidi,SNDRV_RAWMIDI_STREAM_OUTPUT , &snd_ump_legacy_output_ops); -snprintf (rmidi->name,sizeof (rmidi->name),"%.68s (MIDI 1.0)" , - ump->core.name); rmidi->info_flags = ump->core.info_flags & ~SNDRV_RAWMIDI_INFO_UMP ; rmidi->ops = &snd_ump_legacy_ops; rmidi->private_data = ump; ump->legacy_rmidi = rmidi; +ump_legacy_set_rawmidi_name (ump);update_legacy_names (ump); rmidi->tied_device = ump->core.device;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 448/1193 ALSA: ump: do not touch legacy_rmidi before it exists
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qingyu Zhang <[email protected]>
[ Upstream commit adeee7187694719890aaffdc14b7e89cfd736f1d ]
snd_ump_parse_endpoint() sets ump->parsed on every exit, including error, before the caller attaches the legacy rawmidi device. ump_handle_ep_name_msg() then treats parsed as "legacy_rmidi is live" and calls ump_legacy_set_rawmidi_name(), which snprintf()s into ump->legacy_rmidi->name. If a UMP packet arrives in that window (IRQ path from snd_ump_receive), legacy_rmidi is still NULL (KASAN null-ptr-deref in snprintf).
Guard the legacy helpers. parsed only means endpoint info was parsed, not that legacy_rmidi exists.
--- sound/core/ump.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/core/ump.c +4 -0
@@ -1305,6 +1305,8 @@ static void update_legacy_names(struct snd_ump_endpoint *ump) {struct snd_rawmidi *rmidi = ump->legacy_rmidi; +if (!rmidi) +return ;update_legacy_substreams (ump, rmidi,SNDRV_RAWMIDI_STREAM_INPUT );update_legacy_substreams (ump, rmidi,SNDRV_RAWMIDI_STREAM_OUTPUT ); }
@@ -1313,6 +1315,8 @@ static void ump_legacy_set_rawmidi_name(struct snd_ump_endpoint *ump) {struct snd_rawmidi *rmidi = ump->legacy_rmidi; +if (!rmidi) +return ;snprintf (rmidi->name,sizeof (rmidi->name),"%.68s (MIDI 1.0)" , ump->core.name); }
Signature · 1 line
2.53.0