6.6.19-rc1 review
Subsystems (12)
Greg Kroah-Hartman
maintainerPATCH 136/299 LoongArch: Call early_init_fdt_scan_reserved_mem() earlier
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit 9fa304b9f8ec440e614af6d35826110c633c4074 upstream.
The unflatten_and_copy_device_tree() function contains a call to memblock_alloc(). This means that memblock is allocating memory before any of the reserved memory regions are set aside in the arch_mem_init() function which calls early_init_fdt_scan_reserved_mem(). Therefore, there is a possibility for memblock to allocate from any of the reserved memory regions.
Hence, move the call to early_init_fdt_scan_reserved_mem() to be earlier in the init sequence, so that the reserved memory regions are set aside before any allocations are done using memblock.
--- arch/loongarch/kernel/setup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/loongarch/kernel/setup.c +2 -2
@@ -367,6 +367,8 @@ void __init platform_init(void) acpi_gbl_use_default_register_widths = false;acpi_boot_table_init ();#endif + +early_init_fdt_scan_reserved_mem ();unflatten_and_copy_device_tree ();#ifdef CONFIG_NUMA
@@ -400,8 +402,6 @@ static void __init arch_mem_init(char **check_kernel_sections_mem (); -early_init_fdt_scan_reserved_mem (); -/* * In order to reduce the possibility of kernel panic when failed to * get IO TLB memory under CONFIG_SWIOTLB, it is better to allocate
Greg Kroah-Hartman
maintainerPATCH 137/299 LoongArch: Disable IRQ before init_fn() for nonboot CPUs
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit 1001db6c42e4012b55e5ee19405490f23e033b5a upstream.
Disable IRQ before init_fn() for nonboot CPUs when hotplug, in order to silence such warnings (and also avoid potential errors due to unexpected interrupts):
WARNING: CPU: 1 PID: 0 at kernel/rcu/tree.c:4503 rcu_cpu_starting+0x214/0x280 CPU: 1 PID: 0 Comm: swapper/1 Not tainted 6.6.17+ #1198
pc 90000000048e3334 ra 90000000047bd56c tp 900000010039c000 sp 900000010039fdd0 a0 0000000000000001 a1 0000000000000006 a2 900000000802c040 a3 0000000000000000 a4 0000000000000001 a5 0000000000000004 a6 0000000000000000 a7 90000000048e3f4c t0 0000000000000001 t1 9000000005c70968 t2 0000000004000000 t3 000000000005e56e t4 00000000000002e4 t5 0000000000001000 t6 ffffffff80000000 t7 0000000000040000 t8 9000000007931638 u0 0000000000000006 s9 0000000000000004 s0 0000000000000001 s1 9000000006356ac0 s2 9000000007244000 s3 0000000000000001 s4 0000000000000001 s5 900000000636f000 s6 7fffffffffffffff s7 9000000002123940 s8 9000000001ca55f8
ra: 90000000047bd56c tlb_init+0x24c/0x528
ERA: 90000000048e3334 rcu_cpu_starting+0x214/0x280
CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE)
PRMD: 00000000 (PPLV0 -PIE -PWE)
EUEN: 00000000 (-FPE -SXE -ASXE -BTE)
ECFG: 00071000 (LIE=12 VS=7)
ESTAT: 000c0000 [BRK] (IS= ECode=12 EsubCode=0)
PRID: 0014c010 (Loongson-64bit, Loongson-3A5000)
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 6.6.17+ #1198
Stack : 0000000000000000 9000000006375000 9000000005b61878 900000010039c000
900000010039fa30 0000000000000000 900000010039fa38 900000000619a140
9000000006456888 9000000006456880 900000010039f950 0000000000000001
0000000000000001 cb0cb028ec7e52e1 0000000002b90000 9000000100348700
0000000000000000 0000000000000001 ffffffff916d12f1 0000000000000003
0000000000040000 9000000007930370 0000000002b90000 0000000000000004
9000000006366000 900000000619a140 0000000000000000 0000000000000004
0000000000000000 0000000000000009 ffffffffffc681f2 9000000002123940
9000000001ca55f8 9000000006366000 90000000047a4828 00007ffff057ded8
00000000000000b0 0000000000000000 0000000000000000 0000000000071000
...
Call Trace:
[<90000000047a4828>] show_stack+0x48/0x1a0
[<9000000005b61874>] dump_stack_lvl+0x84/0xcc
[<90000000047f60ac>] __warn+0x8c/0x1e0
[<9000000005b0ab34>] report_bug+0x1b4/0x280
[<9000000005b63110>] do_bp+0x2d0/0x480
[<90000000047a2e20>] handle_bp+0x120/0x1c0
[<90000000048e3334>] rcu_cpu_starting+0x214/0x280
[<90000000047bd568>] tlb_init+0x248/0x528
[<90000000047a4c44>] per_cpu_trap_init+0x124/0x160
[<90000000047a19f4>] cpu_probe+0x494/0xa00
[<90000000047b551c>] start_secondary+0x3c/0xc0
[<9000000005b66134>] smpboot_entry+0x50/0x58--- arch/loongarch/kernel/smp.c | 1 + 1 file changed, 1 insertion(+)
arch/loongarch/kernel/smp.c +1 -0
@@ -334,6 +334,7 @@ void __noreturn arch_cpu_idle_dead(void) addr =iocsr_read64 (LOONGARCH_IOCSR_MBUF0 ); }while (addr ==0 ); +local_irq_disable (); init_fn = (void *)TO_CACHE (addr);iocsr_write32 (0xffffffff ,LOONGARCH_IOCSR_IPI_CLEAR );
Greg Kroah-Hartman
maintainerPATCH 138/299 LoongArch: Update cpu_sibling_map when disabling nonboot CPUs
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit 752cd08da320a667a833803a8fd6bb266114cce5 upstream.
Update cpu_sibling_map when disabling nonboot CPUs by defining & calling clear_cpu_sibling_map(), otherwise we get such errors on SMT systems:
jump label: negative count!
WARNING: CPU: 6 PID: 45 at kernel/jump_label.c:263 __static_key_slow_dec_cpuslocked+0xec/0x100 CPU: 6 PID: 45 Comm: cpuhp/6 Not tainted 6.8.0-rc5+ #1340
pc 90000000004c302c ra 90000000004c302c tp 90000001005bc000 sp 90000001005bfd20 a0 000000000000001b a1 900000000224c278 a2 90000001005bfb58 a3 900000000224c280 a4 900000000224c278 a5 90000001005bfb50 a6 0000000000000001 a7 0000000000000001 t0 ce87a4763eb5234a t1 ce87a4763eb5234a t2 0000000000000000 t3 0000000000000000 t4 0000000000000006 t5 0000000000000000 t6 0000000000000064 t7 0000000000001964 t8 000000000009ebf6 u0 9000000001f2a068 s9 0000000000000000 s0 900000000246a2d8 s1 ffffffffffffffff s2 ffffffffffffffff s3 90000000021518c0 s4 0000000000000040 s5 9000000002151058 s6 9000000009828e40 s7 00000000000000b4 s8 0000000000000006
ra: 90000000004c302c __static_key_slow_dec_cpuslocked+0xec/0x100
ERA: 90000000004c302c __static_key_slow_dec_cpuslocked+0xec/0x100
CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE)
PRMD: 00000004 (PPLV0 +PIE -PWE)
EUEN: 00000000 (-FPE -SXE -ASXE -BTE)
ECFG: 00071c1c (LIE=2-4,10-12 VS=7)
ESTAT: 000c0000 [BRK] (IS= ECode=12 EsubCode=0)
PRID: 0014d000 (Loongson-64bit, Loongson-3A6000-HV)
CPU: 6 PID: 45 Comm: cpuhp/6 Not tainted 6.8.0-rc5+ #1340
Stack : 0000000000000000 900000000203f258 900000000179afc8 90000001005bc000
90000001005bf980 0000000000000000 90000001005bf988 9000000001fe0be0
900000000224c280 900000000224c278 90000001005bf8c0 0000000000000001
0000000000000001 ce87a4763eb5234a 0000000007f38000 90000001003f8cc0
0000000000000000 0000000000000006 0000000000000000 4c206e6f73676e6f
6f4c203a656d616e 000000000009ec99 0000000007f38000 0000000000000000
900000000214b000 9000000001fe0be0 0000000000000004 0000000000000000
0000000000000107 0000000000000009 ffffffffffafdabe 00000000000000b4
0000000000000006 90000000004c302c 9000000000224528 00005555939a0c7c
00000000000000b0 0000000000000004 0000000000000000 0000000000071c1c
...
Call Trace:
[<9000000000224528>] show_stack+0x48/0x1a0
[<900000000179afc8>] dump_stack_lvl+0x78/0xa0
[<9000000000263ed0>] __warn+0x90/0x1a0
[<90000000017419b8>] report_bug+0x1b8/0x280
[<900000000179c564>] do_bp+0x264/0x420
[<90000000004c302c>] __static_key_slow_dec_cpuslocked+0xec/0x100
[<90000000002b4d7c>] sched_cpu_deactivate+0x2fc/0x300
[<9000000000266498>] cpuhp_invoke_callback+0x178/0x8a0
[<9000000000267f70>] cpuhp_thread_fun+0xf0/0x240
[<90000000002a117c>] smpboot_thread_fn+0x1dc/0x2e0
[<900000000029a720>] kthread+0x140/0x160
[<9000000000222288>] ret_from_kernel_thread+0xc/0xa4--- arch/loongarch/kernel/smp.c | 121 ++++++++++++++++++++++++-------------------- 1 file changed, 68 insertions(+), 53 deletions(-)
arch/loongarch/kernel/smp.c +68 -53
@@ -88,6 +88,73 @@ void show_ipi_list(struct seq_file *p, i } } +static inline void set_cpu_core_map (int cpu) +{ +int i; + +cpumask_set_cpu (cpu, &cpu_core_setup_map); + +for_each_cpu (i, &cpu_core_setup_map) { +if (cpu_data[cpu].package == cpu_data[i].package) { +cpumask_set_cpu (i, &cpu_core_map[cpu]); +cpumask_set_cpu (cpu, &cpu_core_map[i]); + } + } +} + +static inline void set_cpu_sibling_map (int cpu) +{ +int i; + +cpumask_set_cpu (cpu, &cpu_sibling_setup_map); + +for_each_cpu (i, &cpu_sibling_setup_map) { +if (cpus_are_siblings (cpu, i)) { +cpumask_set_cpu (i, &cpu_sibling_map[cpu]); +cpumask_set_cpu (cpu, &cpu_sibling_map[i]); + } + } +} + +static inline void clear_cpu_sibling_map (int cpu) +{ +int i; + +for_each_cpu (i, &cpu_sibling_setup_map) { +if (cpus_are_siblings (cpu, i)) { +cpumask_clear_cpu (i, &cpu_sibling_map[cpu]); +cpumask_clear_cpu (cpu, &cpu_sibling_map[i]); + } + } + +cpumask_clear_cpu (cpu, &cpu_sibling_setup_map); +} + +/* +* Calculate a new cpu_foreign_map mask whenever a +* new cpu appears or disappears. +*/ +void calculate_cpu_foreign_map (void ) +{ +int i, k, core_present; +cpumask_t temp_foreign_map; + +/* Re-calculate the mask */ +cpumask_clear (&temp_foreign_map); +for_each_online_cpu (i) { + core_present =0 ; +for_each_cpu (k, &temp_foreign_map) +if (cpus_are_siblings (i, k)) + core_present =1 ; +if (!core_present) +cpumask_set_cpu (i, &temp_foreign_map); + } + +for_each_online_cpu (i) +cpumask_andnot (&cpu_foreign_map[i], + &temp_foreign_map, &cpu_sibling_map[i]); +} +/* Send mailbox buffer via Mail_Send */ static void csr_mail_send (uint64_t data,int cpu,int mailbox) {
@@ -300,6 +367,7 @@ int loongson_cpu_disable(void)numa_remove_cpu (cpu);#endif set_cpu_online (cpu, false); +clear_cpu_sibling_map (cpu);calculate_cpu_foreign_map ();local_irq_save (flags);irq_migrate_all_off_this_cpu ();
@@ -377,59 +445,6 @@ static int __init ipi_pm_init(void)core_initcall (ipi_pm_init);#endif -static inline void set_cpu_sibling_map (int cpu) -{ -int i; - -cpumask_set_cpu (cpu, &cpu_sibling_setup_map); - -for_each_cpu (i, &cpu_sibling_setup_map) { -if (cpus_are_siblings (cpu, i)) { -cpumask_set_cpu (i, &cpu_sibling_map[cpu]); -cpumask_set_cpu (cpu, &cpu_sibling_map[i]); - } - } -} - -static inline void set_cpu_core_map (int cpu) -{ -int i; - -cpumask_set_cpu (cpu, &cpu_core_setup_map); - -for_each_cpu (i, &cpu_core_setup_map) { -if (cpu_data[cpu].package == cpu_data[i].package) { -cpumask_set_cpu (i, &cpu_core_map[cpu]); -cpumask_set_cpu (cpu, &cpu_core_map[i]); - } - } -} - -/* -* Calculate a new cpu_foreign_map mask whenever a -* new cpu appears or disappears. -*/ -void calculate_cpu_foreign_map (void ) -{ -int i, k, core_present; -cpumask_t temp_foreign_map; - -/* Re-calculate the mask */ -cpumask_clear (&temp_foreign_map); -for_each_online_cpu (i) { - core_present =0 ; -for_each_cpu (k, &temp_foreign_map) -if (cpus_are_siblings (i, k)) - core_present =1 ; -if (!core_present) -cpumask_set_cpu (i, &temp_foreign_map); - } - -for_each_online_cpu (i) -cpumask_andnot (&cpu_foreign_map[i], - &temp_foreign_map, &cpu_sibling_map[i]); -} -/* Preload SMP state for boot cpu */ void smp_prepare_boot_cpu (void ) {
Greg Kroah-Hartman
maintainerPATCH 139/299 btrfs: defrag: avoid unnecessary defrag caused by incorrect extent size
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
commit e42b9d8b9ea2672811285e6a7654887ff64d23f3 upstream.
[BUG]
With the following file extent layout, defrag would do unnecessary IO and result more on-disk space usage.
# mkfs.btrfs -f $dev # mount $dev $mnt # xfs_io -f -c "pwrite 0 40m" $mnt/foobar # sync # xfs_io -f -c "pwrite 40m 16k" $mnt/foobar # sync
Above command would lead to the following file extent layout:
item 6 key (257 EXTENT_DATA 0) itemoff 15816 itemsize 53
generation 7 type 1 (regular)
extent data disk byte 298844160 nr 41943040
extent data offset 0 nr 41943040 ram 41943040
extent compression 0 (none)
item 7 key (257 EXTENT_DATA 41943040) itemoff 15763 itemsize 53
generation 8 type 1 (regular)
extent data disk byte 13631488 nr 16384
extent data offset 0 nr 16384 ram 16384
extent compression 0 (none)Which is mostly fine. We can allow the final 16K to be merged with the previous 40M, but it's upon the end users' preference.
But if we defrag the file using the default parameters, it would result worse file layout:
# btrfs filesystem defrag $mnt/foobar # sync
item 6 key (257 EXTENT_DATA 0) itemoff 15816 itemsize 53
generation 7 type 1 (regular)
extent data disk byte 298844160 nr 41943040
extent data offset 0 nr 8650752 ram 41943040
extent compression 0 (none)
item 7 key (257 EXTENT_DATA 8650752) itemoff 15763 itemsize 53
generation 9 type 1 (regular)
extent data disk byte 340787200 nr 33292288
extent data offset 0 nr 33292288 ram 33292288
extent compression 0 (none)
item 8 key (257 EXTENT_DATA 41943040) itemoff 15710 itemsize 53
generation 8 type 1 (regular)
extent data disk byte 13631488 nr 16384
extent data offset 0 nr 16384 ram 16384
extent compression 0 (none)Note the original 40M extent is still there, but a new 32M extent is created for no benefit at all.
[CAUSE]
There is an existing check to make sure we won't defrag a large enough extent (the threshold is by default 32M).
But the check is using the length to the end of the extent:
range_len = em->len - (cur - em->start); /* Skip too large extent */ if (range_len >= extent_thresh) goto next;
This means, for the first 8MiB of the extent, the range_len is always smaller than the default threshold, and would not be defragged. But after the first 8MiB, the remaining part would fit the requirement, and be defragged.
Such different behavior inside the same extent caused the above problem, and we should avoid different defrag decision inside the same extent.
[FIX]
Instead of using @range_len, just use @em->len, so that we have a consistent decision among the same file extent.
Now with this fix, we won't touch the extent, thus not making it any worse.
--- fs/btrfs/defrag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/defrag.c +1 -1
@@ -903,7 +903,7 @@ static int defrag_collect_targets(struct goto add;/* Skip too large extent */ -if (range_len >= extent_thresh) +if (em->len >= extent_thresh) goto next;/*
Greg Kroah-Hartman
maintainerPATCH 140/299 drm/ttm: Fix an invalid freeing on already freed page in error path
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Hellström <[email protected]>
commit 40510a941d27d405a82dc3320823d875f94625df upstream.
If caching mode change fails due to, for example, OOM we free the allocated pages in a two-step process. First the pages for which the caching change has already succeeded. Secondly the pages for which a caching change did not succeed.
However the second step was incorrectly freeing the pages already freed in the first step.
Fix.
--- drivers/gpu/drm/ttm/ttm_pool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/ttm/ttm_pool.c +1 -1
@@ -384,7 +384,7 @@ static void ttm_pool_free_range(struct tenum ttm_caching caching, pgoff_t start_page, pgoff_t end_page) { - struct page **pages = tt->pages; + struct page **pages = &tt->pages[start_page];unsigned int order;pgoff_t i, nr;
Greg Kroah-Hartman
maintainerPATCH 141/299 drm/meson: Dont remove bridges which are created by other drivers
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Blumenstingl <[email protected]>
commit bd915ae73a2d78559b376ad2caf5e4ef51de2455 upstream.
Stop calling drm_bridge_remove() for bridges allocated/managed by other drivers in the remove paths of meson_encoder_{cvbs,dsi,hdmi}. drm_bridge_remove() unregisters the bridge so it cannot be used anymore. Doing so for bridges we don't own can lead to the video pipeline not being able to come up after -EPROBE_DEFER of the VPU because we're unregistering a bridge that's managed by another driver. The other driver doesn't know that we have unregistered it's bridge and on subsequent .probe() we're not able to find those bridges anymore (since nobody re-creates them).
This fixes probe errors on Meson8b boards with the CVBS outputs enabled.
--- drivers/gpu/drm/meson/meson_encoder_cvbs.c | 1 - drivers/gpu/drm/meson/meson_encoder_dsi.c | 1 - drivers/gpu/drm/meson/meson_encoder_hdmi.c | 1 - 3 files changed, 3 deletions(-)
drivers/gpu/drm/meson/meson_encoder_cvbs.c +0 -1
@@ -294,6 +294,5 @@ void meson_encoder_cvbs_remove(struct meif (priv->encoders[MESON_ENC_CVBS ]) { meson_encoder_cvbs = priv->encoders[MESON_ENC_CVBS ];drm_bridge_remove (&meson_encoder_cvbs->bridge); -drm_bridge_remove (meson_encoder_cvbs->next_bridge); } }
drivers/gpu/drm/meson/meson_encoder_dsi.c +0 -1
@@ -168,6 +168,5 @@ void meson_encoder_dsi_remove(struct mesif (priv->encoders[MESON_ENC_DSI ]) { meson_encoder_dsi = priv->encoders[MESON_ENC_DSI ];drm_bridge_remove (&meson_encoder_dsi->bridge); -drm_bridge_remove (meson_encoder_dsi->next_bridge); } }
drivers/gpu/drm/meson/meson_encoder_hdmi.c +0 -1
@@ -474,6 +474,5 @@ void meson_encoder_hdmi_remove(struct meif (priv->encoders[MESON_ENC_HDMI ]) { meson_encoder_hdmi = priv->encoders[MESON_ENC_HDMI ];drm_bridge_remove (&meson_encoder_hdmi->bridge); -drm_bridge_remove (meson_encoder_hdmi->next_bridge); } }
Greg Kroah-Hartman
maintainerPATCH 142/299 drm/amd/display: adjust few initialization order in dm
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wayne Lin <[email protected]>
commit 22e1dc4b2fec17af70f297a4295c5f19a0f3fbeb upstream.
[Why]
Observe error message "Can't retrieve aconnector in hpd_rx_irq_offload_work" when boot up with a mst tbt4 dock connected. After analyzing, there are few parts needed to be adjusted:
1. hpd_rx_offload_wq[].aconnector is not initialzed before the dmub outbox hpd_irq handler get registered which causes the error message.
2. registeration of hpd and hpd_rx_irq event for usb4 dp tunneling is not aligned with legacy interface sequence
[How]
Put DMUB_NOTIFICATION_HPD and DMUB_NOTIFICATION_HPD_IRQ handler registration into register_hpd_handlers() to align other interfaces and get hpd_rx_offload_wq[].aconnector initialized earlier than that.
Leave DMUB_NOTIFICATION_AUX_REPLY registered as it was since we need that while calling dc_link_detect(). USB4 connection status will be proactively detected by dc_link_detect_connection_type() in amdgpu_dm_initialize_drm_device()
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 37 ++++++++++------------ 1 file changed, 18 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +18 -19
@@ -1816,21 +1816,12 @@ static int amdgpu_dm_init(struct amdgpu_DRM_ERROR ("amdgpu: fail to register dmub aux callback" ); goto error; } -if (!register_dmub_notify_callback (adev,DMUB_NOTIFICATION_HPD , dmub_hpd_callback, true)) { -DRM_ERROR ("amdgpu: fail to register dmub hpd callback" ); - goto error; - } -if (!register_dmub_notify_callback (adev,DMUB_NOTIFICATION_HPD_IRQ , dmub_hpd_callback, true)) { -DRM_ERROR ("amdgpu: fail to register dmub hpd callback" ); - goto error; - } - } - -/* Enable outbox notification only after IRQ handlers are registered and DMUB is alive. -* It is expected that DMUB will resend any pending notifications at this point, for -* example HPD from DPIA. -*/ -if (dc_is_dmub_outbox_supported (adev->dm.dc)) { +/* Enable outbox notification only after IRQ handlers are registered and DMUB is alive. +* It is expected that DMUB will resend any pending notifications at this point. Note +* that hpd and hpd_irq handler registration are deferred to register_hpd_handlers() to +* align legacy interface initialization sequence. Connection status will be proactivly +* detected once in the amdgpu_dm_initialize_drm_device. +*/ dc_enable_dmub_outbox (adev->dm.dc);/* DPIA trace goes to dmesg logs only if outbox is enabled */
@@ -3484,6 +3475,14 @@ static void register_hpd_handlers(struct int_params.requested_polarity =INTERRUPT_POLARITY_DEFAULT ; int_params.current_polarity =INTERRUPT_POLARITY_DEFAULT ; +if (dc_is_dmub_outbox_supported (adev->dm.dc)) { +if (!register_dmub_notify_callback (adev,DMUB_NOTIFICATION_HPD , dmub_hpd_callback, true)) +DRM_ERROR ("amdgpu: fail to register dmub hpd callback" ); + +if (!register_dmub_notify_callback (adev,DMUB_NOTIFICATION_HPD_IRQ , dmub_hpd_callback, true)) +DRM_ERROR ("amdgpu: fail to register dmub hpd callback" ); + } +list_for_each_entry (connector, &dev->mode_config.connector_list, head) {
@@ -3509,10 +3508,6 @@ static void register_hpd_handlers(struct handle_hpd_rx_irq, (void *) aconnector); } - -if (adev->dm.hpd_rx_offload_wq) - adev->dm.hpd_rx_offload_wq[connector->index].aconnector = - aconnector; } }
@@ -4481,6 +4476,10 @@ static int amdgpu_dm_initialize_drm_devi link =dc_get_link_at_index (dm->dc, i); +if (dm->hpd_rx_offload_wq) + dm->hpd_rx_offload_wq[aconnector->base.index].aconnector = + aconnector; +if (!dc_link_detect_connection_type (link, &new_connection_type))DRM_ERROR ("KMS: Failed to detect connector\n" );
Greg Kroah-Hartman
maintainerPATCH 143/299 s390/cio: fix invalid -EBUSY on ccw_device_start
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Oberparleiter <[email protected]>
commit 5ef1dc40ffa6a6cb968b0fdc43c3a61727a9e950 upstream.
The s390 common I/O layer (CIO) returns an unexpected -EBUSY return code when drivers try to start I/O while a path-verification (PV) process is pending. This can lead to failed device initialization attempts with symptoms like broken network connectivity after boot.
Fix this by replacing the -EBUSY return code with a deferred condition code 1 reply to make path-verification handling consistent from a driver's point of view.
The problem can be reproduced semi-regularly using the following process, while repeating steps 2-3 as necessary (example assumes an OSA device with bus-IDs 0.0.a000-0.0.a002 on CHPID 0.02):
1. echo 0.0.a000,0.0.a001,0.0.a002 >/sys/bus/ccwgroup/drivers/qeth/group
2. echo 0 > /sys/bus/ccwgroup/devices/0.0.a000/online
3. echo 1 > /sys/bus/ccwgroup/devices/0.0.a000/online ; \
echo on > /sys/devices/css0/chp0.02/status
Background information:
The common I/O layer starts path-verification I/Os when it receives indications about changes in a device path's availability. This occurs for example when hardware events indicate a change in channel-path status, or when a manual operation such as a CHPID vary or configure operation is performed.
If a driver attempts to start I/O while a PV is running, CIO reports a successful I/O start (ccw_device_start() return code 0). Then, after completion of PV, CIO synthesizes an interrupt response that indicates an asynchronous status condition that prevented the start of the I/O (deferred condition code 1).
If a PV indication arrives while a device is busy with driver-owned I/O, PV is delayed until after I/O completion was reported to the driver's interrupt handler. To ensure that PV can be started eventually, CIO reports a device busy condition (ccw_device_start() return code -EBUSY) if a driver tries to start another I/O while PV is pending.
In some cases this -EBUSY return code causes device drivers to consider a device not operational, resulting in failed device initialization.
Note: The code that introduced the problem was added in 2003. Symptoms started appearing with the following CIO commit that causes a PV indication when a device is removed from the cio_ignore list after the associated parent subchannel device was probed, but before online processing of the CCW device has started:
2297791c92d0 ("s390/cio: dont unregister subchannel from child-drivers")
During boot, the cio_ignore list is modified by the cio_ignore dracut module [1] as well as Linux vendor-specific systemd service scripts[2]. When combined, this commit and boot scripts cause a frequent occurrence of the problem during boot.
[1] https://github.com/dracutdevs/dracut/tree/master/modules.d/81cio_ignore
[2] https://github.com/SUSE/s390-tools/blob/master/cio_ignore.service
--- drivers/s390/cio/device_ops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/s390/cio/device_ops.c +3 -3
@@ -202,7 +202,8 @@ int ccw_device_start_timeout_key(structreturn -EINVAL ;if (cdev->private->state ==DEV_STATE_NOT_OPER )return -ENODEV ; -if (cdev->private->state ==DEV_STATE_VERIFY ) { +if (cdev->private->state ==DEV_STATE_VERIFY || + cdev->private->flags.doverify) {/* Remember to fake irb when finished. */ if (!cdev->private->flags.fake_irb) { cdev->private->flags.fake_irb =FAKE_CMD_IRB ;
@@ -214,8 +215,7 @@ int ccw_device_start_timeout_key(struct }if (cdev->private->state !=DEV_STATE_ONLINE || ((sch->schib.scsw.cmd.stctl &SCSW_STCTL_PRIM_STATUS ) && - !(sch->schib.scsw.cmd.stctl &SCSW_STCTL_SEC_STATUS )) || - cdev->private->flags.doverify) + !(sch->schib.scsw.cmd.stctl &SCSW_STCTL_SEC_STATUS )))return -EBUSY ; ret =cio_set_options (sch, flags);if (ret)
Greg Kroah-Hartman
maintainerPATCH 144/299 ata: libata-core: Do not try to set sleeping devices to standby
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Damien Le Moal <[email protected]>
commit 4b085736e44dbbe69b5eea1a8a294f404678a1f4 upstream.
In ata ata_dev_power_set_standby(), check that the target device is not sleeping. If it is, there is no need to do anything.
--- drivers/ata/libata-core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/ata/libata-core.c +4 -0
@@ -2034,6 +2034,10 @@ void ata_dev_power_set_active(struct atastruct ata_taskfile tf;unsigned int err_mask; +/* If the device is already sleeping, do nothing. */ +if (dev->flags &ATA_DFLAG_SLEEPING ) +return ; +/* * Issue READ VERIFY SECTORS command for 1 sector at lba=0 only * if supported by the device.
Greg Kroah-Hartman
maintainerPATCH 145/299 fs/aio: Restrict kiocb_set_cancel_fn() to I/O submitted via libaio
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit b820de741ae48ccf50dd95e297889c286ff4f760 upstream.
If kiocb_set_cancel_fn() is called for I/O submitted via io_uring, the following kernel warning appears:
WARNING: CPU: 3 PID: 368 at fs/aio.c:598 kiocb_set_cancel_fn+0x9c/0xa8 Call trace: kiocb_set_cancel_fn+0x9c/0xa8 ffs_epfile_read_iter+0x144/0x1d0 io_read+0x19c/0x498 io_issue_sqe+0x118/0x27c io_submit_sqes+0x25c/0x5fc __arm64_sys_io_uring_enter+0x104/0xab0 invoke_syscall+0x58/0x11c el0_svc_common+0xb4/0xf4 do_el0_svc+0x2c/0xb0 el0_svc+0x2c/0xa4 el0t_64_sync_handler+0x68/0xb4 el0t_64_sync+0x1a4/0x1a8
Fix this by setting the IOCB_AIO_RW flag for read and write I/O that is submitted by libaio.
--- fs/aio.c | 9 ++++++++- include/linux/fs.h | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-)
fs/aio.c +8 -1
@@ -594,6 +594,13 @@ void kiocb_set_cancel_fn(struct kiocb *istruct kioctx *ctx = req->ki_ctx;unsigned long flags; +/* +* kiocb didn't come from aio or is neither a read nor a write, hence +* ignore it. +*/ +if (!(iocb->ki_flags &IOCB_AIO_RW )) +return ; +if (WARN_ON_ONCE (!list_empty (&req->ki_list)))return ;
@@ -1463,7 +1470,7 @@ static int aio_prep_rw(struct kiocb *req req->ki_complete = aio_complete_rw; req->private =NULL ; req->ki_pos = iocb->aio_offset; - req->ki_flags = req->ki_filp->f_iocb_flags; + req->ki_flags = req->ki_filp->f_iocb_flags |IOCB_AIO_RW ;if (iocb->aio_flags &IOCB_FLAG_RESFD ) req->ki_flags |=IOCB_EVENTFD ;if (iocb->aio_flags &IOCB_FLAG_IOPRIO ) {
include/linux/fs.h +2 -0
@@ -352,6 +352,8 @@ enum rw_hint {* unrelated IO (like cache flushing, new IO generation, etc). */ #define IOCB_DIO_CALLER_COMP (1 << 22) +/* kiocb is a read or write operation submitted by fs/aio.c. */ +#define IOCB_AIO_RW (1 << 23)/* for use in trace events */ #define TRACE_IOCB_STRINGS \
Greg Kroah-Hartman
maintainerPATCH 146/299 lib/Kconfig.debug: TEST_IOV_ITER depends on MMU
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit 1eb1e984379e2da04361763f66eec90dd75cf63e upstream.
Trying to run the iov_iter unit test on a nommu system such as the qemu kc705-nommu emulation results in a crash.
KTAP version 1
# Subtest: iov_iter
# module: kunit_iov_iter
1..9
BUG: failure at mm/nommu.c:318/vmap()! Kernel panic - not syncing: BUG!
The test calls vmap() directly, but vmap() is not supported on nommu systems, causing the crash. TEST_IOV_ITER therefore needs to depend on MMU.
--- lib/Kconfig.debug | 1 + 1 file changed, 1 insertion(+)
lib/Kconfig.debug +1 -0
@@ -2225,6 +2225,7 @@ config TEST_DIV64 config TEST_IOV_ITER tristate "Test iov_iter operation" if !KUNIT_ALL_TESTS depends on KUNIT + depends on MMU default KUNIT_ALL_TESTS help Enable this to turn on testing of the operation of the I/O iterator
Greg Kroah-Hartman
maintainerPATCH 147/299 dm-crypt: recheck the integrity tag after a failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 42e15d12070b4ff9af2b980f1b65774c2dab0507 upstream.
If a userspace process reads (with O_DIRECT) multiple blocks into the same buffer, dm-crypt reports an authentication error [1]. The error is reported in a log and it may cause RAID leg being kicked out of the array.
This commit fixes dm-crypt, so that if integrity verification fails, the data is read again into a kernel buffer (where userspace can't modify it) and the integrity tag is rechecked. If the recheck succeeds, the content of the kernel buffer is copied into the user buffer; if the recheck fails, an integrity error is reported.
[1] https://people.redhat.com/~mpatocka/testcases/blk-auth-modify/read2.c
--- drivers/md/dm-crypt.c | 89 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 73 insertions(+), 16 deletions(-)
drivers/md/dm-crypt.c +73 -16
@@ -62,6 +62,8 @@ struct convert_context {struct skcipher_request *req;struct aead_request *req_aead; } r; +bool aead_recheck; +bool aead_failed; };
@@ -82,6 +84,8 @@ struct dm_crypt_io {blk_status_t error;sector_t sector; +struct bvec_iter saved_bi_iter; +struct rb_node rb_node; }CRYPTO_MINALIGN_ATTR ;
@@ -1376,10 +1380,13 @@ static int crypt_convert_block_aead(struif (r == -EBADMSG ) {sector_t s =le64_to_cpu (*sector); -DMERR_LIMIT ("%pg: INTEGRITY AEAD ERROR, sector %llu" , - ctx->bio_in->bi_bdev, s); -dm_audit_log_bio (DM_MSG_PREFIX ,"integrity-aead" , - ctx->bio_in, s,0 ); + ctx->aead_failed = true; +if (ctx->aead_recheck) { +DMERR_LIMIT ("%pg: INTEGRITY AEAD ERROR, sector %llu" , + ctx->bio_in->bi_bdev, s); +dm_audit_log_bio (DM_MSG_PREFIX ,"integrity-aead" , + ctx->bio_in, s,0 ); + } }if (!r && cc->iv_gen_ops && cc->iv_gen_ops->post)
@@ -1763,6 +1770,8 @@ static void crypt_io_init(struct dm_cryp io->base_bio = bio; io->sector = sector; io->error =0 ; + io->ctx.aead_recheck = false; + io->ctx.aead_failed = false; io->ctx.r.req =NULL ; io->integrity_metadata =NULL ; io->integrity_metadata_from_pool = false;
@@ -1774,6 +1783,8 @@ static void crypt_inc_pending(struct dm_atomic_inc (&io->io_pending); } +static void kcryptd_queue_read (struct dm_crypt_io *io); +/* * One of the bios was finished. Check for completion of * the whole request and correctly clean up the buffer.
@@ -1787,6 +1798,15 @@ static void crypt_dec_pending(struct dm_if (!atomic_dec_and_test (&io->io_pending))return ; +if (likely (!io->ctx.aead_recheck) &&unlikely (io->ctx.aead_failed) && + cc->on_disk_tag_size &&bio_data_dir (base_bio) ==READ ) { + io->ctx.aead_recheck = true; + io->ctx.aead_failed = false; + io->error =0 ; +kcryptd_queue_read (io); +return ; + } +if (io->ctx.r.req)crypt_free_req (cc, io->ctx.r.req, base_bio);
@@ -1822,15 +1842,19 @@ static void crypt_endio(struct bio *clonstruct dm_crypt_io *io = clone->bi_private;struct crypt_config *cc = io->cc;unsigned int rw =bio_data_dir (clone); -blk_status_t error; +blk_status_t error = clone->bi_status; + +if (io->ctx.aead_recheck && !error) { +kcryptd_queue_crypt (io); +return ; + }/* * free the processed pages */ -if (rw ==WRITE ) +if (rw ==WRITE || io->ctx.aead_recheck)crypt_free_buffer_pages (cc, clone); - error = clone->bi_status;bio_put (clone);if (rw ==READ && !error) {
@@ -1851,6 +1875,22 @@ static int kcryptd_io_read(struct dm_crystruct crypt_config *cc = io->cc;struct bio *clone; +if (io->ctx.aead_recheck) { +if (!(gfp & __GFP_DIRECT_RECLAIM)) +return 1 ; +crypt_inc_pending (io); + clone =crypt_alloc_buffer (io, io->base_bio->bi_iter.bi_size); +if (unlikely (!clone)) { +crypt_dec_pending (io); +return 1 ; + } + clone->bi_iter.bi_sector = cc->start + io->sector; +crypt_convert_init (cc, &io->ctx, clone, clone, io->sector); + io->saved_bi_iter = clone->bi_iter; +dm_submit_bio_remap (io->base_bio, clone); +return 0 ; + } +/* * We need the original biovec array in order to decrypt the whole bio * data *afterwards* -- thanks to immutable biovecs we don't need to
@@ -2113,6 +2153,14 @@ dec:static void kcryptd_crypt_read_done (struct dm_crypt_io *io) { +if (io->ctx.aead_recheck) { +if (!io->error) { + io->ctx.bio_in->bi_iter = io->saved_bi_iter; +bio_copy_data (io->base_bio, io->ctx.bio_in); + } +crypt_free_buffer_pages (io->cc, io->ctx.bio_in); +bio_put (io->ctx.bio_in); + }crypt_dec_pending (io); }
@@ -2142,11 +2190,17 @@ static void kcryptd_crypt_read_convert(scrypt_inc_pending (io); -crypt_convert_init (cc, &io->ctx, io->base_bio, io->base_bio, - io->sector); +if (io->ctx.aead_recheck) { + io->ctx.cc_sector = io->sector + cc->iv_offset; + r =crypt_convert (cc, &io->ctx, +test_bit (DM_CRYPT_NO_READ_WORKQUEUE , &cc->flags), true); + }else { +crypt_convert_init (cc, &io->ctx, io->base_bio, io->base_bio, + io->sector); - r =crypt_convert (cc, &io->ctx, -test_bit (DM_CRYPT_NO_READ_WORKQUEUE , &cc->flags), true); + r =crypt_convert (cc, &io->ctx, +test_bit (DM_CRYPT_NO_READ_WORKQUEUE , &cc->flags), true); + }/* * Crypto API backlogged the request, because its queue was full * and we're in softirq context, so continue from a workqueue
@@ -2188,10 +2242,13 @@ static void kcryptd_async_done(void *datif (error == -EBADMSG ) {sector_t s =le64_to_cpu (*org_sector_of_dmreq (cc, dmreq)); -DMERR_LIMIT ("%pg: INTEGRITY AEAD ERROR, sector %llu" , - ctx->bio_in->bi_bdev, s); -dm_audit_log_bio (DM_MSG_PREFIX ,"integrity-aead" , - ctx->bio_in, s,0 ); + ctx->aead_failed = true; +if (ctx->aead_recheck) { +DMERR_LIMIT ("%pg: INTEGRITY AEAD ERROR, sector %llu" , + ctx->bio_in->bi_bdev, s); +dm_audit_log_bio (DM_MSG_PREFIX ,"integrity-aead" , + ctx->bio_in, s,0 ); + } io->error =BLK_STS_PROTECTION ; }else if (error <0 ) io->error =BLK_STS_IOERR ;
@@ -3117,7 +3174,7 @@ static int crypt_ctr_optional(struct dm_ sval =strchr (opt_string +strlen ("integrity:" ),':' ) +1 ;if (!strcasecmp (sval,"aead" )) {set_bit (CRYPT_MODE_INTEGRITY_AEAD , &cc->cipher_flags); - }else if (strcasecmp (sval,"none" )) { + }else if (strcasecmp (sval,"none" )) { ti->error ="Unknown integrity profile" ;return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 148/299 Revert "parisc: Only list existing CPUs in cpu_possible_mask"
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit 82b143aeb169b8b55798d7d2063032e1a6ceeeb0 upstream.
This reverts commit 0921244f6f4f0d05698b953fe632a99b38907226.
It broke CPU hotplugging because it modifies the __cpu_possible_mask after bootup, so that it will be different than nr_cpu_ids, which then effictively breaks the workqueue setup code and triggers crashes when shutting down CPUs at runtime.
Guenter was the first who noticed the wrong values in __cpu_possible_mask, since the cpumask Kunit tests were failig.
Reverting this commit fixes both issues, but sadly brings back this uncritical runtime warning:register_cpu_capacity_sysctl: too early to get CPU4 device!
--- arch/parisc/kernel/processor.c | 8 -------- 1 file changed, 8 deletions(-)
arch/parisc/kernel/processor.c +0 -8
@@ -172,7 +172,6 @@ static int __init processor_probe(struct p->cpu_num = cpu_info.cpu_num; p->cpu_loc = cpu_info.cpu_loc; -set_cpu_possible (cpuid, true);store_cpu_topology (cpuid);#ifdef CONFIG_SMP
@@ -474,13 +473,6 @@ static struct parisc_driver cpu_driver _*/ void __init processor_init (void ) { -unsigned int cpu; -reset_cpu_topology (); - -/* reset possible mask. We will mark those which are possible. */ -for_each_possible_cpu (cpu) -set_cpu_possible (cpu, false); -register_parisc_driver (&cpu_driver); }
Greg Kroah-Hartman
maintainerPATCH 149/299 dm-integrity: recheck the integrity tag after a failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit c88f5e553fe38b2ffc4c33d08654e5281b297677 upstream.
If a userspace process reads (with O_DIRECT) multiple blocks into the same buffer, dm-integrity reports an error [1]. The error is reported in a log and it may cause RAID leg being kicked out of the array.
This commit fixes dm-integrity, so that if integrity verification fails, the data is read again into a kernel buffer (where userspace can't modify it) and the integrity tag is rechecked. If the recheck succeeds, the content of the kernel buffer is copied into the user buffer; if the recheck fails, an integrity error is reported.
[1] https://people.redhat.com/~mpatocka/testcases/blk-auth-modify/read2.c
--- drivers/md/dm-integrity.c | 93 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 84 insertions(+), 9 deletions(-)
drivers/md/dm-integrity.c +84 -9
@@ -278,6 +278,8 @@ struct dm_integrity_c {atomic64_t number_of_mismatches; +mempool_t recheck_pool; +struct notifier_block reboot_notifier; };
@@ -1699,6 +1701,79 @@ failed:get_random_bytes (result, ic->tag_size); } +static void integrity_recheck (struct dm_integrity_io *dio) +{ +struct bio *bio =dm_bio_from_per_bio_data (dio,sizeof (struct dm_integrity_io )); +struct dm_integrity_c *ic = dio->ic; +struct bvec_iter iter; +struct bio_vec bv; +sector_t sector, logical_sector, area, offset; +char checksum_onstack[max_t (size_t,HASH_MAX_DIGESTSIZE ,MAX_TAG_SIZE )]; +struct page *page; +void *buffer; + +get_area_and_offset (ic, dio->range.logical_sector, &area, &offset); + dio->metadata_block =get_metadata_sector_and_offset (ic, area, offset, + &dio->metadata_offset); + sector =get_data_sector (ic, area, offset); + logical_sector = dio->range.logical_sector; + + page =mempool_alloc (&ic->recheck_pool,GFP_NOIO ); + buffer =page_to_virt (page); + +__bio_for_each_segment (bv, bio, iter, dio->bio_details.bi_iter) { +unsigned pos =0 ; + +do { +char *mem; +int r; +struct dm_io_request io_req; +struct dm_io_region io_loc; + io_req.bi_opf =REQ_OP_READ ; + io_req.mem.type =DM_IO_KMEM ; + io_req.mem.ptr.addr = buffer; + io_req.notify.fn =NULL ; + io_req.client = ic->io; + io_loc.bdev = ic->dev->bdev; + io_loc.sector = sector; + io_loc.count = ic->sectors_per_block; + + r =dm_io (&io_req,1 , &io_loc,NULL ); +if (unlikely (r)) { + dio->bi_status =errno_to_blk_status (r); + goto free_ret; + } + +integrity_sector_checksum (ic, logical_sector, buffer, + checksum_onstack); + r =dm_integrity_rw_tag (ic, checksum_onstack, &dio->metadata_block, + &dio->metadata_offset, ic->tag_size,TAG_CMP ); +if (r) { +if (r >0 ) { +DMERR_LIMIT ("%pg: Checksum failed at sector 0x%llx" , + bio->bi_bdev, logical_sector); +atomic64_inc (&ic->number_of_mismatches); +dm_audit_log_bio (DM_MSG_PREFIX ,"integrity-checksum" , + bio, logical_sector,0 ); + r = -EILSEQ ; + } + dio->bi_status =errno_to_blk_status (r); + goto free_ret; + } + + mem =bvec_kmap_local (&bv); +memcpy (mem + pos, buffer, ic->sectors_per_block <<SECTOR_SHIFT ); +kunmap_local (mem); + + pos += ic->sectors_per_block <<SECTOR_SHIFT ; + sector += ic->sectors_per_block; + logical_sector += ic->sectors_per_block; + }while (pos < bv.bv_len); + } +free_ret: +mempool_free (page, &ic->recheck_pool); +} +static void integrity_metadata (struct work_struct *w) { struct dm_integrity_io *dio = container_of(w, struct dm_integrity_io, work);
@@ -1786,15 +1861,8 @@ again: checksums_ptr - checksums, dio->op == REQ_OP_READ ? TAG_CMP : TAG_WRITE);if (unlikely (r)) {if (r >0 ) { -sector_t s; - - s = sector - ((r + ic->tag_size -1 ) / ic->tag_size); -DMERR_LIMIT ("%pg: Checksum failed at sector 0x%llx" , - bio->bi_bdev, s); - r = -EILSEQ ; -atomic64_inc (&ic->number_of_mismatches); -dm_audit_log_bio (DM_MSG_PREFIX ,"integrity-checksum" , - bio, s,0 ); +integrity_recheck (dio); + goto skip_io; }if (likely (checksums != checksums_onstack))kfree (checksums);
@@ -4271,6 +4339,12 @@ static int dm_integrity_ctr(struct dm_ta goto bad; } + r =mempool_init_page_pool (&ic->recheck_pool,1 ,0 ); +if (r) { + ti->error ="Cannot allocate mempool" ; + goto bad; + } + ic->metadata_wq =alloc_workqueue ("dm-integrity-metadata" ,WQ_MEM_RECLAIM ,METADATA_WORKQUEUE_MAX_ACTIVE );if (!ic->metadata_wq) {
@@ -4619,6 +4693,7 @@ static void dm_integrity_dtr(struct dm_tkvfree (ic->bbs);if (ic->bufio)dm_bufio_client_destroy (ic->bufio); +mempool_exit (&ic->recheck_pool);mempool_exit (&ic->journal_io_mempool);if (ic->io)dm_io_client_destroy (ic->io);
Greg Kroah-Hartman
maintainerPATCH 150/299 dm-crypt: dont modify the data when using authenticated encryption
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 50c70240097ce41fe6bce6478b80478281e4d0f7 upstream.
It was said that authenticated encryption could produce invalid tag when the data that is being encrypted is modified [1]. So, fix this problem by copying the data into the clone bio first and then encrypt them inside the clone bio.
This may reduce performance, but it is needed to prevent the user from corrupting the device by writing data with O_DIRECT and modifying them at the same time.
[1] https://lore.kernel.org/all/[email protected]/T/
--- drivers/md/dm-crypt.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/md/dm-crypt.c +6 -0
@@ -2117,6 +2117,12 @@ static void kcryptd_crypt_write_convert( io->ctx.bio_out = clone; io->ctx.iter_out = clone->bi_iter; +if (crypt_integrity_aead (cc)) { +bio_copy_data (clone, io->base_bio); + io->ctx.bio_in = clone; + io->ctx.iter_in = clone->bi_iter; + } + sector +=bio_sectors (clone);crypt_inc_pending (io);
Greg Kroah-Hartman
maintainerPATCH 151/299 dm-verity: recheck the hash after a failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 9177f3c0dea6143d05cac1bbd28668fd0e216d11 upstream.
If a userspace process reads (with O_DIRECT) multiple blocks into the same buffer, dm-verity reports an error [1].
This commit fixes dm-verity, so that if hash verification fails, the data is read again into a kernel buffer (where userspace can't modify it) and the hash is rechecked. If the recheck succeeds, the content of the kernel buffer is copied into the user buffer; if the recheck fails, an error is reported.
[1] https://people.redhat.com/~mpatocka/testcases/blk-auth-modify/read2.c
--- drivers/md/dm-verity-target.c | 86 +++++++++++++++++++++++++++++++++++++++--- drivers/md/dm-verity.h | 6 ++ 2 files changed, 86 insertions(+), 6 deletions(-)
drivers/md/dm-verity-target.c +80 -6
@@ -482,6 +482,63 @@ int verity_for_bv_block(struct dm_verityreturn 0 ; } +static int verity_recheck_copy (struct dm_verity *v,struct dm_verity_io *io, +u8 *data,size_t len) +{ +memcpy (data, io->recheck_buffer, len); + io->recheck_buffer += len; + +return 0 ; +} + +static int verity_recheck (struct dm_verity *v,struct dm_verity_io *io, +struct bvec_iter start,sector_t cur_block) +{ +struct page *page; +void *buffer; +int r; +struct dm_io_request io_req; +struct dm_io_region io_loc; + + page =mempool_alloc (&v->recheck_pool,GFP_NOIO ); + buffer =page_to_virt (page); + + io_req.bi_opf =REQ_OP_READ ; + io_req.mem.type =DM_IO_KMEM ; + io_req.mem.ptr.addr = buffer; + io_req.notify.fn =NULL ; + io_req.client = v->io; + io_loc.bdev = v->data_dev->bdev; + io_loc.sector = cur_block << (v->data_dev_block_bits -SECTOR_SHIFT ); + io_loc.count =1 << (v->data_dev_block_bits -SECTOR_SHIFT ); + r =dm_io (&io_req,1 , &io_loc,NULL ); +if (unlikely (r)) + goto free_ret; + + r =verity_hash (v,verity_io_hash_req (v, io), buffer, +1 << v->data_dev_block_bits, +verity_io_real_digest (v, io), true); +if (unlikely (r)) + goto free_ret; + +if (memcmp (verity_io_real_digest (v, io), +verity_io_want_digest (v, io), v->digest_size)) { + r = -EIO ; + goto free_ret; + } + + io->recheck_buffer = buffer; + r =verity_for_bv_block (v, io, &start, verity_recheck_copy); +if (unlikely (r)) + goto free_ret; + + r =0 ; +free_ret: +mempool_free (page, &v->recheck_pool); + +return r; +} +static int verity_bv_zero (struct dm_verity *v,struct dm_verity_io *io,u8 *data,size_t len) {
@@ -508,9 +565,7 @@ static int verity_verify_io(struct dm_ve {bool is_zero;struct dm_verity *v = io->v; -#if defined(CONFIG_DM_VERITY_FEC )struct bvec_iter start; -#endif struct bvec_iter iter_copy;struct bvec_iter *iter;struct crypto_wait wait;
@@ -561,10 +616,7 @@ static int verity_verify_io(struct dm_veif (unlikely (r <0 ))return r; -#if defined(CONFIG_DM_VERITY_FEC ) -if (verity_fec_is_enabled (v)) - start = *iter; -#endif + start = *iter; r =verity_for_io_block (v, io, iter, &wait);if (unlikely (r <0 ))return r;
@@ -586,6 +638,10 @@ static int verity_verify_io(struct dm_ve* tasklet since it may sleep, so fallback to work-queue. */ return -EAGAIN ; + }else if (verity_recheck (v, io, start, cur_block) ==0 ) { +if (v->validated_blocks) +set_bit (cur_block, v->validated_blocks); +continue ;#if defined(CONFIG_DM_VERITY_FEC ) } else if (verity_fec_decode(v, io, DM_VERITY_BLOCK_TYPE_DATA, cur_block,NULL , &start) ==0 ) {
@@ -941,6 +997,10 @@ static void verity_dtr(struct dm_targetif (v->verify_wq)destroy_workqueue (v->verify_wq); +mempool_exit (&v->recheck_pool); +if (v->io) +dm_io_client_destroy (v->io); +if (v->bufio)dm_bufio_client_destroy (v->bufio);
@@ -1379,6 +1439,20 @@ static int verity_ctr(struct dm_target * } v->hash_blocks = hash_position; + r =mempool_init_page_pool (&v->recheck_pool,1 ,0 ); +if (unlikely (r)) { + ti->error ="Cannot allocate mempool" ; + goto bad; + } + + v->io =dm_io_client_create (); +if (IS_ERR (v->io)) { + r =PTR_ERR (v->io); + v->io =NULL ; + ti->error ="Cannot allocate dm io" ; + goto bad; + } + v->bufio = dm_bufio_client_create(v->hash_dev->bdev, 1 << v->hash_dev_block_bits, 1, sizeof(struct buffer_aux), dm_bufio_alloc_callback, NULL,
drivers/md/dm-verity.h +6 -0
@@ -11,6 +11,7 @@#ifndef DM_VERITY_H #define DM_VERITY_H +#include <linux/dm-io.h> #include <linux/dm-bufio.h> #include <linux/device-mapper.h> #include <linux/interrupt.h>
@@ -68,6 +69,9 @@ struct dm_verity {unsigned long *validated_blocks;/* bitset blocks validated */ char *signature_key_desc;/* signature keyring reference */ + +struct dm_io_client *io; +mempool_t recheck_pool; };struct dm_verity_io {
@@ -84,6 +88,8 @@ struct dm_verity_io {struct work_struct work; +char *recheck_buffer; +/* * Three variably-size fields follow this struct: *
Greg Kroah-Hartman
maintainerPATCH 152/299 cxl/acpi: Fix load failures due to single window creation failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit 5c6224bfabbf7f3e491c51ab50fd2c6f92ba1141 upstream.
The expectation is that cxl_parse_cfwms() continues in the face the of failure as evidenced by code like:
cxlrd = cxl_root_decoder_alloc(root_port, ways, cxl_calc_hb);
if (IS_ERR(cxlrd))
return 0;There are other error paths in that function which mistakenly follow idiomatic expectations and return an error when they should not. Most of those mistakes are innocuous checks that hardly ever fail in practice. However, a recent change succeed in making the implementation more fragile by applying an idiomatic, but still wrong "fix" [1]. In this failure case the kernel reports:
cxl root0: Failed to populate active decoder targets
cxl_acpi ACPI0017:00: Failed to add decode range: [mem 0x00000000-0x7fffffff flags 0x200]
...which is a real issue with that one window (to be fixed separately), but ends up failing the entirety of cxl_acpi_probe().
Undo that recent breakage while also removing the confusion about ignoring errors. Update all exits paths to return an error per typical expectations and let an outer wrapper function handle dropping the error.
--- drivers/cxl/acpi.c | 46 ++++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 18 deletions(-)
drivers/cxl/acpi.c +28 -18
@@ -194,31 +194,27 @@ struct cxl_cfmws_context {int id; }; -static int cxl_parse_cfmws (union acpi_subtable_headers *header,void *arg, -const unsigned long end) +static int __cxl_parse_cfmws (struct acpi_cedt_cfmws *cfmws, +struct cxl_cfmws_context *ctx) {int target_map[CXL_DECODER_MAX_INTERLEAVE ]; -struct cxl_cfmws_context *ctx = arg;struct cxl_port *root_port = ctx->root_port;struct resource *cxl_res = ctx->cxl_res;struct cxl_cxims_context cxims_ctx;struct cxl_root_decoder *cxlrd;struct device *dev = ctx->dev; -struct acpi_cedt_cfmws *cfmws;cxl_calc_hb_fn cxl_calc_hb;struct cxl_decoder *cxld;unsigned int ways, i, ig;struct resource *res;int rc; - cfmws = (struct acpi_cedt_cfmws *) header; - rc =cxl_acpi_cfmws_verify (dev, cfmws);if (rc) {dev_err (dev,"CFMWS range %#llx-%#llx not registered\n" , cfmws->base_hpa, cfmws->base_hpa + cfmws->window_size -1 ); -return 0 ; +return rc; } rc =eiw_to_ways (cfmws->interleave_ways, &ways);
@@ -254,7 +250,7 @@ static int cxl_parse_cfmws(union acpi_su cxlrd =cxl_root_decoder_alloc (root_port, ways, cxl_calc_hb);if (IS_ERR (cxlrd)) -return 0 ; +return PTR_ERR (cxlrd); cxld = &cxlrd->cxlsd.cxld; cxld->flags =cfmws_to_decoder_flags (cfmws->restrictions);
@@ -295,16 +291,7 @@ err_xormap:put_device (&cxld->dev); else rc =cxl_decoder_autoremove (dev, cxld); -if (rc) { -dev_err (dev,"Failed to add decode range: %pr" , res); -return rc; - } -dev_dbg (dev,"add: %s node: %d range [%#llx - %#llx]\n" , -dev_name (&cxld->dev), -phys_to_target_node (cxld->hpa_range.start), - cxld->hpa_range.start, cxld->hpa_range.end); - -return 0 ; +return rc; err_insert:kfree (res->name);
@@ -313,6 +300,29 @@ err_name:return -ENOMEM ; } +static int cxl_parse_cfmws (union acpi_subtable_headers *header,void *arg, +const unsigned long end) +{ +struct acpi_cedt_cfmws *cfmws = (struct acpi_cedt_cfmws *)header; +struct cxl_cfmws_context *ctx = arg; +struct device *dev = ctx->dev; +int rc; + + rc =__cxl_parse_cfmws (cfmws, ctx); +if (rc) +dev_err (dev, +"Failed to add decode range: [%#llx - %#llx] (%d)\n" , + cfmws->base_hpa, + cfmws->base_hpa + cfmws->window_size -1 , rc); +else +dev_dbg (dev,"decode range: node: %d range [%#llx - %#llx]\n" , +phys_to_target_node (cfmws->base_hpa), cfmws->base_hpa, + cfmws->base_hpa + cfmws->window_size -1 ); + +/* never fail cxl_acpi load for a single window failure */ +return 0 ; +} + __mock struct acpi_device *to_cxl_host_bridge(struct device *host,struct device *dev) {
Greg Kroah-Hartman
maintainerPATCH 153/299 cxl/pci: Fix disabling memory if DVSEC CXL Range does not match a CFMWS window
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robert Richter <[email protected]>
commit 0cab687205986491302cd2e440ef1d253031c221 upstream.
The Linux CXL subsystem is built on the assumption that HPA == SPA. That is, the host physical address (HPA) the HDM decoder registers are programmed with are system physical addresses (SPA).
During HDM decoder setup, the DVSEC CXL range registers (cxl-3.1, 8.1.3.8) are checked if the memory is enabled and the CXL range is in a HPA window that is described in a CFMWS structure of the CXL host bridge (cxl-3.1, 9.18.1.3).
Now, if the HPA is not an SPA, the CXL range does not match a CFMWS window and the CXL memory range will be disabled then. The HDM decoder stops working which causes system memory being disabled and further a system hang during HDM decoder initialization, typically when a CXL enabled kernel boots.
Prevent a system hang and do not disable the HDM decoder if the decoder's CXL range is not found in a CFMWS window.
Note the change only fixes a hardware hang, but does not implement HPA/SPA translation. Support for this can be added in a follow on patch series.
--- drivers/cxl/core/pci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/cxl/core/pci.c +3 -3
@@ -475,9 +475,9 @@ int cxl_hdm_decode_init(struct cxl_dev_s allowed++; } -if (!allowed) { -cxl_set_mem_enable (cxlds,0 ); - info->mem_enabled =0 ; +if (!allowed && info->mem_enabled) { +dev_err (dev,"Range register decodes outside platform defined CXL ranges.\n" ); +return -ENXIO ; }/*
Greg Kroah-Hartman
maintainerPATCH 154/299 scsi: sd: usb_storage: uas: Access media prior to querying device properties
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin K. Petersen <[email protected]>
commit 321da3dc1f3c92a12e3c5da934090d2992a8814c upstream.
It has been observed that some USB/UAS devices return generic properties hardcoded in firmware for mode pages for a period of time after a device has been discovered. The reported properties are either garbage or they do not accurately reflect the characteristics of the physical storage device attached in the case of a bridge.
Prior to commit 1e029397d12f ("scsi: sd: Reorganize DIF/DIX code to avoid calling revalidate twice") we would call revalidate several times during device discovery. As a result, incorrect values would eventually get replaced with ones accurately describing the attached storage. When we did away with the redundant revalidate pass, several cases were reported where devices reported nonsensical values or would end up in write-protected state.
An initial attempt at addressing this issue involved introducing a delayed second revalidate invocation. However, this approach still left some devices reporting incorrect characteristics.
Tasos Sahanidis debugged the problem further and identified that introducing a READ operation prior to MODE SENSE fixed the problem and that it wasn't a timing issue. Issuing a READ appears to cause the devices to update their state to reflect the actual properties of the storage media. Device properties like vendor, model, and storage capacity appear to be correctly reported from the get-go. It is unclear why these devices defer populating the remaining characteristics.
Match the behavior of a well known commercial operating system and trigger a READ operation prior to querying device characteristics to force the device to populate the mode pages.
The additional READ is triggered by a flag set in the USB storage and UAS drivers. We avoid issuing the READ for other transport classes since some storage devices identify Linux through our particular discovery command sequence.
--- drivers/scsi/sd.c | 26 +++++++++++++++++++++++++- drivers/usb/storage/scsiglue.c | 7 +++++++ drivers/usb/storage/uas.c | 7 +++++++ include/scsi/scsi_device.h | 1 + 4 files changed, 40 insertions(+), 1 deletion(-)
drivers/scsi/sd.c +25 -1
@@ -3404,6 +3404,24 @@ static bool sd_validate_opt_xfer_size(streturn true; } +static void sd_read_block_zero (struct scsi_disk *sdkp) +{ +unsigned int buf_len = sdkp->device->sector_size; +char *buffer, cmd[10 ] = { }; + + buffer =kmalloc (buf_len,GFP_KERNEL ); +if (!buffer) +return ; + + cmd[0 ] =READ_10 ; +put_unaligned_be32 (0 , &cmd[2 ]);/* Logical block address 0 */ +put_unaligned_be16 (1 , &cmd[7 ]);/* Transfer 1 logical block */ + +scsi_execute_cmd (sdkp->device, cmd,REQ_OP_DRV_IN , buffer, buf_len, +SD_TIMEOUT , sdkp->max_retries,NULL ); +kfree (buffer); +} +/** * sd_revalidate_disk - called the first time a new disk is seen, * performs disk spin up, read_capacity, etc.
@@ -3443,7 +3461,13 @@ static int sd_revalidate_disk(struct gen*/ if (sdkp->media_present) {sd_read_capacity (sdkp, buffer); - +/* +* Some USB/UAS devices return generic values for mode pages +* until the media has been accessed. Trigger a READ operation +* to force the device to populate mode pages. +*/ +if (sdp->read_before_ms) +sd_read_block_zero (sdkp);/* * set the default to rotational. All non-rotational devices * support the block characteristics VPD page, which will
drivers/usb/storage/scsiglue.c +7 -0
@@ -180,6 +180,13 @@ static int slave_configure(struct scsi_d sdev->use_192_bytes_for_3f =1 ;/* +* Some devices report generic values until the media has been +* accessed. Force a READ(10) prior to querying device +* characteristics. +*/ + sdev->read_before_ms =1 ; + +/* * Some devices don't like MODE SENSE with page=0x3f, * which is the command used for checking if a device * is write-protected. Now that we tell the sd driver
drivers/usb/storage/uas.c +7 -0
@@ -879,6 +879,13 @@ static int uas_slave_configure(struct sc sdev->guess_capacity =1 ;/* +* Some devices report generic values until the media has been +* accessed. Force a READ(10) prior to querying device +* characteristics. +*/ + sdev->read_before_ms =1 ; + +/* * Some devices don't like MODE SENSE with page=0x3f, * which is the command used for checking if a device * is write-protected. Now that we tell the sd driver
include/scsi/scsi_device.h +1 -0
@@ -208,6 +208,7 @@ struct scsi_device { unsigned use_10_for_rw:1; /* first try 10-byte read / write */ unsigned use_10_for_ms:1; /* first try 10-byte mode sense/select */ unsigned set_dbd_for_ms:1; /* Set "DBD" field in mode sense */ + unsigned read_before_ms:1; /* perform a READ before MODE SENSE */ unsigned no_report_opcodes:1; /* no REPORT SUPPORTED OPERATION CODES */ unsigned no_write_same:1; /* no WRITE SAME command */ unsigned use_16_for_rw:1; /* Use read/write(16) over read/write(10) */
Greg Kroah-Hartman
maintainerPATCH 155/299 scsi: target: pscsi: Fix bio_put() for error case
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Naohiro Aota <[email protected]>
commit de959094eb2197636f7c803af0943cb9d3b35804 upstream.
As of commit 066ff571011d ("block: turn bio_kmalloc into a simple kmalloc wrapper"), a bio allocated by bio_kmalloc() must be freed by bio_uninit() and kfree(). That is not done properly for the error case, hitting WARN and NULL pointer dereference in bio_free().
--- drivers/target/target_core_pscsi.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/target/target_core_pscsi.c +6 -3
@@ -907,12 +907,15 @@ new_bio:return 0 ; fail: -if (bio) -bio_put (bio); +if (bio) { +bio_uninit (bio); +kfree (bio); + }while (req->bio) { bio = req->bio; req->bio = bio->bi_next; -bio_put (bio); +bio_uninit (bio); +kfree (bio); } req->biotail =NULL ;return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE ;
Greg Kroah-Hartman
maintainerPATCH 156/299 scsi: core: Consult supported VPD page list prior to fetching page
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin K. Petersen <[email protected]>
commit b5fc07a5fb56216a49e6c1d0b172d5464d99a89b upstream.
Commit c92a6b5d6335 ("scsi: core: Query VPD size before getting full page") removed the logic which checks whether a VPD page is present on the supported pages list before asking for the page itself. That was done because SPC helpfully states "The Supported VPD Pages VPD page list may or may not include all the VPD pages that are able to be returned by the device server". Testing had revealed a few devices that supported some of the 0xBn pages but didn't actually list them in page 0.
Julian Sikorski bisected a problem with his drive resetting during discovery to the commit above. As it turns out, this particular drive firmware will crash if we attempt to fetch page 0xB9.
Various approaches were attempted to work around this. In the end, reinstating the logic that consults VPD page 0 before fetching any other page was the path of least resistance. A firmware update for the devices which originally compelled us to remove the check has since been released.
--- drivers/scsi/scsi.c | 22 ++++++++++++++++++++-- include/scsi/scsi_device.h | 4 ---- 2 files changed, 20 insertions(+), 6 deletions(-)
drivers/scsi/scsi.c +20 -2
@@ -328,21 +328,39 @@ static int scsi_vpd_inquiry(struct scsi_return result +4 ; } +enum scsi_vpd_parameters { +SCSI_VPD_HEADER_SIZE =4 , +SCSI_VPD_LIST_SIZE =36 , +}; +static int scsi_get_vpd_size (struct scsi_device *sdev,u8 page) { -unsigned char vpd_header[SCSI_VPD_HEADER_SIZE ]__aligned(4) ; +unsigned char vpd[SCSI_VPD_LIST_SIZE ]__aligned(4) ;int result;if (sdev->no_vpd_size)return SCSI_DEFAULT_VPD_LEN ;/* +* Fetch the supported pages VPD and validate that the requested page +* number is present. +*/ +if (page !=0 ) { + result =scsi_vpd_inquiry (sdev, vpd,0 ,sizeof (vpd)); +if (result <SCSI_VPD_HEADER_SIZE ) +return 0 ; + + result -=SCSI_VPD_HEADER_SIZE ; +if (!memchr (&vpd[SCSI_VPD_HEADER_SIZE ], page, result)) +return 0 ; + } +/* * Fetch the VPD page header to find out how big the page * is. This is done to prevent problems on legacy devices * which can not handle allocation lengths as large as * potentially requested by the caller. */ - result =scsi_vpd_inquiry (sdev, vpd_header, page,sizeof (vpd_header)); + result =scsi_vpd_inquiry (sdev, vpd, page,SCSI_VPD_HEADER_SIZE );if (result <0 )return 0 ;
include/scsi/scsi_device.h +0 -4
@@ -100,10 +100,6 @@ struct scsi_vpd {unsigned char data[]; }; -enum scsi_vpd_parameters { -SCSI_VPD_HEADER_SIZE =4 , -}; -struct scsi_device {struct Scsi_Host *host;struct request_queue *request_queue;
Greg Kroah-Hartman
maintainerPATCH 157/299 selftests/mm: uffd-unit-test check if huge page size is 0
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Terry Tritton <[email protected]>
commit 7efa6f2c803366f84c3c362f01e822490669d72b upstream.
If HUGETLBFS is not enabled then the default_huge_page_size function will return 0 and cause a divide by 0 error. Add a check to see if the huge page size is 0 and skip the hugetlb tests if it is.
--- tools/testing/selftests/mm/uffd-unit-tests.c | 6 ++++++ 1 file changed, 6 insertions(+)
tools/testing/selftests/mm/uffd-unit-tests.c +6 -0
@@ -1309,6 +1309,12 @@ int main(int argc, char *argv[])continue ;uffd_test_start ("%s on %s" , test->name, mem_type->name); +if ((mem_type->mem_flag ==MEM_HUGETLB || + mem_type->mem_flag ==MEM_HUGETLB_PRIVATE ) && + (default_huge_page_size () ==0 )) { +uffd_test_skip ("huge page size is 0, feature missing?" ); +continue ; + }if (!uffd_feature_supported (test)) {uffd_test_skip ("feature missing" );continue ;
Greg Kroah-Hartman
maintainerPATCH 158/299 mm/swap: fix race when skipping swapcache
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kairui Song <[email protected]>
commit 13ddaf26be324a7f951891ecd9ccd04466d27458 upstream.
When skipping swapcache for SWP_SYNCHRONOUS_IO, if two or more threads swapin the same entry at the same time, they get different pages (A, B). Before one thread (T0) finishes the swapin and installs page (A) to the PTE, another thread (T1) could finish swapin of page (B), swap_free the entry, then swap out the possibly modified page reusing the same entry. It breaks the pte_same check in (T0) because PTE value is unchanged, causing ABA problem. Thread (T0) will install a stalled page (A) into the PTE and cause data corruption.
One possible callstack is like this:
CPU0 CPU1 ---- ---- do_swap_page() do_swap_page() with same entry <direct swapin path> <direct swapin path> <alloc page A> <alloc page B> swap_read_folio() <- read to page A swap_read_folio() <- read to page B <slow on later locks or interrupt> <finished swapin first> ... set_pte_at()
swap_free() <- entry is free <write to page B, now page A stalled> <swap out page B to same swap entry>pte_same() <- Check pass, PTE seems
unchanged, but page A
is stalled!swap_free() <- page B content lost!set_pte_at() <- staled page A installed!
And besides, for ZRAM, swap_free() allows the swap device to discard the entry content, so even if page (B) is not modified, if swap_read_folio() on CPU0 happens later than swap_free() on CPU1, it may also cause data loss.
To fix this, reuse swapcache_prepare which will pin the swap entry using the cache flag, and allow only one thread to swap it in, also prevent any parallel code from putting the entry in the cache. Release the pin after PT unlocked.
Racers just loop and wait since it's a rare and very short event. A schedule_timeout_uninterruptible(1) call is added to avoid repeated page faults wasting too much CPU, causing livelock or adding too much noise to perf statistics. A similar livelock issue was described in commit 029c4628b2eb ("mm: swap: get rid of livelock in swapin readahead")
Reproducer:
This race issue can be triggered easily using a well constructed reproducer and patched brd (with a delay in read path) [1]:
With latest 6.8 mainline, race caused data loss can be observed easily:
$ gcc -g -lpthread test-thread-swap-race.c && ./a.out Polulating 32MB of memory region... Keep swapping out... Starting round 0... Spawning 65536 workers... 32746 workers spawned, wait for done... Round 0: Error on 0x5aa00, expected 32746, got 32743, 3 data loss! Round 0: Error on 0x395200, expected 32746, got 32743, 3 data loss! Round 0: Error on 0x3fd000, expected 32746, got 32737, 9 data loss! Round 0 Failed, 15 data loss!
This reproducer spawns multiple threads sharing the same memory region using a small swap device. Every two threads updates mapped pages one by one in opposite direction trying to create a race, with one dedicated thread keep swapping out the data out using madvise.
The reproducer created a reproduce rate of about once every 5 minutes, so the race should be totally possible in production.
After this patch, I ran the reproducer for over a few hundred rounds and no data loss observed.
Performance overhead is minimal, microbenchmark swapin 10G from 32G zram:
Before: 10934698 us After: 11157121 us Cached: 13155355 us (Dropping SWP_SYNCHRONOUS_IO flag)
--- include/linux/swap.h | 5 +++++ mm/memory.c | 20 ++++++++++++++++++++ mm/swap.h | 5 +++++ mm/swapfile.c | 13 +++++++++++++ 4 files changed, 43 insertions(+)
include/linux/swap.h +5 -0
@@ -552,6 +552,11 @@ static inline int swap_duplicate(swp_entreturn 0 ; } +static inline int swapcache_prepare (swp_entry_t swp) +{ +return 0 ; +} +static inline void swap_free (swp_entry_t swp) { }
mm/memory.c +20 -0
@@ -3726,6 +3726,7 @@ vm_fault_t do_swap_page(struct vm_faultstruct page *page;struct swap_info_struct *si =NULL ;rmap_t rmap_flags =RMAP_NONE ; +bool need_clear_cache = false;bool exclusive = false;swp_entry_t entry;pte_t pte;
@@ -3794,6 +3795,20 @@ vm_fault_t do_swap_page(struct vm_faultif (!folio) {if (data_race (si->flags &SWP_SYNCHRONOUS_IO ) &&__swap_count (entry) ==1 ) { +/* +* Prevent parallel swapin from proceeding with +* the cache flag. Otherwise, another thread may +* finish swapin first, free the entry, and swapout +* reusing the same entry. It's undetectable as +* pte_same() returns true due to entry reuse. +*/ +if (swapcache_prepare (entry)) { +/* Relax a bit to prevent rapid repeated page faults */ +schedule_timeout_uninterruptible (1 ); + goto out; + } + need_clear_cache = true; +/* skip swapcache */ folio =vma_alloc_folio (GFP_HIGHUSER_MOVABLE ,0 , vma, vmf->address, false);
@@ -4040,6 +4055,9 @@ unlock:if (vmf->pte)pte_unmap_unlock (vmf->pte, vmf->ptl); out: +/* Clear the swap cache pin for direct swapin after PTL unlock */ +if (need_clear_cache) +swapcache_clear (si, entry);if (si)put_swap_device (si);return ret;
@@ -4054,6 +4072,8 @@ out_release:folio_unlock (swapcache);folio_put (swapcache); } +if (need_clear_cache) +swapcache_clear (si, entry);if (si)put_swap_device (si);return ret;
mm/swap.h +5 -0
@@ -38,6 +38,7 @@ void __delete_from_swap_cache(struct folvoid delete_from_swap_cache (struct folio *folio);void clear_shadow_from_swap_cache (int type,unsigned long begin,unsigned long end); +void swapcache_clear (struct swap_info_struct *si,swp_entry_t entry);struct folio *swap_cache_get_folio (swp_entry_t entry,struct vm_area_struct *vma,unsigned long addr); struct folio *filemap_get_incore_folio(struct address_space *mapping,
@@ -96,6 +97,10 @@ static inline int swap_writepage(structreturn 0 ; } +static inline void swapcache_clear (struct swap_info_struct *si,swp_entry_t entry) +{ +} +static inline struct folio *swap_cache_get_folio (swp_entry_t entry,struct vm_area_struct *vma,unsigned long addr) {
mm/swapfile.c +13 -0
@@ -3362,6 +3362,19 @@ int swapcache_prepare(swp_entry_t entry)return __swap_duplicate (entry,SWAP_HAS_CACHE ); } +void swapcache_clear (struct swap_info_struct *si,swp_entry_t entry) +{ +struct swap_cluster_info *ci; +unsigned long offset =swp_offset (entry); +unsigned char usage; + + ci =lock_cluster_or_swap_info (si, offset); + usage =__swap_entry_free_locked (si, offset,SWAP_HAS_CACHE ); +unlock_cluster_or_swap_info (si, ci); +if (!usage) +free_swap_slot (entry); +} +struct swap_info_struct *swp_swap_info (swp_entry_t entry) {return swap_type_to_swap_info (swp_type (entry));
Greg Kroah-Hartman
maintainerPATCH 159/299 mm/damon/lru_sort: fix quota status loss due to online tunings
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 13d0599ab3b2ff17f798353f24bcbef1659d3cfc upstream.
For online parameters change, DAMON_LRU_SORT creates new schemes based on latest values of the parameters and replaces the old schemes with the new one. When creating it, the internal status of the quotas of the old schemes is not preserved. As a result, charging of the quota starts from zero after the online tuning. The data that collected to estimate the throughput of the scheme's action is also reset, and therefore the estimation should start from the scratch again. Because the throughput estimation is being used to convert the time quota to the effective size quota, this could result in temporal time quota inaccuracy. It would be recovered over time, though. In short, the quota accuracy could be temporarily degraded after online parameters update.
Fix the problem by checking the case and copying the internal fields for the status.
--- mm/damon/lru_sort.c | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-)
mm/damon/lru_sort.c +36 -7
@@ -183,9 +183,21 @@ static struct damos *damon_lru_sort_new_return damon_lru_sort_new_scheme (&pattern,DAMOS_LRU_DEPRIO ); } +static void damon_lru_sort_copy_quota_status (struct damos_quota *dst, +struct damos_quota *src) +{ + dst->total_charged_sz = src->total_charged_sz; + dst->total_charged_ns = src->total_charged_ns; + dst->charged_sz = src->charged_sz; + dst->charged_from = src->charged_from; + dst->charge_target_from = src->charge_target_from; + dst->charge_addr_from = src->charge_addr_from; +} +static int damon_lru_sort_apply_parameters (void ) { -struct damos *scheme; +struct damos *scheme, *hot_scheme, *cold_scheme; +struct damos *old_hot_scheme =NULL , *old_cold_scheme =NULL ;unsigned int hot_thres, cold_thres;int err =0 ;
@@ -193,18 +205,35 @@ static int damon_lru_sort_apply_parameteif (err)return err; +damon_for_each_scheme (scheme, ctx) { +if (!old_hot_scheme) { + old_hot_scheme = scheme; +continue ; + } + old_cold_scheme = scheme; + } + hot_thres =damon_max_nr_accesses (&damon_lru_sort_mon_attrs) * hot_thres_access_freq /1000 ; - scheme =damon_lru_sort_new_hot_scheme (hot_thres); -if (!scheme) + hot_scheme =damon_lru_sort_new_hot_scheme (hot_thres); +if (!hot_scheme)return -ENOMEM ; -damon_set_schemes (ctx, &scheme,1 ); +if (old_hot_scheme) +damon_lru_sort_copy_quota_status (&hot_scheme->quota, + &old_hot_scheme->quota); cold_thres = cold_min_age / damon_lru_sort_mon_attrs.aggr_interval; - scheme =damon_lru_sort_new_cold_scheme (cold_thres); -if (!scheme) + cold_scheme =damon_lru_sort_new_cold_scheme (cold_thres); +if (!cold_scheme) { +damon_destroy_scheme (hot_scheme);return -ENOMEM ; -damon_add_scheme (ctx, scheme); + } +if (old_cold_scheme) +damon_lru_sort_copy_quota_status (&cold_scheme->quota, + &old_cold_scheme->quota); + +damon_set_schemes (ctx, &hot_scheme,1 ); +damon_add_scheme (ctx, cold_scheme); return damon_set_region_biggest_system_ram_default(target, &monitor_region_start,
Greg Kroah-Hartman
maintainerPATCH 160/299 mm: memcontrol: clarify swapaccount=0 deprecation warning
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Weiner <[email protected]>
commit 118642d7f606fc9b9c92ee611275420320290ffb upstream.
The swapaccount deprecation warning is throwing false positives. Since we deprecated the knob and defaulted to enabling, the only reports we've been getting are from folks that set swapaccount=1. While this is a nice affirmation that always-enabling was the right choice, we certainly don't want to warn when users request the supported mode.
Only warn when disabling is requested, and clarify the warning.
--- mm/memcontrol.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
mm/memcontrol.c +7 -3
@@ -7613,9 +7613,13 @@ bool mem_cgroup_swap_full(struct folio *static int __init setup_swap_account (char *s) { -pr_warn_once ("The swapaccount= commandline option is deprecated. " -"Please report your usecase to [email protected] if you " -"depend on this functionality.\n" ); +bool res; + +if (!kstrtobool (s, &res) && !res) +pr_warn_once ("The swapaccount=0 commandline option is deprecated " +"in favor of configuring swap control via cgroupfs. " +"Please report your usecase to [email protected] if you " +"depend on this functionality.\n" );return 1 ; }__setup ("swapaccount=" , setup_swap_account);
Greg Kroah-Hartman
maintainerPATCH 161/299 mm/damon/reclaim: fix quota stauts loss due to online tunings
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 1b0ca4e4ff10a2c8402e2cf70132c683e1c772e4 upstream.
Patch series "mm/damon: fix quota status loss due to online tunings".
DAMON_RECLAIM and DAMON_LRU_SORT is not preserving internal quota status when applying new user parameters, and hence could cause temporal quota accuracy degradation. Fix it by preserving the status.
This patch (of 2):
For online parameters change, DAMON_RECLAIM creates new scheme based on latest values of the parameters and replaces the old scheme with the new one. When creating it, the internal status of the quota of the old scheme is not preserved. As a result, charging of the quota starts from zero after the online tuning. The data that collected to estimate the throughput of the scheme's action is also reset, and therefore the estimation should start from the scratch again. Because the throughput estimation is being used to convert the time quota to the effective size quota, this could result in temporal time quota inaccuracy. It would be recovered over time, though. In short, the quota accuracy could be temporarily degraded after online parameters update.
Fix the problem by checking the case and copying the internal fields for the status.
--- mm/damon/reclaim.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
mm/damon/reclaim.c +17 -1
@@ -148,9 +148,20 @@ static struct damos *damon_reclaim_new_s &damon_reclaim_wmarks); } +static void damon_reclaim_copy_quota_status (struct damos_quota *dst, +struct damos_quota *src) +{ + dst->total_charged_sz = src->total_charged_sz; + dst->total_charged_ns = src->total_charged_ns; + dst->charged_sz = src->charged_sz; + dst->charged_from = src->charged_from; + dst->charge_target_from = src->charge_target_from; + dst->charge_addr_from = src->charge_addr_from; +} +static int damon_reclaim_apply_parameters (void ) { -struct damos *scheme; +struct damos *scheme, *old_scheme;struct damos_filter *filter;int err =0 ;
@@ -162,6 +173,11 @@ static int damon_reclaim_apply_parameter scheme =damon_reclaim_new_scheme ();if (!scheme)return -ENOMEM ; +if (!list_empty (&ctx->schemes)) { +damon_for_each_scheme (old_scheme, ctx) +damon_reclaim_copy_quota_status (&scheme->quota, + &old_scheme->quota); + }if (skip_anon) { filter =damos_new_filter (DAMOS_FILTER_TYPE_ANON , true);if (!filter) {
Greg Kroah-Hartman
maintainerPATCH 162/299 platform/x86: intel-vbtn: Stop calling "VBDL" from notify_handler
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 84c16d01ff219bc0a5dca5219db6b8b86a6854fb upstream.
Commit 14c200b7ca46 ("platform/x86: intel-vbtn: Fix missing tablet-mode-switch events") causes 2 issues on the ThinkPad X1 Tablet Gen2:
1. The ThinkPad will wake up immediately from suspend
2. When put in tablet mode SW_TABLET_MODE reverts to 0 after about 1 second
Both these issues are caused by the "VBDL" ACPI method call added at the end of the notify_handler.
And it never became entirely clear if this call is even necessary to fix the issue of missing tablet-mode-switch events on the Dell Inspiron 7352.
Drop the "VBDL" ACPI method call again to fix the 2 issues this is causing on the ThinkPad X1 Tablet Gen2.
--- drivers/platform/x86/intel/vbtn.c | 3 --- 1 file changed, 3 deletions(-)
drivers/platform/x86/intel/vbtn.c +0 -3
@@ -200,9 +200,6 @@ static void notify_handler(acpi_handle h autorelease = val && (!ke_rel || ke_rel->type ==KE_IGNORE );sparse_keymap_report_event (input_dev, event, val, autorelease); - -/* Some devices need this to report further events */ -acpi_evaluate_object (handle,"VBDL" ,NULL ,NULL ); }/*
Greg Kroah-Hartman
maintainerPATCH 163/299 platform/x86: touchscreen_dmi: Allow partial (prefix) matches for ACPI names
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit dbcbfd662a725641d118fb3ae5ffb7be4e3d0fb0 upstream.
On some devices the ACPI name of the touchscreen is e.g. either MSSL1680:00 or MSSL1680:01 depending on the BIOS version.
This happens for example on the "Chuwi Hi8 Air" tablet where the initial commit's ts_data uses "MSSL1680:00" but the tablets from the github issue and linux-hardware.org probe linked below both use "MSSL1680:01".
Replace the strcmp() match on ts_data->acpi_name with a strstarts() check to allow using a partial match on just the ACPI HID of "MSSL1680" and change the ts_data->acpi_name for the "Chuwi Hi8 Air" accordingly to fix the touchscreen not working on models where it is "MSSL1680:01".
Note this drops the length check for I2C_NAME_SIZE. This never was necessary since the ACPI names used are never more then 11 chars and I2C_NAME_SIZE is 20 so the replaced strncmp() would always stop long before reaching I2C_NAME_SIZE.
--- drivers/platform/x86/touchscreen_dmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/touchscreen_dmi.c +2 -2
@@ -81,7 +81,7 @@ static const struct property_entry chuwi };static const struct ts_dmi_data chuwi_hi8_air_data = { - .acpi_name ="MSSL1680:00" , + .acpi_name ="MSSL1680" , .properties = chuwi_hi8_air_props, };
@@ -1821,7 +1821,7 @@ static void ts_dmi_add_props(struct i2c_int error;if (has_acpi_companion (dev) && - !strncmp (ts_data->acpi_name, client->name,I2C_NAME_SIZE )) { +strstarts (client->name, ts_data->acpi_name)) { error =device_create_managed_software_node (dev, ts_data->properties,NULL );if (error)dev_err (dev,"failed to add properties: %d\n" , error);
Greg Kroah-Hartman
maintainerPATCH 164/299 cachefiles: fix memory leak in cachefiles_add_cache()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baokun Li <[email protected]>
commit e21a2f17566cbd64926fb8f16323972f7a064444 upstream.
The following memory leak was reported after unbinding /dev/cachefiles:
==================================================================
unreferenced object 0xffff9b674176e3c0 (size 192):
comm "cachefilesd2", pid 680, jiffies 4294881224 hex dump (first 32 bytes):
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace (crc ea38a44b):
[<ffffffff8eb8a1a5>] kmem_cache_alloc+0x2d5/0x370
[<ffffffff8e917f86>] prepare_creds+0x26/0x2e0
[<ffffffffc002eeef>] cachefiles_determine_cache_security+0x1f/0x120
[<ffffffffc00243ec>] cachefiles_add_cache+0x13c/0x3a0
[<ffffffffc0025216>] cachefiles_daemon_write+0x146/0x1c0
[<ffffffff8ebc4a3b>] vfs_write+0xcb/0x520
[<ffffffff8ebc5069>] ksys_write+0x69/0xf0
[<ffffffff8f6d4662>] do_syscall_64+0x72/0x140
[<ffffffff8f8000aa>] entry_SYSCALL_64_after_hwframe+0x6e/0x76
==================================================================Put the reference count of cache_cred in cachefiles_daemon_unbind() to fix the problem. And also put cache_cred in cachefiles_add_cache() error branch to avoid memory leaks.
--- fs/cachefiles/cache.c | 2 ++ fs/cachefiles/daemon.c | 1 + 2 files changed, 3 insertions(+)
fs/cachefiles/cache.c +2 -0
@@ -168,6 +168,8 @@ error_unsupported:dput (root); error_open_root:cachefiles_end_secure (cache, saved_cred); +put_cred (cache->cache_cred); + cache->cache_cred =NULL ; error_getsec:fscache_relinquish_cache (cache_cookie); cache->cache =NULL ;
fs/cachefiles/daemon.c +1 -0
@@ -805,6 +805,7 @@ static void cachefiles_daemon_unbind(strcachefiles_put_directory (cache->graveyard);cachefiles_put_directory (cache->store);mntput (cache->mnt); +put_cred (cache->cache_cred);kfree (cache->rootdirname);kfree (cache->secctx);
Greg Kroah-Hartman
maintainerPATCH 165/299 sparc: Fix undefined reference to fb_is_primary_device
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Martinez Canillas <[email protected]>
commit ed683b9bb91fc274383e222ba5873a9ee9033462 upstream.
Commit 55bffc8170bb ("fbdev: Split frame buffer support in FB and FB_CORE symbols") added a new FB_CORE Kconfig symbol, that can be enabled to only have fbcon/VT and DRM fbdev emulation, but without support for any legacy fbdev driver.
Unfortunately, it missed to change the CONFIG_FB in arch/sparc makefiles, which leads to the following linking error in some sparc64 configurations:
sparc64-linux-ld: drivers/video/fbdev/core/fbcon.o: in function `fbcon_fb_registered':
Quoted 1 line
Quoted 1 line
fbcon.c:(.text+0x4f60): undefined reference to `fb_is_primary_device'
--- arch/sparc/Makefile | 2 +- arch/sparc/video/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/sparc/Makefile +1 -1
@@ -60,7 +60,7 @@ libs-y += arch/sparc/prom/ libs-y += arch/sparc/lib/ drivers-$(CONFIG_PM) += arch/sparc/power/ -drivers-$(CONFIG_FB) += arch/sparc/video/ +drivers-$(CONFIG_FB_CORE) += arch/sparc/video/ boot := arch/sparc/boot
arch/sparc/video/Makefile +1 -1
@@ -1,3 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only -obj-$(CONFIG_FB) += fbdev.o +obj-$(CONFIG_FB_CORE) += fbdev.o
Signature · 1 line
2.44.0
Greg Kroah-Hartman
maintainerPATCH 166/299 md: Fix missing release of active_io for flush
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
commit 855678ed8534518e2b428bcbcec695de9ba248e8 upstream.
submit_flushes
atomic_set(&mddev->flush_pending, 1);
rdev_for_each_rcu(rdev, mddev)
atomic_inc(&mddev->flush_pending);
bi->bi_end_io = md_end_flush
submit_bio(bi);
/* flush io is done first */
md_end_flush
if (atomic_dec_and_test(&mddev->flush_pending))
percpu_ref_put(&mddev->active_io)
-> active_io is not released if (atomic_dec_and_test(&mddev->flush_pending))
-> missing release of active_io
For consequence, mddev_suspend() will wait for 'active_io' to be zero forever.
Fix this problem by releasing 'active_io' in submit_flushes() if 'flush_pending' is decreased to zero.
--- drivers/md/md.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/md/md.c +5 -1
@@ -530,8 +530,12 @@ static void submit_flushes(struct work_srcu_read_lock (); }rcu_read_unlock (); -if (atomic_dec_and_test (&mddev->flush_pending)) +if (atomic_dec_and_test (&mddev->flush_pending)) { +/* The pair is percpu_ref_get() from md_flush_request() */ +percpu_ref_put (&mddev->active_io); +queue_work (md_wq, &mddev->flush_work); + } }static void md_submit_flush_data (struct work_struct *ws)
Greg Kroah-Hartman
maintainerPATCH 167/299 KVM: arm64: vgic-its: Test for valid IRQ in MOVALL handler
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Upton <[email protected]>
commit 85a71ee9a0700f6c18862ef3b0011ed9dad99aca upstream.
It is possible that an LPI mapped in a different ITS gets unmapped while handling the MOVALL command. If that is the case, there is no state that can be migrated to the destination. Silently ignore it and continue migrating other LPIs.
--- arch/arm64/kvm/vgic/vgic-its.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/kvm/vgic/vgic-its.c +2 -0
@@ -1427,6 +1427,8 @@ static int vgic_its_cmd_handle_movall(stfor (i =0 ; i < irq_count; i++) { irq =vgic_get_irq (kvm,NULL , intids[i]); +if (!irq) +continue ;update_affinity (irq, vcpu2);
Greg Kroah-Hartman
maintainerPATCH 168/299 KVM: arm64: vgic-its: Test for valid IRQ in its_sync_lpi_pending_table()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Upton <[email protected]>
commit 8d3a7dfb801d157ac423261d7cd62c33e95375f8 upstream.
vgic_get_irq() may not return a valid descriptor if there is no ITS that holds a valid translation for the specified INTID. If that is the case, it is safe to silently ignore it and continue processing the LPI pending table.
--- arch/arm64/kvm/vgic/vgic-its.c | 3 +++ 1 file changed, 3 insertions(+)
arch/arm64/kvm/vgic/vgic-its.c +3 -0
@@ -462,6 +462,9 @@ static int its_sync_lpi_pending_table(st } irq =vgic_get_irq (vcpu->kvm,NULL , intids[i]); +if (!irq) +continue ; +raw_spin_lock_irqsave (&irq->irq_lock, flags); irq->pending_latch = pendmask & (1U << bit_nr);vgic_queue_irq_unlock (vcpu->kvm, irq, flags);
Greg Kroah-Hartman
maintainerPATCH 169/299 accel/ivpu: Dont enable any tiles by default on VPU40xx
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrzej Kacprowski <[email protected]>
commit eb0d253ff9c74dee30aa92fe460b825eb28acd73 upstream.
There is no point in requesting 1 tile on VPU40xx as the FW will probably need more tiles to run workloads, so it will have to reconfigure PLL anyway. Don't enable any tiles and allow the FW to perform initial tile configuration.
This improves NPU boot stability as the tiles are always enabled only by the FW from the same initial state.
--- drivers/accel/ivpu/ivpu_hw_40xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/accel/ivpu/ivpu_hw_40xx.c +1 -1
@@ -24,7 +24,7 @@#define SKU_HW_ID_SHIFT 16u#define SKU_HW_ID_MASK 0xffff0000u -#define PLL_CONFIG_DEFAULT 0x1 +#define PLL_CONFIG_DEFAULT 0x0#define PLL_CDYN_DEFAULT 0x80#define PLL_EPP_DEFAULT 0x80#define PLL_REF_CLK_FREQ (50 * 1000000)
Signature · 1 line
2.44.0
Greg Kroah-Hartman
maintainerPATCH 170/299 gtp: fix use-after-free and null-ptr-deref in gtp_genl_dump_pdp()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasiliy Kovalev <[email protected]>
commit 136cfaca22567a03bbb3bf53a43d8cb5748b80ec upstream.
The gtp_net_ops pernet operations structure for the subsystem must be registered before registering the generic netlink family.
Syzkaller hit 'general protection fault in gtp_genl_dump_pdp' bug:
general protection fault, probably for non-canonical address
0xdffffc0000000002: 0000 [#1] PREEMPT SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000010-0x0000000000000017]
CPU: 1 PID: 5826 Comm: gtp Not tainted 6.8.0-rc3-std-def-alt1 #1
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.0-alt1 04/01/2014
RIP: 0010:gtp_genl_dump_pdp+0x1be/0x800 [gtp]
Code: c6 89 c6 e8 64 e9 86 df 58 45 85 f6 0f 85 4e 04 00 00 e8 c5 ee 86
df 48 8b 54 24 18 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 <80>
3c 02 00 0f 85 de 05 00 00 48 8b 44 24 18 4c 8b 30 4c 39 f0 74
RSP: 0018:ffff888014107220 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000002 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: ffff88800fcda588 R14: 0000000000000001 R15: 0000000000000000
FS: 00007f1be4eb05c0(0000) GS:ffff88806ce80000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f1be4e766cf CR3: 000000000c33e000 CR4: 0000000000750ef0
PKRU: 55555554
Call Trace:
<TASK>
? show_regs+0x90/0xa0
? die_addr+0x50/0xd0
? exc_general_protection+0x148/0x220
? asm_exc_general_protection+0x22/0x30
? gtp_genl_dump_pdp+0x1be/0x800 [gtp]
? __alloc_skb+0x1dd/0x350
? __pfx___alloc_skb+0x10/0x10
genl_dumpit+0x11d/0x230
netlink_dump+0x5b9/0xce0
? lockdep_hardirqs_on_prepare+0x253/0x430
? __pfx_netlink_dump+0x10/0x10
? kasan_save_track+0x10/0x40
? __kasan_kmalloc+0x9b/0xa0
? genl_start+0x675/0x970
__netlink_dump_start+0x6fc/0x9f0
genl_family_rcv_msg_dumpit+0x1bb/0x2d0
? __pfx_genl_family_rcv_msg_dumpit+0x10/0x10
? genl_op_from_small+0x2a/0x440
? cap_capable+0x1d0/0x240
? __pfx_genl_start+0x10/0x10
? __pfx_genl_dumpit+0x10/0x10
? __pfx_genl_done+0x10/0x10
? security_capable+0x9d/0xe0--- drivers/net/gtp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/gtp.c +5 -5
@@ -1907,20 +1907,20 @@ static int __init gtp_init(void)if (err <0 ) goto error_out; - err =genl_register_family (>p_genl_family); + err =register_pernet_subsys (>p_net_ops);if (err <0 ) goto unreg_rtnl_link; - err =register_pernet_subsys (>p_net_ops); + err =genl_register_family (>p_genl_family);if (err <0 ) - goto unreg_genl_family; + goto unreg_pernet_subsys;pr_info ("GTP module loaded (pdp ctx size %zd bytes)\n" ,sizeof (struct pdp_ctx ));return 0 ; -unreg_genl_family: -genl_unregister_family (>p_genl_family); +unreg_pernet_subsys: +unregister_pernet_subsys (>p_net_ops); unreg_rtnl_link:rtnl_link_unregister (>p_link_ops); error_out:
Greg Kroah-Hartman
maintainerPATCH 171/299 crypto: virtio/akcipher - Fix stack overflow on memcpy
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: zhenwei pi <[email protected]>
commit c0ec2a712daf133d9996a8a1b7ee2d4996080363 upstream.
sizeof(struct virtio_crypto_akcipher_session_para) is less than sizeof(struct virtio_crypto_op_ctrl_req::u), copying more bytes from stack variable leads stack overflow. Clang reports this issue by commands:
make -j CC=clang-14 mrproper >/dev/null 2>&1
make -j O=/tmp/crypto-build CC=clang-14 allmodconfig >/dev/null 2>&1 make -j O=/tmp/crypto-build W=1 CC=clang-14 drivers/crypto/virtio/
virtio_crypto_akcipher_algs.o
--- drivers/crypto/virtio/virtio_crypto_akcipher_algs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/crypto/virtio/virtio_crypto_akcipher_algs.c +3 -2
@@ -104,7 +104,8 @@ static void virtio_crypto_dataq_akcipher }static int virtio_crypto_alg_akcipher_init_session (struct virtio_crypto_akcipher_ctx *ctx, -struct virtio_crypto_ctrl_header *header,void *para, +struct virtio_crypto_ctrl_header *header, +struct virtio_crypto_akcipher_session_para *para,const uint8_t *key,unsigned int keylen) {struct scatterlist outhdr_sg, key_sg, inhdr_sg, *sgs[3 ];
@@ -128,7 +129,7 @@ static int virtio_crypto_alg_akcipher_in ctrl = &vc_ctrl_req->ctrl;memcpy (&ctrl->header, header,sizeof (ctrl->header)); -memcpy (&ctrl->u, para,sizeof (ctrl->u)); +memcpy (&ctrl->u.akcipher_create_session.para, para,sizeof (*para)); input = &vc_ctrl_req->input; input->status =cpu_to_le32 (VIRTIO_CRYPTO_ERR );
Greg Kroah-Hartman
maintainerPATCH 172/299 irqchip/mbigen: Dont use bus_get_dev_root() to find the parent
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Jun <[email protected]>
commit fb33a46cd75e18773dd5a414744507d84ae90870 upstream.
bus_get_dev_root() returns sp->dev_root which is set in subsys_register(), but subsys_register() is not called by platform_bus_init().
Therefor for the platform_bus_type, bus_get_dev_root() always returns NULL. This makes mbigen_of_create_domain() always return -ENODEV.
Don't try to retrieve the parent via bus_get_dev_root() and unconditionally hand a NULL pointer to of_platform_device_create() to fix this.
--- drivers/irqchip/irq-mbigen.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/irqchip/irq-mbigen.c +1 -7
@@ -235,22 +235,17 @@ static const struct irq_domain_ops mbigen_domain_ops = {static int mbigen_of_create_domain (struct platform_device *pdev,struct mbigen_device *mgn_chip) { -struct device *parent;struct platform_device *child;struct irq_domain *domain;struct device_node *np;u32 num_pins;int ret =0 ; - parent =bus_get_dev_root (&platform_bus_type); -if (!parent) -return -ENODEV ; -for_each_child_of_node (pdev->dev.of_node, np) {if (!of_property_read_bool (np,"interrupt-controller" ))continue ; - child =of_platform_device_create (np,NULL , parent); + child =of_platform_device_create (np,NULL ,NULL );if (!child) { ret = -ENOMEM ;break ;
@@ -273,7 +268,6 @@ static int mbigen_of_create_domain(struct platform_device *pdev, } } -put_device (parent);if (ret)of_node_put (np);
Signature · 1 line
2.44.0
Greg Kroah-Hartman
maintainerPATCH 173/299 irqchip/gic-v3-its: Do not assume vPE tables are preallocated
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Upton <[email protected]>
commit ec4308ecfc887128a468f03fb66b767559c57c23 upstream.
The GIC/ITS code is designed to ensure to pick up any preallocated LPI tables on the redistributors, as enabling LPIs is a one-way switch. There is no such restriction for vLPIs, and for GICv4.1 it is expected to allocate a new vPE table at boot.
This works as intended when initializing an ITS, however when setting up a redistributor in cpu_init_lpis() the early return for preallocated RD tables skips straight past the GICv4 setup. This all comes to a head when trying to kexec() into a new kernel, as the new kernel silently fails to set up GICv4, leading to a complete loss of SGIs and LPIs for KVM VMs.
Slap a band-aid on the problem by ensuring its_cpu_init_lpis() always initializes GICv4 on the way out, even if the other RD tables were preallocated.
--- drivers/irqchip/irq-gic-v3-its.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-gic-v3-its.c +1 -1
@@ -3181,6 +3181,7 @@ static void its_cpu_init_lpis(void) val |=GICR_CTLR_ENABLE_LPIS ;writel_relaxed (val, rbase +GICR_CTLR ); +out:if (gic_rdists->has_vlpis && !gic_rdists->has_rvpeid) {void __iomem *vlpi_base =gic_data_rdist_vlpi_base ();
@@ -3216,7 +3217,6 @@ static void its_cpu_init_lpis(void)/* Make sure the GIC has seen the above */ dsb (sy); -out:gic_data_rdist ()->flags |=RD_LOCAL_LPI_ENABLED ; pr_info("GICv3: CPU%d: using %s LPI pending table @%pa\n", smp_processor_id(),
Greg Kroah-Hartman
maintainerPATCH 174/299 irqchip/sifive-plic: Enable interrupt if needed before EOI
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nam Cao <[email protected]>
commit 9c92006b896c767218aabe8947b62026a571cfd0 upstream.
RISC-V PLIC cannot "end-of-interrupt" (EOI) disabled interrupts, as explained in the description of Interrupt Completion in the PLIC spec:
"The PLIC signals it has completed executing an interrupt handler by writing the interrupt ID it received from the claim to the claim/complete register. The PLIC does not check whether the completion ID is the same as the last claim ID for that target. If the completion ID does not match an interrupt source that *is currently enabled* for the target, the completion is silently ignored."
Commit 69ea463021be ("irqchip/sifive-plic: Fixup EOI failed when masked") ensured that EOI is successful by enabling interrupt first, before EOI.
Commit a1706a1c5062 ("irqchip/sifive-plic: Separate the enable and mask operations") removed the interrupt enabling code from the previous commit, because it assumes that interrupt should already be enabled at the point of EOI.
However, this is incorrect: there is a window after a hart claiming an interrupt and before irq_desc->lock getting acquired, interrupt can be disabled during this window. Thus, EOI can be invoked while the interrupt is disabled, effectively nullify this EOI. This results in the interrupt never gets asserted again, and the device who uses this interrupt appears frozen.
Make sure that interrupt is really enabled before EOI.
--- drivers/irqchip/irq-sifive-plic.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/irqchip/irq-sifive-plic.c +7 -1
@@ -148,7 +148,13 @@ static void plic_irq_eoi(struct irq_data {struct plic_handler *handler =this_cpu_ptr (&plic_handlers); -writel (d->hwirq, handler->hart_base +CONTEXT_CLAIM ); +if (unlikely (irqd_irq_disabled (d))) { +plic_toggle (handler, d->hwirq,1 ); +writel (d->hwirq, handler->hart_base +CONTEXT_CLAIM ); +plic_toggle (handler, d->hwirq,0 ); + }else { +writel (d->hwirq, handler->hart_base +CONTEXT_CLAIM ); + } }#ifdef CONFIG_SMP
Greg Kroah-Hartman
maintainerPATCH 175/299 PCI/MSI: Prevent MSI hardware interrupt number truncation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vidya Sagar <[email protected]>
commit db744ddd59be798c2627efbfc71f707f5a935a40 upstream.
While calculating the hardware interrupt number for a MSI interrupt, the higher bits (i.e. from bit-5 onwards a.k.a domain_nr >= 32) of the PCI domain number gets truncated because of the shifted value casting to return type of pci_domain_nr() which is 'int'. This for example is resulting in same hardware interrupt number for devices 0019:00:00.0 and 0039:00:00.0.
To address this cast the PCI domain number to 'irq_hw_number_t' before left shifting it to calculate the hardware interrupt number.
Please note that this fixes the issue only on 64-bit systems and doesn't change the behavior for 32-bit systems i.e. the 32-bit systems continue to have the issue. Since the issue surfaces only if there are too many PCIe controllers in the system which usually is the case in modern server systems and they don't tend to run 32-bit kernels.
--- drivers/pci/msi/irqdomain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/msi/irqdomain.c +1 -1
@@ -61,7 +61,7 @@ static irq_hw_number_t pci_msi_domain_careturn (irq_hw_number_t )desc->msi_index |pci_dev_id (dev) <<11 | - (pci_domain_nr (dev->bus) &0xFFFFFFFF ) <<27 ; + ((irq_hw_number_t)(pci_domain_nr (dev->bus) &0xFFFFFFFF )) <<27 ; } static void pci_msi_domain_set_desc(msi_alloc_info_t *arg,
Greg Kroah-Hartman
maintainerPATCH 176/299 l2tp: pass correct message length to ip6_append_data
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tom Parkin <[email protected]>
commit 359e54a93ab43d32ee1bff3c2f9f10cb9f6b6e79 upstream.
l2tp_ip6_sendmsg needs to avoid accounting for the transport header twice when splicing more data into an already partially-occupied skbuff.
To manage this, we check whether the skbuff contains data using skb_queue_empty when deciding how much data to append using ip6_append_data.
However, the code which performed the calculation was incorrect:
ulen = len + skb_queue_empty(&sk->sk_write_queue) ? transhdrlen : 0;
...due to C operator precedence, this ends up setting ulen to transhdrlen for messages with a non-zero length, which results in corrupted packets on the wire.
Add parentheses to correct the calculation in line with the original intent.
--- net/l2tp/l2tp_ip6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/l2tp/l2tp_ip6.c +1 -1
@@ -627,7 +627,7 @@ static int l2tp_ip6_sendmsg(struct sock back_from_confirm:lock_sock (sk); - ulen = len +skb_queue_empty (&sk->sk_write_queue) ? transhdrlen :0 ; + ulen = len + (skb_queue_empty (&sk->sk_write_queue) ? transhdrlen :0 ); err = ip6_append_data(sk, ip_generic_getfrag, msg, ulen, transhdrlen, &ipc6, &fl6, (struct rt6_info *)dst,
Greg Kroah-Hartman
maintainerPATCH 177/299 ARM: ep93xx: Add terminator to gpiod_lookup_table
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Shubin <[email protected]>
commit fdf87a0dc26d0550c60edc911cda42f9afec3557 upstream.
Without the terminator, if a con_id is passed to gpio_find() that does not exist in the lookup table the function will not stop looping correctly, and eventually cause an oops.
--- arch/arm/mach-ep93xx/core.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-ep93xx/core.c +1 -0
@@ -339,6 +339,7 @@ static struct gpiod_lookup_table ep93xx_ GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), GPIO_LOOKUP_IDX("G", 0, NULL, 1, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), + { } }, };
Greg Kroah-Hartman
maintainerPATCH 178/299 dm-integrity, dm-verity: reduce stack usage for recheck
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 66ad2fbcdbeab0edfd40c5d94f32f053b98c2320 upstream.
The newly added integrity_recheck() function has another larger stack allocation, just like its caller integrity_metadata(). When it gets inlined, the combination of the two exceeds the warning limit for 32-bit architectures and possibly risks an overflow when this is called from a deep call chain through a file system:
drivers/md/dm-integrity.c:1767:13: error: stack frame size (1048) exceeds limit (1024) in 'integrity_metadata' [-Werror,-Wframe-larger-than]
1767 | static void integrity_metadata(struct work_struct *w)
Since the caller at this point is done using its checksum buffer, just reuse the same buffer in the new function to avoid the double allocation.
[Mikulas: add "noinline" to integrity_recheck and verity_recheck. These functions are only called on error, so they shouldn't bloat the stack frame or code size of the caller.]
--- drivers/md/dm-integrity.c | 10 ++++------ drivers/md/dm-verity-target.c | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-)
drivers/md/dm-integrity.c +4 -6
@@ -1701,14 +1701,13 @@ failed:get_random_bytes (result, ic->tag_size); } -static void integrity_recheck (struct dm_integrity_io *dio) +static noinline void integrity_recheck(struct dm_integrity_io *dio, char *checksum) {struct bio *bio =dm_bio_from_per_bio_data (dio,sizeof (struct dm_integrity_io ));struct dm_integrity_c *ic = dio->ic;struct bvec_iter iter;struct bio_vec bv;sector_t sector, logical_sector, area, offset; -char checksum_onstack[max_t (size_t,HASH_MAX_DIGESTSIZE ,MAX_TAG_SIZE )];struct page *page;void *buffer;
@@ -1744,9 +1743,8 @@ static void integrity_recheck(struct dm_ goto free_ret; } -integrity_sector_checksum (ic, logical_sector, buffer, - checksum_onstack); - r =dm_integrity_rw_tag (ic, checksum_onstack, &dio->metadata_block, +integrity_sector_checksum (ic, logical_sector, buffer, checksum); + r =dm_integrity_rw_tag (ic, checksum, &dio->metadata_block, &dio->metadata_offset, ic->tag_size,TAG_CMP );if (r) {if (r >0 ) {
@@ -1861,7 +1859,7 @@ again: checksums_ptr - checksums, dio->op == REQ_OP_READ ? TAG_CMP : TAG_WRITE);if (unlikely (r)) {if (r >0 ) { -integrity_recheck (dio); +integrity_recheck (dio, checksums); goto skip_io; }if (likely (checksums != checksums_onstack))
drivers/md/dm-verity-target.c +2 -2
@@ -491,8 +491,8 @@ static int verity_recheck_copy(struct dmreturn 0 ; } -static int verity_recheck (struct dm_verity *v,struct dm_verity_io *io, -struct bvec_iter start,sector_t cur_block) +static noinline int verity_recheck(struct dm_verity *v, struct dm_verity_io *io, +struct bvec_iter start,sector_t cur_block) {struct page *page;void *buffer;
Greg Kroah-Hartman
maintainerPATCH 179/299 erofs: fix refcount on the metabuf used for inode lookup
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sandeep Dhavale <[email protected]>
commit 56ee7db31187dc36d501622cb5f1415e88e01c2a upstream.
In erofs_find_target_block() when erofs_dirnamecmp() returns 0, we do not assign the target metabuf. This causes the caller erofs_namei()'s erofs_put_metabuf() at the end to be not effective leaving the refcount on the page.
As the page from metabuf (buf->page) is never put, such page cannot be migrated or reclaimed. Fix it now by putting the metabuf from previous loop and assigning the current metabuf to target before returning so caller erofs_namei() can do the final put as it was intended.
--- fs/erofs/namei.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
fs/erofs/namei.c +14 -14
@@ -130,24 +130,24 @@ static void *erofs_find_target_block(str/* string comparison without already matched prefix */ diff =erofs_dirnamecmp (name, &dname, &matched); -if (!diff) { - *_ndirents =0 ; - goto out; - }else if (diff >0 ) { - head = mid +1 ; - startprfx = matched; - -if (!IS_ERR (candidate)) -erofs_put_metabuf (target); - *target = buf; - candidate = de; - *_ndirents = ndirents; - }else { +if (diff <0 ) {erofs_put_metabuf (&buf); - back = mid -1 ; endprfx = matched; +continue ; + } + +if (!IS_ERR (candidate)) +erofs_put_metabuf (target); + *target = buf; +if (!diff) { + *_ndirents =0 ; +return de; } + head = mid +1 ; + startprfx = matched; + candidate = de; + *_ndirents = ndirents;continue ; } out:/* free if the candidate is valid */
Greg Kroah-Hartman
maintainerPATCH 180/299 Revert "usb: typec: tcpm: reset counter when enter into unattached state after try role"
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ondrej Jirman <[email protected]>
commit 23b1d2d99b0f55326f05e7d757fa197c4a95dc5c upstream.
The reverted commit makes the state machine only ever go from SRC_ATTACH_WAIT to SNK_TRY in endless loop when toggling. After revert it goes to SRC_ATTACHED after initially trying SNK_TRY earlier, as it should for toggling to ever detect the power source mode and the port is again able to provide power to attached power sinks.
This reverts commit 2d6d80127006ae3da26b1f21a65eccf957f2d1e5.
--- drivers/usb/typec/tcpm/tcpm.c | 3 --- 1 file changed, 3 deletions(-)
drivers/usb/typec/tcpm/tcpm.c +0 -3
@@ -3730,9 +3730,6 @@ static void tcpm_detach(struct tcpm_portif (tcpm_port_is_disconnected (port)) port->hard_reset_count =0 ; - port->try_src_count =0 ; - port->try_snk_count =0 ; -if (!port->attached)return ;
Greg Kroah-Hartman
maintainerPATCH 181/299 serial: stm32: do not always set SER_RS485_RX_DURING_TX if RS485 is enabled
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lino Sanfilippo <[email protected]>
commit f418ae73311deb901c0110b08d1bbafc20c1820e upstream.
Before commit 07c30ea5861f ("serial: Do not hold the port lock when setting rx-during-tx GPIO") the SER_RS485_RX_DURING_TX flag was only set if the rx-during-tx mode was not controlled by a GPIO. Now the flag is set unconditionally when RS485 is enabled. This results in an incorrect setting if the rx-during-tx GPIO is not asserted.
Fix this by setting the flag only if the rx-during-tx mode is not controlled by a GPIO and thus restore the correct behaviour.
--- drivers/tty/serial/stm32-usart.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/tty/serial/stm32-usart.c +3 -1
@@ -251,7 +251,9 @@ static int stm32_usart_config_rs485(struct uart_port *port, struct ktermios *terwritel_relaxed (cr3, port->membase + ofs->cr3);writel_relaxed (cr1, port->membase + ofs->cr1); - rs485conf->flags |=SER_RS485_RX_DURING_TX ; +if (!port->rs485_rx_during_tx_gpio) + rs485conf->flags |=SER_RS485_RX_DURING_TX ; + }else {stm32_usart_clr_bits (port, ofs->cr3,USART_CR3_DEM |USART_CR3_DEP );
Signature · 1 line
2.44.0
Greg Kroah-Hartman
maintainerPATCH 182/299 serial: amba-pl011: Fix DMA transmission in RS485 mode
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lino Sanfilippo <[email protected]>
commit 3b69e32e151bc4a4e3c785cbdb1f918d5ee337ed upstream.
When DMA is used in RS485 mode make sure that the UARTs tx section is enabled before the DMA buffers are queued for transmission.
--- drivers/tty/serial/amba-pl011.c | 60 ++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 30 deletions(-)
drivers/tty/serial/amba-pl011.c +30 -30
@@ -1345,11 +1345,41 @@ static void pl011_start_tx_pio(struct ua } } +static void pl011_rs485_tx_start (struct uart_amba_port *uap) +{ +struct uart_port *port = &uap->port; +u32 cr; + +/* Enable transmitter */ + cr =pl011_read (uap,REG_CR ); + cr |=UART011_CR_TXE ; + +/* Disable receiver if half-duplex */ +if (!(port->rs485.flags &SER_RS485_RX_DURING_TX )) + cr &= ~UART011_CR_RXE ; + +if (port->rs485.flags &SER_RS485_RTS_ON_SEND ) + cr &= ~UART011_CR_RTS ; +else + cr |=UART011_CR_RTS ; + +pl011_write (cr, uap,REG_CR ); + +if (port->rs485.delay_rts_before_send) +mdelay (port->rs485.delay_rts_before_send); + + uap->rs485_tx_started = true; +} +static void pl011_start_tx (struct uart_port *port) {struct uart_amba_port *uap = container_of(port, struct uart_amba_port, port); +if ((uap->port.rs485.flags &SER_RS485_ENABLED ) && + !uap->rs485_tx_started) +pl011_rs485_tx_start (uap); +if (!pl011_dma_tx_start (uap))pl011_start_tx_pio (uap); }
@@ -1431,42 +1461,12 @@ static bool pl011_tx_char(struct uart_amreturn true; } -static void pl011_rs485_tx_start (struct uart_amba_port *uap) -{ -struct uart_port *port = &uap->port; -u32 cr; - -/* Enable transmitter */ - cr =pl011_read (uap,REG_CR ); - cr |=UART011_CR_TXE ; - -/* Disable receiver if half-duplex */ -if (!(port->rs485.flags &SER_RS485_RX_DURING_TX )) - cr &= ~UART011_CR_RXE ; - -if (port->rs485.flags &SER_RS485_RTS_ON_SEND ) - cr &= ~UART011_CR_RTS ; -else - cr |=UART011_CR_RTS ; - -pl011_write (cr, uap,REG_CR ); - -if (port->rs485.delay_rts_before_send) -mdelay (port->rs485.delay_rts_before_send); - - uap->rs485_tx_started = true; -} -/* Returns true if tx interrupts have to be (kept) enabled */ static bool pl011_tx_chars (struct uart_amba_port *uap,bool from_irq) {struct circ_buf *xmit = &uap->port.state->xmit;int count = uap->fifosize >>1 ; -if ((uap->port.rs485.flags &SER_RS485_ENABLED ) && - !uap->rs485_tx_started) -pl011_rs485_tx_start (uap); -if (uap->port.x_char) {if (!pl011_tx_char (uap, uap->port.x_char, from_irq))return true;
Greg Kroah-Hartman
maintainerPATCH 183/299 usb: dwc3: gadget: Dont disconnect if not started
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <[email protected]>
commit b191a18cb5c47109ca696370a74a5062a70adfd0 upstream.
Don't go through soft-disconnection sequence if the controller hasn't started. Otherwise, there will be timeout and warning reports from the soft-disconnection flow.
--- drivers/usb/dwc3/gadget.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/dwc3/gadget.c +5 -0
@@ -2650,6 +2650,11 @@ static int dwc3_gadget_soft_disconnect(sint ret;spin_lock_irqsave (&dwc->lock, flags); +if (!dwc->pullups_connected) { +spin_unlock_irqrestore (&dwc->lock, flags); +return 0 ; + } + dwc->connected = false;/*
Greg Kroah-Hartman
maintainerPATCH 184/299 usb: cdnsp: blocked some cdns3 specific code
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pawel Laszczak <[email protected]>
commit 18a6be674306c9acb05c08e5c3fd376ef50a917c upstream.
host.c file has some parts of code that were introduced for CDNS3 driver and should not be used with CDNSP driver.
This patch blocks using these parts of codes by CDNSP driver. These elements include:
- xhci_plat_cdns3_xhci object
- cdns3 specific XECP_PORT_CAP_REG register
- cdns3 specific XECP_AUX_CTRL_REG1 register
--- drivers/usb/cdns3/host.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/usb/cdns3/host.c +14 -2
@@ -18,6 +18,11 @@#include "../host/xhci.h" #include "../host/xhci-plat.h" +/* +* The XECP_PORT_CAP_REG and XECP_AUX_CTRL_REG1 exist only +* in Cadence USB3 dual-role controller, so it can't be used +* with Cadence CDNSP dual-role controller. +*/ #define XECP_PORT_CAP_REG 0x8000#define XECP_AUX_CTRL_REG1 0x8120
@@ -57,6 +62,8 @@ static const struct xhci_plat_priv xhci_ .resume_quirk = xhci_cdns3_resume_quirk, }; +static const struct xhci_plat_priv xhci_plat_cdnsp_xhci; +static int __cdns_host_init (struct cdns *cdns) {struct platform_device *xhci;
@@ -81,8 +88,13 @@ static int __cdns_host_init(struct cdns goto err1; } - cdns->xhci_plat_data =kmemdup (&xhci_plat_cdns3_xhci, -sizeof (struct xhci_plat_priv ),GFP_KERNEL ); +if (cdns->version <CDNSP_CONTROLLER_V2 ) + cdns->xhci_plat_data =kmemdup (&xhci_plat_cdns3_xhci, +sizeof (struct xhci_plat_priv ),GFP_KERNEL ); +else + cdns->xhci_plat_data =kmemdup (&xhci_plat_cdnsp_xhci, +sizeof (struct xhci_plat_priv ),GFP_KERNEL ); +if (!cdns->xhci_plat_data) { ret = -ENOMEM ; goto err1;
Greg Kroah-Hartman
maintainerPATCH 185/299 usb: cdnsp: fixed issue with incorrect detecting CDNSP family controllers
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pawel Laszczak <[email protected]>
commit 47625b018c6bc788bc10dd654c82696eb0a5ef11 upstream.
Cadence have several controllers from 0x000403xx family but current driver suuport detecting only one with DID equal 0x0004034E. It causes that if someone uses different CDNSP controller then driver will use incorrect version and register space.
Patch fix this issue.
--- drivers/usb/cdns3/core.c | 1 - drivers/usb/cdns3/drd.c | 13 +++++++++---- drivers/usb/cdns3/drd.h | 6 +++++- 3 files changed, 14 insertions(+), 6 deletions(-)
drivers/usb/cdns3/core.c +0 -1
@@ -395,7 +395,6 @@ pm_put:return ret; } -/** * cdns_wakeup_irq - interrupt handler for wakeup events * @irq: irq number for cdns3/cdnsp core device
drivers/usb/cdns3/drd.c +9 -4
@@ -156,7 +156,8 @@ bool cdns_is_device(struct cdns *cdns)*/ static void cdns_otg_disable_irq (struct cdns *cdns) { -writel (0 , &cdns->otg_irq_regs->ien); +if (cdns->version) +writel (0 , &cdns->otg_irq_regs->ien); }/**
@@ -422,15 +423,20 @@ int cdns_drd_init(struct cdns *cdns) cdns->otg_regs = (void __iomem *)&cdns->otg_v1_regs->cmd; -if (readl (&cdns->otg_cdnsp_regs->did) ==OTG_CDNSP_DID ) { + state =readl (&cdns->otg_cdnsp_regs->did); + +if (OTG_CDNSP_CHECK_DID (state)) { cdns->otg_irq_regs = (struct cdns_otg_irq_regs __iomem *) &cdns->otg_cdnsp_regs->ien; cdns->version =CDNSP_CONTROLLER_V2 ; - }else { + }else if (OTG_CDNS3_CHECK_DID (state)) { cdns->otg_irq_regs = (struct cdns_otg_irq_regs __iomem *) &cdns->otg_v1_regs->ien;writel (1 , &cdns->otg_v1_regs->simulate); cdns->version =CDNS3_CONTROLLER_V1 ; + }else { +dev_err (cdns->dev,"not supporte DID=0x%08x\n" , state); +return -EINVAL ; } dev_dbg(cdns->dev, "DRD version v1 (ID: %08x, rev: %08x)\n",
@@ -483,7 +489,6 @@ int cdns_drd_exit(struct cdns *cdns)return 0 ; } -/* Indicate the cdns3 core was power lost before */ bool cdns_power_is_lost (struct cdns *cdns) {
drivers/usb/cdns3/drd.h +5 -1
@@ -79,7 +79,11 @@ struct cdnsp_otg_regs {__le32 susp_timing_ctrl; }; -#define OTG_CDNSP_DID 0x0004034E +/* CDNSP driver supports 0x000403xx Cadence USB controller family. */ +#define OTG_CDNSP_CHECK_DID (did) (((did) & GENMASK(31, 8)) == 0x00040300) + +/* CDNS3 driver supports 0x000402xx Cadence USB controller family. */ +#define OTG_CDNS3_CHECK_DID (did) (((did) & GENMASK(31, 8)) == 0x00040200)/* * Common registers interface for both CDNS3 and CDNSP version of DRD.
Greg Kroah-Hartman
maintainerPATCH 186/299 usb: cdns3: fixed memory use after free at cdns3_gadget_ep_disable()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Li <[email protected]>
commit cd45f99034b0c8c9cb346dd0d6407a95ca3d36f6 upstream.
... cdns3_gadget_ep_free_request(&priv_ep->endpoint, &priv_req->request); list_del_init(&priv_req->list); ...
'priv_req' actually free at cdns3_gadget_ep_free_request(). But list_del_init() use priv_req->list after it.
[ 1542.642868][ T534] BUG: KFENCE: use-after-free read in __list_del_entry_valid+0x10/0xd4 [ 1542.642868][ T534] [ 1542.653162][ T534] Use-after-free read at 0x000000009ed0ba99 (in kfence-#3): [ 1542.660311][ T534] __list_del_entry_valid+0x10/0xd4 [ 1542.665375][ T534] cdns3_gadget_ep_disable+0x1f8/0x388 [cdns3] [ 1542.671571][ T534] usb_ep_disable+0x44/0xe4 [ 1542.675948][ T534] ffs_func_eps_disable+0x64/0xc8 [ 1542.680839][ T534] ffs_func_set_alt+0x74/0x368 [ 1542.685478][ T534] ffs_func_disable+0x18/0x28
Move list_del_init() before cdns3_gadget_ep_free_request() to resolve this problem.
--- drivers/usb/cdns3/cdns3-gadget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/cdns3/cdns3-gadget.c +1 -1
@@ -2539,11 +2539,11 @@ static int cdns3_gadget_ep_disable(strucwhile (!list_empty (&priv_ep->wa2_descmiss_req_list)) { priv_req =cdns3_next_priv_request (&priv_ep->wa2_descmiss_req_list); +list_del_init (&priv_req->list);kfree (priv_req->request.buf);cdns3_gadget_ep_free_request (&priv_ep->endpoint, &priv_req->request); -list_del_init (&priv_req->list); --priv_ep->wa2_counter; }
Greg Kroah-Hartman
maintainerPATCH 187/299 usb: cdns3: fix memory double free when handle zero packet
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Li <[email protected]>
commit 5fd9e45f1ebcd57181358af28506e8a661a260b3 upstream.
829 if (request->complete) {
830 spin_unlock(&priv_dev->lock);
831 usb_gadget_giveback_request(&priv_ep->endpoint,
832 request);
833 spin_lock(&priv_dev->lock);
834 }
835
836 if (request->buf == priv_dev->zlp_buf)
837 cdns3_gadget_ep_free_request(&priv_ep->endpoint, request);
Driver append an additional zero packet request when queue a packet, which length mod max packet size is 0. When transfer complete, run to line 831, usb_gadget_giveback_request() will free this requestion. 836 condition is true, so cdns3_gadget_ep_free_request() free this request again.
Log:
[ 1920.140696][ T150] BUG: KFENCE: use-after-free read in cdns3_gadget_giveback+0x134/0x2c0 [cdns3] [ 1920.140696][ T150] [ 1920.151837][ T150] Use-after-free read at 0x000000003d1cd10b (in kfence-#36): [ 1920.159082][ T150] cdns3_gadget_giveback+0x134/0x2c0 [cdns3] [ 1920.164988][ T150] cdns3_transfer_completed+0x438/0x5f8 [cdns3]
Add check at line 829, skip call usb_gadget_giveback_request() if it is additional zero length packet request. Needn't call usb_gadget_giveback_request() because it is allocated in this driver.
--- drivers/usb/cdns3/cdns3-gadget.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/cdns3/cdns3-gadget.c +5 -1
@@ -828,7 +828,11 @@ void cdns3_gadget_giveback(struct cdns3_return ; } -if (request->complete) { +/* +* zlp request is appended by driver, needn't call usb_gadget_giveback_request() to notify +* gadget composite driver. +*/ +if (request->complete && request->buf != priv_dev->zlp_buf) {spin_unlock (&priv_dev->lock);usb_gadget_giveback_request (&priv_ep->endpoint, request);
Greg Kroah-Hartman
maintainerPATCH 188/299 usb: gadget: ncm: Avoid dropping datagrams of properly parsed NTBs
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krishna Kurapati <[email protected]>
commit 76c51146820c5dac629f21deafab0a7039bc3ccd upstream.
It is observed sometimes when tethering is used over NCM with Windows 11 as host, at some instances, the gadget_giveback has one byte appended at the end of a proper NTB. When the NTB is parsed, unwrap call looks for any leftover bytes in SKB provided by u_ether and if there are any pending bytes, it treats them as a separate NTB and parses it. But in case the second NTB (as per unwrap call) is faulty/corrupt, all the datagrams that were parsed properly in the first NTB and saved in rx_list are dropped.
Adding a few custom traces showed the following:
[002] d..1 7828.532866: dwc3_gadget_giveback: ep1out:
req 000000003868811a length 1025/16384 zsI ==> 0
[002] d..1 7828.532867: ncm_unwrap_ntb: K: ncm_unwrap_ntb toprocess: 1025 [002] d..1 7828.532867: ncm_unwrap_ntb: K: ncm_unwrap_ntb nth: 1751999342 [002] d..1 7828.532868: ncm_unwrap_ntb: K: ncm_unwrap_ntb seq: 0xce67 [002] d..1 7828.532868: ncm_unwrap_ntb: K: ncm_unwrap_ntb blk_len: 0x400 [002] d..1 7828.532868: ncm_unwrap_ntb: K: ncm_unwrap_ntb ndp_len: 0x10 [002] d..1 7828.532869: ncm_unwrap_ntb: K: Parsed NTB with 1 frames
In this case, the giveback is of 1025 bytes and block length is 1024. The rest 1 byte (which is 0x00) won't be parsed resulting in drop of all datagrams in rx_list.
Same is case with packets of size 2048:
[002] d..1 7828.557948: dwc3_gadget_giveback: ep1out:
req 0000000011dfd96e length 2049/16384 zsI ==> 0
[002] d..1 7828.557949: ncm_unwrap_ntb: K: ncm_unwrap_ntb nth: 1751999342
[002] d..1 7828.557950: ncm_unwrap_ntb: K: ncm_unwrap_ntb blk_len: 0x800
Lecroy shows one byte coming in extra confirming that the byte is coming in from PC:
Transfer 2959 - Bytes Transferred(1025) Timestamp((18.524 843 590)
- Transaction 8391 - Data(1025 bytes) Timestamp(18.524 843 590) --- Packet 4063861
Data(1024 bytes)
Duration(2.117us) Idle(14.700ns) Timestamp(18.524 843 590)
--- Packet 4063863
Data(1 byte)
Duration(66.160ns) Time(282.000ns) Timestamp(18.524 845 722)According to Windows driver, no ZLP is needed if wBlockLength is non-zero, because the non-zero wBlockLength has already told the function side the size of transfer to be expected. However, there are in-market NCM devices that rely on ZLP as long as the wBlockLength is multiple of wMaxPacketSize. To deal with such devices, it pads an extra 0 at end so the transfer is no longer multiple of wMaxPacketSize.
--- drivers/usb/gadget/function/f_ncm.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/usb/gadget/function/f_ncm.c +9 -1
@@ -1325,7 +1325,15 @@ parse_ntb: "Parsed NTB with %d frames\n", dgram_counter); to_process -= block_len; -if (to_process !=0 ) { + +/* +* Windows NCM driver avoids USB ZLPs by adding a 1-byte +* zero pad as needed. +*/ +if (to_process ==1 && + (*(unsigned char *)(ntb_ptr + block_len) ==0x00 )) { + to_process--; + }else if (to_process >0 ) { ntb_ptr = (unsigned char *)(ntb_ptr + block_len); goto parse_ntb; }
Greg Kroah-Hartman
maintainerPATCH 189/299 usb: gadget: omap_udc: fix USB gadget regression on Palm TE
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaro Koskinen <[email protected]>
commit 858a74cb512833e276d96a72acb560ce8c138bec upstream.
When upgrading from 6.1 LTS to 6.6 LTS, I noticed the ethernet gadget stopped working on Palm TE.
Commit 8825acd7cc8a ("ARM: omap1: remove dead code") deleted Palm TE from machine_without_vbus_sense(), although the board is still used. Fix that.
--- drivers/usb/gadget/udc/omap_udc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/gadget/udc/omap_udc.c +2 -1
@@ -2036,7 +2036,8 @@ static irqreturn_t omap_udc_iso_irq(intstatic inline int machine_without_vbus_sense (void ) { -return machine_is_omap_osk () ||machine_is_sx1 (); +return machine_is_omap_osk () ||machine_is_omap_palmte () || +machine_is_sx1 (); } static int omap_udc_start(struct usb_gadget *g,
Greg Kroah-Hartman
maintainerPATCH 190/299 usb: roles: fix NULL pointer issue when put modules reference
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xu Yang <[email protected]>
commit 1c9be13846c0b2abc2480602f8ef421360e1ad9e upstream.
In current design, usb role class driver will get usb_role_switch parent's module reference after the user get usb_role_switch device and put the reference after the user put the usb_role_switch device. However, the parent device of usb_role_switch may be removed before the user put the usb_role_switch. If so, then, NULL pointer issue will be met when the user put the parent module's reference.
This will save the module pointer in structure of usb_role_switch. Then, we don't need to find module by iterating long relations.
--- drivers/usb/roles/class.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/usb/roles/class.c +11 -6
@@ -21,6 +21,7 @@ static const struct class role_class = {struct usb_role_switch {struct device dev;struct mutex lock;/* device lock*/ +struct module *module;/* the module this device depends on */ enum usb_role role;/* From descriptor */
@@ -135,7 +136,7 @@ struct usb_role_switch *usb_role_switch_ usb_role_switch_match);if (!IS_ERR_OR_NULL (sw)) -WARN_ON (!try_module_get (sw->dev.parent->driver->owner)); +WARN_ON (!try_module_get (sw->module));return sw; }
@@ -157,7 +158,7 @@ struct usb_role_switch *fwnode_usb_role_ sw =fwnode_connection_find_match (fwnode,"usb-role-switch" ,NULL , usb_role_switch_match);if (!IS_ERR_OR_NULL (sw)) -WARN_ON (!try_module_get (sw->dev.parent->driver->owner)); +WARN_ON (!try_module_get (sw->module));return sw; }
@@ -172,7 +173,7 @@ EXPORT_SYMBOL_GPL(fwnode_usb_role_switchvoid usb_role_switch_put (struct usb_role_switch *sw) {if (!IS_ERR_OR_NULL (sw)) { -module_put (sw->dev.parent->driver->owner); +module_put (sw->module);put_device (&sw->dev); } }
@@ -189,15 +190,18 @@ struct usb_role_switch * usb_role_switch_find_by_fwnode(const struct fwnode_handle *fwnode) {struct device *dev; +struct usb_role_switch *sw =NULL ;if (!fwnode)return NULL ; dev =class_find_device_by_fwnode (&role_class, fwnode); -if (dev) -WARN_ON (!try_module_get (dev->parent->driver->owner)); +if (dev) { + sw =to_role_switch (dev); +WARN_ON (!try_module_get (sw->module)); + } -return dev ?to_role_switch (dev) :NULL ; +return sw; }EXPORT_SYMBOL_GPL (usb_role_switch_find_by_fwnode);
@@ -338,6 +342,7 @@ usb_role_switch_register(struct device * sw->set = desc->set; sw->get = desc->get; + sw->module = parent->driver->owner; sw->dev.parent = parent; sw->dev.fwnode = desc->fwnode; sw->dev.class = &role_class;
Greg Kroah-Hartman
maintainerPATCH 191/299 usb: roles: dont get/set_role() when usb_role_switch is unregistered
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xu Yang <[email protected]>
commit b787a3e781759026a6212736ef8e52cf83d1821a upstream.
There is a possibility that usb_role_switch device is unregistered before the user put usb_role_switch. In this case, the user may still want to get/set_role() since the user can't sense the changes of usb_role_switch.
This will add a flag to show if usb_role_switch is already registered and avoid unwanted behaviors.
--- drivers/usb/roles/class.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/usb/roles/class.c +10 -2
@@ -23,6 +23,7 @@ struct usb_role_switch {struct mutex lock;/* device lock*/ struct module *module;/* the module this device depends on */ enum usb_role role; +bool registered;/* From descriptor */ struct device *usb2_port;
@@ -49,6 +50,9 @@ int usb_role_switch_set_role(struct usb_if (IS_ERR_OR_NULL (sw))return 0 ; +if (!sw->registered) +return -EOPNOTSUPP ; +mutex_lock (&sw->lock); ret = sw->set (sw, role);
@@ -74,7 +78,7 @@ enum usb_role usb_role_switch_get_role(s {enum usb_role role; -if (IS_ERR_OR_NULL (sw)) +if (IS_ERR_OR_NULL (sw) || !sw->registered)return USB_ROLE_NONE ;mutex_lock (&sw->lock);
@@ -357,6 +361,8 @@ usb_role_switch_register(struct device *return ERR_PTR (ret); } + sw->registered = true; +/* TODO: Symlinks for the host port and the device controller. */ return sw;
@@ -371,8 +377,10 @@ EXPORT_SYMBOL_GPL(usb_role_switch_regist*/ void usb_role_switch_unregister (struct usb_role_switch *sw) { -if (!IS_ERR_OR_NULL (sw)) +if (!IS_ERR_OR_NULL (sw)) { + sw->registered = false;device_unregister (&sw->dev); + } }EXPORT_SYMBOL_GPL (usb_role_switch_unregister);
Greg Kroah-Hartman
maintainerPATCH 192/299 mptcp: add needs_id for userspace appending addr
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geliang Tang <[email protected]>
commit 6c347be62ae963b301ead8e7fa7b9973e6e0d6e1 upstream.
When userspace PM requires to create an ID 0 subflow in "userspace pm create id 0 subflow" test like this:
userspace_pm_add_sf $ns2 10.0.3.2 0
An ID 1 subflow, in fact, is created.
Since in mptcp_pm_nl_append_new_local_addr(), 'id 0' will be treated as no ID is set by userspace, and will allocate a new ID immediately:
if (!e->addr.id)
e->addr.id = find_next_zero_bit(pernet->id_bitmap,
MPTCP_PM_MAX_ADDR_ID + 1,
1);To solve this issue, a new parameter needs_id is added for mptcp_userspace_pm_append_new_local_addr() to distinguish between whether userspace PM has set an ID 0 or whether userspace PM has not set any address.
needs_id is true in mptcp_userspace_pm_get_local_id(), but false in mptcp_pm_nl_announce_doit() and mptcp_pm_nl_subflow_create_doit().
--- net/mptcp/pm_userspace.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
net/mptcp/pm_userspace.c +7 -6
@@ -26,7 +26,8 @@ void mptcp_free_local_addr_list(struct m }static int mptcp_userspace_pm_append_new_local_addr (struct mptcp_sock *msk, -struct mptcp_pm_addr_entry *entry) +struct mptcp_pm_addr_entry *entry, +bool needs_id) {DECLARE_BITMAP (id_bitmap,MPTCP_PM_MAX_ADDR_ID +1 );struct mptcp_pm_addr_entry *match =NULL ;
@@ -41,7 +42,7 @@ static int mptcp_userspace_pm_append_newspin_lock_bh (&msk->pm.lock);list_for_each_entry (e, &msk->pm.userspace_pm_local_addr_list, list) { addr_match =mptcp_addresses_equal (&e->addr, &entry->addr, true); -if (addr_match && entry->addr.id ==0 ) +if (addr_match && entry->addr.id ==0 && needs_id) entry->addr.id = e->addr.id; id_match = (e->addr.id == entry->addr.id);if (addr_match && id_match) {
@@ -64,7 +65,7 @@ static int mptcp_userspace_pm_append_new } *e = *entry; -if (!e->addr.id) +if (!e->addr.id && needs_id) e->addr.id =find_next_zero_bit (id_bitmap,MPTCP_PM_MAX_ADDR_ID +1 ,1 );
@@ -153,7 +154,7 @@ int mptcp_userspace_pm_get_local_id(struif (new_entry.addr.port == msk_sport) new_entry.addr.port =0 ; -return mptcp_userspace_pm_append_new_local_addr (msk, &new_entry); +return mptcp_userspace_pm_append_new_local_addr (msk, &new_entry, true); }int mptcp_nl_cmd_announce (struct sk_buff *skb,struct genl_info *info)
@@ -195,7 +196,7 @@ int mptcp_nl_cmd_announce(struct sk_buff goto announce_err; } - err =mptcp_userspace_pm_append_new_local_addr (msk, &addr_val); + err =mptcp_userspace_pm_append_new_local_addr (msk, &addr_val, false);if (err <0 ) {GENL_SET_ERR_MSG (info,"did not match address and id" ); goto announce_err;
@@ -333,7 +334,7 @@ int mptcp_nl_cmd_sf_create(struct sk_buf } local.addr = addr_l; - err =mptcp_userspace_pm_append_new_local_addr (msk, &local); + err =mptcp_userspace_pm_append_new_local_addr (msk, &local, false);if (err <0 ) {GENL_SET_ERR_MSG (info,"did not match address and id" ); goto create_err;
Greg Kroah-Hartman
maintainerPATCH 193/299 mptcp: fix lockless access in subflow ULP diag
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit b8adb69a7d29c2d33eb327bca66476fb6066516b upstream.
Since the introduction of the subflow ULP diag interface, the dump callback accessed all the subflow data with lockless.
We need either to annotate all the read and write operation accordingly, or acquire the subflow socket lock. Let's do latter, even if slower, to avoid a diffstat havoc.
--- include/net/tcp.h | 2 +- net/mptcp/diag.c | 6 +++++- net/tls/tls_main.c | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-)
include/net/tcp.h +1 -1
@@ -2343,7 +2343,7 @@ struct tcp_ulp_ops {/* cleanup ulp */ void (*release)(struct sock *sk);/* diagnostic */ -int (*get_info)(const struct sock *sk,struct sk_buff *skb); +int (*get_info)(struct sock *sk,struct sk_buff *skb);size_t (*get_info_size)(const struct sock *sk);/* clone ulp */ void (*clone)(const struct request_sock *req, struct sock *newsk,
net/mptcp/diag.c +5 -1
@@ -13,17 +13,19 @@#include <uapi/linux/mptcp.h> #include "protocol.h" -static int subflow_get_info (const struct sock *sk,struct sk_buff *skb) +static int subflow_get_info (struct sock *sk,struct sk_buff *skb) {struct mptcp_subflow_context *sf;struct nlattr *start;u32 flags =0 ; +bool slow;int err; start =nla_nest_start_noflag (skb,INET_ULP_INFO_MPTCP );if (!start)return -EMSGSIZE ; + slow =lock_sock_fast (sk);rcu_read_lock (); sf =rcu_dereference (inet_csk (sk)->icsk_ulp_data);if (!sf) {
@@ -69,11 +71,13 @@ static int subflow_get_info(const struct }rcu_read_unlock (); +unlock_sock_fast (sk, slow);nla_nest_end (skb, start);return 0 ; nla_failure:rcu_read_unlock (); +unlock_sock_fast (sk, slow);nla_nest_cancel (skb, start);return err; }
net/tls/tls_main.c +1 -1
@@ -1001,7 +1001,7 @@ static u16 tls_user_config(struct tls_coreturn 0 ; } -static int tls_get_info (const struct sock *sk,struct sk_buff *skb) +static int tls_get_info (struct sock *sk,struct sk_buff *skb) {u16 version, cipher_type;struct tls_context *ctx;
Greg Kroah-Hartman
maintainerPATCH 194/299 mptcp: fix data races on local_id
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit a7cfe776637004a4c938fde78be4bd608c32c3ef upstream.
The local address id is accessed lockless by the NL PM, add all the required ONCE annotation. There is a caveat: the local id can be initialized late in the subflow life-cycle, and its validity is controlled by the local_id_valid flag.
Remove such flag and encode the validity in the local_id field itself with negative value before initialization. That allows accessing the field consistently with a single read operation.
--- net/mptcp/diag.c | 2 +- net/mptcp/pm_netlink.c | 6 +++--- net/mptcp/protocol.c | 2 +- net/mptcp/protocol.h | 15 ++++++++++++--- net/mptcp/subflow.c | 9 +++++---- 5 files changed, 22 insertions(+), 12 deletions(-)
net/mptcp/diag.c +1 -1
@@ -65,7 +65,7 @@ static int subflow_get_info(struct sock sf->map_data_len) || nla_put_u32(skb, MPTCP_SUBFLOW_ATTR_FLAGS, flags) || nla_put_u8(skb, MPTCP_SUBFLOW_ATTR_ID_REM, sf->remote_id) || - nla_put_u8(skb, MPTCP_SUBFLOW_ATTR_ID_LOC, sf->local_id)) { + nla_put_u8(skb, MPTCP_SUBFLOW_ATTR_ID_LOC, subflow_get_local_id(sf))) { err = -EMSGSIZE ; goto nla_failure; }
net/mptcp/pm_netlink.c +3 -3
@@ -800,7 +800,7 @@ static void mptcp_pm_nl_rm_addr_or_subflmptcp_for_each_subflow_safe (msk, subflow, tmp) {struct sock *ssk =mptcp_subflow_tcp_sock (subflow);int how =RCV_SHUTDOWN |SEND_SHUTDOWN ; -u8 id = subflow->local_id; +u8 id =subflow_get_local_id (subflow);if (rm_type ==MPTCP_MIB_RMADDR && subflow->remote_id != rm_id)continue ;
@@ -809,7 +809,7 @@ static void mptcp_pm_nl_rm_addr_or_subflpr_debug (" -> %s rm_list_ids[%d]=%u local_id=%u remote_id=%u mpc_id=%u" , rm_type ==MPTCP_MIB_RMADDR ?"address" :"subflow" , - i, rm_id, subflow->local_id, subflow->remote_id, + i, rm_id, id, subflow->remote_id, msk->mpc_endpoint_id);spin_unlock_bh (&msk->pm.lock);mptcp_subflow_shutdown (sk, ssk, how);
@@ -2005,7 +2005,7 @@ static int mptcp_event_add_subflow(strucif (WARN_ON_ONCE (!sf))return -EINVAL ; -if (nla_put_u8 (skb,MPTCP_ATTR_LOC_ID , sf->local_id)) +if (nla_put_u8 (skb,MPTCP_ATTR_LOC_ID ,subflow_get_local_id (sf)))return -EMSGSIZE ;if (nla_put_u8 (skb,MPTCP_ATTR_REM_ID , sf->remote_id))
net/mptcp/protocol.c +1 -1
@@ -99,7 +99,7 @@ static int __mptcp_socket_create(struct subflow->subflow_id = msk->subflow_id++;/* This is the first subflow, always with id 0 */ - subflow->local_id_valid =1 ; +WRITE_ONCE (subflow->local_id,0 );mptcp_sock_graft (msk->first, sk->sk_socket);iput (SOCK_INODE (ssock));
net/mptcp/protocol.h +12 -3
@@ -493,10 +493,9 @@ struct mptcp_subflow_context { remote_key_valid : 1, /* received the peer key from */ disposable : 1, /* ctx can be free at ulp release time */ stale : 1, /* unable to snd/rcv data, do not use for xmit */ - local_id_valid : 1, /* local_id is correctly initialized */ valid_csum_seen : 1, /* at least one csum validated */ is_mptfo : 1, /* subflow is doing TFO */ - __unused : 9; + __unused : 10;enum mptcp_data_avail data_avail;bool scheduled;u32 remote_nonce;
@@ -507,7 +506,7 @@ struct mptcp_subflow_context {u8 hmac[MPTCPOPT_HMAC_LEN ];/* MPJ subflow only */ u64 iasn;/* initial ack sequence number, MPC subflows only */ }; -u8 local_id; +s16 local_id;/* if negative not initialized yet */ u8 remote_id; u8 reset_seen:1; u8 reset_transient:1;
@@ -558,6 +557,7 @@ mptcp_subflow_ctx_reset(struct mptcp_sub {memset (&subflow->reset,0 ,sizeof (subflow->reset)); subflow->request_mptcp =1 ; +WRITE_ONCE (subflow->local_id,-1 ); } static inline u64
@@ -1008,6 +1008,15 @@ int mptcp_pm_get_local_id(struct mptcp_sint mptcp_pm_nl_get_local_id (struct mptcp_sock *msk,struct mptcp_addr_info *skc);int mptcp_userspace_pm_get_local_id (struct mptcp_sock *msk,struct mptcp_addr_info *skc); +static inline u8 subflow_get_local_id (const struct mptcp_subflow_context *subflow) +{ +int local_id =READ_ONCE (subflow->local_id); + +if (local_id <0 ) +return 0 ; +return local_id; +} +void __init mptcp_pm_nl_init (void );void mptcp_pm_nl_work (struct mptcp_sock *msk); void mptcp_pm_nl_rm_subflow_received(struct mptcp_sock *msk,
net/mptcp/subflow.c +5 -4
@@ -577,8 +577,8 @@ do_reset:static void subflow_set_local_id (struct mptcp_subflow_context *subflow,int local_id) { - subflow->local_id = local_id; - subflow->local_id_valid =1 ; +WARN_ON_ONCE (local_id <0 || local_id >255 ); +WRITE_ONCE (subflow->local_id, local_id); }static int subflow_chk_local_id (struct sock *sk)
@@ -587,7 +587,7 @@ static int subflow_chk_local_id(struct sstruct mptcp_sock *msk =mptcp_sk (subflow->conn);int err; -if (likely (subflow->local_id_valid)) +if (likely (subflow->local_id >=0 ))return 0 ; err =mptcp_pm_get_local_id (msk, (struct sock_common *)sk);
@@ -1723,6 +1723,7 @@ static struct mptcp_subflow_context *subpr_debug ("subflow=%p" , ctx); ctx->tcp_sock = sk; +WRITE_ONCE (ctx->local_id,-1 );return ctx; }
@@ -1958,7 +1959,7 @@ static void subflow_ulp_clone(const stru new_ctx->idsn = subflow_req->idsn;/* this is the first subflow, id is always 0 */ - new_ctx->local_id_valid =1 ; +subflow_set_local_id (new_ctx,0 ); }else if (subflow_req->mp_join) { new_ctx->ssn_offset = subflow_req->ssn_offset; new_ctx->mp_join =1 ;
Greg Kroah-Hartman
maintainerPATCH 195/299 mptcp: fix data races on remote_id
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit 967d3c27127e71a10ff5c083583a038606431b61 upstream.
Similar to the previous patch, address the data race on remote_id, adding the suitable ONCE annotations.
--- net/mptcp/pm_netlink.c | 8 ++++---- net/mptcp/subflow.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-)
net/mptcp/pm_netlink.c +4 -4
@@ -443,7 +443,7 @@ static unsigned int fill_remote_addressemptcp_for_each_subflow (msk, subflow) { ssk =mptcp_subflow_tcp_sock (subflow);remote_address ((struct sock_common *)ssk, &addrs[i]); - addrs[i].id = subflow->remote_id; + addrs[i].id =READ_ONCE (subflow->remote_id);if (deny_id0 && !addrs[i].id)continue ;
@@ -799,18 +799,18 @@ static void mptcp_pm_nl_rm_addr_or_subflmptcp_for_each_subflow_safe (msk, subflow, tmp) {struct sock *ssk =mptcp_subflow_tcp_sock (subflow); +u8 remote_id =READ_ONCE (subflow->remote_id);int how =RCV_SHUTDOWN |SEND_SHUTDOWN ;u8 id =subflow_get_local_id (subflow); -if (rm_type ==MPTCP_MIB_RMADDR && subflow->remote_id != rm_id) +if (rm_type ==MPTCP_MIB_RMADDR && remote_id != rm_id)continue ;if (rm_type ==MPTCP_MIB_RMSUBFLOW && !mptcp_local_id_match (msk, id, rm_id))continue ;pr_debug (" -> %s rm_list_ids[%d]=%u local_id=%u remote_id=%u mpc_id=%u" , rm_type ==MPTCP_MIB_RMADDR ?"address" :"subflow" , - i, rm_id, id, subflow->remote_id, - msk->mpc_endpoint_id); + i, rm_id, id, remote_id, msk->mpc_endpoint_id);spin_unlock_bh (&msk->pm.lock);mptcp_subflow_shutdown (sk, ssk, how);
net/mptcp/subflow.c +3 -3
@@ -535,7 +535,7 @@ static void subflow_finish_connect(struc subflow->backup = mp_opt.backup; subflow->thmac = mp_opt.thmac; subflow->remote_nonce = mp_opt.nonce; - subflow->remote_id = mp_opt.join_id; +WRITE_ONCE (subflow->remote_id, mp_opt.join_id);pr_debug ("subflow=%p, thmac=%llu, remote_nonce=%u backup=%d" , subflow, subflow->thmac, subflow->remote_nonce, subflow->backup);
@@ -1561,7 +1561,7 @@ int __mptcp_subflow_connect(struct sockpr_debug ("msk=%p remote_token=%u local_id=%d remote_id=%d" , msk, remote_token, local_id, remote_id); subflow->remote_token = remote_token; - subflow->remote_id = remote_id; +WRITE_ONCE (subflow->remote_id, remote_id); subflow->request_join =1 ; subflow->request_bkup = !!(flags &MPTCP_PM_ADDR_FLAG_BACKUP ); subflow->subflow_id = msk->subflow_id++;
@@ -1966,7 +1966,7 @@ static void subflow_ulp_clone(const stru new_ctx->fully_established =1 ; new_ctx->remote_key_valid =1 ; new_ctx->backup = subflow_req->backup; - new_ctx->remote_id = subflow_req->remote_id; +WRITE_ONCE (new_ctx->remote_id, subflow_req->remote_id); new_ctx->token = subflow_req->token; new_ctx->thmac = subflow_req->thmac;
Greg Kroah-Hartman
maintainerPATCH 196/299 mptcp: fix duplicate subflow creation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit 045e9d812868a2d80b7a57b224ce8009444b7bbc upstream.
Fullmesh endpoints could end-up unexpectedly generating duplicate subflows - same local and remote addresses - when multiple incoming ADD_ADDR are processed before the PM creates the subflow for the local endpoints.
Address the issue explicitly checking for duplicates at subflow creation time.
To avoid a quadratic computational complexity, track the unavailable remote address ids in a temporary bitmap and initialize such bitmap with the remote ids of all the existing subflows matching the local address currently processed.
The above allows additionally replacing the existing code checking for duplicate entry in the current set with a simple bit test operation.
--- net/mptcp/pm_netlink.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-)
net/mptcp/pm_netlink.c +18 -15
@@ -396,19 +396,6 @@ void mptcp_pm_free_anno_list(struct mptc } } -static bool lookup_address_in_vec (const struct mptcp_addr_info *addrs,unsigned int nr, -const struct mptcp_addr_info *addr) -{ -int i; - -for (i =0 ; i < nr; i++) { -if (addrs[i].id == addr->id) -return true; - } - -return false; -} -/* Fill all the remote addresses into the array addrs[], * and return the array size. */
@@ -440,6 +427,16 @@ static unsigned int fill_remote_addresse msk->pm.subflows++; addrs[i++] = remote; }else { +DECLARE_BITMAP (unavail_id,MPTCP_PM_MAX_ADDR_ID +1 ); + +/* Forbid creation of new subflows matching existing +* ones, possibly already created by incoming ADD_ADDR +*/ +bitmap_zero (unavail_id,MPTCP_PM_MAX_ADDR_ID +1 ); +mptcp_for_each_subflow (msk, subflow) +if (READ_ONCE (subflow->local_id) == local->id) +__set_bit (subflow->remote_id, unavail_id); +mptcp_for_each_subflow (msk, subflow) { ssk =mptcp_subflow_tcp_sock (subflow);remote_address ((struct sock_common *)ssk, &addrs[i]);
@@ -447,11 +444,17 @@ static unsigned int fill_remote_addresseif (deny_id0 && !addrs[i].id)continue ; +if (test_bit (addrs[i].id, unavail_id)) +continue ; +if (!mptcp_pm_addr_families_match (sk, local, &addrs[i]))continue ; -if (!lookup_address_in_vec (addrs, i, &addrs[i]) && - msk->pm.subflows < subflows_max) { +if (msk->pm.subflows < subflows_max) { +/* forbid creating multiple address towards +* this id +*/ +__set_bit (addrs[i].id, unavail_id); msk->pm.subflows++; i++; }
Greg Kroah-Hartman
maintainerPATCH 197/299 selftests: mptcp: userspace_pm: unique subtest names
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
commit 2ef0d804c090658960c008446523863fd7e3541e upstream.
It is important to have a unique (sub)test name in TAP, because some CI environments drop tests with duplicated names.
Some subtests from the userspace_pm selftest had the same names. That's because different subflows are created (and deleted) between the same pair of IP addresses.
Simply adding the destination port in the name is then enough to have different names, because the destination port is always different.
Note that adding such info takes a bit more space, so we need to increase a bit the width to print the name, simply to keep all the '[ OK ]' aligned as before.
--- tools/testing/selftests/net/mptcp/userspace_pm.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/net/mptcp/userspace_pm.sh +2 -2
@@ -75,7 +75,7 @@ print_test() { test_name="${1}" - _printf "%-63s" "${test_name}" + _printf "%-68s" "${test_name}" } print_results()
@@ -555,7 +555,7 @@ verify_subflow_events() local remid local info - info="${e_saddr} (${e_from}) => ${e_daddr} (${e_to})" + info="${e_saddr} (${e_from}) => ${e_daddr}:${e_dport} (${e_to})" if [ "$e_type" = "$SUB_ESTABLISHED" ] then
Greg Kroah-Hartman
maintainerPATCH 198/299 selftests: mptcp: simult flows: fix some subtest names
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
commit 4d8e0dde0403b5a86aa83e243f020711a9c3e31f upstream.
The selftest was correctly recording all the results, but the 'reverse direction' part was missing in the name when needed.
It is important to have a unique (sub)test name in TAP, because some CI environments drop tests with duplicated name.
--- tools/testing/selftests/net/mptcp/simult_flows.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/net/mptcp/simult_flows.sh +2 -1
@@ -267,7 +267,8 @@ run_test() [ $bail -eq 0 ] || exit $ret fi - printf "%-60s" "$msg - reverse direction" + msg+=" - reverse direction" + printf "%-60s" "${msg}" do_transfer $large $small $time lret=$? mptcp_lib_result_code "${lret}" "${msg}"
Greg Kroah-Hartman
maintainerPATCH 199/299 selftests: mptcp: pm nl: also list skipped tests
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
commit d2a2547565a9f1ad7989f7e21f97cbf065a9390d upstream.
If the feature is not supported by older kernels, and instead of just ignoring some tests, we should mark them as skipped, so we can still track them.
--- tools/testing/selftests/net/mptcp/pm_netlink.sh | 6 ++++++ 1 file changed, 6 insertions(+)
tools/testing/selftests/net/mptcp/pm_netlink.sh +6 -0
@@ -194,6 +194,12 @@ subflow 10.0.1.1" " (nofullmesh)" ip netns exec $ns1 ./pm_nl_ctl set id 1 flags backup,fullmesh check "ip netns exec $ns1 ./pm_nl_ctl dump" "id 1 flags \ subflow,backup,fullmesh 10.0.1.1" " (backup,fullmesh)" +else + for st in fullmesh nofullmesh backup,fullmesh; do + st=" (${st})" + printf "%-50s%s\n" "${st}" "[SKIP]" + mptcp_lib_result_skip "${st}" + done fi mptcp_lib_result_print_all_tap
Signature · 1 line
2.44.0
Greg Kroah-Hartman
maintainerPATCH 200/299 selftests: mptcp: pm nl: avoid error msg on older kernels
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
commit 662f084f3396d8a804d56cb53ac05c9e39902a7b upstream.
Since the 'Fixes' commit mentioned below, and if the kernel being tested doesn't support the 'fullmesh' flag, this error will be printed:
netlink error -22 (Invalid argument) ./pm_nl_ctl: bailing out due to netlink error[s]
But that can be normal if the kernel doesn't support the feature, no need to print this worrying error message while everything else looks OK. So we can mute stderr. Failures will still be detected if any.
--- tools/testing/selftests/net/mptcp/pm_netlink.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/mptcp/pm_netlink.sh +1 -1
@@ -183,7 +183,7 @@ check "ip netns exec $ns1 ./pm_nl_ctl dump" "id 1 flags \ subflow 10.0.1.1" " (nobackup)" # fullmesh support has been added later -ip netns exec $ns1 ./pm_nl_ctl set id 1 flags fullmesh +ip netns exec $ns1 ./pm_nl_ctl set id 1 flags fullmesh 2>/dev/null if ip netns exec $ns1 ./pm_nl_ctl dump | grep -q "fullmesh" || mptcp_lib_expect_all_features; then check "ip netns exec $ns1 ./pm_nl_ctl dump" "id 1 flags \
Signature · 1 line
2.44.0
Greg Kroah-Hartman
maintainerPATCH 201/299 selftests: mptcp: diag: check CURRESTAB counters
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geliang Tang <[email protected]>
commit 81ab772819da408977ac79c0a17d8be57283379f upstream.
This patch adds a new helper chk_msk_cestab() to check the current established connections counter MIB_CURRESTAB in diag.sh. Invoke it to check the counter during the connection after every chk_msk_inuse().
--- tools/testing/selftests/net/mptcp/diag.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
tools/testing/selftests/net/mptcp/diag.sh +16 -1
@@ -56,7 +56,7 @@ __chk_nr() local command="$1" local expected=$2 local msg="$3" - local skip="${4:-SKIP}" + local skip="${4-SKIP}" local nr nr=$(eval $command)
@@ -199,6 +199,15 @@ wait_local_port_listen() done } +# $1: cestab nr +chk_msk_cestab() +{ + local cestab=$1 + + __chk_nr "mptcp_lib_get_counter ${ns} MPTcpExtMPCurrEstab" \ + "${cestab}" "....chk ${cestab} cestab" "" +} + wait_connected() { local listener_ns="${1}"
@@ -236,9 +245,11 @@ chk_msk_nr 2 "after MPC handshake " chk_msk_remote_key_nr 2 "....chk remote_key" chk_msk_fallback_nr 0 "....chk no fallback" chk_msk_inuse 2 "....chk 2 msk in use" +chk_msk_cestab 2 flush_pids chk_msk_inuse 0 "....chk 0 msk in use after flush" +chk_msk_cestab 0 echo "a" | \ timeout ${timeout_test} \
@@ -254,9 +265,11 @@ echo "b" | \ wait_connected $ns 10001 chk_msk_fallback_nr 1 "check fallback" chk_msk_inuse 1 "....chk 1 msk in use" +chk_msk_cestab 1 flush_pids chk_msk_inuse 0 "....chk 0 msk in use after flush" +chk_msk_cestab 0 NR_CLIENTS=100 for I in `seq 1 $NR_CLIENTS`; do
@@ -278,9 +291,11 @@ done wait_msk_nr $((NR_CLIENTS*2)) "many msk socket present" chk_msk_inuse $((NR_CLIENTS*2)) "....chk many msk in use" +chk_msk_cestab $((NR_CLIENTS*2)) flush_pids chk_msk_inuse 0 "....chk 0 msk in use after flush" +chk_msk_cestab 0 mptcp_lib_result_print_all_tap exit $ret
Greg Kroah-Hartman
maintainerPATCH 202/299 selftests: mptcp: diag: fix bash warnings on older kernels
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
commit 694bd45980a61045eb5ec07799e3b94c76db830e upstream.
Since the 'Fixes' commit mentioned below, the command that is executed in __chk_nr() helper can return nothing if the feature is not supported. This is the case when the MPTCP CURRESTAB counter is not supported.
To avoid this warning ...
./diag.sh: line 65: [: !=: unary operator expected
... we just need to surround '$nr' with double quotes, to support an empty string when the feature is not supported.
--- tools/testing/selftests/net/mptcp/diag.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/net/mptcp/diag.sh +2 -2
@@ -62,8 +62,8 @@ __chk_nr() nr=$(eval $command) printf "%-50s" "$msg" - if [ $nr != $expected ]; then - if [ $nr = "$skip" ] && ! mptcp_lib_expect_all_features; then + if [ "$nr" != "$expected" ]; then + if [ "$nr" = "$skip" ] && ! mptcp_lib_expect_all_features; then echo "[ skip ] Feature probably not supported" mptcp_lib_result_skip "${msg}" else
Greg Kroah-Hartman
maintainerPATCH 203/299 selftests: mptcp: diag: unique in use subtest names
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
commit 645c1dc965ef6b5554e5e69737bb179c7a0f872f upstream.
It is important to have a unique (sub)test name in TAP, because some CI environments drop tests with duplicated name.
Some 'in use' subtests from the diag selftest had the same names, e.g.:
chk 0 msk in use after flush
Now the previous value is taken, to have different names, e.g.:
chk 2->0 msk in use after flush
While at it, avoid repeating the full message, declare it once in the helper.
--- tools/testing/selftests/net/mptcp/diag.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
tools/testing/selftests/net/mptcp/diag.sh +12 -8
@@ -166,9 +166,13 @@ chk_msk_listen() chk_msk_inuse() { local expected=$1 - local msg="$2" + local msg="....chk ${2:-${expected}} msk in use" local listen_nr + if [ "${expected}" -eq 0 ]; then + msg+=" after flush" + fi + listen_nr=$(ss -N "${ns}" -Ml | grep -c LISTEN) expected=$((expected + listen_nr))
@@ -179,7 +183,7 @@ chk_msk_inuse() sleep 0.1 done - __chk_nr get_msk_inuse $expected "$msg" 0 + __chk_nr get_msk_inuse $expected "${msg}" 0 } # $1: ns, $2: port
@@ -244,11 +248,11 @@ wait_connected $ns 10000 chk_msk_nr 2 "after MPC handshake " chk_msk_remote_key_nr 2 "....chk remote_key" chk_msk_fallback_nr 0 "....chk no fallback" -chk_msk_inuse 2 "....chk 2 msk in use" +chk_msk_inuse 2 chk_msk_cestab 2 flush_pids -chk_msk_inuse 0 "....chk 0 msk in use after flush" +chk_msk_inuse 0 "2->0" chk_msk_cestab 0 echo "a" | \
@@ -264,11 +268,11 @@ echo "b" | \ 127.0.0.1 >/dev/null & wait_connected $ns 10001 chk_msk_fallback_nr 1 "check fallback" -chk_msk_inuse 1 "....chk 1 msk in use" +chk_msk_inuse 1 chk_msk_cestab 1 flush_pids -chk_msk_inuse 0 "....chk 0 msk in use after flush" +chk_msk_inuse 0 "1->0" chk_msk_cestab 0 NR_CLIENTS=100
@@ -290,11 +294,11 @@ for I in `seq 1 $NR_CLIENTS`; do done wait_msk_nr $((NR_CLIENTS*2)) "many msk socket present" -chk_msk_inuse $((NR_CLIENTS*2)) "....chk many msk in use" +chk_msk_inuse $((NR_CLIENTS*2)) "many" chk_msk_cestab $((NR_CLIENTS*2)) flush_pids -chk_msk_inuse 0 "....chk 0 msk in use after flush" +chk_msk_inuse 0 "many->0" chk_msk_cestab 0 mptcp_lib_result_print_all_tap
Greg Kroah-Hartman
maintainerPATCH 204/299 selftests: mptcp: diag: unique cestab subtest names
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
commit 4103d8480866fe5abb71ef0ed8af3a3b7b9625bf upstream.
It is important to have a unique (sub)test name in TAP, because some CI environments drop tests with duplicated name.
Some 'cestab' subtests from the diag selftest had the same names, e.g.:
....chk 0 cestab
Now the previous value is taken, to have different names, e.g.:
....chk 2->0 cestab after flush
While at it, the 'after flush' info is added, similar to what is done with the 'in use' subtests. Also inspired by these 'in use' subtests, 'many' is displayed instead of a large number:
many msk socket present [ ok ]
....chk many msk in use [ ok ]
....chk many cestab [ ok ]
....chk many->0 msk in use after flush [ ok ]
....chk many->0 cestab after flush [ ok ]--- tools/testing/selftests/net/mptcp/diag.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
tools/testing/selftests/net/mptcp/diag.sh +11 -6
@@ -206,10 +206,15 @@ wait_local_port_listen() # $1: cestab nr chk_msk_cestab() { - local cestab=$1 + local expected=$1 + local msg="....chk ${2:-${expected}} cestab" + + if [ "${expected}" -eq 0 ]; then + msg+=" after flush" + fi __chk_nr "mptcp_lib_get_counter ${ns} MPTcpExtMPCurrEstab" \ - "${cestab}" "....chk ${cestab} cestab" "" + "${expected}" "${msg}" "" } wait_connected()
@@ -253,7 +258,7 @@ chk_msk_cestab 2 flush_pids chk_msk_inuse 0 "2->0" -chk_msk_cestab 0 +chk_msk_cestab 0 "2->0" echo "a" | \ timeout ${timeout_test} \
@@ -273,7 +278,7 @@ chk_msk_cestab 1 flush_pids chk_msk_inuse 0 "1->0" -chk_msk_cestab 0 +chk_msk_cestab 0 "1->0" NR_CLIENTS=100 for I in `seq 1 $NR_CLIENTS`; do
@@ -295,11 +300,11 @@ done wait_msk_nr $((NR_CLIENTS*2)) "many msk socket present" chk_msk_inuse $((NR_CLIENTS*2)) "many" -chk_msk_cestab $((NR_CLIENTS*2)) +chk_msk_cestab $((NR_CLIENTS*2)) "many" flush_pids chk_msk_inuse 0 "many->0" -chk_msk_cestab 0 +chk_msk_cestab 0 "many->0" mptcp_lib_result_print_all_tap exit $ret
Greg Kroah-Hartman
maintainerPATCH 205/299 smb3: add missing null server pointer check
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit 45be0882c5f91e1b92e645001dd1a53b3bd58c97 upstream.
Address static checker warning in cifs_ses_get_chan_index():
warn: variable dereferenced before check 'server'
To be consistent, and reduce risk, we should add another check for null server pointer.
--- fs/smb/client/sess.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/client/sess.c +1 -1
@@ -76,7 +76,7 @@ cifs_ses_get_chan_index(struct cifs_sesunsigned int i;/* if the channel is waiting for termination */ -if (server->terminate) +if (server && server->terminate)return CIFS_INVAL_CHAN_INDEX ;for (i =0 ; i < ses->chan_count; i++) {
Greg Kroah-Hartman
maintainerPATCH 206/299 drm/amd/display: Avoid enum conversion warning
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit d7643fe6fb76edb1f2f1497bf5e8b8f4774b5129 upstream.
Clang warns (or errors with CONFIG_WERROR=y) when performing arithmetic with different enumerated types, which is usually a bug:
drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_dp_dpia_bw.c:548:24: error: arithmetic between different enumeration types ('const enum dc_link_rate' and 'const enum dc_lane_count') [-Werror,-Wenum-enum-conversion]
548 | link_cap->link_rate * link_cap->lane_count * LINK_RATE_REF_FREQ_IN_KHZ * 8;
| ~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~
1 error generated.
In this case, there is not a problem because the enumerated types are basically treated as '#define' values. Add an explicit cast to an integral type to silence the warning.
--- drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c +3 -2
@@ -544,8 +544,9 @@ int link_dp_dpia_get_dp_overhead_in_dp_t*/ const struct dc_link_settings *link_cap =dc_link_get_link_cap (link); -uint32_t link_bw_in_kbps = - link_cap->link_rate * link_cap->lane_count *LINK_RATE_REF_FREQ_IN_KHZ *8 ; +uint32_t link_bw_in_kbps = (uint32_t )link_cap->link_rate * + (uint32_t )link_cap->lane_count * +LINK_RATE_REF_FREQ_IN_KHZ *8 ; link_mst_overhead = (link_bw_in_kbps /64 ) + ((link_bw_in_kbps %64 ) ?1 :0 ); }
Greg Kroah-Hartman
maintainerPATCH 207/299 drm/amd/display: Fix buffer overflow in get_host_router_total_dp_tunnel_bw()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivasan Shanmugam <[email protected]>
commit 97cba232549b9fe7e491fb60a69cf93075015f29 upstream.
The error message buffer overflow 'dc->links' 12 <= 12 suggests that the code is trying to access an element of the dc->links array that is beyond its bounds. In C, arrays are zero-indexed, so an array with 12 elements has valid indices from 0 to 11. Trying to access dc->links[12] would be an attempt to access the 13th element of a 12-element array, which is a buffer overflow.
To fix this, ensure that the loop does not go beyond the last valid index when accessing dc->links[i + 1] by subtracting 1 from the loop condition.
This would ensure that i + 1 is always a valid index in the array.
Fixes the below:drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_dp_dpia_bw.c:208 get_host_router_total_dp_tunnel_bw() error: buffer overflow 'dc->links' 12 <= 12
--- drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c +1 -1
@@ -196,7 +196,7 @@ static int get_host_router_total_dp_tunnstruct dc_link *link_dpia_primary, *link_dpia_secondary;int total_bw =0 ; -for (uint8_t i =0 ; i <MAX_PIPES *2 ; ++i) { +for (uint8_t i =0 ; i < (MAX_PIPES *2 ) -1 ; ++i) {if (!dc->links[i] || dc->links[i]->ep_type !=DISPLAY_ENDPOINT_USB4_DPIA )continue ;
Greg Kroah-Hartman
maintainerPATCH 208/299 Revert "drm/amd/display: increased min_dcfclk_mhz and min_fclk_mhz"
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sohaib Nadeem <[email protected]>
commit a538dabf772c169641e151834e161e241802ab33 upstream.
[why]:
This reverts commit 2ff33c759a4247c84ec0b7815f1f223e155ba82a.
The commit caused corruption when running some applications in fullscreen
--- drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c +1 -1
@@ -2452,7 +2452,7 @@ static int build_synthetic_soc_states(bostruct _vcs_dpi_voltage_scaling_st entry = {0 };struct clk_limit_table_entry max_clk_data = {0 }; -unsigned int min_dcfclk_mhz =399 , min_fclk_mhz =599 ; +unsigned int min_dcfclk_mhz =199 , min_fclk_mhz =299 ;static const unsigned int num_dcfclk_stas =5 ;unsigned int dcfclk_sta_targets[DC__VOLTAGE_STATES ] = {199 ,615 ,906 ,1324 ,1564 };
Greg Kroah-Hartman
maintainerPATCH 209/299 xen/events: fix error code in xen_bind_pirq_msi_to_irq()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 7f3da4b698bcc21a6df0e7f114af71d53a3e26ac upstream.
Return -ENOMEM if xen_irq_init() fails. currently the code returns an uninitialized variable or zero.
--- drivers/xen/events/events_base.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/xen/events/events_base.c +3 -1
@@ -1099,8 +1099,10 @@ int xen_bind_pirq_msi_to_irq(struct pci_for (i =0 ; i < nvec; i++) { info =xen_irq_init (irq + i); -if (!info) +if (!info) { + ret = -ENOMEM ; goto error_irq; + }irq_set_chip_and_handler_name (irq + i, &xen_pirq_chip, handle_edge_irq, name);
Greg Kroah-Hartman
maintainerPATCH 210/299 bpf: Derive source IP addr via bpf_*_fib_lookup()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martynas Pumputis <[email protected]>
commit dab4e1f06cabb6834de14264394ccab197007302 upstream.
Extend the bpf_fib_lookup() helper by making it to return the source IPv4/IPv6 address if the BPF_FIB_LOOKUP_SRC flag is set.
For example, the following snippet can be used to derive the desired source IP address:
struct bpf_fib_lookup p = { .ipv4_dst = ip4->daddr };
ret = bpf_skb_fib_lookup(skb, p, sizeof(p),
BPF_FIB_LOOKUP_SRC | BPF_FIB_LOOKUP_SKIP_NEIGH);
if (ret != BPF_FIB_LKUP_RET_SUCCESS)
return TC_ACT_SHOT;
/* the p.ipv4_src now contains the source address */The inability to derive the proper source address may cause malfunctions in BPF-based dataplanes for hosts containing netdevs with more than one routable IP address or for multi-homed hosts.
For example, Cilium implements packet masquerading in BPF. If an egressing netdev to which the Cilium's BPF prog is attached has multiple IP addresses, then only one [hardcoded] IP address can be used for masquerading. This breaks connectivity if any other IP address should have been selected instead, for example, when a public and private addresses are attached to the same egress interface.
The change was tested with Cilium [1].
Nikolay Aleksandrov helped to figure out the IPv6 addr selection.
[1]: https://github.com/cilium/cilium/pull/28283
--- include/net/ipv6_stubs.h | 5 +++++ include/uapi/linux/bpf.h | 10 ++++++++++ net/core/filter.c | 18 +++++++++++++++++- net/ipv6/af_inet6.c | 1 + tools/include/uapi/linux/bpf.h | 10 ++++++++++ 5 files changed, 43 insertions(+), 1 deletion(-)
include/net/ipv6_stubs.h +5 -0
@@ -85,6 +85,11 @@ struct ipv6_bpf_stub { sockptr_t optval, unsigned int optlen);int (*ipv6_getsockopt)(struct sock *sk,int level,int optname,sockptr_t optval,sockptr_t optlen); +int (*ipv6_dev_get_saddr)(struct net *net, +const struct net_device *dst_dev, +const struct in6_addr *daddr, +unsigned int prefs, +struct in6_addr *saddr); };extern const struct ipv6_bpf_stub *ipv6_bpf_stub__read_mostly ;
include/uapi/linux/bpf.h +10 -0
@@ -3257,6 +3257,11 @@ union bpf_attr {* and *params*->smac will not be set as output. A common * use case is to call **bpf_redirect_neigh**\ () after * doing **bpf_fib_lookup**\ (). +* **BPF_FIB_LOOKUP_SRC** +* Derive and set source IP addr in *params*->ipv{4,6}_src +* for the nexthop. If the src addr cannot be derived, +* **BPF_FIB_LKUP_RET_NO_SRC_ADDR** is returned. In this +* case, *params*->dmac and *params*->smac are not set either. * * *ctx* is either **struct xdp_md** for XDP programs or * **struct sk_buff** tc cls_act programs.
@@ -6956,6 +6961,7 @@ enum {BPF_FIB_LOOKUP_OUTPUT = (1U <<1 ),BPF_FIB_LOOKUP_SKIP_NEIGH = (1U <<2 ),BPF_FIB_LOOKUP_TBID = (1U <<3 ), + BPF_FIB_LOOKUP_SRC = (1U << 4), }; enum {
@@ -6968,6 +6974,7 @@ enum {BPF_FIB_LKUP_RET_UNSUPP_LWT ,/* fwd requires encapsulation */ BPF_FIB_LKUP_RET_NO_NEIGH ,/* no neighbor entry for nh */ BPF_FIB_LKUP_RET_FRAG_NEEDED ,/* fragmentation required to fwd */ + BPF_FIB_LKUP_RET_NO_SRC_ADDR, /* failed to derive IP src addr */ }; struct bpf_fib_lookup {
@@ -7002,6 +7009,9 @@ struct bpf_fib_lookup {__u32 rt_metric; }; +/* input: source address to consider for lookup +* output: source address result from lookup +*/ union {__be32 ipv4_src;__u32 ipv6_src[4 ];/* in6_addr; network order */
net/core/filter.c +17 -1
@@ -5903,6 +5903,9 @@ static int bpf_ipv4_fib_lookup(struct ne params->rt_metric = res.fi->fib_priority; params->ifindex = dev->ifindex; +if (flags &BPF_FIB_LOOKUP_SRC ) + params->ipv4_src =fib_result_prefsrc (net, &res); +/* xdp and cls_bpf programs are run in RCU-bh so * rcu_read_lock_bh is not needed here */
@@ -6045,6 +6048,18 @@ static int bpf_ipv6_fib_lookup(struct ne params->rt_metric = res.f6i->fib6_metric; params->ifindex = dev->ifindex; +if (flags &BPF_FIB_LOOKUP_SRC ) { +if (res.f6i->fib6_prefsrc.plen) { + *src = res.f6i->fib6_prefsrc.addr; + }else { + err = ipv6_bpf_stub->ipv6_dev_get_saddr (net, dev, + &fl6.daddr,0 , + src); +if (err) +return BPF_FIB_LKUP_RET_NO_SRC_ADDR ; + } + } +if (flags &BPF_FIB_LOOKUP_SKIP_NEIGH ) goto set_fwd_params;
@@ -6063,7 +6078,8 @@ set_fwd_params:#endif #define BPF_FIB_LOOKUP_MASK (BPF_FIB_LOOKUP_DIRECT | BPF_FIB_LOOKUP_OUTPUT | \ - BPF_FIB_LOOKUP_SKIP_NEIGH | BPF_FIB_LOOKUP_TBID) + BPF_FIB_LOOKUP_SKIP_NEIGH | BPF_FIB_LOOKUP_TBID | \ + BPF_FIB_LOOKUP_SRC) BPF_CALL_4(bpf_xdp_fib_lookup, struct xdp_buff *, ctx, struct bpf_fib_lookup *, params, int, plen, u32, flags)
net/ipv6/af_inet6.c +1 -0
@@ -1064,6 +1064,7 @@ static const struct ipv6_bpf_stub ipv6_b .udp6_lib_lookup = __udp6_lib_lookup, .ipv6_setsockopt = do_ipv6_setsockopt, .ipv6_getsockopt = do_ipv6_getsockopt, + .ipv6_dev_get_saddr = ipv6_dev_get_saddr, };static int __init inet6_init (void )
tools/include/uapi/linux/bpf.h +10 -0
@@ -3257,6 +3257,11 @@ union bpf_attr {* and *params*->smac will not be set as output. A common * use case is to call **bpf_redirect_neigh**\ () after * doing **bpf_fib_lookup**\ (). +* **BPF_FIB_LOOKUP_SRC** +* Derive and set source IP addr in *params*->ipv{4,6}_src +* for the nexthop. If the src addr cannot be derived, +* **BPF_FIB_LKUP_RET_NO_SRC_ADDR** is returned. In this +* case, *params*->dmac and *params*->smac are not set either. * * *ctx* is either **struct xdp_md** for XDP programs or * **struct sk_buff** tc cls_act programs.
@@ -6956,6 +6961,7 @@ enum {BPF_FIB_LOOKUP_OUTPUT = (1U <<1 ),BPF_FIB_LOOKUP_SKIP_NEIGH = (1U <<2 ),BPF_FIB_LOOKUP_TBID = (1U <<3 ), + BPF_FIB_LOOKUP_SRC = (1U << 4), }; enum {
@@ -6968,6 +6974,7 @@ enum {BPF_FIB_LKUP_RET_UNSUPP_LWT ,/* fwd requires encapsulation */ BPF_FIB_LKUP_RET_NO_NEIGH ,/* no neighbor entry for nh */ BPF_FIB_LKUP_RET_FRAG_NEEDED ,/* fragmentation required to fwd */ + BPF_FIB_LKUP_RET_NO_SRC_ADDR, /* failed to derive IP src addr */ }; struct bpf_fib_lookup {
@@ -7002,6 +7009,9 @@ struct bpf_fib_lookup {__u32 rt_metric; }; +/* input: source address to consider for lookup +* output: source address result from lookup +*/ union {__be32 ipv4_src;__u32 ipv6_src[4 ];/* in6_addr; network order */
Greg Kroah-Hartman
maintainerPATCH 211/299 IB/hfi1: Fix a memleak in init_credit_return
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhipeng Lu <[email protected]>
[ Upstream commit 809aa64ebff51eb170ee31a95f83b2d21efa32e2 ]
When dma_alloc_coherent fails to allocate dd->cr_base[i].va, init_credit_return should deallocate dd->cr_base and dd->cr_base[i] that allocated before. Or those resources would be never freed and a memleak is triggered.
--- drivers/infiniband/hw/hfi1/pio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/infiniband/hw/hfi1/pio.c +5 -1
@@ -2086,7 +2086,7 @@ int init_credit_return(struct hfi1_devdata *dd)"Unable to allocate credit return DMA range for NUMA %d\n" , i); ret = -ENOMEM ; - goto done; + goto free_cr_base; } }set_dev_node (&dd->pcidev->dev, dd->node);
@@ -2094,6 +2094,10 @@ int init_credit_return(struct hfi1_devdata *dd) ret =0 ; done:return ret; + +free_cr_base: +free_credit_return (dd); + goto done; }void free_credit_return (struct hfi1_devdata *dd)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 212/299 RDMA/bnxt_re: Return error for SRQ resize
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kalesh AP <[email protected]>
[ Upstream commit 3687b450c5f32e80f179ce4b09e0454da1449eac ]
SRQ resize is not supported in the driver. But driver is not returning error from bnxt_re_modify_srq() for SRQ resize.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +2 -3
@@ -1809,7 +1809,7 @@ int bnxt_re_modify_srq(struct ib_srq *ib_srq, struct ib_srq_attr *srq_attr,switch (srq_attr_mask) {case IB_SRQ_MAX_WR :/* SRQ resize is not supported */ -break ; +return -EINVAL ;case IB_SRQ_LIMIT :/* Change the SRQ threshold */ if (srq_attr->srq_limit > srq->qplib_srq.max_wqe)
@@ -1824,13 +1824,12 @@ int bnxt_re_modify_srq(struct ib_srq *ib_srq, struct ib_srq_attr *srq_attr,/* On success, update the shadow */ srq->srq_limit = srq_attr->srq_limit;/* No need to Build and send response back to udata */ -break ; +return 0 ;default :ibdev_err (&rdev->ibdev,"Unsupported srq_attr_mask 0x%x" , srq_attr_mask);return -EINVAL ; } -return 0 ; }int bnxt_re_query_srq (struct ib_srq *ib_srq,struct ib_srq_attr *srq_attr)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 213/299 RDMA/bnxt_re: Add a missing check in bnxt_qplib_query_srq
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kalesh AP <[email protected]>
[ Upstream commit 80dde187f734cf9ccf988d5c2ef1a46b990660fd ]
Before populating the response, driver has to check the status of HWRM command.
--- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/bnxt_re/qplib_fp.c +2 -1
@@ -748,7 +748,8 @@ int bnxt_qplib_query_srq(struct bnxt_qplib_res *res,bnxt_qplib_fill_cmdqmsg (&msg, &req, &resp, &sbuf,sizeof (req),sizeof (resp),0 ); rc =bnxt_qplib_rcfw_send_message (rcfw, &msg); - srq->threshold =le16_to_cpu (sb->srq_limit); +if (!rc) + srq->threshold =le16_to_cpu (sb->srq_limit);dma_free_coherent (&rcfw->pdev->dev, sbuf.size, sbuf.sb, sbuf.dma_addr);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 214/299 IB/mlx5: Dont expose debugfs entries for RRoCE general parameters if not supported
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Zhang <[email protected]>
[ Upstream commit 43fdbd140238d44e7e847232719fef7d20f9d326 ]
debugfs entries for RRoCE general CC parameters must be exposed only when they are supported, otherwise when accessing them there may be a syndrome error in kernel log, for example:
$ cat /sys/kernel/debug/mlx5/0000:08:00.1/cc_params/rtt_resp_dscp cat: '/sys/kernel/debug/mlx5/0000:08:00.1/cc_params/rtt_resp_dscp': Invalid argument $ dmesg mlx5_core 0000:08:00.1: mlx5_cmd_out_err:805:(pid 1253): QUERY_CONG_PARAMS(0x824) op_mod(0x0) failed, status bad parameter(0x3), syndrome (0x325a82), err(-22)
--- drivers/infiniband/hw/mlx5/cong.c | 6 ++++++ include/linux/mlx5/mlx5_ifc.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/cong.c +6 -0
@@ -458,6 +458,12 @@ void mlx5_ib_init_cong_debugfs(struct mlx5_ib_dev *dev, u32 port_num) dbg_cc_params->root =debugfs_create_dir ("cc_params" ,mlx5_debugfs_get_dev_root (mdev));for (i =0 ; i <MLX5_IB_DBG_CC_MAX ; i++) { +if ((i ==MLX5_IB_DBG_CC_GENERAL_RTT_RESP_DSCP_VALID || + i ==MLX5_IB_DBG_CC_GENERAL_RTT_RESP_DSCP )) +if (!MLX5_CAP_GEN (mdev, roce) || + !MLX5_CAP_ROCE (mdev, roce_cc_general)) +continue ; + dbg_cc_params->params[i].offset = i; dbg_cc_params->params[i].dev = dev; dbg_cc_params->params[i].port_num = port_num;
include/linux/mlx5/mlx5_ifc.h +1 -1
@@ -1102,7 +1102,7 @@ struct mlx5_ifc_roce_cap_bits {u8 sw_r_roce_src_udp_port[0x1 ];u8 fl_rc_qp_when_roce_disabled[0x1 ];u8 fl_rc_qp_when_roce_enabled[0x1 ]; -u8 reserved_at_7[0x1 ]; +u8 roce_cc_general[0x1 ];u8 qp_ooo_transmit_default[0x1 ];u8 reserved_at_9[0x15 ];u8 qp_ts_format[0x2 ];
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 215/299 arm64: dts: imx8mp: Disable UART4 by default on Data Modul i.MX8M Plus eDM SBC
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit f03869698bc3bd6d9d2d9f216b20da08a8c2508a ]
UART4 is used as CM7 coprocessor debug UART and may not be accessible from Linux in case it is protected by RDC. The RDC protection is set up by the platform firmware. UART4 is not used on this platform by Linux. Disable UART4 by default to prevent boot hangs, which occur when the RDC protection is in place.
--- arch/arm64/boot/dts/freescale/imx8mp-data-modul-edm-sbc.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mp-data-modul-edm-sbc.dts +1 -1
@@ -484,7 +484,7 @@ &uart4 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart4>; - status = "okay"; + status = "disabled"; }; &usb3_phy0 {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 216/299 RDMA/irdma: Fix KASAN issue with tasklet
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Marciniszyn <[email protected]>
[ Upstream commit bd97cea7b18a0a553773af806dfbfac27a7c4acb ]
KASAN testing revealed the following issue assocated with freeing an IRQ.
[50006.466686] Call Trace: [50006.466691] <IRQ> [50006.489538] dump_stack+0x5c/0x80 [50006.493475] print_address_description.constprop.6+0x1a/0x150 [50006.499872] ? irdma_sc_process_ceq+0x483/0x790 [irdma] [50006.505742] ? irdma_sc_process_ceq+0x483/0x790 [irdma] [50006.511644] kasan_report.cold.11+0x7f/0x118 [50006.516572] ? irdma_sc_process_ceq+0x483/0x790 [irdma] [50006.522473] irdma_sc_process_ceq+0x483/0x790 [irdma] [50006.528232] irdma_process_ceq+0xb2/0x400 [irdma] [50006.533601] ? irdma_hw_flush_wqes_callback+0x370/0x370 [irdma] [50006.540298] irdma_ceq_dpc+0x44/0x100 [irdma] [50006.545306] tasklet_action_common.isra.14+0x148/0x2c0 [50006.551096] __do_softirq+0x1d0/0xaf8 [50006.555396] irq_exit_rcu+0x219/0x260 [50006.559670] irq_exit+0xa/0x20 [50006.563320] smp_apic_timer_interrupt+0x1bf/0x690 [50006.568645] apic_timer_interrupt+0xf/0x20 [50006.573341] </IRQ>
The issue is that a tasklet could be pending on another core racing the delete of the irq.
Fix by insuring any scheduled tasklet is killed after deleting the irq.
--- drivers/infiniband/hw/irdma/hw.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/infiniband/hw/irdma/hw.c +7 -0
@@ -570,6 +570,13 @@ static void irdma_destroy_irq(struct irdma_pci_f *rf, dev->irq_ops->irdma_dis_irq (dev, msix_vec->idx);irq_update_affinity_hint (msix_vec->irq,NULL );free_irq (msix_vec->irq, dev_id); +if (rf == dev_id) { +tasklet_kill (&rf->dpc_tasklet); + }else { +struct irdma_ceq *iwceq = (struct irdma_ceq *)dev_id; + +tasklet_kill (&iwceq->dpc_tasklet); + } }/**
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 217/299 RDMA/irdma: Validate max_send_wr and max_recv_wr
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shiraz Saleem <[email protected]>
[ Upstream commit ee107186bcfd25d7873258f3f75440e20f5e6416 ]
Validate that max_send_wr and max_recv_wr is within the supported range.
--- drivers/infiniband/hw/irdma/verbs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/irdma/verbs.c +3 -1
@@ -839,7 +839,9 @@ static int irdma_validate_qp_attrs(struct ib_qp_init_attr *init_attr,if (init_attr->cap.max_inline_data > uk_attrs->max_hw_inline || init_attr->cap.max_send_sge > uk_attrs->max_hw_wq_frags || - init_attr->cap.max_recv_sge > uk_attrs->max_hw_wq_frags) + init_attr->cap.max_recv_sge > uk_attrs->max_hw_wq_frags || + init_attr->cap.max_send_wr > uk_attrs->max_hw_wq_quanta || + init_attr->cap.max_recv_wr > uk_attrs->max_hw_rq_quanta)return -EINVAL ;if (rdma_protocol_roce (&iwdev->ibdev,1 )) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 218/299 RDMA/irdma: Set the CQ read threshold for GEN 1
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mustafa Ismail <[email protected]>
[ Upstream commit 666047f3ece9f991774c1fe9b223139a9ef8908d ]
The CQ shadow read threshold is currently not set for GEN 2. This could cause an invalid CQ overflow condition, so remove the GEN check that exclused GEN 1.
--- drivers/infiniband/hw/irdma/verbs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/infiniband/hw/irdma/verbs.c +2 -3
@@ -2186,9 +2186,8 @@ static int irdma_create_cq(struct ib_cq *ibcq, info.cq_base_pa = iwcq->kmem.pa; } -if (dev->hw_attrs.uk_attrs.hw_rev >=IRDMA_GEN_2 ) - info.shadow_read_threshold =min (info.cq_uk_init_info.cq_size /2 , - (u32 )IRDMA_MAX_CQ_READ_THRESH ); + info.shadow_read_threshold =min (info.cq_uk_init_info.cq_size /2 , + (u32 )IRDMA_MAX_CQ_READ_THRESH );if (irdma_sc_cq_init (cq, &info)) {ibdev_dbg (&iwdev->ibdev,"VERBS: init cq fail\n" );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 219/299 RDMA/irdma: Add AE for too many RNRS
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mustafa Ismail <[email protected]>
[ Upstream commit 630bdb6f28ca9e5ff79e244030170ac788478332 ]
Add IRDMA_AE_LLP_TOO_MANY_RNRS to the list of AE's processed as an abnormal asyncronous event.
--- drivers/infiniband/hw/irdma/defs.h | 1 + drivers/infiniband/hw/irdma/hw.c | 1 + 2 files changed, 2 insertions(+)
drivers/infiniband/hw/irdma/defs.h +1 -0
@@ -346,6 +346,7 @@ enum irdma_cqp_op_type {#define IRDMA_AE_LLP_TOO_MANY_KEEPALIVE_RETRIES 0x050b#define IRDMA_AE_LLP_DOUBT_REACHABILITY 0x050c#define IRDMA_AE_LLP_CONNECTION_ESTABLISHED 0x050e +#define IRDMA_AE_LLP_TOO_MANY_RNRS 0x050f#define IRDMA_AE_RESOURCE_EXHAUSTION 0x0520#define IRDMA_AE_RESET_SENT 0x0601#define IRDMA_AE_TERMINATE_SENT 0x0602
drivers/infiniband/hw/irdma/hw.c +1 -0
@@ -387,6 +387,7 @@ static void irdma_process_aeq(struct irdma_pci_f *rf)case IRDMA_AE_LLP_TOO_MANY_RETRIES :case IRDMA_AE_LCE_QP_CATASTROPHIC :case IRDMA_AE_LCE_FUNCTION_CATASTROPHIC : +case IRDMA_AE_LLP_TOO_MANY_RNRS :case IRDMA_AE_LCE_CQ_CATASTROPHIC :case IRDMA_AE_UDA_XMIT_DGRAM_TOO_LONG :default :
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 220/299 RDMA/srpt: Support specifying the srpt_service_guid parameter
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
[ Upstream commit fdfa083549de5d50ebf7f6811f33757781e838c0 ]
Make loading ib_srpt with this parameter set work. The current behavior is that setting that parameter while loading the ib_srpt kernel module triggers the following kernel crash:
BUG: kernel NULL pointer dereference, address: 0000000000000000 Call Trace: <TASK> parse_one+0x18c/0x1d0 parse_args+0xe1/0x230 load_module+0x8de/0xa60 init_module_from_file+0x8b/0xd0 idempotent_init_module+0x181/0x240 __x64_sys_finit_module+0x5a/0xb0 do_syscall_64+0x5f/0xe0 entry_SYSCALL_64_after_hwframe+0x6e/0x76
--- drivers/infiniband/ulp/srpt/ib_srpt.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/infiniband/ulp/srpt/ib_srpt.c +6 -2
@@ -79,12 +79,16 @@ module_param(srpt_srq_size, int, 0444);MODULE_PARM_DESC (srpt_srq_size,"Shared receive queue (SRQ) size." ); +static int srpt_set_u64_x (const char *buffer,const struct kernel_param *kp) +{ +return kstrtou64 (buffer,16 , (u64 *)kp->arg); +}static int srpt_get_u64_x (char *buffer,const struct kernel_param *kp) {return sprintf (buffer,"0x%016llx\n" , *(u64 *)kp->arg); } -module_param_call (srpt_service_guid,NULL , srpt_get_u64_x, &srpt_service_guid, -0444 ); +module_param_call (srpt_service_guid, srpt_set_u64_x, srpt_get_u64_x, + &srpt_service_guid,0444 );MODULE_PARM_DESC (srpt_service_guid,"Using this value for ioc_guid, id_ext, and cm_listen_id instead of using the node_guid of the first HCA." );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 221/299 arm64: dts: tqma8mpql: fix audio codec iov-supply
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Stein <[email protected]>
[ Upstream commit a620a7f2ae8b08c5beea6369f61e87064ee222dc ]
IOVDD is supplied by 1.8V, fix the referenced regulator.
--- .../boot/dts/freescale/imx8mp-tqma8mpql-mba8mpxl.dts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mp-tqma8mpql-mba8mpxl.dts +8 -1
@@ -168,6 +168,13 @@ enable-active-high; }; + reg_vcc_1v8: regulator-1v8 { + compatible = "regulator-fixed"; + regulator-name = "VCC_1V8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; + reg_vcc_3v3: regulator-3v3 { compatible = "regulator-fixed"; regulator-name = "VCC_3V3";
@@ -464,7 +471,7 @@ clock-names = "mclk"; clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1>; reset-gpios = <&gpio4 29 GPIO_ACTIVE_LOW>; - iov-supply = <®_vcc_3v3>; + iov-supply = <®_vcc_1v8>; ldoin-supply = <®_vcc_3v3>; };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 222/299 bus: imx-weim: fix valid range check
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lucas Stach <[email protected]>
[ Upstream commit 7bca405c986075c99b9f729d3587b5c45db39d01 ]
When the range parsing was open-coded the number of u32 entries to parse had to be a multiple of 4 and the driver checks this. With the range parsing converted to the range parser the counting changes from individual u32 entries to a complete range, so the check must not reject counts not divisible by 4.
--- drivers/bus/imx-weim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/imx-weim.c +1 -1
@@ -117,7 +117,7 @@ static int imx_weim_gpr_setup(struct platform_device *pdev) i++; } -if (i ==0 || i %4 ) +if (i ==0 ) goto err;for (i =0 ; i <ARRAY_SIZE (gprvals); i++) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 223/299 iommufd/iova_bitmap: Bounds check mapped::pages access
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joao Martins <[email protected]>
[ Upstream commit a4ab7dedaee0e39b15653c5fd0367e420739f7ef ]
Dirty IOMMU hugepages reported on a base page page-size granularity can lead to an attempt to set dirty pages in the bitmap beyond the limits that are pinned.
Bounds check the page index of the array we are trying to access is within the limits before we kmap() and return otherwise.
While it is also a defensive check, this is also in preparation to defer setting bits (outside the mapped range) to the next iteration(s) when the pages become available.
--- drivers/vfio/iova_bitmap.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/vfio/iova_bitmap.c +4 -0
@@ -406,6 +406,7 @@ void iova_bitmap_set(struct iova_bitmap *bitmap, mapped->pgshift) + mapped->pgoff * BITS_PER_BYTE;unsigned long last_bit = (((iova + length -1 ) - mapped->iova) >> mapped->pgshift) + mapped->pgoff *BITS_PER_BYTE ; +unsigned long last_page_idx = mapped->npages -1 ; do { unsigned int page_idx = cur_bit / BITS_PER_PAGE;
@@ -414,6 +415,9 @@ void iova_bitmap_set(struct iova_bitmap *bitmap, last_bit - cur_bit + 1);void *kaddr; +if (unlikely (page_idx > last_page_idx)) +break ; + kaddr =kmap_local_page (mapped->pages[page_idx]);bitmap_set (kaddr, offset, nbits);kunmap_local (kaddr);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 224/299 iommufd/iova_bitmap: Switch iova_bitmap::bitmap to an u8 array
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joao Martins <[email protected]>
[ Upstream commit d18411ec305728c6371806c4fb09be07016aad0b ]
iova_bitmap_mapped_length() don't deal correctly with the small bitmaps (< 2M bitmaps) when the starting address isn't u64 aligned, leading to skipping a tiny part of the IOVA range. This is materialized as not marking data dirty that should otherwise have been.
Fix that by using a u8 * in the internal state of IOVA bitmap. Most of the data structures use the type of the bitmap to adjust its indexes, thus changing the type of the bitmap decreases the granularity of the bitmap indexes.
--- drivers/vfio/iova_bitmap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/vfio/iova_bitmap.c +4 -4
@@ -100,7 +100,7 @@ struct iova_bitmap {struct iova_bitmap_map mapped;/* userspace address of the bitmap */ -u64 __user *bitmap; +u8 __user *bitmap;/* u64 index that @mapped points to */ unsigned long mapped_base_index;
@@ -162,7 +162,7 @@ static int iova_bitmap_get(struct iova_bitmap *bitmap) {struct iova_bitmap_map *mapped = &bitmap->mapped;unsigned long npages; -u64 __user *addr; +u8 __user *addr;long ret;/*
@@ -247,7 +247,7 @@ struct iova_bitmap *iova_bitmap_alloc(unsigned long iova, size_t length, mapped = &bitmap->mapped; mapped->pgshift =__ffs (page_size); - bitmap->bitmap = data; + bitmap->bitmap = (u8 __user *)data; bitmap->mapped_total_index =iova_bitmap_offset_to_index (bitmap, length -1 ) +1 ; bitmap->iova = iova;
@@ -302,7 +302,7 @@ static unsigned long iova_bitmap_mapped_remaining(struct iova_bitmap *bitmap) remaining = bitmap->mapped_total_index - bitmap->mapped_base_index; remaining = min_t(unsigned long, remaining, - bytes /sizeof (*bitmap->bitmap)); +DIV_ROUND_UP (bytes,sizeof (*bitmap->bitmap)));return remaining; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 225/299 iommufd/iova_bitmap: Consider page offset for the pages to be pinned
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joao Martins <[email protected]>
[ Upstream commit 4bbcbc6ea2fa379632a24c14cfb47aa603816ac6 ]
For small bitmaps that aren't PAGE_SIZE aligned *and* that are less than 512 pages in bitmap length, use an extra page to be able to cover the entire range e.g. [1M..3G] which would be iterated more efficiently in a single iteration, rather than two.
--- drivers/vfio/iova_bitmap.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/vfio/iova_bitmap.c +7 -6
@@ -175,18 +175,19 @@ static int iova_bitmap_get(struct iova_bitmap *bitmap) bitmap->mapped_base_index) * sizeof(*bitmap->bitmap), PAGE_SIZE); -/* -* We always cap at max number of 'struct page' a base page can fit. -* This is, for example, on x86 means 2M of bitmap data max. -*/ - npages =min (npages,PAGE_SIZE /sizeof (struct page *)); -/* * Bitmap address to be pinned is calculated via pointer arithmetic * with bitmap u64 word index. */ addr = bitmap->bitmap + bitmap->mapped_base_index; +/* +* We always cap at max number of 'struct page' a base page can fit. +* This is, for example, on x86 means 2M of bitmap data max. +*/ + npages =min (npages + !!offset_in_page (addr), +PAGE_SIZE /sizeof (struct page *)); + ret =pin_user_pages_fast ((unsigned long )addr, npages,FOLL_WRITE , mapped->pages);if (ret <=0 )
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 226/299 RDMA/qedr: Fix qedr_create_user_qp error flow
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kamal Heib <[email protected]>
[ Upstream commit 5ba4e6d5863c53e937f49932dee0ecb004c65928 ]
Avoid the following warning by making sure to free the allocated resources in case that qedr_init_user_queue() fail.
-----------[ cut here ]-----------
WARNING: CPU: 0 PID: 143192 at drivers/infiniband/core/rdma_core.c:874 uverbs_destroy_ufile_hw+0xcf/0xf0 [ib_uverbs] Modules linked in: tls target_core_user uio target_core_pscsi target_core_file target_core_iblock ib_srpt ib_srp scsi_transport_srp nfsd nfs_acl rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver nfs lockd grace fscache netfs 8021q garp mrp stp llc ext4 mbcache jbd2 opa_vnic ib_umad ib_ipoib sunrpc rdma_ucm ib_isert iscsi_target_mod target_core_mod ib_iser libiscsi scsi_transport_iscsi rdma_cm iw_cm ib_cm hfi1 intel_rapl_msr intel_rapl_common mgag200 qedr sb_edac drm_shmem_helper rdmavt x86_pkg_temp_thermal drm_kms_helper intel_powerclamp ib_uverbs coretemp i2c_algo_bit kvm_intel dell_wmi_descriptor ipmi_ssif sparse_keymap kvm ib_core rfkill syscopyarea sysfillrect video sysimgblt irqbypass ipmi_si ipmi_devintf fb_sys_fops rapl iTCO_wdt mxm_wmi iTCO_vendor_support intel_cstate pcspkr dcdbas intel_uncore ipmi_msghandler lpc_ich acpi_power_meter mei_me mei fuse drm xfs libcrc32c qede sd_mod ahci libahci t10_pi sg crct10dif_pclmul crc32_pclmul crc32c_intel qed libata tg3 ghash_clmulni_intel megaraid_sas crc8 wmi [last unloaded: ib_srpt] CPU: 0 PID: 143192 Comm: fi_rdm_tagged_p Kdump: loaded Not tainted 5.14.0-408.el9.x86_64 #1 Hardware name: Dell Inc. PowerEdge R430/03XKDV, BIOS 2.14.0 01/25/2022 RIP: 0010:uverbs_destroy_ufile_hw+0xcf/0xf0 [ib_uverbs] Code: 5d 41 5c 41 5d 41 5e e9 0f 26 1b dd 48 89 df e8 67 6a ff ff 49 8b 86 10 01 00 00 48 85 c0 74 9c 4c 89 e7 e8 83 c0 cb dd eb 92 <0f> 0b eb be 0f 0b be 04 00 00 00 48 89 df e8 8e f5 ff ff e9 6d ff RSP: 0018:ffffb7c6cadfbc60 EFLAGS: 00010286 RAX: ffff8f0889ee3f60 RBX: ffff8f088c1a5200 RCX: 00000000802a0016 RDX: 00000000802a0017 RSI: 0000000000000001 RDI: ffff8f0880042600 RBP: 0000000000000001 R08: 0000000000000001 R09: 0000000000000000 R10: ffff8f11fffd5000 R11: 0000000000039000 R12: ffff8f0d5b36cd80 R13: ffff8f088c1a5250 R14: ffff8f1206d91000 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff8f11d7c00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000147069200e20 CR3: 00000001c7210002 CR4: 00000000001706f0 Call Trace: <TASK> ? show_trace_log_lvl+0x1c4/0x2df ? show_trace_log_lvl+0x1c4/0x2df ? ib_uverbs_close+0x1f/0xb0 [ib_uverbs] ? uverbs_destroy_ufile_hw+0xcf/0xf0 [ib_uverbs] ? __warn+0x81/0x110 ? uverbs_destroy_ufile_hw+0xcf/0xf0 [ib_uverbs] ? report_bug+0x10a/0x140 ? handle_bug+0x3c/0x70 ? exc_invalid_op+0x14/0x70 ? asm_exc_invalid_op+0x16/0x20 ? uverbs_destroy_ufile_hw+0xcf/0xf0 [ib_uverbs] ib_uverbs_close+0x1f/0xb0 [ib_uverbs] __fput+0x94/0x250 task_work_run+0x5c/0x90 do_exit+0x270/0x4a0 do_group_exit+0x2d/0x90 get_signal+0x87c/0x8c0 arch_do_signal_or_restart+0x25/0x100 ? ib_uverbs_ioctl+0xc2/0x110 [ib_uverbs] exit_to_user_mode_loop+0x9c/0x130 exit_to_user_mode_prepare+0xb6/0x100 syscall_exit_to_user_mode+0x12/0x40 do_syscall_64+0x69/0x90 ? syscall_exit_work+0x103/0x130 ? syscall_exit_to_user_mode+0x22/0x40 ? do_syscall_64+0x69/0x90 ? syscall_exit_work+0x103/0x130 ? syscall_exit_to_user_mode+0x22/0x40 ? do_syscall_64+0x69/0x90 ? do_syscall_64+0x69/0x90 ? common_interrupt+0x43/0xa0 entry_SYSCALL_64_after_hwframe+0x72/0xdc RIP: 0033:0x1470abe3ec6b Code: Unable to access opcode bytes at RIP 0x1470abe3ec41. RSP: 002b:00007fff13ce9108 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: fffffffffffffffc RBX: 00007fff13ce9218 RCX: 00001470abe3ec6b RDX: 00007fff13ce9200 RSI: 00000000c0181b01 RDI: 0000000000000004 RBP: 00007fff13ce91e0 R08: 0000558d9655da10 R09: 0000558d9655dd00 R10: 00007fff13ce95c0 R11: 0000000000000246 R12: 00007fff13ce9358 R13: 0000000000000013 R14: 0000558d9655db50 R15: 00007fff13ce9470 </TASK>
--[ end trace 888a9b92e04c5c97 ]--
--- drivers/infiniband/hw/qedr/verbs.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/infiniband/hw/qedr/verbs.c +10 -1
@@ -1879,8 +1879,17 @@ static int qedr_create_user_qp(struct qedr_dev *dev,/* RQ - read access only (0) */ rc =qedr_init_user_queue (udata, dev, &qp->urq, ureq.rq_addr, ureq.rq_len, true,0 , alloc_and_init); -if (rc) +if (rc) { +ib_umem_release (qp->usq.umem); + qp->usq.umem =NULL ; +if (rdma_protocol_roce (&dev->ibdev,1 )) { +qedr_free_pbl (dev, &qp->usq.pbl_info, + qp->usq.pbl_tbl); + }else { +kfree (qp->usq.pbl_tbl); + }return rc; + } }memset (&in_params,0 ,sizeof (in_params));
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 227/299 arm64: dts: rockchip: set num-cs property for spi on px30
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
[ Upstream commit 334bf0710c98d391f4067b72f535d6c4c84dfb6f ]
The px30 has two spi controllers with two chip-selects each. The num-cs property is specified as the total number of chip selects a controllers has and is used since 2020 to find uses of chipselects outside that range in the Rockchip spi driver.
Without the property set, the default is 1, so spi devices using the second chipselect will not be created.
--- arch/arm64/boot/dts/rockchip/px30.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/rockchip/px30.dtsi +2 -0
@@ -632,6 +632,7 @@ clock-names = "spiclk", "apb_pclk"; dmas = <&dmac 12>, <&dmac 13>; dma-names = "tx", "rx"; + num-cs = <2>; pinctrl-names = "default"; pinctrl-0 = <&spi0_clk &spi0_csn &spi0_miso &spi0_mosi>; #address-cells = <1>;
@@ -647,6 +648,7 @@ clock-names = "spiclk", "apb_pclk"; dmas = <&dmac 14>, <&dmac 15>; dma-names = "tx", "rx"; + num-cs = <2>; pinctrl-names = "default"; pinctrl-0 = <&spi1_clk &spi1_csn0 &spi1_csn1 &spi1_miso &spi1_mosi>; #address-cells = <1>;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 228/299 arm64: dts: rockchip: Correct Indiedroid Nova GPIO Names
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Morgan <[email protected]>
[ Upstream commit c22d03a95b0d815cd186302fdd93f74d99f1c914 ]
Correct the names given to a few of the GPIO pins. The original names were unknowingly based on the header from a pre-production board. The production board has a slightly different pin assignment for the 40-pin GPIO header.
--- .../boot/dts/rockchip/rk3588s-indiedroid-nova.dts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/rockchip/rk3588s-indiedroid-nova.dts +5 -5
@@ -163,13 +163,13 @@ &gpio1 { gpio-line-names = /* GPIO1 A0-A7 */ - "HEADER_27_3v3", "HEADER_28_3v3", "", "", + "HEADER_27_3v3", "", "", "", "HEADER_29_1v8", "", "HEADER_7_1v8", "", /* GPIO1 B0-B7 */ "", "HEADER_31_1v8", "HEADER_33_1v8", "", "HEADER_11_1v8", "HEADER_13_1v8", "", "", /* GPIO1 C0-C7 */ - "", "", "", "", + "", "HEADER_28_3v3", "", "", "", "", "", "", /* GPIO1 D0-D7 */ "", "", "", "",
@@ -193,11 +193,11 @@ &gpio4 { gpio-line-names = /* GPIO4 A0-A7 */ - "", "", "HEADER_37_3v3", "HEADER_32_3v3", - "HEADER_36_3v3", "", "HEADER_35_3v3", "HEADER_38_3v3", + "", "", "HEADER_37_3v3", "HEADER_8_3v3", + "HEADER_10_3v3", "", "HEADER_32_3v3", "HEADER_35_3v3", /* GPIO4 B0-B7 */ "", "", "", "HEADER_40_3v3", - "HEADER_8_3v3", "HEADER_10_3v3", "", "", + "HEADER_38_3v3", "HEADER_36_3v3", "", "", /* GPIO4 C0-C7 */ "", "", "", "", "", "", "", "",
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 229/299 xsk: Add truesize to skb_add_rx_frag().
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
[ Upstream commit 2127c604383666675789fd4a5fc2aead46c73aad ]
xsk_build_skb() allocates a page and adds it to the skb via skb_add_rx_frag() and specifies 0 for truesize. This leads to a warning in skb_add_rx_frag() with CONFIG_DEBUG_NET enabled because size is larger than truesize.
Increasing truesize requires to add the same amount to socket's sk_wmem_alloc counter in order not to underflow the counter during release in the destructor (sock_wfree()).
Pass the size of the allocated page as truesize to skb_add_rx_frag(). Add this mount to socket's sk_wmem_alloc counter.
--- net/xdp/xsk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/xdp/xsk.c +2 -1
@@ -683,7 +683,8 @@ static struct sk_buff *xsk_build_skb(struct xdp_sock *xs,memcpy (vaddr, buffer, len);kunmap_local (vaddr); -skb_add_rx_frag (skb, nr_frags, page,0 , len,0 ); +skb_add_rx_frag (skb, nr_frags, page,0 , len,PAGE_SIZE ); +refcount_add (PAGE_SIZE , &xs->sk.sk_wmem_alloc); } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 230/299 RDMA/srpt: fix function pointer cast warnings
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit eb5c7465c3240151cd42a55c7ace9da0026308a1 ]
clang-16 notices that srpt_qp_event() gets called through an incompatible pointer here:
drivers/infiniband/ulp/srpt/ib_srpt.c:1815:5: error: cast from 'void (*)(struct ib_event *, struct srpt_rdma_ch *)' to 'void (*)(struct ib_event *, void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
1815 | = (void(*)(struct ib_event *, void*))srpt_qp_event;
Change srpt_qp_event() to use the correct prototype and adjust the argument inside of it.
--- drivers/infiniband/ulp/srpt/ib_srpt.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/infiniband/ulp/srpt/ib_srpt.c +5 -4
@@ -214,10 +214,12 @@ static const char *get_ch_state_name(enum rdma_ch_state s)/** * srpt_qp_event - QP event callback function * @event: Description of the event that occurred. -* @ch: SRPT RDMA channel. +* @ptr: SRPT RDMA channel. */ -static void srpt_qp_event (struct ib_event *event,struct srpt_rdma_ch *ch) +static void srpt_qp_event (struct ib_event *event,void *ptr) { +struct srpt_rdma_ch *ch = ptr; +pr_debug ("QP event %d on ch=%p sess_name=%s-%d state=%s\n" , event->event, ch, ch->sess_name, ch->qp->qp_num,get_ch_state_name (ch->state));
@@ -1811,8 +1813,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) ch->cq_size = ch->rq_size + sq_size; qp_init->qp_context = (void *)ch; - qp_init->event_handler - = (void (*)(struct ib_event *,void *))srpt_qp_event; + qp_init->event_handler = srpt_qp_event; qp_init->send_cq = ch->cq; qp_init->recv_cq = ch->cq; qp_init->sq_sig_type =IB_SIGNAL_REQ_WR ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 231/299 bpf, scripts: Correct GPL license name
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gianmarco Lusvardi <[email protected]>
[ Upstream commit e37243b65d528a8a9f8b9a57a43885f8e8dfc15c ]
The bpf_doc script refers to the GPL as the "GNU Privacy License". I strongly suspect that the author wanted to refer to the GNU General Public License, under which the Linux kernel is released, as, to the best of my knowledge, there is no license named "GNU Privacy License". This patch corrects the license name in the script accordingly.
--- scripts/bpf_doc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/bpf_doc.py +1 -1
@@ -513,7 +513,7 @@ eBPF programs can have an associated license, passed along with the bytecode instructions to the kernel when the programs are loaded. The format for that string is identical to the one in use for kernel modules (Dual licenses, such as "Dual BSD/GPL", may be used). Some helper functions are only accessible to -programs that are compatible with the GNU Privacy License (GPL). +programs that are compatible with the GNU General Public License (GNU GPL). In order to use such helpers, the eBPF program must be loaded with the correct license string passed (via **attr**) to the **bpf**\\ () system call, and this
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 232/299 scsi: smartpqi: Fix disable_managed_interrupts
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Don Brace <[email protected]>
[ Upstream commit 5761eb9761d2d5fe8248a9b719efc4d8baf1f24a ]
Correct blk-mq registration issue with module parameter disable_managed_interrupts enabled.
When we turn off the default PCI_IRQ_AFFINITY flag, the driver needs to register with blk-mq using blk_mq_map_queues(). The driver is currently calling blk_mq_pci_map_queues() which results in a stack trace and possibly undefined behavior.
Stack Trace:
[ 7.860089] scsi host2: smartpqi [ 7.871934] WARNING: CPU: 0 PID: 238 at block/blk-mq-pci.c:52 blk_mq_pci_map_queues+0xca/0xd0 [ 7.889231] Modules linked in: sd_mod t10_pi sg uas smartpqi(+) crc32c_intel scsi_transport_sas usb_storage dm_mirror dm_region_hash dm_log dm_mod ipmi_devintf ipmi_msghandler fuse [ 7.924755] CPU: 0 PID: 238 Comm: kworker/0:3 Not tainted 4.18.0-372.88.1.el8_6_smartpqi_test.x86_64 #1 [ 7.944336] Hardware name: HPE ProLiant DL380 Gen10/ProLiant DL380 Gen10, BIOS U30 03/08/2022 [ 7.963026] Workqueue: events work_for_cpu_fn [ 7.978275] RIP: 0010:blk_mq_pci_map_queues+0xca/0xd0 [ 7.978278] Code: 48 89 de 89 c7 e8 f6 0f 4f 00 3b 05 c4 b7 8e 01 72 e1 5b 31 c0 5d 41 5c 41 5d 41 5e 41 5f e9 7d df 73 00 31 c0 e9 76 df 73 00 <0f> 0b eb bc 90 90 0f 1f 44 00 00 41 57 49 89 ff 41 56 41 55 41 54 [ 7.978280] RSP: 0018:ffffa95fc3707d50 EFLAGS: 00010216 [ 7.978283] RAX: 00000000ffffffff RBX: 0000000000000000 RCX: 0000000000000010 [ 7.978284] RDX: 0000000000000004 RSI: 0000000000000000 RDI: ffff9190c32d4310 [ 7.978286] RBP: 0000000000000000 R08: ffffa95fc3707d38 R09: ffff91929b81ac00 [ 7.978287] R10: 0000000000000001 R11: ffffa95fc3707ac0 R12: 0000000000000000 [ 7.978288] R13: ffff9190c32d4000 R14: 00000000ffffffff R15: ffff9190c4c950a8 [ 7.978290] FS: 0000000000000000(0000) GS:ffff9193efc00000(0000) knlGS:0000000000000000 [ 7.978292] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 8.172814] CR2: 000055d11166c000 CR3: 00000002dae10002 CR4: 00000000007706f0 [ 8.172816] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 8.172817] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 8.172818] PKRU: 55555554 [ 8.172819] Call Trace: [ 8.172823] blk_mq_alloc_tag_set+0x12e/0x310 [ 8.264339] scsi_add_host_with_dma.cold.9+0x30/0x245 [ 8.279302] pqi_ctrl_init+0xacf/0xc8e [smartpqi] [ 8.294085] ? pqi_pci_probe+0x480/0x4c8 [smartpqi] [ 8.309015] pqi_pci_probe+0x480/0x4c8 [smartpqi] [ 8.323286] local_pci_probe+0x42/0x80 [ 8.337855] work_for_cpu_fn+0x16/0x20 [ 8.351193] process_one_work+0x1a7/0x360 [ 8.364462] ? create_worker+0x1a0/0x1a0 [ 8.379252] worker_thread+0x1ce/0x390 [ 8.392623] ? create_worker+0x1a0/0x1a0 [ 8.406295] kthread+0x10a/0x120 [ 8.418428] ? set_kthread_struct+0x50/0x50 [ 8.431532] ret_from_fork+0x1f/0x40 [ 8.444137] ---[ end trace 1bf0173d39354506 ]---
--- drivers/scsi/smartpqi/smartpqi_init.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/scsi/smartpqi/smartpqi_init.c +4 -1
@@ -6533,8 +6533,11 @@ static void pqi_map_queues(struct Scsi_Host *shost) {struct pqi_ctrl_info *ctrl_info =shost_to_hba (shost); -blk_mq_pci_map_queues (&shost->tag_set.map[HCTX_TYPE_DEFAULT ], +if (!ctrl_info->disable_managed_interrupts) +return blk_mq_pci_map_queues (&shost->tag_set.map[HCTX_TYPE_DEFAULT ], ctrl_info->pci_dev,0 ); +else +return blk_mq_map_queues (&shost->tag_set.map[HCTX_TYPE_DEFAULT ]); }static inline bool pqi_is_tape_changer_device (struct pqi_scsi_dev *device)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 233/299 scsi: jazz_esp: Only build if SCSI core is builtin
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit 9ddf190a7df77b77817f955fdb9c2ae9d1c9c9a3 ]
JAZZ_ESP is a bool kconfig symbol that selects SCSI_SPI_ATTRS. When CONFIG_SCSI=m, this results in SCSI_SPI_ATTRS=m while JAZZ_ESP=y, which causes many undefined symbol linker errors.
Fix this by only offering to build this driver when CONFIG_SCSI=y.
[mkp: JAZZ_ESP is unique in that it does not support being compiled as a module unlike the remaining SPI SCSI HBA drivers]
--- drivers/scsi/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/Kconfig +1 -1
@@ -1285,7 +1285,7 @@ source "drivers/scsi/arm/Kconfig" config JAZZ_ESP bool "MIPS JAZZ FAS216 SCSI support" - depends on MACH_JAZZ && SCSI + depends on MACH_JAZZ && SCSI=y select SCSI_SPI_ATTRS help This is the driver for the onboard SCSI host adapter of MIPS Magnum
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 234/299 net: bridge: switchdev: Skip MDB replays of deferred events on offload
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tobias Waldekranz <[email protected]>
[ Upstream commit dc489f86257cab5056e747344f17a164f63bff4b ]
Before this change, generation of the list of MDB events to replay would race against the creation of new group memberships, either from the IGMP/MLD snooping logic or from user configuration.
While new memberships are immediately visible to walkers of br->mdb_list, the notification of their existence to switchdev event subscribers is deferred until a later point in time. So if a replay list was generated during a time that overlapped with such a window, it would also contain a replay of the not-yet-delivered event.
The driver would thus receive two copies of what the bridge internally considered to be one single event. On destruction of the bridge, only a single membership deletion event was therefore sent. As a consequence of this, drivers which reference count memberships (at least DSA), would be left with orphan groups in their hardware database when the bridge was destroyed.
This is only an issue when replaying additions. While deletion events may still be pending on the deferred queue, they will already have been removed from br->mdb_list, so no duplicates can be generated in that scenario.
To a user this meant that old group memberships, from a bridge in which a port was previously attached, could be reanimated (in hardware) when the port joined a new bridge, without the new bridge's knowledge.
For example, on an mv88e6xxx system, create a snooping bridge and immediately add a port to it:
root@infix-06-0b-00:~$ ip link add dev br0 up type bridge mcast_snooping 1 && \
Quoted 1 line
ip link set dev x3 up master br0
And then destroy the bridge:
root@infix-06-0b-00:~$ ip link del dev br0
root@infix-06-0b-00:~$ mvls atu
ADDRESS FID STATE Q F 0 1 2 3 4 5 6 7 8 9 a
DEV:0 Marvell 88E6393X
33:33:00:00:00:6a 1 static - - 0 . . . . . . . . . .
33:33:ff:87:e4:3f 1 static - - 0 . . . . . . . . . .
ff:ff:ff:ff:ff:ff 1 static - - 0 1 2 3 4 5 6 7 8 9 a
root@infix-06-0b-00:~$The two IPv6 groups remain in the hardware database because the port (x3) is notified of the host's membership twice: once via the original event and once via a replay. Since only a single delete notification is sent, the count remains at 1 when the bridge is destroyed.
Then add the same port (or another port belonging to the same hardware domain) to a new bridge, this time with snooping disabled:
root@infix-06-0b-00:~$ ip link add dev br1 up type bridge mcast_snooping 0 && \
Quoted 1 line
ip link set dev x3 up master br1
All multicast, including the two IPv6 groups from br0, should now be flooded, according to the policy of br1. But instead the old memberships are still active in the hardware database, causing the switch to only forward traffic to those groups towards the CPU (port 0).
Eliminate the race in two steps:
1. Grab the write-side lock of the MDB while generating the replay list.
This prevents new memberships from showing up while we are generating the replay list. But it leaves the scenario in which a deferred event was already generated, but not delivered, before we grabbed the lock. Therefore:
2. Make sure that no deferred version of a replay event is already enqueued to the switchdev deferred queue, before adding it to the replay list, when replaying additions.
--- include/net/switchdev.h | 3 ++ net/bridge/br_switchdev.c | 74 ++++++++++++++++++++++++--------------- net/switchdev/switchdev.c | 73 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 122 insertions(+), 28 deletions(-)
include/net/switchdev.h +3 -0
@@ -308,6 +308,9 @@ void switchdev_deferred_process(void);int switchdev_port_attr_set (struct net_device *dev,const struct switchdev_attr *attr,struct netlink_ext_ack *extack); +bool switchdev_port_obj_act_is_deferred (struct net_device *dev, +enum switchdev_notifier_type nt, +const struct switchdev_obj *obj);int switchdev_port_obj_add (struct net_device *dev,const struct switchdev_obj *obj,struct netlink_ext_ack *extack);
net/bridge/br_switchdev.c +46 -28
118 lines not on this page · raw message
net/switchdev/switchdev.c +73 -0
85 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 235/299 net: bridge: switchdev: Ensure deferred event delivery on unoffload
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tobias Waldekranz <[email protected]>
[ Upstream commit f7a70d650b0b6b0134ccba763d672c8439d9f09b ]
When unoffloading a device, it is important to ensure that all relevant deferred events are delivered to it before it disassociates itself from the bridge.
Before this change, this was true for the normal case when a device maps 1:1 to a net_bridge_port, i.e.
br0
/
swp0
When swp0 leaves br0, the call to switchdev_deferred_process() in del_nbp() makes sure to process any outstanding events while the device is still associated with the bridge.
In the case when the association is indirect though, i.e. when the device is attached to the bridge via an intermediate device, like a LAG...
br0
/ lag0
/
swp0
...then detaching swp0 from lag0 does not cause any net_bridge_port to be deleted, so there was no guarantee that all events had been processed before the device disassociated itself from the bridge.
Fix this by always synchronously processing all deferred events before signaling completion of unoffloading back to the driver.
--- net/bridge/br_switchdev.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
net/bridge/br_switchdev.c +10 -0
@@ -804,6 +804,16 @@ static void nbp_switchdev_unsync_objs(struct net_bridge_port *p,br_switchdev_mdb_replay (br_dev, dev, ctx, false, blocking_nb,NULL );br_switchdev_vlan_replay (br_dev, ctx, false, blocking_nb,NULL ); + +/* Make sure that the device leaving this bridge has seen all +* relevant events before it is disassociated. In the normal +* case, when the device is directly attached to the bridge, +* this is covered by del_nbp(). If the association was indirect +* however, e.g. via a team or bond, and the device is leaving +* that intermediate device, then the bridge port remains in +* place. +*/ +switchdev_deferred_process (); }/* Let the bridge know that this port is offloaded, so that it can assign a
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 236/299 dccp/tcp: Unhash sk from ehash for tb2 alloc failure after check_estalblished().
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 66b60b0c8c4a163b022a9f0ad6769b0fd3dc662f ]
syzkaller reported a warning [0] in inet_csk_destroy_sock() with no repro.
WARN_ON(inet_sk(sk)->inet_num && !inet_csk(sk)->icsk_bind_hash);
However, the syzkaller's log hinted that connect() failed just before the warning due to FAULT_INJECTION. [1]
When connect() is called for an unbound socket, we search for an available ephemeral port. If a bhash bucket exists for the port, we call __inet_check_established() or __inet6_check_established() to check if the bucket is reusable.
If reusable, we add the socket into ehash and set inet_sk(sk)->inet_num.
Later, we look up the corresponding bhash2 bucket and try to allocate it if it does not exist.
Although it rarely occurs in real use, if the allocation fails, we must revert the changes by check_established(). Otherwise, an unconnected socket could illegally occupy an ehash entry.
Note that we do not put tw back into ehash because sk might have already responded to a packet for tw and it would be better to free tw earlier under such memory presure.
[0]:
WARNING: CPU: 0 PID: 350830 at net/ipv4/inet_connection_sock.c:1193 inet_csk_destroy_sock (net/ipv4/inet_connection_sock.c:1193) Modules linked in: Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 RIP: 0010:inet_csk_destroy_sock (net/ipv4/inet_connection_sock.c:1193) Code: 41 5c 41 5d 41 5e e9 2d 4a 3d fd e8 28 4a 3d fd 48 89 ef e8 f0 cd 7d ff 5b 5d 41 5c 41 5d 41 5e e9 13 4a 3d fd e8 0e 4a 3d fd <0f> 0b e9 61 fe ff ff e8 02 4a 3d fd 4c 89 e7 be 03 00 00 00 e8 05 RSP: 0018:ffffc9000b21fd38 EFLAGS: 00010293 RAX: 0000000000000000 RBX: 0000000000009e78 RCX: ffffffff840bae40 RDX: ffff88806e46c600 RSI: ffffffff840bb012 RDI: ffff88811755cca8 RBP: ffff88811755c880 R08: 0000000000000003 R09: 0000000000000000 R10: 0000000000009e78 R11: 0000000000000000 R12: ffff88811755c8e0 R13: ffff88811755c892 R14: ffff88811755c918 R15: 0000000000000000 FS: 00007f03e5243800(0000) GS:ffff88811ae00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000001b32f21000 CR3: 0000000112ffe001 CR4: 0000000000770ef0 PKRU: 55555554 Call Trace: <TASK> ? inet_csk_destroy_sock (net/ipv4/inet_connection_sock.c:1193) dccp_close (net/dccp/proto.c:1078) inet_release (net/ipv4/af_inet.c:434) __sock_release (net/socket.c:660) sock_close (net/socket.c:1423) __fput (fs/file_table.c:377) __fput_sync (fs/file_table.c:462) __x64_sys_close (fs/open.c:1557 fs/open.c:1539 fs/open.c:1539) do_syscall_64 (arch/x86/entry/common.c:52 arch/x86/entry/common.c:83) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:129) RIP: 0033:0x7f03e53852bb Code: 03 00 00 00 0f 05 48 3d 00 f0 ff ff 77 41 c3 48 83 ec 18 89 7c 24 0c e8 43 c9 f5 ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 c9 f5 ff 8b 44 RSP: 002b:00000000005dfba0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 00007f03e53852bb RDX: 0000000000000002 RSI: 0000000000000002 RDI: 0000000000000003 RBP: 0000000000000000 R08: 0000000000000000 R09: 000000000000167c R10: 0000000008a79680 R11: 0000000000000293 R12: 00007f03e4e43000 R13: 00007f03e4e43170 R14: 00007f03e4e43178 R15: 00007f03e4e43170 </TASK>
[1]:FAULT_INJECTION: forcing a failure.
name failslab, interval 1, probability 0, space 0, times 0
CPU: 0 PID: 350833 Comm: syz-executor.1 Not tainted 6.7.0-12272-g2121c43f88f5 #9 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 Call Trace: <TASK> dump_stack_lvl (lib/dump_stack.c:107 (discriminator 1)) should_fail_ex (lib/fault-inject.c:52 lib/fault-inject.c:153) should_failslab (mm/slub.c:3748) kmem_cache_alloc (mm/slub.c:3763 mm/slub.c:3842 mm/slub.c:3867) inet_bind2_bucket_create (net/ipv4/inet_hashtables.c:135) __inet_hash_connect (net/ipv4/inet_hashtables.c:1100) dccp_v4_connect (net/dccp/ipv4.c:116) __inet_stream_connect (net/ipv4/af_inet.c:676) inet_stream_connect (net/ipv4/af_inet.c:747) __sys_connect_file (net/socket.c:2048 (discriminator 2)) __sys_connect (net/socket.c:2065) __x64_sys_connect (net/socket.c:2072) do_syscall_64 (arch/x86/entry/common.c:52 arch/x86/entry/common.c:83) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:129) RIP: 0033:0x7f03e5284e5d Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 73 9f 1b 00 f7 d8 64 89 01 48 RSP: 002b:00007f03e4641cc8 EFLAGS: 00000246 ORIG_RAX: 000000000000002a RAX: ffffffffffffffda RBX: 00000000004bbf80 RCX: 00007f03e5284e5d RDX: 0000000000000010 RSI: 0000000020000000 RDI: 0000000000000003 RBP: 00000000004bbf80 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 000000000000000b R14: 00007f03e52e5530 R15: 0000000000000000 </TASK>
--- net/ipv4/inet_hashtables.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-)
net/ipv4/inet_hashtables.c +24 -1
@@ -1131,10 +1131,33 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row,return 0 ; error: +if (sk_hashed (sk)) { +spinlock_t *lock =inet_ehash_lockp (hinfo, sk->sk_hash); + +sock_prot_inuse_add (net, sk->sk_prot,-1 ); + +spin_lock (lock); +sk_nulls_del_node_init_rcu (sk); +spin_unlock (lock); + + sk->sk_hash =0 ; +inet_sk (sk)->inet_sport =0 ; +inet_sk (sk)->inet_num =0 ; + +if (tw) +inet_twsk_bind_unhash (tw, hinfo); + } +spin_unlock (&head2->lock);if (tb_created)inet_bind_bucket_destroy (hinfo->bind_bucket_cachep, tb); -spin_unlock_bh (&head->lock); +spin_unlock (&head->lock); + +if (tw) +inet_twsk_deschedule_put (tw); + +local_bh_enable (); +return -ENOMEM ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 237/299 net: ethernet: adi: requires PHYLIB support
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit a9f80df4f51440303d063b55bb98720857693821 ]
This driver uses functions that are supplied by the Kconfig symbol PHYLIB, so select it to ensure that they are built as needed.
When CONFIG_ADIN1110=y and CONFIG_PHYLIB=m, there are multiple build (linker) errors that are resolved by this Kconfig change:
ld: drivers/net/ethernet/adi/adin1110.o: in function `adin1110_net_open':
drivers/net/ethernet/adi/adin1110.c:933: undefined reference to `phy_start'
ld: drivers/net/ethernet/adi/adin1110.o: in function `adin1110_probe_netdevs':
drivers/net/ethernet/adi/adin1110.c:1603: undefined reference to `get_phy_device'
ld: drivers/net/ethernet/adi/adin1110.c:1609: undefined reference to `phy_connect'
ld: drivers/net/ethernet/adi/adin1110.o: in function `adin1110_disconnect_phy':
drivers/net/ethernet/adi/adin1110.c:1226: undefined reference to `phy_disconnect'
ld: drivers/net/ethernet/adi/adin1110.o: in function `devm_mdiobus_alloc':
include/linux/phy.h:455: undefined reference to `devm_mdiobus_alloc_size'
ld: drivers/net/ethernet/adi/adin1110.o: in function `adin1110_register_mdiobus':
drivers/net/ethernet/adi/adin1110.c:529: undefined reference to `__devm_mdiobus_register'
ld: drivers/net/ethernet/adi/adin1110.o: in function `adin1110_net_stop':
drivers/net/ethernet/adi/adin1110.c:958: undefined reference to `phy_stop'
ld: drivers/net/ethernet/adi/adin1110.o: in function `adin1110_disconnect_phy':
drivers/net/ethernet/adi/adin1110.c:1226: undefined reference to `phy_disconnect'
ld: drivers/net/ethernet/adi/adin1110.o: in function `adin1110_adjust_link':
drivers/net/ethernet/adi/adin1110.c:1077: undefined reference to `phy_print_status'
ld: drivers/net/ethernet/adi/adin1110.o: in function `adin1110_ioctl':
drivers/net/ethernet/adi/adin1110.c:790: undefined reference to `phy_do_ioctl'
ld: drivers/net/ethernet/adi/adin1110.o:(.rodata+0xf60): undefined reference to `phy_ethtool_get_link_ksettings'
ld: drivers/net/ethernet/adi/adin1110.o:(.rodata+0xf68): undefined reference to `phy_ethtool_set_link_ksettings'
--- drivers/net/ethernet/adi/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/adi/Kconfig +1 -0
@@ -7,6 +7,7 @@ config NET_VENDOR_ADI bool "Analog Devices devices" default y depends on SPI + select PHYLIB help If you have a network (Ethernet) card belonging to this class, say Y.
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 238/299 net/sched: act_mirred: Create function tcf_mirred_to_dev and improve readability
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 16085e48cb48aeb50a1178dc276747749910b0f2 ]
As a preparation for adding block ID to mirred, separate the part of mirred that redirect/mirrors to a dev into a specific function so that it can be called by blockcast for each dev.
Also improve readability. Eg. rename use_reinsert to dont_clone and skb2 to skb_to_send.
Stable-dep-of: 52f671db1882 ("net/sched: act_mirred: use the backlog for mirred ingress")
--- net/sched/act_mirred.c | 129 +++++++++++++++++++++++------------------ 1 file changed, 72 insertions(+), 57 deletions(-)
net/sched/act_mirred.c +72 -57
@@ -225,48 +225,26 @@ static int tcf_mirred_forward(bool want_ingress, struct sk_buff *skb)return err; } -TC_INDIRECT_SCOPE int tcf_mirred_act(struct sk_buff *skb, -const struct tc_action *a, -struct tcf_result *res) +static int tcf_mirred_to_dev (struct sk_buff *skb,struct tcf_mirred *m, +struct net_device *dev, +const bool m_mac_header_xmit,int m_eaction, +int retval) { -struct tcf_mirred *m =to_mirred (a); -struct sk_buff *skb2 = skb; -bool m_mac_header_xmit; -struct net_device *dev; -unsigned int nest_level; -int retval, err =0 ; -bool use_reinsert; +struct sk_buff *skb_to_send = skb;bool want_ingress;bool is_redirect;bool expects_nh;bool at_ingress; -int m_eaction; +bool dont_clone;int mac_len;bool at_nh; +int err; - nest_level =__this_cpu_inc_return (mirred_nest_level); -if (unlikely (nest_level >MIRRED_NEST_LIMIT )) { -net_warn_ratelimited ("Packet exceeded mirred recursion limit on dev %s\n" , -netdev_name (skb->dev)); -__this_cpu_dec (mirred_nest_level); -return TC_ACT_SHOT ; - } - -tcf_lastuse_update (&m->tcf_tm); -tcf_action_update_bstats (&m->common, skb); - - m_mac_header_xmit =READ_ONCE (m->tcfm_mac_header_xmit); - m_eaction =READ_ONCE (m->tcfm_eaction); - retval =READ_ONCE (m->tcf_action); - dev =rcu_dereference_bh (m->tcfm_dev); -if (unlikely (!dev)) { -pr_notice_once ("tc mirred: target device is gone\n" ); - goto out; - } - + is_redirect =tcf_mirred_is_act_redirect (m_eaction);if (unlikely (!(dev->flags &IFF_UP )) || !netif_carrier_ok (dev)) {net_notice_ratelimited ("tc mirred to Houston: device %s is down\n" , dev->name); + err = -ENODEV ; goto out; }
@@ -274,61 +252,98 @@ TC_INDIRECT_SCOPE int tcf_mirred_act(struct sk_buff *skb,* since we can't easily detect the clsact caller, skip clone only for * ingress - that covers the TC S/W datapath. */ - is_redirect =tcf_mirred_is_act_redirect (m_eaction); at_ingress =skb_at_tc_ingress (skb); - use_reinsert = at_ingress && is_redirect && -tcf_mirred_can_reinsert (retval); -if (!use_reinsert) { - skb2 =skb_clone (skb,GFP_ATOMIC ); -if (!skb2) + dont_clone =skb_at_tc_ingress (skb) && is_redirect && +tcf_mirred_can_reinsert (retval); +if (!dont_clone) { + skb_to_send =skb_clone (skb,GFP_ATOMIC ); +if (!skb_to_send) { + err = -ENOMEM ; goto out; + } } want_ingress =tcf_mirred_act_wants_ingress (m_eaction);/* All mirred/redirected skbs should clear previous ct info */ -nf_reset_ct (skb2); +nf_reset_ct (skb_to_send);if (want_ingress && !at_ingress)/* drop dst for egress -> ingress */ -skb_dst_drop (skb2); +skb_dst_drop (skb_to_send); expects_nh = want_ingress || !m_mac_header_xmit; at_nh = skb->data ==skb_network_header (skb);if (at_nh != expects_nh) { - mac_len =skb_at_tc_ingress (skb) ? skb->mac_len : + mac_len = at_ingress ? skb->mac_len :skb_network_offset (skb);if (expects_nh) {/* target device/action expect data at nh */ -skb_pull_rcsum (skb2, mac_len); +skb_pull_rcsum (skb_to_send, mac_len); }else {/* target device/action expect data at mac */ -skb_push_rcsum (skb2, mac_len); +skb_push_rcsum (skb_to_send, mac_len); } } - skb2->skb_iif = skb->dev->ifindex; - skb2->dev = dev; + skb_to_send->skb_iif = skb->dev->ifindex; + skb_to_send->dev = dev; -/* mirror is always swallowed */ if (is_redirect) { -skb_set_redirected (skb2, skb2->tc_at_ingress); - -/* let's the caller reinsert the packet, if possible */ -if (use_reinsert) { - err =tcf_mirred_forward (want_ingress, skb); -if (err) -tcf_action_inc_overlimit_qstats (&m->common); -__this_cpu_dec (mirred_nest_level); -return TC_ACT_CONSUMED ; - } +if (skb == skb_to_send) + retval =TC_ACT_CONSUMED ; + +skb_set_redirected (skb_to_send, skb_to_send->tc_at_ingress); + + err =tcf_mirred_forward (want_ingress, skb_to_send); + }else { + err =tcf_mirred_forward (want_ingress, skb_to_send); } - err =tcf_mirred_forward (want_ingress, skb2);if (err) { out:tcf_action_inc_overlimit_qstats (&m->common); -if (tcf_mirred_is_act_redirect (m_eaction)) +if (is_redirect) retval =TC_ACT_SHOT ; } + +return retval; +} + +TC_INDIRECT_SCOPE int tcf_mirred_act(struct sk_buff *skb, +const struct tc_action *a, +struct tcf_result *res) +{ +struct tcf_mirred *m =to_mirred (a); +int retval =READ_ONCE (m->tcf_action); +unsigned int nest_level; +bool m_mac_header_xmit; +struct net_device *dev; +int m_eaction; + + nest_level =__this_cpu_inc_return (mirred_nest_level); +if (unlikely (nest_level >MIRRED_NEST_LIMIT )) { +net_warn_ratelimited ("Packet exceeded mirred recursion limit on dev %s\n" , +netdev_name (skb->dev)); + retval =TC_ACT_SHOT ; + goto dec_nest_level; + } + +tcf_lastuse_update (&m->tcf_tm); +tcf_action_update_bstats (&m->common, skb); + + dev =rcu_dereference_bh (m->tcfm_dev); +if (unlikely (!dev)) { +pr_notice_once ("tc mirred: target device is gone\n" ); +tcf_action_inc_overlimit_qstats (&m->common); + goto dec_nest_level; + } + + m_mac_header_xmit =READ_ONCE (m->tcfm_mac_header_xmit); + m_eaction =READ_ONCE (m->tcfm_eaction); + + retval =tcf_mirred_to_dev (skb, m, dev, m_mac_header_xmit, m_eaction, + retval); + +dec_nest_level:__this_cpu_dec (mirred_nest_level);return retval;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 239/299 net/sched: act_mirred: use the backlog for mirred ingress
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 52f671db18823089a02f07efc04efdb2272ddc17 ]
The test Davide added in commit ca22da2fbd69 ("act_mirred: use the backlog for nested calls to mirred ingress") hangs our testing VMs every 10 or so runs, with the familiar tcp_v4_rcv -> tcp_v4_rcv deadlock reported by lockdep.
The problem as previously described by Davide (see Link) is that if we reverse flow of traffic with the redirect (egress -> ingress) we may reach the same socket which generated the packet. And we may still be holding its socket lock. The common solution to such deadlocks is to put the packet in the Rx backlog, rather than run the Rx path inline. Do that for all egress -> ingress reversals, not just once we started to nest mirred calls.
In the past there was a concern that the backlog indirection will lead to loss of error reporting / less accurate stats. But the current workaround does not seem to address the issue.
--- net/sched/act_mirred.c | 14 +++++--------- .../testing/selftests/net/forwarding/tc_actions.sh | 3 --- 2 files changed, 5 insertions(+), 12 deletions(-)
net/sched/act_mirred.c +5 -9
@@ -206,18 +206,14 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,return err; } -static bool is_mirred_nested (void ) -{ -return unlikely (__this_cpu_read (mirred_nest_level) >1 ); -} - -static int tcf_mirred_forward (bool want_ingress,struct sk_buff *skb) +static int +tcf_mirred_forward (bool at_ingress,bool want_ingress,struct sk_buff *skb) {int err;if (!want_ingress) err =tcf_dev_queue_xmit (skb, dev_queue_xmit); -else if (is_mirred_nested ()) +else if (!at_ingress) err =netif_rx (skb);else err =netif_receive_skb (skb);
@@ -293,9 +289,9 @@ static int tcf_mirred_to_dev(struct sk_buff *skb, struct tcf_mirred *m,skb_set_redirected (skb_to_send, skb_to_send->tc_at_ingress); - err =tcf_mirred_forward (want_ingress, skb_to_send); + err =tcf_mirred_forward (at_ingress, want_ingress, skb_to_send); }else { - err =tcf_mirred_forward (want_ingress, skb_to_send); + err =tcf_mirred_forward (at_ingress, want_ingress, skb_to_send); }if (err) {
tools/testing/selftests/net/forwarding/tc_actions.sh +0 -3
@@ -235,9 +235,6 @@ mirred_egress_to_ingress_tcp_test() check_err $? "didn't mirred redirect ICMP" tc_check_packets "dev $h1 ingress" 102 10 check_err $? "didn't drop mirred ICMP" - local overlimits=$(tc_rule_stats_get ${h1} 101 egress .overlimits) - test ${overlimits} = 10 - check_err $? "wrong overlimits, expected 10 got ${overlimits}" tc filter del dev $h1 egress protocol ip pref 100 handle 100 flower tc filter del dev $h1 egress protocol ip pref 101 handle 101 flower
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 240/299 net/sched: act_mirred: dont override retval if we already lost the skb
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 166c2c8a6a4dc2e4ceba9e10cfe81c3e469e3210 ]
If we're redirecting the skb, and haven't called tcf_mirred_forward(), yet, we need to tell the core to drop the skb by setting the retcode to SHOT. If we have called tcf_mirred_forward(), however, the skb is out of our hands and returning SHOT will lead to UaF.
Move the retval override to the error path which actually need it.
--- net/sched/act_mirred.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
net/sched/act_mirred.c +10 -12
@@ -240,8 +240,7 @@ static int tcf_mirred_to_dev(struct sk_buff *skb, struct tcf_mirred *m,if (unlikely (!(dev->flags &IFF_UP )) || !netif_carrier_ok (dev)) {net_notice_ratelimited ("tc mirred to Houston: device %s is down\n" , dev->name); - err = -ENODEV ; - goto out; + goto err_cant_do; }/* we could easily avoid the clone only if called by ingress and clsact;
@@ -253,10 +252,8 @@ static int tcf_mirred_to_dev(struct sk_buff *skb, struct tcf_mirred *m,tcf_mirred_can_reinsert (retval);if (!dont_clone) { skb_to_send =skb_clone (skb,GFP_ATOMIC ); -if (!skb_to_send) { - err = -ENOMEM ; - goto out; - } +if (!skb_to_send) + goto err_cant_do; } want_ingress =tcf_mirred_act_wants_ingress (m_eaction);
@@ -293,15 +290,16 @@ static int tcf_mirred_to_dev(struct sk_buff *skb, struct tcf_mirred *m, }else { err =tcf_mirred_forward (at_ingress, want_ingress, skb_to_send); } - -if (err) { -out: +if (err)tcf_action_inc_overlimit_qstats (&m->common); -if (is_redirect) - retval =TC_ACT_SHOT ; - }return retval; + +err_cant_do: +if (is_redirect) + retval =TC_ACT_SHOT ; +tcf_action_inc_overlimit_qstats (&m->common); +return retval; } TC_INDIRECT_SCOPE int tcf_mirred_act(struct sk_buff *skb,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 241/299 nouveau: fix function cast warnings
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 0affdba22aca5573f9d989bcb1d71d32a6a03efe ]
clang-16 warns about casting between incompatible function types:
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c:161:10: error: cast from 'void (*)(const struct firmware *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
161 | .fini = (void(*)(void *))release_firmware,
This one was done to use the generic shadow_fw_release() function as a callback for struct nvbios_source. Change it to use the same prototype as the other five instances, with a trivial helper function that actually calls release_firmware.
--- drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c +7 -1
@@ -154,11 +154,17 @@ shadow_fw_init(struct nvkm_bios *bios, const char *name)return (void *)fw; } +static void +shadow_fw_release (void *fw) +{ +release_firmware (fw); +} +static const struct nvbios_source shadow_fw = { .name ="firmware" , .init = shadow_fw_init, - .fini = (void (*)(void *))release_firmware, + .fini = shadow_fw_release, .read = shadow_fw_read, .rw = false, };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 242/299 x86/numa: Fix the address overlap check in numa_fill_memblks()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alison Schofield <[email protected]>
[ Upstream commit 9b99c17f7510bed2adbe17751fb8abddba5620bc ]
numa_fill_memblks() fills in the gaps in numa_meminfo memblks over a physical address range. To do so, it first creates a list of existing memblks that overlap that address range. The issue is that it is off by one when comparing to the end of the address range, so memblks that do not overlap are selected.
The impact of selecting a memblk that does not actually overlap is that an existing memblk may be filled when the expected action is to do nothing and return NUMA_NO_MEMBLK to the caller. The caller can then add a new NUMA node and memblk.
Replace the broken open-coded search for address overlap with the memblock helper memblock_addrs_overlap(). Update the kernel doc and in code comments.
Suggested by: "Huang, Ying" <[email protected]>
--- arch/x86/mm/numa.c | 19 +++++++------------ include/linux/memblock.h | 2 ++ mm/memblock.c | 5 +++-- 3 files changed, 12 insertions(+), 14 deletions(-)
arch/x86/mm/numa.c +7 -12
@@ -971,14 +971,12 @@ static struct numa_memblk *numa_memblk_list[NR_NODE_MEMBLKS] __initdata;* @start: address to begin fill * @end: address to end fill * -* Find and extend numa_meminfo memblks to cover the @start-@end -* physical address range, such that the first memblk includes -* @start, the last memblk includes @end, and any gaps in between -* are filled. +* Find and extend numa_meminfo memblks to cover the physical +* address range @start-@end * * RETURNS: * 0 : Success -* NUMA_NO_MEMBLK : No memblk exists in @start-@end range +* NUMA_NO_MEMBLK : No memblks exist in address range @start-@end */ int __init numa_fill_memblks (u64 start,u64 end)
@@ -990,17 +988,14 @@ int __init numa_fill_memblks(u64 start, u64 end)/* * Create a list of pointers to numa_meminfo memblks that -* overlap start, end. Exclude (start == bi->end) since -* end addresses in both a CFMWS range and a memblk range -* are exclusive. -* -* This list of pointers is used to make in-place changes -* that fill out the numa_meminfo memblks. +* overlap start, end. The list is used to make in-place +* changes that fill out the numa_meminfo memblks. */ for (int i =0 ; i < mi->nr_blks; i++) {struct numa_memblk *bi = &mi->blk[i]; -if (start < bi->end && end >= bi->start) { +if (memblock_addrs_overlap (start, end - start, bi->start, + bi->end - bi->start)) { blk[count] = &mi->blk[i]; count++; }
include/linux/memblock.h +2 -0
@@ -118,6 +118,8 @@ int memblock_reserve(phys_addr_t base, phys_addr_t size);int memblock_physmem_add (phys_addr_t base,phys_addr_t size);#endif void memblock_trim_memory (phys_addr_t align); +unsigned long memblock_addrs_overlap (phys_addr_t base1,phys_addr_t size1, +phys_addr_t base2,phys_addr_t size2);bool memblock_overlaps_region (struct memblock_type *type,phys_addr_t base,phys_addr_t size);int memblock_mark_hotplug (phys_addr_t base,phys_addr_t size);
mm/memblock.c +3 -2
@@ -180,8 +180,9 @@ static inline phys_addr_t memblock_cap_size(phys_addr_t base, phys_addr_t *size)/* * Address comparison utilities */ -static unsigned long __init_memblock memblock_addrs_overlap (phys_addr_t base1,phys_addr_t size1, -phys_addr_t base2,phys_addr_t size2) +unsigned long __init_memblock +memblock_addrs_overlap (phys_addr_t base1,phys_addr_t size1,phys_addr_t base2, +phys_addr_t size2) {return ((base1 < (base2 + size2)) && (base2 < (base1 + size1))); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 243/299 x86/numa: Fix the sort compare func used in numa_fill_memblks()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alison Schofield <[email protected]>
[ Upstream commit b626070ffc14acca5b87a2aa5f581db98617584c ]
The compare function used to sort memblks into starting address order fails when the result of its u64 address subtraction gets truncated to an int upon return.
The impact of the bad sort is that memblks will be filled out incorrectly. Depending on the set of memblks, a user may see no errors at all but still have a bad fill, or see messages reporting a node overlap that leads to numa init failure:
[] node 0 [mem: ] overlaps with node 1 [mem: ]
[] No NUMA configuration found
Replace with a comparison that can only result in: 1, 0, -1.
--- arch/x86/mm/numa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/mm/numa.c +1 -1
@@ -961,7 +961,7 @@ static int __init cmp_memblk(const void *a, const void *b)const struct numa_memblk *ma = *(const struct numa_memblk **)a;const struct numa_memblk *mb = *(const struct numa_memblk **)b; -return ma->start - mb->start; +return (ma->start > mb->start) - (ma->start < mb->start); }static struct numa_memblk *numa_memblk_list[NR_NODE_MEMBLKS ]__initdata ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 244/299 net: stmmac: Fix incorrect dereference in interrupt handlers
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Sakharov <[email protected]>
[ Upstream commit 97dde84026339e4b4af9a6301f825d1828d7874b ]
If 'dev' or 'data' is NULL, the 'priv' variable has an incorrect address when dereferencing calling netdev_err().
Since we get as 'dev_id' or 'data' what was passed as the 'dev' argument to request_irq() during interrupt initialization (that is, the net_device and rx/tx queue pointers initialized at the time of the call) and since there are usually no checks for the 'dev_id' argument in such handlers in other drivers, remove these checks from the handlers in stmmac driver.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 20 ------------------- 1 file changed, 20 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +0 -20
@@ -5951,11 +5951,6 @@ static irqreturn_t stmmac_mac_interrupt(int irq, void *dev_id)struct net_device *dev = (struct net_device *)dev_id;struct stmmac_priv *priv =netdev_priv (dev); -if (unlikely (!dev)) { -netdev_err (priv->dev,"%s: invalid dev pointer\n" , __func__); -return IRQ_NONE ; - } -/* Check if adapter is up */ if (test_bit (STMMAC_DOWN , &priv->state))return IRQ_HANDLED ;
@@ -5971,11 +5966,6 @@ static irqreturn_t stmmac_safety_interrupt(int irq, void *dev_id)struct net_device *dev = (struct net_device *)dev_id;struct stmmac_priv *priv =netdev_priv (dev); -if (unlikely (!dev)) { -netdev_err (priv->dev,"%s: invalid dev pointer\n" , __func__); -return IRQ_NONE ; - } -/* Check if adapter is up */ if (test_bit (STMMAC_DOWN , &priv->state))return IRQ_HANDLED ;
@@ -5997,11 +5987,6 @@ static irqreturn_t stmmac_msi_intr_tx(int irq, void *data) dma_conf = container_of(tx_q, struct stmmac_dma_conf, tx_queue[chan]); priv = container_of(dma_conf, struct stmmac_priv, dma_conf); -if (unlikely (!data)) { -netdev_err (priv->dev,"%s: invalid dev pointer\n" , __func__); -return IRQ_NONE ; - } -/* Check if adapter is up */ if (test_bit (STMMAC_DOWN , &priv->state))return IRQ_HANDLED ;
@@ -6028,11 +6013,6 @@ static irqreturn_t stmmac_msi_intr_rx(int irq, void *data) dma_conf = container_of(rx_q, struct stmmac_dma_conf, rx_queue[chan]); priv = container_of(dma_conf, struct stmmac_priv, dma_conf); -if (unlikely (!data)) { -netdev_err (priv->dev,"%s: invalid dev pointer\n" , __func__); -return IRQ_NONE ; - } -/* Check if adapter is up */ if (test_bit (STMMAC_DOWN , &priv->state))return IRQ_HANDLED ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 245/299 ipv4: properly combine dev_base_seq and ipv4.dev_addr_genid
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 081a0e3b0d4c061419d3f4679dec9f68725b17e4 ]
net->dev_base_seq and ipv4.dev_addr_genid are monotonically increasing.
If we XOR their values, we could miss to detect if both values were changed with the same amount.
--- net/ipv4/devinet.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
net/ipv4/devinet.c +17 -4
@@ -1825,6 +1825,21 @@ static int in_dev_dump_addr(struct in_device *in_dev, struct sk_buff *skb,return err; } +/* Combine dev_addr_genid and dev_base_seq to detect changes. +*/ +static u32 inet_base_seq (const struct net *net) +{ +u32 res =atomic_read (&net->ipv4.dev_addr_genid) + + net->dev_base_seq; + +/* Must not return 0 (see nl_dump_check_consistent()). +* Chose a value far away from 0. +*/ +if (!res) + res =0x80000000 ; +return res; +} +static int inet_dump_ifaddr (struct sk_buff *skb,struct netlink_callback *cb) {const struct nlmsghdr *nlh = cb->nlh;
@@ -1876,8 +1891,7 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb) idx =0 ; head = &tgt_net->dev_index_head[h];rcu_read_lock (); - cb->seq =atomic_read (&tgt_net->ipv4.dev_addr_genid) ^ - tgt_net->dev_base_seq; + cb->seq =inet_base_seq (tgt_net);hlist_for_each_entry_rcu (dev, head, index_hlist) {if (idx < s_idx) goto cont;
@@ -2278,8 +2292,7 @@ static int inet_netconf_dump_devconf(struct sk_buff *skb, idx =0 ; head = &net->dev_index_head[h];rcu_read_lock (); - cb->seq =atomic_read (&net->ipv4.dev_addr_genid) ^ - net->dev_base_seq; + cb->seq =inet_base_seq (net);hlist_for_each_entry_rcu (dev, head, index_hlist) {if (idx < s_idx) goto cont;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 246/299 ipv6: properly combine dev_base_seq and ipv6.dev_addr_genid
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 e898e4cd1aab271ca414f9ac6e08e4c761f6913c ]
net->dev_base_seq and ipv6.dev_addr_genid are monotonically increasing.
If we XOR their values, we could miss to detect if both values were changed with the same amount.
--- net/ipv6/addrconf.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
net/ipv6/addrconf.c +18 -3
@@ -706,6 +706,22 @@ static int inet6_netconf_get_devconf(struct sk_buff *in_skb,return err; } +/* Combine dev_addr_genid and dev_base_seq to detect changes. +*/ +static u32 inet6_base_seq (const struct net *net) +{ +u32 res =atomic_read (&net->ipv6.dev_addr_genid) + + net->dev_base_seq; + +/* Must not return 0 (see nl_dump_check_consistent()). +* Chose a value far away from 0. +*/ +if (!res) + res =0x80000000 ; +return res; +} + +static int inet6_netconf_dump_devconf (struct sk_buff *skb,struct netlink_callback *cb) {
@@ -739,8 +755,7 @@ static int inet6_netconf_dump_devconf(struct sk_buff *skb, idx =0 ; head = &net->dev_index_head[h];rcu_read_lock (); - cb->seq =atomic_read (&net->ipv6.dev_addr_genid) ^ - net->dev_base_seq; + cb->seq =inet6_base_seq (net);hlist_for_each_entry_rcu (dev, head, index_hlist) {if (idx < s_idx) goto cont;
@@ -5358,7 +5373,7 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb, }rcu_read_lock (); - cb->seq =atomic_read (&tgt_net->ipv6.dev_addr_genid) ^ tgt_net->dev_base_seq; + cb->seq =inet6_base_seq (tgt_net);for (h = s_h; h <NETDEV_HASHENTRIES ; h++, s_idx =0 ) { idx =0 ; head = &tgt_net->dev_index_head[h];
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 247/299 net: bcmasp: Indicate MAC is in charge of PHY PM
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
[ Upstream commit 5b76d928f8b779a1b19c5842e7cabee4cbb610c3 ]
Avoid the PHY library call unnecessarily into the suspend/resume functions by setting phydev->mac_managed_pm to true. The ASP driver essentially does exactly what mdio_bus_phy_resume() does.
--- drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c +3 -0
@@ -1048,6 +1048,9 @@ static int bcmasp_netif_init(struct net_device *dev, bool phy_connect)netdev_err (dev,"could not attach to PHY\n" ); goto err_phy_disable; } + +/* Indicate that the MAC is responsible for PHY PM */ + phydev->mac_managed_pm = true; }else if (!intf->wolopts) { ret =phy_resume (dev->phydev);if (ret)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 248/299 net: bcmasp: Sanity check is off by one
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Justin Chen <[email protected]>
[ Upstream commit f120e62e37f0af4c4cbe08e5a88ea60a6a17c858 ]
A sanity check for OOB write is off by one leading to a false positive when the array is full.
--- drivers/net/ethernet/broadcom/asp2/bcmasp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/asp2/bcmasp.c +3 -3
@@ -535,9 +535,6 @@ int bcmasp_netfilt_get_all_active(struct bcmasp_intf *intf, u32 *rule_locs,int j =0 , i;for (i =0 ; i <NUM_NET_FILTERS ; i++) { -if (j == *rule_cnt) -return -EMSGSIZE ; -if (!priv->net_filters[i].claimed || priv->net_filters[i].port != intf->port)continue ;
@@ -547,6 +544,9 @@ int bcmasp_netfilt_get_all_active(struct bcmasp_intf *intf, u32 *rule_locs, priv->net_filters[i - 1].wake_filter)continue ; +if (j == *rule_cnt) +return -EMSGSIZE ; + rule_locs[j++] = priv->net_filters[i].fs.location; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 249/299 powerpc/pseries/iommu: DLPAR add doesnt completely initialize pci_controller
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gaurav Batra <[email protected]>
[ Upstream commit a5c57fd2e9bd1c8ea8613a8f94fd0be5eccbf321 ]
When a PCI device is dynamically added, the kernel oopses with a NULL pointer dereference:
BUG: Kernel NULL pointer dereference on read at 0x00000030 Faulting instruction address: 0xc0000000006bbe5c Oops: Kernel access of bad area, sig: 11 [#1] LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries Modules linked in: rpadlpar_io rpaphp rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver nfs lockd grace fscache netfs xsk_diag bonding nft_compat nf_tables nfnetlink rfkill binfmt_misc dm_multipath rpcrdma sunrpc rdma_ucm ib_srpt ib_isert iscsi_target_mod target_core_mod ib_umad ib_iser libiscsi scsi_transport_iscsi ib_ipoib rdma_cm iw_cm ib_cm mlx5_ib ib_uverbs ib_core pseries_rng drm drm_panel_orientation_quirks xfs libcrc32c mlx5_core mlxfw sd_mod t10_pi sg tls ibmvscsi ibmveth scsi_transport_srp vmx_crypto pseries_wdt psample dm_mirror dm_region_hash dm_log dm_mod fuse CPU: 17 PID: 2685 Comm: drmgr Not tainted 6.7.0-203405+ #66 Hardware name: IBM,9080-HEX POWER10 (raw) 0x800200 0xf000006 of:IBM,FW1060.00 (NH1060_008) hv:phyp pSeries NIP: c0000000006bbe5c LR: c000000000a13e68 CTR: c0000000000579f8 REGS: c00000009924f240 TRAP: 0300 Not tainted (6.7.0-203405+) MSR: 8000000000009033 <SF,EE,ME,IR,DR,RI,LE> CR: 24002220 XER: 20040006 CFAR: c000000000a13e64 DAR: 0000000000000030 DSISR: 40000000 IRQMASK: 0 ... NIP sysfs_add_link_to_group+0x34/0x94 LR iommu_device_link+0x5c/0x118 Call Trace: iommu_init_device+0x26c/0x318 (unreliable) iommu_device_link+0x5c/0x118 iommu_init_device+0xa8/0x318 iommu_probe_device+0xc0/0x134 iommu_bus_notifier+0x44/0x104 notifier_call_chain+0xb8/0x19c blocking_notifier_call_chain+0x64/0x98 bus_notify+0x50/0x7c device_add+0x640/0x918 pci_device_add+0x23c/0x298 of_create_pci_dev+0x400/0x884 of_scan_pci_dev+0x124/0x1b0 __of_scan_bus+0x78/0x18c pcibios_scan_phb+0x2a4/0x3b0 init_phb_dynamic+0xb8/0x110 dlpar_add_slot+0x170/0x3b8 [rpadlpar_io] add_slot_store.part.0+0xb4/0x130 [rpadlpar_io] kobj_attr_store+0x2c/0x48 sysfs_kf_write+0x64/0x78 kernfs_fop_write_iter+0x1b0/0x290 vfs_write+0x350/0x4a0 ksys_write+0x84/0x140 system_call_exception+0x124/0x330 system_call_vectored_common+0x15c/0x2ec
Commit a940904443e4 ("powerpc/iommu: Add iommu_ops to report capabilities and allow blocking domains") broke DLPAR add of PCI devices.
The above added iommu_device structure to pci_controller. During system boot, PCI devices are discovered and this newly added iommu_device structure is initialized by a call to iommu_device_register().
During DLPAR add of a PCI device, a new pci_controller structure is allocated but there are no calls made to iommu_device_register() interface.
Fix is to register the iommu device during DLPAR add as well.
--- arch/powerpc/include/asm/ppc-pci.h | 10 ++++++++++ arch/powerpc/kernel/iommu.c | 23 ++++++++++++++++------ arch/powerpc/platforms/pseries/pci_dlpar.c | 4 ++++ 3 files changed, 31 insertions(+), 6 deletions(-)
arch/powerpc/include/asm/ppc-pci.h +10 -0
@@ -30,6 +30,16 @@ void *pci_traverse_device_nodes(struct device_node *start, void *data);extern void pci_devs_phb_init_dynamic (struct pci_controller *phb); +#if defined(CONFIG_IOMMU_API ) && (defined(CONFIG_PPC_PSERIES ) || \ + defined(CONFIG_PPC_POWERNV )) +extern void ppc_iommu_register_device (struct pci_controller *phb); +extern void ppc_iommu_unregister_device (struct pci_controller *phb); +#else +static inline void ppc_iommu_register_device (struct pci_controller *phb) { } +static inline void ppc_iommu_unregister_device (struct pci_controller *phb) { } +#endif + +/* From rtas_pci.h */ extern void init_pci_config_tokens (void );extern unsigned long get_phb_buid (struct device_node *);
arch/powerpc/kernel/iommu.c +17 -6
@@ -1344,7 +1344,7 @@ static struct iommu_device *spapr_tce_iommu_probe_device(struct device *dev)struct pci_controller *hose;if (!dev_is_pci (dev)) -return ERR_PTR (-EPERM ); +return ERR_PTR (-ENODEV ); pdev =to_pci_dev (dev); hose = pdev->bus->sysdata;
@@ -1393,6 +1393,21 @@ static const struct attribute_group *spapr_tce_iommu_groups[] = { NULL, }; +void ppc_iommu_register_device (struct pci_controller *phb) +{ +iommu_device_sysfs_add (&phb->iommu, phb->parent, + spapr_tce_iommu_groups,"iommu-phb%04x" , + phb->global_number); +iommu_device_register (&phb->iommu, &spapr_tce_iommu_ops, + phb->parent); +} + +void ppc_iommu_unregister_device (struct pci_controller *phb) +{ +iommu_device_unregister (&phb->iommu); +iommu_device_sysfs_remove (&phb->iommu); +} +/* * This registers IOMMU devices of PHBs. This needs to happen * after core_initcall(iommu_init) + postcore_initcall(pci_driver_init) and
@@ -1403,11 +1418,7 @@ static int __init spapr_tce_setup_phb_iommus_initcall(void)struct pci_controller *hose;list_for_each_entry (hose, &hose_list, list_node) { -iommu_device_sysfs_add (&hose->iommu, hose->parent, - spapr_tce_iommu_groups,"iommu-phb%04x" , - hose->global_number); -iommu_device_register (&hose->iommu, &spapr_tce_iommu_ops, - hose->parent); +ppc_iommu_register_device (hose); }return 0 ; }
arch/powerpc/platforms/pseries/pci_dlpar.c +4 -0
@@ -35,6 +35,8 @@ struct pci_controller *init_phb_dynamic(struct device_node *dn)pseries_msi_allocate_domains (phb); +ppc_iommu_register_device (phb); +/* Create EEH devices for the PHB */ eeh_phb_pe_create (phb);
@@ -76,6 +78,8 @@ int remove_phb_dynamic(struct pci_controller *phb) } } +ppc_iommu_unregister_device (phb); +pseries_msi_free_domains (phb);/* Keep a reference so phb isn't freed yet */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 250/299 selftests: bonding: set active slave to primary eth1 specifically
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
[ Upstream commit cd65c48d66920457129584553f217005d09b1edb ]
In bond priority testing, we set the primary interface to eth1 and add eth0,1,2 to bond in serial. This is OK in normal times. But when in debug kernel, the bridge port that eth0,1,2 connected would start slowly (enter blocking, forwarding state), which caused the primary interface down for a while after enslaving and active slave changed. Here is a test log from Jakub's debug test[1].
[ 400.399070][ T50] br0: port 1(s0) entered disabled state [ 400.400168][ T50] br0: port 4(s2) entered disabled state [ 400.941504][ T2791] bond0: (slave eth0): making interface the new active one [ 400.942603][ T2791] bond0: (slave eth0): Enslaving as an active interface with an up link [ 400.943633][ T2766] br0: port 1(s0) entered blocking state [ 400.944119][ T2766] br0: port 1(s0) entered forwarding state [ 401.128792][ T2792] bond0: (slave eth1): making interface the new active one [ 401.130771][ T2792] bond0: (slave eth1): Enslaving as an active interface with an up link [ 401.131643][ T69] br0: port 2(s1) entered blocking state [ 401.132067][ T69] br0: port 2(s1) entered forwarding state [ 401.346201][ T2793] bond0: (slave eth2): Enslaving as a backup interface with an up link [ 401.348414][ T50] br0: port 4(s2) entered blocking state [ 401.348857][ T50] br0: port 4(s2) entered forwarding state [ 401.519669][ T250] bond0: (slave eth0): link status definitely down, disabling slave [ 401.526522][ T250] bond0: (slave eth1): link status definitely down, disabling slave [ 401.526986][ T250] bond0: (slave eth2): making interface the new active one [ 401.629470][ T250] bond0: (slave eth0): link status definitely up [ 401.630089][ T250] bond0: (slave eth1): link status definitely up [...] # TEST: prio (active-backup ns_ip6_target primary_reselect 1) [FAIL] # Current active slave is eth2 but not eth1
Fix it by setting active slave to primary slave specifically before testing.
[1] https://netdev-3.bots.linux.dev/vmksft-bonding-dbg/results/464301/1-bond-options-sh/stdout
--- tools/testing/selftests/drivers/net/bonding/bond_options.sh | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/drivers/net/bonding/bond_options.sh +2 -0
@@ -62,6 +62,8 @@ prio_test() # create bond bond_reset "${param}" + # set active_slave to primary eth1 specifically + ip -n ${s_ns} link set bond0 type bond active_slave eth1 # check bonding member prio value ip -n ${s_ns} link set eth0 type bond_slave prio 0
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 251/299 ata: ahci_ceva: fix error handling for Xilinx GT PHY support
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Radhey Shyam Pandey <[email protected]>
[ Upstream commit 26c8404e162b43dddcb037ba2d0cb58c0ed60aab ]
Platform clock and phy error resources are not cleaned up in Xilinx GT PHY error path.
To fix introduce the function ceva_ahci_platform_enable_resources() which is a customized version of ahci_platform_enable_resources() and inline with SATA IP programming sequence it does:
- Assert SATA reset
- Program PS GTR phy
- Bring SATA by de-asserting the reset
- Wait for GT lane PLL to be locked
ceva_ahci_platform_enable_resources() is also used in the resume path as the same SATA programming sequence (as in probe) should be followed. Also cleanup the mixed usage of ahci_platform_enable_resources() and custom implementation in the probe function as both are not required.
--- drivers/ata/ahci_ceva.c | 125 +++++++++++++++++++++++++--------------- 1 file changed, 79 insertions(+), 46 deletions(-)
drivers/ata/ahci_ceva.c +79 -46
@@ -88,7 +88,6 @@ struct ceva_ahci_priv {u32 axicc;bool is_cci_enabled;int flags; -struct reset_control *rst; }; static unsigned int ceva_ahci_read_id(struct ata_device *dev,
@@ -189,6 +188,60 @@ static const struct scsi_host_template ahci_platform_sht = { AHCI_SHT(DRV_NAME), }; +static int ceva_ahci_platform_enable_resources (struct ahci_host_priv *hpriv) +{ +int rc, i; + + rc =ahci_platform_enable_regulators (hpriv); +if (rc) +return rc; + + rc =ahci_platform_enable_clks (hpriv); +if (rc) + goto disable_regulator; + +/* Assert the controller reset */ + rc =ahci_platform_assert_rsts (hpriv); +if (rc) + goto disable_clks; + +for (i =0 ; i < hpriv->nports; i++) { + rc =phy_init (hpriv->phys[i]); +if (rc) + goto disable_rsts; + } + +/* De-assert the controller reset */ +ahci_platform_deassert_rsts (hpriv); + +for (i =0 ; i < hpriv->nports; i++) { + rc =phy_power_on (hpriv->phys[i]); +if (rc) { +phy_exit (hpriv->phys[i]); + goto disable_phys; + } + } + +return 0 ; + +disable_rsts: +ahci_platform_deassert_rsts (hpriv); + +disable_phys: +while (--i >=0 ) { +phy_power_off (hpriv->phys[i]); +phy_exit (hpriv->phys[i]); + } + +disable_clks: +ahci_platform_disable_clks (hpriv); + +disable_regulator: +ahci_platform_disable_regulators (hpriv); + +return rc; +} +static int ceva_ahci_probe (struct platform_device *pdev) {struct device_node *np = pdev->dev.of_node;
@@ -203,47 +256,19 @@ static int ceva_ahci_probe(struct platform_device *pdev)return -ENOMEM ; cevapriv->ahci_pdev = pdev; - - cevapriv->rst =devm_reset_control_get_optional_exclusive (&pdev->dev, -NULL ); -if (IS_ERR (cevapriv->rst)) -dev_err_probe (&pdev->dev,PTR_ERR (cevapriv->rst), -"failed to get reset\n" ); - hpriv =ahci_platform_get_resources (pdev,0 );if (IS_ERR (hpriv))return PTR_ERR (hpriv); -if (!cevapriv->rst) { - rc =ahci_platform_enable_resources (hpriv); -if (rc) -return rc; - }else { -int i; + hpriv->rsts =devm_reset_control_get_optional_exclusive (&pdev->dev, +NULL ); +if (IS_ERR (hpriv->rsts)) +return dev_err_probe (&pdev->dev,PTR_ERR (hpriv->rsts), +"failed to get reset\n" ); - rc =ahci_platform_enable_clks (hpriv); -if (rc) -return rc; -/* Assert the controller reset */ -reset_control_assert (cevapriv->rst); - -for (i =0 ; i < hpriv->nports; i++) { - rc =phy_init (hpriv->phys[i]); -if (rc) -return rc; - } - -/* De-assert the controller reset */ -reset_control_deassert (cevapriv->rst); - -for (i =0 ; i < hpriv->nports; i++) { - rc =phy_power_on (hpriv->phys[i]); -if (rc) { -phy_exit (hpriv->phys[i]); -return rc; - } - } - } + rc =ceva_ahci_platform_enable_resources (hpriv); +if (rc) +return rc;if (of_property_read_bool (np,"ceva,broken-gen2" )) cevapriv->flags =CEVA_FLAG_BROKEN_GEN2 ;
@@ -252,52 +277,60 @@ static int ceva_ahci_probe(struct platform_device *pdev)if (of_property_read_u8_array (np,"ceva,p0-cominit-params" , (u8 *)&cevapriv->pp2c[0 ],4 ) <0 ) {dev_warn (dev,"ceva,p0-cominit-params property not defined\n" ); -return -EINVAL ; + rc = -EINVAL ; + goto disable_resources; }if (of_property_read_u8_array (np,"ceva,p1-cominit-params" , (u8 *)&cevapriv->pp2c[1 ],4 ) <0 ) {dev_warn (dev,"ceva,p1-cominit-params property not defined\n" ); -return -EINVAL ; + rc = -EINVAL ; + goto disable_resources; }/* Read OOB timing value for COMWAKE from device-tree*/ if (of_property_read_u8_array (np,"ceva,p0-comwake-params" , (u8 *)&cevapriv->pp3c[0 ],4 ) <0 ) {dev_warn (dev,"ceva,p0-comwake-params property not defined\n" ); -return -EINVAL ; + rc = -EINVAL ; + goto disable_resources; }if (of_property_read_u8_array (np,"ceva,p1-comwake-params" , (u8 *)&cevapriv->pp3c[1 ],4 ) <0 ) {dev_warn (dev,"ceva,p1-comwake-params property not defined\n" ); -return -EINVAL ; + rc = -EINVAL ; + goto disable_resources; }/* Read phy BURST timing value from device-tree */ if (of_property_read_u8_array (np,"ceva,p0-burst-params" , (u8 *)&cevapriv->pp4c[0 ],4 ) <0 ) {dev_warn (dev,"ceva,p0-burst-params property not defined\n" ); -return -EINVAL ; + rc = -EINVAL ; + goto disable_resources; }if (of_property_read_u8_array (np,"ceva,p1-burst-params" , (u8 *)&cevapriv->pp4c[1 ],4 ) <0 ) {dev_warn (dev,"ceva,p1-burst-params property not defined\n" ); -return -EINVAL ; + rc = -EINVAL ; + goto disable_resources; }/* Read phy RETRY interval timing value from device-tree */ if (of_property_read_u16_array (np,"ceva,p0-retry-params" , (u16 *)&cevapriv->pp5c[0 ],2 ) <0 ) {dev_warn (dev,"ceva,p0-retry-params property not defined\n" ); -return -EINVAL ; + rc = -EINVAL ; + goto disable_resources; }if (of_property_read_u16_array (np,"ceva,p1-retry-params" , (u16 *)&cevapriv->pp5c[1 ],2 ) <0 ) {dev_warn (dev,"ceva,p1-retry-params property not defined\n" ); -return -EINVAL ; + rc = -EINVAL ; + goto disable_resources; }/*
@@ -335,7 +368,7 @@ static int __maybe_unused ceva_ahci_resume(struct device *dev)struct ahci_host_priv *hpriv = host->private_data;int rc; - rc =ahci_platform_enable_resources (hpriv); + rc =ceva_ahci_platform_enable_resources (hpriv);if (rc)return rc;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 252/299 bpf: Fix racing between bpf_timer_cancel_and_free and bpf_timer_cancel
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin KaFai Lau <[email protected]>
[ Upstream commit 0281b919e175bb9c3128bd3872ac2903e9436e3f ]
The following race is possible between bpf_timer_cancel_and_free and bpf_timer_cancel. It will lead a UAF on the timer->timer.
bpf_timer_cancel(); spin_lock(); t = timer->time; spin_unlock(); bpf_timer_cancel_and_free(); spin_lock(); t = timer->timer; timer->timer = NULL; spin_unlock(); hrtimer_cancel(&t->timer); kfree(t); /* UAF on t */ hrtimer_cancel(&t->timer);
In bpf_timer_cancel_and_free, this patch frees the timer->timer after a rcu grace period. This requires a rcu_head addition to the "struct bpf_hrtimer". Another kfree(t) happens in bpf_timer_init, this does not need a kfree_rcu because it is still under the spin_lock and timer->timer has not been visible by others yet.
In bpf_timer_cancel, rcu_read_lock() is added because this helper can be used in a non rcu critical section context (e.g. from a sleepable bpf prog). Other timer->timer usages in helpers.c have been audited, bpf_timer_cancel() is the only place where timer->timer is used outside of the spin_lock.
Another solution considered is to mark a t->flag in bpf_timer_cancel and clear it after hrtimer_cancel() is done. In bpf_timer_cancel_and_free, it busy waits for the flag to be cleared before kfree(t). This patch goes with a straight forward solution and frees timer->timer after a rcu grace period.
--- kernel/bpf/helpers.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/bpf/helpers.c +4 -1
@@ -1100,6 +1100,7 @@ struct bpf_hrtimer {struct bpf_prog *prog;void __rcu *callback_fn;void *value; +struct rcu_head rcu; };/* the actual struct hidden inside uapi struct bpf_timer */
@@ -1328,6 +1329,7 @@ BPF_CALL_1(bpf_timer_cancel, struct bpf_timer_kern *, timer)if (in_nmi ())return -EOPNOTSUPP ; +rcu_read_lock ();__bpf_spin_lock_irqsave (&timer->lock); t = timer->timer;if (!t) {
@@ -1349,6 +1351,7 @@ BPF_CALL_1(bpf_timer_cancel, struct bpf_timer_kern *, timer)* if it was running. */ ret = ret ?:hrtimer_cancel (&t->timer); +rcu_read_unlock ();return ret; }
@@ -1403,7 +1406,7 @@ void bpf_timer_cancel_and_free(void *val)*/ if (this_cpu_read (hrtimer_running) != t)hrtimer_cancel (&t->timer); -kfree (t); +kfree_rcu (t, rcu); } BPF_CALL_2(bpf_kptr_xchg, void *, map_value, void *, ptr)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 253/299 parisc: Fix stack unwinder
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 882a2a724ee964c1ebe7268a91d5c8c8ddc796bf ]
Debugging shows a large number of unaligned access traps in the unwinder code. Code analysis reveals a number of issues with this code:
- handle_interruption is passed twice through dereference_kernel_function_descriptor()
- ret_from_kernel_thread, syscall_exit, intr_return, _switch_to_ret, and _call_on_stack are passed through dereference_kernel_function_descriptor() even though they are not declared as function pointers.
To fix the problems, drop one of the calls to dereference_kernel_function_descriptor() for handle_interruption, and compare the other pointers directly.
--- arch/parisc/kernel/unwind.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
arch/parisc/kernel/unwind.c +6 -8
@@ -228,10 +228,8 @@ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, int#ifdef CONFIG_IRQSTACKS extern void *const _call_on_stack;#endif /* CONFIG_IRQSTACKS */ -void *ptr; - ptr =dereference_kernel_function_descriptor (&handle_interruption); -if (pc_is_kernel_fn (pc, ptr)) { +if (pc_is_kernel_fn (pc, handle_interruption)) {struct pt_regs *regs = (struct pt_regs *)(info->sp - frame_size -PT_SZ_ALGN );dbg ("Unwinding through handle_interruption()\n" ); info->prev_sp = regs->gr[30 ];
@@ -239,13 +237,13 @@ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, intreturn 1 ; } -if (pc_is_kernel_fn (pc, ret_from_kernel_thread) || -pc_is_kernel_fn (pc, syscall_exit)) { +if (pc == (unsigned long )&ret_from_kernel_thread || + pc == (unsigned long )&syscall_exit) { info->prev_sp = info->prev_ip =0 ;return 1 ; } -if (pc_is_kernel_fn (pc, intr_return)) { +if (pc == (unsigned long )&intr_return) {struct pt_regs *regs;dbg ("Found intr_return()\n" );
@@ -257,14 +255,14 @@ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, int }if (pc_is_kernel_fn (pc, _switch_to) || -pc_is_kernel_fn (pc, _switch_to_ret)) { + pc == (unsigned long )&_switch_to_ret) { info->prev_sp = info->sp -CALLEE_SAVE_FRAME_SIZE ; info->prev_ip = *(unsigned long *)(info->prev_sp -RP_OFFSET );return 1 ; }#ifdef CONFIG_IRQSTACKS -if (pc_is_kernel_fn (pc, _call_on_stack)) { +if (pc == (unsigned long )&_call_on_stack) { info->prev_sp = *(unsigned long *)(info->sp -FRAME_SIZE -REG_SZ ); info->prev_ip = *(unsigned long *)(info->sp -FRAME_SIZE -RP_OFFSET );return 1 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 254/299 afs: Increase buffer size in afs_update_volume_status()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniil Dulov <[email protected]>
[ Upstream commit 6ea38e2aeb72349cad50e38899b0ba6fbcb2af3d ]
The max length of volume->vid value is 20 characters. So increase idbuf[] size up to 24 to avoid overflow.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
[DH: Actually, it's 20 + NUL, so increase it to 24 and use snprintf()]
--- fs/afs/volume.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/afs/volume.c +2 -2
@@ -337,7 +337,7 @@ static int afs_update_volume_status(struct afs_volume *volume, struct key *key) {struct afs_server_list *new, *old, *discard;struct afs_vldb_entry *vldb; -char idbuf[16 ]; +char idbuf[24 ];int ret, idsz;_enter ("" );
@@ -345,7 +345,7 @@ static int afs_update_volume_status(struct afs_volume *volume, struct key *key)/* We look up an ID by passing it as a decimal string in the * operation's name parameter. */ - idsz =sprintf (idbuf,"%llu" , volume->vid); + idsz =snprintf (idbuf,sizeof (idbuf),"%llu" , volume->vid); vldb =afs_vl_lookup_vldb (volume->cell, key, idbuf, idsz);if (IS_ERR (vldb)) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 255/299 ipv6: sr: fix possible use-after-free and null-ptr-deref
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasiliy Kovalev <[email protected]>
[ Upstream commit 5559cea2d5aa3018a5f00dd2aca3427ba09b386b ]
The pernet operations structure for the subsystem must be registered before registering the generic netlink family.
--- net/ipv6/seg6.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
net/ipv6/seg6.c +11 -9
@@ -512,22 +512,24 @@ int __init seg6_init(void) {int err; - err =genl_register_family (&seg6_genl_family); + err =register_pernet_subsys (&ip6_segments_ops);if (err) goto out; - err =register_pernet_subsys (&ip6_segments_ops); + err =genl_register_family (&seg6_genl_family);if (err) - goto out_unregister_genl; + goto out_unregister_pernet;#ifdef CONFIG_IPV6_SEG6_LWTUNNEL err =seg6_iptunnel_init ();if (err) - goto out_unregister_pernet; + goto out_unregister_genl; err =seg6_local_init (); -if (err) - goto out_unregister_pernet; +if (err) { +seg6_iptunnel_exit (); + goto out_unregister_genl; + }#endif #ifdef CONFIG_IPV6_SEG6_HMAC
@@ -548,11 +550,11 @@ int __init seg6_init(void)#endif #endif #ifdef CONFIG_IPV6_SEG6_LWTUNNEL -out_unregister_pernet: -unregister_pernet_subsys (&ip6_segments_ops); -#endif out_unregister_genl:genl_unregister_family (&seg6_genl_family); +#endif +out_unregister_pernet: +unregister_pernet_subsys (&ip6_segments_ops); goto out; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 256/299 devlink: fix possible use-after-free and memory leaks in devlink_init()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasiliy Kovalev <[email protected]>
[ Upstream commit def689fc26b9a9622d2e2cb0c4933dd3b1c8071c ]
The pernet operations structure for the subsystem must be registered before registering the generic netlink family.
Make an unregister in case of unsuccessful registration.
--- net/devlink/core.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
net/devlink/core.c +9 -3
@@ -308,14 +308,20 @@ static int __init devlink_init(void) {int err; - err =genl_register_family (&devlink_nl_family); -if (err) - goto out; err =register_pernet_subsys (&devlink_pernet_ops);if (err) goto out; + err =genl_register_family (&devlink_nl_family); +if (err) + goto out_unreg_pernet_subsys; err =register_netdevice_notifier (&devlink_port_netdevice_nb); +if (!err) +return 0 ; + +genl_unregister_family (&devlink_nl_family); +out_unreg_pernet_subsys: +unregister_pernet_subsys (&devlink_pernet_ops); out:WARN_ON (err);return err;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 257/299 arp: Prevent overflow in arp_req_get().
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 a7d6027790acea24446ddd6632d394096c0f4667 ]
syzkaller reported an overflown write in arp_req_get(). [0]
When ioctl(SIOCGARP) is issued, arp_req_get() looks up an neighbour entry and copies neigh->ha to struct arpreq.arp_ha.sa_data.
The arp_ha here is struct sockaddr, not struct sockaddr_storage, so the sa_data buffer is just 14 bytes.
In the splat below, 2 bytes are overflown to the next int field, arp_flags. We initialise the field just after the memcpy(), so it's not a problem.
However, when dev->addr_len is greater than 22 (e.g. MAX_ADDR_LEN), arp_netmask is overwritten, which could be set as htonl(0xFFFFFFFFUL) in arp_ioctl() before calling arp_req_get().
To avoid the overflow, let's limit the max length of memcpy().
Note that commit b5f0de6df6dc ("net: dev: Convert sa_data to flexible array in struct sockaddr") just silenced syzkaller.
[0]:
memcpy: detected field-spanning write (size 16) of single field "r->arp_ha.sa_data" at net/ipv4/arp.c:1128 (size 14)
WARNING: CPU: 0 PID: 144638 at net/ipv4/arp.c:1128 arp_req_get+0x411/0x4a0 net/ipv4/arp.c:1128 Modules linked in: CPU: 0 PID: 144638 Comm: syz-executor.4 Not tainted 6.1.74 #31 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-debian-1.16.0-5 04/01/2014 RIP: 0010:arp_req_get+0x411/0x4a0 net/ipv4/arp.c:1128 Code: fd ff ff e8 41 42 de fb b9 0e 00 00 00 4c 89 fe 48 c7 c2 20 6d ab 87 48 c7 c7 80 6d ab 87 c6 05 25 af 72 04 01 e8 5f 8d ad fb <0f> 0b e9 6c fd ff ff e8 13 42 de fb be 03 00 00 00 4c 89 e7 e8 a6 RSP: 0018:ffffc900050b7998 EFLAGS: 00010286 RAX: 0000000000000000 RBX: ffff88803a815000 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffffff8641a44a RDI: 0000000000000001 RBP: ffffc900050b7a98 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 203a7970636d656d R12: ffff888039c54000 R13: 1ffff92000a16f37 R14: ffff88803a815084 R15: 0000000000000010 FS: 00007f172bf306c0(0000) GS:ffff88805aa00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f172b3569f0 CR3: 0000000057f12005 CR4: 0000000000770ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: <TASK> arp_ioctl+0x33f/0x4b0 net/ipv4/arp.c:1261 inet_ioctl+0x314/0x3a0 net/ipv4/af_inet.c:981 sock_do_ioctl+0xdf/0x260 net/socket.c:1204 sock_ioctl+0x3ef/0x650 net/socket.c:1321 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __x64_sys_ioctl+0x18e/0x220 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x37/0x90 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x64/0xce RIP: 0033:0x7f172b262b8d Code: 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f172bf300b8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f172b3abf80 RCX: 00007f172b262b8d RDX: 0000000020000000 RSI: 0000000000008954 RDI: 0000000000000003 RBP: 00007f172b2d3493 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f172b3abf80 R15: 00007f172bf10000 </TASK>
--- net/ipv4/arp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv4/arp.c +2 -1
@@ -1125,7 +1125,8 @@ static int arp_req_get(struct arpreq *r, struct net_device *dev)if (neigh) {if (!(READ_ONCE (neigh->nud_state) &NUD_NOARP )) {read_lock_bh (&neigh->lock); -memcpy (r->arp_ha.sa_data, neigh->ha, dev->addr_len); +memcpy (r->arp_ha.sa_data, neigh->ha, +min (dev->addr_len,sizeof (r->arp_ha.sa_data_min))); r->arp_flags =arp_state_to_flags (neigh);read_unlock_bh (&neigh->lock); r->arp_ha.sa_family = dev->type;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 258/299 arm64/sme: Restore SME registers on exit from suspend
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
[ Upstream commit 9533864816fb4a6207c63b7a98396351ce1a9fae ]
The fields in SMCR_EL1 and SMPRI_EL1 reset to an architecturally UNKNOWN value. Since we do not otherwise manage the traps configured in this register at runtime we need to reconfigure them after a suspend in case nothing else was kind enough to preserve them for us.
The vector length will be restored as part of restoring the SME state for the next SME using task.
--- arch/arm64/include/asm/fpsimd.h | 2 ++ arch/arm64/kernel/fpsimd.c | 14 ++++++++++++++ arch/arm64/kernel/suspend.c | 3 +++ 3 files changed, 19 insertions(+)
arch/arm64/include/asm/fpsimd.h +2 -0
@@ -360,6 +360,7 @@ extern void sme_alloc(struct task_struct *task, bool flush);extern unsigned int sme_get_vl (void );extern int sme_set_current_vl (unsigned long arg);extern int sme_get_current_vl (void ); +extern void sme_suspend_exit (void );/* * Return how many bytes of memory are required to store the full SME
@@ -395,6 +396,7 @@ static inline int sme_max_vl(void) { return 0; }static inline int sme_max_virtualisable_vl (void ) {return 0 ; }static inline int sme_set_current_vl (unsigned long arg) {return -EINVAL ; }static inline int sme_get_current_vl (void ) {return -EINVAL ; } +static inline void sme_suspend_exit (void ) { }static inline size_t sme_state_size (struct task_struct const *task) {
arch/arm64/kernel/fpsimd.c +14 -0
@@ -1406,6 +1406,20 @@ void __init sme_setup(void) get_sme_default_vl()); } +void sme_suspend_exit (void ) +{ +u64 smcr =0 ; + +if (!system_supports_sme ()) +return ; + +if (system_supports_fa64 ()) + smcr |= SMCR_ELx_FA64; + +write_sysreg_s (smcr,SYS_SMCR_EL1 ); +write_sysreg_s (0 ,SYS_SMPRI_EL1 ); +} +#endif /* CONFIG_ARM64_SME */ static void sve_init_regs (void )
arch/arm64/kernel/suspend.c +3 -0
@@ -12,6 +12,7 @@#include <asm/daifflags.h> #include <asm/debug-monitors.h> #include <asm/exec.h> +#include <asm/fpsimd.h> #include <asm/mte.h> #include <asm/memory.h> #include <asm/mmu_context.h>
@@ -80,6 +81,8 @@ void notrace __cpu_suspend_exit(void)*/ spectre_v4_enable_mitigation (NULL ); +sme_suspend_exit (); +/* Restore additional feature-specific configuration */ ptrauth_suspend_exit (); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 259/299 arm64/sme: Restore SMCR_EL1.EZT0 on exit from suspend
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
[ Upstream commit d7b77a0d565b048cb0808fa8a4fb031352b22a01 ]
The fields in SMCR_EL1 reset to an architecturally UNKNOWN value. Since we do not otherwise manage the traps configured in this register at runtime we need to reconfigure them after a suspend in case nothing else was kind enough to preserve them for us. Do so for SMCR_EL1.EZT0.
--- arch/arm64/kernel/fpsimd.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/kernel/fpsimd.c +2 -0
@@ -1415,6 +1415,8 @@ void sme_suspend_exit(void)if (system_supports_fa64 ()) smcr |= SMCR_ELx_FA64; +if (system_supports_sme2 ()) + smcr |= SMCR_ELx_EZT0;write_sysreg_s (smcr,SYS_SMCR_EL1 );write_sysreg_s (0 ,SYS_SMPRI_EL1 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 260/299 platform/x86: thinkpad_acpi: Only update profile if successfully converted
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit 427c70dec738318b7f71e1b9d829ff0e9771d493 ]
Randomly a Lenovo Z13 will trigger a kernel warning traceback from this condition:
``` if (WARN_ON((profile < 0) || (profile >= ARRAY_SIZE(profile_names)))) ```
This happens because thinkpad-acpi always assumes that convert_dytc_to_profile() successfully updated the profile. On the contrary a condition can occur that when dytc_profile_refresh() is called the profile doesn't get updated as there is a -EOPNOTSUPP branch.
Catch this situation and avoid updating the profile. Also log this into dynamic debugging in case any other modes should be added in the future.
--- drivers/platform/x86/thinkpad_acpi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +3 -2
@@ -10308,6 +10308,7 @@ static int convert_dytc_to_profile(int funcmode, int dytcmode,return 0 ;default :/* Unknown function */ +pr_debug ("unknown function 0x%x\n" , funcmode);return -EOPNOTSUPP ; }return 0 ;
@@ -10493,8 +10494,8 @@ static void dytc_profile_refresh(void)return ; perfmode = (output >>DYTC_GET_MODE_BIT ) &0xF ; -convert_dytc_to_profile (funcmode, perfmode, &profile); -if (profile != dytc_current_profile) { + err =convert_dytc_to_profile (funcmode, perfmode, &profile); +if (!err && profile != dytc_current_profile) { dytc_current_profile = profile;platform_profile_notify (); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 261/299 drm/i915/tv: Fix TV mode
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Ripard <[email protected]>
[ Upstream commit fb1e881273f432e593f8789f99e725b09304cc97 ]
Commit 1fd4a5a36f9f ("drm/connector: Rename legacy TV property") failed to update all the users of the struct drm_tv_connector_state mode field, which resulted in a build failure in i915.
However, a subsequent commit in the same series reintroduced a mode field in that structure, with a different semantic but the same type, with the assumption that all previous users were updated.
Since that didn't happen, the i915 driver now compiles, but mixes accesses to the legacy_mode field and the newer mode field, but with the previous semantics.
This obviously doesn't work very well, so we need to update the accesses that weren't in the legacy renaming commit.
--- drivers/gpu/drm/i915/display/intel_sdvo.c | 10 +++++----- drivers/gpu/drm/i915/display/intel_tv.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/display/intel_sdvo.c +5 -5
@@ -1212,7 +1212,7 @@ static bool intel_sdvo_set_tv_format(struct intel_sdvo *intel_sdvo,struct intel_sdvo_tv_format format;u32 format_map; - format_map =1 << conn_state->tv.mode; + format_map =1 << conn_state->tv.legacy_mode;memset (&format,0 ,sizeof (format));memcpy (&format, &format_map,min (sizeof (format),sizeof (format_map)));
@@ -2295,7 +2295,7 @@ static int intel_sdvo_get_tv_modes(struct drm_connector *connector)* Read the list of supported input resolutions for the selected TV * format. */ - format_map =1 << conn_state->tv.mode; + format_map =1 << conn_state->tv.legacy_mode;memcpy (&tv_res, &format_map,min (sizeof (format_map),sizeof (struct intel_sdvo_sdtv_resolution_request )));
@@ -2360,7 +2360,7 @@ intel_sdvo_connector_atomic_get_property(struct drm_connector *connector,int i;for (i =0 ; i < intel_sdvo_connector->format_supported_num; i++) -if (state->tv.mode == intel_sdvo_connector->tv_format_supported[i]) { +if (state->tv.legacy_mode == intel_sdvo_connector->tv_format_supported[i]) { *val = i;return 0 ;
@@ -2416,7 +2416,7 @@ intel_sdvo_connector_atomic_set_property(struct drm_connector *connector,struct intel_sdvo_connector_state *sdvo_state =to_intel_sdvo_connector_state (state);if (property == intel_sdvo_connector->tv_format) { - state->tv.mode = intel_sdvo_connector->tv_format_supported[val]; + state->tv.legacy_mode = intel_sdvo_connector->tv_format_supported[val];if (state->crtc) { struct drm_crtc_state *crtc_state =
@@ -3071,7 +3071,7 @@ static bool intel_sdvo_tv_create_property(struct intel_sdvo *intel_sdvo,drm_property_add_enum (intel_sdvo_connector->tv_format, i, tv_format_names[intel_sdvo_connector->tv_format_supported[i]]); - intel_sdvo_connector->base.base.state->tv.mode = intel_sdvo_connector->tv_format_supported[0 ]; + intel_sdvo_connector->base.base.state->tv.legacy_mode = intel_sdvo_connector->tv_format_supported[0 ];drm_object_attach_property (&intel_sdvo_connector->base.base.base, intel_sdvo_connector->tv_format,0 );return true;
drivers/gpu/drm/i915/display/intel_tv.c +5 -5
@@ -949,7 +949,7 @@ intel_disable_tv(struct intel_atomic_state *state,static const struct tv_mode *intel_tv_mode_find (const struct drm_connector_state *conn_state) { -int format = conn_state->tv.mode; +int format = conn_state->tv.legacy_mode;return &tv_modes[format]; }
@@ -1710,7 +1710,7 @@ static void intel_tv_find_better_format(struct drm_connector *connector)break ; } - connector->state->tv.mode = i; + connector->state->tv.legacy_mode = i; } static int
@@ -1865,7 +1865,7 @@ static int intel_tv_atomic_check(struct drm_connector *connector, old_state =drm_atomic_get_old_connector_state (state, connector); new_crtc_state =drm_atomic_get_new_crtc_state (state, new_state->crtc); - if (old_state->tv.mode != new_state->tv.mode || + if (old_state->tv.legacy_mode != new_state->tv.legacy_mode || old_state->tv.margins.left != new_state->tv.margins.left || old_state->tv.margins.right != new_state->tv.margins.right || old_state->tv.margins.top != new_state->tv.margins.top ||
@@ -1902,7 +1902,7 @@ static void intel_tv_add_properties(struct drm_connector *connector) conn_state->tv.margins.right =46 ; conn_state->tv.margins.bottom =37 ; - conn_state->tv.mode =0 ; + conn_state->tv.legacy_mode =0 ;/* Create TV properties then attach current values */ for (i =0 ; i <ARRAY_SIZE (tv_modes); i++) {
@@ -1916,7 +1916,7 @@ static void intel_tv_add_properties(struct drm_connector *connector)drm_object_attach_property (&connector->base, i915->drm.mode_config.legacy_tv_mode_property, - conn_state->tv.mode); + conn_state->tv.legacy_mode);drm_object_attach_property (&connector->base, i915->drm.mode_config.tv_left_margin_property, conn_state->tv.margins.left);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 262/299 octeontx2-af: Consider the action set by PF
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Subbaraya Sundeep <[email protected]>
[ Upstream commit 3b1ae9b71c2a97f848b00fb085a2bd29bddbe8d9 ]
AF reserves MCAM entries for each PF, VF present in the system and populates the entry with DMAC and action with default RSS so that basic packet I/O works. Since PF/VF is not aware of the RSS action installed by AF, AF only fixup the actions of the rules installed by PF/VF with corresponding default RSS action. This worked well for rules installed by PF/VF for features like RX VLAN offload and DMAC filters but rules involving action like drop/forward to queue are also getting modified by AF. Hence fix it by setting the default RSS action only if requested by PF/VF.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +4 -0
@@ -437,6 +437,10 @@ static void npc_fixup_vf_rule(struct rvu *rvu, struct npc_mcam *mcam,return ; } +/* AF modifies given action iff PF/VF has requested for it */ +if ((entry->action &0xFULL ) !=NIX_RX_ACTION_DEFAULT ) +return ; +/* copy VF default entry action to the VF mcam entry */ rx_action =npc_get_default_entry_action (rvu, mcam, blkaddr, target_func);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 263/299 net: ipa: dont overrun IPA suspend interrupt registers
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Elder <[email protected]>
[ Upstream commit d80f8e96d47d7374794a30fbed69be43f3388afc ]
In newer hardware, IPA supports more than 32 endpoints. Some registers--such as IPA interrupt registers--represent endpoints as bits in a 4-byte register, and such registers are repeated as needed to represent endpoints beyond the first 32.
In ipa_interrupt_suspend_clear_all(), we clear all pending IPA suspend interrupts by reading all status register(s) and writing corresponding registers to clear interrupt conditions.
Unfortunately the number of registers to read/write is calculated incorrectly, and as a result we access *many* more registers than intended. This bug occurs only when the IPA hardware signals a SUSPEND interrupt, which happens when a packet is received for an endpoint (or its underlying GSI channel) that is suspended. This situation is difficult to reproduce, but possible.
Fix this by correctly computing the number of interrupt registers to read and write. This is the only place in the code where registers that map endpoints or channels this way perform this calculation.
--- drivers/net/ipa/ipa_interrupt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ipa/ipa_interrupt.c +1 -1
@@ -212,7 +212,7 @@ void ipa_interrupt_suspend_clear_all(struct ipa_interrupt *interrupt)u32 unit_count;u32 unit; - unit_count =roundup (ipa->endpoint_count,32 ); + unit_count =DIV_ROUND_UP (ipa->endpoint_count,32 );for (unit =0 ; unit < unit_count; unit++) {const struct reg *reg;u32 val;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 264/299 s390: use the correct count for __iowrite64_copy()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gunthorpe <[email protected]>
[ Upstream commit 723a2cc8d69d4342b47dfddbfe6c19f1b135f09b ]
The signature for __iowrite64_copy() requires the number of 64 bit quantities, not bytes. Multiple by 8 to get to a byte length before invoking zpci_memcpy_toio()
--- arch/s390/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/pci/pci.c +1 -1
@@ -241,7 +241,7 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,/* combine single writes by using store-block insn */ void __iowrite64_copy (void __iomem *to,const void *from,size_t count) { -zpci_memcpy_toio (to, from, count); +zpci_memcpy_toio (to, from, count *8 ); } void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 265/299 bpf, sockmap: Fix NULL pointer dereference in sk_psock_verdict_data_ready()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shigeru Yoshida <[email protected]>
[ Upstream commit 4cd12c6065dfcdeba10f49949bffcf383b3952d8 ]
syzbot reported the following NULL pointer dereference issue [1]:
BUG: kernel NULL pointer dereference, address: 0000000000000000 [...] RIP: 0010:0x0 [...] Call Trace: <TASK> sk_psock_verdict_data_ready+0x232/0x340 net/core/skmsg.c:1230 unix_stream_sendmsg+0x9b4/0x1230 net/unix/af_unix.c:2293 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0x221/0x270 net/socket.c:745 ____sys_sendmsg+0x525/0x7d0 net/socket.c:2584 ___sys_sendmsg net/socket.c:2638 [inline] __sys_sendmsg+0x2b0/0x3a0 net/socket.c:2667 do_syscall_64+0xf9/0x240 entry_SYSCALL_64_after_hwframe+0x6f/0x77
If sk_psock_verdict_data_ready() and sk_psock_stop_verdict() are called concurrently, psock->saved_data_ready can be NULL, causing the above issue.
This patch fixes this issue by calling the appropriate data ready function using the sk_psock_data_ready() helper and protecting it from concurrency with sk->sk_callback_lock.
--- net/core/skmsg.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/core/skmsg.c +5 -2
@@ -1226,8 +1226,11 @@ static void sk_psock_verdict_data_ready(struct sock *sk)rcu_read_lock (); psock =sk_psock (sk); -if (psock) - psock->saved_data_ready (sk); +if (psock) { +read_lock_bh (&sk->sk_callback_lock); +sk_psock_data_ready (sk, psock); +read_unlock_bh (&sk->sk_callback_lock); + }rcu_read_unlock (); } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 266/299 cache: ax45mp_cache: Align end size to cache boundary in ax45mp_dma_cache_wback()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lad Prabhakar <[email protected]>
[ Upstream commit 9bd405c48b0ac4de087c0c4440fd79597201b8a7 ]
Align the end size to cache boundary size in ax45mp_dma_cache_wback() callback likewise done in ax45mp_dma_cache_inv() callback.
Additionally return early in case of start == end.
--- drivers/cache/ax45mp_cache.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/cache/ax45mp_cache.c +4 -0
@@ -129,8 +129,12 @@ static void ax45mp_dma_cache_wback(phys_addr_t paddr, size_t size)unsigned long line_size;unsigned long flags; +if (unlikely (start == end)) +return ; + line_size = ax45mp_priv.ax45mp_cache_line_size; start = start & (~(line_size -1 )); + end = ((end + line_size -1 ) & (~(line_size -1 )));local_irq_save (flags);ax45mp_cpu_dcache_wb_range (start, end);local_irq_restore (flags);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 267/299 hwmon: (nct6775) Fix access to temperature configuration registers
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 d56e460e19ea8382f813eb489730248ec8d7eb73 ]
The number of temperature configuration registers does not always match the total number of temperature registers. This can result in access errors reported if KASAN is enabled.
BUG: KASAN: global-out-of-bounds in nct6775_probe+0x5654/0x6fe9 nct6775_core
--- drivers/hwmon/nct6775-core.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/hwmon/nct6775-core.c +12 -2
@@ -3512,6 +3512,7 @@ int nct6775_probe(struct device *dev, struct nct6775_data *data,const u16 *reg_temp_mon, *reg_temp_alternate, *reg_temp_crit;const u16 *reg_temp_crit_l =NULL , *reg_temp_crit_h =NULL ;int num_reg_temp, num_reg_temp_mon, num_reg_tsi_temp; +int num_reg_temp_config;struct device *hwmon_dev;struct sensor_template_group tsi_temp_tg;
@@ -3594,6 +3595,7 @@ int nct6775_probe(struct device *dev, struct nct6775_data *data, reg_temp_over =NCT6106_REG_TEMP_OVER ; reg_temp_hyst =NCT6106_REG_TEMP_HYST ; reg_temp_config =NCT6106_REG_TEMP_CONFIG ; + num_reg_temp_config =ARRAY_SIZE (NCT6106_REG_TEMP_CONFIG ); reg_temp_alternate =NCT6106_REG_TEMP_ALTERNATE ; reg_temp_crit =NCT6106_REG_TEMP_CRIT ; reg_temp_crit_l =NCT6106_REG_TEMP_CRIT_L ;
@@ -3669,6 +3671,7 @@ int nct6775_probe(struct device *dev, struct nct6775_data *data, reg_temp_over =NCT6106_REG_TEMP_OVER ; reg_temp_hyst =NCT6106_REG_TEMP_HYST ; reg_temp_config =NCT6106_REG_TEMP_CONFIG ; + num_reg_temp_config =ARRAY_SIZE (NCT6106_REG_TEMP_CONFIG ); reg_temp_alternate =NCT6106_REG_TEMP_ALTERNATE ; reg_temp_crit =NCT6106_REG_TEMP_CRIT ; reg_temp_crit_l =NCT6106_REG_TEMP_CRIT_L ;
@@ -3746,6 +3749,7 @@ int nct6775_probe(struct device *dev, struct nct6775_data *data, reg_temp_over =NCT6775_REG_TEMP_OVER ; reg_temp_hyst =NCT6775_REG_TEMP_HYST ; reg_temp_config =NCT6775_REG_TEMP_CONFIG ; + num_reg_temp_config =ARRAY_SIZE (NCT6775_REG_TEMP_CONFIG ); reg_temp_alternate =NCT6775_REG_TEMP_ALTERNATE ; reg_temp_crit =NCT6775_REG_TEMP_CRIT ;
@@ -3821,6 +3825,7 @@ int nct6775_probe(struct device *dev, struct nct6775_data *data, reg_temp_over =NCT6775_REG_TEMP_OVER ; reg_temp_hyst =NCT6775_REG_TEMP_HYST ; reg_temp_config =NCT6776_REG_TEMP_CONFIG ; + num_reg_temp_config =ARRAY_SIZE (NCT6776_REG_TEMP_CONFIG ); reg_temp_alternate =NCT6776_REG_TEMP_ALTERNATE ; reg_temp_crit =NCT6776_REG_TEMP_CRIT ;
@@ -3900,6 +3905,7 @@ int nct6775_probe(struct device *dev, struct nct6775_data *data, reg_temp_over =NCT6779_REG_TEMP_OVER ; reg_temp_hyst =NCT6779_REG_TEMP_HYST ; reg_temp_config =NCT6779_REG_TEMP_CONFIG ; + num_reg_temp_config =ARRAY_SIZE (NCT6779_REG_TEMP_CONFIG ); reg_temp_alternate =NCT6779_REG_TEMP_ALTERNATE ; reg_temp_crit =NCT6779_REG_TEMP_CRIT ;
@@ -4034,6 +4040,7 @@ int nct6775_probe(struct device *dev, struct nct6775_data *data, reg_temp_over =NCT6779_REG_TEMP_OVER ; reg_temp_hyst =NCT6779_REG_TEMP_HYST ; reg_temp_config =NCT6779_REG_TEMP_CONFIG ; + num_reg_temp_config =ARRAY_SIZE (NCT6779_REG_TEMP_CONFIG ); reg_temp_alternate =NCT6779_REG_TEMP_ALTERNATE ; reg_temp_crit =NCT6779_REG_TEMP_CRIT ;
@@ -4123,6 +4130,7 @@ int nct6775_probe(struct device *dev, struct nct6775_data *data, reg_temp_over =NCT6798_REG_TEMP_OVER ; reg_temp_hyst =NCT6798_REG_TEMP_HYST ; reg_temp_config =NCT6779_REG_TEMP_CONFIG ; + num_reg_temp_config =ARRAY_SIZE (NCT6779_REG_TEMP_CONFIG ); reg_temp_alternate =NCT6798_REG_TEMP_ALTERNATE ; reg_temp_crit =NCT6798_REG_TEMP_CRIT ;
@@ -4204,7 +4212,8 @@ int nct6775_probe(struct device *dev, struct nct6775_data *data, = reg_temp_crit[src - 1];if (reg_temp_crit_l && reg_temp_crit_l[i]) data->reg_temp[4 ][src -1 ] = reg_temp_crit_l[i]; - data->reg_temp_config[src -1 ] = reg_temp_config[i]; +if (i < num_reg_temp_config) + data->reg_temp_config[src -1 ] = reg_temp_config[i]; data->temp_src[src -1 ] = src;continue ; }
@@ -4217,7 +4226,8 @@ int nct6775_probe(struct device *dev, struct nct6775_data *data, data->reg_temp[0 ][s] = reg_temp[i]; data->reg_temp[1 ][s] = reg_temp_over[i]; data->reg_temp[2 ][s] = reg_temp_hyst[i]; - data->reg_temp_config[s] = reg_temp_config[i]; +if (i < num_reg_temp_config) + data->reg_temp_config[s] = reg_temp_config[i];if (reg_temp_crit_h && reg_temp_crit_h[i]) data->reg_temp[3 ][s] = reg_temp_crit_h[i];else if (reg_temp_crit[src -1 ])
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 268/299 tls: break out of main loop when PEEK gets a non-data record
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sabrina Dubroca <[email protected]>
[ Upstream commit 10f41d0710fc81b7af93fa6106678d57b1ff24a7 ]
PEEK needs to leave decrypted records on the rx_list so that we can receive them later on, so it jumps back into the async code that queues the skb. Unfortunately that makes us skip the TLS_RECORD_TYPE_DATA check at the bottom of the main loop, so if two records of the same (non-DATA) type are queued, we end up merging them.
Add the same record type check, and make it unlikely to not penalize the async fastpath. Async decrypt only applies to data record, so this check is only needed for PEEK.
process_rx_list also has similar issues.
--- net/tls/tls_sw.c | 2 ++ 1 file changed, 2 insertions(+)
net/tls/tls_sw.c +2 -0
@@ -2064,6 +2064,8 @@ int tls_sw_recvmsg(struct sock *sk, decrypted += chunk; len -= chunk;__skb_queue_tail (&ctx->rx_list, skb); +if (unlikely (control !=TLS_RECORD_TYPE_DATA )) +break ;continue ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 269/299 tls: stop recv() if initial process_rx_list gave us non-DATA
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sabrina Dubroca <[email protected]>
[ Upstream commit fdfbaec5923d9359698cbb286bc0deadbb717504 ]
If we have a non-DATA record on the rx_list and another record of the same type still on the queue, we will end up merging them:
- process_rx_list copies the non-DATA record
- we start the loop and process the first available record since it's of the same type
- we break out of the loop since the record was not DATA
Just check the record type and jump to the end in case process_rx_list did some work.
--- net/tls/tls_sw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/tls/tls_sw.c +1 -1
@@ -1971,7 +1971,7 @@ int tls_sw_recvmsg(struct sock *sk, goto end; copied = err; -if (len <= copied) +if (len <= copied || (copied && control !=TLS_RECORD_TYPE_DATA )) goto end; target =sock_rcvlowat (sk, flags &MSG_WAITALL , len);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 270/299 tls: dont skip over different type records from the rx_list
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sabrina Dubroca <[email protected]>
[ Upstream commit ec823bf3a479d42c589dc0f28ef4951c49cd2d2a ]
If we queue 3 records:
- record 1, type DATA
- record 2, some other type
- record 3, type DATA
and do a recv(PEEK), the rx_list will contain the first two records.
The next large recv will walk through the rx_list and copy data from record 1, then stop because record 2 is a different type. Since we haven't filled up our buffer, we will process the next available record. It's also DATA, so we can merge it with the current read.
We shouldn't do that, since there was a record in between that we ignored.
Add a flag to let process_rx_list inform tls_sw_recvmsg that it had more data available.
--- net/tls/tls_sw.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
net/tls/tls_sw.c +14 -8
@@ -1772,7 +1772,8 @@ static int process_rx_list(struct tls_sw_context_rx *ctx,u8 *control, size_t skip, size_t len, - bool is_peek) + bool is_peek, + bool *more) { struct sk_buff *skb = skb_peek(&ctx->rx_list);struct tls_msg *tlm;
@@ -1785,7 +1786,7 @@ static int process_rx_list(struct tls_sw_context_rx *ctx, err =tls_record_content_type (msg, tlm, control);if (err <=0 ) - goto out; + goto more;if (skip < rxm->full_len)break ;
@@ -1803,12 +1804,12 @@ static int process_rx_list(struct tls_sw_context_rx *ctx, err =tls_record_content_type (msg, tlm, control);if (err <=0 ) - goto out; + goto more; err =skb_copy_datagram_msg (skb, rxm->offset + skip, msg, chunk);if (err <0 ) - goto out; + goto more; len = len - chunk; copied = copied + chunk;
@@ -1844,6 +1845,10 @@ static int process_rx_list(struct tls_sw_context_rx *ctx, out:return copied ? : err; +more: +if (more) + *more = true; + goto out; } static bool
@@ -1947,6 +1952,7 @@ int tls_sw_recvmsg(struct sock *sk,int target, err;bool is_kvec =iov_iter_is_kvec (&msg->msg_iter);bool is_peek = flags &MSG_PEEK ; +bool rx_more = false;bool released = true;bool bpf_strp_enabled;bool zc_capable;
@@ -1966,12 +1972,12 @@ int tls_sw_recvmsg(struct sock *sk, goto end;/* Process pending decrypted records. It must be non-zero-copy */ - err =process_rx_list (ctx, msg, &control,0 , len, is_peek); + err =process_rx_list (ctx, msg, &control,0 , len, is_peek, &rx_more);if (err <0 ) goto end; copied = err; -if (len <= copied || (copied && control !=TLS_RECORD_TYPE_DATA )) +if (len <= copied || (copied && control !=TLS_RECORD_TYPE_DATA ) || rx_more) goto end; target =sock_rcvlowat (sk, flags &MSG_WAITALL , len);
@@ -2130,10 +2136,10 @@ int tls_sw_recvmsg(struct sock *sk,/* Drain records from the rx_list & copy if required */ if (is_peek || is_kvec) err =process_rx_list (ctx, msg, &control, copied, - decrypted, is_peek); + decrypted, is_peek,NULL );else err =process_rx_list (ctx, msg, &control,0 , - async_copy_bytes, is_peek); + async_copy_bytes, is_peek,NULL ); } copied += decrypted;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 271/299 netfilter: nf_tables: set dormant flag on hook register failure
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 bccebf64701735533c8db37773eeacc6566cc8ec ]
We need to set the dormant flag again if we fail to register the hooks.
During memory pressure hook registration can fail and we end up with a table marked as active but no registered hooks.
On table/base chain deletion, nf_tables will attempt to unregister the hook again which yields a warn splat from the nftables core.
--- net/netfilter/nf_tables_api.c | 1 + 1 file changed, 1 insertion(+)
net/netfilter/nf_tables_api.c +1 -0
@@ -1253,6 +1253,7 @@ static int nf_tables_updtable(struct nft_ctx *ctx)return 0 ; err_register_hooks: + ctx->table->flags |=NFT_TABLE_F_DORMANT ;nft_trans_destroy (trans);return ret; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 272/299 netfilter: nft_flow_offload: reset dst in route object after setting up flow
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 9e0f0430389be7696396c62f037be4bf72cf93e3 ]
dst is transferred to the flow object, route object does not own it anymore. Reset dst in route object, otherwise if flow_offload_add() fails, error path releases dst twice, leading to a refcount underflow.
--- include/net/netfilter/nf_flow_table.h | 2 +- net/netfilter/nf_flow_table_core.c | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-)
include/net/netfilter/nf_flow_table.h +1 -1
@@ -275,7 +275,7 @@ nf_flow_table_offload_del_cb(struct nf_flowtable *flow_table, }void flow_offload_route_init (struct flow_offload *flow, -const struct nf_flow_route *route); +struct nf_flow_route *route);int flow_offload_add (struct nf_flowtable *flow_table,struct flow_offload *flow); void flow_offload_refresh(struct nf_flowtable *flow_table,
net/netfilter/nf_flow_table_core.c +13 -3
@@ -87,12 +87,22 @@ static u32 flow_offload_dst_cookie(struct flow_offload_tuple *flow_tuple)return 0 ; } +static struct dst_entry *nft_route_dst_fetch (struct nf_flow_route *route, +enum flow_offload_tuple_dir dir) +{ +struct dst_entry *dst = route->tuple[dir].dst; + + route->tuple[dir].dst =NULL ; + +return dst; +} +static int flow_offload_fill_route (struct flow_offload *flow, -const struct nf_flow_route *route, +struct nf_flow_route *route,enum flow_offload_tuple_dir dir) {struct flow_offload_tuple *flow_tuple = &flow->tuplehash[dir].tuple; -struct dst_entry *dst = route->tuple[dir].dst; +struct dst_entry *dst =nft_route_dst_fetch (route, dir);int i, j =0 ;switch (flow_tuple->l3proto) {
@@ -146,7 +156,7 @@ static void nft_flow_dst_release(struct flow_offload *flow, }void flow_offload_route_init (struct flow_offload *flow, -const struct nf_flow_route *route) +struct nf_flow_route *route) {flow_offload_fill_route (flow, route,FLOW_OFFLOAD_DIR_ORIGINAL );flow_offload_fill_route (flow, route,FLOW_OFFLOAD_DIR_REPLY );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 273/299 netfilter: nft_flow_offload: release dst in case direct xmit path is used
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 8762785f459be1cfe6fcf7285c123aad6a3703f0 ]
Direct xmit does not use it since it calls dev_queue_xmit() to send packets, hence it calls dst_release().
kmemleak reports:
unreferenced object 0xffff88814f440900 (size 184):
comm "softirq", pid 0, jiffies 4294951896 hex dump (first 32 bytes):
00 60 5b 04 81 88 ff ff 00 e6 e8 82 ff ff ff ff .`[.............
21 0b 50 82 ff ff ff ff 00 00 00 00 00 00 00 00 !.P.............
backtrace (crc cb2bf5d6):
[<000000003ee17107>] kmem_cache_alloc+0x286/0x340
[<0000000021a5de2c>] dst_alloc+0x43/0xb0
[<00000000f0671159>] rt_dst_alloc+0x2e/0x190
[<00000000fe5092c9>] __mkroute_output+0x244/0x980
[<000000005fb96fb0>] ip_route_output_flow+0xc0/0x160
[<0000000045367433>] nf_ip_route+0xf/0x30
[<0000000085da1d8e>] nf_route+0x2d/0x60
[<00000000d1ecd1cb>] nft_flow_route+0x171/0x6a0 [nft_flow_offload]
[<00000000d9b2fb60>] nft_flow_offload_eval+0x4e8/0x700 [nft_flow_offload]
[<000000009f447dbb>] expr_call_ops_eval+0x53/0x330 [nf_tables]
[<00000000072e1be6>] nft_do_chain+0x17c/0x840 [nf_tables]
[<00000000d0551029>] nft_do_chain_inet+0xa1/0x210 [nf_tables]
[<0000000097c9d5c6>] nf_hook_slow+0x5b/0x160
[<0000000005eccab1>] ip_forward+0x8b6/0x9b0
[<00000000553a269b>] ip_rcv+0x221/0x230
[<00000000412872e5>] __netif_receive_skb_one_core+0xfe/0x110--- net/netfilter/nf_flow_table_core.c | 1 + 1 file changed, 1 insertion(+)
net/netfilter/nf_flow_table_core.c +1 -0
@@ -132,6 +132,7 @@ static int flow_offload_fill_route(struct flow_offload *flow, ETH_ALEN); flow_tuple->out.ifidx = route->tuple[dir].out.ifindex; flow_tuple->out.hw_ifidx = route->tuple[dir].out.hw_ifindex; +dst_release (dst);break ;case FLOW_OFFLOAD_XMIT_XFRM :case FLOW_OFFLOAD_XMIT_NEIGH :
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 274/299 netfilter: nf_tables: register hooks last when adding new chain/flowtable
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit d472e9853d7b46a6b094224d131d09ccd3a03daf ]
Register hooks last when adding chain/flowtable to ensure that packets do not walk over datastructure that is being released in the error path without waiting for the rcu grace period.
--- net/netfilter/nf_tables_api.c | 78 ++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 38 deletions(-)
net/netfilter/nf_tables_api.c +40 -38
@@ -686,15 +686,16 @@ static int nft_delobj(struct nft_ctx *ctx, struct nft_object *obj)return err; } -static int nft_trans_flowtable_add (struct nft_ctx *ctx,int msg_type, -struct nft_flowtable *flowtable) +static struct nft_trans * +nft_trans_flowtable_add (struct nft_ctx *ctx,int msg_type, +struct nft_flowtable *flowtable) {struct nft_trans *trans; trans =nft_trans_alloc (ctx, msg_type,sizeof (struct nft_trans_flowtable ));if (trans ==NULL ) -return -ENOMEM ; +return ERR_PTR (-ENOMEM );if (msg_type ==NFT_MSG_NEWFLOWTABLE )nft_activate_next (ctx->net, flowtable);
@@ -703,22 +704,22 @@ static int nft_trans_flowtable_add(struct nft_ctx *ctx, int msg_type,nft_trans_flowtable (trans) = flowtable;nft_trans_commit_list_add_tail (ctx->net, trans); -return 0 ; +return trans; }static int nft_delflowtable (struct nft_ctx *ctx,struct nft_flowtable *flowtable) { -int err; +struct nft_trans *trans; - err =nft_trans_flowtable_add (ctx,NFT_MSG_DELFLOWTABLE , flowtable); -if (err <0 ) -return err; + trans =nft_trans_flowtable_add (ctx,NFT_MSG_DELFLOWTABLE , flowtable); +if (IS_ERR (trans)) +return PTR_ERR (trans);nft_deactivate_next (ctx->net, flowtable);nft_use_dec (&ctx->table->use); -return err; +return 0 ; }static void __nft_reg_track_clobber (struct nft_regs_track *track,u8 dreg)
@@ -2506,19 +2507,15 @@ static int nf_tables_addchain(struct nft_ctx *ctx, u8 family, u8 genmask,RCU_INIT_POINTER (chain->blob_gen_0, blob);RCU_INIT_POINTER (chain->blob_gen_1, blob); - err =nf_tables_register_hook (net, table, chain); -if (err <0 ) - goto err_destroy_chain; -if (!nft_use_inc (&table->use)) { err = -EMFILE ; - goto err_use; + goto err_destroy_chain; } trans =nft_trans_chain_add (ctx,NFT_MSG_NEWCHAIN );if (IS_ERR (trans)) { err =PTR_ERR (trans); - goto err_unregister_hook; + goto err_trans; }nft_trans_chain_policy (trans) =NFT_CHAIN_POLICY_UNSET ;
@@ -2526,17 +2523,22 @@ static int nf_tables_addchain(struct nft_ctx *ctx, u8 family, u8 genmask,nft_trans_chain_policy (trans) = policy; err =nft_chain_add (table, chain); -if (err <0 ) { -nft_trans_destroy (trans); - goto err_unregister_hook; - } +if (err <0 ) + goto err_chain_add; + +/* This must be LAST to ensure no packets are walking over this chain. */ + err =nf_tables_register_hook (net, table, chain); +if (err <0 ) + goto err_register_hook;return 0 ; -err_unregister_hook: +err_register_hook: +nft_chain_del (chain); +err_chain_add: +nft_trans_destroy (trans); +err_trans:nft_use_dec_restore (&table->use); -err_use: -nf_tables_unregister_hook (net, table, chain); err_destroy_chain:nf_tables_chain_destroy (ctx);
@@ -8334,9 +8336,9 @@ static int nf_tables_newflowtable(struct sk_buff *skb,u8 family = info->nfmsg->nfgen_family;const struct nf_flowtable_type *type;struct nft_flowtable *flowtable; -struct nft_hook *hook, *next;struct net *net = info->net;struct nft_table *table; +struct nft_trans *trans;struct nft_ctx ctx;int err;
@@ -8416,34 +8418,34 @@ static int nf_tables_newflowtable(struct sk_buff *skb, err =nft_flowtable_parse_hook (&ctx, nla, &flowtable_hook, flowtable, extack, true);if (err <0 ) - goto err4; + goto err_flowtable_parse_hooks;list_splice (&flowtable_hook.list, &flowtable->hook_list); flowtable->data.priority = flowtable_hook.priority; flowtable->hooknum = flowtable_hook.num; + trans =nft_trans_flowtable_add (&ctx,NFT_MSG_NEWFLOWTABLE , flowtable); +if (IS_ERR (trans)) { + err =PTR_ERR (trans); + goto err_flowtable_trans; + } + +/* This must be LAST to ensure no packets are walking over this flowtable. */ err =nft_register_flowtable_net_hooks (ctx.net, table, &flowtable->hook_list, flowtable); -if (err <0 ) { -nft_hooks_destroy (&flowtable->hook_list); - goto err4; - } - - err =nft_trans_flowtable_add (&ctx,NFT_MSG_NEWFLOWTABLE , flowtable);if (err <0 ) - goto err5; + goto err_flowtable_hooks;list_add_tail_rcu (&flowtable->list, &table->flowtables);return 0 ; -err5: -list_for_each_entry_safe (hook, next, &flowtable->hook_list, list) { -nft_unregister_flowtable_hook (net, flowtable, hook); -list_del_rcu (&hook->list); -kfree_rcu (hook, rcu); - } -err4: + +err_flowtable_hooks: +nft_trans_destroy (trans); +err_flowtable_trans: +nft_hooks_destroy (&flowtable->hook_list); +err_flowtable_parse_hooks: flowtable->data.type->free (&flowtable->data); err3:module_put (type->owner);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 275/299 netfilter: nf_tables: use kzalloc for hook allocation
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 195e5f88c2e48330ba5483e0bad2de3b3fad484f ]
KMSAN reports unitialized variable when registering the hook,
reg->hook_ops_type == NF_HOOK_OP_BPF)
~~~~~~~~~~~ undefined
This is a small structure, just use kzalloc to make sure this won't happen again when new fields get added to nf_hook_ops.
--- net/netfilter/nf_tables_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_tables_api.c +1 -1
@@ -2084,7 +2084,7 @@ static struct nft_hook *nft_netdev_hook_alloc(struct net *net,struct nft_hook *hook;int err; - hook =kmalloc (sizeof (struct nft_hook ),GFP_KERNEL_ACCOUNT ); + hook =kzalloc (sizeof (struct nft_hook ),GFP_KERNEL_ACCOUNT );if (!hook) { err = -ENOMEM ; goto err_hook_alloc;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 276/299 net: mctp: put sock on tag allocation failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeremy Kerr <[email protected]>
[ Upstream commit 9990889be14288d4f1743e4768222d5032a79c27 ]
We may hold an extra reference on a socket if a tag allocation fails: we optimistically allocate the sk_key, and take a ref there, but do not drop if we end up not using the allocated key.
Ensure we're dropping the sock on this failure by doing a proper unref rather than directly kfree()ing.
--- net/mctp/route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mctp/route.c +1 -1
@@ -663,7 +663,7 @@ struct mctp_sk_key *mctp_alloc_local_tag(struct mctp_sock *msk,spin_unlock_irqrestore (&mns->keys_lock, flags);if (!tagbits) { -kfree (key); +mctp_key_unref (key);return ERR_PTR (-EBUSY ); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 277/299 tools: ynl: make sure we always pass yarg to mnl_cb_run
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit e4fe082c38cd74a8fa384bc7542cf3edf1cb7318 ]
There is one common error handler in ynl - ynl_cb_error(). It expects priv to be a pointer to struct ynl_parse_arg AKA yarg. To avoid potential crashes if we encounter a stray NLMSG_ERROR always pass yarg as priv (or a struct which has it as the first member).
ynl_cb_null() has a similar problem directly - it expects yarg but priv passed by the caller is ys.
Found by code inspection.
--- tools/net/ynl/lib/ynl.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
tools/net/ynl/lib/ynl.c +8 -3
@@ -450,6 +450,8 @@ ynl_gemsg_start_dump(struct ynl_sock *ys, __u32 id, __u8 cmd, __u8 version)int ynl_recv_ack (struct ynl_sock *ys,int ret) { +struct ynl_parse_arg yarg = { .ys = ys, }; +if (!ret) {yerr (ys,YNL_ERROR_EXPECT_ACK ,"Expecting an ACK but nothing received" );
@@ -462,7 +464,7 @@ int ynl_recv_ack(struct ynl_sock *ys, int ret)return ret; }return mnl_cb_run (ys->rx_buf, ret, ys->seq, ys->portid, - ynl_cb_null, ys); + ynl_cb_null, &yarg); }int ynl_cb_null (const struct nlmsghdr *nlh,void *data)
@@ -725,11 +727,14 @@ static int ynl_ntf_parse(struct ynl_sock *ys, const struct nlmsghdr *nlh)static int ynl_ntf_trampoline (const struct nlmsghdr *nlh,void *data) { -return ynl_ntf_parse ((struct ynl_sock *)data, nlh); +struct ynl_parse_arg *yarg = data; + +return ynl_ntf_parse (yarg->ys, nlh); }int ynl_ntf_check (struct ynl_sock *ys) { +struct ynl_parse_arg yarg = { .ys = ys, };ssize_t len;int err;
@@ -751,7 +756,7 @@ int ynl_ntf_check(struct ynl_sock *ys)return len; err =mnl_cb_run2 (ys->rx_buf, len, ys->seq, ys->portid, - ynl_ntf_trampoline, ys, + ynl_ntf_trampoline, &yarg, ynl_cb_array,NLMSG_MIN_TYPE );if (err <0 )return err;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 278/299 tools: ynl: dont leak mcast_groups on init error
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 5d78b73e851455d525a064f3b042b29fdc0c1a4a ]
Make sure to free the already-parsed mcast_groups if we don't get an ack from the kernel when reading family info. This is part of the ynl_sock_create() error path, so we won't get a call to ynl_sock_destroy() to free them later.
--- tools/net/ynl/lib/ynl.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
tools/net/ynl/lib/ynl.c +7 -1
@@ -572,7 +572,13 @@ static int ynl_sock_read_family(struct ynl_sock *ys, const char *family_name)return err; } -return ynl_recv_ack (ys, err); + err =ynl_recv_ack (ys, err); +if (err <0 ) { +free (ys->mcast_groups); +return err; + } + +return 0 ; } struct ynl_sock *
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 279/299 devlink: fix port dump cmd type
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Pirko <[email protected]>
[ Upstream commit 61c43780e9444123410cd48c2483e01d2b8f75e8 ]
Unlike other commands, due to a c&p error, port dump fills-up cmd with wrong value, different from port-get request cmd, port-get doit reply and port notification.
Fix it by filling cmd with value DEVLINK_CMD_PORT_NEW.
Skimmed through devlink userspace implementations, none of them cares about this cmd value. Only ynl, for which, this is actually a fix, as it expects doit and dumpit ops rsp_value to be the same.
Omit the fixes tag, even thought this is fix, better to target this for next release.
--- net/devlink/port.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/devlink/port.c +1 -1
@@ -574,7 +574,7 @@ devlink_nl_port_get_dump_one(struct sk_buff *msg, struct devlink *devlink,xa_for_each_start (&devlink->ports, port_index, devlink_port, state->idx) { err =devlink_nl_port_fill (msg, devlink_port, -DEVLINK_CMD_NEW , +DEVLINK_CMD_PORT_NEW ,NETLINK_CB (cb->skb).portid, cb->nlh->nlmsg_seq, flags, cb->extack);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 280/299 net/sched: flower: Add lock protection when remove filter handle
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jianbo Liu <[email protected]>
[ Upstream commit 1fde0ca3a0de7e9f917668941156959dd5e9108b ]
As IDR can't protect itself from the concurrent modification, place idr_remove() under the protection of tp->lock.
--- net/sched/cls_flower.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/sched/cls_flower.c +4 -1
@@ -2460,8 +2460,11 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, } errout_idr: -if (!fold) +if (!fold) { +spin_lock (&tp->lock);idr_remove (&head->handle_idr, fnew->handle); +spin_unlock (&tp->lock); + }__fl_put (fnew); errout_tb:kfree (tb);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 281/299 net: sparx5: Add spinlock for frame transmission from CPU
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Horatiu Vultur <[email protected]>
[ Upstream commit 603ead96582d85903baec2d55f021b8dac5c25d2 ]
Both registers used when doing manual injection or fdma injection are shared between all the net devices of the switch. It was noticed that when having two process which each of them trying to inject frames on different ethernet ports, that the HW started to behave strange, by sending out more frames then expected. When doing fdma injection it is required to set the frame in the DCB and then make sure that the next pointer of the last DCB is invalid. But because there is no locks for this, then easily this pointer between the DCB can be broken and then it would create a loop of DCBs. And that means that the HW will continuously transmit these frames in a loop. Until the SW will break this loop.
Therefore to fix this issue, add a spin lock for when accessing the registers for manual or fdma injection.
--- drivers/net/ethernet/microchip/sparx5/sparx5_main.c | 1 + drivers/net/ethernet/microchip/sparx5/sparx5_main.h | 1 + drivers/net/ethernet/microchip/sparx5/sparx5_packet.c | 2 ++ 3 files changed, 4 insertions(+)
drivers/net/ethernet/microchip/sparx5/sparx5_main.c +1 -0
@@ -757,6 +757,7 @@ static int mchp_sparx5_probe(struct platform_device *pdev)platform_set_drvdata (pdev, sparx5); sparx5->pdev = pdev; sparx5->dev = &pdev->dev; +spin_lock_init (&sparx5->tx_lock);/* Do switch core reset if available */ reset =devm_reset_control_get_optional_shared (&pdev->dev,"switch" );
drivers/net/ethernet/microchip/sparx5/sparx5_main.h +1 -0
@@ -280,6 +280,7 @@ struct sparx5 {int xtr_irq;/* Frame DMA */ int fdma_irq; +spinlock_t tx_lock;/* lock for frame transmission */ struct sparx5_rx rx;struct sparx5_tx tx;/* PTP */
drivers/net/ethernet/microchip/sparx5/sparx5_packet.c +2 -0
@@ -244,10 +244,12 @@ netdev_tx_t sparx5_port_xmit_impl(struct sk_buff *skb, struct net_device *dev) }skb_tx_timestamp (skb); +spin_lock (&sparx5->tx_lock);if (sparx5->fdma_irq >0 ) ret =sparx5_fdma_xmit (sparx5, ifh, skb);else ret =sparx5_inject (sparx5, ifh, skb, dev); +spin_unlock (&sparx5->tx_lock);if (ret == -EBUSY ) goto busy;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 282/299 phonet: take correct lock to peek at the RX queue
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rémi Denis-Courmont <[email protected]>
[ Upstream commit 3b2d9bc4d4acdf15a876eae2c0d83149250e85ba ]
The receive queue is protected by its embedded spin-lock, not the socket lock, so we need the former lock here (and only that one).
--- net/phonet/datagram.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/phonet/datagram.c +2 -2
@@ -34,10 +34,10 @@ static int pn_ioctl(struct sock *sk, int cmd, int *karg)switch (cmd) {case SIOCINQ : -lock_sock (sk); +spin_lock_bh (&sk->sk_receive_queue.lock); skb =skb_peek (&sk->sk_receive_queue); *karg = skb ? skb->len :0 ; -release_sock (sk); +spin_unlock_bh (&sk->sk_receive_queue.lock);return 0 ;case SIOCPNADDRESOURCE :
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 283/299 phonet/pep: fix racy skb_queue_empty() use
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rémi Denis-Courmont <[email protected]>
[ Upstream commit 7d2a894d7f487dcb894df023e9d3014cf5b93fe5 ]
The receive queues are protected by their respective spin-lock, not the socket lock. This could lead to skb_peek() unexpectedly returning NULL or a pointer to an already dequeued socket buffer.
--- net/phonet/pep.c | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-)
net/phonet/pep.c +32 -9
@@ -917,6 +917,37 @@ static int pep_sock_enable(struct sock *sk, struct sockaddr *addr, int len)return 0 ; } +static unsigned int pep_first_packet_length (struct sock *sk) +{ +struct pep_sock *pn =pep_sk (sk); +struct sk_buff_head *q; +struct sk_buff *skb; +unsigned int len =0 ; +bool found = false; + +if (sock_flag (sk,SOCK_URGINLINE )) { + q = &pn->ctrlreq_queue; +spin_lock_bh (&q->lock); + skb =skb_peek (q); +if (skb) { + len = skb->len; + found = true; + } +spin_unlock_bh (&q->lock); + } + +if (likely (!found)) { + q = &sk->sk_receive_queue; +spin_lock_bh (&q->lock); + skb =skb_peek (q); +if (skb) + len = skb->len; +spin_unlock_bh (&q->lock); + } + +return len; +} +static int pep_ioctl (struct sock *sk,int cmd,int *karg) {struct pep_sock *pn =pep_sk (sk);
@@ -929,15 +960,7 @@ static int pep_ioctl(struct sock *sk, int cmd, int *karg)break ; } -lock_sock (sk); -if (sock_flag (sk,SOCK_URGINLINE ) && - !skb_queue_empty (&pn->ctrlreq_queue)) - *karg =skb_peek (&pn->ctrlreq_queue)->len; -else if (!skb_queue_empty (&sk->sk_receive_queue)) - *karg =skb_peek (&sk->sk_receive_queue)->len; -else - *karg =0 ; -release_sock (sk); + *karg =pep_first_packet_length (sk); ret =0 ;break ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 284/299 Fix write to cloned skb in ipv6_hop_ioam()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Justin Iurman <[email protected]>
[ Upstream commit f198d933c2e4f8f89e0620fbaf1ea7eac384a0eb ]
ioam6_fill_trace_data() writes inside the skb payload without ensuring it's writeable (e.g., not cloned). This function is called both from the input and output path. The output path (ioam6_iptunnel) already does the check. This commit provides a fix for the input path, inside ipv6_hop_ioam(). It also updates ip6_parse_tlv() to refresh the network header pointer ("nh") when returning from ipv6_hop_ioam().
--- net/ipv6/exthdrs.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
net/ipv6/exthdrs.c +10 -0
@@ -177,6 +177,8 @@ static bool ip6_parse_tlv(bool hopbyhop,case IPV6_TLV_IOAM :if (!ipv6_hop_ioam (skb, off))return false; + + nh =skb_network_header (skb);break ;case IPV6_TLV_JUMBO :if (!ipv6_hop_jumbo (skb, off))
@@ -943,6 +945,14 @@ static bool ipv6_hop_ioam(struct sk_buff *skb, int optoff)if (!skb_valid_dst (skb))ip6_route_input (skb); +/* About to mangle packet header */ +if (skb_ensure_writable (skb, optoff +2 + hdr->opt_len)) + goto drop; + +/* Trace pointer may have changed */ + trace = (struct ioam6_trace_hdr *)(skb_network_header (skb) + + optoff +sizeof (*hdr)); +ioam6_fill_trace_data (skb, ns, trace, true);break ;default :
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 285/299 net: phy: realtek: Fix rtl8211f_config_init() for RTL8211F(D)(I)-VD-CG PHY
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Siddharth Vadapalli <[email protected]>
[ Upstream commit 3489182b11d35f1944c1245fc9c4867cf622c50f ]
Commit bb726b753f75 ("net: phy: realtek: add support for RTL8211F(D)(I)-VD-CG") extended support of the driver from the existing support for RTL8211F(D)(I)-CG PHY to the newer RTL8211F(D)(I)-VD-CG PHY.
While that commit indicated that the RTL8211F_PHYCR2 register is not supported by the "VD-CG" PHY model and therefore updated the corresponding section in rtl8211f_config_init() to be invoked conditionally, the call to "genphy_soft_reset()" was left as-is, when it should have also been invoked conditionally. This is because the call to "genphy_soft_reset()" was first introduced by the commit 0a4355c2b7f8 ("net: phy: realtek: add dt property to disable CLKOUT clock") since the RTL8211F guide indicates that a PHY reset should be issued after setting bits in the PHYCR2 register.
As the PHYCR2 register is not applicable to the "VD-CG" PHY model, fix the rtl8211f_config_init() function by invoking "genphy_soft_reset()" conditionally based on the presence of the "PHYCR2" register.
--- drivers/net/phy/realtek.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/phy/realtek.c +3 -1
@@ -421,9 +421,11 @@ static int rtl8211f_config_init(struct phy_device *phydev) ERR_PTR(ret));return ret; } + +return genphy_soft_reset (phydev); } -return genphy_soft_reset (phydev); +return 0 ; }static int rtl821x_suspend (struct phy_device *phydev)
Signature · 1 line
2.43.0